package hd;

import android.app.Application;
import android.content.Context;
import androidx.lifecycle.a0;
import androidx.lifecycle.f0;
import ca.canadapost.core.data.model.PhoneNumber;
import d9.f;
import kotlin.jvm.internal.t;
import tp.m0;
import tp.o0;
import tp.u1;

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

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

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

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

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

    /* renamed from: g, reason: collision with root package name */
    private final PhoneNumber f21555g;

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

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

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

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

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

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

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

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public i(g9.i l2Repository, t7.c contextService, d9.f analyticsService) {
        super((Application) r0);
        t.g(l2Repository, "l2Repository");
        t.g(contextService, "contextService");
        t.g(analyticsService, "analyticsService");
        Context a10 = contextService.a();
        t.e(a10, "null cannot be cast to non-null type android.app.Application");
        this.f21551c = l2Repository;
        this.f21552d = analyticsService;
        this.f21553e = new l8.i(contextService);
        this.f21554f = new l8.d();
        PhoneNumber phoneNumber = (PhoneNumber) l2Repository.b().f();
        this.f21555g = phoneNumber;
        this.f21556h = new f0(phoneNumber != null ? phoneNumber.toString() : null);
        f0 f0Var = new f0();
        this.f21557i = f0Var;
        this.f21558j = f0Var;
        l8.g gVar = new l8.g();
        this.f21559k = gVar;
        this.f21560l = gVar;
        l8.g gVar2 = new l8.g();
        this.f21561m = gVar2;
        this.f21562n = gVar2;
        f.a.c(analyticsService, "L1 - MobileNumberView", null, 2, null);
    }

    private final boolean U(String str) {
        String normalizePhoneNumber = PhoneNumber.INSTANCE.normalizePhoneNumber(String.valueOf(this.f21555g));
        if (str == null) {
            str = "";
        }
        return !t.b(normalizePhoneNumber, r0.normalizePhoneNumber(str));
    }

    private final boolean X() {
        String str = (String) this.f21556h.f();
        if ((str == null || str.length() == 0) || PhoneNumber.Companion.parsePhoneNumber$default(PhoneNumber.INSTANCE, str, null, 2, null) == null) {
            this.f21557i.q(P().getString(ed.m.f16947d));
        } else {
            this.f21557i.q(null);
        }
        return this.f21558j.f() == null;
    }

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

    public final a0 Q() {
        return this.f21562n;
    }

    public final f0 R() {
        return this.f21556h;
    }

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

    public final a0 T() {
        return this.f21560l;
    }

    public final void V() {
        this.f21561m.q(Boolean.valueOf(U((String) this.f21556h.f())));
    }

    public final void W() {
        String str;
        if (X() && (str = (String) this.f21556h.f()) != null) {
            if (!U(str)) {
                this.f21561m.q(Boolean.FALSE);
            } else {
                this.f21551c.b().q(PhoneNumber.Companion.parsePhoneNumber$default(PhoneNumber.INSTANCE, str, null, 2, null));
                this.f21559k.s();
            }
        }
    }

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

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

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