package com.google.android.gms.internal.ads; import androidx.annotation.Nullable; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; import org.json.JSONArray; import org.json.JSONObject; /* loaded from: classes3.dex */ public final class zzdpt { public static String zza(@Nullable JSONObject jSONObject, String str, String str2) { JSONArray optJSONArray; if (jSONObject != null && (optJSONArray = jSONObject.optJSONArray(str2)) != null) { for (int i = 0; i < optJSONArray.length(); i++) { JSONObject optJSONObject = optJSONArray.optJSONObject(i); if (optJSONObject != null) { JSONArray optJSONArray2 = optJSONObject.optJSONArray("including"); JSONArray optJSONArray3 = optJSONObject.optJSONArray("excluding"); if (zzb(optJSONArray2, str) && !zzb(optJSONArray3, str)) { return optJSONObject.optString("effective_ad_unit_id", ""); } } } } return ""; } private static boolean zzb(@Nullable JSONArray jSONArray, String str) { if (jSONArray != null && str != null) { for (int i = 0; i < jSONArray.length(); i++) { String optString = jSONArray.optString(i); try { } catch (PatternSyntaxException e) { com.google.android.gms.ads.internal.zzv.zzp().zzw(e, "RtbAdapterMap.hasAtleastOneRegexMatch"); } if ((((Boolean) com.google.android.gms.ads.internal.client.zzbe.zzc().zza(zzbcl.zzkN)).booleanValue() ? Pattern.compile(optString, 2) : Pattern.compile(optString)).matcher(str).lookingAt()) { return true; } } } return false; } }