package h2;

import B0.C0016c;
import java.io.IOException;
import java.util.ArrayList;
import x7.x;

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

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final long[] f13361b;

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public boolean f13365f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public C0016c f13366g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public int f13367h;
    public final /* synthetic */ f i;

    public C1029b(f fVar, String str) {
        this.i = fVar;
        this.f13360a = str;
        fVar.getClass();
        this.f13361b = new long[2];
        fVar.getClass();
        this.f13362c = new ArrayList(2);
        fVar.getClass();
        this.f13363d = new ArrayList(2);
        StringBuilder sb = new StringBuilder(str);
        sb.append('.');
        int length = sb.length();
        fVar.getClass();
        for (int i = 0; i < 2; i++) {
            sb.append(i);
            this.f13362c.add(this.i.f13379q.e(sb.toString()));
            sb.append(".tmp");
            this.f13363d.add(this.i.f13379q.e(sb.toString()));
            sb.setLength(length);
        }
    }

    public final C1030c a() {
        if (this.f13364e && this.f13366g == null && !this.f13365f) {
            ArrayList arrayList = this.f13362c;
            int size = arrayList.size();
            int i = 0;
            while (true) {
                f fVar = this.i;
                if (i >= size) {
                    this.f13367h++;
                    return new C1030c(fVar, this);
                }
                if (fVar.f13378F.e((x) arrayList.get(i))) {
                    i++;
                } else {
                    try {
                        fVar.H(this);
                        return null;
                    } catch (IOException unused) {
                    }
                }
            }
        }
        return null;
    }
}
