package com.chartboost.sdk.impl;

import java.io.File;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes2.dex */
public final class mb {

    /* renamed from: a  reason: collision with root package name */
    public long f1759a;
    public int b;
    public int c;
    public long d;
    public long e;
    public long f;
    public int g;
    public final h2 h;
    public volatile long i;
    public volatile int j;

    public final void a(int i) {
        this.g = i;
    }

    public final long b() {
        return this.f1759a;
    }

    public final void b(int i) {
        this.b = i;
    }

    public final boolean b(long j) {
        return j >= this.f1759a;
    }

    public final void c(int i) {
        this.c = i;
    }

    public final void c(long j) {
        this.f1759a = j;
    }

    public final void d(long j) {
        this.d = j;
    }

    public final void e(long j) {
        this.e = j;
    }

    public final void f(long j) {
        this.f = j;
    }

    public mb(long j, int i, int i2, long j2, long j3, long j4, int i3, h2 h2Var) {
        this.f1759a = j;
        this.b = i;
        this.c = i2;
        this.d = j2;
        this.e = j3;
        this.f = j4;
        this.g = i3;
        this.h = h2Var;
    }

    public final long e() {
        return y9.a() - this.i;
    }

    public final long d() {
        return f() - e();
    }

    public final void a() {
        c7.a("addDownloadToTimeWindow() - timeWindowStartTimeStamp " + this.i + ", timeWindowCachedVideosCount " + this.j, (Throwable) null, 2, (Object) null);
        if (this.i == 0) {
            this.i = y9.a();
        }
        this.j++;
    }

    public final boolean a(File file) {
        Intrinsics.checkNotNullParameter(file, "file");
        return a(file.lastModified());
    }

    public final boolean g() {
        h();
        boolean z = this.j >= c();
        if (z) {
            l9.a("Video loading limit reached, will resume in timeToResetWindow: " + d());
        }
        c7.a("isMaxCountForTimeWindowReached() - " + z, (Throwable) null, 2, (Object) null);
        return z;
    }

    public final long i() {
        return f() - (y9.a() - this.i);
    }

    public final void h() {
        c7.a("resetWindowWhenTimeReached()", (Throwable) null, 2, (Object) null);
        if (e() > f()) {
            c7.a("resetWindowWhenTimeReached() - timer and count reset", (Throwable) null, 2, (Object) null);
            l9.a("Video loading limit reset");
            this.j = 0;
            this.i = 0L;
        }
    }

    public final long f() {
        h2 h2Var = this.h;
        return ((h2Var == null || !h2Var.d()) ? this.d : this.e) * 1000;
    }

    public final int c() {
        h2 h2Var = this.h;
        return (h2Var == null || !h2Var.d()) ? this.b : this.c;
    }

    public final boolean a(long j) {
        return y9.a() - j > this.f * ((long) 1000);
    }
}
