package com.google.android.gms.internal.ads;

import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.View;
import androidx.annotation.Nullable;
import java.util.Collections;

/* JADX INFO: loaded from: classes2.dex */
public final class o01 extends n7.q0 implements xg0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Context f14782a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final x81 f14783b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final String f14784c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final d11 f14785d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public n7.f4 f14786e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final hb1 f14787f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final q7.a f14788g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final cr0 f14789h;

    @Nullable
    private eb0 zzi;

    public o01(Context context, n7.f4 f4Var, String str, x81 x81Var, d11 d11Var, q7.a aVar, cr0 cr0Var) {
        this.f14782a = context;
        this.f14783b = x81Var;
        this.f14786e = f4Var;
        this.f14784c = str;
        this.f14785d = d11Var;
        this.f14787f = x81Var.f18364j;
        this.f14788g = aVar;
        this.f14789h = cr0Var;
        x81Var.f18361g.G0(this, x81Var.f18356b);
    }

    @Override // n7.r0
    public final void H1() {
    }

    @Override // n7.r0
    public final synchronized void K1(boolean z10) {
        try {
            if (U2()) {
                com.google.android.gms.common.internal.w.d("setManualImpressionsEnabled must be called from the main thread.");
            }
            this.f14787f.f12107d = z10;
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override // n7.r0
    public final void N0(nk nkVar) {
    }

    public final /* synthetic */ eb0 R2() {
        return this.zzi;
    }

    public final /* synthetic */ void S2(eb0 eb0Var) {
        this.zzi = eb0Var;
    }

    public final synchronized boolean T2(n7.a4 a4Var) {
        try {
            if (U2()) {
                com.google.android.gms.common.internal.w.d("loadAd must be called on the main UI thread.");
            }
            p7.r0 r0Var = m7.n.C.f30464c;
            Context context = this.f14782a;
            if (!p7.r0.g(context) || a4Var.zzs != null) {
                ni.s(context, a4Var.f30898f);
                return this.f14783b.zza(a4Var, this.f14784c, null, new dh0(this));
            }
            q7.j.b("Failed to load the ad because app ID is missing.");
            d11 d11Var = this.f14785d;
            if (d11Var != null) {
                d11Var.q(sb1.zzd(4, null, null));
            }
            return false;
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0024  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean U2() {
        boolean z10;
        if (((Boolean) mp.f14330f.j()).booleanValue()) {
            z10 = ((Boolean) n7.y.f31093e.f31096c.b(ao.f9089tc)).booleanValue();
        }
        return this.f14788g.f32214c < ((Integer) n7.y.f31093e.f31096c.b(ao.f9106uc)).intValue() || !z10;
    }

    public final synchronized void V2() {
        Object parent;
        int i10;
        try {
            parent = this.f14783b.f18360f.getParent();
        } catch (Throwable th) {
            throw th;
        }
        if (parent instanceof View) {
            View view = (View) parent;
            p7.r0 r0Var = m7.n.C.f30464c;
            if (p7.r0.s(view.getContext(), view)) {
                hb1 hb1Var = this.f14787f;
                n7.f4 f4VarF = hb1Var.f12105b;
                eb0 eb0Var = this.zzi;
                if (eb0Var != null && hb1Var.f12116m) {
                    f4VarF = ni.f(this.f14782a, Collections.singletonList(((gb0) eb0Var).f11687m));
                }
                synchronized (this) {
                    hb1 hb1Var2 = this.f14787f;
                    hb1Var2.f12105b = f4VarF;
                    hb1Var2.f12116m = this.f14786e.Q;
                    hb1Var.f12115l = true;
                    try {
                        T2(hb1Var.f12104a);
                    } catch (RemoteException unused) {
                        q7.j.d("Failed to refresh the banner ad.");
                    }
                    this.f14787f.f12115l = false;
                }
                return;
            }
            throw th;
        }
        x81 x81Var = this.f14783b;
        bh0 bh0Var = x81Var.f18361g;
        si0 si0Var = x81Var.f18363i;
        synchronized (si0Var) {
            i10 = si0Var.f16452a;
        }
        bh0Var.J0(i10);
    }

    @Override // n7.r0
    public final void Y1(String str) {
    }

    @Override // n7.r0
    public final void a0(k8.a aVar) {
    }

    @Override // n7.r0
    public final synchronized String c() {
        return this.f14784c;
    }

    @Override // n7.r0
    public final synchronized void c2(n7.f4 f4Var) {
        com.google.android.gms.common.internal.w.d("setAdSize must be called on the main UI thread.");
        this.f14787f.f12105b = f4Var;
        this.f14786e = f4Var;
        eb0 eb0Var = this.zzi;
        if (eb0Var != null) {
            eb0Var.c(this.f14783b.f18360f, f4Var);
        }
    }

    @Override // n7.r0
    public final n7.g1 d() {
        n7.g1 g1Var;
        d11 d11Var = this.f14785d;
        synchronized (d11Var) {
            g1Var = (n7.g1) d11Var.f10140b.get();
        }
        return g1Var;
    }

    @Override // n7.r0
    public final synchronized void d0(long j10) {
        td0 td0Var;
        this.f14787f.f12119p.set(j10);
        eb0 eb0Var = this.zzi;
        if (eb0Var == null || (td0Var = eb0Var.f14064i) == null) {
            return;
        }
        td0Var.a(j10);
    }

    @Override // n7.r0
    public final void e0(boolean z10) {
    }

    @Override // n7.r0
    public final synchronized boolean i() {
        eb0 eb0Var = this.zzi;
        if (eb0Var != null) {
            if (eb0Var.f14057b.f17992k0) {
                return true;
            }
        }
        return false;
    }

    @Override // n7.r0
    public final void j1(n7.i4 i4Var) {
    }

    @Override // n7.r0
    public final void j2(n7.e2 e2Var) {
        if (U2()) {
            com.google.android.gms.common.internal.w.d("setPaidEventListener must be called on the main UI thread.");
        }
        try {
            if (!e2Var.zzf()) {
                this.f14789h.b();
            }
        } catch (RemoteException unused) {
        }
        this.f14785d.f10141c.set(e2Var);
    }

    @Override // n7.r0
    public final synchronized void k1(n7.k1 k1Var) {
        com.google.android.gms.common.internal.w.d("setCorrelationIdProvider must be called on the main UI thread");
        this.f14787f.zzZ(k1Var);
    }

    @Override // n7.r0
    public final n7.e0 l() {
        return this.f14785d.a();
    }

    @Override // n7.r0
    public final void o() {
    }

    @Override // n7.r0
    public final void o2(n7.m1 m1Var) {
    }

    @Override // n7.r0
    public final void s1(n7.a4 a4Var, n7.h0 h0Var) {
    }

    @Override // n7.r0
    public final synchronized long x() {
        td0 td0Var;
        eb0 eb0Var = this.zzi;
        return (eb0Var == null || (td0Var = eb0Var.f14064i) == null) ? this.f14787f.f12119p.get() : td0Var.f16861a.get();
    }

    @Override // n7.r0
    public final synchronized boolean z(n7.a4 a4Var) {
        n7.f4 f4Var = this.f14786e;
        synchronized (this) {
            hb1 hb1Var = this.f14787f;
            hb1Var.f12105b = f4Var;
            hb1Var.f12116m = this.f14786e.Q;
        }
        return T2(a4Var);
        return T2(a4Var);
    }

    @Override // n7.r0
    public final synchronized boolean zzB() {
        return this.f14783b.zzb();
    }

    @Override // n7.q0, n7.r0
    public final void zzC(i00 i00Var) {
    }

    @Override // n7.r0
    @Nullable
    public final synchronized n7.p2 zzF() {
        com.google.android.gms.common.internal.w.d("getVideoController must be called from the main thread.");
        eb0 eb0Var = this.zzi;
        if (eb0Var == null) {
            return null;
        }
        return eb0Var.zzc();
    }

    @Override // n7.q0, n7.r0
    public final synchronized void zzG(n7.u3 u3Var) {
        try {
            if (U2()) {
                com.google.android.gms.common.internal.w.d("setVideoOptions must be called on the main UI thread.");
            }
            this.f14787f.zzi(u3Var);
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override // n7.q0, n7.r0
    public final void zzH(n7.s2 s2Var) {
    }

    @Override // n7.r0
    public final k8.a zzb() {
        if (U2()) {
            com.google.android.gms.common.internal.w.d("getAdFrame must be called on the main UI thread.");
        }
        return new k8.b(this.f14783b.f18360f);
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x0038 A[Catch: all -> 0x0036, TryCatch #0 {all -> 0x0036, blocks: (B:3:0x0001, B:5:0x000f, B:7:0x0021, B:13:0x003d, B:15:0x0041, B:12:0x0038), top: B:22:0x0001 }] */
    @Override // n7.r0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized void zzc() {
        try {
            if (((Boolean) mp.f14329e.j()).booleanValue()) {
                tn tnVar = ao.f9040qc;
                n7.y yVar = n7.y.f31093e;
                if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue()) {
                    if (this.f14788g.f32214c < ((Integer) yVar.f31096c.b(ao.f9122vc)).intValue()) {
                        com.google.android.gms.common.internal.w.d("destroy must be called on the main UI thread.");
                    }
                } else {
                    com.google.android.gms.common.internal.w.d("destroy must be called on the main UI thread.");
                }
            }
            eb0 eb0Var = this.zzi;
            if (eb0Var != null) {
                eb0Var.f14058c.zzc(null);
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override // n7.r0
    public final boolean zzd() {
        return false;
    }

    @Override // n7.q0, n7.r0
    public final void zzdR(n7.e0 e0Var) {
        if (U2()) {
            com.google.android.gms.common.internal.w.d("setAdListener must be called on the main UI thread.");
        }
        this.f14785d.f10139a.set(e0Var);
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x0038 A[Catch: all -> 0x0036, TryCatch #0 {all -> 0x0036, blocks: (B:3:0x0001, B:5:0x000f, B:7:0x0021, B:13:0x003d, B:15:0x0041, B:12:0x0038), top: B:22:0x0001 }] */
    @Override // n7.r0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized void zzf() {
        try {
            if (((Boolean) mp.f14331g.j()).booleanValue()) {
                tn tnVar = ao.f9057rc;
                n7.y yVar = n7.y.f31093e;
                if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue()) {
                    if (this.f14788g.f32214c < ((Integer) yVar.f31096c.b(ao.f9122vc)).intValue()) {
                        com.google.android.gms.common.internal.w.d("pause must be called on the main UI thread.");
                    }
                } else {
                    com.google.android.gms.common.internal.w.d("pause must be called on the main UI thread.");
                }
            }
            eb0 eb0Var = this.zzi;
            if (eb0Var != null) {
                kf0 kf0Var = eb0Var.f14058c;
                kf0Var.getClass();
                kf0Var.H0(new qn(null, 3));
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:12:0x0038 A[Catch: all -> 0x0036, TryCatch #0 {all -> 0x0036, blocks: (B:3:0x0001, B:5:0x000f, B:7:0x0021, B:13:0x003d, B:15:0x0041, B:12:0x0038), top: B:22:0x0001 }] */
    @Override // n7.r0
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final synchronized void zzg() {
        try {
            if (((Boolean) mp.f14332h.j()).booleanValue()) {
                tn tnVar = ao.f9023pc;
                n7.y yVar = n7.y.f31093e;
                if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue()) {
                    if (this.f14788g.f32214c < ((Integer) yVar.f31096c.b(ao.f9122vc)).intValue()) {
                        com.google.android.gms.common.internal.w.d("resume must be called on the main UI thread.");
                    }
                } else {
                    com.google.android.gms.common.internal.w.d("resume must be called on the main UI thread.");
                }
            }
            eb0 eb0Var = this.zzi;
            if (eb0Var != null) {
                kf0 kf0Var = eb0Var.f14058c;
                kf0Var.getClass();
                kf0Var.H0(new qn(null, 1));
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    @Override // n7.q0, n7.r0
    public final void zzi(n7.g1 g1Var) {
        if (U2()) {
            com.google.android.gms.common.internal.w.d("setAppEventListener must be called on the main UI thread.");
        }
        this.f14785d.i(g1Var);
    }

    @Override // n7.q0, n7.r0
    public final void zzj(n7.v0 v0Var) {
        com.google.android.gms.common.internal.w.d("setAdMetadataListener must be called on the main UI thread.");
    }

    @Override // n7.r0
    public final Bundle zzk() {
        com.google.android.gms.common.internal.w.d("getAdMetadata must be called on the main UI thread.");
        return new Bundle();
    }

    @Override // n7.r0
    public final void zzl() {
    }

    @Override // n7.r0
    public final synchronized void zzm() {
        com.google.android.gms.common.internal.w.d("recordManualImpression must be called on the main UI thread.");
        eb0 eb0Var = this.zzi;
        if (eb0Var != null) {
            hk0 hk0Var = ((gb0) eb0Var).f11690p;
            synchronized (hk0Var) {
                hk0Var.H0(gk0.f11771a);
            }
        }
    }

    @Override // n7.r0
    public final synchronized n7.f4 zzn() {
        com.google.android.gms.common.internal.w.d("getAdSize must be called on the main UI thread.");
        eb0 eb0Var = this.zzi;
        if (eb0Var != null) {
            return ni.f(this.f14782a, Collections.singletonList(eb0Var.d()));
        }
        return this.f14787f.f12105b;
    }

    @Override // n7.r0
    public final void zzq() {
    }

    @Override // n7.r0
    @Nullable
    public final synchronized String zzr() {
        oe0 oe0Var;
        eb0 eb0Var = this.zzi;
        if (eb0Var == null || (oe0Var = eb0Var.f14060e) == null) {
            return null;
        }
        return oe0Var.f15040a;
    }

    @Override // n7.r0
    @Nullable
    public final synchronized String zzs() {
        oe0 oe0Var;
        eb0 eb0Var = this.zzi;
        if (eb0Var == null || (oe0Var = eb0Var.f14060e) == null) {
            return null;
        }
        return oe0Var.f15040a;
    }

    @Override // n7.r0
    @Nullable
    public final synchronized n7.m2 zzt() {
        eb0 eb0Var;
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.f9151x7)).booleanValue() && (eb0Var = this.zzi) != null) {
            return eb0Var.f14060e;
        }
        return null;
    }

    @Override // n7.q0, n7.r0
    public final synchronized void zzx(qo qoVar) {
        com.google.android.gms.common.internal.w.d("setOnCustomRenderedAdLoadedListener must be called on the main UI thread.");
        this.f14783b.b(qoVar);
    }

    @Override // n7.q0, n7.r0
    public final void zzy(n7.b0 b0Var) {
        if (U2()) {
            com.google.android.gms.common.internal.w.d("setAdListener must be called on the main UI thread.");
        }
        f11 f11Var = this.f14783b.f18359e;
        synchronized (f11Var) {
            f11Var.f10987a = b0Var;
        }
    }
}
