package ca.canadapost.module.track.views;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.o0;
import ca.canadapost.core.data.model.Event;
import ca.canadapost.module.track.views.PackageDetailSignatureFragment;
import jg.j0;
import kotlin.Metadata;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import l8.h;
import n8.a;
import rm.c0;
import rm.n0;
import rm.o;
import u8.g;
import w8.p0;
import zf.a1;

@Metadata(d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\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\u0002\b\u0003\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\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u00012\u00020\u0002B\u0007¢\u0006\u0004\b#\u0010$J\u0019\u0010\b\u001a\u00020\u00072\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\u0006\u001a\u00020\u0005H\u0096\u0001J\u0019\u0010\r\u001a\u00020\u00072\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000bH\u0096\u0001J\u0019\u0010\u000e\u001a\u00020\u00072\u0006\u0010\u0006\u001a\u00020\u00052\u0006\u0010\f\u001a\u00020\u000bH\u0096\u0001J&\u0010\u0016\u001a\u0004\u0018\u00010\u00152\u0006\u0010\u0010\u001a\u00020\u000f2\b\u0010\u0012\u001a\u0004\u0018\u00010\u00112\b\u0010\u0014\u001a\u0004\u0018\u00010\u0013H\u0016J\u001a\u0010\u0018\u001a\u00020\u00072\u0006\u0010\u0017\u001a\u00020\u00152\b\u0010\u0014\u001a\u0004\u0018\u00010\u0013H\u0016R\u0016\u0010\u001c\u001a\u00020\u00198\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u001a\u0010\u001bR\u001b\u0010\"\u001a\u00020\u001d8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u001e\u0010\u001f\u001a\u0004\b \u0010!¨\u0006%"}, d2 = {"Lca/canadapost/module/track/views/PackageDetailSignatureFragment;", "Lu8/b;", "Lw8/p0;", "Ll8/h;", "spinnerVM", "Landroidx/fragment/app/f;", "fragment", "Lrm/n0;", "M", "Landroid/app/Activity;", "activity", "Ll8/h$b;", "event", "c", "p", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroid/view/View;", "onCreateView", "view", "onViewCreated", "Lzf/a1;", "t", "Lzf/a1;", "binding", "Ljg/j0;", "u", "Lrm/o;", "N", "()Ljg/j0;", "viewModel", "<init>", "()V", "track_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class PackageDetailSignatureFragment extends u8.b implements p0 {

    /* renamed from: t, reason: collision with root package name and from kotlin metadata */
    private a1 binding;

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

    /* renamed from: u, reason: collision with root package name and from kotlin metadata */
    private final o viewModel = androidx.fragment.app.p0.a(this, kotlin.jvm.internal.p0.b(j0.class), new d(new c(this)), new e());

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

        public final void a(n0 n0Var) {
            o0 i10;
            v4.g H = x4.d.a(PackageDetailSignatureFragment.this).H();
            if (H != null && (i10 = H.i()) != null) {
                i10.k("trackSignatureResponse", PackageDetailSignatureFragment.this.N().Z().n().f());
            }
            x4.d.a(PackageDetailSignatureFragment.this).U();
        }

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

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

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

        b(dn.l function) {
            t.g(function, "function");
            this.f10961a = function;
        }

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

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f10961a.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 c extends v implements dn.a {

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

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

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

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

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

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

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

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

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

    /* JADX INFO: Access modifiers changed from: private */
    public final j0 N() {
        return (j0) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void O(PackageDetailSignatureFragment this$0, String str) {
        t.g(this$0, "this$0");
        a1 a1Var = this$0.binding;
        a1 a1Var2 = null;
        if (a1Var == null) {
            t.y("binding");
            a1Var = null;
        }
        a1Var.A.B.setError(str);
        a1 a1Var3 = this$0.binding;
        if (a1Var3 == null) {
            t.y("binding");
        } else {
            a1Var2 = a1Var3;
        }
        a1Var2.A.B.setErrorEnabled(!qa.d.h(str));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void P(PackageDetailSignatureFragment this$0, String message) {
        t.g(this$0, "this$0");
        t.g(message, "message");
        g.a.k(u8.g.f36993k, this$0.requireActivity(), message, null, 4, null).x(this$0.requireActivity());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void Q(PackageDetailSignatureFragment this$0, Event event) {
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        String string = this$0.getString(yf.h.N2);
        t.f(string, "getString(...)");
        x4.d.a(this$0).N(yf.d.T0, androidx.core.os.c.a(c0.a("error_title", this$0.getString(yf.h.f52613m3)), c0.a("error_message", string), c0.a("button_text", this$0.getString(yf.h.B1))));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void R(PackageDetailSignatureFragment this$0, View view) {
        t.g(this$0, "this$0");
        a.C0681a c0681a = n8.a.f29843a;
        androidx.fragment.app.k requireActivity = this$0.requireActivity();
        t.f(requireActivity, "requireActivity(...)");
        c0681a.b(requireActivity, false);
    }

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

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

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        androidx.databinding.n h10 = androidx.databinding.f.h(inflater, yf.e.C, container, false);
        t.f(h10, "inflate(...)");
        a1 a1Var = (a1) h10;
        this.binding = a1Var;
        a1 a1Var2 = null;
        if (a1Var == null) {
            t.y("binding");
            a1Var = null;
        }
        a1Var.O(getViewLifecycleOwner());
        a1 a1Var3 = this.binding;
        if (a1Var3 == null) {
            t.y("binding");
            a1Var3 = null;
        }
        a1Var3.U(N());
        a1 a1Var4 = this.binding;
        if (a1Var4 == null) {
            t.y("binding");
        } else {
            a1Var2 = a1Var4;
        }
        return a1Var2.x();
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        M(N(), this);
        N().Y().j(getViewLifecycleOwner(), new b(new a()));
        N().X().j(getViewLifecycleOwner(), new g0() { // from class: jg.f0
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDetailSignatureFragment.O(PackageDetailSignatureFragment.this, (String) obj);
            }
        });
        N().b0().j(getViewLifecycleOwner(), new g0() { // from class: jg.g0
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDetailSignatureFragment.P(PackageDetailSignatureFragment.this, (String) obj);
            }
        });
        N().a0().j(getViewLifecycleOwner(), new g0() { // from class: jg.h0
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDetailSignatureFragment.Q(PackageDetailSignatureFragment.this, (Event) obj);
            }
        });
        a1 a1Var = this.binding;
        if (a1Var == null) {
            t.y("binding");
            a1Var = null;
        }
        a1Var.A.A.A.setOnClickListener(new View.OnClickListener() { // from class: jg.i0
            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                PackageDetailSignatureFragment.R(PackageDetailSignatureFragment.this, view2);
            }
        });
    }

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