package com.ironsource; import android.app.Activity; import com.ironsource.l1; import com.ironsource.mediationsdk.impressionData.ImpressionData; import com.ironsource.mediationsdk.logger.IronLog; import com.ironsource.mediationsdk.logger.IronSourceError; import com.ironsource.x1; import com.unity3d.mediation.LevelPlayAdInfo; import java.lang.ref.WeakReference; import java.util.Map; import kotlin.TuplesKt; import kotlin.collections.MapsKt__MapsJVMKt; import kotlin.collections.MapsKt__MapsKt; import kotlin.jvm.internal.Intrinsics; import org.json.JSONObject; /* loaded from: classes2.dex */ public final class rc extends l1 { private final WeakReference h; private final b i; private WeakReference j; public static final class a { public final rc a(k1 tools, b1 adProperties, boolean z, tc listener, ak akVar) { Intrinsics.checkNotNullParameter(tools, "tools"); Intrinsics.checkNotNullParameter(adProperties, "adProperties"); Intrinsics.checkNotNullParameter(listener, "listener"); IronLog.INTERNAL.verbose(); return new rc(tools, di.A.a(adProperties, akVar, z), listener); } } public final class b extends l1.a implements pc { public b() { super(); } @Override // com.ironsource.pc public void a(IronSourceError error, oc fullscreenInstance) { Intrinsics.checkNotNullParameter(error, "error"); Intrinsics.checkNotNullParameter(fullscreenInstance, "fullscreenInstance"); IronLog.INTERNAL.verbose(rc.this.a(fullscreenInstance.o() + " - error = " + error)); rc.this.a(error, fullscreenInstance); } @Override // com.ironsource.pc public void a(oc fullscreenInstance) { Intrinsics.checkNotNullParameter(fullscreenInstance, "fullscreenInstance"); IronLog.INTERNAL.verbose(rc.this.a(fullscreenInstance.o())); tc tcVar = (tc) rc.this.h.get(); if (tcVar != null) { tcVar.n(new p1(rc.this, fullscreenInstance.d())); } } @Override // com.ironsource.pc public void b(oc fullscreenInstance) { Intrinsics.checkNotNullParameter(fullscreenInstance, "fullscreenInstance"); IronLog.INTERNAL.verbose(rc.this.a(fullscreenInstance.o())); rc.this.g().e().a().l(rc.this.i()); rc.this.n(); rc.this.m(); rc.this.l(); WeakReference weakReference = rc.this.j; if (weakReference == null) { Intrinsics.throwUninitializedPropertyAccessException("showListener"); weakReference = null; } o2 o2Var = (o2) weakReference.get(); if (o2Var != null) { o2Var.d(new p1(rc.this, fullscreenInstance.d())); } } @Override // com.ironsource.pc public void c(oc fullscreenInstance) { Intrinsics.checkNotNullParameter(fullscreenInstance, "fullscreenInstance"); IronLog.INTERNAL.verbose(rc.this.a(fullscreenInstance.o())); rc.this.g().e().a().b(rc.this.i()); tc tcVar = (tc) rc.this.h.get(); if (tcVar != null) { tcVar.a(new p1(rc.this, fullscreenInstance.d())); } } } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public rc(k1 adTools, s1 adUnitData, tc listener) { super(adTools, adUnitData, listener); Intrinsics.checkNotNullParameter(adTools, "adTools"); Intrinsics.checkNotNullParameter(adUnitData, "adUnitData"); Intrinsics.checkNotNullParameter(listener, "listener"); this.h = new WeakReference<>(listener); this.i = new b(); } /* JADX INFO: Access modifiers changed from: private */ public static final x a(rc this$0, y instanceData) { Intrinsics.checkNotNullParameter(this$0, "this$0"); Intrinsics.checkNotNullParameter(instanceData, "instanceData"); return new oc(new p2(this$0.g(), x1.b.PROVIDER), instanceData, this$0.i); } private final void a(IronSourceError ironSourceError) { g().e().a().a(i(), ironSourceError.getErrorCode(), ironSourceError.getErrorMessage(), ""); WeakReference weakReference = this.j; if (weakReference == null) { Intrinsics.throwUninitializedPropertyAccessException("showListener"); weakReference = null; } o2 o2Var = weakReference.get(); if (o2Var != null) { o2Var.b(new p1(this, k()), ironSourceError); } } /* JADX INFO: Access modifiers changed from: private */ public final void a(IronSourceError ironSourceError, oc ocVar) { g().e().a().a(i(), ironSourceError.getErrorCode(), ironSourceError.getErrorMessage(), ""); WeakReference weakReference = this.j; if (weakReference == null) { Intrinsics.throwUninitializedPropertyAccessException("showListener"); weakReference = null; } o2 o2Var = weakReference.get(); if (o2Var != null) { o2Var.b(new p1(this, ocVar != null ? ocVar.d() : null), ironSourceError); } } public static /* synthetic */ void a(rc rcVar, IronSourceError ironSourceError, oc ocVar, int i, Object obj) { if ((i & 2) != 0) { ocVar = null; } rcVar.a(ironSourceError, ocVar); } private final LevelPlayAdInfo k() { Map emptyMap; emptyMap = MapsKt__MapsKt.emptyMap(); if (i().length() > 0) { emptyMap = MapsKt__MapsJVMKt.mapOf(TuplesKt.to("placement", i())); } return new LevelPlayAdInfo(f().b().b(), f().b().c().getValue(), new ImpressionData(new JSONObject(emptyMap)), null, 8, null); } /* JADX INFO: Access modifiers changed from: private */ public final void l() { if (i().length() == 0) { return; } f8 a2 = el.p.d().w().a(i(), f().b().c()); if (a2.d()) { g().e().a().b(i(), a2.e()); } } /* JADX INFO: Access modifiers changed from: private */ public final void m() { el.p.a().u().b(f().b().b()); } /* JADX INFO: Access modifiers changed from: private */ public final void n() { if (i().length() > 0) { el.p.a().a().b(i(), f().b().c()); } } private final IronSourceError o() { IronSourceError ironSourceError; if (!super.e().a()) { return new IronSourceError(IronSourceError.ERROR_CODE_NO_ADS_TO_SHOW, "show called while ad unit is not ready to show"); } if (i().length() > 0 && el.p.d().w().a(i(), f().b().c()).d()) { ironSourceError = new IronSourceError(IronSourceError.ERROR_PLACEMENT_CAPPED, "placement " + i() + " is capped"); } else { if (!el.p.d().s().a(f().b().b()).d()) { return null; } ironSourceError = new IronSourceError(IronSourceError.ERROR_AD_UNIT_CAPPED, "adUnitId " + f().b().b() + " is capped"); } return ironSourceError; } @Override // com.ironsource.l1 public a0 a() { return new a0() { // from class: com.ironsource.rc$$ExternalSyntheticLambda0 @Override // com.ironsource.a0 public final x a(y yVar) { x a2; a2 = rc.a(rc.this, yVar); return a2; } }; } public final void a(Activity activity, o2 showListener) { Intrinsics.checkNotNullParameter(activity, "activity"); Intrinsics.checkNotNullParameter(showListener, "showListener"); this.j = new WeakReference<>(showListener); IronLog.INTERNAL.verbose(a("showAd called")); g().e().a().a(activity, i()); IronSourceError o = o(); if (o == null) { a(new qc(activity)); } else { IronLog.API.error(a(o.getErrorMessage())); a(o); } } }