package ca.canadapost.module.track.slice;

import android.content.Context;
import android.net.Uri;
import androidx.slice.Slice;
import androidx.slice.c;
import hg.a;
import hg.b;
import hg.d;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.internal.k;
import kotlin.jvm.internal.t;

@Metadata(d1 = {"\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\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010%\n\u0002\b\b\u0018\u0000 \u00122\u00020\u0001:\u0001\u0013B\u0007¢\u0006\u0004\b\u0010\u0010\u0011J\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0005\u001a\u00020\u0004H\u0002J\b\u0010\t\u001a\u00020\bH\u0016J\u0010\u0010\u000b\u001a\u00020\n2\u0006\u0010\u0003\u001a\u00020\u0002H\u0016R \u0010\u000f\u001a\u000e\u0012\u0004\u0012\u00020\u0002\u0012\u0004\u0012\u00020\u00060\f8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\r\u0010\u000e¨\u0006\u0014"}, d2 = {"Lca/canadapost/module/track/slice/CPSliceTrackProvider;", "Landroidx/slice/c;", "Landroid/net/Uri;", "sliceUri", "Landroid/content/Context;", "context", "Lhg/a;", "m", "", "g", "Landroidx/slice/Slice;", "f", "", "t", "Ljava/util/Map;", "savedSlices", "<init>", "()V", "u", "a", "track_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class CPSliceTrackProvider extends c {

    /* renamed from: u, reason: collision with root package name and from kotlin metadata */
    public static final Companion INSTANCE = new Companion(null);

    /* renamed from: t, reason: collision with root package name and from kotlin metadata */
    private final Map savedSlices = new LinkedHashMap();

    /* renamed from: ca.canadapost.module.track.slice.CPSliceTrackProvider$a, reason: from kotlin metadata */
    /* loaded from: classes4.dex */
    public static final class Companion {
        private Companion() {
        }

        public /* synthetic */ Companion(k kVar) {
            this();
        }

        public final String a(String appId) {
            t.g(appId, "appId");
            return appId + ".slice.provider";
        }
    }

    private final a m(Uri sliceUri, Context context) {
        String path = sliceUri.getPath();
        return (path != null && path.hashCode() == 1456191100 && path.equals("/track")) ? new b(context, sliceUri) : new d(context, sliceUri);
    }

    @Override // androidx.slice.c
    public Slice f(Uri sliceUri) {
        t.g(sliceUri, "sliceUri");
        Map map = this.savedSlices;
        Object obj = map.get(sliceUri);
        if (obj == null) {
            Context context = getContext();
            t.d(context);
            obj = m(sliceUri, context);
            map.put(sliceUri, obj);
        }
        return ((a) obj).a();
    }

    @Override // androidx.slice.c
    public boolean g() {
        return true;
    }
}
