package ib;

import android.app.Application;
import android.content.Context;
import ca.canadapost.core.data.db.cupboard.model.CustomsFormObject;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/* loaded from: classes4.dex */
public final class o0 extends androidx.lifecycle.b {

    /* renamed from: c, reason: collision with root package name */
    private final s0 f22910c;

    /* renamed from: d, reason: collision with root package name */
    private final d9.f f22911d;

    /* renamed from: e, reason: collision with root package name */
    private final aa.a f22912e;

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

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

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

    /* renamed from: i, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22916i;

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

    /* renamed from: k, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22918k;

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

    /* renamed from: m, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22920m;

    /* renamed from: n, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22921n;

    /* renamed from: o, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22922o;

    /* renamed from: p, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22923p;

    /* renamed from: q, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22924q;

    /* renamed from: r, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22925r;

    /* renamed from: s, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22926s;

    /* renamed from: t, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22927t;

    /* renamed from: u, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22928u;

    /* renamed from: v, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22929v;

    /* renamed from: w, reason: collision with root package name */
    private final androidx.lifecycle.f0 f22930w;

    /* loaded from: classes4.dex */
    static final class a extends kotlin.jvm.internal.v implements dn.l {
        a() {
            super(1);
        }

        public final void a(String str) {
            o0.this.i0();
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((String) obj);
            return rm.n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class b implements androidx.lifecycle.g0, kotlin.jvm.internal.n {

        /* renamed from: a, reason: collision with root package name */
        private final /* synthetic */ dn.l f22932a;

        b(dn.l function) {
            kotlin.jvm.internal.t.g(function, "function");
            this.f22932a = function;
        }

        @Override // kotlin.jvm.internal.n
        public final rm.i b() {
            return this.f22932a;
        }

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f22932a.invoke(obj);
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof androidx.lifecycle.g0) && (obj instanceof kotlin.jvm.internal.n)) {
                return kotlin.jvm.internal.t.b(b(), ((kotlin.jvm.internal.n) obj).b());
            }
            return false;
        }

        public final int hashCode() {
            return b().hashCode();
        }
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public o0(t7.c contextService, w8.r shareDataService, s0 customsFormObjectDataManager, d9.f analyticsService, aa.a iInAppReviewRepository) {
        super((Application) r6);
        androidx.lifecycle.f0 n10;
        androidx.lifecycle.f0 o10;
        androidx.lifecycle.f0 h10;
        List<CustomsFormObject.CustomsFormArticleObject> list;
        androidx.lifecycle.f0 j10;
        androidx.lifecycle.f0 g10;
        androidx.lifecycle.f0 l10;
        androidx.lifecycle.f0 u10;
        androidx.lifecycle.f0 t10;
        androidx.lifecycle.f0 r10;
        androidx.lifecycle.f0 v10;
        androidx.lifecycle.f0 w10;
        androidx.lifecycle.f0 x10;
        androidx.lifecycle.f0 p10;
        androidx.lifecycle.f0 y10;
        androidx.lifecycle.f0 s10;
        androidx.lifecycle.f0 D;
        androidx.lifecycle.f0 E;
        androidx.lifecycle.f0 z10;
        androidx.lifecycle.f0 G;
        androidx.lifecycle.f0 C;
        kotlin.jvm.internal.t.g(contextService, "contextService");
        kotlin.jvm.internal.t.g(shareDataService, "shareDataService");
        kotlin.jvm.internal.t.g(customsFormObjectDataManager, "customsFormObjectDataManager");
        kotlin.jvm.internal.t.g(analyticsService, "analyticsService");
        kotlin.jvm.internal.t.g(iInAppReviewRepository, "iInAppReviewRepository");
        Context a10 = contextService.a();
        kotlin.jvm.internal.t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f22910c = customsFormObjectDataManager;
        this.f22911d = analyticsService;
        this.f22912e = iInAppReviewRepository;
        l8.g gVar = new l8.g();
        this.f22913f = gVar;
        this.f22914g = gVar;
        androidx.lifecycle.f0 f0Var = new androidx.lifecycle.f0();
        this.f22916i = f0Var;
        androidx.lifecycle.f0 f0Var2 = new androidx.lifecycle.f0();
        this.f22917j = f0Var2;
        androidx.lifecycle.f0 f0Var3 = new androidx.lifecycle.f0();
        this.f22918k = f0Var3;
        androidx.lifecycle.f0 f0Var4 = new androidx.lifecycle.f0();
        this.f22919l = f0Var4;
        androidx.lifecycle.f0 f0Var5 = new androidx.lifecycle.f0();
        this.f22920m = f0Var5;
        androidx.lifecycle.f0 f0Var6 = new androidx.lifecycle.f0();
        this.f22921n = f0Var6;
        androidx.lifecycle.f0 f0Var7 = new androidx.lifecycle.f0();
        this.f22922o = f0Var7;
        androidx.lifecycle.f0 f0Var8 = new androidx.lifecycle.f0();
        this.f22923p = f0Var8;
        androidx.lifecycle.f0 f0Var9 = new androidx.lifecycle.f0();
        this.f22924q = f0Var9;
        androidx.lifecycle.f0 f0Var10 = new androidx.lifecycle.f0();
        this.f22925r = f0Var10;
        this.f22926s = new androidx.lifecycle.f0();
        this.f22927t = new androidx.lifecycle.f0();
        this.f22928u = new androidx.lifecycle.f0();
        this.f22929v = new androidx.lifecycle.f0();
        this.f22930w = new androidx.lifecycle.f0();
        analyticsService.c("Customsform_step6of6", null);
        s sVar = (s) shareDataService.e("CUSTOMS_FORM_SHARE_DATA_CUSTOMS_FORM_OBJECT_VIEWMODEL");
        this.f22915h = sVar;
        f0Var.q((sVar == null || (C = sVar.C()) == null) ? null : (String) C.f());
        f0Var2.q((sVar == null || (G = sVar.G()) == null) ? null : (String) G.f());
        kotlin.jvm.internal.u0 u0Var = kotlin.jvm.internal.u0.f26205a;
        Object[] objArr = new Object[3];
        objArr[0] = Objects.toString((sVar == null || (z10 = sVar.z()) == null) ? null : (String) z10.f(), "");
        objArr[1] = Objects.toString((sVar == null || (E = sVar.E()) == null) ? null : (String) E.f(), "");
        objArr[2] = Objects.toString((sVar == null || (D = sVar.D()) == null) ? null : (String) D.f(), "");
        String format = String.format("%s %s %s", Arrays.copyOf(objArr, 3));
        kotlin.jvm.internal.t.f(format, "format(...)");
        f0Var3.q(format);
        f0Var4.q((sVar == null || (s10 = sVar.s()) == null) ? null : (String) s10.f());
        f0Var5.q((sVar == null || (y10 = sVar.y()) == null) ? null : (String) y10.f());
        Object[] objArr2 = new Object[5];
        objArr2[0] = Objects.toString((sVar == null || (p10 = sVar.p()) == null) ? null : (String) p10.f(), "");
        objArr2[1] = Objects.toString((sVar == null || (x10 = sVar.x()) == null) ? null : (String) x10.f(), "");
        objArr2[2] = Objects.toString((sVar == null || (w10 = sVar.w()) == null) ? null : (String) w10.f(), "");
        objArr2[3] = Objects.toString((sVar == null || (v10 = sVar.v()) == null) ? null : (String) v10.f(), "");
        objArr2[4] = Objects.toString((sVar == null || (r10 = sVar.r()) == null) ? null : (String) r10.f(), "");
        String format2 = String.format("%s %s %s \n%s %s", Arrays.copyOf(objArr2, 5));
        kotlin.jvm.internal.t.f(format2, "format(...)");
        f0Var6.q(format2);
        Object[] objArr3 = new Object[2];
        objArr3[0] = (sVar == null || (t10 = sVar.t()) == null) ? null : (String) t10.f();
        objArr3[1] = Objects.toString((sVar == null || (u10 = sVar.u()) == null) ? null : (String) u10.f(), "");
        String format3 = String.format("%s Ext. %s", Arrays.copyOf(objArr3, 2));
        kotlin.jvm.internal.t.f(format3, "format(...)");
        f0Var7.q(format3);
        Object[] objArr4 = new Object[2];
        objArr4[0] = contextService.getString(b1.f22603o);
        objArr4[1] = (sVar == null || (l10 = sVar.l()) == null) ? null : (String) l10.f();
        String format4 = String.format("%s : %s", Arrays.copyOf(objArr4, 2));
        kotlin.jvm.internal.t.f(format4, "format(...)");
        f0Var8.q(format4);
        Object[] objArr5 = new Object[2];
        objArr5[0] = contextService.getString(b1.f22599m);
        objArr5[1] = (sVar == null || (g10 = sVar.g()) == null) ? false : kotlin.jvm.internal.t.b(g10.f(), Boolean.TRUE) ? contextService.getString(b1.f22595k) : contextService.getString(b1.f22605p);
        String format5 = String.format("%s:%s", Arrays.copyOf(objArr5, 2));
        kotlin.jvm.internal.t.f(format5, "format(...)");
        f0Var9.q(format5);
        f0Var10.q((sVar == null || (j10 = sVar.j()) == null) ? null : (String) j10.f());
        StringBuffer stringBuffer = new StringBuffer();
        if (sVar != null && (h10 = sVar.h()) != null && (list = (List) h10.f()) != null) {
            boolean z11 = false;
            for (CustomsFormObject.CustomsFormArticleObject customsFormArticleObject : list) {
                if (z11) {
                    stringBuffer.append("\n");
                }
                stringBuffer.append(customsFormArticleObject.titleString);
                stringBuffer.append("\n");
                if (!qa.d.h(customsFormArticleObject.countryOfOrigin)) {
                    stringBuffer.append(contextService.getString(b1.f22591i));
                    stringBuffer.append(": ");
                    stringBuffer.append(customsFormArticleObject.countryOfOrigin);
                    stringBuffer.append("\n");
                }
                z11 = true;
            }
        }
        this.f22926s.q(stringBuffer.toString());
        androidx.lifecycle.f0 f0Var11 = this.f22929v;
        s sVar2 = this.f22915h;
        f0Var11.q((sVar2 == null || (o10 = sVar2.o()) == null) ? null : (Boolean) o10.f());
        androidx.lifecycle.f0 f0Var12 = this.f22930w;
        kotlin.jvm.internal.u0 u0Var2 = kotlin.jvm.internal.u0.f26205a;
        Object[] objArr6 = new Object[2];
        objArr6[0] = contextService.getString(b1.f22597l);
        s sVar3 = this.f22915h;
        objArr6[1] = Objects.toString((sVar3 == null || (n10 = sVar3.n()) == null) ? null : (String) n10.f(), "");
        String format6 = String.format("%s: %s", Arrays.copyOf(objArr6, 2));
        kotlin.jvm.internal.t.f(format6, "format(...)");
        f0Var12.q(format6);
        this.f22928u.q(Boolean.FALSE);
        this.f22927t.k(new b(new a()));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void i0() {
        this.f22928u.q(Boolean.valueOf(!qa.d.h((String) this.f22927t.f())));
    }

    public final androidx.lifecycle.f0 R() {
        return this.f22926s;
    }

    public final androidx.lifecycle.f0 S() {
        return this.f22925r;
    }

    public final androidx.lifecycle.f0 T() {
        return this.f22928u;
    }

    public final androidx.lifecycle.a0 U() {
        return this.f22914g;
    }

    public final androidx.lifecycle.f0 V() {
        return this.f22927t;
    }

    public final androidx.lifecycle.f0 W() {
        return this.f22924q;
    }

    public final androidx.lifecycle.f0 X() {
        return this.f22930w;
    }

    public final androidx.lifecycle.f0 Y() {
        return this.f22929v;
    }

    public final androidx.lifecycle.f0 Z() {
        return this.f22923p;
    }

    public final androidx.lifecycle.f0 a0() {
        return this.f22919l;
    }

    public final androidx.lifecycle.f0 b0() {
        return this.f22922o;
    }

    public final androidx.lifecycle.f0 c0() {
        return this.f22920m;
    }

    public final androidx.lifecycle.f0 d0() {
        return this.f22921n;
    }

    public final androidx.lifecycle.f0 e0() {
        return this.f22916i;
    }

    public final androidx.lifecycle.f0 f0() {
        return this.f22917j;
    }

    public final androidx.lifecycle.f0 g0() {
        return this.f22918k;
    }

    public final void h0() {
        Map p10;
        s sVar = this.f22915h;
        if (sVar != null) {
            if (sVar.h().f() != null) {
                d9.f fVar = this.f22911d;
                Map a10 = d9.e.f15943f.a("Customsform_step6of6");
                List list = (List) this.f22915h.h().f();
                p10 = sm.q0.p(a10, rm.c0.a("Customs_Form_Barcode_created_Adobe", String.valueOf(list != null ? Integer.valueOf(list.size()) : null)));
                fVar.b("Customs_Form_Barcode_created_Adobe", p10);
            }
            this.f22915h.m().q(this.f22927t.f());
            this.f22910c.c(this.f22915h.k());
        }
        this.f22912e.a();
        this.f22913f.s();
    }
}
