package com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u0000J\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u0000 \"2\b\u0012\u0004\u0012\u00020\u00020\u0001:\u0001#B\u0007¢\u0006\u0004\b\u0003\u0010\u0004J\u0017\u0010\b\u001a\u00020\u00072\u0006\u0010\u0006\u001a\u00020\u0005H\u0002¢\u0006\u0004\b\b\u0010\tJ\u000f\u0010\n\u001a\u00020\u0007H\u0016¢\u0006\u0004\b\n\u0010\u0004J\u000f\u0010\u000b\u001a\u00020\u0007H\u0016¢\u0006\u0004\b\u000b\u0010\u0004J'\u0010\u0010\u001a\u00020\u00002\u0018\u0010\u000f\u001a\u0014\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000e0\r\u0012\u0004\u0012\u00020\u00070\f¢\u0006\u0004\b\u0010\u0010\u0011J\u0015\u0010\u0014\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00020\u0012¢\u0006\u0004\b\u0014\u0010\u0015R\u0016\u0010\u0019\u001a\u00020\u00168\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u0017\u0010\u0018R&\u0010\u001e\u001a\u0012\u0012\u0004\u0012\u00020\u000e0\u001aj\b\u0012\u0004\u0012\u00020\u000e`\u001b8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u001c\u0010\u001dR*\u0010!\u001a\u0016\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u000e0\r\u0012\u0004\u0012\u00020\u0007\u0018\u00010\f8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u001f\u0010 ¨\u0006$"}, d2 = {"Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/SelectSubServiceBottomSheetDialog;", "Lcom/vinfast/companion/core/base/ui/widget/bottomsheet/BaseBottomSheetDialogFragment;", "Lcom/vinfast/companion/services/databinding/BottomSheetDialogSelectSubServiceBinding;", "<init>", "()V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "position", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "P0", "(I)V", "s0", "r0", "Lkotlin/Function1;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Lcom/vinfast/companion/serviceskit/domain/model/Service;", "listener", "Q0", "(Lkotlin/jvm/functions/Function1;)Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/SelectSubServiceBottomSheetDialog;", "Landroidx/fragment/app/FragmentManager;", "manager", "R0", "(Landroidx/fragment/app/FragmentManager;)V", "Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/ThirdLevelServiceAdapter;", "k", "Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/ThirdLevelServiceAdapter;", "mThirdLevelServiceAdapter", "Ljava/util/ArrayList;", "Lkotlin/collections/ArrayList;", "l", "Ljava/util/ArrayList;", "mServiceItems", "m", "Lkotlin/jvm/functions/Function1;", "onServiceSelectedListener", "n", "Companion", "services_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class SelectSubServiceBottomSheetDialog extends com.vinfast.companion.core.base.ui.widget.bottomsheet.BaseBottomSheetDialogFragment<com.vinfast.companion.services.databinding.BottomSheetDialogSelectSubServiceBinding> {

    /* JADX INFO: renamed from: n, reason: from kotlin metadata */
    public static final com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog.Companion INSTANCE = new com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog.Companion(null);

    /* JADX INFO: renamed from: k, reason: from kotlin metadata */
    private com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.ThirdLevelServiceAdapter mThirdLevelServiceAdapter;

    /* JADX INFO: renamed from: l, reason: from kotlin metadata */
    private java.util.ArrayList mServiceItems;

    /* JADX INFO: renamed from: m, reason: from kotlin metadata */
    private kotlin.jvm.functions.Function1 onServiceSelectedListener;

    /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
    @kotlin.Metadata(d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0007\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J'\u0010\n\u001a\u00020\t2\b\u0010\u0005\u001a\u0004\u0018\u00010\u00042\u000e\u0010\b\u001a\n\u0012\u0004\u0012\u00020\u0007\u0018\u00010\u0006¢\u0006\u0004\b\n\u0010\u000bR\u0014\u0010\f\u001a\u00020\u00048\u0002X\u0082T¢\u0006\u0006\n\u0004\b\f\u0010\rR\u0014\u0010\u000e\u001a\u00020\u00048\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000e\u0010\rR\u0014\u0010\u000f\u001a\u00020\u00048\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u000f\u0010\r¨\u0006\u0010"}, d2 = {"Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/SelectSubServiceBottomSheetDialog$Companion;", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "<init>", "()V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "title", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Lcom/vinfast/companion/serviceskit/domain/model/Service;", "services", "Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/SelectSubServiceBottomSheetDialog;", "a", "(Ljava/lang/String;Ljava/util/List;)Lcom/vinfast/companion/main/ui/booking/servicestep/selectsubservicedialog/SelectSubServiceBottomSheetDialog;", "TAG", "Ljava/lang/String;", "ARGS_TITLE", "ARGS_SERVICES", "services_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
    @kotlin.jvm.internal.SourceDebugExtension
    public static final class Companion {
        public /* synthetic */ Companion(kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }

        public final com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog a(java.lang.String title, java.util.List services) {
            java.util.ArrayList arrayList = null;
            if (services != null) {
                java.util.ArrayList arrayList2 = new java.util.ArrayList(kotlin.collections.CollectionsKt.z(services, 10));
                java.util.Iterator it = services.iterator();
                while (it.hasNext()) {
                    arrayList2.add(com.vinfast.companion.serviceskit.domain.model.Service.f((com.vinfast.companion.serviceskit.domain.model.Service) it.next(), (com.vinfast.companion.serviceskit.domain.model.Service) null, false, 3, (java.lang.Object) null));
                }
                arrayList = arrayList2;
            }
            android.os.Bundle bundleB = androidx.core.os.BundleKt.b(new kotlin.Pair[]{kotlin.TuplesKt.a("ARGS_TITLE", title), kotlin.TuplesKt.a("ARGS_SERVICES", arrayList)});
            com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog selectSubServiceBottomSheetDialog = new com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog();
            selectSubServiceBottomSheetDialog.setArguments(bundleB);
            return selectSubServiceBottomSheetDialog;
        }

        private Companion() {
        }
    }

    public SelectSubServiceBottomSheetDialog() {
        super(new kotlin.jvm.functions.Function1() { // from class: t2.b
            public final java.lang.Object invoke(java.lang.Object obj) {
                return com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog.L0((android.view.LayoutInflater) obj);
            }
        });
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final com.vinfast.companion.services.databinding.BottomSheetDialogSelectSubServiceBinding L0(android.view.LayoutInflater layoutInflater) {
        kotlin.jvm.internal.Intrinsics.l(layoutInflater, "it");
        com.vinfast.companion.services.databinding.BottomSheetDialogSelectSubServiceBinding bottomSheetDialogSelectSubServiceBindingC = com.vinfast.companion.services.databinding.BottomSheetDialogSelectSubServiceBinding.c(layoutInflater);
        kotlin.jvm.internal.Intrinsics.k(bottomSheetDialogSelectSubServiceBindingC, "inflate(...)");
        return bottomSheetDialogSelectSubServiceBindingC;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final kotlin.Unit M0(com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog selectSubServiceBottomSheetDialog, int i) {
        selectSubServiceBottomSheetDialog.P0(i);
        return kotlin.Unit.a;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void N0(com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog selectSubServiceBottomSheetDialog, android.view.View view) {
        selectSubServiceBottomSheetDialog.dismiss();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void O0(com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog selectSubServiceBottomSheetDialog, android.view.View view) {
        selectSubServiceBottomSheetDialog.dismiss();
        kotlin.jvm.functions.Function1 function1 = selectSubServiceBottomSheetDialog.onServiceSelectedListener;
        if (function1 != null) {
            java.util.ArrayList arrayList = selectSubServiceBottomSheetDialog.mServiceItems;
            if (arrayList == null) {
                kotlin.jvm.internal.Intrinsics.C("mServiceItems");
                arrayList = null;
            }
            function1.invoke(arrayList);
        }
    }

    private final void P0(int position) {
        if (position >= 0) {
            java.util.ArrayList arrayList = this.mServiceItems;
            com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.ThirdLevelServiceAdapter thirdLevelServiceAdapter = null;
            if (arrayList == null) {
                kotlin.jvm.internal.Intrinsics.C("mServiceItems");
                arrayList = null;
            }
            if (position < arrayList.size()) {
                java.util.ArrayList arrayList2 = this.mServiceItems;
                if (arrayList2 == null) {
                    kotlin.jvm.internal.Intrinsics.C("mServiceItems");
                    arrayList2 = null;
                }
                ((com.vinfast.companion.serviceskit.domain.model.Service) arrayList2.get(position)).P();
                com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.ThirdLevelServiceAdapter thirdLevelServiceAdapter2 = this.mThirdLevelServiceAdapter;
                if (thirdLevelServiceAdapter2 == null) {
                    kotlin.jvm.internal.Intrinsics.C("mThirdLevelServiceAdapter");
                } else {
                    thirdLevelServiceAdapter = thirdLevelServiceAdapter2;
                }
                thirdLevelServiceAdapter.notifyItemChanged(position, 3);
            }
        }
    }

    public final com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog Q0(kotlin.jvm.functions.Function1 listener) {
        kotlin.jvm.internal.Intrinsics.l(listener, "listener");
        this.onServiceSelectedListener = listener;
        return this;
    }

    public final void R0(androidx.fragment.app.FragmentManager manager) {
        kotlin.jvm.internal.Intrinsics.l(manager, "manager");
        super/*androidx.fragment.app.DialogFragment*/.show(manager, "SelectSubServiceBottomSheetDialog");
    }

    /* JADX WARN: Code duplicated, block: B:12:0x0029  */
    public void r0() {
        java.lang.String string;
        java.util.List parcelableArrayList;
        android.os.Bundle arguments = getArguments();
        if (arguments == null || (string = arguments.getString("ARGS_TITLE")) == null) {
            string = okhttp3.HttpUrl.FRAGMENT_ENCODE_SET;
        }
        D0(string);
        java.util.ArrayList arrayList = null;
        if (android.os.Build.VERSION.SDK_INT >= 33) {
            android.os.Bundle arguments2 = getArguments();
            if (arguments2 != null) {
                parcelableArrayList = arguments2.getParcelableArrayList("ARGS_SERVICES", com.vinfast.companion.serviceskit.domain.model.Service.class);
            } else {
                parcelableArrayList = null;
            }
        } else {
            android.os.Bundle arguments3 = getArguments();
            if (arguments3 != null) {
                parcelableArrayList = arguments3.getParcelableArrayList("ARGS_SERVICES");
            } else {
                parcelableArrayList = null;
            }
        }
        if (parcelableArrayList == null) {
            parcelableArrayList = kotlin.collections.CollectionsKt.o();
        }
        this.mServiceItems = new java.util.ArrayList(parcelableArrayList);
        com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.ThirdLevelServiceAdapter thirdLevelServiceAdapter = this.mThirdLevelServiceAdapter;
        if (thirdLevelServiceAdapter == null) {
            kotlin.jvm.internal.Intrinsics.C("mThirdLevelServiceAdapter");
            thirdLevelServiceAdapter = null;
        }
        java.util.ArrayList arrayList2 = this.mServiceItems;
        if (arrayList2 == null) {
            kotlin.jvm.internal.Intrinsics.C("mServiceItems");
        } else {
            arrayList = arrayList2;
        }
        thirdLevelServiceAdapter.k(arrayList);
    }

    public void s0() {
        androidx.recyclerview.widget.RecyclerView recyclerView = n0().d;
        android.content.Context contextRequireContext = requireContext();
        kotlin.jvm.internal.Intrinsics.k(contextRequireContext, "requireContext(...)");
        com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.ThirdLevelServiceAdapter thirdLevelServiceAdapter = new com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.ThirdLevelServiceAdapter(contextRequireContext, new kotlin.jvm.functions.Function1() { // from class: t2.c
            public final java.lang.Object invoke(java.lang.Object obj) {
                return com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog.M0(this.a, ((java.lang.Integer) obj).intValue());
            }
        });
        this.mThirdLevelServiceAdapter = thirdLevelServiceAdapter;
        recyclerView.setAdapter(thirdLevelServiceAdapter);
        int iD = kotlin.math.MathKt.d(com.vinfast.companion.core.utils.DimensionUtils.a.a(0.5f));
        int color = androidx.core.content.ContextCompat.getColor(recyclerView.getContext(), com.vinfast.companion.map.R.color.white_op_16);
        android.content.Context context = recyclerView.getContext();
        kotlin.jvm.internal.Intrinsics.k(context, "getContext(...)");
        int i = com.vinfast.companion.map.R.dimen.dimen24dp;
        int iD2 = com.vinfast.companion.core.extensions.ContextExtensionKt.d(context, i);
        android.content.Context context2 = recyclerView.getContext();
        kotlin.jvm.internal.Intrinsics.k(context2, "getContext(...)");
        recyclerView.addItemDecoration(new com.vinfast.companion.core.base.ui.widget.recyclerview.itemdecoration.InsetDividerDecoration(iD, color, 0, iD2, com.vinfast.companion.core.extensions.ContextExtensionKt.d(context2, i), 4, (kotlin.jvm.internal.DefaultConstructorMarker) null));
        n0().b.setOnClickListener(new android.view.View.OnClickListener() { // from class: t2.d
            @Override // android.view.View.OnClickListener
            public final void onClick(android.view.View view) {
                com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog.N0(this.a, view);
            }
        });
        n0().c.setOnClickListener(new android.view.View.OnClickListener() { // from class: t2.e
            @Override // android.view.View.OnClickListener
            public final void onClick(android.view.View view) {
                com.vinfast.companion.main.ui.booking.servicestep.selectsubservicedialog.SelectSubServiceBottomSheetDialog.O0(this.a, view);
            }
        });
    }
}
