package ca.canadapost.module.epostprofile.userprofile;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.u;
import androidx.lifecycle.z0;
import ca.canadapost.core.data.model.AMSCheckSteps;
import ca.canadapost.core.data.model.Event;
import ca.canadapost.core.data.model.ResultWrapper;
import ca.canadapost.core.data.model.ValidationError;
import ca.canadapost.module.epostprofile.userprofile.UserAMSCheckFragment;
import cc.j3;
import com.google.firebase.messaging.Constants;
import kotlin.Metadata;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import l8.h;
import n8.j;
import n8.k;
import rm.c0;
import rm.n0;
import u7.x;
import w8.d0;
import w8.o;
import w8.p0;
import w8.w;
import zb.m3;

@Metadata(d1 = {"\u0000\u009e\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\n\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\n\b\u0007\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u00022\u00020\u00042\u00020\u0005B\u0007¢\u0006\u0004\bN\u0010OJ\u0016\u0010\n\u001a\u00020\t2\f\u0010\b\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006H\u0002J\u0016\u0010\u000b\u001a\u00020\t2\f\u0010\b\u001a\b\u0012\u0004\u0012\u00020\u00070\u0006H\u0002J5\u0010\u0017\u001a\u00020\u00162\u0006\u0010\r\u001a\u00020\f2\b\u0010\u000f\u001a\u0004\u0018\u00010\u000e2\b\u0010\u0011\u001a\u0004\u0018\u00010\u00102\u0006\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0015\u001a\u00020\u0014H\u0096\u0001J\u0019\u0010\u001c\u001a\u00020\t2\u0006\u0010\u0019\u001a\u00020\u00182\u0006\u0010\u001b\u001a\u00020\u001aH\u0096\u0001J\u0019\u0010 \u001a\u00020\t2\u0006\u0010\u001e\u001a\u00020\u001d2\u0006\u0010\b\u001a\u00020\u001fH\u0096\u0001J\u0019\u0010!\u001a\u00020\t2\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010\b\u001a\u00020\u001fH\u0096\u0001J\u0019\u0010$\u001a\u00020\t2\u0006\u0010#\u001a\u00020\"2\u0006\u0010\u001b\u001a\u00020\u001aH\u0096\u0001J\u001b\u0010*\u001a\u00020)2\b\u0010&\u001a\u0004\u0018\u00010%2\u0006\u0010(\u001a\u00020'H\u0096\u0001J#\u0010-\u001a\u00020)2\u0006\u0010+\u001a\u00020)2\b\u0010,\u001a\u0004\u0018\u00010)2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u001b\u0010.\u001a\u00020)2\b\u0010&\u001a\u0004\u0018\u00010%2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0019\u0010/\u001a\u00020)2\u0006\u0010+\u001a\u00020)2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0011\u00100\u001a\u00020)2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0011\u00101\u001a\u00020)2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0011\u00102\u001a\u00020)2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0019\u00104\u001a\u00020\t2\u0006\u0010#\u001a\u0002032\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0019\u00105\u001a\u00020\t2\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010#\u001a\u000203H\u0096\u0001J\u0011\u00106\u001a\u00020\t2\u0006\u0010(\u001a\u00020'H\u0096\u0001J\u0019\u00107\u001a\u00020\t2\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010#\u001a\u000203H\u0096\u0001J\u001b\u00109\u001a\u00020\t2\b\u00108\u001a\u0004\u0018\u00010%2\u0006\u0010(\u001a\u00020'H\u0096\u0001J$\u0010:\u001a\u00020\u00162\u0006\u0010\r\u001a\u00020\f2\b\u0010\u000f\u001a\u0004\u0018\u00010\u000e2\b\u0010\u0011\u001a\u0004\u0018\u00010\u0010H\u0016J\u001a\u0010<\u001a\u00020\t2\u0006\u0010;\u001a\u00020\u00162\b\u0010\u0011\u001a\u0004\u0018\u00010\u0010H\u0016J\b\u0010=\u001a\u00020\tH\u0016R\"\u0010E\u001a\u00020>8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b?\u0010@\u001a\u0004\bA\u0010B\"\u0004\bC\u0010DR\u001b\u0010\u0015\u001a\u00020F8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bG\u0010H\u001a\u0004\bI\u0010JR\u0014\u0010M\u001a\u00020\u00038\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\bK\u0010L¨\u0006P"}, d2 = {"Lca/canadapost/module/epostprofile/userprofile/UserAMSCheckFragment;", "Lu8/b;", "", "Lzb/m3;", "Lw8/p0;", "Lw8/o;", "Lca/canadapost/core/data/model/Event;", "", "event", "Lrm/n0;", "P", "O", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "Q", "Ll8/h;", "spinnerVM", "Landroidx/fragment/app/f;", "fragment", "L", "Landroid/app/Activity;", "activity", "Ll8/h$b;", "c", "p", "Ll8/c;", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "K", "Lca/canadapost/core/data/model/ValidationError;", "validationError", "Landroid/content/Context;", "context", "", "m", "code", "message", "n", "i", "j", "h", "d", "a", "Lca/canadapost/core/data/model/ResultWrapper$Error;", "e", "l", "o", "g", "valError", "k", "onCreateView", "view", "onViewCreated", "onResume", "Lp9/h;", "v", "Lp9/h;", "getFeatureFlagRepository", "()Lp9/h;", "setFeatureFlagRepository", "(Lp9/h;)V", "featureFlagRepository", "Lcc/j3;", "w", "Lrm/o;", "N", "()Lcc/j3;", "M", "()Lzb/m3;", "binding", "<init>", "()V", "epostprofile_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class UserAMSCheckFragment extends u8.b implements p0, o {

    /* renamed from: v, reason: collision with root package name and from kotlin metadata */
    public p9.h featureFlagRepository;

    /* renamed from: s, reason: collision with root package name */
    private final /* synthetic */ x f9047s = new x(ob.j.f31215h0);

    /* renamed from: t, reason: collision with root package name */
    private final /* synthetic */ w8.l f9048t = new w8.l();

    /* renamed from: u, reason: collision with root package name */
    private final /* synthetic */ w8.k f9049u = new w8.k(null, null, null, 7, null);

    /* renamed from: w, reason: collision with root package name and from kotlin metadata */
    private final rm.o viewModel = androidx.fragment.app.p0.a(this, kotlin.jvm.internal.p0.b(j3.class), new k(new j(this)), new l());

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

        public final void a(Event event) {
            Boolean bool = event != null ? (Boolean) event.getContentIfNotHandled() : null;
            if (bool != null) {
                UserAMSCheckFragment userAMSCheckFragment = UserAMSCheckFragment.this;
                if (bool.booleanValue()) {
                    w.d(x4.d.a(userAMSCheckFragment), ob.i.f31174n, null, null, 6, null);
                }
            }
        }

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

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

        public final void a(Event event) {
            UserAMSCheckFragment userAMSCheckFragment = UserAMSCheckFragment.this;
            t.d(event);
            userAMSCheckFragment.P(event);
        }

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

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

        public final void a(Event event) {
            UserAMSCheckFragment userAMSCheckFragment = UserAMSCheckFragment.this;
            t.d(event);
            userAMSCheckFragment.O(event);
        }

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

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

        public final void a(Event event) {
            androidx.fragment.app.k activity;
            Boolean bool = event != null ? (Boolean) event.getContentIfNotHandled() : null;
            if (bool != null) {
                UserAMSCheckFragment userAMSCheckFragment = UserAMSCheckFragment.this;
                if (!bool.booleanValue() || (activity = userAMSCheckFragment.getActivity()) == null) {
                    return;
                }
                activity.finish();
            }
        }

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

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

        public final void a(Event event) {
            Boolean bool = event != null ? (Boolean) event.getContentIfNotHandled() : null;
            if (bool != null) {
                UserAMSCheckFragment userAMSCheckFragment = UserAMSCheckFragment.this;
                if (bool.booleanValue()) {
                    x4.d.a(userAMSCheckFragment).N(ob.i.f31149d, null);
                }
            }
        }

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

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

        public final void a(Event event) {
            Boolean bool = event != null ? (Boolean) event.getContentIfNotHandled() : null;
            if (bool != null) {
                UserAMSCheckFragment userAMSCheckFragment = UserAMSCheckFragment.this;
                if (bool.booleanValue()) {
                    x4.d.a(userAMSCheckFragment).M(ob.i.f31164i);
                }
            }
        }

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

    /* loaded from: classes4.dex */
    static final class g extends v implements dn.l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ View f9058p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        g(View view) {
            super(1);
            this.f9058p = view;
        }

        public final void a(Event event) {
            String str = event != null ? (String) event.getContentIfNotHandled() : null;
            if (str != null) {
                d0.v(this.f9058p, str);
            }
        }

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

    /* loaded from: classes4.dex */
    static final class h extends v implements dn.l {

        /* loaded from: classes4.dex */
        public /* synthetic */ class a {

            /* renamed from: a, reason: collision with root package name */
            public static final /* synthetic */ int[] f9060a;

            static {
                int[] iArr = new int[AMSCheckSteps.values().length];
                try {
                    iArr[AMSCheckSteps.L1AUTH.ordinal()] = 1;
                } catch (NoSuchFieldError unused) {
                }
                try {
                    iArr[AMSCheckSteps.L2.ordinal()] = 2;
                } catch (NoSuchFieldError unused2) {
                }
                try {
                    iArr[AMSCheckSteps.MYMAIL.ordinal()] = 3;
                } catch (NoSuchFieldError unused3) {
                }
                try {
                    iArr[AMSCheckSteps.TNC.ordinal()] = 4;
                } catch (NoSuchFieldError unused4) {
                }
                f9060a = iArr;
            }
        }

        h() {
            super(1);
        }

        public final void a(Event event) {
            AMSCheckSteps aMSCheckSteps = (AMSCheckSteps) event.getContentIfNotHandled();
            int i10 = aMSCheckSteps == null ? -1 : a.f9060a[aMSCheckSteps.ordinal()];
            if (i10 == 1) {
                j.a aVar = n8.j.f29856a;
                androidx.fragment.app.k requireActivity = UserAMSCheckFragment.this.requireActivity();
                t.f(requireActivity, "requireActivity(...)");
                aVar.a(requireActivity);
                return;
            }
            if (i10 == 2) {
                k.a aVar2 = n8.k.f29857a;
                androidx.fragment.app.k requireActivity2 = UserAMSCheckFragment.this.requireActivity();
                t.f(requireActivity2, "requireActivity(...)");
                aVar2.a(requireActivity2);
                return;
            }
            if (i10 == 3) {
                UserAMSCheckFragment.this.requireActivity().setResult(-1, new Intent());
                UserAMSCheckFragment.this.requireActivity().finish();
            } else {
                if (i10 != 4) {
                    return;
                }
                x4.d.a(UserAMSCheckFragment.this).M(ob.i.f31161h);
            }
        }

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

    /* loaded from: classes4.dex */
    static final class i implements g0, n {

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

        i(dn.l function) {
            t.g(function, "function");
            this.f9061a = function;
        }

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

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

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

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

    /* loaded from: classes4.dex */
    public static final class j extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ androidx.fragment.app.f f9062p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public j(androidx.fragment.app.f fVar) {
            super(0);
            this.f9062p = fVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final androidx.fragment.app.f invoke() {
            return this.f9062p;
        }
    }

    /* loaded from: classes4.dex */
    public static final class k extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ dn.a f9063p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public k(dn.a aVar) {
            super(0);
            this.f9063p = aVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final d1 invoke() {
            d1 viewModelStore = ((e1) this.f9063p.invoke()).getViewModelStore();
            t.f(viewModelStore, "ownerProducer().viewModelStore");
            return viewModelStore;
        }
    }

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

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final c1.c invoke() {
            return UserAMSCheckFragment.this.y();
        }
    }

    private final j3 N() {
        return (j3) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void O(Event event) {
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        w.d(x4.d.a(this), ob.i.f31184s, androidx.core.os.c.a(c0.a("navigateToEditAddress", Boolean.TRUE)), null, 4, null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void P(Event event) {
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        w.d(x4.d.a(this), ob.i.f31182r, androidx.core.os.c.a(c0.a("navigateToEditAddress", Boolean.TRUE)), null, 4, null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void R(UserAMSCheckFragment this$0, View view) {
        t.g(this$0, "this$0");
        this$0.N().y0();
    }

    public void K(l8.c error, androidx.fragment.app.f fragment) {
        t.g(error, "error");
        t.g(fragment, "fragment");
        this.f9049u.b(error, fragment);
    }

    public void L(l8.h spinnerVM, androidx.fragment.app.f fragment) {
        t.g(spinnerVM, "spinnerVM");
        t.g(fragment, "fragment");
        this.f9048t.b(spinnerVM, fragment);
    }

    public m3 M() {
        return (m3) this.f9047s.b();
    }

    public View Q(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, u viewLifecycleOwner, z0 viewModel) {
        t.g(inflater, "inflater");
        t.g(viewLifecycleOwner, "viewLifecycleOwner");
        t.g(viewModel, "viewModel");
        return this.f9047s.c(inflater, container, savedInstanceState, viewLifecycleOwner, viewModel);
    }

    @Override // w8.o
    public String a(Context context) {
        t.g(context, "context");
        return this.f9049u.a(context);
    }

    @Override // w8.p0
    public void c(Activity activity, h.b event) {
        t.g(activity, "activity");
        t.g(event, "event");
        this.f9048t.c(activity, event);
    }

    @Override // w8.o
    public String d(Context context) {
        t.g(context, "context");
        return this.f9049u.d(context);
    }

    @Override // w8.o
    public void e(ResultWrapper.Error error, Context context) {
        t.g(error, "error");
        t.g(context, "context");
        this.f9049u.e(error, context);
    }

    @Override // w8.o
    public void g(androidx.fragment.app.f fragment, ResultWrapper.Error error) {
        t.g(fragment, "fragment");
        t.g(error, "error");
        this.f9049u.g(fragment, error);
    }

    @Override // w8.o
    public String h(Context context) {
        t.g(context, "context");
        return this.f9049u.h(context);
    }

    @Override // w8.o
    public String i(ValidationError validationError, Context context) {
        t.g(context, "context");
        return this.f9049u.i(validationError, context);
    }

    @Override // w8.o
    public String j(String code, Context context) {
        t.g(code, "code");
        t.g(context, "context");
        return this.f9049u.j(code, context);
    }

    @Override // w8.o
    public void k(ValidationError validationError, Context context) {
        t.g(context, "context");
        this.f9049u.k(validationError, context);
    }

    @Override // w8.o
    public void l(androidx.fragment.app.f fragment, ResultWrapper.Error error) {
        t.g(fragment, "fragment");
        t.g(error, "error");
        this.f9049u.l(fragment, error);
    }

    @Override // w8.o
    public String m(ValidationError validationError, Context context) {
        t.g(context, "context");
        return this.f9049u.m(validationError, context);
    }

    @Override // w8.o
    public String n(String code, String message, Context context) {
        t.g(code, "code");
        t.g(context, "context");
        return this.f9049u.n(code, message, context);
    }

    @Override // w8.o
    public void o(Context context) {
        t.g(context, "context");
        this.f9049u.o(context);
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        u viewLifecycleOwner = getViewLifecycleOwner();
        t.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        return Q(inflater, container, savedInstanceState, viewLifecycleOwner, N());
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onResume() {
        super.onResume();
        N().z0();
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        L(N(), this);
        K(N(), this);
        N().B0();
        N().p0().j(getViewLifecycleOwner(), new i(new a()));
        N().q0().j(getViewLifecycleOwner(), new i(new b()));
        N().o0().j(getViewLifecycleOwner(), new i(new c()));
        N().m0().j(getViewLifecycleOwner(), new i(new d()));
        N().t0().j(getViewLifecycleOwner(), new i(new e()));
        N().u0().j(getViewLifecycleOwner(), new i(new f()));
        N().r0().j(getViewLifecycleOwner(), new i(new g(view)));
        Button continueButton = M().B;
        t.f(continueButton, "continueButton");
        d0.p(continueButton, new View.OnClickListener() { // from class: cc.e3
            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                UserAMSCheckFragment.R(UserAMSCheckFragment.this, view2);
            }
        });
        N().n0().j(getViewLifecycleOwner(), new i(new h()));
    }

    @Override // w8.p0
    public void p(androidx.fragment.app.f fragment, h.b event) {
        t.g(fragment, "fragment");
        t.g(event, "event");
        this.f9048t.p(fragment, event);
    }
}
