package o; import android.content.Context; import android.text.TextUtils; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; import o.oKp; /* loaded from: classes2.dex */ public final class ZpP extends lVh { private final String a; private final Context b; private volatile vbd c; private IbW e; private volatile FOx j; private final Object d = new Object(); private PoK f = PoK.b; private final Map i = new HashMap(); private void d() { if (this.c == null) { synchronized (this.d) { if (this.c == null) { this.c = new C16631ppS(this.b, this.a); this.j = new FOx(this.c); } if (this.f == PoK.b && this.c != null) { this.f = C5595bvy.c(this.c.a("/region", null), this.c.a("/agcgw/url", null)); } } } } @Override // o.InterfaceC8452dLk public final String d(String str) { oKp.Sts sts; if (str == null) { throw new NullPointerException("path must not be null."); } if (this.c == null) { d(); } int i = 0; if (str.length() > 0) { while (str.charAt(i) == '/') { i++; } } StringBuilder sb = new StringBuilder("/"); sb.append(str.substring(i)); String obj = sb.toString(); String str2 = this.i.get(obj); if (str2 != null) { return str2; } Map a = oKp.a(); String a2 = (!a.containsKey(obj) || (sts = a.get(obj)) == null) ? null : sts.a(this); if (a2 != null) { return a2; } String a3 = this.c.a(obj, null); return (TextUtils.isEmpty(a3) || !Pattern.matches("^\\[!([A-Fa-f0-9]*)]", a3)) ? a3 : this.j.c(a3, null); } @Override // o.InterfaceC8452dLk public final PoK b() { if (this.f == null) { this.f = PoK.b; } if (this.f == PoK.b && this.c == null) { d(); } PoK poK = this.f; return poK == null ? PoK.b : poK; } @Override // o.InterfaceC8452dLk public final String e() { return "DEFAULT_INSTANCE"; } @Override // o.InterfaceC8452dLk public final Context c() { return this.b; } public ZpP(Context context, String str) { this.b = context; this.a = str; } }