package ca.canadapost.module.track.views;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import androidx.activity.p;
import androidx.activity.q;
import androidx.fragment.app.z;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import androidx.lifecycle.u;
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.track.views.PackageDeliveryOptionSelectionFragment;
import com.google.firebase.messaging.Constants;
import jg.s;
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.n0;
import u8.g;
import w8.d0;
import w8.k0;
import w8.o;
import w8.p0;
import w8.q0;
import w8.r0;
import zf.o0;

@Metadata(d1 = {"\u0000\u009f\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\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\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\u0005\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\b\u0007*\u0001P\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u0003B\u0007¢\u0006\u0004\bT\u0010UJ\b\u0010\u0005\u001a\u00020\u0004H\u0002J\b\u0010\u0006\u001a\u00020\u0004H\u0002J\b\u0010\u0007\u001a\u00020\u0004H\u0002J\b\u0010\b\u001a\u00020\u0004H\u0002J\u0019\u0010\r\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000bH\u0096\u0001J\u001b\u0010\u0013\u001a\u00020\u00122\b\u0010\u000f\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J#\u0010\u0016\u001a\u00020\u00122\u0006\u0010\u0014\u001a\u00020\u00122\b\u0010\u0015\u001a\u0004\u0018\u00010\u00122\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u001b\u0010\u0017\u001a\u00020\u00122\b\u0010\u000f\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0019\u0010\u0018\u001a\u00020\u00122\u0006\u0010\u0014\u001a\u00020\u00122\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0011\u0010\u0019\u001a\u00020\u00122\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0011\u0010\u001a\u001a\u00020\u00122\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0011\u0010\u001b\u001a\u00020\u00122\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0019\u0010\u001d\u001a\u00020\u00042\u0006\u0010\n\u001a\u00020\u001c2\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0019\u0010\u001e\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\n\u001a\u00020\u001cH\u0096\u0001J\u0011\u0010\u001f\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0019\u0010 \u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\n\u001a\u00020\u001cH\u0096\u0001J\u001b\u0010\"\u001a\u00020\u00042\b\u0010!\u001a\u0004\u0018\u00010\u000e2\u0006\u0010\u0011\u001a\u00020\u0010H\u0096\u0001J\u0019\u0010%\u001a\u00020\u00042\u0006\u0010$\u001a\u00020#2\u0006\u0010\f\u001a\u00020\u000bH\u0096\u0001J\u0019\u0010*\u001a\u00020\u00042\u0006\u0010'\u001a\u00020&2\u0006\u0010)\u001a\u00020(H\u0096\u0001J\u0019\u0010+\u001a\u00020\u00042\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010)\u001a\u00020(H\u0096\u0001J&\u00103\u001a\u0004\u0018\u0001022\u0006\u0010-\u001a\u00020,2\b\u0010/\u001a\u0004\u0018\u00010.2\b\u00101\u001a\u0004\u0018\u000100H\u0016J\u001a\u00105\u001a\u00020\u00042\u0006\u00104\u001a\u0002022\b\u00101\u001a\u0004\u0018\u000100H\u0016J\u0006\u00106\u001a\u00020\u0004J\b\u00107\u001a\u00020\u0004H\u0016J\b\u00109\u001a\u000208H\u0016R\u0016\u0010=\u001a\u00020:8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b;\u0010<R\"\u0010E\u001a\u00020>8\u0006@\u0006X\u0087.¢\u0006\u0012\n\u0004\b?\u0010@\u001a\u0004\bA\u0010B\"\u0004\bC\u0010DR\u001b\u0010K\u001a\u00020F8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\bG\u0010H\u001a\u0004\bI\u0010JR\u0018\u0010O\u001a\u0004\u0018\u00010L8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\bM\u0010NR\u0014\u0010S\u001a\u00020P8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\bQ\u0010R¨\u0006V"}, d2 = {"Lca/canadapost/module/track/views/PackageDeliveryOptionSelectionFragment;", "Lu8/b;", "Lw8/o;", "Lw8/p0;", "Lrm/n0;", "i0", "T", "X", "j0", "Ll8/c;", Constants.IPC_BUNDLE_KEY_SEND_ERROR, "Landroidx/fragment/app/f;", "fragment", "U", "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", "V", "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", "W", "onDestroy", "", "E", "Lzf/o0;", "u", "Lzf/o0;", "binding", "Lt7/c;", "v", "Lt7/c;", "getContextService", "()Lt7/c;", "setContextService", "(Lt7/c;)V", "contextService", "Ljg/s;", "w", "Lrm/o;", "Y", "()Ljg/s;", "viewModel", "Landroid/app/AlertDialog;", "x", "Landroid/app/AlertDialog;", "progressDialog", "ca/canadapost/module/track/views/PackageDeliveryOptionSelectionFragment$b", "y", "Lca/canadapost/module/track/views/PackageDeliveryOptionSelectionFragment$b;", "onBackPressedCallback", "<init>", "()V", "track_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class PackageDeliveryOptionSelectionFragment extends u8.b implements o, p0 {

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

    /* renamed from: v, reason: collision with root package name and from kotlin metadata */
    public t7.c contextService;

    /* renamed from: x, reason: collision with root package name and from kotlin metadata */
    private AlertDialog progressDialog;

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

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

    /* 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(s.class), new h(new g(this)), new i());

    /* renamed from: y, reason: collision with root package name and from kotlin metadata */
    private final b onBackPressedCallback = new b();

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

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m181invoke() {
            PackageDeliveryOptionSelectionFragment.this.X();
        }
    }

    /* loaded from: classes4.dex */
    public static final class b extends p {
        b() {
            super(true);
        }

        @Override // androidx.activity.p
        public void d() {
            PackageDeliveryOptionSelectionFragment.this.W();
        }
    }

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

        public final void a(n0 n0Var) {
            PackageDeliveryOptionSelectionFragment.this.T();
        }

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

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

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

        d(dn.l function) {
            t.g(function, "function");
            this.f10951a = function;
        }

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

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

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m182invoke() {
            PackageDeliveryOptionSelectionFragment.this.Y().y0();
        }
    }

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

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

        /* renamed from: invoke, reason: collision with other method in class */
        public final void m183invoke() {
            PackageDeliveryOptionSelectionFragment.this.X();
        }
    }

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

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

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

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

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

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

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

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

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

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

    /* JADX INFO: Access modifiers changed from: private */
    public final void T() {
        u8.g c10 = u8.g.f36993k.c(requireContext());
        c10.o(new a());
        c10.x(requireContext());
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void X() {
        x4.d.a(this).U();
    }

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

    /* JADX INFO: Access modifiers changed from: private */
    public static final void Z(PackageDeliveryOptionSelectionFragment this$0, String[] strArr) {
        t.g(this$0, "this$0");
        if (strArr != null) {
            if (!(strArr.length == 0)) {
                o0 o0Var = this$0.binding;
                o0 o0Var2 = null;
                if (o0Var == null) {
                    t.y("binding");
                    o0Var = null;
                }
                o0Var.B.removeAllViews();
                RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(-1, -2);
                o0 o0Var3 = this$0.binding;
                if (o0Var3 == null) {
                    t.y("binding");
                } else {
                    o0Var2 = o0Var3;
                }
                k0.a(o0Var2.B, this$0.getContext(), layoutParams, yf.e.f52507f0, strArr);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void a0(PackageDeliveryOptionSelectionFragment this$0, Event event) {
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        this$0.j0();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void b0(PackageDeliveryOptionSelectionFragment this$0, Event event) {
        t.g(this$0, "this$0");
        r0 r0Var = (r0) event.getContentIfNotHandled();
        if (r0Var != null) {
            if (r0Var.a() != q0.ON) {
                AlertDialog alertDialog = this$0.progressDialog;
                if (alertDialog != null) {
                    alertDialog.dismiss();
                }
                this$0.progressDialog = null;
                return;
            }
            AlertDialog a10 = new u8.n(r0Var.b()).a(this$0.getContext());
            this$0.progressDialog = a10;
            if (a10 != null) {
                a10.show();
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void c0(PackageDeliveryOptionSelectionFragment this$0, Event event) {
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        this$0.Y().b0();
        this$0.X();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void d0(Bundle bundle, View view, PackageDeliveryOptionSelectionFragment this$0, Event event) {
        t.g(view, "$view");
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue() || bundle == null) {
            return;
        }
        String string = this$0.getString(yf.h.f52627p2);
        t.f(string, "getString(...)");
        d0.v(view, string);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void e0(PackageDeliveryOptionSelectionFragment this$0, RadioGroup radioGroup, int i10) {
        t.g(this$0, "this$0");
        t.g(radioGroup, "radioGroup");
        int checkedRadioButtonId = radioGroup.getCheckedRadioButtonId();
        if (checkedRadioButtonId <= 0) {
            this$0.Y().m0().q(null);
        } else {
            this$0.Y().m0().q(Integer.valueOf(radioGroup.indexOfChild(radioGroup.findViewById(checkedRadioButtonId))));
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void f0(PackageDeliveryOptionSelectionFragment this$0, RadioGroup.OnCheckedChangeListener radioGroupOnCheckedChangeListener, Integer num) {
        t.g(this$0, "this$0");
        t.g(radioGroupOnCheckedChangeListener, "$radioGroupOnCheckedChangeListener");
        if (num != null) {
            num.intValue();
            o0 o0Var = null;
            if (num.intValue() < 0) {
                o0 o0Var2 = this$0.binding;
                if (o0Var2 == null) {
                    t.y("binding");
                    o0Var2 = null;
                }
                o0Var2.B.setOnCheckedChangeListener(null);
                o0 o0Var3 = this$0.binding;
                if (o0Var3 == null) {
                    t.y("binding");
                    o0Var3 = null;
                }
                o0Var3.B.clearCheck();
                o0 o0Var4 = this$0.binding;
                if (o0Var4 == null) {
                    t.y("binding");
                } else {
                    o0Var = o0Var4;
                }
                o0Var.B.setOnCheckedChangeListener(radioGroupOnCheckedChangeListener);
                return;
            }
            o0 o0Var5 = this$0.binding;
            if (o0Var5 == null) {
                t.y("binding");
                o0Var5 = null;
            }
            if (o0Var5.B.getChildCount() > num.intValue()) {
                o0 o0Var6 = this$0.binding;
                if (o0Var6 == null) {
                    t.y("binding");
                    o0Var6 = null;
                }
                o0Var6.B.setOnCheckedChangeListener(null);
                o0 o0Var7 = this$0.binding;
                if (o0Var7 == null) {
                    t.y("binding");
                    o0Var7 = null;
                }
                View childAt = o0Var7.B.getChildAt(num.intValue());
                t.e(childAt, "null cannot be cast to non-null type android.widget.RadioButton");
                ((RadioButton) childAt).setChecked(true);
                o0 o0Var8 = this$0.binding;
                if (o0Var8 == null) {
                    t.y("binding");
                } else {
                    o0Var = o0Var8;
                }
                o0Var.B.setOnCheckedChangeListener(radioGroupOnCheckedChangeListener);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void g0(PackageDeliveryOptionSelectionFragment this$0, Event event) {
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        this$0.X();
        String string = this$0.getString(yf.h.M2);
        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 h0(PackageDeliveryOptionSelectionFragment this$0, Event event) {
        t.g(this$0, "this$0");
        Boolean bool = (Boolean) event.getContentIfNotHandled();
        if (bool == null || !bool.booleanValue()) {
            return;
        }
        this$0.i0();
    }

    private final void i0() {
        g.a aVar = u8.g.f36993k;
        androidx.fragment.app.k requireActivity = requireActivity();
        String string = getString(yf.h.f52678z3);
        t.f(string, "getString(...)");
        u8.g l10 = aVar.l(requireActivity, string, getString(yf.h.E1));
        l10.n(requireActivity().getString(yf.h.C1));
        l10.p(requireActivity().getString(yf.h.f52580g0));
        l10.o(new e());
        l10.q(new f());
        l10.x(requireActivity());
    }

    private final void j0() {
        Bundle bundle = new Bundle();
        Object f10 = Y().i0().f();
        t.d(f10);
        bundle.putBoolean("EDIT_DELIVERY_PREFERENCE_KEY", ((Boolean) f10).booleanValue());
        z supportFragmentManager = requireActivity().getSupportFragmentManager();
        t.f(supportFragmentManager, "getSupportFragmentManager(...)");
        jg.z zVar = new jg.z();
        zVar.setArguments(bundle);
        zVar.show(supportFragmentManager, jg.z.class.getSimpleName());
    }

    @Override // u8.b
    public boolean E() {
        W();
        return true;
    }

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

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

    public final void W() {
        Y().Z();
    }

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

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

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

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

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

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

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

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

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

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

    @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.f52540w, container, false);
        t.f(h10, "inflate(...)");
        o0 o0Var = (o0) h10;
        this.binding = o0Var;
        o0 o0Var2 = null;
        if (o0Var == null) {
            t.y("binding");
            o0Var = null;
        }
        o0Var.U(Y());
        o0 o0Var3 = this.binding;
        if (o0Var3 == null) {
            t.y("binding");
            o0Var3 = null;
        }
        o0Var3.O(this);
        o0 o0Var4 = this.binding;
        if (o0Var4 == null) {
            t.y("binding");
        } else {
            o0Var2 = o0Var4;
        }
        return o0Var2.x();
    }

    @Override // androidx.fragment.app.f
    public void onDestroy() {
        super.onDestroy();
        AlertDialog alertDialog = this.progressDialog;
        if (alertDialog != null) {
            alertDialog.dismiss();
        }
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(final View view, Bundle bundle) {
        q onBackPressedDispatcher;
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        o0 o0Var = null;
        this.progressDialog = new u8.n(null, 1, null).a(getContext());
        final Bundle arguments = getArguments();
        if (arguments != null && arguments.containsKey("EDIT_DELIVERY_PREFERENCE_KEY")) {
            Y().a0(arguments.getBoolean("EDIT_DELIVERY_PREFERENCE_KEY", false));
        }
        Y().g0().j(getViewLifecycleOwner(), new g0() { // from class: jg.h
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.Z(PackageDeliveryOptionSelectionFragment.this, (String[]) obj);
            }
        });
        final RadioGroup.OnCheckedChangeListener onCheckedChangeListener = new RadioGroup.OnCheckedChangeListener() { // from class: jg.i
            @Override // android.widget.RadioGroup.OnCheckedChangeListener
            public final void onCheckedChanged(RadioGroup radioGroup, int i10) {
                PackageDeliveryOptionSelectionFragment.e0(PackageDeliveryOptionSelectionFragment.this, radioGroup, i10);
            }
        };
        o0 o0Var2 = this.binding;
        if (o0Var2 == null) {
            t.y("binding");
            o0Var2 = null;
        }
        o0Var2.B.setOnCheckedChangeListener(onCheckedChangeListener);
        Y().m0().j(getViewLifecycleOwner(), new g0() { // from class: jg.j
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.f0(PackageDeliveryOptionSelectionFragment.this, onCheckedChangeListener, (Integer) obj);
            }
        });
        Y().n0().j(getViewLifecycleOwner(), new g0() { // from class: jg.k
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.g0(PackageDeliveryOptionSelectionFragment.this, (Event) obj);
            }
        });
        Y().l0().j(getViewLifecycleOwner(), new g0() { // from class: jg.l
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.h0(PackageDeliveryOptionSelectionFragment.this, (Event) obj);
            }
        });
        Y().d0().j(getViewLifecycleOwner(), new d(new c()));
        Y().k0().j(getViewLifecycleOwner(), new g0() { // from class: jg.m
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.a0(PackageDeliveryOptionSelectionFragment.this, (Event) obj);
            }
        });
        Y().q0().j(getViewLifecycleOwner(), new g0() { // from class: jg.n
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.b0(PackageDeliveryOptionSelectionFragment.this, (Event) obj);
            }
        });
        Y().h0().j(getViewLifecycleOwner(), new g0() { // from class: jg.o
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.c0(PackageDeliveryOptionSelectionFragment.this, (Event) obj);
            }
        });
        Y().p0().j(getViewLifecycleOwner(), new g0() { // from class: jg.p
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                PackageDeliveryOptionSelectionFragment.d0(arguments, view, this, (Event) obj);
            }
        });
        androidx.fragment.app.k activity = getActivity();
        if (activity != null && (onBackPressedDispatcher = activity.getOnBackPressedDispatcher()) != null) {
            u viewLifecycleOwner = getViewLifecycleOwner();
            t.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
            onBackPressedDispatcher.i(viewLifecycleOwner, this.onBackPressedCallback);
        }
        V(Y(), this);
        U(Y(), this);
        o0 o0Var3 = this.binding;
        if (o0Var3 == null) {
            t.y("binding");
        } else {
            o0Var = o0Var3;
        }
        Button tAddTrackItemLookupButton = o0Var.A.B;
        t.f(tAddTrackItemLookupButton, "tAddTrackItemLookupButton");
        d0.g(tAddTrackItemLookupButton);
    }

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