package ca.canadapost.module.selfscan.summary;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.r;
import androidx.lifecycle.c1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.u;
import androidx.lifecycle.z0;
import ca.canadapost.core.data.model.CoreConstants;
import ca.canadapost.core.data.model.ResultWrapper;
import ca.canadapost.core.data.model.ValidationError;
import ca.canadapost.module.selfscan.summary.SelfScanSummaryPositiveFragment;
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 rm.c0;
import rm.i;
import rm.n0;
import rm.q;
import u7.x;
import u8.g;
import w8.d0;
import w8.k;
import w8.l;
import w8.o;
import w8.p0;
import w8.w;

@Metadata(d1 = {"\u0000\u0098\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\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\u0000\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\u0006\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\n\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u00022\u00020\u00042\u00020\u0005B\u0007¢\u0006\u0004\bL\u0010MJ\b\u0010\u0007\u001a\u00020\u0006H\u0002J5\u0010\u0013\u001a\u00020\u00122\u0006\u0010\t\u001a\u00020\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\b\u0010\r\u001a\u0004\u0018\u00010\f2\u0006\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0019\u0010\u0018\u001a\u00020\u00062\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u0017\u001a\u00020\u0016H\u0096\u0001J\u001b\u0010\u001e\u001a\u00020\u001d2\b\u0010\u001a\u001a\u0004\u0018\u00010\u00192\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J#\u0010!\u001a\u00020\u001d2\u0006\u0010\u001f\u001a\u00020\u001d2\b\u0010 \u001a\u0004\u0018\u00010\u001d2\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u001b\u0010\"\u001a\u00020\u001d2\b\u0010\u001a\u001a\u0004\u0018\u00010\u00192\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0019\u0010#\u001a\u00020\u001d2\u0006\u0010\u001f\u001a\u00020\u001d2\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0011\u0010$\u001a\u00020\u001d2\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0011\u0010%\u001a\u00020\u001d2\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0011\u0010&\u001a\u00020\u001d2\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0019\u0010(\u001a\u00020\u00062\u0006\u0010\u0015\u001a\u00020'2\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0019\u0010)\u001a\u00020\u00062\u0006\u0010\u0017\u001a\u00020\u00162\u0006\u0010\u0015\u001a\u00020'H\u0096\u0001J\u0011\u0010*\u001a\u00020\u00062\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0019\u0010+\u001a\u00020\u00062\u0006\u0010\u0017\u001a\u00020\u00162\u0006\u0010\u0015\u001a\u00020'H\u0096\u0001J\u001b\u0010-\u001a\u00020\u00062\b\u0010,\u001a\u0004\u0018\u00010\u00192\u0006\u0010\u001c\u001a\u00020\u001bH\u0096\u0001J\u0019\u00100\u001a\u00020\u00062\u0006\u0010/\u001a\u00020.2\u0006\u0010\u0017\u001a\u00020\u0016H\u0096\u0001J\u0019\u00105\u001a\u00020\u00062\u0006\u00102\u001a\u0002012\u0006\u00104\u001a\u000203H\u0096\u0001J\u0019\u00106\u001a\u00020\u00062\u0006\u0010\u0017\u001a\u00020\u00162\u0006\u00104\u001a\u000203H\u0096\u0001J$\u00107\u001a\u00020\u00122\u0006\u0010\t\u001a\u00020\b2\b\u0010\u000b\u001a\u0004\u0018\u00010\n2\b\u0010\r\u001a\u0004\u0018\u00010\fH\u0016J\u001a\u00109\u001a\u00020\u00062\u0006\u00108\u001a\u00020\u00122\b\u0010\r\u001a\u0004\u0018\u00010\fH\u0016J\b\u0010;\u001a\u00020:H\u0016R\"\u0010C\u001a\u00020<8\u0004@\u0004X\u0085.¢\u0006\u0012\n\u0004\b=\u0010>\u001a\u0004\b?\u0010@\"\u0004\bA\u0010BR\u001b\u0010\u0011\u001a\u00020D8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bE\u0010F\u001a\u0004\bG\u0010HR\u0014\u0010K\u001a\u00020\u00038\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\bI\u0010J¨\u0006N"}, d2 = {"Lca/canadapost/module/selfscan/summary/SelfScanSummaryPositiveFragment;", "Lu8/b;", "", "Lbf/o;", "Lw8/o;", "Lw8/p0;", "Lrm/n0;", "Q", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "O", "Ll8/c;", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "Landroidx/fragment/app/f;", "fragment", "J", "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", "Ll8/h;", "spinnerVM", "K", "Landroid/app/Activity;", "activity", "Ll8/h$b;", "event", "c", "p", "onCreateView", "view", "onViewCreated", "", "E", "Lif/e;", "v", "Lif/e;", "M", "()Lif/e;", "setSelfScanSummaryPositiveViewModelFactory", "(Lif/e;)V", "selfScanSummaryPositiveViewModelFactory", "Lif/d;", "w", "Lrm/o;", "N", "()Lif/d;", "L", "()Lbf/o;", "binding", "<init>", "()V", "selfscan_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class SelfScanSummaryPositiveFragment extends u8.b implements o, p0 {

    /* renamed from: s, reason: collision with root package name */
    private final /* synthetic */ x f10758s = new x(af.d.f356h);

    /* renamed from: t, reason: collision with root package name */
    private final /* synthetic */ k f10759t = new k(null, null, null, 7, null);

    /* renamed from: u, reason: collision with root package name */
    private final /* synthetic */ l f10760u = new l();

    /* renamed from: v, reason: collision with root package name and from kotlin metadata */
    protected p003if.e selfScanSummaryPositiveViewModelFactory;

    /* renamed from: w, reason: collision with root package name and from kotlin metadata */
    private final rm.o viewModel;

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

        public final void a(Boolean bool) {
            t.d(bool);
            if (bool.booleanValue()) {
                SelfScanSummaryPositiveFragment.this.N().f0();
            } else {
                SelfScanSummaryPositiveFragment.this.Q();
            }
        }

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

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

        public final void a(n0 n0Var) {
            w.d(x4.d.a(SelfScanSummaryPositiveFragment.this), af.c.f333k, null, null, 6, null);
        }

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

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

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

        c(dn.l function) {
            t.g(function, "function");
            this.f10765a = function;
        }

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

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f10765a.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();
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes4.dex */
    public static final class d extends v implements dn.a {
        d() {
            super(0);
        }

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m172invoke() {
            SelfScanSummaryPositiveFragment.this.N().e0();
        }
    }

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

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

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

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

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

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

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ SelfScanSummaryPositiveFragment f10769q;

        /* loaded from: classes4.dex */
        public static final class a implements c1.c {

            /* renamed from: b, reason: collision with root package name */
            final /* synthetic */ SelfScanSummaryPositiveFragment f10770b;

            public a(SelfScanSummaryPositiveFragment selfScanSummaryPositiveFragment) {
                this.f10770b = selfScanSummaryPositiveFragment;
            }

            @Override // androidx.lifecycle.c1.c
            public z0 a(Class modelClass) {
                String str;
                t.g(modelClass, "modelClass");
                p003if.e M = this.f10770b.M();
                Bundle arguments = this.f10770b.getArguments();
                if (arguments == null || (str = arguments.getString(CoreConstants.ARG_TRACKING_NUMBER)) == null) {
                    str = "";
                }
                t.d(str);
                p003if.d a10 = M.a(str);
                t.e(a10, "null cannot be cast to non-null type U of ca.canadapost.core.common.utils.KotlinExtensionsKt.viewModels.<no name provided>.invoke.<no name provided>.create");
                return a10;
            }
        }

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public f(dn.a aVar, SelfScanSummaryPositiveFragment selfScanSummaryPositiveFragment) {
            super(0);
            this.f10768p = aVar;
            this.f10769q = selfScanSummaryPositiveFragment;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final z0 invoke() {
            return new c1((e1) this.f10768p.invoke(), new a(this.f10769q)).a(p003if.d.class);
        }
    }

    public SelfScanSummaryPositiveFragment() {
        rm.o a10;
        a10 = q.a(new f(new e(this), this));
        this.viewModel = a10;
    }

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

    /* JADX INFO: Access modifiers changed from: private */
    public static final void P(SelfScanSummaryPositiveFragment this$0) {
        t.g(this$0, "this$0");
        this$0.N().g0(this$0.L().A.getWidth(), this$0.L().A.getHeight());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void Q() {
        View view = getView();
        if (view != null) {
            String string = getString(af.f.f376p);
            t.f(string, "getString(...)");
            d0.v(view, string);
        }
        g.a aVar = g.f36993k;
        Context context = getContext();
        String string2 = getString(af.f.f372l);
        t.f(string2, "getString(...)");
        g j10 = aVar.j(context, string2, getString(af.f.f373m));
        j10.s(false);
        j10.o(new d());
        j10.x(getContext());
    }

    @Override // u8.b
    public boolean E() {
        rm.v[] vVarArr = new rm.v[1];
        Bundle arguments = getArguments();
        vVarArr[0] = c0.a(CoreConstants.ARG_IS_FROM_SCANNER, arguments != null ? Boolean.valueOf(arguments.getBoolean(CoreConstants.ARG_IS_FROM_SCANNER)) : null);
        r.c(this, "SCAN_BARCODE_AGAIN", androidx.core.os.c.a(vVarArr));
        return super.E();
    }

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

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

    public bf.o L() {
        return (bf.o) this.f10758s.b();
    }

    protected final p003if.e M() {
        p003if.e eVar = this.selfScanSummaryPositiveViewModelFactory;
        if (eVar != null) {
            return eVar;
        }
        t.y("selfScanSummaryPositiveViewModelFactory");
        return null;
    }

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

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

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

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

    @Override // w8.o
    public void e(ResultWrapper.Error error, Context context) {
        t.g(error, "error");
        t.g(context, "context");
        this.f10759t.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.f10759t.g(fragment, error);
    }

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

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

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

    @Override // w8.o
    public void k(ValidationError validationError, Context context) {
        t.g(context, "context");
        this.f10759t.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.f10759t.l(fragment, error);
    }

    @Override // w8.o
    public String m(ValidationError validationError, Context context) {
        t.g(context, "context");
        return this.f10759t.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.f10759t.n(code, message, context);
    }

    @Override // w8.o
    public void o(Context context) {
        t.g(context, "context");
        this.f10759t.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 O(inflater, container, savedInstanceState, viewLifecycleOwner, N());
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        L().A.post(new Runnable() { // from class: if.c
            @Override // java.lang.Runnable
            public final void run() {
                SelfScanSummaryPositiveFragment.P(SelfScanSummaryPositiveFragment.this);
            }
        });
        J(N(), this);
        K(N(), this);
        N().X().j(getViewLifecycleOwner(), new c(new a()));
        N().Z().j(getViewLifecycleOwner(), new c(new b()));
    }

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