package com.applovin.impl; import android.net.Uri; import androidx.arch.core.util.Function; import com.applovin.impl.sdk.utils.JsonUtils; import com.applovin.impl.sdk.utils.StringUtils; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.json.JSONObject; /* loaded from: classes.dex */ public class aq extends com.applovin.impl.sdk.ad.b { private final String l; private final String m; private final jq n; private final long o; private final nq p; private final dq q; private final String r; private final cq s; private final sg t; private final Set u; private final Set v; public enum c { COMPANION_AD, VIDEO } public enum d { IMPRESSION, VIDEO_CLICK, COMPANION_CLICK, VIDEO, COMPANION, INDUSTRY_ICON_IMPRESSION, INDUSTRY_ICON_CLICK, ERROR } @Override // com.applovin.impl.sdk.ad.b public void L0() { } @Override // com.applovin.impl.sdk.ad.b public String P() { return this.r; } @Override // com.applovin.impl.sdk.ad.b, com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg public sg getAdEventTracker() { return this.t; } @Override // com.applovin.impl.sdk.AppLovinAdBase public long getCreatedAtMillis() { return this.o; } @Override // com.applovin.impl.sdk.ad.AppLovinAdImpl public JSONObject getOriginalFullResponse() { return this.fullResponse; } public cq i1() { return this.s; } public dq j1() { return this.q; } public jq r1() { return this.n; } public nq t1() { return this.p; } @Override // com.applovin.impl.sdk.ad.AppLovinAdImpl public String toString() { return "VastAd{title='" + this.l + "', adDescription='" + this.m + "', systemInfo=" + this.n + ", videoCreative=" + this.p + ", companionAd=" + this.q + ", adVerifications=" + this.s + ", impressionTrackers=" + this.u + ", errorTrackers=" + this.v + '}'; } private aq(b bVar) { super(bVar.a, bVar.b, bVar.c); this.l = bVar.e; this.n = bVar.g; this.m = bVar.f; this.p = bVar.h; this.q = bVar.i; this.s = bVar.j; this.u = bVar.k; this.v = bVar.l; this.t = new sg(this); Uri t0 = t0(); if (t0 != null) { this.r = t0.toString(); } else { this.r = ""; } this.o = bVar.d; } @Override // com.applovin.impl.sdk.ad.AppLovinAdImpl public boolean hasVideoUrl() { List f; nq nqVar = this.p; return (nqVar == null || (f = nqVar.f()) == null || f.size() <= 0) ? false : true; } @Override // com.applovin.impl.sdk.ad.b public boolean I0() { return getBooleanFromAdObject("vast_is_streaming", Boolean.FALSE); } public void x1() { tl tlVar = this.synchronizedAdObject; if (tlVar != null) { tlVar.c("vast_is_streaming"); return; } synchronized (this.adObjectLock) { this.adObject.remove("vast_is_streaming"); } } @Override // com.applovin.impl.sdk.ad.b, com.applovin.impl.sdk.AppLovinAdBase, com.applovin.impl.lg public boolean isOpenMeasurementEnabled() { return getBooleanFromAdObject("omsdk_enabled", Boolean.TRUE) && this.s != null; } public boolean B1() { return getBooleanFromAdObject("iopms", Boolean.FALSE); } public boolean C1() { return getBooleanFromAdObject("iopmsfsr", Boolean.TRUE); } public long q1() { return getLongFromAdObject("real_close_delay", 0L); } public c n1() { if ("companion_ad".equalsIgnoreCase(getStringFromAdObject("vast_first_caching_operation", "companion_ad"))) { return c.COMPANION_AD; } return c.VIDEO; } public boolean w1() { return getBooleanFromAdObject("vast_immediate_ad_load", Boolean.TRUE); } @Override // com.applovin.impl.sdk.ad.b public Uri t0() { oq u1 = u1(); if (u1 != null) { return u1.d(); } return null; } @Override // com.applovin.impl.sdk.ad.b public Uri i() { nq nqVar = this.p; if (nqVar != null) { return nqVar.b(); } return null; } @Override // com.applovin.impl.sdk.ad.b public Uri k0() { return i(); } @Override // com.applovin.impl.sdk.ad.b public boolean H0() { return getBooleanFromAdObject("video_clickable", Boolean.FALSE) && i() != null; } @Override // com.applovin.impl.sdk.ad.b public List E() { List a2; tl tlVar = this.synchronizedAdObject; if (tlVar != null) { return (List) tlVar.a(new Function() { // from class: com.applovin.impl.aq$$ExternalSyntheticLambda0 @Override // androidx.arch.core.util.Function public final Object apply(Object obj) { List w; w = aq.this.w((tl) obj); return w; } }); } synchronized (this.adObjectLock) { a2 = yp.a(getJsonObjectFromAdObject("vimp_urls", new JSONObject()), getClCode(), null, o1(), Q(), T0(), this.sdk); } return a2; } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ List w(tl tlVar) { return yp.a(tlVar.a("vimp_urls", new JSONObject()), getClCode(), null, o1(), Q(), T0(), this.sdk); } private String o1() { String stringFromAdObject = getStringFromAdObject("vimp_url", null); if (stringFromAdObject != null) { return stringFromAdObject.replace("{CLCODE}", getClCode()); } return null; } public oq u1() { Long f = e4.f(this.sdk); return this.p.a(f != null ? f.longValue() : 0L); } public gq p1() { nq nqVar = this.p; if (nqVar != null) { return nqVar.e(); } return null; } public boolean v1() { return p1() != null; } public boolean A1() { return getBooleanFromAdObject("vast_fire_click_trackers_on_html_clicks", Boolean.FALSE); } public void b(String str) { tl tlVar = this.synchronizedAdObject; if (tlVar != null) { tlVar.b("html_template", str); return; } synchronized (this.adObjectLock) { JsonUtils.putString(this.adObject, "html_template", str); } } public String l1() { return getStringFromAdObject("html_template", ""); } public Uri m1() { String stringFromAdObject = getStringFromAdObject("html_template_url", null); if (StringUtils.isValidString(stringFromAdObject)) { return Uri.parse(stringFromAdObject); } return null; } public boolean y1() { return getBooleanFromAdObject("cache_companion_ad", Boolean.TRUE); } public boolean z1() { return getBooleanFromAdObject("cache_video", Boolean.TRUE); } private Set s1() { nq nqVar = this.p; if (nqVar != null) { return nqVar.a(); } return Collections.emptySet(); } private Set k1() { dq dqVar = this.q; if (dqVar != null) { return dqVar.a(); } return Collections.emptySet(); } private Set a(c cVar, String[] strArr) { Map c2; dq dqVar; nq nqVar; if (strArr != null && strArr.length > 0) { if (cVar == c.VIDEO && (nqVar = this.p) != null) { c2 = nqVar.d(); } else { c2 = (cVar != c.COMPANION_AD || (dqVar = this.q) == null) ? null : dqVar.c(); } HashSet hashSet = new HashSet(); if (c2 != null && !c2.isEmpty()) { for (String str : strArr) { if (c2.containsKey(str)) { hashSet.addAll((Collection) c2.get(str)); } } } return Collections.unmodifiableSet(hashSet); } return Collections.emptySet(); } @Override // com.applovin.impl.sdk.ad.AppLovinAdImpl public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof aq) || !super.equals(obj)) { return false; } aq aqVar = (aq) obj; String str = this.l; if (str == null ? aqVar.l != null : !str.equals(aqVar.l)) { return false; } String str2 = this.m; if (str2 == null ? aqVar.m != null : !str2.equals(aqVar.m)) { return false; } jq jqVar = this.n; if (jqVar == null ? aqVar.n != null : !jqVar.equals(aqVar.n)) { return false; } nq nqVar = this.p; if (nqVar == null ? aqVar.p != null : !nqVar.equals(aqVar.p)) { return false; } dq dqVar = this.q; if (dqVar == null ? aqVar.q != null : !dqVar.equals(aqVar.q)) { return false; } cq cqVar = this.s; if (cqVar == null ? aqVar.s != null : !cqVar.equals(aqVar.s)) { return false; } Set set = this.u; if (set == null ? aqVar.u != null : !set.equals(aqVar.u)) { return false; } Set set2 = this.v; Set set3 = aqVar.v; return set2 != null ? set2.equals(set3) : set3 == null; } @Override // com.applovin.impl.sdk.ad.AppLovinAdImpl public int hashCode() { int hashCode = super.hashCode() * 31; String str = this.l; int hashCode2 = (hashCode + (str != null ? str.hashCode() : 0)) * 31; String str2 = this.m; int hashCode3 = (hashCode2 + (str2 != null ? str2.hashCode() : 0)) * 31; jq jqVar = this.n; int hashCode4 = (hashCode3 + (jqVar != null ? jqVar.hashCode() : 0)) * 31; nq nqVar = this.p; int hashCode5 = (hashCode4 + (nqVar != null ? nqVar.hashCode() : 0)) * 31; dq dqVar = this.q; int hashCode6 = (hashCode5 + (dqVar != null ? dqVar.hashCode() : 0)) * 31; cq cqVar = this.s; int hashCode7 = (hashCode6 + (cqVar != null ? cqVar.hashCode() : 0)) * 31; Set set = this.u; int hashCode8 = (hashCode7 + (set != null ? set.hashCode() : 0)) * 31; Set set2 = this.v; return hashCode8 + (set2 != null ? set2.hashCode() : 0); } public static class b { private JSONObject a; private JSONObject b; private com.applovin.impl.sdk.j c; private long d; private String e; private String f; private jq g; private nq h; private dq i; private cq j; private Set k; private Set l; public b a(long j) { this.d = j; return this; } public b a(cq cqVar) { this.j = cqVar; return this; } public b a(dq dqVar) { this.i = dqVar; return this; } public b a(jq jqVar) { this.g = jqVar; return this; } public b a(nq nqVar) { this.h = nqVar; return this; } public b a(String str) { this.f = str; return this; } public b a(Set set) { this.l = set; return this; } public b b(String str) { this.e = str; return this; } public b b(Set set) { this.k = set; return this; } public b b(JSONObject jSONObject) { if (jSONObject == null) { throw new IllegalArgumentException("No full ad response specified."); } this.b = jSONObject; return this; } public b a(JSONObject jSONObject) { if (jSONObject == null) { throw new IllegalArgumentException("No ad object specified."); } this.a = jSONObject; return this; } public b a(com.applovin.impl.sdk.j jVar) { if (jVar == null) { throw new IllegalArgumentException("No sdk specified."); } this.c = jVar; return this; } public aq a() { return new aq(this); } } public Set a(d dVar, String str) { return a(dVar, new String[]{str}); } public Set a(d dVar, String[] strArr) { this.sdk.J(); if (com.applovin.impl.sdk.n.a()) { this.sdk.J().a("VastAd", "Retrieving trackers of type '" + dVar + "' and events '" + Arrays.toString(strArr) + "'..."); } if (dVar == d.IMPRESSION) { return this.u; } if (dVar == d.VIDEO_CLICK) { return s1(); } if (dVar == d.COMPANION_CLICK) { return k1(); } if (dVar == d.VIDEO) { return a(c.VIDEO, strArr); } if (dVar == d.COMPANION) { return a(c.COMPANION_AD, strArr); } if (dVar == d.INDUSTRY_ICON_CLICK) { return p1().a(); } if (dVar == d.INDUSTRY_ICON_IMPRESSION) { return p1().e(); } if (dVar == d.ERROR) { return this.v; } this.sdk.J(); if (com.applovin.impl.sdk.n.a()) { this.sdk.J().b("VastAd", "Failed to retrieve trackers of invalid type '" + dVar + "' and events '" + Arrays.toString(strArr) + "'"); } return Collections.emptySet(); } }