package ca.canadapost.module.l1auth;

import ad.q;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.p0;
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.ResultWrapper;
import ca.canadapost.core.data.model.ValidationError;
import ca.canadapost.module.l1auth.L1AuthBarcodeFragment;
import com.google.firebase.messaging.Constants;
import dn.l;
import java.util.EnumMap;
import kotlin.Metadata;
import kotlin.jvm.internal.n;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import n8.f;
import rm.c0;
import rm.i;
import rm.n0;
import u7.x;
import w8.k;
import w8.o;
import w8.w;
import yc.a0;
import yc.y;
import yk.g;

@Metadata(d1 = {"\u0000n\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\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\u0000\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\t\n\u0002\u0018\u0002\n\u0002\b\n\u0018\u00002\u00020\u00012\b\u0012\u0004\u0012\u00020\u00030\u00022\u00020\u0004B\u0007¢\u0006\u0004\b7\u00108J5\u0010\u0010\u001a\u00020\u000f2\u0006\u0010\u0006\u001a\u00020\u00052\b\u0010\b\u001a\u0004\u0018\u00010\u00072\b\u0010\n\u001a\u0004\u0018\u00010\t2\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\u000e\u001a\u00020\rH\u0096\u0001J\u0019\u0010\u0016\u001a\u00020\u00152\u0006\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\u0013H\u0096\u0001J\u001b\u0010\u001c\u001a\u00020\u001b2\b\u0010\u0018\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J#\u0010\u001f\u001a\u00020\u001b2\u0006\u0010\u001d\u001a\u00020\u001b2\b\u0010\u001e\u001a\u0004\u0018\u00010\u001b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u001b\u0010 \u001a\u00020\u001b2\b\u0010\u0018\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0019\u0010!\u001a\u00020\u001b2\u0006\u0010\u001d\u001a\u00020\u001b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0011\u0010\"\u001a\u00020\u001b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0011\u0010#\u001a\u00020\u001b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0011\u0010$\u001a\u00020\u001b2\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0019\u0010&\u001a\u00020\u00152\u0006\u0010\u0012\u001a\u00020%2\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0019\u0010'\u001a\u00020\u00152\u0006\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0012\u001a\u00020%H\u0096\u0001J\u0011\u0010(\u001a\u00020\u00152\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J\u0019\u0010)\u001a\u00020\u00152\u0006\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0012\u001a\u00020%H\u0096\u0001J\u001b\u0010+\u001a\u00020\u00152\b\u0010*\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u001a\u001a\u00020\u0019H\u0096\u0001J$\u0010,\u001a\u00020\u000f2\u0006\u0010\u0006\u001a\u00020\u00052\b\u0010\b\u001a\u0004\u0018\u00010\u00072\b\u0010\n\u001a\u0004\u0018\u00010\tH\u0016J\u001a\u0010.\u001a\u00020\u00152\u0006\u0010-\u001a\u00020\u000f2\b\u0010\n\u001a\u0004\u0018\u00010\tH\u0016R\u001b\u0010\u000e\u001a\u00020/8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b0\u00101\u001a\u0004\b2\u00103R\u0014\u00106\u001a\u00020\u00038\u0016X\u0096\u0005¢\u0006\u0006\u001a\u0004\b4\u00105¨\u00069"}, d2 = {"Lca/canadapost/module/l1auth/L1AuthBarcodeFragment;", "Lu8/b;", "", "Lad/q;", "Lw8/o;", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroidx/lifecycle/u;", "viewLifecycleOwner", "Landroidx/lifecycle/z0;", "viewModel", "Landroid/view/View;", "N", "Ll8/c;", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "Landroidx/fragment/app/f;", "fragment", "Lrm/n0;", "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", "Lyc/o;", "u", "Lrm/o;", "M", "()Lyc/o;", "L", "()Lad/q;", "binding", "<init>", "()V", "l1auth_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class L1AuthBarcodeFragment extends u8.b implements o {

    /* renamed from: s, reason: collision with root package name */
    private final /* synthetic */ x f9628s = new x(y.f52227i);

    /* renamed from: t, reason: collision with root package name */
    private final /* synthetic */ k f9629t = new k(Integer.valueOf(a0.B), Integer.valueOf(a0.C), Integer.valueOf(a0.f52078a));

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

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

        public final void a(String str) {
            if (str == null || str.length() == 0) {
                return;
            }
            try {
                EnumMap enumMap = new EnumMap(g.class);
                enumMap.put((EnumMap) g.CHARACTER_SET, (g) "UTF-8");
                enumMap.put((EnumMap) g.MARGIN, (g) 0);
                L1AuthBarcodeFragment.this.L().C.setImageBitmap(new bm.b().c(str, yk.a.PDF_417, (int) L1AuthBarcodeFragment.this.getResources().getDimension(yc.v.f52189b), (int) L1AuthBarcodeFragment.this.getResources().getDimension(yc.v.f52188a), enumMap));
            } catch (Exception e10) {
                e10.printStackTrace();
            }
        }

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

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

        public final void a(String str) {
            if (str != null) {
                L1AuthBarcodeFragment.this.L().B.setText(androidx.core.text.b.a(L1AuthBarcodeFragment.this.getString(a0.f52084g, str), 0));
            } else {
                L1AuthBarcodeFragment.this.L().B.setVisibility(8);
            }
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((String) 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 */ l f9633a;

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

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

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

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

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

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

    /* 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 */ dn.a f9635p;

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

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

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

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

    private final yc.o M() {
        return (yc.o) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void O(L1AuthBarcodeFragment this$0, View view) {
        t.g(this$0, "this$0");
        f.a aVar = n8.f.f29853a;
        androidx.fragment.app.k requireActivity = this$0.requireActivity();
        t.f(requireActivity, "requireActivity(...)");
        aVar.a(requireActivity);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void P(L1AuthBarcodeFragment this$0, View view) {
        t.g(this$0, "this$0");
        w.d(x4.d.a(this$0), yc.x.f52197e, null, null, 6, null);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void Q(L1AuthBarcodeFragment this$0, View view) {
        t.g(this$0, "this$0");
        w.d(x4.d.a(this$0), yc.x.f52198f, androidx.core.os.c.a(c0.a("fromBarcodeFragment", Boolean.TRUE)), null, 4, null);
    }

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

    public q L() {
        return (q) this.f9628s.b();
    }

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

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

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

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

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

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

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

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

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

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

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        K(M(), this);
        M().U().j(getViewLifecycleOwner(), new c(new a()));
        M().T().j(getViewLifecycleOwner(), new c(new b()));
        L().E.setOnClickListener(new View.OnClickListener() { // from class: yc.l
            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                L1AuthBarcodeFragment.O(L1AuthBarcodeFragment.this, view2);
            }
        });
        L().A.setOnClickListener(new View.OnClickListener() { // from class: yc.m
            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                L1AuthBarcodeFragment.P(L1AuthBarcodeFragment.this, view2);
            }
        });
        L().F.setOnClickListener(new View.OnClickListener() { // from class: yc.n
            @Override // android.view.View.OnClickListener
            public final void onClick(View view2) {
                L1AuthBarcodeFragment.Q(L1AuthBarcodeFragment.this, view2);
            }
        });
    }
}
