Perfume Of Love v2.14.9版本的 MD5 值为:16011aefc5a55805771706ce3b259b4e

以下内容为反编译后的 y.java 源代码,内容仅作参考


package com.ironsource.mediationsdk;

import android.app.Activity;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.ironsource.environment.ContextProvider;
import com.ironsource.environment.a;
import com.ironsource.mediationsdk.D;
import com.ironsource.mediationsdk.IronSource;
import com.ironsource.mediationsdk.adunit.adapter.utility.AdInfo;
import com.ironsource.mediationsdk.adunit.data.DataKeys;
import com.ironsource.mediationsdk.config.ConfigFile;
import com.ironsource.mediationsdk.demandOnly.ISDemandOnlyBannerLayout;
import com.ironsource.mediationsdk.demandOnly.ISDemandOnlyInterstitialListener;
import com.ironsource.mediationsdk.demandOnly.ISDemandOnlyRewardedVideoListener;
import com.ironsource.mediationsdk.events.ISErrorListener;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.mediationsdk.logger.IronSourceLogger;
import com.ironsource.mediationsdk.logger.IronSourceLoggerManager;
import com.ironsource.mediationsdk.metadata.MetaData;
import com.ironsource.mediationsdk.metadata.MetaDataUtils;
import com.ironsource.mediationsdk.model.InterstitialPlacement;
import com.ironsource.mediationsdk.model.NetworkSettings;
import com.ironsource.mediationsdk.model.Placement;
import com.ironsource.mediationsdk.sdk.InitializationListener;
import com.ironsource.mediationsdk.sdk.LevelPlayInterstitialListener;
import com.ironsource.mediationsdk.sdk.LevelPlayRewardedVideoListener;
import com.ironsource.mediationsdk.sdk.LevelPlayRewardedVideoManualListener;
import com.ironsource.mediationsdk.sdk.RewardedVideoManualListener;
import com.ironsource.mediationsdk.server.HttpFunctions;
import com.ironsource.mediationsdk.server.ServerURL;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
import com.ironsource.mediationsdk.utils.IronSourceAES;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import com.ironsource.mediationsdk.utils.IronSourceUtils;
import com.ironsource.mediationsdk.utils.j;
import com.ironsource.mediationsdk.utils.k;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
public final class y implements com.ironsource.mediationsdk.utils.h {
    private static boolean am;
    public com.ironsource.mediationsdk.adunit.c.h A;
    public com.ironsource.mediationsdk.adunit.c.c B;
    boolean C;
    boolean D;
    boolean E;
    boolean F;
    boolean G;
    int H;
    com.ironsource.mediationsdk.demandOnly.c I;
    com.ironsource.sdk.f.a J;
    com.ironsource.mediationsdk.impressionData.a K;
    public boolean L;
    private final String M;
    private AbstractAdapter N;
    private AtomicBoolean O;
    private final Object P;
    private String Q;
    private AtomicBoolean R;
    private List<IronSource.AD_UNIT> S;
    private Set<IronSource.AD_UNIT> T;
    private Set<IronSource.AD_UNIT> U;
    private boolean V;
    private final String W;
    private boolean X;
    private boolean Y;
    private ConcurrentHashMap<String, ISDemandOnlyBannerLayout> Z;
    final String a;
    private Boolean aa;
    private IronSourceBannerLayout ab;
    private String ac;
    private InitializationListener ad;
    private AtomicBoolean ae;
    private boolean af;
    private CopyOnWriteArraySet<String> ag;
    private CopyOnWriteArraySet<String> ah;
    private CopyOnWriteArraySet<String> ai;
    private com.ironsource.mediationsdk.demandOnly.e aj;
    private com.ironsource.sdk.controller.x ak;
    private X al;
    private ISErrorListener an;
    F b;
    IronSourceLoggerManager c;
    com.ironsource.mediationsdk.sdk.f d;
    com.ironsource.mediationsdk.logger.b e;
    public com.ironsource.mediationsdk.utils.k f;
    public String g;
    public String h;
    public String i;
    public Map<String, String> j;
    public String k;
    boolean l;
    public String m;
    Context n;
    Boolean o;
    IronSourceSegment p;
    int q;
    boolean r;
    boolean s;
    boolean t;
    boolean u;
    Boolean v;
    InterfaceC1342s w;
    J x;
    G y;
    public com.ironsource.mediationsdk.adunit.c.g z;

    public static class AnonymousClass2 {
        static final int[] a;
        static final int[] b;

        static {
            int[] iArr = new int[j.a.a().length];
            b = iArr;
            try {
                int i = j.a.a;
                iArr[0] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                int[] iArr2 = b;
                int i2 = j.a.b;
                iArr2[1] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                int[] iArr3 = b;
                int i3 = j.a.c;
                iArr3[2] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                int[] iArr4 = b;
                int i4 = j.a.d;
                iArr4[3] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            int[] iArr5 = new int[IronSource.AD_UNIT.values().length];
            a = iArr5;
            try {
                iArr5[IronSource.AD_UNIT.REWARDED_VIDEO.ordinal()] = 1;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                a[IronSource.AD_UNIT.INTERSTITIAL.ordinal()] = 2;
            } catch (NoSuchFieldError unused6) {
            }
            try {
                a[IronSource.AD_UNIT.OFFERWALL.ordinal()] = 3;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                a[IronSource.AD_UNIT.BANNER.ordinal()] = 4;
            } catch (NoSuchFieldError unused8) {
            }
        }
    }

    public interface a {
        void a(String str);
    }

    public static class b {
        static volatile y a = new y((byte) 0);
    }

    private y() {
        this.a = getClass().getName();
        this.M = "!SDK-VERSION-STRING!:com.ironsource:mediationsdk:\u200b7.3.0.1";
        this.P = new Object();
        this.f = null;
        this.g = null;
        this.h = "";
        this.Q = null;
        this.i = null;
        this.j = null;
        this.k = null;
        this.l = false;
        this.m = null;
        this.o = null;
        this.V = true;
        this.W = IronSourceConstants.KEY_SESSION_DEPTH;
        this.v = null;
        this.L = false;
        this.c = IronSourceLoggerManager.getLogger(0);
        com.ironsource.mediationsdk.logger.b bVar = new com.ironsource.mediationsdk.logger.b(null, 1);
        this.e = bVar;
        this.c.addLogger(bVar);
        this.d = new com.ironsource.mediationsdk.sdk.f();
        F f = new F();
        this.b = f;
        f.b = this.d;
        this.O = new AtomicBoolean();
        this.T = new HashSet();
        this.U = new HashSet();
        this.s = false;
        this.r = false;
        this.X = false;
        this.R = new AtomicBoolean(true);
        this.ae = new AtomicBoolean(false);
        this.q = 0;
        this.t = false;
        this.u = false;
        this.Y = false;
        this.m = UUID.randomUUID().toString();
        this.aa = Boolean.FALSE;
        this.F = false;
        this.ac = null;
        this.w = null;
        this.x = null;
        this.ad = null;
        this.y = null;
        this.C = false;
        this.ag = new CopyOnWriteArraySet<>();
        this.ah = new CopyOnWriteArraySet<>();
        this.ai = new CopyOnWriteArraySet<>();
        this.Z = new ConcurrentHashMap<>();
        this.I = null;
        this.aj = null;
        this.J = null;
        this.H = 1;
        this.K = new com.ironsource.mediationsdk.impressionData.a();
        this.ak = new com.ironsource.sdk.controller.x();
        this.al = new X();
        this.an = new ISErrorListener() {
            @Override
            public final void onError(Throwable th) {
                IronLog.INTERNAL.error(th.getMessage());
            }
        };
    }

    y(byte b2) {
        this();
    }

    private void A() {
        if (this.X) {
            B();
            return;
        }
        boolean z = this.f.c.d.h.a;
        this.G = z;
        if (z) {
            x();
        } else {
            w();
        }
    }

    private void B() {
        this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "Banner started in demand only mode", 0);
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < this.f.a.c.size(); i++) {
            String str = this.f.a.c.get(i);
            if (!TextUtils.isEmpty(str)) {
                arrayList.add(this.f.b.a(str));
            }
        }
        if (arrayList.size() <= 0) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, false, 1);
            a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
            b((int) IronSourceConstants.TROUBLESHOOTING_BN_INIT_FAILED, mediationAdditionalData);
            a(IronSource.AD_UNIT.BANNER, false);
            return;
        }
        synchronized (this.ai) {
            this.J = new com.ironsource.sdk.f.a(arrayList, this.f.c.d, this.g, this.h);
        }
        Iterator<String> it = this.ai.iterator();
        while (it.hasNext()) {
            String next = it.next();
            this.J.a(this.Z.get(next), next);
        }
        this.Z.clear();
        this.ai.clear();
    }

    private void C() {
        if (this.aa.booleanValue()) {
            IronLog.INTERNAL.verbose("load banner after init");
            this.aa = Boolean.FALSE;
            a(this.ab, this.ac);
            this.ab = null;
            this.ac = null;
        }
    }

    private boolean D() {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        return (kVar == null || kVar.a == null || this.f.a.a == null || this.f.a.a.size() <= 0) ? false : true;
    }

    private boolean E() {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        return (kVar == null || kVar.a == null || this.f.a.b == null || this.f.a.b.size() <= 0) ? false : true;
    }

    private boolean F() {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        return (kVar == null || kVar.c == null || this.f.c.d == null) ? false : true;
    }

    private boolean G() {
        if (F()) {
            com.ironsource.mediationsdk.utils.k kVar = this.f;
            if ((kVar == null || kVar.a == null || this.f.a.c == null || this.f.a.c.size() <= 0) ? false : true) {
                return true;
            }
        }
        return false;
    }

    private void H() {
        if (this.ad == null || !this.ae.compareAndSet(false, true)) {
            return;
        }
        IronLog.CALLBACK.verbose("onInitializationCompleted()");
        com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(IronSourceConstants.TROUBLESHOOTING_INIT_COMPLETED, IronSourceUtils.getMediationAdditionalData(false)));
        this.ad.onInitializationComplete();
    }

    private int a(com.ironsource.mediationsdk.model.s sVar) {
        return !this.af && !this.C && sVar.k.n ? 2 : 1;
    }

    private IronSourceError a(D.a aVar) {
        if (this.Y) {
            if (this.X) {
                if (aVar == D.a.INIT_FAILED) {
                    return new IronSourceError(510, "ironSource initialization failed");
                }
                if (aVar == D.a.INIT_IN_PROGRESS && D.a().c()) {
                    return new IronSourceError(510, "ironSource initialization in progress");
                }
                return null;
            }
            return new IronSourceError(510, "ironSource SDK was not initialized using Demand Only mode");
        }
        return new IronSourceError(510, "ironSource SDK was not initialized");
    }

    private static com.ironsource.mediationsdk.utils.k a(Context context, String str) {
        if (IronSourceUtils.isInitResponseCached(context)) {
            String cachedValueByKeyOfCachedInitResponse = IronSourceUtils.getCachedValueByKeyOfCachedInitResponse(context, "appKey");
            String cachedValueByKeyOfCachedInitResponse2 = IronSourceUtils.getCachedValueByKeyOfCachedInitResponse(context, DataKeys.USER_ID);
            String cachedValueByKeyOfCachedInitResponse3 = IronSourceUtils.getCachedValueByKeyOfCachedInitResponse(context, "response");
            if (cachedValueByKeyOfCachedInitResponse.equals(str)) {
                com.ironsource.mediationsdk.utils.k kVar = new com.ironsource.mediationsdk.utils.k(context, cachedValueByKeyOfCachedInitResponse, cachedValueByKeyOfCachedInitResponse2, cachedValueByKeyOfCachedInitResponse3);
                kVar.e = k.a.b;
                return kVar;
            }
        }
        return null;
    }

    public static y a() {
        return b.a;
    }

    public static String a(Context context) {
        String C = com.ironsource.environment.h.C(context);
        return !TextUtils.isEmpty(C) ? C : "";
    }

    public static void a(int i, JSONObject jSONObject) {
        com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(i, jSONObject));
    }

    private void a(IronSource.AD_UNIT ad_unit) {
        String str = ad_unit + " ad unit has already been initialized";
        this.c.log(IronSourceLogger.IronSourceTag.API, str, 3);
        IronSourceUtils.sendAutomationLog(str);
    }

    private void a(IronSource.AD_UNIT ad_unit, boolean z) {
        int i = AnonymousClass2.a[ad_unit.ordinal()];
        if (i == 1) {
            if (this.r) {
                Iterator<String> it = this.ah.iterator();
                while (it.hasNext()) {
                    com.ironsource.mediationsdk.demandOnly.i.a().a(it.next(), ErrorBuilder.buildInitFailedError("initISDemandOnly() had failed", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
                }
                this.ah.clear();
            } else if (this.C) {
                if (this.D) {
                    this.D = false;
                    C1339p.a().a(IronSource.AD_UNIT.REWARDED_VIDEO, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
                }
            } else if (z || e() || this.U.contains(ad_unit)) {
                Q.a().a(false, (AdInfo) null);
            }
        } else if (i == 2) {
            if (!this.s) {
                if (this.F) {
                    this.F = false;
                    C1339p.a().a(IronSource.AD_UNIT.INTERSTITIAL, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.INTERSTITIAL_AD_UNIT));
                    return;
                }
                return;
            }
            Iterator<String> it2 = this.ag.iterator();
            while (it2.hasNext()) {
                com.ironsource.mediationsdk.demandOnly.h.a().a(it2.next(), ErrorBuilder.buildInitFailedError("initISDemandOnly() had failed", IronSourceConstants.INTERSTITIAL_AD_UNIT));
            }
            this.ag.clear();
        } else if (i == 3) {
            if (z || k() || this.U.contains(ad_unit)) {
                this.d.onOfferwallAvailable(false);
            }
        } else if (i != 4) {
        } else {
            if (!this.X) {
                if (this.aa.booleanValue()) {
                    this.aa = Boolean.FALSE;
                    C1339p.a().a(IronSource.AD_UNIT.BANNER, new IronSourceError(602, "Init had failed"));
                    this.ab = null;
                    this.ac = null;
                    return;
                }
                return;
            }
            Iterator<String> it3 = this.ai.iterator();
            while (it3.hasNext()) {
                String next = it3.next();
                ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout = this.Z.get(next);
                if (iSDemandOnlyBannerLayout != null) {
                    iSDemandOnlyBannerLayout.getListener().a(next, ErrorBuilder.buildInitFailedError("initISDemandOnly() had failed", IronSourceConstants.BANNER_AD_UNIT));
                }
            }
            this.ai.clear();
        }
    }

    public static void a(ISDemandOnlyInterstitialListener iSDemandOnlyInterstitialListener) {
        com.ironsource.mediationsdk.demandOnly.h.a().a = iSDemandOnlyInterstitialListener;
    }

    public static void a(ISDemandOnlyRewardedVideoListener iSDemandOnlyRewardedVideoListener) {
        com.ironsource.mediationsdk.demandOnly.i.a().a = iSDemandOnlyRewardedVideoListener;
    }

    public static void a(LevelPlayInterstitialListener levelPlayInterstitialListener) {
        IronLog ironLog = IronLog.API;
        if (levelPlayInterstitialListener == null) {
            ironLog.info("ISListener is null");
        } else {
            ironLog.info();
        }
        C1343t.a().a(levelPlayInterstitialListener);
    }

    public static void a(LevelPlayRewardedVideoListener levelPlayRewardedVideoListener) {
        IronLog ironLog = IronLog.API;
        if (levelPlayRewardedVideoListener == null) {
            ironLog.info("RVListener is null");
        } else {
            ironLog.info();
        }
        Q.a().b = levelPlayRewardedVideoListener;
    }

    public static void a(String str, JSONObject jSONObject) {
        String str2 = "networkKey = " + str;
        if (jSONObject != null) {
            str2 = str2 + " networkData = " + jSONObject;
        }
        IronLog.API.verbose(str2);
        C1326c.a().a(str, jSONObject);
    }

    public static void a(JSONObject jSONObject, Object[][] objArr) {
        for (int i = 0; i <= 0; i++) {
            try {
                Object[] objArr2 = objArr[0];
                jSONObject.put(objArr2[0].toString(), objArr2[1]);
            } catch (Exception e) {
                IronSourceLoggerManager logger = IronSourceLoggerManager.getLogger();
                IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.INTERNAL;
                logger.log(ironSourceTag, "IronSourceObject addToDictionary: " + Log.getStackTraceString(e), 3);
                return;
            }
        }
    }

    public static void a(boolean z) {
        IronSourceLoggerManager logger = IronSourceLoggerManager.getLogger();
        IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
        logger.log(ironSourceTag, "setAdaptersDebug : " + z, 1);
        C1326c.a().b(z);
    }

    private static void a(boolean z, int i, JSONObject jSONObject) {
        String str;
        try {
            StringBuilder sb = new StringBuilder();
            if (a.AnonymousClass1.d()) {
                sb.append(IronSourceConstants.IS_APP_LANGUAGE_KOTLIN);
                str = a.AnonymousClass1.c();
            } else {
                str = IronSourceConstants.IS_APP_LANGUAGE_JAVA;
            }
            sb.append(str);
            sb.append(String.format(",androidx=%s", Boolean.valueOf(IronSourceUtils.isAndroidXAvailable())));
            if (z) {
                Object[] objArr = new Object[1];
                objArr[0] = Boolean.valueOf(ContextProvider.getInstance().getCurrentActiveActivity() != null);
                sb.append(String.format(",Activity=%s", objArr));
            }
            sb.append(String.format(",cachedUserAgent=%s", Boolean.valueOf(com.ironsource.environment.h.a)));
            jSONObject.put(IronSourceConstants.EVENTS_EXT1, sb.toString());
            jSONObject.put(IronSourceConstants.KEY_SESSION_DEPTH, i);
        } catch (Exception e) {
            e.printStackTrace();
        }
        com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(14, jSONObject));
    }

    private synchronized void a(boolean z, IronSource.AD_UNIT... ad_unitArr) {
        int i = 0;
        for (IronSource.AD_UNIT ad_unit : ad_unitArr) {
            if (ad_unit.equals(IronSource.AD_UNIT.INTERSTITIAL)) {
                this.u = true;
            } else if (ad_unit.equals(IronSource.AD_UNIT.BANNER)) {
                this.Y = true;
            } else if (ad_unit.equals(IronSource.AD_UNIT.REWARDED_VIDEO)) {
                this.t = true;
            }
        }
        if (D.a().b() == D.a.INIT_FAILED) {
            try {
                if (this.d != null) {
                    int length = ad_unitArr.length;
                    while (i < length) {
                        IronSource.AD_UNIT ad_unit2 = ad_unitArr[i];
                        if (!this.T.contains(ad_unit2)) {
                            a(ad_unit2, true);
                        }
                        i++;
                    }
                }
                return;
            } catch (Exception e) {
                e.printStackTrace();
                return;
            }
        } else if (!this.l) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(z);
            int length2 = ad_unitArr.length;
            boolean z2 = false;
            while (i < length2) {
                IronSource.AD_UNIT ad_unit3 = ad_unitArr[i];
                if (this.T.contains(ad_unit3)) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, ad_unit3 + " ad unit has started initializing.", 3);
                } else {
                    this.T.add(ad_unit3);
                    this.U.add(ad_unit3);
                    try {
                        mediationAdditionalData.put(ad_unit3.toString(), true);
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                    z2 = true;
                }
                i++;
            }
            if (z2) {
                int i2 = this.q + 1;
                this.q = i2;
                a(z, i2, mediationAdditionalData);
            }
            return;
        } else {
            D.a().b(z);
            if (this.S == null) {
                return;
            }
            JSONObject mediationAdditionalData2 = IronSourceUtils.getMediationAdditionalData(z);
            boolean z3 = false;
            for (IronSource.AD_UNIT ad_unit4 : ad_unitArr) {
                if (this.T.contains(ad_unit4)) {
                    a(ad_unit4);
                } else {
                    this.T.add(ad_unit4);
                    this.U.add(ad_unit4);
                    try {
                        mediationAdditionalData2.put(ad_unit4.toString(), true);
                    } catch (Exception e3) {
                        e3.printStackTrace();
                    }
                    List<IronSource.AD_UNIT> list = this.S;
                    if (list == null || !list.contains(ad_unit4)) {
                        a(ad_unit4, false);
                    } else {
                        b(ad_unit4);
                    }
                    z3 = true;
                }
            }
            if (z3) {
                int i3 = this.q + 1;
                this.q = i3;
                a(z, i3, mediationAdditionalData2);
            }
            return;
        }
    }

    private boolean a(ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, String str) {
        synchronized (this.ai) {
            if (this.J == null) {
                if (!this.ai.contains(str)) {
                    this.ai.add(str);
                }
                this.Z.put(str, iSDemandOnlyBannerLayout);
                return true;
            }
            return false;
        }
    }

    public static boolean a(com.ironsource.mediationsdk.utils.k kVar) {
        return kVar != null && kVar.c();
    }

    private static boolean a(String str, int i, int i2) {
        return str != null && str.length() >= i && str.length() <= i2;
    }

    private static IronSourceError b(Activity activity, ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, String str) {
        if (activity == null && ContextProvider.getInstance().getCurrentActiveActivity() == null) {
            return new IronSourceError(IronSourceError.ERROR_DO_BN_LOAD_MISSING_ACTIVITY, "Banner was initialized and loaded without Activity");
        }
        if (iSDemandOnlyBannerLayout == null || iSDemandOnlyBannerLayout.isDestroyed()) {
            return new IronSourceError(510, iSDemandOnlyBannerLayout == null ? "Missing banner layout" : "Banner layout is destroyed");
        } else if (TextUtils.isEmpty(str)) {
            return new IronSourceError(510, "Missing instance Id");
        } else {
            return null;
        }
    }

    private com.ironsource.mediationsdk.utils.k b(Context context, String str, a aVar) {
        com.ironsource.mediationsdk.utils.k kVar = null;
        if (IronSourceUtils.isNetworkConnected(context)) {
            try {
                String a2 = a(context);
                if (TextUtils.isEmpty(a2)) {
                    a2 = com.ironsource.environment.h.x(context);
                    IronSourceLoggerManager.getLogger().log(IronSourceLogger.IronSourceTag.INTERNAL, "using custom identifier", 1);
                }
                String str2 = a2;
                IronSourceSegment ironSourceSegment = this.p;
                String stringFromURL = HttpFunctions.getStringFromURL(ServerURL.getCPVProvidersURL(context, this.g, str, str2, this.k, this.C, ironSourceSegment != null ? ironSourceSegment.a() : null, m()), aVar);
                if (stringFromURL == null) {
                    IronLog.INTERNAL.warning("serverResponseString is null");
                    return null;
                }
                if (IronSourceUtils.getSerr() == 1) {
                    IronLog.INTERNAL.verbose("encrypt");
                    String optString = new JSONObject(stringFromURL).optString("response", null);
                    if (TextUtils.isEmpty(optString)) {
                        IronLog.INTERNAL.warning("encryptedResponse is empty - return null");
                        return null;
                    }
                    stringFromURL = IronSourceAES.decode(com.ironsource.mediationsdk.utils.e.a().b(), optString);
                    if (TextUtils.isEmpty(stringFromURL)) {
                        IronLog.INTERNAL.warning("encoded response invalid - return null");
                        if (!am) {
                            am = true;
                            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false);
                            try {
                                mediationAdditionalData.put("status", "false");
                                mediationAdditionalData.put(IronSourceConstants.EVENTS_ERROR_CODE, 1);
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                            com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(114, mediationAdditionalData));
                        }
                        return null;
                    }
                }
                com.ironsource.mediationsdk.utils.k kVar2 = new com.ironsource.mediationsdk.utils.k(context, this.g, str, stringFromURL);
                try {
                    kVar2.e = k.a.c;
                    if (kVar2.b()) {
                        return kVar2;
                    }
                    IronLog.INTERNAL.warning("response invalid - return null");
                    return null;
                } catch (Exception e2) {
                    e = e2;
                    kVar = kVar2;
                    IronLog ironLog = IronLog.INTERNAL;
                    ironLog.warning("exception = " + e);
                    e.printStackTrace();
                    return kVar;
                }
            } catch (Exception e3) {
                e = e3;
                IronLog ironLog2 = IronLog.INTERNAL;
                ironLog2.warning("exception = " + e);
                e.printStackTrace();
                return kVar;
            }
        }
        return null;
    }

    private static void b(int i, JSONObject jSONObject) {
        com.ironsource.mediationsdk.events.e.d().b(new com.ironsource.mediationsdk.events.d(i, jSONObject));
    }

    private void b(IronSource.AD_UNIT ad_unit) {
        int i = AnonymousClass2.a[ad_unit.ordinal()];
        if (i == 1) {
            p();
        } else if (i == 2) {
            z();
        } else if (i == 3) {
            this.b.a(this.g, this.h);
        } else if (i != 4) {
        } else {
            A();
        }
    }

    private boolean b(ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, String str) {
        if (D.a().b() == D.a.INIT_IN_PROGRESS) {
            synchronized (this.ai) {
                if (!this.ai.contains(str)) {
                    this.ai.add(str);
                }
                this.Z.put(str, iSDemandOnlyBannerLayout);
            }
            return true;
        }
        return false;
    }

    private void n() {
        this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "Rewarded Video started in programmatic mode", 0);
        List<NetworkSettings> r = r();
        if (r.size() <= 0) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, true, this.H);
            a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
            a((int) IronSourceConstants.TROUBLESHOOTING_RV_INIT_FAILED, mediationAdditionalData);
            a(IronSource.AD_UNIT.REWARDED_VIDEO, false);
            return;
        }
        this.w = this.f.c.a.k.n ? new z(r, this.f.c.a, this.g, IronSourceUtils.getUserIdForNetworks(), com.ironsource.d.a.a().b(), this.p) : new M(r, this.f.c.a, this.g, IronSourceUtils.getUserIdForNetworks(), com.ironsource.d.a.a().b(), this.p);
        Boolean bool = this.o;
        if (bool != null) {
            this.w.a(this.n, bool.booleanValue());
        }
    }

    private void o() {
        this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "Rewarded Video started in demand only mode", 0);
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < this.f.a.a.size(); i++) {
            String str = this.f.a.a.get(i);
            if (!TextUtils.isEmpty(str)) {
                arrayList.add(this.f.b.a(str));
            }
        }
        if (arrayList.size() <= 0) {
            a(IronSource.AD_UNIT.REWARDED_VIDEO, false);
            return;
        }
        synchronized (this.ah) {
            this.aj = new com.ironsource.mediationsdk.demandOnly.e(arrayList, this.f.c.a, this.g, this.h);
        }
        if (ContextProvider.getInstance().getCurrentActiveActivity() == null) {
            a(IronSource.AD_UNIT.REWARDED_VIDEO, false);
            return;
        }
        Iterator<String> it = this.ah.iterator();
        while (it.hasNext()) {
            this.aj.a(it.next(), (String) null, false);
        }
        this.ah.clear();
    }

    private Placement p(String str) {
        com.ironsource.mediationsdk.model.s sVar = this.f.c.a;
        if (sVar != null) {
            Iterator<Placement> it = sVar.a.iterator();
            while (it.hasNext()) {
                Placement next = it.next();
                if (next.getPlacementName().equals(str)) {
                    return next;
                }
            }
        }
        return null;
    }

    private void p() {
        if (this.r) {
            o();
            return;
        }
        com.ironsource.mediationsdk.model.s sVar = this.f.c.a;
        this.af = sVar.k.a;
        this.H = a(sVar);
        if (this.C || this.af) {
            q();
        } else {
            n();
        }
    }

    private void q() {
        IronLog.INTERNAL.verbose();
        List<NetworkSettings> r = r();
        if (r.size() <= 0) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, true, this.H);
            a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
            a((int) IronSourceConstants.TROUBLESHOOTING_RV_INIT_FAILED, mediationAdditionalData);
            a(IronSource.AD_UNIT.REWARDED_VIDEO, false);
            return;
        }
        com.ironsource.mediationsdk.adunit.c.h hVar = new com.ironsource.mediationsdk.adunit.c.h(r, this.f.c.a, IronSourceUtils.getUserIdForNetworks(), this.C, com.ironsource.d.a.a().b(), this.p, this.f.d());
        this.A = hVar;
        Boolean bool = this.o;
        if (bool != null) {
            hVar.b(bool.booleanValue());
        }
        if (this.D && this.C) {
            this.D = false;
            this.A.j();
        }
    }

    private void q(String str) {
        Placement placement;
        com.ironsource.mediationsdk.adunit.c.h hVar;
        InterfaceC1342s interfaceC1342s;
        try {
            placement = p(str);
            if (placement == null) {
                try {
                    placement = c();
                } catch (Exception e) {
                    e = e;
                    this.c.logException(IronSourceLogger.IronSourceTag.API, "showProgrammaticRewardedVideo()", e);
                    hVar = this.A;
                    if (hVar == null) {
                    }
                    interfaceC1342s = this.w;
                    if (interfaceC1342s == null) {
                    }
                }
            }
            if (placement == null) {
                this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "showProgrammaticRewardedVideo error: empty default placement in response", 3);
                Q.a().a(new IronSourceError(1021, "showProgrammaticRewardedVideo error: empty default placement in response"), (AdInfo) null);
                return;
            }
        } catch (Exception e2) {
            e = e2;
            placement = null;
        }
        hVar = this.A;
        if (hVar == null && (this.C || this.af)) {
            hVar.a(placement);
            return;
        }
        interfaceC1342s = this.w;
        if (interfaceC1342s == null) {
            interfaceC1342s.a(placement);
            return;
        }
        this.c.log(IronSourceLogger.IronSourceTag.API, "showProgrammaticRewardedVideo - show called before init completed, managers not initiated yet", 3);
        Q.a().a(new IronSourceError(1023, "showProgrammaticRewardedVideo - show called before init completed, managers not initiated yet"), (AdInfo) null);
    }

    private InterstitialPlacement r(String str) {
        com.ironsource.mediationsdk.model.l lVar = this.f.c.b;
        if (lVar != null) {
            Iterator<InterstitialPlacement> it = lVar.a.iterator();
            while (it.hasNext()) {
                InterstitialPlacement next = it.next();
                if (next.getPlacementName().equals(str)) {
                    return next;
                }
            }
        }
        return null;
    }

    private List<NetworkSettings> r() {
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < this.f.a.a.size(); i++) {
            String str = this.f.a.a.get(i);
            if (!TextUtils.isEmpty(str)) {
                arrayList.add(this.f.b.a(str));
            }
        }
        return arrayList;
    }

    private List<NetworkSettings> s() {
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < this.f.a.b.size(); i++) {
            String str = this.f.a.b.get(i);
            if (!TextUtils.isEmpty(str)) {
                arrayList.add(this.f.b.a(str));
            }
        }
        return arrayList;
    }

    private void s(String str) {
        try {
            InterstitialPlacement r = r(str);
            if (r == null) {
                r = g();
            }
            if (r == null) {
                this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "showProgrammaticInterstitial error: empty default placement in response", 3);
                C1343t.a().a(new IronSourceError(1020, "showProgrammaticInterstitial error: empty default placement in response"), (AdInfo) null);
            } else if (this.E) {
                this.z.a(new Placement(r));
            } else {
                this.x.a(r.getPlacementName());
            }
        } catch (Exception e) {
            this.c.logException(IronSourceLogger.IronSourceTag.API, "showProgrammaticInterstitial()", e);
        }
    }

    private List<NetworkSettings> t() {
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < this.f.a.c.size(); i++) {
            String str = this.f.a.c.get(i);
            if (!TextUtils.isEmpty(str)) {
                arrayList.add(this.f.b.a(str));
            }
        }
        return arrayList;
    }

    private static boolean t(String str) {
        if (str == null) {
            return false;
        }
        return str.matches("^[a-zA-Z0-9]*$");
    }

    private int u(String str) {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        if (kVar == null || kVar.c == null || this.f.c.b == null) {
            return j.a.d;
        }
        InterstitialPlacement interstitialPlacement = null;
        try {
            interstitialPlacement = r(str);
            if (interstitialPlacement == null && (interstitialPlacement = g()) == null) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Default placement was not found", 3);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return interstitialPlacement == null ? j.a.d : com.ironsource.mediationsdk.utils.j.b(ContextProvider.getInstance().getApplicationContext(), interstitialPlacement);
    }

    private void u() {
        IronLog.INTERNAL.verbose();
        List<NetworkSettings> s = s();
        if (s.size() <= 0) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, true, 1);
            a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
            b((int) IronSourceConstants.TROUBLESHOOTING_IS_INIT_FAILED, mediationAdditionalData);
            a(IronSource.AD_UNIT.INTERSTITIAL, false);
            return;
        }
        com.ironsource.mediationsdk.adunit.c.g gVar = new com.ironsource.mediationsdk.adunit.c.g(s, this.f.c.b, IronSourceUtils.getUserIdForNetworks(), com.ironsource.d.a.a().b(), this.p, this.f.d());
        this.z = gVar;
        Boolean bool = this.o;
        if (bool != null) {
            gVar.b(bool.booleanValue());
        }
        if (this.F) {
            this.F = false;
            this.z.j();
        }
    }

    private com.ironsource.mediationsdk.model.i v(String str) {
        com.ironsource.mediationsdk.model.i a2;
        com.ironsource.mediationsdk.model.h hVar = this.f.c.d;
        return hVar == null ? new com.ironsource.mediationsdk.model.k() : (TextUtils.isEmpty(str) || (a2 = hVar.a(str)) == null) ? hVar.a() : a2;
    }

    private void v() {
        this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "Adunit: Interstitial is now initiated - programmatic mode", 0);
        List<NetworkSettings> s = s();
        if (s.size() <= 0) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, true, 1);
            a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
            b((int) IronSourceConstants.TROUBLESHOOTING_IS_INIT_FAILED, mediationAdditionalData);
            a(IronSource.AD_UNIT.INTERSTITIAL, false);
            return;
        }
        J j = new J(s, this.f.c.b, this.g, IronSourceUtils.getUserIdForNetworks(), this.f.c.b.f, com.ironsource.d.a.a().b(), this.p);
        this.x = j;
        Boolean bool = this.o;
        if (bool != null) {
            j.a(bool.booleanValue());
        }
        if (this.F) {
            this.F = false;
            this.x.d();
        }
    }

    private void w() {
        IronLog.INTERNAL.verbose();
        List<NetworkSettings> t = t();
        if (t.size() > 0) {
            this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "Banner started in programmatic mode", 0);
            this.y = new G(t, new com.ironsource.mediationsdk.utils.j(this.g, IronSourceUtils.getUserIdForNetworks(), this.f.c.d), com.ironsource.d.a.a().b(), this.p);
            C();
            return;
        }
        JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, true, 1);
        a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
        b((int) IronSourceConstants.TROUBLESHOOTING_BN_INIT_FAILED, mediationAdditionalData);
        a(IronSource.AD_UNIT.BANNER, false);
    }

    private void x() {
        IronLog.INTERNAL.verbose();
        List<NetworkSettings> t = t();
        if (t.size() > 0) {
            this.B = new com.ironsource.mediationsdk.adunit.c.c(t, this.f.c.d, IronSourceUtils.getUserIdForNetworks(), com.ironsource.d.a.a().b(), this.p, this.f.d());
            C();
            return;
        }
        JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, true, 1);
        a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
        b((int) IronSourceConstants.TROUBLESHOOTING_BN_INIT_FAILED, mediationAdditionalData);
        a(IronSource.AD_UNIT.BANNER, false);
    }

    private void y() {
        this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, "Interstitial started in demand only mode", 0);
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < this.f.a.b.size(); i++) {
            String str = this.f.a.b.get(i);
            if (!TextUtils.isEmpty(str)) {
                arrayList.add(this.f.b.a(str));
            }
        }
        if (arrayList.size() <= 0) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false, false, 1);
            a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_ERROR_CODE, 1010}});
            b((int) IronSourceConstants.TROUBLESHOOTING_IS_INIT_FAILED, mediationAdditionalData);
            a(IronSource.AD_UNIT.INTERSTITIAL, false);
            return;
        }
        synchronized (this.ag) {
            this.I = new com.ironsource.mediationsdk.demandOnly.c(arrayList, this.f.c.b, this.g, this.h);
        }
        Iterator<String> it = this.ag.iterator();
        while (it.hasNext()) {
            this.I.a(it.next(), (String) null, false);
        }
        this.ag.clear();
    }

    private void z() {
        if (this.s) {
            y();
            return;
        }
        boolean z = this.f.c.b.g.a;
        this.E = z;
        if (z) {
            u();
        } else {
            v();
        }
    }

    public final IronSourceBannerLayout a(Activity activity, ISBannerSize iSBannerSize) {
        this.c.log(IronSourceLogger.IronSourceTag.API, "createBanner()", 1);
        if (activity == null) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "createBanner() : Activity cannot be null", 3);
            return null;
        }
        ContextProvider.getInstance().updateActivity(activity);
        return new IronSourceBannerLayout(activity, iSBannerSize);
    }

    public final com.ironsource.mediationsdk.utils.k a(Context context, String str, a aVar) {
        com.ironsource.mediationsdk.events.i d;
        int i;
        com.ironsource.mediationsdk.events.e d2;
        int i2;
        synchronized (this.P) {
            com.ironsource.mediationsdk.utils.k kVar = this.f;
            if (kVar != null) {
                return new com.ironsource.mediationsdk.utils.k(kVar);
            }
            com.ironsource.mediationsdk.utils.k b2 = b(context, str, aVar);
            if (b2 == null || !b2.b()) {
                IronSourceLoggerManager.getLogger().log(IronSourceLogger.IronSourceTag.INTERNAL, "Null or invalid response. Trying to get cached response", 0);
                b2 = a(context, this.g);
                if (b2 != null) {
                    IronSourceError buildUsingCachedConfigurationError = ErrorBuilder.buildUsingCachedConfigurationError(this.g, str);
                    IronSourceLoggerManager ironSourceLoggerManager = this.c;
                    IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.INTERNAL;
                    ironSourceLoggerManager.log(ironSourceTag, buildUsingCachedConfigurationError.toString() + ": " + b2.toString(), 1);
                    com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(IronSourceConstants.USING_CACHE_FOR_INIT_EVENT, IronSourceUtils.getMediationAdditionalData(false)));
                }
            }
            if (b2 != null) {
                this.f = b2;
                IronSourceUtils.saveLastResponse(context, b2.toString());
                com.ironsource.mediationsdk.utils.k kVar2 = this.f;
                this.e.setDebugLevel(kVar2.c.e.a.a);
                this.c.setLoggerDebugLevel("console", kVar2.c.e.a.b);
                boolean z = e() ? kVar2.c.a.b.a : false;
                boolean z2 = i() ? kVar2.c.b.b.a : false;
                boolean z3 = F() ? kVar2.c.d.a.a : false;
                boolean z4 = k() ? kVar2.c.c.c.a : false;
                com.ironsource.mediationsdk.utils.i iVar = kVar2.c.e.h;
                boolean a2 = iVar.a();
                if (z) {
                    com.ironsource.mediationsdk.model.e eVar = kVar2.c.a.b;
                    com.ironsource.mediationsdk.events.i.d().b(eVar.e, context);
                    com.ironsource.mediationsdk.events.i.d().a(eVar.d, context);
                    com.ironsource.mediationsdk.events.i.d().b(eVar.g);
                    com.ironsource.mediationsdk.events.i.d().c(eVar.h);
                    com.ironsource.mediationsdk.events.i.d().a(eVar.f);
                    com.ironsource.mediationsdk.events.i.d().a(eVar.i, context);
                    com.ironsource.mediationsdk.events.i.d().b(eVar.j, context);
                    com.ironsource.mediationsdk.events.i.d().c(eVar.k, context);
                    com.ironsource.mediationsdk.events.i.d().d(eVar.l, context);
                    com.ironsource.mediationsdk.events.i.d().a(kVar2.c.e.b);
                    com.ironsource.mediationsdk.events.i.d().c = eVar.b;
                    d = com.ironsource.mediationsdk.events.i.d();
                    i = eVar.c;
                } else if (z4) {
                    com.ironsource.mediationsdk.model.e eVar2 = kVar2.c.c.c;
                    com.ironsource.mediationsdk.events.i.d().b(eVar2.e, context);
                    com.ironsource.mediationsdk.events.i.d().a(eVar2.d, context);
                    com.ironsource.mediationsdk.events.i.d().b(eVar2.g);
                    com.ironsource.mediationsdk.events.i.d().c(eVar2.h);
                    com.ironsource.mediationsdk.events.i.d().a(eVar2.f);
                    com.ironsource.mediationsdk.events.i.d().a(eVar2.i, context);
                    com.ironsource.mediationsdk.events.i.d().b(eVar2.j, context);
                    com.ironsource.mediationsdk.events.i.d().c(eVar2.k, context);
                    com.ironsource.mediationsdk.events.i.d().d(eVar2.l, context);
                    com.ironsource.mediationsdk.events.i.d().a(kVar2.c.e.b);
                    com.ironsource.mediationsdk.events.i.d().c = eVar2.b;
                    d = com.ironsource.mediationsdk.events.i.d();
                    i = eVar2.c;
                } else {
                    com.ironsource.mediationsdk.events.i.d().g = false;
                    if (!z2) {
                        com.ironsource.mediationsdk.model.e eVar3 = kVar2.c.b.b;
                        com.ironsource.mediationsdk.events.e.d().b(eVar3.e, context);
                        com.ironsource.mediationsdk.events.e.d().a(eVar3.d, context);
                        com.ironsource.mediationsdk.events.e.d().b(eVar3.g);
                        com.ironsource.mediationsdk.events.e.d().c(eVar3.h);
                        com.ironsource.mediationsdk.events.e.d().a(eVar3.f);
                        com.ironsource.mediationsdk.events.e.d().a(eVar3.i, context);
                        com.ironsource.mediationsdk.events.e.d().b(eVar3.j, context);
                        com.ironsource.mediationsdk.events.e.d().c(eVar3.k, context);
                        com.ironsource.mediationsdk.events.e.d().d(eVar3.l, context);
                        com.ironsource.mediationsdk.events.e.d().a(kVar2.c.e.b);
                        com.ironsource.mediationsdk.events.e.d().c = eVar3.b;
                        d2 = com.ironsource.mediationsdk.events.e.d();
                        i2 = eVar3.c;
                    } else if (z3) {
                        com.ironsource.mediationsdk.model.e eVar4 = kVar2.c.d.a;
                        com.ironsource.mediationsdk.events.e.d().b(eVar4.e, context);
                        com.ironsource.mediationsdk.events.e.d().a(eVar4.d, context);
                        com.ironsource.mediationsdk.events.e.d().b(eVar4.g);
                        com.ironsource.mediationsdk.events.e.d().c(eVar4.h);
                        com.ironsource.mediationsdk.events.e.d().a(eVar4.f);
                        com.ironsource.mediationsdk.events.e.d().a(eVar4.i, context);
                        com.ironsource.mediationsdk.events.e.d().b(eVar4.j, context);
                        com.ironsource.mediationsdk.events.e.d().c(eVar4.k, context);
                        com.ironsource.mediationsdk.events.e.d().d(eVar4.l, context);
                        com.ironsource.mediationsdk.events.e.d().a(kVar2.c.e.b);
                        com.ironsource.mediationsdk.events.e.d().c = eVar4.b;
                        d2 = com.ironsource.mediationsdk.events.e.d();
                        i2 = eVar4.c;
                    } else {
                        com.ironsource.mediationsdk.events.e.d().g = false;
                        com.ironsource.mediationsdk.events.h.x.g = a2;
                        if (a2) {
                            com.ironsource.mediationsdk.events.h.x.a(iVar.b(), context);
                            com.ironsource.mediationsdk.events.h.x.a(iVar.e(), context);
                            com.ironsource.mediationsdk.events.h.x.b(iVar.f(), context);
                            com.ironsource.mediationsdk.events.h.x.c = iVar.c();
                            com.ironsource.mediationsdk.events.h.x.d = iVar.d();
                        }
                        com.ironsource.mediationsdk.events.e.d().a = true;
                        com.ironsource.mediationsdk.events.i.d().a = true;
                        com.ironsource.mediationsdk.events.h.x.a = true;
                    }
                    d2.d = i2;
                    com.ironsource.mediationsdk.events.h.x.g = a2;
                    if (a2) {
                    }
                    com.ironsource.mediationsdk.events.e.d().a = true;
                    com.ironsource.mediationsdk.events.i.d().a = true;
                    com.ironsource.mediationsdk.events.h.x.a = true;
                }
                d.d = i;
                if (!z2) {
                }
                d2.d = i2;
                com.ironsource.mediationsdk.events.h.x.g = a2;
                if (a2) {
                }
                com.ironsource.mediationsdk.events.e.d().a = true;
                com.ironsource.mediationsdk.events.i.d().a = true;
                com.ironsource.mediationsdk.events.h.x.a = true;
            }
            return b2;
        }
    }

    public final synchronized void a(Activity activity, ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, String str) {
        IronSourceError b2 = b(activity, iSDemandOnlyBannerLayout, str);
        if (b2 != null) {
            this.c.log(IronSourceLogger.IronSourceTag.API, b2.getErrorMessage(), 3);
            if (iSDemandOnlyBannerLayout != null) {
                iSDemandOnlyBannerLayout.getListener().a(str, b2);
            }
            return;
        }
        IronSourceError a2 = a(D.a().b());
        if (a2 != null) {
            this.c.log(IronSourceLogger.IronSourceTag.API, a2.getErrorMessage(), 3);
            iSDemandOnlyBannerLayout.getListener().a(str, a2);
            return;
        }
        ContextProvider.getInstance().updateActivity(activity);
        if (b(iSDemandOnlyBannerLayout, str)) {
            return;
        }
        if (!G()) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "No banner configurations found", 3);
            iSDemandOnlyBannerLayout.getListener().a(str, ErrorBuilder.buildInitFailedError("the server response does not contain banner data", IronSourceConstants.BANNER_AD_UNIT));
        } else if (a(iSDemandOnlyBannerLayout, str)) {
        } else {
            this.J.a(iSDemandOnlyBannerLayout, str);
        }
    }

    public final synchronized void a(Activity activity, ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout, String str, String str2) {
        IronSourceError b2 = b(activity, iSDemandOnlyBannerLayout, str);
        if (b2 == null && str2 == null) {
            b2 = new IronSourceError(510, "Missing adm");
        }
        if (b2 != null) {
            this.c.log(IronSourceLogger.IronSourceTag.API, b2.getErrorMessage(), 3);
            if (iSDemandOnlyBannerLayout != null) {
                iSDemandOnlyBannerLayout.getListener().a(str, b2);
            }
            return;
        }
        IronSourceError a2 = a(D.a().b());
        if (a2 != null) {
            this.c.log(IronSourceLogger.IronSourceTag.API, a2.getErrorMessage(), 3);
            iSDemandOnlyBannerLayout.getListener().a(str, a2);
            return;
        }
        ContextProvider.getInstance().updateActivity(activity);
        if (b(iSDemandOnlyBannerLayout, str)) {
            return;
        }
        if (!G()) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "No banner configurations found", 3);
            iSDemandOnlyBannerLayout.getListener().a(str, ErrorBuilder.buildInitFailedError("the server response does not contain banner data", IronSourceConstants.BANNER_AD_UNIT));
        } else if (a(iSDemandOnlyBannerLayout, str)) {
        } else {
            this.J.a(iSDemandOnlyBannerLayout, str, str2);
        }
    }

    public final synchronized void a(Activity activity, String str, String str2) {
        if (str2 != null) {
            b(activity, str, str2);
            return;
        }
        this.c.log(IronSourceLogger.IronSourceTag.API, "adm cannot be null", 3);
        com.ironsource.mediationsdk.demandOnly.i.a().a(str, new IronSourceError(510, "adm cannot be null"));
    }

    public final synchronized void a(Context context, String str, InitializationListener initializationListener, IronSource.AD_UNIT... ad_unitArr) {
        ArrayList arrayList = new ArrayList();
        if (ad_unitArr != null && ad_unitArr.length != 0) {
            for (IronSource.AD_UNIT ad_unit : ad_unitArr) {
                if (ad_unit.equals(IronSource.AD_UNIT.OFFERWALL)) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, ad_unit + " ad unit cannot be initialized in demand only mode", 3);
                } else {
                    if (ad_unit.equals(IronSource.AD_UNIT.INTERSTITIAL)) {
                        if (this.u) {
                            a(ad_unit);
                        } else {
                            this.s = true;
                            if (!arrayList.contains(ad_unit)) {
                                arrayList.add(ad_unit);
                            }
                        }
                    }
                    if (ad_unit.equals(IronSource.AD_UNIT.REWARDED_VIDEO)) {
                        if (this.t) {
                            a(ad_unit);
                        } else {
                            this.r = true;
                            if (!arrayList.contains(ad_unit)) {
                                arrayList.add(ad_unit);
                            }
                        }
                    }
                    if (ad_unit.equals(IronSource.AD_UNIT.BANNER)) {
                        if (this.Y) {
                            a(ad_unit);
                        } else {
                            this.X = true;
                            if (!arrayList.contains(ad_unit)) {
                                arrayList.add(ad_unit);
                            }
                        }
                    }
                }
            }
            if (context != null) {
                if (context instanceof Activity) {
                    ContextProvider.getInstance().updateActivity((Activity) context);
                }
                ContextProvider.getInstance().updateAppContext(context.getApplicationContext());
            }
            if (arrayList.size() > 0) {
                a(context, str, true, null, (IronSource.AD_UNIT[]) arrayList.toArray(new IronSource.AD_UNIT[arrayList.size()]));
            }
        }
        if (this.t) {
            a(IronSource.AD_UNIT.REWARDED_VIDEO);
        } else {
            this.r = true;
            arrayList.add(IronSource.AD_UNIT.REWARDED_VIDEO);
        }
        if (this.u) {
            a(IronSource.AD_UNIT.INTERSTITIAL);
        } else {
            this.s = true;
            arrayList.add(IronSource.AD_UNIT.INTERSTITIAL);
        }
        if (this.Y) {
            a(IronSource.AD_UNIT.BANNER);
        } else {
            this.X = true;
            arrayList.add(IronSource.AD_UNIT.BANNER);
        }
        if (context != null) {
        }
        if (arrayList.size() > 0) {
        }
    }

    public final synchronized void a(Context context, String str, boolean z, InitializationListener initializationListener, IronSource.AD_UNIT... ad_unitArr) {
        com.ironsource.sdk.a.e eVar;
        IronSourceError ironSourceError;
        com.ironsource.mediationsdk.utils.k a2;
        Context applicationContext;
        boolean isInitResponseCached;
        ConcurrentHashMap<String, List<String>> c;
        AtomicBoolean atomicBoolean;
        IronLog.INTERNAL.verbose();
        if (!com.ironsource.mediationsdk.b.a.a((Object) context, "Init Failed - provided context is null")) {
            a("Provided context is null");
            return;
        }
        if (initializationListener != null) {
            this.ad = initializationListener;
        }
        AtomicBoolean atomicBoolean2 = this.R;
        if (atomicBoolean2 == null || !atomicBoolean2.compareAndSet(true, false)) {
            if (ad_unitArr != null) {
                a(z, ad_unitArr);
                if (D.a().b() == D.a.INITIATED && !z) {
                    H();
                    return;
                }
            } else {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Multiple calls to init without ad units are not allowed", 3);
            }
            return;
        }
        if (ad_unitArr != null && ad_unitArr.length != 0) {
            for (IronSource.AD_UNIT ad_unit : ad_unitArr) {
                this.T.add(ad_unit);
                this.U.add(ad_unit);
                if (ad_unit.equals(IronSource.AD_UNIT.INTERSTITIAL)) {
                    this.u = true;
                }
                if (ad_unit.equals(IronSource.AD_UNIT.BANNER)) {
                    this.Y = true;
                }
                if (ad_unit.equals(IronSource.AD_UNIT.REWARDED_VIDEO)) {
                    this.t = true;
                }
            }
            IronLog.API.info("init(appKey:" + str + ")");
            if (context instanceof Activity) {
                ContextProvider.getInstance().updateActivity((Activity) context);
            }
            eVar = new com.ironsource.sdk.a.e();
            if (str != null) {
                ironSourceError = new IronSourceError(506, "Init Fail - appKey is missing");
            } else if (a(str, 5, 10)) {
                if (!t(str)) {
                    ironSourceError = ErrorBuilder.buildInvalidCredentialsError("appKey", str, "should contain only english characters and numbers");
                }
                if (eVar.a()) {
                    this.g = str;
                }
                a2 = a(context, this.g);
                if (a2 != null) {
                    com.ironsource.mediationsdk.utils.b bVar = a2.c.e.f;
                    com.ironsource.environment.g gVar = com.ironsource.environment.g.a;
                    com.ironsource.environment.g.a(bVar.a());
                    com.ironsource.environment.g gVar2 = com.ironsource.environment.g.a;
                    com.ironsource.environment.g.c(bVar.b());
                    com.ironsource.environment.g gVar3 = com.ironsource.environment.g.a;
                    com.ironsource.environment.g.a(bVar.c());
                }
                ContextProvider.getInstance().updateAppContext(context.getApplicationContext());
                Context applicationContext2 = context.getApplicationContext();
                TimeUnit timeUnit = TimeUnit.HOURS;
                com.ironsource.environment.g gVar4 = com.ironsource.environment.g.a;
                com.ironsource.environment.h.a(applicationContext2, timeUnit.toMillis(com.ironsource.environment.g.d()));
                this.ak.b(IronSourceUtils.getSDKVersion());
                this.ak.a(com.ironsource.c.a.a());
                this.ak.b(IronSourceUtils.isGooglePlayInstalled(context));
                applicationContext = ContextProvider.getInstance().getApplicationContext();
                isInitResponseCached = IronSourceUtils.isInitResponseCached(applicationContext);
                long firstSessionTimestamp = IronSourceUtils.getFirstSessionTimestamp(applicationContext);
                if (!isInitResponseCached && firstSessionTimestamp == -1) {
                    long currentTimeMillis = System.currentTimeMillis();
                    IronLog.INTERNAL.verbose("get first session timestamp = " + currentTimeMillis);
                    IronSourceUtils.saveFirstSessionTimestamp(applicationContext, currentTimeMillis);
                }
                c = com.ironsource.d.a.a().c();
                if (c.containsKey("is_deviceid_optout")) {
                    String str2 = c.get("is_deviceid_optout").get(0);
                    if (!TextUtils.isEmpty(str2)) {
                        boolean z2 = !MetaDataUtils.getMetaDataBooleanValue(str2);
                        com.ironsource.environment.g gVar5 = com.ironsource.environment.g.a;
                        com.ironsource.environment.g.b(z2);
                    }
                }
                atomicBoolean = this.O;
                if (atomicBoolean != null && atomicBoolean.compareAndSet(false, true)) {
                    com.ironsource.mediationsdk.events.j.a().a(new com.ironsource.mediationsdk.utils.f(context));
                    com.ironsource.mediationsdk.events.e.d().a(context, this.p);
                    com.ironsource.mediationsdk.events.i.d().a(context, this.p);
                    com.ironsource.mediationsdk.events.h.x.a(context, this.p);
                }
                if (this.g == null) {
                    D.a().a(D.a.INIT_FAILED);
                    if (this.T.contains(IronSource.AD_UNIT.REWARDED_VIDEO)) {
                        Q.a().a(false, (AdInfo) null);
                    }
                    if (this.T.contains(IronSource.AD_UNIT.OFFERWALL)) {
                        this.d.a(false, eVar.b());
                    }
                    IronSourceLoggerManager.getLogger().log(IronSourceLogger.IronSourceTag.API, eVar.b().toString(), 1);
                    return;
                }
                this.ak.a(context);
                this.ak.a(this.g);
                this.ak.c(this.m);
                this.ak.d(ConfigFile.getConfigFile().getPluginType());
                if (this.V) {
                    JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(z);
                    if (ad_unitArr != null) {
                        for (IronSource.AD_UNIT ad_unit2 : ad_unitArr) {
                            try {
                                mediationAdditionalData.put(ad_unit2.toString(), true);
                            } catch (Exception unused) {
                            }
                        }
                    }
                    int i = this.q + 1;
                    this.q = i;
                    a(z, i, mediationAdditionalData);
                    this.V = false;
                }
                D.a().a(this);
                D.a().a(this.K);
                D.a().a(context, str, this.h);
                return;
            } else {
                ironSourceError = ErrorBuilder.buildInvalidCredentialsError("appKey", str, "length should be between 5-10 characters");
            }
            eVar.a(ironSourceError);
            if (eVar.a()) {
            }
            a2 = a(context, this.g);
            if (a2 != null) {
            }
            ContextProvider.getInstance().updateAppContext(context.getApplicationContext());
            Context applicationContext22 = context.getApplicationContext();
            TimeUnit timeUnit2 = TimeUnit.HOURS;
            com.ironsource.environment.g gVar42 = com.ironsource.environment.g.a;
            com.ironsource.environment.h.a(applicationContext22, timeUnit2.toMillis(com.ironsource.environment.g.d()));
            this.ak.b(IronSourceUtils.getSDKVersion());
            this.ak.a(com.ironsource.c.a.a());
            this.ak.b(IronSourceUtils.isGooglePlayInstalled(context));
            applicationContext = ContextProvider.getInstance().getApplicationContext();
            isInitResponseCached = IronSourceUtils.isInitResponseCached(applicationContext);
            long firstSessionTimestamp2 = IronSourceUtils.getFirstSessionTimestamp(applicationContext);
            if (!isInitResponseCached) {
                long currentTimeMillis2 = System.currentTimeMillis();
                IronLog.INTERNAL.verbose("get first session timestamp = " + currentTimeMillis2);
                IronSourceUtils.saveFirstSessionTimestamp(applicationContext, currentTimeMillis2);
            }
            c = com.ironsource.d.a.a().c();
            if (c.containsKey("is_deviceid_optout")) {
            }
            atomicBoolean = this.O;
            if (atomicBoolean != null) {
                com.ironsource.mediationsdk.events.j.a().a(new com.ironsource.mediationsdk.utils.f(context));
                com.ironsource.mediationsdk.events.e.d().a(context, this.p);
                com.ironsource.mediationsdk.events.i.d().a(context, this.p);
                com.ironsource.mediationsdk.events.h.x.a(context, this.p);
            }
            if (this.g == null) {
            }
        }
        for (IronSource.AD_UNIT ad_unit3 : IronSource.AD_UNIT.values()) {
            this.T.add(ad_unit3);
        }
        this.t = true;
        this.u = true;
        this.Y = true;
        IronLog.API.info("init(appKey:" + str + ")");
        if (context instanceof Activity) {
        }
        eVar = new com.ironsource.sdk.a.e();
        if (str != null) {
        }
        eVar.a(ironSourceError);
        if (eVar.a()) {
        }
        a2 = a(context, this.g);
        if (a2 != null) {
        }
        ContextProvider.getInstance().updateAppContext(context.getApplicationContext());
        Context applicationContext222 = context.getApplicationContext();
        TimeUnit timeUnit22 = TimeUnit.HOURS;
        com.ironsource.environment.g gVar422 = com.ironsource.environment.g.a;
        com.ironsource.environment.h.a(applicationContext222, timeUnit22.toMillis(com.ironsource.environment.g.d()));
        this.ak.b(IronSourceUtils.getSDKVersion());
        this.ak.a(com.ironsource.c.a.a());
        this.ak.b(IronSourceUtils.isGooglePlayInstalled(context));
        applicationContext = ContextProvider.getInstance().getApplicationContext();
        isInitResponseCached = IronSourceUtils.isInitResponseCached(applicationContext);
        long firstSessionTimestamp22 = IronSourceUtils.getFirstSessionTimestamp(applicationContext);
        if (!isInitResponseCached) {
        }
        c = com.ironsource.d.a.a().c();
        if (c.containsKey("is_deviceid_optout")) {
        }
        atomicBoolean = this.O;
        if (atomicBoolean != null) {
        }
        if (this.g == null) {
        }
    }

    public final synchronized void a(AbstractAdapter abstractAdapter) {
        this.N = abstractAdapter;
    }

    public final void a(IronSourceBannerLayout ironSourceBannerLayout, String str) {
        IronLog ironLog = IronLog.INTERNAL;
        ironLog.verbose("placementName = " + str);
        if (this.X) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "Banner was initialized in demand only mode. Use loadISDemandOnlyBanner instead", 3);
            C1339p.a().a(IronSource.AD_UNIT.BANNER, ErrorBuilder.buildInitFailedError("Banner was initialized in demand only mode. Use loadISDemandOnlyBanner instead", IronSourceConstants.BANNER_AD_UNIT));
        } else if (ironSourceBannerLayout == null || ironSourceBannerLayout.isDestroyed()) {
            StringBuilder sb = new StringBuilder("loadBanner can't be called - ");
            sb.append(ironSourceBannerLayout == null ? "banner layout is null " : "banner layout is destroyed");
            String sb2 = sb.toString();
            this.c.log(IronSourceLogger.IronSourceTag.API, sb2, 3);
            C1339p.a().a(IronSource.AD_UNIT.BANNER, ErrorBuilder.buildLoadFailedError(sb2));
        } else if (!this.Y) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "init() must be called before loadBanner()", 3);
            C1339p.a().a(IronSource.AD_UNIT.BANNER, ErrorBuilder.buildLoadFailedError("init() must be called before loadBanner()"));
        } else if (ironSourceBannerLayout.getSize().getDescription().equals("CUSTOM") && (ironSourceBannerLayout.getSize().getWidth() <= 0 || ironSourceBannerLayout.getSize().getHeight() <= 0)) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "loadBanner: Unsupported banner size. Height and width must be bigger than 0", 3);
            C1339p.a().a(IronSource.AD_UNIT.BANNER, ErrorBuilder.unsupportedBannerSize(""));
        } else {
            D.a b2 = D.a().b();
            if (b2 == D.a.INIT_FAILED) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "init() had failed", 3);
                C1339p.a().a(IronSource.AD_UNIT.BANNER, new IronSourceError(600, "Init() had failed"));
            } else if (b2 == D.a.INIT_IN_PROGRESS) {
                if (D.a().c()) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "init() had failed", 3);
                    C1339p.a().a(IronSource.AD_UNIT.BANNER, new IronSourceError(601, "Init had failed"));
                    return;
                }
                this.ab = ironSourceBannerLayout;
                this.aa = Boolean.TRUE;
                this.ac = str;
            } else if (!G()) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "No banner configurations found", 3);
                C1339p.a().a(IronSource.AD_UNIT.BANNER, new IronSourceError(IronSourceError.ERROR_BN_LOAD_NO_CONFIG, "the server response does not contain banner data"));
            } else {
                G g = this.y;
                if (g == null && this.B == null) {
                    this.ab = ironSourceBannerLayout;
                    this.aa = Boolean.TRUE;
                    this.ac = str;
                } else if (this.G) {
                    this.B.a(ironSourceBannerLayout, new Placement(v(str)));
                } else {
                    g.a(ironSourceBannerLayout, v(str));
                }
            }
        }
    }

    public final synchronized void a(LevelPlayRewardedVideoManualListener levelPlayRewardedVideoManualListener) {
        IronLog ironLog;
        String str;
        if (levelPlayRewardedVideoManualListener == null) {
            IronLog.API.info("RVListener is null");
        } else {
            IronLog.API.info();
        }
        if (!this.t) {
            if (levelPlayRewardedVideoManualListener == null) {
                this.C = false;
                ironLog = IronLog.API;
                str = "Disabling rewarded video manual mode";
            } else {
                this.C = true;
                ironLog = IronLog.API;
                str = "Enabling rewarded video manual mode";
            }
            ironLog.info(str);
        }
        Q.a().b = levelPlayRewardedVideoManualListener;
    }

    public final synchronized void a(RewardedVideoManualListener rewardedVideoManualListener) {
        IronLog ironLog;
        String str;
        if (rewardedVideoManualListener == null) {
            IronLog.API.info("RVListener is null");
        } else {
            IronLog.API.info();
        }
        if (!this.t) {
            if (rewardedVideoManualListener == null) {
                this.C = false;
                ironLog = IronLog.API;
                str = "Disabling rewarded video manual mode";
            } else {
                this.C = true;
                ironLog = IronLog.API;
                str = "Enabling rewarded video manual mode";
            }
            ironLog.info(str);
        }
        this.d.a = rewardedVideoManualListener;
        Q.a().a = rewardedVideoManualListener;
    }

    @Override
    public final void a(String str) {
        try {
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
            ironSourceLoggerManager.log(ironSourceTag, "onInitFailed(reason:" + str + ")", 1);
            IronSourceUtils.sendAutomationLog("Mediation init failed");
            if (this.d != null) {
                for (IronSource.AD_UNIT ad_unit : this.T) {
                    a(ad_unit, true);
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public final void a(String str, List<String> list) {
        IronLog ironLog = IronLog.API;
        ironLog.verbose("key = " + str + ", values = " + list.toString());
        String checkMetaDataKeyValidity = MetaDataUtils.checkMetaDataKeyValidity(str);
        String checkMetaDataValueValidity = MetaDataUtils.checkMetaDataValueValidity(list);
        if (checkMetaDataKeyValidity.length() > 0) {
            IronLog.API.verbose(checkMetaDataKeyValidity);
        } else if (checkMetaDataValueValidity.length() > 0) {
            IronLog.API.verbose(checkMetaDataValueValidity);
        } else {
            MetaData formatMetaData = MetaDataUtils.formatMetaData(str, list);
            String metaDataKey = formatMetaData.getMetaDataKey();
            List<String> metaDataValue = formatMetaData.getMetaDataValue();
            if (!MetaDataUtils.isMediationOnlyKey(metaDataKey)) {
                C1326c.a().a(metaDataKey, metaDataValue);
            } else if (D.a().b() == D.a.INITIATED && MetaDataUtils.isMediationKeysBeforeInit(metaDataKey)) {
                IronLog ironLog2 = IronLog.API;
                ironLog2.error("setMetaData with key = " + metaDataKey + " must to be called before init");
            } else {
                com.ironsource.d.a.a().a(metaDataKey, metaDataValue);
            }
            try {
                ConcurrentHashMap<String, List<String>> concurrentHashMap = C1326c.a().d;
                concurrentHashMap.putAll(com.ironsource.d.a.a().c());
                JSONObject jSONObject = new JSONObject();
                for (Map.Entry<String, List<String>> entry : concurrentHashMap.entrySet()) {
                    jSONObject.put(entry.getKey(), entry.getValue());
                }
                this.ak.a(jSONObject);
            } catch (JSONException e) {
                IronLog ironLog3 = IronLog.INTERNAL;
                ironLog3.error("got the following error " + e.getMessage());
                e.printStackTrace();
            }
            com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(D.a().b() == D.a.INITIATED ? 51 : 50, IronSourceUtils.getJsonForMetaData(str, list, metaDataValue)));
        }
    }

    @Override
    public final void a(List<IronSource.AD_UNIT> list, boolean z, com.ironsource.mediationsdk.model.j jVar) {
        IronSource.AD_UNIT[] values;
        IronLog.INTERNAL.verbose();
        try {
            this.e.d = jVar.e.a.c;
            this.S = list;
            this.l = true;
            this.c.log(IronSourceLogger.IronSourceTag.API, "onInitSuccess()", 1);
            IronSourceUtils.sendAutomationLog("init success");
            if (z) {
                JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false);
                try {
                    mediationAdditionalData.put("revived", true);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(114, mediationAdditionalData));
            }
            com.ironsource.mediationsdk.events.e.d().b();
            com.ironsource.mediationsdk.events.i.d().b();
            C1326c a2 = C1326c.a();
            String str = this.g;
            String str2 = this.h;
            a2.b = str;
            a2.c = str2;
            for (IronSource.AD_UNIT ad_unit : IronSource.AD_UNIT.values()) {
                if (this.T.contains(ad_unit)) {
                    if (list.contains(ad_unit)) {
                        b(ad_unit);
                    } else {
                        a(ad_unit, false);
                    }
                }
            }
            H();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public final synchronized AbstractAdapter b(String str) {
        try {
            AbstractAdapter abstractAdapter = this.N;
            if (abstractAdapter != null && abstractAdapter.getProviderName().equals(str)) {
                return this.N;
            }
        } catch (Exception e) {
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.INTERNAL;
            ironSourceLoggerManager.log(ironSourceTag, "getOfferwallAdapter exception: " + e, 1);
        }
        return null;
    }

    public final String b(Context context) {
        String str;
        com.ironsource.mediationsdk.utils.o oVar;
        a((int) IronSourceConstants.TROUBLESHOOTING_DO_GET_BIDDING_DATA_CALLED, (JSONObject) null);
        if (context == null) {
            IronLog.API.error("bidding data cannot be retrieved, context required");
            return null;
        }
        D.a b2 = D.a().b();
        if (b2 == D.a.NOT_INIT) {
            IronLog.API.error("bidding data cannot be retrieved, SDK not initialized");
            a((int) IronSourceConstants.TROUBLESHOOTING_DO_GET_BIDDING_DATA_RETURNED_NULL, (JSONObject) null);
            return null;
        } else if (b2 == D.a.INIT_FAILED) {
            IronLog.API.error("bidding data cannot be retrieved, SDK failed to initialize");
            a((int) IronSourceConstants.TROUBLESHOOTING_DO_GET_BIDDING_DATA_RETURNED_NULL, (JSONObject) null);
            return null;
        } else {
            try {
                com.ironsource.mediationsdk.utils.k kVar = this.f;
                if (kVar == null) {
                    kVar = C1345v.a(context);
                }
                if (b2 == D.a.NOT_INIT) {
                    this.ak.a(context);
                    this.ak.b(IronSourceUtils.getSDKVersion());
                    this.ak.c(this.m);
                    this.ak.d(ConfigFile.getConfigFile().getPluginType());
                    this.ak.a(com.ironsource.c.a.a());
                    this.ak.b(IronSourceUtils.isGooglePlayInstalled(context));
                }
                if (b2 != D.a.INITIATED) {
                    D.a().a(kVar);
                    if (kVar != null) {
                        D.a().a(context, kVar);
                    }
                }
                if (kVar == null || !kVar.b()) {
                    oVar = new com.ironsource.mediationsdk.utils.o();
                } else {
                    oVar = kVar.c.e.c;
                    if (!oVar.d) {
                        oVar.b = kVar.b.a(IronSourceConstants.IRONSOURCE_CONFIG_NAME);
                    }
                }
                JSONObject a2 = X.a(context, oVar);
                C1327d.a().a(a2, true);
                str = oVar.e ? IronSourceAES.compressAndEncrypt(a2.toString()) : IronSourceAES.encrypt(a2.toString());
            } catch (Throwable th) {
                a((int) IronSourceConstants.TROUBLESHOOTING_DO_GET_BIDDING_DATA_ENRICH_TOKEN_ERROR, (JSONObject) null);
                IronLog ironLog = IronLog.API;
                ironLog.error("got error during token creation: " + th.getMessage());
                str = null;
            }
            if (str == null) {
                a((int) IronSourceConstants.TROUBLESHOOTING_DO_GET_BIDDING_DATA_RETURNED_NULL, (JSONObject) null);
            }
            return str;
        }
    }

    @Override
    public final void b() {
        if (this.aa.booleanValue()) {
            this.aa = Boolean.FALSE;
            C1339p.a().a(IronSource.AD_UNIT.BANNER, new IronSourceError(603, "init had failed"));
            this.ab = null;
            this.ac = null;
        }
        if (this.F) {
            this.F = false;
            C1339p.a().a(IronSource.AD_UNIT.INTERSTITIAL, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.INTERSTITIAL_AD_UNIT));
        }
        if (this.D) {
            this.D = false;
            C1339p.a().a(IronSource.AD_UNIT.REWARDED_VIDEO, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
        }
        synchronized (this.ag) {
            Iterator<String> it = this.ag.iterator();
            while (it.hasNext()) {
                com.ironsource.mediationsdk.demandOnly.h.a().a(it.next(), ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.INTERSTITIAL_AD_UNIT));
            }
            this.ag.clear();
        }
        synchronized (this.ah) {
            Iterator<String> it2 = this.ah.iterator();
            while (it2.hasNext()) {
                com.ironsource.mediationsdk.demandOnly.i.a().a(it2.next(), ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
            }
            this.ah.clear();
        }
        synchronized (this.ai) {
            Iterator<String> it3 = this.ai.iterator();
            while (it3.hasNext()) {
                String next = it3.next();
                ISDemandOnlyBannerLayout iSDemandOnlyBannerLayout = this.Z.get(next);
                if (iSDemandOnlyBannerLayout != null) {
                    iSDemandOnlyBannerLayout.getListener().a(next, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.BANNER_AD_UNIT));
                }
            }
            this.ai.clear();
            this.Z.clear();
        }
    }

    public final synchronized void b(Activity activity, String str, String str2) {
        IronSourceLoggerManager ironSourceLoggerManager = this.c;
        IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
        ironSourceLoggerManager.log(ironSourceTag, "loadISDemandOnlyRewardedVideo() instanceId=" + str, 1);
        if (!this.t) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "initISDemandOnly() must be called before loadISDemandOnlyRewardedVideo()", 3);
            com.ironsource.mediationsdk.demandOnly.i.a().a(str, new IronSourceError(508, "initISDemandOnly() must be called before loadISDemandOnlyRewardedVideo()"));
        } else if (!this.r) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "Rewarded video was initialized in mediation mode", 3);
            com.ironsource.mediationsdk.demandOnly.i.a().a(str, new IronSourceError(508, "Rewarded video was initialized in mediation mode"));
        } else {
            boolean z = false;
            if (activity != null) {
                ContextProvider.getInstance().updateActivity(activity);
            } else if (ContextProvider.getInstance().getCurrentActiveActivity() == null) {
                if (str2 != null) {
                    z = true;
                }
                a((int) IronSourceConstants.TROUBLESHOOTING_DO_CALLED_RV_LOAD_WITH_NO_ACTIVITY, IronSourceUtils.getMediationAdditionalData(true, z, 1));
                this.c.log(IronSourceLogger.IronSourceTag.API, "Rewarded video was initialized and loaded without Activity", 3);
                com.ironsource.mediationsdk.demandOnly.i.a().a(str, new IronSourceError(IronSourceError.ERROR_DO_RV_LOAD_MISSING_ACTIVITY, "Rewarded video was initialized and loaded without Activity"));
                return;
            }
            D.a b2 = D.a().b();
            if (b2 == D.a.INIT_FAILED) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "init() had failed", 3);
                com.ironsource.mediationsdk.demandOnly.i.a().a(str, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
            } else if (b2 == D.a.INIT_IN_PROGRESS) {
                if (D.a().c()) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "init() had failed", 3);
                    com.ironsource.mediationsdk.demandOnly.i.a().a(str, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
                    return;
                }
                synchronized (this.ah) {
                    this.ah.add(str);
                }
                if (str2 != null) {
                    a((int) IronSourceConstants.TROUBLESHOOTING_DO_IAB_RV_LOAD_FAILED_INIT_IN_PROGRESS, IronSourceUtils.getMediationAdditionalData(true, true, this.H));
                }
            } else if (!f()) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "No rewarded video configurations found", 3);
                com.ironsource.mediationsdk.demandOnly.i.a().a(str, ErrorBuilder.buildInitFailedError("the server response does not contain rewarded video data", IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
            } else {
                synchronized (this.ah) {
                    com.ironsource.mediationsdk.demandOnly.e eVar = this.aj;
                    if (eVar == null) {
                        this.ah.add(str);
                        if (str2 != null) {
                            a((int) IronSourceConstants.TROUBLESHOOTING_DO_IAB_RV_LOAD_FAILED_INIT_IN_PROGRESS, IronSourceUtils.getMediationAdditionalData(true, true, this.H));
                        }
                    } else if (str2 == null) {
                        eVar.a(str, (String) null, false);
                    } else {
                        eVar.a(str, str2, true);
                    }
                }
            }
        }
    }

    public final void b(boolean z) {
        this.v = Boolean.valueOf(z);
        IronSourceLoggerManager logger = IronSourceLoggerManager.getLogger();
        IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
        logger.log(ironSourceTag, "setConsent : " + z, 1);
        C1326c.a().a(z);
        if (this.N != null) {
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag2 = IronSourceLogger.IronSourceTag.ADAPTER_API;
            ironSourceLoggerManager.log(ironSourceTag2, "Offerwall | setConsent(consent:" + z + ")", 1);
            this.N.setConsent(z);
        }
        int i = z ? 40 : 41;
        this.ak.a(z);
        com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(i, IronSourceUtils.getMediationAdditionalData(false)));
    }

    public Placement c() {
        com.ironsource.mediationsdk.model.s sVar = this.f.c.a;
        if (sVar != null) {
            return sVar.a();
        }
        return null;
    }

    public final synchronized void c(Activity activity, String str, String str2) {
        if (str2 != null) {
            d(activity, str, str2);
            return;
        }
        this.c.log(IronSourceLogger.IronSourceTag.API, "adm cannot be null", 3);
        com.ironsource.mediationsdk.demandOnly.h.a().a(str, new IronSourceError(510, "adm cannot be null"));
    }

    public final boolean c(String str) {
        try {
            this.c.log(IronSourceLogger.IronSourceTag.API, this.a + ":setDynamicUserId(dynamicUserId:" + str + ")", 1);
            com.ironsource.sdk.a.e eVar = new com.ironsource.sdk.a.e();
            if (!a(str, 1, 128)) {
                eVar.a(ErrorBuilder.buildInvalidKeyValueError(IronSourceConstants.EVENTS_DYNAMIC_USER_ID, IronSourceConstants.SUPERSONIC_CONFIG_NAME, "dynamicUserId is invalid, should be between 1-128 chars in length."));
            }
            if (!eVar.a()) {
                IronSourceLoggerManager.getLogger().log(IronSourceLogger.IronSourceTag.API, eVar.b().toString(), 2);
                return false;
            }
            this.i = str;
            com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(52, IronSourceUtils.getJsonForUserId(true)));
            return true;
        } catch (Exception e) {
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
            ironSourceLoggerManager.logException(ironSourceTag, this.a + ":setDynamicUserId(dynamicUserId:" + str + ")", e);
            return false;
        }
    }

    public final synchronized void d(Activity activity, String str, String str2) {
        IronSourceLoggerManager ironSourceLoggerManager = this.c;
        IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
        ironSourceLoggerManager.log(ironSourceTag, "loadISDemandOnlyInterstitial() instanceId=" + str, 1);
        if (!this.u) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "initISDemandOnly() must be called before loadISDemandOnlyInterstitial()", 3);
            com.ironsource.mediationsdk.demandOnly.h.a().a(str, new IronSourceError(510, "initISDemandOnly() must be called before loadISDemandOnlyInterstitial()"));
        } else if (!this.s) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "Interstitial was initialized in mediation mode. Use loadInterstitial instead", 3);
            com.ironsource.mediationsdk.demandOnly.h.a().a(str, new IronSourceError(510, "Interstitial was initialized in mediation mode. Use loadInterstitial instead"));
        } else {
            boolean z = false;
            if (activity != null) {
                ContextProvider.getInstance().updateActivity(activity);
            } else if (ContextProvider.getInstance().getCurrentActiveActivity() == null) {
                if (str2 != null) {
                    z = true;
                }
                b((int) IronSourceConstants.TROUBLESHOOTING_DO_CALLED_IS_LOAD_WITH_NO_ACTIVITY, IronSourceUtils.getMediationAdditionalData(true, z, 1));
                this.c.log(IronSourceLogger.IronSourceTag.API, "Interstitial was initialized and loaded without Activity", 3);
                com.ironsource.mediationsdk.demandOnly.h.a().a(str, new IronSourceError(IronSourceError.ERROR_DO_IS_LOAD_MISSING_ACTIVITY, "Interstitial was initialized and loaded without Activity"));
                return;
            }
            D.a b2 = D.a().b();
            if (b2 == D.a.INIT_FAILED) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "init() had failed", 3);
                com.ironsource.mediationsdk.demandOnly.h.a().a(str, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.INTERSTITIAL_AD_UNIT));
            } else if (b2 == D.a.INIT_IN_PROGRESS) {
                if (D.a().c()) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "init() had failed", 3);
                    com.ironsource.mediationsdk.demandOnly.h.a().a(str, ErrorBuilder.buildInitFailedError("init() had failed", IronSourceConstants.INTERSTITIAL_AD_UNIT));
                    return;
                }
                synchronized (this.ag) {
                    this.ag.add(str);
                }
                if (str2 != null) {
                    b((int) IronSourceConstants.TROUBLESHOOTING_DO_IAB_IS_LOAD_FAILED_INIT_IN_PROGRESS, IronSourceUtils.getMediationAdditionalData(true, true, 1));
                }
            } else if (!j()) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "No interstitial configurations found", 3);
                com.ironsource.mediationsdk.demandOnly.h.a().a(str, ErrorBuilder.buildInitFailedError("the server response does not contain interstitial data", IronSourceConstants.INTERSTITIAL_AD_UNIT));
            } else {
                synchronized (this.ag) {
                    com.ironsource.mediationsdk.demandOnly.c cVar = this.I;
                    if (cVar == null) {
                        this.ag.add(str);
                        if (str2 != null) {
                            b((int) IronSourceConstants.TROUBLESHOOTING_DO_IAB_IS_LOAD_FAILED_INIT_IN_PROGRESS, IronSourceUtils.getMediationAdditionalData(true, true, 1));
                        }
                    } else if (str2 == null) {
                        cVar.a(str, (String) null, false);
                    } else {
                        cVar.a(str, str2, true);
                    }
                }
            }
        }
    }

    public final void d(String str) {
        try {
            this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, this.a + ":setMediationType(mediationType:" + str + ")", 1);
            if (a(str, 1, 64) && t(str)) {
                this.k = str;
            } else {
                this.c.log(IronSourceLogger.IronSourceTag.INTERNAL, " mediationType value is invalid - should be alphanumeric and 1-64 chars in length", 1);
            }
        } catch (Exception e) {
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
            ironSourceLoggerManager.logException(ironSourceTag, this.a + ":setMediationType(mediationType:" + str + ")", e);
        }
    }

    public final boolean d() {
        boolean z;
        boolean z2;
        try {
            if (this.r) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Rewarded Video was initialized in demand only mode. Use isISDemandOnlyRewardedVideoAvailable instead", 3);
                return false;
            }
            try {
                if (!this.C && !this.af) {
                    InterfaceC1342s interfaceC1342s = this.w;
                    if (interfaceC1342s != null) {
                    }
                    z2 = false;
                    JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(false);
                    a(mediationAdditionalData, new Object[][]{new Object[]{IronSourceConstants.EVENTS_PROGRAMMATIC, Integer.valueOf(this.H)}});
                    com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(!z2 ? IronSourceConstants.RV_API_HAS_AVAILABILITY_TRUE : IronSourceConstants.RV_API_HAS_AVAILABILITY_FALSE, mediationAdditionalData));
                    IronSourceLoggerManager ironSourceLoggerManager = this.c;
                    IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
                    ironSourceLoggerManager.log(ironSourceTag, "isRewardedVideoAvailable():" + z2, 1);
                    return z2;
                }
                JSONObject mediationAdditionalData2 = IronSourceUtils.getMediationAdditionalData(false);
                a(mediationAdditionalData2, new Object[][]{new Object[]{IronSourceConstants.EVENTS_PROGRAMMATIC, Integer.valueOf(this.H)}});
                com.ironsource.mediationsdk.events.i.d().b(new com.ironsource.mediationsdk.events.d(!z2 ? IronSourceConstants.RV_API_HAS_AVAILABILITY_TRUE : IronSourceConstants.RV_API_HAS_AVAILABILITY_FALSE, mediationAdditionalData2));
                IronSourceLoggerManager ironSourceLoggerManager2 = this.c;
                IronSourceLogger.IronSourceTag ironSourceTag2 = IronSourceLogger.IronSourceTag.API;
                ironSourceLoggerManager2.log(ironSourceTag2, "isRewardedVideoAvailable():" + z2, 1);
                return z2;
            } catch (Throwable th) {
                z = z2;
                th = th;
                IronSourceLoggerManager ironSourceLoggerManager3 = this.c;
                IronSourceLogger.IronSourceTag ironSourceTag3 = IronSourceLogger.IronSourceTag.API;
                ironSourceLoggerManager3.log(ironSourceTag3, "isRewardedVideoAvailable():" + z, 1);
                this.c.logException(IronSourceLogger.IronSourceTag.API, "isRewardedVideoAvailable()", th);
                return false;
            }
            com.ironsource.mediationsdk.adunit.c.h hVar = this.A;
            if (hVar != null) {
            }
            z2 = false;
        } catch (Throwable th2) {
            th = th2;
            z = false;
        }
    }

    public final void e(String str) {
        String str2 = "showRewardedVideo(" + str + ")";
        this.c.log(IronSourceLogger.IronSourceTag.API, str2, 1);
        try {
            if (this.r) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Rewarded Video was initialized in demand only mode. Use showISDemandOnlyRewardedVideo instead", 3);
                Q.a().a(ErrorBuilder.buildInitFailedError("Rewarded Video was initialized in demand only mode. Use showISDemandOnlyRewardedVideo instead", IronSourceConstants.REWARDED_VIDEO_AD_UNIT), (AdInfo) null);
            } else if (e()) {
                q(str);
            } else {
                Q.a().a(ErrorBuilder.buildInitFailedError("showRewardedVideo can't be called before the Rewarded Video ad unit initialization completed successfully", IronSourceConstants.REWARDED_VIDEO_AD_UNIT), (AdInfo) null);
            }
        } catch (Exception e) {
            this.c.logException(IronSourceLogger.IronSourceTag.API, str2, e);
            Q.a().a(new IronSourceError(510, e.getMessage()), (AdInfo) null);
        }
    }

    public boolean e() {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        return (kVar == null || kVar.c == null || this.f.c.a == null) ? false : true;
    }

    public final synchronized void f(String str) {
        IronSourceLoggerManager ironSourceLoggerManager = this.c;
        IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
        ironSourceLoggerManager.log(ironSourceTag, "showISDemandOnlyRewardedVideo() instanceId=" + str, 1);
        try {
        } catch (Exception e) {
            this.c.logException(IronSourceLogger.IronSourceTag.API, "showISDemandOnlyRewardedVideo", e);
            com.ironsource.mediationsdk.demandOnly.i.a().b(str, new IronSourceError(510, e.getMessage()));
        }
        if (!this.r) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "Rewarded video was initialized in mediation mode. Use showRewardedVideo instead", 3);
            com.ironsource.mediationsdk.demandOnly.i.a().b(str, new IronSourceError(508, "Rewarded video was initialized in mediation mode. Use showRewardedVideo instead"));
            return;
        }
        com.ironsource.mediationsdk.demandOnly.e eVar = this.aj;
        if (eVar == null) {
            this.c.log(IronSourceLogger.IronSourceTag.API, "Rewarded video was not initiated", 3);
            com.ironsource.mediationsdk.demandOnly.i.a().b(str, new IronSourceError(508, "Rewarded video was not initiated"));
        } else if (eVar.a.containsKey(str)) {
            com.ironsource.mediationsdk.demandOnly.f fVar = eVar.a.get(str);
            eVar.a(IronSourceConstants.RV_INSTANCE_SHOW, fVar);
            fVar.a();
        } else {
            com.ironsource.mediationsdk.demandOnly.e.a(1500, str);
            com.ironsource.mediationsdk.demandOnly.i.a().b(str, ErrorBuilder.buildNonExistentInstanceError(IronSourceConstants.REWARDED_VIDEO_AD_UNIT));
        }
    }

    public boolean f() {
        return e() && D();
    }

    public InterstitialPlacement g() {
        com.ironsource.mediationsdk.model.l lVar = this.f.c.b;
        if (lVar != null) {
            return lVar.a();
        }
        return null;
    }

    public final synchronized boolean g(String str) {
        boolean z;
        com.ironsource.mediationsdk.demandOnly.e eVar = this.aj;
        if (eVar != null) {
            if (eVar.a.containsKey(str)) {
                com.ironsource.mediationsdk.demandOnly.f fVar = eVar.a.get(str);
                if (fVar.b()) {
                    com.ironsource.mediationsdk.demandOnly.e.a((int) IronSourceConstants.RV_INSTANCE_READY_TRUE, fVar, (Object[][]) null);
                    z = true;
                    if (z) {
                        return true;
                    }
                } else {
                    com.ironsource.mediationsdk.demandOnly.e.a((int) IronSourceConstants.RV_INSTANCE_READY_FALSE, fVar, (Object[][]) null);
                }
            } else {
                com.ironsource.mediationsdk.demandOnly.e.a(1500, str);
            }
            z = false;
            if (z) {
            }
        }
        return false;
    }

    public final void h(String str) {
        String str2 = "showInterstitial(" + str + ")";
        this.c.log(IronSourceLogger.IronSourceTag.API, str2, 1);
        try {
            if (this.s) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Interstitial was initialized in demand only mode. Use showISDemandOnlyInterstitial instead", 3);
                C1343t.a().a(new IronSourceError(510, "Interstitial was initialized in demand only mode. Use showISDemandOnlyInterstitial instead"), (AdInfo) null);
            } else if (i()) {
                s(str);
            } else {
                C1343t.a().a(ErrorBuilder.buildInitFailedError("showInterstitial can't be called before the Interstitial ad unit initialization completed successfully", IronSourceConstants.INTERSTITIAL_AD_UNIT), (AdInfo) null);
            }
        } catch (Exception e) {
            this.c.logException(IronSourceLogger.IronSourceTag.API, str2, e);
            C1343t.a().a(new IronSourceError(510, e.getMessage()), (AdInfo) null);
        }
    }

    public final boolean h() {
        boolean z;
        J j;
        com.ironsource.mediationsdk.adunit.c.g gVar;
        try {
            if (this.s) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Interstitial was initialized in demand only mode. Use isISDemandOnlyInterstitialReady instead", 3);
                return false;
            }
            boolean z2 = !this.E ? (j = this.x) == null || !j.e() : (gVar = this.z) == null || !gVar.h();
            try {
                com.ironsource.mediationsdk.events.e.d().b(new com.ironsource.mediationsdk.events.d(z2 ? IronSourceConstants.IS_CHECK_READY_TRUE : IronSourceConstants.IS_CHECK_READY_FALSE, IronSourceUtils.getMediationAdditionalData(false, true, 1)));
                IronSourceLoggerManager ironSourceLoggerManager = this.c;
                IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
                ironSourceLoggerManager.log(ironSourceTag, "isInterstitialReady():" + z2, 1);
                return z2;
            } catch (Throwable th) {
                z = z2;
                th = th;
                IronSourceLoggerManager ironSourceLoggerManager2 = this.c;
                IronSourceLogger.IronSourceTag ironSourceTag2 = IronSourceLogger.IronSourceTag.API;
                ironSourceLoggerManager2.log(ironSourceTag2, "isInterstitialReady():" + z, 1);
                this.c.logException(IronSourceLogger.IronSourceTag.API, "isInterstitialReady()", th);
                return false;
            }
        } catch (Throwable th2) {
            th = th2;
            z = false;
        }
    }

    public boolean i() {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        return (kVar == null || kVar.c == null || this.f.c.b == null) ? false : true;
    }

    public final synchronized boolean i(String str) {
        boolean z;
        com.ironsource.mediationsdk.demandOnly.c cVar = this.I;
        if (cVar != null) {
            if (cVar.a.containsKey(str)) {
                com.ironsource.mediationsdk.demandOnly.d dVar = cVar.a.get(str);
                if (dVar.b()) {
                    com.ironsource.mediationsdk.demandOnly.c.a((int) IronSourceConstants.IS_INSTANCE_READY_TRUE, dVar, (Object[][]) null);
                    z = true;
                    if (z) {
                        return true;
                    }
                } else {
                    com.ironsource.mediationsdk.demandOnly.c.a((int) IronSourceConstants.IS_INSTANCE_READY_FALSE, dVar, (Object[][]) null);
                }
            } else {
                com.ironsource.mediationsdk.demandOnly.c.a(2500, str);
            }
            z = false;
            if (z) {
            }
        }
        return false;
    }

    public final void j(String str) {
        String str2 = "showOfferwall(" + str + ")";
        this.c.log(IronSourceLogger.IronSourceTag.API, str2, 1);
        try {
            if (!k()) {
                this.d.onOfferwallShowFailed(ErrorBuilder.buildInitFailedError("showOfferwall can't be called before the Offerwall ad unit initialization completed successfully", IronSourceConstants.OFFERWALL_AD_UNIT));
                return;
            }
            com.ironsource.mediationsdk.model.n a2 = this.f.c.c.a(str);
            if (a2 == null) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Placement is not valid, please make sure you are using the right placements, using the default placement.", 3);
                a2 = this.f.c.c.a();
                if (a2 == null) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "Default placement was not found, please make sure you are using the right placements.", 3);
                    return;
                }
            }
            this.b.a(a2.getPlacementName());
        } catch (Exception e) {
            this.c.logException(IronSourceLogger.IronSourceTag.API, str2, e);
            this.d.onOfferwallShowFailed(ErrorBuilder.buildInitFailedError("showOfferwall can't be called before the Offerwall ad unit initialization completed successfully", IronSourceConstants.OFFERWALL_AD_UNIT));
        }
    }

    public boolean j() {
        return i() && E();
    }

    public final InterstitialPlacement k(String str) {
        try {
            InterstitialPlacement r = r(str);
            if (r == null) {
                try {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "Placement is not valid, please make sure you are using the right placements, using the default placement.", 2);
                    r = g();
                } catch (Exception unused) {
                    return r;
                }
            }
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
            ironSourceLoggerManager.log(ironSourceTag, "getPlacementInfo(placement: " + str + "):" + r, 1);
            return r;
        } catch (Exception unused2) {
            return null;
        }
    }

    public boolean k() {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        return (kVar == null || kVar.c == null || this.f.c.c == null) ? false : true;
    }

    public final Placement l(String str) {
        try {
            Placement p = p(str);
            if (p == null) {
                try {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "Placement is not valid, please make sure you are using the right placements, using the default placement.", 2);
                    p = c();
                } catch (Exception unused) {
                    return p;
                }
            }
            IronSourceLoggerManager ironSourceLoggerManager = this.c;
            IronSourceLogger.IronSourceTag ironSourceTag = IronSourceLogger.IronSourceTag.API;
            ironSourceLoggerManager.log(ironSourceTag, "getPlacementInfo(placement: " + str + "):" + p, 1);
            return p;
        } catch (Exception unused2) {
            return null;
        }
    }

    public final boolean l() {
        try {
            F f = this.b;
            if (f != null) {
                return f.a();
            }
            return false;
        } catch (Exception unused) {
            return false;
        }
    }

    public final boolean m() {
        return this.r || this.s || this.X;
    }

    public final boolean m(String str) {
        if (this.s) {
            return false;
        }
        boolean z = u(str) != j.a.d;
        if (z) {
            JSONObject mediationAdditionalData = IronSourceUtils.getMediationAdditionalData(this.s, true, 1);
            try {
                mediationAdditionalData.put("placement", str);
                mediationAdditionalData.put(IronSourceConstants.EVENTS_PROGRAMMATIC, 1);
            } catch (Exception unused) {
            }
            com.ironsource.mediationsdk.events.e.d().b(new com.ironsource.mediationsdk.events.d(IronSourceConstants.IS_CHECK_CAPPED_TRUE, mediationAdditionalData));
        }
        return z;
    }

    public final boolean n(String str) {
        if (F()) {
            com.ironsource.mediationsdk.model.i iVar = null;
            try {
                iVar = this.f.c.d.a(str);
                if (iVar == null && (iVar = this.f.c.d.a()) == null) {
                    this.c.log(IronSourceLogger.IronSourceTag.API, "Banner default placement was not found", 3);
                    return false;
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (iVar == null) {
                return false;
            }
            return com.ironsource.mediationsdk.utils.j.b(ContextProvider.getInstance().getApplicationContext(), iVar.getPlacementName());
        }
        return false;
    }

    public int o(String str) {
        com.ironsource.mediationsdk.utils.k kVar = this.f;
        if (kVar == null || kVar.c == null || this.f.c.a == null) {
            return j.a.d;
        }
        Placement placement = null;
        try {
            placement = p(str);
            if (placement == null && (placement = c()) == null) {
                this.c.log(IronSourceLogger.IronSourceTag.API, "Default placement was not found", 3);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return placement == null ? j.a.d : com.ironsource.mediationsdk.utils.j.b(ContextProvider.getInstance().getApplicationContext(), placement);
    }
}