package kotlinx.coroutines.flow; import kotlin.coroutines.CoroutineContext; import kotlinx.coroutines.channels.BufferOverflow; import kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl; import kotlinx.coroutines.internal.Symbol; /* loaded from: classes5.dex */ public abstract class SharedFlowKt { public static final Symbol NO_VALUE = new Symbol("NO_VALUE"); public static /* synthetic */ MutableSharedFlow MutableSharedFlow$default(int i, int i2, BufferOverflow bufferOverflow, int i3, Object obj) { if ((i3 & 1) != 0) { i = 0; } if ((i3 & 2) != 0) { i2 = 0; } if ((i3 & 4) != 0) { bufferOverflow = BufferOverflow.SUSPEND; } return MutableSharedFlow(i, i2, bufferOverflow); } public static final MutableSharedFlow MutableSharedFlow(int i, int i2, BufferOverflow bufferOverflow) { if (i < 0) { throw new IllegalArgumentException(("replay cannot be negative, but was " + i).toString()); } if (i2 < 0) { throw new IllegalArgumentException(("extraBufferCapacity cannot be negative, but was " + i2).toString()); } if (i <= 0 && i2 <= 0 && bufferOverflow != BufferOverflow.SUSPEND) { throw new IllegalArgumentException(("replay or extraBufferCapacity must be positive with non-default onBufferOverflow strategy " + bufferOverflow).toString()); } int i3 = i2 + i; if (i3 < 0) { i3 = Integer.MAX_VALUE; } return new SharedFlowImpl(i, i3, bufferOverflow); } public static final Object getBufferAt(Object[] objArr, long j) { return objArr[((int) j) & (objArr.length - 1)]; } public static final void setBufferAt(Object[] objArr, long j, Object obj) { objArr[((int) j) & (objArr.length - 1)] = obj; } public static final Flow fuseSharedFlow(SharedFlow sharedFlow, CoroutineContext coroutineContext, int i, BufferOverflow bufferOverflow) { return ((i == 0 || i == -3) && bufferOverflow == BufferOverflow.SUSPEND) ? sharedFlow : new ChannelFlowOperatorImpl(sharedFlow, coroutineContext, i, bufferOverflow); } }