package com.iab.omid.library.bytedance2.internal;

import android.content.Context;
import androidx.annotation.NonNull;
import com.iab.omid.library.bytedance2.internal.d;
import java.util.Date;
import java.util.Iterator;

/* JADX INFO: loaded from: classes.dex */
public class a implements d.a {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private static a f24446f = new a(new d());

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    protected com.iab.omid.library.bytedance2.utils.f f24447a = new com.iab.omid.library.bytedance2.utils.f();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private Date f24448b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private boolean f24449c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private d f24450d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private boolean f24451e;

    private a(d dVar) {
        this.f24450d = dVar;
    }

    public static a a() {
        return f24446f;
    }

    private void c() {
        if (!this.f24449c || this.f24448b == null) {
            return;
        }
        Iterator<com.iab.omid.library.bytedance2.adsession.a> it = c.c().a().iterator();
        while (it.hasNext()) {
            it.next().getAdSessionStatePublisher().a(b());
        }
    }

    public Date b() {
        Date date = this.f24448b;
        if (date != null) {
            return (Date) date.clone();
        }
        return null;
    }

    public void d() {
        Date dateA = this.f24447a.a();
        Date date = this.f24448b;
        if (date == null || dateA.after(date)) {
            this.f24448b = dateA;
            c();
        }
    }

    public void a(@NonNull Context context) {
        if (this.f24449c) {
            return;
        }
        this.f24450d.a(context);
        this.f24450d.a(this);
        this.f24450d.e();
        this.f24451e = this.f24450d.c();
        this.f24449c = true;
    }

    @Override // com.iab.omid.library.bytedance2.internal.d.a
    public void a(boolean z10) {
        if (!this.f24451e && z10) {
            d();
        }
        this.f24451e = z10;
    }
}
