alexandroid/decompiled/jadx/sources/androidx/compose/ui/text/input/GapBuffer.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

105 lines
5.2 KiB
Java

package androidx.compose.ui.text.input;
import com.dee.app.metrics.MetricsConstants;
import kotlin.Metadata;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.jvm.internal.SourceDebugExtension;
import org.jetbrains.annotations.NotNull;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@Metadata(d1 = {"\u0000<\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0019\n\u0000\n\u0002\u0010\b\n\u0002\b\t\n\u0002\u0010\f\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0006\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0002\u0018\u00002\u00020\u0001B\u001f\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0005¢\u0006\u0004\b\u0007\u0010\bJ\b\u0010\r\u001a\u00020\u0005H\u0002J\u0011\u0010\u000e\u001a\u00020\u000f2\u0006\u0010\u0010\u001a\u00020\u0005H\u0086\u0002J\u0010\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u0005H\u0002J\u0018\u0010\u0014\u001a\u00020\u00122\u0006\u0010\u0015\u001a\u00020\u00052\u0006\u0010\u0016\u001a\u00020\u0005H\u0002J\u001e\u0010\u0017\u001a\u00020\u00122\u0006\u0010\u0015\u001a\u00020\u00052\u0006\u0010\u0016\u001a\u00020\u00052\u0006\u0010\u0018\u001a\u00020\u0019J\u0012\u0010\u001a\u001a\u00020\u00122\n\u0010\u001b\u001a\u00060\u001cj\u0002`\u001dJ\u0006\u0010\u001e\u001a\u00020\u0005J\b\u0010\u001f\u001a\u00020\u0019H\u0016R\u000e\u0010\t\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u0003X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u000b\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\u0005X\u0082\u000e¢\u0006\u0002\n\u0000¨\u0006 "}, d2 = {"Landroidx/compose/ui/text/input/GapBuffer;", "", "initBuffer", "", "initGapStart", "", "initGapEnd", "<init>", "([CII)V", "capacity", "buffer", "gapStart", "gapEnd", "gapLength", MetricsConstants.Method.CACHE_GET, "", "index", "makeSureAvailableSpace", "", "requestSize", "delete", "start", "end", "replace", "text", "", "append", "builder", "Ljava/lang/StringBuilder;", "Lkotlin/text/StringBuilder;", "length", "toString", "ui-text"}, k = 1, mv = {2, 0, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nGapBuffer.kt\nKotlin\n*S Kotlin\n*F\n+ 1 GapBuffer.kt\nandroidx/compose/ui/text/input/GapBuffer\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,318:1\n1#2:319\n*E\n"})
/* loaded from: classes13.dex */
final class GapBuffer {
@NotNull
private char[] buffer;
private int capacity;
private int gapEnd;
private int gapStart;
public GapBuffer(@NotNull char[] cArr, int i, int i2) {
this.capacity = cArr.length;
this.buffer = cArr;
this.gapStart = i;
this.gapEnd = i2;
}
private final void delete(int start, int end) {
int i = this.gapStart;
if (start < i && end <= i) {
int i2 = i - end;
char[] cArr = this.buffer;
ArraysKt___ArraysJvmKt.copyInto(cArr, cArr, this.gapEnd - i2, end, i);
this.gapStart = start;
this.gapEnd -= i2;
return;
}
if (start < i && end >= i) {
this.gapEnd = end + gapLength();
this.gapStart = start;
return;
}
int gapLength = start + gapLength();
int gapLength2 = end + gapLength();
int i3 = this.gapEnd;
char[] cArr2 = this.buffer;
ArraysKt___ArraysJvmKt.copyInto(cArr2, cArr2, this.gapStart, i3, gapLength);
this.gapStart += gapLength - i3;
this.gapEnd = gapLength2;
}
private final int gapLength() {
return this.gapEnd - this.gapStart;
}
private final void makeSureAvailableSpace(int requestSize) {
if (requestSize <= gapLength()) {
return;
}
int gapLength = requestSize - gapLength();
int i = this.capacity;
do {
i *= 2;
} while (i - this.capacity < gapLength);
char[] cArr = new char[i];
ArraysKt___ArraysJvmKt.copyInto(this.buffer, cArr, 0, 0, this.gapStart);
int i2 = this.capacity;
int i3 = this.gapEnd;
int i4 = i2 - i3;
int i5 = i - i4;
ArraysKt___ArraysJvmKt.copyInto(this.buffer, cArr, i5, i3, i4 + i3);
this.buffer = cArr;
this.capacity = i;
this.gapEnd = i5;
}
public final void append(@NotNull StringBuilder builder) {
builder.append(this.buffer, 0, this.gapStart);
char[] cArr = this.buffer;
int i = this.gapEnd;
builder.append(cArr, i, this.capacity - i);
}
public final char get(int index) {
int i = this.gapStart;
char[] cArr = this.buffer;
return index < i ? cArr[index] : cArr[(index - i) + this.gapEnd];
}
public final int length() {
return this.capacity - gapLength();
}
public final void replace(int start, int end, @NotNull String text) {
makeSureAvailableSpace(text.length() - (end - start));
delete(start, end);
GapBufferKt.toCharArray(text, this.buffer, this.gapStart);
this.gapStart = text.length() + this.gapStart;
}
@NotNull
public String toString() {
return "";
}
}