package c.u;

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

/* JADX INFO: compiled from: Strings.kt */
/* JADX INFO: loaded from: classes.dex */
final class d implements c.t.c<c.r.c> {

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final c.q.c.c<CharSequence, Integer, c.d<Integer, Integer>> f1477d;

    /* JADX INFO: compiled from: Strings.kt */
    public static final class a implements Iterator<c.r.c>, c.q.d.v.a {

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

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

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

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        private c.r.c f1481e;

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

        a() {
            int iD = c.r.g.d(d.this.f1475b, 0, d.this.f1474a.length());
            this.f1479c = iD;
            this.f1480d = 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.f1480d
                r1 = 0
                if (r0 >= 0) goto Lc
                r6.f1478b = r1
                r0 = 0
                r6.f1481e = r0
                goto L9e
            Lc:
                c.u.d r0 = c.u.d.this
                int r0 = c.u.d.d(r0)
                r2 = -1
                r3 = 1
                if (r0 <= 0) goto L23
                int r0 = r6.f1482f
                int r0 = r0 + r3
                r6.f1482f = r0
                c.u.d r4 = c.u.d.this
                int r4 = c.u.d.d(r4)
                if (r0 >= r4) goto L31
            L23:
                int r0 = r6.f1480d
                c.u.d r4 = c.u.d.this
                java.lang.CharSequence r4 = c.u.d.c(r4)
                int r4 = r4.length()
                if (r0 <= r4) goto L47
            L31:
                int r0 = r6.f1479c
                c.r.c r1 = new c.r.c
                c.u.d r4 = c.u.d.this
                java.lang.CharSequence r4 = c.u.d.c(r4)
                int r4 = c.u.o.B(r4)
                r1.<init>(r0, r4)
                r6.f1481e = r1
                r6.f1480d = r2
                goto L9c
            L47:
                c.u.d r0 = c.u.d.this
                c.q.c.c r0 = c.u.d.b(r0)
                c.u.d r4 = c.u.d.this
                java.lang.CharSequence r4 = c.u.d.c(r4)
                int r5 = r6.f1480d
                java.lang.Integer r5 = java.lang.Integer.valueOf(r5)
                java.lang.Object r0 = r0.a(r4, r5)
                c.d r0 = (c.d) r0
                if (r0 != 0) goto L77
                int r0 = r6.f1479c
                c.r.c r1 = new c.r.c
                c.u.d r4 = c.u.d.this
                java.lang.CharSequence r4 = c.u.d.c(r4)
                int r4 = c.u.o.B(r4)
                r1.<init>(r0, r4)
                r6.f1481e = r1
                r6.f1480d = 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.f1479c
                c.r.c r4 = c.r.d.g(r4, r2)
                r6.f1481e = r4
                int r2 = r2 + r0
                r6.f1479c = r2
                if (r0 != 0) goto L99
                r1 = r3
            L99:
                int r2 = r2 + r1
                r6.f1480d = r2
            L9c:
                r6.f1478b = r3
            L9e:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: c.u.d.a.a():void");
        }

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

        @Override // java.util.Iterator
        public boolean hasNext() {
            if (this.f1478b == -1) {
                a();
            }
            return this.f1478b == 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 d(CharSequence charSequence, int i, int i2, c.q.c.c<? super CharSequence, ? super Integer, c.d<Integer, Integer>> cVar) {
        c.q.d.j.c(charSequence, "input");
        c.q.d.j.c(cVar, "getNextMatch");
        this.f1474a = charSequence;
        this.f1475b = i;
        this.f1476c = i2;
        this.f1477d = cVar;
    }

    @Override // c.t.c
    public Iterator<c.r.c> iterator() {
        return new a();
    }
}
