package r4;

import K2.e;
import android.os.SystemClock;
import android.util.Log;
import e0.C0853a;
import g3.h;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import k4.C1099b;
import s4.C1521a;
import w2.C1698a;
import w2.EnumC1700c;

/* JADX INFO: renamed from: r4.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1495b {

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

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final int f16448e;

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final ThreadPoolExecutor f16450g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final e f16451h;
    public final C0853a i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f16452j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public long f16453k;

    public C1495b(e eVar, C1521a c1521a, C0853a c0853a) {
        double d8 = c1521a.f16861d;
        long j8 = ((long) c1521a.f16863f) * 1000;
        this.f16444a = d8;
        this.f16445b = c1521a.f16862e;
        this.f16446c = j8;
        this.f16451h = eVar;
        this.i = c0853a;
        this.f16447d = SystemClock.elapsedRealtime();
        int i = (int) d8;
        this.f16448e = i;
        ArrayBlockingQueue arrayBlockingQueue = new ArrayBlockingQueue(i);
        this.f16449f = arrayBlockingQueue;
        this.f16450g = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, arrayBlockingQueue);
        this.f16452j = 0;
        this.f16453k = 0L;
    }

    public final int a() {
        if (this.f16453k == 0) {
            this.f16453k = System.currentTimeMillis();
        }
        int iCurrentTimeMillis = (int) ((System.currentTimeMillis() - this.f16453k) / this.f16446c);
        int iMin = this.f16449f.size() == this.f16448e ? Math.min(100, this.f16452j + iCurrentTimeMillis) : Math.max(0, this.f16452j - iCurrentTimeMillis);
        if (this.f16452j != iMin) {
            this.f16452j = iMin;
            this.f16453k = System.currentTimeMillis();
        }
        return iMin;
    }

    public final void b(C1099b c1099b, h hVar) {
        String str = "Sending report through Google DataTransport: " + c1099b.f13846b;
        if (Log.isLoggable("FirebaseCrashlytics", 3)) {
            Log.d("FirebaseCrashlytics", str, null);
        }
        this.f16451h.L(new C1698a(c1099b.f13845a, EnumC1700c.f18298s), new O0.e(this, hVar, SystemClock.elapsedRealtime() - this.f16447d < 2000, c1099b));
    }
}
