package kotlin.collections; import androidx.exifinterface.media.ExifInterface; import java.util.Iterator; import java.util.List; import kotlin.Metadata; import kotlin.jvm.internal.Intrinsics; import kotlin.sequences.Sequence; import kotlin.sequences.SequencesKt; /* compiled from: SlidingWindow.kt */ @Metadata(d1 = {"\u0000*\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010(\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u001a\u0018\u0010\u0000\u001a\u00020\u00012\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u0003H\u0000\u001aH\u0010\u0005\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\b0\u00070\u0006\"\u0004\b\u0000\u0010\b2\f\u0010\t\u001a\b\u0012\u0004\u0012\u0002H\b0\u00062\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000bH\u0000\u001aD\u0010\r\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\b0\u00070\u000e\"\u0004\b\u0000\u0010\b*\b\u0012\u0004\u0012\u0002H\b0\u000e2\u0006\u0010\u0002\u001a\u00020\u00032\u0006\u0010\u0004\u001a\u00020\u00032\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000bH\u0000ยจ\u0006\u000f"}, d2 = {"checkWindowSizeStep", "", "size", "", "step", "windowedIterator", "", "", ExifInterface.GPS_DIRECTION_TRUE, "iterator", "partialWindows", "", "reuseBuffer", "windowedSequence", "Lkotlin/sequences/Sequence;", "kotlin-stdlib"}, k = 2, mv = {1, 9, 0}, xi = 48) /* loaded from: classes3.dex */ public final class SlidingWindowKt { public static final void checkWindowSizeStep(int i, int i2) { String str; if (i <= 0 || i2 <= 0) { if (i != i2) { str = "Both size " + i + " and step " + i2 + " must be greater than zero."; } else { str = "size " + i + " must be greater than zero."; } throw new IllegalArgumentException(str.toString()); } } public static final Sequence> windowedSequence(final Sequence sequence, final int i, final int i2, final boolean z, final boolean z2) { Intrinsics.checkNotNullParameter(sequence, ""); checkWindowSizeStep(i, i2); return new Sequence>() { // from class: kotlin.collections.SlidingWindowKt$windowedSequence$$inlined$Sequence$1 @Override // kotlin.sequences.Sequence public Iterator> iterator() { return SlidingWindowKt.windowedIterator(Sequence.this.iterator(), i, i2, z, z2); } }; } public static final Iterator> windowedIterator(Iterator iterator, int i, int i2, boolean z, boolean z2) { Intrinsics.checkNotNullParameter(iterator, "iterator"); return !iterator.hasNext() ? EmptyIterator.INSTANCE : SequencesKt.iterator(new SlidingWindowKt$windowedIterator$1(i, i2, iterator, z2, z, null)); } }