soul-browser/sources/java/kotlin/text/StringsKt__IndentKt.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* Decompile and recreate Soul Browser v1.4.85 with APK CI builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix CI build: include bundled google.jks and remove PR trigger

The apktool build failed in CI because app/unknown/.../google.jks was
excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files
and commit the missing resource.

Also remove the redundant pull_request workflow trigger.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Change package ID to com.github.kaki87.soulbrowser

Rename the application ID so the rebuilt APK can be installed
alongside the original Soul Browser from Google Play.

- Update AndroidManifest package, permissions, providers, and actions
- Update R class references in smali (com/github/kaki87/soulbrowser/R)
- Update shortcuts.xml targetPackage
- Rename app label to "Soul Rebuild" for easy identification

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install compatibility: remove split APK metadata and bundle native libs

The rebuilt APK still declared requiredSplitTypes and Play Store split
metadata, causing Android to reject standalone installs as incompatible.

- Remove requiredSplitTypes and split-related manifest meta-data
- Merge native libs from all ABI splits with uncompressed storage
- Page-align before signing for extractNativeLibs=false
- Add .so to apktool doNotCompress list

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix install failure: use apksigner v2/v3 and bundle arm64 native libs

Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only
produces v1 signatures, causing Android to reject the install.

- Sign with apksigner (v1+v2+v3) instead of jarsigner
- Add arm64-v8a native libraries from universal Soul Browser 1.4.79
- Set extractNativeLibs=true for reliable sideload installs
- Commit stable debug keystore for consistent signatures across builds

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Add committed debug keystore for consistent APK signatures

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix startup crash: use original classes2.dex desugar libraries

Apktool recompiles smali_classes2 into a broken classes2.dex, causing
ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init.

Inject the original classes2.dex (Java 8+ desugar libs) after apktool
build instead of using the recompiled version.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Fix missing drawable resources from density split APKs

The base APK is an app bundle module; density-specific drawables like
seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild,
causing Resources$NotFoundException at runtime.

- Merge non-9-patch resources from split APKs before apktool build
- Sync public.xml IDs from R smali only when backing files exist
- Add 713 density-specific resource IDs to public.xml

Co-authored-by: KaKi87 <KaKi87@pm.me>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-10 16:07:14 +02:00

277 lines
14 KiB
Java

package kotlin.text;
import com.google.android.gms.ads.RequestConfiguration;
import java.util.ArrayList;
import java.util.List;
import kotlin.Metadata;
import kotlin.collections.CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.internal.IntrinsicConstEvaluation;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.sequences.SequencesKt;
import kotlin.sequences.SequencesKt___SequencesKt;
import org.jetbrains.annotations.NotNull;
@Metadata(d1 = {"\u0000\"\n\u0000\n\u0002\u0010\u000e\n\u0002\b\b\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\b\u0005\u001a\u0016\u0010\u0000\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010\u0002\u001a\u00020\u0001H\u0007\u001a\u001e\u0010\u0003\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010\u0004\u001a\u00020\u00012\b\b\u0002\u0010\u0002\u001a\u00020\u0001\u001a\f\u0010\u0005\u001a\u00020\u0001*\u00020\u0001H\u0007\u001a\u0014\u0010\u0006\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010\u0004\u001a\u00020\u0001\u001a\u0014\u0010\u0007\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010\b\u001a\u00020\u0001\u001a\u0011\u0010\t\u001a\u00020\n*\u00020\u0001H\u0002¢\u0006\u0002\b\u000b\u001a!\u0010\f\u001a\u000e\u0012\u0004\u0012\u00020\u0001\u0012\u0004\u0012\u00020\u00010\r2\u0006\u0010\b\u001a\u00020\u0001H\u0002¢\u0006\u0002\b\u000e\u001aJ\u0010\u000f\u001a\u00020\u0001*\b\u0012\u0004\u0012\u00020\u00010\u00102\u0006\u0010\u0011\u001a\u00020\n2\u0012\u0010\u0012\u001a\u000e\u0012\u0004\u0012\u00020\u0001\u0012\u0004\u0012\u00020\u00010\r2\u0014\u0010\u0013\u001a\u0010\u0012\u0004\u0012\u00020\u0001\u0012\u0006\u0012\u0004\u0018\u00010\u00010\rH\u0082\\u0006\u0002\b\u0014¨\u0006\u0015"}, d2 = {"trimMargin", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "marginPrefix", "replaceIndentByMargin", "newIndent", "trimIndent", "replaceIndent", "prependIndent", "indent", "indentWidth", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "indentWidth$StringsKt__IndentKt", "getIndentFunction", "Lkotlin/Function1;", "getIndentFunction$StringsKt__IndentKt", "reindent", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, "resultSizeEstimate", "indentAddFunction", "indentCutFunction", "reindent$StringsKt__IndentKt", "kotlin-stdlib"}, k = 5, mv = {2, 2, 0}, xi = 49, xs = "kotlin/text/StringsKt")
@SourceDebugExtension({"SMAP\nIndent.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Indent.kt\nkotlin/text/StringsKt__IndentKt\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 4 _Strings.kt\nkotlin/text/StringsKt___StringsKt\n*L\n1#1,129:1\n119#1,2:131\n121#1,4:146\n126#1,2:159\n119#1,2:168\n121#1,4:183\n126#1,2:190\n1#2:130\n1#2:156\n1#2:187\n1#2:211\n1583#3,11:133\n1878#3,2:144\n1880#3:157\n1594#3:158\n774#3:161\n865#3,2:162\n1563#3:164\n1634#3,3:165\n1583#3,11:170\n1878#3,2:181\n1880#3:188\n1594#3:189\n1583#3,11:198\n1878#3,2:209\n1880#3:212\n1594#3:213\n158#4,6:150\n158#4,6:192\n*S KotlinDebug\n*F\n+ 1 Indent.kt\nkotlin/text/StringsKt__IndentKt\n*L\n42#1:131,2\n42#1:146,4\n42#1:159,2\n83#1:168,2\n83#1:183,4\n83#1:190,2\n42#1:156\n83#1:187\n120#1:211\n42#1:133,11\n42#1:144,2\n42#1:157\n42#1:158\n79#1:161\n79#1:162,2\n80#1:164\n80#1:165,3\n83#1:170,11\n83#1:181,2\n83#1:188\n83#1:189\n120#1:198,11\n120#1:209,2\n120#1:212\n120#1:213\n43#1:150,6\n107#1:192,6\n*E\n"})
/* loaded from: classes4.dex */
public class StringsKt__IndentKt extends StringsKt__AppendableKt {
private static final Function1<String, String> getIndentFunction$StringsKt__IndentKt(String str) {
if (str.length() == 0) {
return new d(0);
}
return new c(1, str);
}
public static final String getIndentFunction$lambda$0$StringsKt__IndentKt(String line) {
Intrinsics.checkNotNullParameter(line, "line");
return line;
}
public static final String getIndentFunction$lambda$1$StringsKt__IndentKt(String str, String line) {
Intrinsics.checkNotNullParameter(line, "line");
return str + line;
}
private static final int indentWidth$StringsKt__IndentKt(String str) {
int length = str.length();
int i = 0;
while (true) {
if (i < length) {
if (!CharsKt__CharJVMKt.isWhitespace(str.charAt(i))) {
break;
}
i++;
} else {
i = -1;
break;
}
}
if (i == -1) {
return str.length();
}
return i;
}
@NotNull
public static final String prependIndent(@NotNull String str, @NotNull String indent) {
String joinToString$default;
Intrinsics.checkNotNullParameter(str, "<this>");
Intrinsics.checkNotNullParameter(indent, "indent");
joinToString$default = SequencesKt___SequencesKt.joinToString$default(SequencesKt.map(StringsKt__StringsKt.lineSequence(str), new c(0, indent)), "\n", null, null, 0, null, null, 62, null);
return joinToString$default;
}
public static /* synthetic */ String prependIndent$default(String str, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str2 = " ";
}
return prependIndent(str, str2);
}
public static final String prependIndent$lambda$0$StringsKt__IndentKt(String str, String it) {
Intrinsics.checkNotNullParameter(it, "it");
if (StringsKt__StringsKt.isBlank(it)) {
if (it.length() < str.length()) {
return str;
}
return it;
}
return android.support.v4.media.a.k(str, it);
}
private static final String reindent$StringsKt__IndentKt(List<String> list, int i, Function1<? super String, String> function1, Function1<? super String, String> function12) {
Appendable joinTo$default;
String invoke;
int lastIndex = CollectionsKt.getLastIndex(list);
ArrayList arrayList = new ArrayList();
int i2 = 0;
for (Object obj : list) {
int i3 = i2 + 1;
if (i2 < 0) {
CollectionsKt.throwIndexOverflow();
}
String str = (String) obj;
if ((i2 == 0 || i2 == lastIndex) && StringsKt__StringsKt.isBlank(str)) {
str = null;
} else {
String invoke2 = function12.invoke(str);
if (invoke2 != null && (invoke = function1.invoke(invoke2)) != null) {
str = invoke;
}
}
if (str != null) {
arrayList.add(str);
}
i2 = i3;
}
joinTo$default = CollectionsKt___CollectionsKt.joinTo$default(arrayList, new StringBuilder(i), "\n", null, null, 0, null, null, 124, null);
return ((StringBuilder) joinTo$default).toString();
}
@NotNull
public static final String replaceIndent(@NotNull String str, @NotNull String newIndent) {
Comparable minOrNull;
int i;
Appendable joinTo$default;
String invoke;
Intrinsics.checkNotNullParameter(str, "<this>");
Intrinsics.checkNotNullParameter(newIndent, "newIndent");
List<String> lines = StringsKt__StringsKt.lines(str);
ArrayList arrayList = new ArrayList();
for (Object obj : lines) {
if (!StringsKt__StringsKt.isBlank((String) obj)) {
arrayList.add(obj);
}
}
ArrayList arrayList2 = new ArrayList(CollectionsKt.collectionSizeOrDefault(arrayList, 10));
int size = arrayList.size();
int i2 = 0;
int i3 = 0;
while (i3 < size) {
Object obj2 = arrayList.get(i3);
i3++;
arrayList2.add(Integer.valueOf(indentWidth$StringsKt__IndentKt((String) obj2)));
}
minOrNull = CollectionsKt___CollectionsKt.minOrNull((Iterable<? extends Comparable>) ((Iterable) arrayList2));
Integer num = (Integer) minOrNull;
if (num != null) {
i = num.intValue();
} else {
i = 0;
}
int size2 = (lines.size() * newIndent.length()) + str.length();
Function1<String, String> indentFunction$StringsKt__IndentKt = getIndentFunction$StringsKt__IndentKt(newIndent);
int lastIndex = CollectionsKt.getLastIndex(lines);
ArrayList arrayList3 = new ArrayList();
for (Object obj3 : lines) {
int i4 = i2 + 1;
if (i2 < 0) {
CollectionsKt.throwIndexOverflow();
}
String str2 = (String) obj3;
if ((i2 == 0 || i2 == lastIndex) && StringsKt__StringsKt.isBlank(str2)) {
str2 = null;
} else {
String drop = StringsKt___StringsKt.drop(str2, i);
if (drop != null && (invoke = indentFunction$StringsKt__IndentKt.invoke(drop)) != null) {
str2 = invoke;
}
}
if (str2 != null) {
arrayList3.add(str2);
}
i2 = i4;
}
joinTo$default = CollectionsKt___CollectionsKt.joinTo$default(arrayList3, new StringBuilder(size2), "\n", null, null, 0, null, null, 124, null);
return ((StringBuilder) joinTo$default).toString();
}
public static /* synthetic */ String replaceIndent$default(String str, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str2 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
}
return replaceIndent(str, str2);
}
@NotNull
public static final String replaceIndentByMargin(@NotNull String str, @NotNull String newIndent, @NotNull String marginPrefix) {
Appendable joinTo$default;
String str2;
String invoke;
Intrinsics.checkNotNullParameter(str, "<this>");
Intrinsics.checkNotNullParameter(newIndent, "newIndent");
Intrinsics.checkNotNullParameter(marginPrefix, "marginPrefix");
if (!StringsKt__StringsKt.isBlank(marginPrefix)) {
List<String> lines = StringsKt__StringsKt.lines(str);
int size = (lines.size() * newIndent.length()) + str.length();
Function1<String, String> indentFunction$StringsKt__IndentKt = getIndentFunction$StringsKt__IndentKt(newIndent);
int lastIndex = CollectionsKt.getLastIndex(lines);
ArrayList arrayList = new ArrayList();
int i = 0;
for (Object obj : lines) {
int i2 = i + 1;
if (i < 0) {
CollectionsKt.throwIndexOverflow();
}
String str3 = (String) obj;
String str4 = null;
if ((i == 0 || i == lastIndex) && StringsKt__StringsKt.isBlank(str3)) {
str2 = marginPrefix;
str3 = null;
} else {
int length = str3.length();
int i3 = 0;
while (true) {
if (i3 < length) {
if (!CharsKt__CharJVMKt.isWhitespace(str3.charAt(i3))) {
break;
}
i3++;
} else {
i3 = -1;
break;
}
}
if (i3 == -1) {
str2 = marginPrefix;
} else {
int i4 = i3;
str2 = marginPrefix;
if (StringsKt__StringsJVMKt.startsWith$default(str3, str2, i4, false, 4, null)) {
int length2 = str2.length() + i4;
Intrinsics.checkNotNull(str3, "null cannot be cast to non-null type java.lang.String");
str4 = str3.substring(length2);
Intrinsics.checkNotNullExpressionValue(str4, "substring(...)");
}
}
if (str4 != null && (invoke = indentFunction$StringsKt__IndentKt.invoke(str4)) != null) {
str3 = invoke;
}
}
if (str3 != null) {
arrayList.add(str3);
}
i = i2;
marginPrefix = str2;
}
joinTo$default = CollectionsKt___CollectionsKt.joinTo$default(arrayList, new StringBuilder(size), "\n", null, null, 0, null, null, 124, null);
return ((StringBuilder) joinTo$default).toString();
}
throw new IllegalArgumentException("marginPrefix must be non-blank string.");
}
public static /* synthetic */ String replaceIndentByMargin$default(String str, String str2, String str3, int i, Object obj) {
if ((i & 1) != 0) {
str2 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
}
if ((i & 2) != 0) {
str3 = "|";
}
return replaceIndentByMargin(str, str2, str3);
}
@IntrinsicConstEvaluation
@NotNull
public static String trimIndent(@NotNull String str) {
Intrinsics.checkNotNullParameter(str, "<this>");
return replaceIndent(str, RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED);
}
@IntrinsicConstEvaluation
@NotNull
public static final String trimMargin(@NotNull String str, @NotNull String marginPrefix) {
Intrinsics.checkNotNullParameter(str, "<this>");
Intrinsics.checkNotNullParameter(marginPrefix, "marginPrefix");
return replaceIndentByMargin(str, RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, marginPrefix);
}
public static /* synthetic */ String trimMargin$default(String str, String str2, int i, Object obj) {
if ((i & 1) != 0) {
str2 = "|";
}
return trimMargin(str, str2);
}
}