package d.s0;

import java.util.Iterator;
import java.util.NoSuchElementException;

/* JADX INFO: compiled from: Strings.kt */
/* JADX INFO: loaded from: classes.dex */
@d.n
final class e implements d.r0.a<d.p0.h> {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final CharSequence f2706a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final int f2707b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final int f2708c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final d.n0.b.p<CharSequence, Integer, d.p<Integer, Integer>> f2709d;

    /* JADX INFO: compiled from: Strings.kt */
    @d.n
    public static final class a implements Iterator<d.p0.h> {

        /* JADX INFO: renamed from: c, reason: collision with root package name */
        private int f2710c = -1;

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

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

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        private d.p0.h f2713f;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private int f2714g;

        a() {
            int iD = d.p0.n.d(e.this.f2707b, 0, e.this.f2706a.length());
            this.f2711d = iD;
            this.f2712e = iD;
        }

        /* JADX WARN: Removed duplicated region for block: B:9:0x0023  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        private final void a() {
            /*
                r6 = this;
                int r0 = r6.f2712e
                r1 = 0
                if (r0 >= 0) goto Lc
                r6.f2710c = r1
                r0 = 0
                r6.f2713f = r0
                goto L9e
            Lc:
                d.s0.e r0 = d.s0.e.this
                int r0 = d.s0.e.c(r0)
                r2 = -1
                r3 = 1
                if (r0 <= 0) goto L23
                int r0 = r6.f2714g
                int r0 = r0 + r3
                r6.f2714g = r0
                d.s0.e r4 = d.s0.e.this
                int r4 = d.s0.e.c(r4)
                if (r0 >= r4) goto L31
            L23:
                int r0 = r6.f2712e
                d.s0.e r4 = d.s0.e.this
                java.lang.CharSequence r4 = d.s0.e.b(r4)
                int r4 = r4.length()
                if (r0 <= r4) goto L47
            L31:
                d.p0.h r0 = new d.p0.h
                int r1 = r6.f2711d
                d.s0.e r4 = d.s0.e.this
                java.lang.CharSequence r4 = d.s0.e.b(r4)
                int r4 = d.s0.h.z(r4)
                r0.<init>(r1, r4)
                r6.f2713f = r0
                r6.f2712e = r2
                goto L9c
            L47:
                d.s0.e r0 = d.s0.e.this
                d.n0.b.p r0 = d.s0.e.a(r0)
                d.s0.e r4 = d.s0.e.this
                java.lang.CharSequence r4 = d.s0.e.b(r4)
                int r5 = r6.f2712e
                java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
                java.lang.Object r0 = r0.g(r4, r5)
                d.p r0 = (d.p) r0
                if (r0 != 0) goto L77
                d.p0.h r0 = new d.p0.h
                int r1 = r6.f2711d
                d.s0.e r4 = d.s0.e.this
                java.lang.CharSequence r4 = d.s0.e.b(r4)
                int r4 = d.s0.h.z(r4)
                r0.<init>(r1, r4)
                r6.f2713f = r0
                r6.f2712e = r2
                goto L9c
            L77:
                java.lang.Object r2 = r0.a()
                java.lang.Number r2 = (java.lang.Number) r2
                int r2 = r2.intValue()
                java.lang.Object r0 = r0.b()
                java.lang.Number r0 = (java.lang.Number) r0
                int r0 = r0.intValue()
                int r4 = r6.f2711d
                d.p0.h r4 = d.p0.l.h(r4, r2)
                r6.f2713f = r4
                int r2 = r2 + r0
                r6.f2711d = r2
                if (r0 != 0) goto L99
                r1 = r3
            L99:
                int r2 = r2 + r1
                r6.f2712e = r2
            L9c:
                r6.f2710c = r3
            L9e:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: d.s0.e.a.a():void");
        }

        @Override // java.util.Iterator
        /* JADX INFO: renamed from: b, reason: merged with bridge method [inline-methods] */
        public d.p0.h next() {
            if (this.f2710c == -1) {
                a();
            }
            if (this.f2710c == 0) {
                throw new NoSuchElementException();
            }
            d.p0.h hVar = this.f2713f;
            d.n0.c.s.c(hVar, "null cannot be cast to non-null type kotlin.ranges.IntRange");
            this.f2713f = null;
            this.f2710c = -1;
            return hVar;
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            if (this.f2710c == -1) {
                a();
            }
            return this.f2710c == 1;
        }

        @Override // java.util.Iterator
        public void remove() {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public e(CharSequence charSequence, int i, int i2, d.n0.b.p<? super CharSequence, ? super Integer, d.p<Integer, Integer>> pVar) {
        d.n0.c.s.e(charSequence, "input");
        d.n0.c.s.e(pVar, "getNextMatch");
        this.f2706a = charSequence;
        this.f2707b = i;
        this.f2708c = i2;
        this.f2709d = pVar;
    }

    @Override // d.r0.a
    public Iterator<d.p0.h> iterator() {
        return new a();
    }
}
