package z3;

import android.content.Context;
import android.webkit.WebResourceResponse;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;

/* JADX INFO: loaded from: classes.dex */
public final class u implements w {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final a4.o f37046a;

    public u(Context context) {
        this.f37046a = new a4.o(context);
    }

    @Override // z3.w
    @Nullable
    @WorkerThread
    public WebResourceResponse handle(@NonNull String str) {
        try {
            a4.o oVar = this.f37046a;
            oVar.getClass();
            String strSubstring = (str.length() <= 1 || str.charAt(0) != '/') ? str : str.substring(1);
            InputStream inputStreamOpen = oVar.f347a.getAssets().open(strSubstring, 2);
            if (strSubstring.endsWith(".svgz")) {
                inputStreamOpen = new GZIPInputStream(inputStreamOpen);
            }
            return new WebResourceResponse(a4.o.b(str), null, inputStreamOpen);
        } catch (IOException unused) {
            return new WebResourceResponse(null, null, null);
        }
    }
}
