package w; import android.content.Context; import android.content.pm.PackageManager; import android.graphics.Typeface; import com.igaworks.ssp.SSPErrorCode; import java.util.ArrayList; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import q.i; import w.f; /* loaded from: classes.dex */ abstract class e { /* renamed from: a, reason: collision with root package name */ static final androidx.collection.e f14959a = new androidx.collection.e(16); /* renamed from: b, reason: collision with root package name */ private static final ExecutorService f14960b = g.a("fonts-androidx", 10, SSPErrorCode.BANNER_VIEW_IS_EMPTY); /* renamed from: c, reason: collision with root package name */ static final Object f14961c = new Object(); /* renamed from: d, reason: collision with root package name */ static final androidx.collection.g f14962d = new androidx.collection.g(); class a implements Callable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ String f14963a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ Context f14964b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ w.d f14965c; /* renamed from: d, reason: collision with root package name */ final /* synthetic */ int f14966d; a(String str, Context context, w.d dVar, int i10) { this.f14963a = str; this.f14964b = context; this.f14965c = dVar; this.f14966d = i10; } @Override // java.util.concurrent.Callable /* renamed from: a, reason: merged with bridge method [inline-methods] */ public C0250e call() { return e.c(this.f14963a, this.f14964b, this.f14965c, this.f14966d); } } class b implements y.a { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ w.a f14967a; b(w.a aVar) { this.f14967a = aVar; } @Override // y.a /* renamed from: b, reason: merged with bridge method [inline-methods] */ public void a(C0250e c0250e) { if (c0250e == null) { c0250e = new C0250e(-3); } this.f14967a.b(c0250e); } } class c implements Callable { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ String f14968a; /* renamed from: b, reason: collision with root package name */ final /* synthetic */ Context f14969b; /* renamed from: c, reason: collision with root package name */ final /* synthetic */ w.d f14970c; /* renamed from: d, reason: collision with root package name */ final /* synthetic */ int f14971d; c(String str, Context context, w.d dVar, int i10) { this.f14968a = str; this.f14969b = context; this.f14970c = dVar; this.f14971d = i10; } @Override // java.util.concurrent.Callable /* renamed from: a, reason: merged with bridge method [inline-methods] */ public C0250e call() { try { return e.c(this.f14968a, this.f14969b, this.f14970c, this.f14971d); } catch (Throwable unused) { return new C0250e(-3); } } } class d implements y.a { /* renamed from: a, reason: collision with root package name */ final /* synthetic */ String f14972a; d(String str) { this.f14972a = str; } @Override // y.a /* renamed from: b, reason: merged with bridge method [inline-methods] */ public void a(C0250e c0250e) { synchronized (e.f14961c) { androidx.collection.g gVar = e.f14962d; ArrayList arrayList = (ArrayList) gVar.get(this.f14972a); if (arrayList == null) { return; } gVar.remove(this.f14972a); for (int i10 = 0; i10 < arrayList.size(); i10++) { ((y.a) arrayList.get(i10)).a(c0250e); } } } } private static String a(w.d dVar, int i10) { return dVar.d() + "-" + i10; } private static int b(f.a aVar) { int i10 = 1; if (aVar.c() != 0) { return aVar.c() != 1 ? -3 : -2; } f.b[] b10 = aVar.b(); if (b10 != null && b10.length != 0) { i10 = 0; for (f.b bVar : b10) { int b11 = bVar.b(); if (b11 != 0) { if (b11 < 0) { return -3; } return b11; } } } return i10; } static C0250e c(String str, Context context, w.d dVar, int i10) { androidx.collection.e eVar = f14959a; Typeface typeface = (Typeface) eVar.get(str); if (typeface != null) { return new C0250e(typeface); } try { f.a d10 = w.c.d(context, dVar, null); int b10 = b(d10); if (b10 != 0) { return new C0250e(b10); } Typeface b11 = i.b(context, null, d10.b(), i10); if (b11 == null) { return new C0250e(-3); } eVar.put(str, b11); return new C0250e(b11); } catch (PackageManager.NameNotFoundException unused) { return new C0250e(-1); } } static Typeface d(Context context, w.d dVar, int i10, Executor executor, w.a aVar) { String a10 = a(dVar, i10); Typeface typeface = (Typeface) f14959a.get(a10); if (typeface != null) { aVar.b(new C0250e(typeface)); return typeface; } b bVar = new b(aVar); synchronized (f14961c) { androidx.collection.g gVar = f14962d; ArrayList arrayList = (ArrayList) gVar.get(a10); if (arrayList != null) { arrayList.add(bVar); return null; } ArrayList arrayList2 = new ArrayList(); arrayList2.add(bVar); gVar.put(a10, arrayList2); c cVar = new c(a10, context, dVar, i10); if (executor == null) { executor = f14960b; } g.b(executor, cVar, new d(a10)); return null; } } static Typeface e(Context context, w.d dVar, w.a aVar, int i10, int i11) { String a10 = a(dVar, i10); Typeface typeface = (Typeface) f14959a.get(a10); if (typeface != null) { aVar.b(new C0250e(typeface)); return typeface; } if (i11 == -1) { C0250e c10 = c(a10, context, dVar, i10); aVar.b(c10); return c10.f14973a; } try { C0250e c0250e = (C0250e) g.c(f14960b, new a(a10, context, dVar, i10), i11); aVar.b(c0250e); return c0250e.f14973a; } catch (InterruptedException unused) { aVar.b(new C0250e(-3)); return null; } } /* renamed from: w.e$e, reason: collision with other inner class name */ static final class C0250e { /* renamed from: a, reason: collision with root package name */ final Typeface f14973a; /* renamed from: b, reason: collision with root package name */ final int f14974b; C0250e(int i10) { this.f14973a = null; this.f14974b = i10; } boolean a() { return this.f14974b == 0; } C0250e(Typeface typeface) { this.f14973a = typeface; this.f14974b = 0; } } }