package d0.g0; import d0.d0.f; import d0.z.d.m; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Objects; import kotlin.Pair; import kotlin.jvm.functions.Function2; import kotlin.ranges.IntRange; import kotlin.sequences.Sequence; /* compiled from: Strings.kt */ public final class d implements Sequence { public final CharSequence a; public final int b; /* renamed from: c reason: collision with root package name */ public final int f2707c; public final Function2> d; /* compiled from: Strings.kt */ public static final class a implements Iterator, d0.z.d.g0.a { public int i = -1; public int j; public int k; public IntRange l; public int m; public final /* synthetic */ d n; public a(d dVar) { this.n = dVar; int coerceIn = f.coerceIn(d.access$getStartIndex$p(dVar), 0, d.access$getInput$p(dVar).length()); this.j = coerceIn; this.k = coerceIn; } /* JADX WARNING: Code restructure failed: missing block: B:6:0x0021, code lost: if (r0 < d0.g0.d.access$getLimit$p(r6.n)) goto L_0x0023; */ public final void a() { int i = 0; if (this.k < 0) { this.i = 0; this.l = null; return; } if (d.access$getLimit$p(this.n) > 0) { int i2 = this.m + 1; this.m = i2; } if (this.k <= d.access$getInput$p(this.n).length()) { Pair pair = (Pair) d.access$getGetNextMatch$p(this.n).invoke(d.access$getInput$p(this.n), Integer.valueOf(this.k)); if (pair == null) { this.l = new IntRange(this.j, w.getLastIndex(d.access$getInput$p(this.n))); this.k = -1; } else { int intValue = ((Number) pair.component1()).intValue(); int intValue2 = ((Number) pair.component2()).intValue(); this.l = f.until(this.j, intValue); int i3 = intValue + intValue2; this.j = i3; if (intValue2 == 0) { i = 1; } this.k = i3 + i; } this.i = 1; } this.l = new IntRange(this.j, w.getLastIndex(d.access$getInput$p(this.n))); this.k = -1; this.i = 1; } @Override // java.util.Iterator public boolean hasNext() { if (this.i == -1) { a(); } return this.i == 1; } @Override // java.util.Iterator public IntRange next() { if (this.i == -1) { a(); } if (this.i != 0) { IntRange intRange = this.l; Objects.requireNonNull(intRange, "null cannot be cast to non-null type kotlin.ranges.IntRange"); this.l = null; this.i = -1; return intRange; } throw new NoSuchElementException(); } @Override // java.util.Iterator public void remove() { throw new UnsupportedOperationException("Operation is not supported for read-only collection"); } } /* JADX DEBUG: Multi-variable search result rejected for r5v0, resolved type: kotlin.jvm.functions.Function2> */ /* JADX WARN: Multi-variable type inference failed */ public d(CharSequence charSequence, int i, int i2, Function2> function2) { m.checkNotNullParameter(charSequence, "input"); m.checkNotNullParameter(function2, "getNextMatch"); this.a = charSequence; this.b = i; this.f2707c = i2; this.d = function2; } public static final /* synthetic */ Function2 access$getGetNextMatch$p(d dVar) { return dVar.d; } public static final /* synthetic */ CharSequence access$getInput$p(d dVar) { return dVar.a; } public static final /* synthetic */ int access$getLimit$p(d dVar) { return dVar.f2707c; } public static final /* synthetic */ int access$getStartIndex$p(d dVar) { return dVar.b; } @Override // kotlin.sequences.Sequence public Iterator iterator() { return new a(this); } }