package ca.canadapost.module.track.views;

import android.content.Context;
import android.os.Bundle;
import androidx.fragment.app.i0;
import androidx.fragment.app.z;
import ca.canadapost.module.track.views.f;
import java.util.List;
import jg.h3;
import jg.m3;
import jg.r3;
import kotlin.jvm.internal.t;

/* loaded from: classes4.dex */
public final class e extends i0 {

    /* renamed from: j, reason: collision with root package name */
    private Context f11171j;

    /* renamed from: k, reason: collision with root package name */
    private final List f11172k;

    /* renamed from: l, reason: collision with root package name */
    private final String f11173l;

    /* renamed from: m, reason: collision with root package name */
    private final boolean f11174m;

    /* renamed from: n, reason: collision with root package name */
    private final dn.l f11175n;

    /* loaded from: classes4.dex */
    public /* synthetic */ class a {

        /* renamed from: a, reason: collision with root package name */
        public static final /* synthetic */ int[] f11176a;

        static {
            int[] iArr = new int[f.a.values().length];
            try {
                iArr[f.a.PROGRESS_TAB.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[f.a.DETAIL_TAB.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[f.a.PICKUP_TAB.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr[f.a.FEATURES_TAB.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            f11176a = iArr;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public e(Context context, z fragmentManager, List trackItemDetailTabTypeList, String str, boolean z10, dn.l adapterOnClick) {
        super(fragmentManager, 1);
        t.g(fragmentManager, "fragmentManager");
        t.g(trackItemDetailTabTypeList, "trackItemDetailTabTypeList");
        t.g(adapterOnClick, "adapterOnClick");
        this.f11171j = context;
        this.f11172k = trackItemDetailTabTypeList;
        this.f11173l = str;
        this.f11174m = z10;
        this.f11175n = adapterOnClick;
    }

    @Override // androidx.viewpager.widget.a
    public int c() {
        return this.f11172k.size();
    }

    @Override // androidx.viewpager.widget.a
    public CharSequence e(int i10) {
        String string;
        Context context;
        int i11 = a.f11176a[((f.a) this.f11172k.get(i10)).ordinal()];
        if (i11 == 1) {
            Context context2 = this.f11171j;
            if (context2 == null) {
                return null;
            }
            string = context2.getString(yf.h.f52598j3);
        } else if (i11 == 2) {
            Context context3 = this.f11171j;
            if (context3 == null) {
                return null;
            }
            string = context3.getString(yf.h.f52583g3);
        } else if (i11 == 3) {
            Context context4 = this.f11171j;
            if (context4 == null) {
                return null;
            }
            string = context4.getString(yf.h.f52593i3);
        } else {
            if (i11 != 4 || (context = this.f11171j) == null) {
                return null;
            }
            string = context.getString(yf.h.f52588h3);
        }
        return string;
    }

    @Override // androidx.fragment.app.i0
    public androidx.fragment.app.f p(int i10) {
        String str = this.f11173l;
        int i11 = a.f11176a[((f.a) this.f11172k.get(i10)).ordinal()];
        if (i11 == 1) {
            Bundle bundle = new Bundle();
            bundle.putString("TRACK_ITEM_NUMBER", str);
            bundle.putString("TRACK_ITEM_PROGRESS_TYPE", "TRACK_SHARE_DATA_TRACK_ITEM_PROGRESS");
            r3 r3Var = new r3();
            r3Var.setArguments(bundle);
            return r3Var;
        }
        if (i11 == 2) {
            Bundle bundle2 = new Bundle();
            bundle2.putString("TRACK_ITEM_NUMBER", str);
            bundle2.putString("TRACK_ITEM_PROGRESS_TYPE", "TRACK_SHARE_DATA_TRACK_ITEM_DETAIL");
            r3 r3Var2 = new r3();
            r3Var2.setArguments(bundle2);
            return r3Var2;
        }
        if (i11 == 3) {
            Bundle bundle3 = new Bundle();
            bundle3.putString("TRACK_ITEM_NUMBER", str);
            m3 m3Var = new m3();
            m3Var.setArguments(bundle3);
            return m3Var;
        }
        if (i11 != 4) {
            throw new RuntimeException("Unknown Type");
        }
        Bundle bundle4 = new Bundle();
        bundle4.putString("TRACK_ITEM_NUMBER", str);
        bundle4.putBoolean("INTENT_DELIVERY_OPTION_AVAILABLE", this.f11174m);
        h3 h3Var = new h3();
        h3Var.setArguments(bundle4);
        this.f11175n.invoke(h3Var);
        return h3Var;
    }
}
