package ib;

import android.graphics.Bitmap;
import ca.canadapost.core.data.db.cupboard.model.CustomsFormObject;
import com.google.android.gms.common.ConnectionResult;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/* loaded from: classes4.dex */
public final class l extends h {
    private final l8.g A;
    private final androidx.lifecycle.a0 B;
    private final s C;
    private final androidx.lifecycle.f0 D;
    private final androidx.lifecycle.f0 E;
    private final androidx.lifecycle.f0 F;
    private final androidx.lifecycle.f0 G;
    private final androidx.lifecycle.f0 H;
    private final androidx.lifecycle.f0 I;
    private final androidx.lifecycle.f0 J;
    private final androidx.lifecycle.f0 K;
    private final androidx.lifecycle.f0 L;
    private final androidx.lifecycle.f0 M;
    private final androidx.lifecycle.f0 N;
    private final androidx.lifecycle.f0 O;
    private final androidx.lifecycle.f0 P;

    /* renamed from: r, reason: collision with root package name */
    private final p9.h f22852r;

    /* renamed from: s, reason: collision with root package name */
    private final ja.d f22853s;

    /* renamed from: t, reason: collision with root package name */
    private final ca.a f22854t;

    /* renamed from: u, reason: collision with root package name */
    private final w8.r f22855u;

    /* renamed from: v, reason: collision with root package name */
    private final t0 f22856v;

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public l(t7.c contextService, p9.h featureFlagRepository, ja.d sharedPreferencesService, ca.a languageService, w8.r shareDataService, t0 customsFormQRCodeService, d9.f analyticsService) {
        super(contextService, featureFlagRepository, sharedPreferencesService, languageService);
        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 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;
        androidx.lifecycle.f0 m10;
        kotlin.jvm.internal.t.g(contextService, "contextService");
        kotlin.jvm.internal.t.g(featureFlagRepository, "featureFlagRepository");
        kotlin.jvm.internal.t.g(sharedPreferencesService, "sharedPreferencesService");
        kotlin.jvm.internal.t.g(languageService, "languageService");
        kotlin.jvm.internal.t.g(shareDataService, "shareDataService");
        kotlin.jvm.internal.t.g(customsFormQRCodeService, "customsFormQRCodeService");
        kotlin.jvm.internal.t.g(analyticsService, "analyticsService");
        this.f22852r = featureFlagRepository;
        this.f22853s = sharedPreferencesService;
        this.f22854t = languageService;
        this.f22855u = shareDataService;
        this.f22856v = customsFormQRCodeService;
        l8.g gVar = new l8.g();
        this.f22857w = gVar;
        this.f22858x = gVar;
        l8.g gVar2 = new l8.g();
        this.f22859y = gVar2;
        this.f22860z = gVar2;
        l8.g gVar3 = new l8.g();
        this.A = gVar3;
        this.B = gVar3;
        s sVar = (s) shareDataService.e("CUSTOMS_FORM_SHARE_DATA_CUSTOMS_FORM_OBJECT_VIEWMODEL");
        this.C = sVar;
        androidx.lifecycle.f0 f0Var = new androidx.lifecycle.f0();
        this.D = f0Var;
        androidx.lifecycle.f0 f0Var2 = new androidx.lifecycle.f0();
        this.E = f0Var2;
        androidx.lifecycle.f0 f0Var3 = new androidx.lifecycle.f0();
        this.F = f0Var3;
        androidx.lifecycle.f0 f0Var4 = new androidx.lifecycle.f0();
        this.G = f0Var4;
        androidx.lifecycle.f0 f0Var5 = new androidx.lifecycle.f0();
        this.H = f0Var5;
        androidx.lifecycle.f0 f0Var6 = new androidx.lifecycle.f0();
        this.I = f0Var6;
        androidx.lifecycle.f0 f0Var7 = new androidx.lifecycle.f0();
        this.J = f0Var7;
        androidx.lifecycle.f0 f0Var8 = new androidx.lifecycle.f0();
        this.K = f0Var8;
        androidx.lifecycle.f0 f0Var9 = new androidx.lifecycle.f0();
        this.L = f0Var9;
        androidx.lifecycle.f0 f0Var10 = new androidx.lifecycle.f0();
        this.M = f0Var10;
        this.N = new androidx.lifecycle.f0();
        this.O = new androidx.lifecycle.f0();
        this.P = new androidx.lifecycle.f0();
        gVar.q((sVar == null || (m10 = sVar.m()) == null) ? null : (String) m10.f());
        analyticsService.c("CustomsQRcodedisplayed", null);
        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[4];
        objArr2[0] = Objects.toString((sVar == null || (p10 = sVar.p()) == null) ? null : (String) p10.f(), "");
        objArr2[1] = Objects.toString((sVar == null || (w10 = sVar.w()) == null) ? null : (String) w10.f(), "");
        objArr2[2] = Objects.toString((sVar == null || (v10 = sVar.v()) == null) ? null : (String) v10.f(), "");
        objArr2[3] = Objects.toString((sVar == null || (r10 = sVar.r()) == null) ? null : (String) r10.f(), "");
        String format2 = String.format("%s %s %s %s", Arrays.copyOf(objArr2, 4));
        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.N.q(stringBuffer.toString());
        androidx.lifecycle.f0 f0Var11 = this.O;
        s sVar2 = this.C;
        f0Var11.q((sVar2 == null || (o10 = sVar2.o()) == null) ? null : (Boolean) o10.f());
        androidx.lifecycle.f0 f0Var12 = this.P;
        kotlin.jvm.internal.u0 u0Var2 = kotlin.jvm.internal.u0.f26205a;
        Object[] objArr6 = new Object[2];
        objArr6[0] = contextService.getString(b1.f22597l);
        s sVar3 = this.C;
        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);
        if (this.f22852r.d(p9.a.CUSTOM_FORM_DIMINIMUS)) {
            this.f22859y.q(this.f22856v.a(this.C));
        } else {
            this.f22859y.q(this.f22856v.b(this.C));
        }
    }

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

    public final Bitmap e0(String data) {
        kotlin.jvm.internal.t.g(data, "data");
        return this.f22856v.c(data, ConnectionResult.DRIVE_EXTERNAL_STORAGE_REQUIRED, 1700);
    }

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

    public final androidx.lifecycle.a0 g0() {
        return this.B;
    }

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

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

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

    public final androidx.lifecycle.a0 k0() {
        return this.f22858x;
    }

    public final androidx.lifecycle.a0 l0() {
        return this.f22860z;
    }

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

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

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

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

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

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

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

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

    public final void u0() {
        this.f22855u.c();
        this.A.s();
    }
}
