package K;

import J0.AbstractC0391w0;
import T0.C0596g;
import T0.C0606q;
import X0.InterfaceC0807u;
import android.os.Build;
import android.os.Trace;
import androidx.compose.runtime.Composer;
import androidx.compose.runtime.ComposerKt;
import androidx.compose.runtime.CompositionLocalKt;
import androidx.compose.runtime.ProvidableCompositionLocal;
import androidx.compose.runtime.snapshots.MutableSnapshot;
import androidx.compose.runtime.snapshots.Snapshot;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;

/* JADX INFO: renamed from: K.x, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0486x {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final ProvidableCompositionLocal f4016a = CompositionLocalKt.staticCompositionLocalOf(new B2.f(4));

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static Boolean f4017b;

    /* JADX WARN: Removed duplicated region for block: B:13:0x004d A[Catch: RejectedExecutionException -> 0x00a0, TryCatch #0 {RejectedExecutionException -> 0x00a0, blocks: (B:11:0x0047, B:17:0x0054, B:19:0x0069, B:24:0x0074, B:26:0x0086, B:29:0x009b, B:28:0x008e, B:21:0x006f, B:13:0x004d), top: B:37:0x0047 }] */
    /* JADX WARN: Removed duplicated region for block: B:15:0x0051  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static final void a(final C0596g c0596g, final T0.O o6, final InterfaceC0807u interfaceC0807u, final List list, Composer composer, int i6) {
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventStart(-650368117, i6, -1, "androidx.compose.foundation.text.BackgroundTextMeasurement (BasicText.android.kt:102)");
        }
        Executor executor = (Executor) composer.consume(f4016a);
        if (executor == null || !b(c0596g.f6510b.length())) {
            composer.startReplaceGroup(-523310345);
        } else {
            composer.startReplaceGroup(-518761746);
            final h1.m mVar = (h1.m) composer.consume(AbstractC0391w0.f3105n);
            final h1.c cVar = (h1.c) composer.consume(AbstractC0391w0.f3100h);
            if (((i6 & 112) ^ 48) > 32) {
                try {
                    if (!composer.changed(o6)) {
                        boolean z6 = (i6 & 48) == 32;
                        boolean zChanged = z6 | composer.changed(mVar.ordinal()) | composer.changedInstance(list) | ((((i6 & 14) ^ 6) > 4 && composer.changed(c0596g)) || (i6 & 6) == 4) | composer.changed(cVar) | composer.changedInstance(interfaceC0807u);
                        Object objRememberedValue = composer.rememberedValue();
                        if (zChanged || objRememberedValue == Composer.Companion.getEmpty()) {
                            Object obj = new Runnable() { // from class: K.v
                                @Override // java.lang.Runnable
                                public final void run() {
                                    T0.O o7 = o6;
                                    h1.m mVar2 = mVar;
                                    C0596g c0596g2 = c0596g;
                                    h1.c cVar2 = cVar;
                                    InterfaceC0807u interfaceC0807u2 = interfaceC0807u;
                                    Trace.beginSection("BackgroundTextMeasurement");
                                    try {
                                        MutableSnapshot mutableSnapshotTakeMutableSnapshot$default = Snapshot.Companion.takeMutableSnapshot$default(Snapshot.Companion, null, null, 3, null);
                                        try {
                                            Snapshot snapshotMakeCurrent = mutableSnapshotTakeMutableSnapshot$default.makeCurrent();
                                            try {
                                                T0.O oD0 = e4.C.d0(o7, mVar2);
                                                List list2 = list;
                                                if (list2 == null) {
                                                    list2 = x4.y.f26065a;
                                                }
                                                new C0606q(c0596g2, oD0, list2, cVar2, interfaceC0807u2).c();
                                                mutableSnapshotTakeMutableSnapshot$default.apply().check();
                                            } finally {
                                                mutableSnapshotTakeMutableSnapshot$default.restoreCurrent(snapshotMakeCurrent);
                                            }
                                        } finally {
                                        }
                                    } finally {
                                        Trace.endSection();
                                    }
                                }
                            };
                            composer.updateRememberedValue(obj);
                            objRememberedValue = obj;
                        }
                        executor.execute((Runnable) objRememberedValue);
                    }
                } catch (RejectedExecutionException unused) {
                }
            }
        }
        composer.endReplaceGroup();
        if (ComposerKt.isTraceInProgress()) {
            ComposerKt.traceEventEnd();
        }
    }

    public static final boolean b(int i6) {
        if (Build.VERSION.SDK_INT >= 28 && i6 >= 8 && i6 < 1000) {
            if (f4017b == null) {
                f4017b = Boolean.valueOf(Runtime.getRuntime().availableProcessors() >= 4);
            }
            Boolean bool = f4017b;
            kotlin.jvm.internal.o.e(bool);
            if (bool.booleanValue()) {
                return true;
            }
        }
        return false;
    }
}
