导航菜单

页面标题

页面副标题

Tasker v6.6.3 - b7.java 源代码

正在查看: Tasker v6.6.3 应用的 b7.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.joaomgcd.taskerm.util;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Notification;
import android.app.Service;
import android.app.usage.UsageEvents;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
import android.bluetooth.BluetoothProfile;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.pm.ComponentInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.hardware.Sensor;
import android.media.AudioAttributes;
import android.media.MediaMetadata;
import android.media.MediaPlayer;
import android.net.ConnectivityManager;
import android.net.LinkProperties;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.Uri;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.BaseBundle;
import android.os.Bundle;
import android.os.ParcelUuid;
import android.os.Parcelable;
import android.service.notification.StatusBarNotification;
import android.telephony.TelephonyDisplayInfo;
import android.text.Editable;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewManager;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.widget.EditText;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityForResultForIntent;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityForResultForIntentGrantFilePermission;
import com.joaomgcd.taskerm.navigationbar.IconProvider;
import com.joaomgcd.taskerm.structuredoutput.StructureType;
import com.joaomgcd.taskerm.util.s2;
import com.joaomgcd.taskerservercommon.ConstantsCommonTaskerServer;
import cyanogenmod.app.ProfileManager;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Writer;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import kotlin.Pair;
import net.dinglisch.android.taskerm.Expr;
import net.dinglisch.android.taskerm.an;
import net.dinglisch.android.taskerm.bn;
import net.dinglisch.android.taskerm.fn;
import net.dinglisch.android.taskerm.fo;
import net.dinglisch.android.taskerm.go;
import net.dinglisch.android.taskerm.io;
import net.dinglisch.android.taskerm.mj;
import net.dinglisch.android.taskerm.pp;
import net.dinglisch.android.taskerm.pr;
import net.dinglisch.android.taskerm.r1;
import net.dinglisch.android.taskerm.sn;
import net.dinglisch.android.taskerm.wo;
import net.dinglisch.android.taskerm.wp;
import net.dinglisch.android.taskerm.xq;
import org.json.JSONException;
import org.json.JSONObject;
import sg.a4;
import vj.r;

public final class b7 {

    static final class a<T> implements ik.l<T, vj.e0> {
        final zj.e<T> i;

        a(zj.e<? super T> eVar) {
            this.i = eVar;
        }

        public final void a(T t) {
            this.i.w(vj.r.a(t));
        }

        @Override
        public vj.e0 invoke(Object obj) {
            a(obj);
            return vj.e0.a;
        }
    }

    static final class b implements aa.e {
        final zj.e<T> a;

        b(zj.e<? super T> eVar) {
            this.a = eVar;
        }

        public final void onFailure(Exception exc) {
            jk.p.i(exc, "error");
            zj.e<T> eVar = this.a;
            r.a aVar = vj.r.i;
            eVar.w(vj.r.a(vj.s.a(exc)));
        }
    }

    static final class c implements ik.l<Void, vj.e0> {
        final zj.e<vj.e0> i;

        c(zj.e<? super vj.e0> eVar) {
            this.i = eVar;
        }

        public final void a(Void r2) {
            zj.e<vj.e0> eVar = this.i;
            r.a aVar = vj.r.i;
            eVar.w(vj.r.a(vj.e0.a));
        }

        @Override
        public vj.e0 invoke(Void r1) {
            a(r1);
            return vj.e0.a;
        }
    }

    static final class d implements aa.e {
        final zj.e<vj.e0> a;

        d(zj.e<? super vj.e0> eVar) {
            this.a = eVar;
        }

        public final void onFailure(Exception exc) {
            jk.p.i(exc, "error");
            zj.e<vj.e0> eVar = this.a;
            r.a aVar = vj.r.i;
            eVar.w(vj.r.a(vj.s.a(exc)));
        }
    }

    public static final class e implements hl.f {
        final zj.e<hl.d0> i;

        e(zj.e<? super hl.d0> eVar) {
            this.i = eVar;
        }

        @Override
        public void a(hl.e eVar, hl.d0 d0Var) {
            jk.p.i(eVar, net.dinglisch.android.taskerm.z5.CALL_LABEL);
            jk.p.i(d0Var, "response");
            this.i.w(vj.r.a(d0Var));
        }

        @Override
        public void c(hl.e eVar, IOException iOException) {
            jk.p.i(eVar, net.dinglisch.android.taskerm.z5.CALL_LABEL);
            jk.p.i(iOException, "e");
            zj.e<hl.d0> eVar2 = this.i;
            r.a aVar = vj.r.i;
            eVar2.w(vj.r.a(vj.s.a(iOException)));
        }
    }

    @bk.f(c = "com.joaomgcd.taskerm.util.ExtensionsKt$doInMainSuspend$2", f = "Extensions.kt", l = {}, m = "invokeSuspend")
    static final class f<T> extends bk.m implements ik.p<uk.n0, zj.e<? super T>, Object> {
        int t;
        final ik.a<T> u;

        f(ik.a<? extends T> aVar, zj.e<? super f> eVar) {
            super(2, eVar);
            this.u = aVar;
        }

        @Override
        public final zj.e<vj.e0> m(Object obj, zj.e<?> eVar) {
            return new f(this.u, eVar);
        }

        @Override
        public final Object t(Object obj) {
            ak.b.c();
            if (this.t != 0) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            vj.s.b(obj);
            return this.u.e();
        }

        @Override
        public final Object n(uk.n0 n0Var, zj.e<? super T> eVar) {
            return ((f) m(n0Var, eVar)).t(vj.e0.a);
        }
    }

    public static final class g implements BluetoothProfile.ServiceListener {
        final sj.d<x1> a;

        g(sj.d<x1> dVar) {
            this.a = dVar;
        }

        @Override
        public void onServiceConnected(int i, BluetoothProfile bluetoothProfile) {
            jk.p.i(bluetoothProfile, "bluetoothProfile");
            this.a.b(new x1(i, bluetoothProfile));
        }

        @Override
        public void onServiceDisconnected(int i) {
        }
    }

    public static final class h extends BluetoothGattCallback {
        final sj.d<Integer> a;
        final jk.j0<BluetoothGatt> b;

        h(sj.d<Integer> dVar, jk.j0<BluetoothGatt> j0Var) {
            this.a = dVar;
            this.b = j0Var;
        }

        @Override
        public void onConnectionStateChange(BluetoothGatt bluetoothGatt, int i, int i2) {
            jk.p.i(bluetoothGatt, "gatt");
            super.onConnectionStateChange(bluetoothGatt, i, i2);
            this.b.i = bluetoothGatt;
            bluetoothGatt.readRemoteRssi();
        }

        @Override
        public void onReadRemoteRssi(BluetoothGatt bluetoothGatt, int i, int i2) {
            jk.p.i(bluetoothGatt, "gatt");
            this.a.b(Integer.valueOf(i));
            b7.T0(bluetoothGatt);
        }
    }

    public static final class i implements ViewTreeObserver.OnPreDrawListener {
        final View i;
        final ik.l<View, vj.e0> q;

        i(View view, ik.l<? super View, vj.e0> lVar) {
            this.i = view;
            this.q = lVar;
        }

        @Override
        public boolean onPreDraw() {
            this.i.getViewTreeObserver().removeOnPreDrawListener(this);
            this.q.invoke(this.i);
            return true;
        }
    }

    static final class j implements aa.f {
        private final ik.l a;

        j(ik.l lVar) {
            jk.p.i(lVar, "function");
            this.a = lVar;
        }

        public final void b(Object obj) {
            this.a.invoke(obj);
        }
    }

    @bk.f(c = "com.joaomgcd.taskerm.util.ExtensionsKt", f = "Extensions.kt", l = {2399}, m = "tryOrHandleErrorSuspend")
    static final class k extends bk.d {
        Object s;
        Object t;
        Object u;
        int v;

        k(zj.e<? super k> eVar) {
            super(eVar);
        }

        @Override
        public final Object t(Object obj) {
            this.u = obj;
            this.v |= Integer.MIN_VALUE;
            return b7.l6(null, null, this);
        }
    }

    @bk.f(c = "com.joaomgcd.taskerm.util.ExtensionsKt", f = "Extensions.kt", l = {2380}, m = "tryOrNullSuspend")
    static final class l<T> extends bk.d {
        Object s;
        Object t;
        Object u;
        int v;

        l(zj.e<? super l> eVar) {
            super(eVar);
        }

        @Override
        public final Object t(Object obj) {
            this.u = obj;
            this.v |= Integer.MIN_VALUE;
            return b7.o6(null, null, this);
        }
    }

    @bk.f(c = "com.joaomgcd.taskerm.util.ExtensionsKt", f = "Extensions.kt", l = {2675, 2677}, m = "waitTilTrue")
    static final class m extends bk.d {
        Object s;
        long t;
        long u;
        Object v;
        int w;

        m(zj.e<? super m> eVar) {
            super(eVar);
        }

        @Override
        public final Object t(Object obj) {
            this.v = obj;
            this.w |= Integer.MIN_VALUE;
            return b7.v6(null, 0L, 0L, this);
        }
    }

    public static final <T> boolean A0(T[] tArr, ik.l<? super T, Boolean> lVar) {
        T t;
        jk.p.i(tArr, "<this>");
        jk.p.i(lVar, "predicate");
        int length = tArr.length;
        int i2 = 0;
        while (true) {
            if (i2 >= length) {
                t = null;
                break;
            }
            t = tArr[i2];
            if (lVar.invoke(t).booleanValue()) {
                break;
            }
            i2++;
        }
        return t != null;
    }

    public static final String[] A1(List<ComponentName> list, Context context) {
        jk.p.i(context, "context");
        if (list != null) {
            ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
            Iterator<T> it = list.iterator();
            while (it.hasNext()) {
                String S0 = ExtensionsContextKt.S0(context, ((ComponentName) it.next()).getPackageName(), null, 2, null);
                if (S0 == null) {
                    S0 = "";
                }
                arrayList.add(S0);
            }
            String[] strArr = (String[]) arrayList.toArray(new String[0]);
            if (strArr != null) {
                return strArr;
            }
        }
        return new String[0];
    }

    public static final String A2(float f2, boolean z) {
        return z2(f2, z);
    }

    public static final ti.r<Integer> A3(BluetoothDevice bluetoothDevice, Context context, long j2) {
        jk.p.i(bluetoothDevice, "<this>");
        jk.p.i(context, "context");
        sj.d V = sj.d.V();
        jk.p.h(V, "create(...)");
        final jk.j0 j0Var = new jk.j0();
        bluetoothDevice.connectGatt(context, true, new h(V, j0Var));
        ti.r<Integer> n = V.L(j2, TimeUnit.MILLISECONDS).n(new yi.a() {
            @Override
            public final void run() {
                b7.C3(jk.j0.this);
            }
        });
        jk.p.h(n, "doFinally(...)");
        return n;
    }

    public static final boolean A4(UsageEvents.Event event) {
        jk.p.i(event, "<this>");
        return b1(Integer.valueOf(event.getEventType()), 1);
    }

    public static final <TExtra, T> ik.l<T, vj.e0> A6(final ik.p<? super TExtra, ? super T, vj.e0> pVar, final TExtra textra) {
        if (pVar == null) {
            return null;
        }
        return new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                vj.e0 C6;
                C6 = b7.C6(ik.p.this, textra, obj);
                return C6;
            }
        };
    }

    public static final <T> boolean B0(T[] tArr, T[] tArr2) {
        jk.p.i(tArr2, "other");
        if (tArr == null) {
            return false;
        }
        for (T t : tArr2) {
            if (!kotlin.collections.n.L(tArr, t)) {
                return false;
            }
        }
        return true;
    }

    private static final Object[] B1(String str, Context context, Class<?> cls) {
        return J3(str, context, cls).toArray(new Object[0]);
    }

    private static final String B2(int i2) {
        if (1000000 <= i2 && i2 < 1000000000) {
            return (i2 / 1000000) + " s";
        }
        if (1000 > i2 || i2 >= 1000000) {
            return i2 + " μs";
        }
        return (i2 / 1000) + " ms";
    }

    public static ti.r B3(BluetoothDevice bluetoothDevice, Context context, long j2, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            j2 = 1000;
        }
        return A3(bluetoothDevice, context, j2);
    }

    public static final boolean B4(UsageEvents.Event event) {
        jk.p.i(event, "<this>");
        return b1(Integer.valueOf(event.getEventType()), 2, 23);
    }

    public static final Intent B5(Intent intent, Context context, Uri uri, boolean z) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        jk.p.i(uri, "uri");
        intent.setAction("android.intent.action.VIEW");
        intent.setData(uri);
        if (z) {
            ComponentName w1 = ExtensionsContextKt.w1(context);
            if (w1 == null) {
                return y6(intent, context, j6(2131886626, context, new Object[0]), false, null, Boolean.TRUE, 12, null);
            }
            intent.setComponent(w1);
        }
        return intent;
    }

    public static final <TExtra, TExtra1, T> ik.l<T, vj.e0> B6(final ik.q<? super TExtra, ? super TExtra1, ? super T, vj.e0> qVar, final TExtra textra, final TExtra1 textra1) {
        if (qVar == null) {
            return null;
        }
        return new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                vj.e0 D6;
                D6 = b7.D6(ik.q.this, textra, textra1, obj);
                return D6;
            }
        };
    }

    public static final boolean C0(ParcelUuid[] parcelUuidArr, ParcelUuid[] parcelUuidArr2) {
        jk.p.i(parcelUuidArr, "<this>");
        jk.p.i(parcelUuidArr2, "uuids");
        int i2 = 0;
        for (ParcelUuid parcelUuid : parcelUuidArr) {
            if (b1(parcelUuid, Arrays.copyOf(parcelUuidArr2, parcelUuidArr2.length))) {
                i2++;
            }
        }
        return i2 > 0;
    }

    public static final <T> List<T> C1(Iterator<? extends T> it) {
        rk.h f2;
        if (it == null || (f2 = rk.k.f(it)) == null) {
            return null;
        }
        return rk.k.G(f2);
    }

    public static final long C2(long j2) {
        return j2 * 60000;
    }

    public static final void C3(jk.j0 j0Var) {
        BluetoothGatt bluetoothGatt = (BluetoothGatt) j0Var.i;
        if (bluetoothGatt != null) {
            T0(bluetoothGatt);
        }
    }

    public static final boolean C4(int i2, int i3, int i4) {
        return i2 >= i3 && i2 <= i4;
    }

    public static final Intent C5(Intent intent, Context context, String str, boolean z) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "url");
        Uri parse = Uri.parse(str);
        jk.p.h(parse, "parse(...)");
        return B5(intent, context, parse, z);
    }

    public static final vj.e0 C6(ik.p pVar, Object obj, Object obj2) {
        pVar.n(obj, obj2);
        return vj.e0.a;
    }

    public static final void D0(Bundle bundle, Context context, fn fnVar, String str) {
        jk.p.i(bundle, "<this>");
        jk.p.i(context, "context");
        jk.p.i(fnVar, "task");
        G0(bundle, context, fnVar, str, false, 8, null);
    }

    public static final boolean D1(pk.f fVar) {
        jk.p.i(fVar, "<this>");
        return fVar.H().intValue() <= fVar.G().intValue();
    }

    public static final String D2(List<? extends net.dinglisch.android.taskerm.f5> list, final Context context) {
        int i2;
        Integer[] numArr;
        Object K;
        String K2;
        String j6;
        jk.p.i(list, "<this>");
        jk.p.i(context, "context");
        HashSet hashSet = new HashSet();
        HashSet hashSet2 = new HashSet();
        ArrayList arrayList = new ArrayList();
        for (Object obj : list) {
            if (obj instanceof io) {
                arrayList.add(obj);
            }
        }
        Integer[] numArr2 = {80};
        Integer[] numArr3 = {100};
        HashMap g2 = kotlin.collections.m0.g(new Pair(461, 2131889301), new Pair(2078, 2131891328), new Pair(463, 2131891328), new Pair(2080, 2131886828));
        HashMap g3 = kotlin.collections.m0.g(new Pair(160, 2131891127), new Pair(170, 2131891127), new Pair(3, 2131886828), new Pair(4, 2131886828), new Pair(2, 2131886828));
        Iterator it = arrayList.iterator();
        while (true) {
            i2 = 0;
            if (!it.hasNext()) {
                break;
            }
            List<sn> x0 = ((io) it.next()).x0();
            jk.p.h(x0, "getContexts(...)");
            for (Object obj2 : x0) {
                net.dinglisch.android.taskerm.w4 w4Var = obj2 instanceof net.dinglisch.android.taskerm.w4 ? (net.dinglisch.android.taskerm.w4) obj2 : null;
                if (w4Var != null) {
                    E2(w4Var, hashSet);
                }
                if (obj2 instanceof net.dinglisch.android.taskerm.f1) {
                    K2 = j6(2131891328, context, new Object[0]);
                } else if (obj2 instanceof net.dinglisch.android.taskerm.v1) {
                    K2 = j6(2131890812, context, new Object[0]);
                } else if (obj2 instanceof net.dinglisch.android.taskerm.n7) {
                    K2 = j6(2131891329, context, new Object[0]);
                } else if (obj2 instanceof wo) {
                    K2 = j6(2131890813, context, new Object[0]);
                } else if (obj2 instanceof net.dinglisch.android.taskerm.j2) {
                    net.dinglisch.android.taskerm.j2 j2Var = (net.dinglisch.android.taskerm.j2) obj2;
                    if (G2(j2Var, numArr3)) {
                        Integer num = (Integer) g2.get(Integer.valueOf(j2Var.j()));
                        if (num == null || (j6 = j6(num.intValue(), context, new Object[0])) == null) {
                            K2 = j2Var.K();
                        }
                        K2 = j6;
                    }
                    K2 = null;
                } else {
                    if (obj2 instanceof bn) {
                        bn bnVar = (bn) obj2;
                        if (I2(bnVar, numArr2)) {
                            Integer num2 = (Integer) g3.get(Integer.valueOf(bnVar.j()));
                            if (num2 == null || (j6 = j6(num2.intValue(), context, new Object[0])) == null) {
                                K2 = bnVar.K();
                            }
                            K2 = j6;
                        }
                    }
                    K2 = null;
                }
                if (K2 != null) {
                    hashSet2.add(K2);
                }
            }
        }
        HashSet hashSet3 = new HashSet();
        ArrayList arrayList2 = new ArrayList();
        for (Object obj3 : list) {
            if (obj3 instanceof fn) {
                arrayList2.add(obj3);
            }
        }
        Integer[] numArr4 = {548, 30, 35, 137, 901, 300, 138, 133, 612, 143, 142, 194, 195};
        Integer[] numArr5 = {102, 120, 110, 105};
        HashMap g4 = kotlin.collections.m0.g(new Pair(16, 2131888439), new Pair(348, 2131886960), new Pair(131, 2131888355), new Pair(664, 2131888353), new Pair(129, 2131888355), new Pair(665, 2131888353), new Pair(500, 2131887088), new Pair(525, 2131887088), new Pair(520, 2131887088), new Pair(510, 2131887088), new Pair(523, 2131887088), new Pair(540, 2131887088), new Pair(538, 2131887088), new Pair(530, 2131887088), new Pair(536, 2131887088), new Pair(779, 2131887380), new Pair(235, 2131886949), new Pair(360, 2131888314), new Pair(390, 2131888314), new Pair(377, 2131888314), new Pair(550, 2131888314), new Pair(941, 2131888314), new Pair(340, 2131886828), new Pair(366, 2131886376), new Pair(294, 2131890042), new Pair(425, 2131890044), new Pair(559, 2131890271), new Pair(334, 2131890271), new Pair(342, 2131886961), new Pair(411, 2131886961), new Pair(806, 2131891005), new Pair(248, 2131891004));
        List<ik.p> d2 = kotlin.collections.t.d(new ik.p() {
            @Override
            public final Object n(Object obj4, Object obj5) {
                String M2;
                M2 = b7.M2(context, ((Integer) obj4).intValue(), (String) obj5);
                return M2;
            }
        });
        Iterator it2 = arrayList2.iterator();
        while (it2.hasNext()) {
            List<net.dinglisch.android.taskerm.c> D0 = ((fn) it2.next()).D0();
            jk.p.h(D0, "getActions(...)");
            for (net.dinglisch.android.taskerm.c cVar : D0) {
                jk.p.f(cVar);
                if (K2(cVar, numArr5, numArr4)) {
                    int j2 = cVar.j();
                    Integer num3 = (Integer) g4.get(Integer.valueOf(j2));
                    if (num3 == null || (K = j6(num3.intValue(), context, new Object[i2])) == null) {
                        K = cVar.K();
                    }
                    for (ik.p pVar : d2) {
                        Integer valueOf = Integer.valueOf(j2);
                        jk.p.h(K, "element");
                        K = pVar.n(valueOf, K);
                        numArr4 = numArr4;
                    }
                    numArr = numArr4;
                    hashSet3.add(K);
                    E2(cVar, hashSet);
                } else {
                    numArr = numArr4;
                }
                numArr4 = numArr;
                i2 = 0;
            }
        }
        StringBuilder sb = new StringBuilder();
        if (!hashSet2.isEmpty()) {
            sb.append("Monitors:\n\n");
            Iterator it3 = kotlin.collections.t.E0(kotlin.collections.t.O0(hashSet2)).iterator();
            while (it3.hasNext()) {
                sb.append("\t- " + ((String) it3.next()) + "\n");
            }
        }
        if (!hashSet3.isEmpty()) {
            if (sb.length() > 0) {
                sb.append("\n");
            }
            sb.append("Actions:\n\n");
            Iterator it4 = kotlin.collections.t.E0(kotlin.collections.t.O0(hashSet3)).iterator();
            while (it4.hasNext()) {
                sb.append("\t- " + ((String) it4.next()) + "\n");
            }
        }
        if (!hashSet.isEmpty()) {
            if (sb.length() > 0) {
                sb.append("\n");
            }
            sb.append("Plugin Apps Needed (Get them on Google Play):\n\n");
            ArrayList arrayList3 = new ArrayList();
            Iterator it5 = hashSet.iterator();
            while (it5.hasNext()) {
                String S0 = ExtensionsContextKt.S0(context, (String) it5.next(), null, 2, null);
                if (S0 != null) {
                    arrayList3.add(S0);
                }
            }
            Iterator it6 = kotlin.collections.t.E0(arrayList3).iterator();
            while (it6.hasNext()) {
                sb.append("\t- " + ((String) it6.next()) + "\n");
            }
        }
        String sb2 = sb.toString();
        jk.p.h(sb2, "toString(...)");
        return sb2;
    }

    public static final Integer D3(BluetoothDevice bluetoothDevice, Context context, long j2, boolean z) {
        jk.p.i(bluetoothDevice, "<this>");
        jk.p.i(context, "context");
        if (!z) {
            return null;
        }
        try {
            return A3(bluetoothDevice, context, j2).f();
        } catch (Exception unused) {
            return null;
        }
    }

    public static final boolean D4(final BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        Boolean bool = (Boolean) n6(null, new ik.a() {
            @Override
            public final Object e() {
                Boolean X;
                X = b7.X(bluetoothDevice);
                return X;
            }
        }, 1, null);
        if (bool != null) {
            return bool.booleanValue();
        }
        return false;
    }

    public static Intent D5(Intent intent, Context context, Uri uri, boolean z, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            z = false;
        }
        return B5(intent, context, uri, z);
    }

    public static final vj.e0 D6(ik.q qVar, Object obj, Object obj2, Object obj3) {
        qVar.g(obj, obj2, obj3);
        return vj.e0.a;
    }

    public static final void E0(Bundle bundle, Context context, fn fnVar, final String str, boolean z) {
        ik.l lVar;
        jk.p.i(bundle, "<this>");
        jk.p.i(context, "context");
        jk.p.i(fnVar, "task");
        if (str == null || !sk.q.U(str, ",", false, 2, null)) {
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    boolean J0;
                    J0 = b7.J0(str, (String) obj);
                    return Boolean.valueOf(J0);
                }
            };
        } else {
            final String[] t2 = t2(str);
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    boolean I0;
                    I0 = b7.I0(t2, (String) obj);
                    return Boolean.valueOf(I0);
                }
            };
        }
        for (Pair pair : kotlin.collections.m0.t(l1(bundle))) {
            Object second = pair.getSecond();
            if (second instanceof String) {
                String str2 = (String) pair.getFirst();
                if (!z || !sg.a4.i.n(str2)) {
                    if (!((Boolean) lVar.invoke(str2)).booleanValue()) {
                        xq.a aVar = xq.a;
                        String a0 = aVar.a0(str2);
                        StructureType V = aVar.V(bundle, str2);
                        if (V != null) {
                            fnVar.Q(a0, V.getValueForBundle());
                        }
                        fnVar.U(str2, (String) second);
                    }
                }
            }
        }
    }

    public static final String E1(byte[] bArr) {
        jk.p.i(bArr, "<this>");
        byte[] encode = Base64.encode(bArr, 2);
        jk.p.h(encode, "encode(...)");
        return new String(encode, sk.d.b);
    }

    private static final Boolean E2(net.dinglisch.android.taskerm.w4 w4Var, HashSet<String> hashSet) {
        String n0;
        if (w4Var == null || (n0 = w4Var.n0()) == null) {
            return null;
        }
        return Boolean.valueOf(hashSet.add(n0));
    }

    public static Integer E3(BluetoothDevice bluetoothDevice, Context context, long j2, boolean z, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            j2 = 1000;
        }
        if ((i2 & 4) != 0) {
            z = E4(bluetoothDevice);
        }
        return D3(bluetoothDevice, context, j2, z);
    }

    public static final boolean E4(BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        return ((Boolean) mi.k(bluetoothDevice, "isConnected", "btisconnected", false, 4, null).a()).booleanValue();
    }

    public static final void E5(List<String> list, String str) {
        jk.p.i(list, "<this>");
        jk.p.i(str, "match");
        final String lowerCase = str.toLowerCase(Locale.ROOT);
        jk.p.h(lowerCase, "toLowerCase(...)");
        kotlin.collections.t.z(list, new Comparator() {
            @Override
            public final int compare(Object obj, Object obj2) {
                int F5;
                F5 = b7.F5(lowerCase, (String) obj, (String) obj2);
                return F5;
            }
        });
    }

    public static final void F0(Bundle bundle, HashMap<String, String> hashMap, boolean z, final String str, boolean z2) {
        ik.l lVar;
        jk.p.i(bundle, "<this>");
        jk.p.i(hashMap, "hashMap");
        if (str == null || !sk.q.U(str, ",", false, 2, null)) {
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    boolean L0;
                    L0 = b7.L0(str, (String) obj);
                    return Boolean.valueOf(L0);
                }
            };
        } else {
            final String[] t2 = t2(str);
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    boolean K0;
                    K0 = b7.K0(t2, (String) obj);
                    return Boolean.valueOf(K0);
                }
            };
        }
        for (Pair pair : kotlin.collections.m0.t(l1(bundle))) {
            Object second = pair.getSecond();
            if (second instanceof String) {
                String str2 = (String) pair.getFirst();
                if (!z2 || !sg.a4.i.n(str2)) {
                    if (z || !l7.x0((String) hashMap.get(str2))) {
                        if (!((Boolean) lVar.invoke(str2)).booleanValue()) {
                            hashMap.put(str2, second);
                        }
                    }
                }
            }
        }
    }

    public static final Integer F1(BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        try {
            return (Integer) mi.k(bluetoothDevice, "getBatteryLevel", null, false, 6, null).a();
        } catch (Exception unused) {
            return null;
        }
    }

    private static final boolean F2(int i2, Integer[] numArr, Integer[] numArr2, ik.l<? super Integer, Integer> lVar) {
        return (kotlin.collections.n.L(numArr, Integer.valueOf(lVar.invoke(Integer.valueOf(i2)).intValue())) || kotlin.collections.n.L(numArr2, Integer.valueOf(i2))) ? false : true;
    }

    public static final long F3(int i2) {
        return i2 * 1000;
    }

    public static final boolean F4(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        return sensor.getReportingMode() == 0;
    }

    public static final int F5(String str, String str2, String str3) {
        jk.p.f(str2);
        if (G5(str, str2)) {
            return -1;
        }
        jk.p.f(str3);
        return G5(str, str3) ? 1 : 0;
    }

    public static void G0(Bundle bundle, Context context, fn fnVar, String str, boolean z, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            str = null;
        }
        if ((i2 & 8) != 0) {
            z = true;
        }
        E0(bundle, context, fnVar, str, z);
    }

    public static final File G1(byte[] bArr, Context context, String str, String str2) {
        jk.p.i(bArr, "<this>");
        jk.p.i(context, "context");
        if (str == null && (str = y2(bArr)) == null) {
            str = "cachebitmap";
        }
        File G = ph.G(context, str + ".png", str2);
        if (!G.exists()) {
            e6(bArr, G);
        }
        return G;
    }

    private static final boolean G2(net.dinglisch.android.taskerm.j2 j2Var, Integer[] numArr) {
        return F2(j2Var.j(), numArr, new Integer[0], new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                int H2;
                H2 = b7.H2(((Integer) obj).intValue());
                return Integer.valueOf(H2);
            }
        });
    }

    public static final String G3(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        String name = sensor.getName();
        String Q3 = Q3(sensor);
        jk.p.f(name);
        Locale locale = Locale.ROOT;
        String lowerCase = name.toLowerCase(locale);
        jk.p.h(lowerCase, "toLowerCase(...)");
        String lowerCase2 = Q3.toLowerCase(locale);
        jk.p.h(lowerCase2, "toLowerCase(...)");
        if (sk.q.U(lowerCase, lowerCase2, false, 2, null)) {
            return name;
        }
        return name + " - " + Q3(sensor);
    }

    public static final boolean G4(fo foVar, int i2) {
        Object obj;
        if (foVar == null) {
            return false;
        }
        ArrayList<fn> R2 = foVar.R2(-2);
        jk.p.h(R2, "getTasksInProject(...)");
        Iterator<T> it = R2.iterator();
        while (true) {
            obj = null;
            if (!it.hasNext()) {
                break;
            }
            Object next = it.next();
            List<net.dinglisch.android.taskerm.c> D0 = ((fn) next).D0();
            jk.p.h(D0, "getActions(...)");
            Iterator<T> it2 = D0.iterator();
            while (true) {
                if (!it2.hasNext()) {
                    break;
                }
                Object next2 = it2.next();
                net.dinglisch.android.taskerm.c cVar = (net.dinglisch.android.taskerm.c) next2;
                if (cVar.L() && cVar.j() == i2) {
                    obj = next2;
                    break;
                }
            }
            if (obj != null) {
                obj = next;
                break;
            }
        }
        return ((fn) obj) != null;
    }

    private static final boolean G5(String str, String str2) {
        String lowerCase = str2.toLowerCase(Locale.ROOT);
        jk.p.h(lowerCase, "toLowerCase(...)");
        return jk.p.d(str, lowerCase) || sk.q.O(lowerCase, str, false, 2, null);
    }

    public static void H0(Bundle bundle, HashMap hashMap, boolean z, String str, boolean z2, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            str = null;
        }
        if ((i2 & 8) != 0) {
            z2 = true;
        }
        F0(bundle, hashMap, z, str, z2);
    }

    public static File H1(byte[] bArr, Context context, String str, String str2, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            str = null;
        }
        if ((i2 & 4) != 0) {
            str2 = null;
        }
        return G1(bArr, context, str, str2);
    }

    public static final int H2(int i2) {
        return net.dinglisch.android.taskerm.i2.q(i2);
    }

    public static final <T> ti.r<T> H3(aa.i<T> iVar) {
        jk.p.i(iVar, "<this>");
        if (iVar.o()) {
            ti.r<T> w = ti.r.w(iVar.k());
            jk.p.h(w, "just(...)");
            return w;
        }
        final sj.d V = sj.d.V();
        jk.p.h(V, "create(...)");
        iVar.b(new aa.d() {
            public final void a(aa.i iVar2) {
                b7.d0(sj.d.this, iVar2);
            }
        });
        return V;
    }

    public static final boolean H4(BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        try {
            return ((Boolean) mi.k(bluetoothDevice, "isEncrypted", "btdeviceenctrypted", false, 4, null).a()).booleanValue();
        } catch (Exception unused) {
            return false;
        }
    }

    public static final <T extends Service> ComponentName H5(Class<T> cls, Context context, Bundle bundle) {
        jk.p.i(cls, "<this>");
        jk.p.i(context, "context");
        Intent intent = new Intent(context, (Class<?>) cls);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        return context.startService(intent);
    }

    public static final boolean I0(String[] strArr, String str) {
        jk.p.i(str, "it");
        return (strArr == null || kotlin.collections.n.L(strArr, str)) ? false : true;
    }

    public static final NetworkCapabilities I1(Network network, Context context) {
        jk.p.i(network, "<this>");
        jk.p.i(context, "context");
        ConnectivityManager l1 = ExtensionsContextKt.l1(context);
        if (l1 != null) {
            return l1.getNetworkCapabilities(network);
        }
        return null;
    }

    private static final boolean I2(bn bnVar, Integer[] numArr) {
        return F2(bnVar.j(), numArr, new Integer[0], new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                int J2;
                J2 = b7.J2(((Integer) obj).intValue());
                return Integer.valueOf(J2);
            }
        });
    }

    public static final ti.r<ue> I3(aa.i<Void> iVar) {
        jk.p.i(iVar, "<this>");
        if (iVar.o()) {
            ti.r<ue> w = ti.r.w(new ue());
            jk.p.h(w, "just(...)");
            return w;
        }
        final sj.d V = sj.d.V();
        jk.p.h(V, "create(...)");
        iVar.b(new aa.d() {
            public final void a(aa.i iVar2) {
                b7.c0(sj.d.this, iVar2);
            }
        });
        return V;
    }

    public static final boolean I4(int i2) {
        return i2 % 2 != 1;
    }

    public static final <T extends Activity> void I5(Class<T> cls, Context context, Bundle bundle) {
        jk.p.i(cls, "<this>");
        jk.p.i(context, "context");
        ExtensionsContextKt.t4(context, new xe(context, cls, bundle));
    }

    public static final boolean J0(String str, String str2) {
        jk.p.i(str2, "it");
        return l7.x0(str) && !Expr.l(str, str2);
    }

    public static final String[] J1(Network network, Context context) {
        jk.p.i(network, "<this>");
        jk.p.i(context, "context");
        return t3(network, context, n1(), new ik.p() {
            @Override
            public final Object n(Object obj, Object obj2) {
                boolean K1;
                K1 = b7.K1((NetworkCapabilities) obj, ((Integer) obj2).intValue());
                return Boolean.valueOf(K1);
            }
        });
    }

    public static final int J2(int i2) {
        return an.j(i2);
    }

    private static final List<Object> J3(String str, Context context, Class<?> cls) {
        List J0 = sk.q.J0(str, new String[]{","}, false, 0, 6, null);
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(J0, 10));
        Iterator it = J0.iterator();
        while (it.hasNext()) {
            arrayList.add(p4(cls, context, (String) it.next(), null, 4, null));
        }
        return arrayList;
    }

    public static final boolean J4(File file) {
        jk.p.i(file, "<this>");
        Iterator<File> it = b3(file).iterator();
        while (it.hasNext()) {
            if (it.next().isHidden()) {
                return true;
            }
        }
        return false;
    }

    public static void J5(Class cls, Context context, Bundle bundle, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            bundle = null;
        }
        I5(cls, context, bundle);
    }

    public static final boolean K0(String[] strArr, String str) {
        jk.p.i(str, "it");
        return (strArr == null || kotlin.collections.n.L(strArr, str)) ? false : true;
    }

    public static final boolean K1(NetworkCapabilities networkCapabilities, int i2) {
        jk.p.i(networkCapabilities, "$this$getPropStrings");
        return networkCapabilities.hasCapability(i2);
    }

    private static final boolean K2(net.dinglisch.android.taskerm.c cVar, Integer[] numArr, Integer[] numArr2) {
        return F2(cVar.j(), numArr, numArr2, new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                int L2;
                L2 = b7.L2(((Integer) obj).intValue());
                return Integer.valueOf(L2);
            }
        });
    }

    public static final String[] K3(List<ComponentName> list) {
        if (list != null) {
            ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
            Iterator<T> it = list.iterator();
            while (it.hasNext()) {
                arrayList.add(((ComponentName) it.next()).flattenToString());
            }
            String[] strArr = (String[]) arrayList.toArray(new String[0]);
            if (strArr != null) {
                return strArr;
            }
        }
        return new String[0];
    }

    public static final boolean K4(final StatusBarNotification statusBarNotification) {
        jk.p.i(statusBarNotification, "<this>");
        Boolean bool = (Boolean) n6(null, new ik.a() {
            @Override
            public final Object e() {
                Boolean Y;
                Y = b7.Y(statusBarNotification);
                return Y;
            }
        }, 1, null);
        if (bool != null) {
            return bool.booleanValue();
        }
        return false;
    }

    public static final void K5(Intent intent, Context context) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        ExtensionsContextKt.t4(context, new xe(intent, false, 0, null, 14, null));
    }

    public static final boolean L0(String str, String str2) {
        jk.p.i(str2, "it");
        return l7.x0(str) && !Expr.l(str, str2);
    }

    public static final List<View> L1(ViewGroup viewGroup) {
        jk.p.i(viewGroup, "<this>");
        pk.f s = pk.j.s(0, viewGroup.getChildCount());
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(s, 10));
        Iterator<Integer> it = s.iterator();
        while (it.hasNext()) {
            arrayList.add(viewGroup.getChildAt(((kotlin.collections.j0) it).d()));
        }
        return arrayList;
    }

    public static final int L2(int i2) {
        Integer M = net.dinglisch.android.taskerm.z0.M(i2);
        jk.p.h(M, "getCatCodeByActionCode(...)");
        return M.intValue();
    }

    public static final String[] L3(float[] fArr) {
        jk.p.i(fArr, "<this>");
        ArrayList arrayList = new ArrayList(fArr.length);
        for (float f2 : fArr) {
            String valueOf = String.valueOf(f2);
            if (sk.q.U(valueOf, "E", false, 2, null)) {
                valueOf = new BigDecimal(f2).toPlainString();
            }
            arrayList.add(valueOf);
        }
        return (String[]) arrayList.toArray(new String[0]);
    }

    public static final boolean L4(Boolean bool) {
        return bool != null && bool.booleanValue();
    }

    public static final ti.r<Intent> L5(Intent intent, Context context, Integer num, Integer num2, Long l2) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        ti.r<pe> run = new GenericActionActivityForResultForIntent(intent, num, num2, l2).run(context);
        final ik.l lVar = new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                ti.v N5;
                N5 = b7.N5((pe) obj);
                return N5;
            }
        };
        ti.r t = run.t(new yi.e() {
            @Override
            public final Object a(Object obj) {
                ti.v O5;
                O5 = b7.O5(ik.l.this, obj);
                return O5;
            }
        });
        jk.p.h(t, "flatMap(...)");
        return t;
    }

    public static final long M0(InputStream inputStream, OutputStream outputStream, long j2, int i2) {
        jk.p.i(inputStream, "<this>");
        jk.p.i(outputStream, "out");
        if (j2 < 0) {
            return 0L;
        }
        byte[] bArr = new byte[i2];
        long j3 = 0;
        while (true) {
            long j4 = j2 - j3;
            if (j4 == 0) {
                return j3;
            }
            if (j4 < i2) {
                bArr = new byte[(int) j4];
            }
            int read = inputStream.read(bArr);
            if (read < 0) {
                return j3;
            }
            outputStream.write(bArr, 0, read);
            j3 += read;
        }
    }

    public static final Bundle M1(Bundle bundle) {
        return (Bundle) (bundle != null ? bundle.clone() : null);
    }

    public static final String M2(Context context, int i2, String str) {
        jk.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
        Integer M = net.dinglisch.android.taskerm.z0.M(i2);
        if (M == null || M.intValue() != 51) {
            return (M == null || M.intValue() != 30 || i2 == 235 || i2 == 338) ? str : j6(2131889327, context, new Object[0]);
        }
        return sk.q.I(str, "GD ", j6(2131886997, context, new Object[0]) + " ", false, 4, null);
    }

    public static final String M3(double d2, Integer num) {
        String P = pp.P(d2, num != null ? num.intValue() : 3);
        jk.p.h(P, "doubleToString(...)");
        return P;
    }

    public static final boolean M4(Boolean bool) {
        return bool == null || jk.p.d(bool, Boolean.FALSE);
    }

    public static ti.r M5(Intent intent, Context context, Integer num, Integer num2, Long l2, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            num = null;
        }
        if ((i2 & 4) != 0) {
            num2 = null;
        }
        if ((i2 & 8) != 0) {
            l2 = null;
        }
        return L5(intent, context, num, num2, l2);
    }

    public static final long N0(InputStream inputStream, File file, String str, dd ddVar) {
        OutputStream fileOutputStream;
        rf.d b2;
        jk.p.i(inputStream, "<this>");
        jk.p.i(file, "file");
        jk.p.i(str, "contentType");
        Context c2 = ng.c("copyToWithProgress");
        if (c2 == null || (b2 = rf.a.b(c2, file, true)) == null || (fileOutputStream = b2.g0(str, false)) == null) {
            fileOutputStream = new FileOutputStream(file);
        }
        return P0(inputStream, fileOutputStream, ddVar, 0, 4, null);
    }

    public static final ComponentName N1(ComponentInfo componentInfo) {
        jk.p.i(componentInfo, "<this>");
        return new ComponentName(componentInfo.packageName, componentInfo.name);
    }

    public static final String N2(BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        String name = bluetoothDevice.getName();
        String Z = Z(name, bluetoothDevice.getAddress());
        if (r.a.t()) {
            return Z;
        }
        String a2 = mf.b.a(bluetoothDevice);
        if (a2 == null) {
            return Z;
        }
        if (jk.p.d(a2, name)) {
            return Z;
        }
        return Z + " (" + a2 + ")";
    }

    public static final String N3(float f2, Integer num) {
        return M3(f2, num);
    }

    public static final boolean N4(Boolean bool) {
        return bool == null || jk.p.d(bool, Boolean.TRUE);
    }

    public static final ti.v N5(pe peVar) {
        jk.p.i(peVar, "it");
        if (peVar.b() && (peVar instanceof we)) {
            Object d2 = ((we) peVar).d();
            jk.p.g(d2, "null cannot be cast to non-null type android.content.Intent");
            return ti.r.w((Intent) d2);
        }
        return ti.r.r(new RuntimeException("Couldn't get result (error: " + peVar.a()));
    }

    public static final long O0(InputStream inputStream, OutputStream outputStream, dd ddVar, int i2) {
        jk.p.i(inputStream, "<this>");
        jk.p.i(outputStream, "out");
        if (ddVar == null) {
            return gk.a.a(inputStream, outputStream, i2);
        }
        byte[] bArr = new byte[i2];
        int read = inputStream.read(bArr);
        int b2 = ddVar.b();
        long currentTimeMillis = System.currentTimeMillis();
        long j2 = 0;
        while (read >= 0) {
            outputStream.write(bArr, 0, read);
            j2 += read;
            if (System.currentTimeMillis() - currentTimeMillis > b2) {
                currentTimeMillis = System.currentTimeMillis();
                ddVar.e(j2);
            }
            read = inputStream.read(bArr);
        }
        return j2;
    }

    public static final ComponentName O1(ResolveInfo resolveInfo) {
        jk.p.i(resolveInfo, "<this>");
        ComponentInfo componentInfo = resolveInfo.activityInfo;
        if (componentInfo == null) {
            componentInfo = resolveInfo.serviceInfo;
        }
        jk.p.g(componentInfo, "null cannot be cast to non-null type android.content.pm.ComponentInfo");
        return N1(componentInfo);
    }

    public static final ArrayList<fn> O2(fo foVar, int i2, boolean z) {
        jk.p.i(foVar, "<this>");
        ArrayList<fn> q = foVar.q(i2, z);
        jk.p.h(q, "getNamedTasksInProject(...)");
        return new ArrayList<>(kotlin.collections.t.A0(q));
    }

    public static final String O3(Object obj, Integer num) {
        jk.p.i(obj, "<this>");
        return obj instanceof Double ? M3(((Number) obj).doubleValue(), num) : obj instanceof Float ? N3(((Number) obj).floatValue(), num) : obj.toString();
    }

    public static final boolean O4(int i2) {
        return i2 % 2 == 1;
    }

    public static final ti.v O5(ik.l lVar, Object obj) {
        jk.p.i(obj, "p0");
        return (ti.v) lVar.invoke(obj);
    }

    public static long P0(InputStream inputStream, OutputStream outputStream, dd ddVar, int i2, int i3, Object obj) {
        if ((i3 & 4) != 0) {
            i2 = 8192;
        }
        return O0(inputStream, outputStream, ddVar, i2);
    }

    public static final ComponentName P1(UsageEvents.Event event) {
        jk.p.i(event, "<this>");
        return new ComponentName(event.getPackageName(), event.getClassName());
    }

    public static final <T> List<T> P2(List<? extends T> list) {
        if (list == 0 || list.isEmpty()) {
            return null;
        }
        return list;
    }

    public static final String P3(JSONObject jSONObject, String str) {
        jk.p.i(jSONObject, "<this>");
        jk.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
        try {
            return jSONObject.getString(str);
        } catch (JSONException unused) {
            return null;
        }
    }

    public static final boolean P4(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        return sensor.getReportingMode() == 1;
    }

    public static final ti.r<Intent> P5(Intent intent, Context context, Integer num, Integer num2, Long l2) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        ti.r<pe> run = new GenericActionActivityForResultForIntentGrantFilePermission(intent, num, num2, l2, false, 16, null).run(context);
        final ik.l lVar = new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                ti.v R5;
                R5 = b7.R5((pe) obj);
                return R5;
            }
        };
        ti.r t = run.t(new yi.e() {
            @Override
            public final Object a(Object obj) {
                ti.v S5;
                S5 = b7.S5(ik.l.this, obj);
                return S5;
            }
        });
        jk.p.h(t, "flatMap(...)");
        return t;
    }

    public static final <T> boolean Q0(Collection<? extends T> collection, Collection<? extends T> collection2) {
        return !p5(collection, collection2);
    }

    public static final net.dinglisch.android.taskerm.r1 Q1(Sensor sensor, String str, float f2, float f3, float f4) {
        Pair pair;
        jk.p.i(sensor, "<this>");
        jk.p.i(str, "variable");
        if (f2 == f3) {
            return new net.dinglisch.android.taskerm.r1(new net.dinglisch.android.taskerm.q1(Expr.Op.Matches, str, a4(f2, 5)));
        }
        boolean z = Math.min(f2, f3) == f2;
        float abs = Math.abs(sensor.getMaximumRange());
        float abs2 = (abs - Math.abs(f2)) + (abs - Math.abs(f3));
        float abs3 = Math.abs(f2 - f3);
        boolean z2 = Math.min(abs2, abs3) == abs3;
        if (z2) {
            pair = z ? new Pair(Float.valueOf(f2 - f4), Float.valueOf(f3 + f4)) : new Pair(Float.valueOf(f2 + f4), Float.valueOf(f3 - f4));
        } else {
            pair = z ? new Pair(Float.valueOf(f2 + f4), Float.valueOf(f3 - f4)) : new Pair(Float.valueOf(f2 - f4), Float.valueOf(f3 + f4));
        }
        float floatValue = ((Number) pair.component1()).floatValue();
        float floatValue2 = ((Number) pair.component2()).floatValue();
        Expr.Op op = z ? Expr.Op.LessThan : Expr.Op.MoreThan;
        Expr.Op op2 = z ? Expr.Op.MoreThan : Expr.Op.LessThan;
        String a4 = a4(floatValue, 5);
        String a42 = a4(floatValue2, 5);
        return z2 ? new net.dinglisch.android.taskerm.r1(kotlin.collections.t.p(new net.dinglisch.android.taskerm.q1(op2, str, a4), new net.dinglisch.android.taskerm.q1(op, str, a42)), kotlin.collections.t.d(r1.a.And)) : new net.dinglisch.android.taskerm.r1(kotlin.collections.t.p(new net.dinglisch.android.taskerm.q1(op, str, a4), new net.dinglisch.android.taskerm.q1(op2, str, a42)), kotlin.collections.t.d(r1.a.Or));
    }

    public static final <K, V> Map<K, V> Q2(Map<K, ? extends V> map) {
        if (map == 0 || map.isEmpty()) {
            return null;
        }
        return map;
    }

    public static final String Q3(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        String stringType = sensor.getStringType();
        jk.p.h(stringType, "getStringType(...)");
        return l7.t0(sk.q.I(l7.N0(l7.N0(l7.N0(l7.N0(stringType, "android."), "com.google."), "com.samsung."), "sensor."), "_", " ", false, 4, null));
    }

    public static final boolean Q4(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        return sensor.getReportingMode() == 2;
    }

    public static ti.r Q5(Intent intent, Context context, Integer num, Integer num2, Long l2, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            num = null;
        }
        if ((i2 & 4) != 0) {
            num2 = null;
        }
        if ((i2 & 8) != 0) {
            l2 = null;
        }
        return P5(intent, context, num, num2, l2);
    }

    public static final <T> boolean R0(Iterator<? extends T> it, Iterator<? extends T> it2) {
        return Q0(C1(it), C1(it2));
    }

    public static final String R1(double d2) {
        return Z3(d2, 7);
    }

    public static final <T> T[] R2(T[] tArr) {
        if (tArr == null || tArr.length == 0) {
            return null;
        }
        return tArr;
    }

    public static final String R3(go goVar, String str) {
        jk.p.i(goVar, "<this>");
        jk.p.i(str, "taskName");
        return IconProvider.i.i(str);
    }

    public static final <T> String R4(Iterable<? extends T> iterable) {
        jk.p.i(iterable, "<this>");
        return U4(iterable, null, null, 3, null);
    }

    public static final ti.v R5(pe peVar) {
        jk.p.i(peVar, "it");
        if (!peVar.b() || !(peVar instanceof we)) {
            return ti.r.r(new RuntimeException("Couldn't get result"));
        }
        Object d2 = ((we) peVar).d();
        jk.p.g(d2, "null cannot be cast to non-null type android.content.Intent");
        return ti.r.w((Intent) d2);
    }

    public static final Sensor S(Context context, Integer num) {
        jk.p.i(context, "context");
        return T(context, num != null ? num.toString() : null);
    }

    public static final boolean S0(BluetoothProfile bluetoothProfile, BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothProfile, "<this>");
        jk.p.i(bluetoothDevice, "bluetoothDevice");
        return ((Boolean) mi.j(bluetoothProfile, "disconnect", "a2dpdisconnect", true).b(bluetoothDevice)).booleanValue();
    }

    public static final String S1(Intent intent, Context context) {
        ComponentName component;
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        Intent a2 = a2(intent, context);
        if (a2 == null || (component = a2.getComponent()) == null) {
            return null;
        }
        return component.getPackageName();
    }

    public static final <R extends net.dinglisch.android.taskerm.hi> ArrayList<R> S2(net.dinglisch.android.taskerm.ii iiVar, String str, ik.l<? super net.dinglisch.android.taskerm.ii, ? extends R> lVar) {
        jk.p.i(str, "baseKey");
        jk.p.i(lVar, "itemGetter");
        ArrayList<R> arrayList = null;
        if (iiVar == null) {
            return null;
        }
        int i2 = 0;
        while (true) {
            net.dinglisch.android.taskerm.ii w = iiVar.w(net.dinglisch.android.taskerm.ii.F(str, i2));
            if (w == null) {
                return arrayList;
            }
            R invoke = lVar.invoke(w);
            if (invoke != null) {
                if (arrayList == null) {
                    arrayList = new ArrayList<>();
                }
                arrayList.add(invoke);
            }
            i2++;
        }
    }

    public static final List<sg.k> S3(io ioVar, fo foVar, ik.l<? super fn, Boolean> lVar) {
        jk.p.i(ioVar, "<this>");
        jk.p.i(foVar, "data");
        jk.p.i(lVar, "filter");
        List<fn> e4 = e4(ioVar, foVar);
        ArrayList arrayList = new ArrayList();
        for (Object obj : e4) {
            if (lVar.invoke(obj).booleanValue()) {
                arrayList.add(obj);
            }
        }
        ArrayList arrayList2 = new ArrayList();
        Iterator it = arrayList.iterator();
        while (it.hasNext()) {
            sg.a4 O = ((fn) it.next()).O();
            if (O != null) {
                arrayList2.add(O);
            }
        }
        return kotlin.collections.t.x(arrayList2);
    }

    public static final <T> String S4(Iterable<? extends T> iterable, CharSequence charSequence) {
        jk.p.i(iterable, "<this>");
        jk.p.i(charSequence, "separator");
        return U4(iterable, charSequence, null, 2, null);
    }

    public static final ti.v S5(ik.l lVar, Object obj) {
        jk.p.i(obj, "p0");
        return (ti.v) lVar.invoke(obj);
    }

    public static final Sensor T(Context context, String str) {
        boolean d2;
        jk.p.i(context, "context");
        Object obj = null;
        if (str == null) {
            return null;
        }
        Integer t = sk.q.t(str);
        List<Sensor> F2 = ExtensionsContextKt.F2(context);
        if (F2 == null) {
            return null;
        }
        Iterator<T> it = F2.iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            Object next = it.next();
            Sensor sensor = (Sensor) next;
            if (t != null) {
                d2 = sensor.getType() == t.intValue();
            } else {
                jk.p.f(sensor);
                d2 = jk.p.d(G3(sensor), str);
            }
            if (d2) {
                obj = next;
                break;
            }
        }
        return (Sensor) obj;
    }

    public static final void T0(BluetoothGatt bluetoothGatt) {
        jk.p.i(bluetoothGatt, "<this>");
        try {
            bluetoothGatt.disconnect();
            bluetoothGatt.close();
        } catch (Throwable th2) {
            net.dinglisch.android.taskerm.o7.l("Extensions", "Error disconnecting/closing BluetoothGatt", th2);
        }
    }

    public static final String T1(Context context) {
        jk.p.i(context, "<this>");
        Intent p = net.dinglisch.android.taskerm.mh.p();
        jk.p.h(p, "getLauncherIntent(...)");
        return S1(p, context);
    }

    public static final <T> T T2(Collection<? extends T> collection, String str, ik.l<? super T, String> lVar) {
        String str2;
        jk.p.i(collection, "<this>");
        jk.p.i(lVar, "transformer");
        List<String> i1 = i1(collection, str, lVar);
        if (i1.size() > 1 || (str2 = (String) kotlin.collections.t.g0(i1)) == null) {
            return null;
        }
        for (T t : collection) {
            if (jk.p.d(str2, lVar.invoke(t))) {
                return t;
            }
        }
        return null;
    }

    public static List T3(io ioVar, fo foVar, ik.l lVar, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj2) {
                    boolean U3;
                    U3 = b7.U3((fn) obj2);
                    return Boolean.valueOf(U3);
                }
            };
        }
        return S3(ioVar, foVar, lVar);
    }

    public static final <T> String T4(Iterable<? extends T> iterable, CharSequence charSequence, ik.l<? super T, ? extends CharSequence> lVar) {
        jk.p.i(iterable, "<this>");
        jk.p.i(charSequence, "separator");
        return kotlin.collections.t.n0(iterable, charSequence, null, null, 0, null, lVar, 30, null);
    }

    public static final <T extends Service> boolean T5(Class<T> cls, Context context) {
        jk.p.i(cls, "<this>");
        jk.p.i(context, "context");
        return context.stopService(new Intent(context, (Class<?>) cls));
    }

    public static final Object U(BaseBundle baseBundle, String str) {
        return baseBundle.get(str);
    }

    public static final <T, K> List<T> U0(Iterable<? extends T> iterable, ik.l<? super T, ? extends K> lVar, ik.p<? super T, ? super T, Boolean> pVar) {
        jk.p.i(iterable, "<this>");
        jk.p.i(lVar, "selector");
        jk.p.i(pVar, "keepCriteria");
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (T t : iterable) {
            K invoke = lVar.invoke(t);
            ah.c cVar = (Object) linkedHashMap.get(invoke);
            if (cVar == null || pVar.n(t, cVar).booleanValue()) {
                linkedHashMap.put(invoke, t);
            }
        }
        return kotlin.collections.t.O0(linkedHashMap.values());
    }

    public static final String U1(float f2, boolean z) {
        return u3(f2, z, 1);
    }

    public static final <K, V> V U2(HashMap<K, V> hashMap, K k2, ik.a<? extends V> aVar) {
        jk.p.i(hashMap, "<this>");
        jk.p.i(aVar, "getNewValue");
        V v = hashMap.get(k2);
        if (v != null) {
            return v;
        }
        V e2 = aVar.e();
        hashMap.put(k2, e2);
        return e2;
    }

    public static final boolean U3(fn fnVar) {
        jk.p.i(fnVar, "it");
        return true;
    }

    public static String U4(Iterable iterable, CharSequence charSequence, ik.l lVar, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            charSequence = ", ";
        }
        if ((i2 & 2) != 0) {
            lVar = null;
        }
        return T4(iterable, charSequence, lVar);
    }

    public static final void U5(final fo foVar, Integer num, Integer[] numArr, Integer num2, String str, String str2) {
        sg.a4 O;
        net.dinglisch.android.taskerm.pi piVar;
        sg.a4 O2;
        fn T;
        jk.p.i(foVar, "<this>");
        jk.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
        if (num2 != null && (T = foVar.T(num2.intValue())) != null) {
            X5(foVar, T, str, str2, false, 8, null);
        }
        if (num != null) {
            final int intValue = num.intValue();
            if (num.intValue() != -1 && (piVar = (net.dinglisch.android.taskerm.pi) n6(null, new ik.a() {
                @Override
                public final Object e() {
                    net.dinglisch.android.taskerm.pi Y5;
                    Y5 = b7.Y5(fo.this, intValue);
                    return Y5;
                }
            }, 1, null)) != null && (O2 = piVar.O()) != null) {
                sg.a4.W(O2, str, str2, false, 4, null);
            }
        }
        if (numArr != null) {
            ArrayList arrayList = new ArrayList();
            for (Integer num3 : numArr) {
                if (num3 == null || num3.intValue() != -1) {
                    arrayList.add(num3);
                }
            }
            List b0 = kotlin.collections.t.b0(arrayList);
            if (b0 != null) {
                Iterator it = b0.iterator();
                while (it.hasNext()) {
                    io c2 = foVar.c(((Number) it.next()).intValue());
                    if (c2 != null && (O = c2.O()) != null) {
                        sg.a4.W(O, str, str2, false, 4, null);
                    }
                }
            }
        }
    }

    public static final Object V(Object obj) {
        return obj instanceof Bundle ? x1((BaseBundle) obj) : obj;
    }

    public static final <T, K> List<T> V0(Iterable<? extends T> iterable, ik.l<? super T, ? extends K> lVar) {
        jk.p.i(iterable, "<this>");
        jk.p.i(lVar, "selector");
        List Q = kotlin.collections.t.Q(kotlin.collections.t.O0(iterable));
        HashSet hashSet = new HashSet();
        ArrayList arrayList = new ArrayList();
        for (T t : Q) {
            if (hashSet.add(lVar.invoke(t))) {
                arrayList.add(t);
            }
        }
        return kotlin.collections.t.Q(arrayList);
    }

    public static final String V1(BluetoothClass bluetoothClass, Context context) {
        jk.p.i(context, "context");
        if (bluetoothClass == null) {
            return null;
        }
        switch (bluetoothClass.getDeviceClass()) {
            case 256:
            case 512:
            case 1024:
            case 1792:
            case 2048:
            case 2304:
                break;
            case 260:
                break;
            case 264:
                break;
            case 268:
                break;
            case 272:
                break;
            case 276:
                break;
            case 280:
                break;
            case 516:
                break;
            case 520:
                break;
            case 524:
                break;
            case 528:
                break;
            case 532:
                break;
            case 1028:
                break;
            case 1032:
                break;
            case 1040:
                break;
            case 1044:
                break;
            case 1048:
                break;
            case 1052:
                break;
            case 1056:
                break;
            case 1060:
                break;
            case 1064:
                break;
            case 1068:
                break;
            case 1072:
                break;
            case 1076:
                break;
            case 1080:
                break;
            case 1084:
                break;
            case 1088:
                break;
            case 1096:
                break;
            case 1796:
                break;
            case 1800:
                break;
            case 1804:
                break;
            case 1808:
                break;
            case 1812:
                break;
            case 2052:
                break;
            case 2056:
                break;
            case 2060:
                break;
            case 2064:
                break;
            case 2068:
                break;
            case 2308:
                break;
            case 2312:
                break;
            case 2316:
                break;
            case 2320:
                break;
            case 2324:
                break;
            case 2328:
                break;
            case 2332:
                break;
        }
        return null;
    }

    public static final <T> T V2(List<? extends T> list, int i2) {
        T t;
        if (list != null && (t = (T) kotlin.collections.t.h0(list, i2)) != null) {
            return t;
        }
        if (list != null) {
            return (T) kotlin.collections.t.q0(list);
        }
        return null;
    }

    public static final List<io> V3(final fo foVar, final Integer num) {
        if (foVar == null || num == null) {
            return kotlin.collections.t.m();
        }
        List<io> list = (List) n6(null, new ik.a() {
            @Override
            public final Object e() {
                List X3;
                X3 = b7.X3(fo.this, num);
                return X3;
            }
        }, 1, null);
        return list == null ? kotlin.collections.t.m() : list;
    }

    public static final double V4(double d2, double d3, double d4, double d5, double d6, boolean z, boolean z2) {
        double d7 = (d6 - d5) * ((d2 - d3) / (d4 - d3));
        double d8 = !z ? d7 + d5 : d6 - d7;
        if (z2) {
            if (d8 < d5) {
                return d5;
            }
            if (d8 > d6) {
                return d6;
            }
        }
        return d8;
    }

    public static final void V5(fo foVar, mj mjVar, String str, String str2) {
        jk.p.i(foVar, "<this>");
        jk.p.i(mjVar, "scene");
        jk.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
        sg.a4 q3 = q3(foVar, mjVar);
        if (q3 != null) {
            sg.a4.W(q3, str, str2, false, 4, null);
        }
    }

    private static final String W(jk.i0 i0Var, int i2) {
        long j2 = i2;
        String valueOf = String.valueOf(i0Var.i % j2);
        i0Var.i /= j2;
        if (jk.p.d(valueOf, "0")) {
            return null;
        }
        if (valueOf.length() != 1) {
            return valueOf;
        }
        return "0" + valueOf;
    }

    public static final <T> Object W0(ik.a<? extends T> aVar, zj.e<? super T> eVar) {
        return uk.i.g(uk.d1.c(), new f(aVar, null), eVar);
    }

    public static final List<net.dinglisch.android.taskerm.j2> W1(fo foVar, int i2) {
        jk.p.i(foVar, "<this>");
        List<io> O1 = foVar.O1();
        jk.p.h(O1, "getEnabledProfileList(...)");
        ArrayList arrayList = new ArrayList();
        Iterator<T> it = O1.iterator();
        while (it.hasNext()) {
            net.dinglisch.android.taskerm.j2 z0 = ((io) it.next()).z0();
            if (z0 == null || z0.j() != i2) {
                z0 = null;
            }
            if (z0 != null) {
                arrayList.add(z0);
            }
        }
        return arrayList;
    }

    public static final List<sn> W2(io ioVar, sn snVar) {
        jk.p.i(ioVar, "<this>");
        jk.p.i(snVar, "context");
        List<sn> x0 = ioVar.x0();
        jk.p.h(x0, "getContexts(...)");
        ArrayList arrayList = new ArrayList();
        for (Object obj : x0) {
            if (!jk.p.d((sn) obj, snVar)) {
                arrayList.add(obj);
            }
        }
        return arrayList;
    }

    public static final List<io> W3(fo foVar, fn fnVar) {
        return V3(foVar, fnVar != null ? Integer.valueOf(fnVar.P0()) : null);
    }

    public static final double W4(Number number, Number number2, Number number3, Number number4, Number number5, boolean z, boolean z2) {
        jk.p.i(number, "<this>");
        jk.p.i(number2, "inputMin");
        jk.p.i(number3, "inputMax");
        jk.p.i(number4, "outputMin");
        jk.p.i(number5, "outputMax");
        return V4(number.doubleValue(), number2.doubleValue(), number3.doubleValue(), number4.doubleValue(), number5.doubleValue(), z, z2);
    }

    public static final void W5(fo foVar, fn fnVar, String str, String str2, boolean z) throws a4.b {
        List<io> i3;
        boolean z2;
        sg.a4 r3;
        sg.a4 O;
        jk.p.i(foVar, "<this>");
        jk.p.i(fnVar, "task");
        jk.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
        sg.a4 O2 = fnVar.O();
        if (O2 == null || !O2.V(str, str2, z)) {
            int Y0 = fnVar.Y0();
            if (Y0 != -1) {
                i3 = kotlin.collections.t.d(foVar.c(Y0));
            } else {
                i3 = i3(foVar, fnVar);
                if (i3 == null || i3.size() != 1) {
                    i3 = kotlin.collections.t.m();
                }
            }
            loop0: while (true) {
                z2 = false;
                for (io ioVar : kotlin.collections.t.b0(i3)) {
                    sg.a4 O3 = ioVar.O();
                    if (O3 != null) {
                        O3.V(str, str2, z);
                    }
                    if (!z2) {
                        net.dinglisch.android.taskerm.pi n3 = n3(foVar, ioVar);
                        if ((n3 == null || (O = n3.O()) == null) ? false : O.V(str, str2, z)) {
                        }
                    }
                    z2 = true;
                }
            }
            if (z2 || (r3 = r3(foVar, fnVar)) == null) {
                return;
            }
            r3.V(str, str2, z);
        }
    }

    public static final Boolean X(BluetoothDevice bluetoothDevice) {
        Set<BluetoothDevice> bondedDevices;
        BluetoothAdapter defaultAdapter = BluetoothAdapter.getDefaultAdapter();
        Object obj = null;
        if (defaultAdapter != null && (bondedDevices = defaultAdapter.getBondedDevices()) != null) {
            Iterator<T> it = bondedDevices.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                Object next = it.next();
                if (jk.p.d((BluetoothDevice) next, bluetoothDevice)) {
                    obj = next;
                    break;
                }
            }
            obj = (BluetoothDevice) obj;
        }
        return Boolean.valueOf(obj != null);
    }

    public static final boolean X0(net.dinglisch.android.taskerm.fo r5, int r6, ik.l<? super net.dinglisch.android.taskerm.j2, java.lang.Boolean> r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.util.b7.X0(net.dinglisch.android.taskerm.fo, int, ik.l):boolean");
    }

    public static final List<File> X1(File file) {
        jk.p.i(file, "<this>");
        return c1(file, true);
    }

    public static final List<bn> X2(io ioVar, sn snVar) {
        jk.p.i(ioVar, "<this>");
        jk.p.i(snVar, "context");
        List<sn> W2 = W2(ioVar, snVar);
        ArrayList arrayList = new ArrayList();
        for (Object obj : W2) {
            if (obj instanceof bn) {
                arrayList.add(obj);
            }
        }
        return arrayList;
    }

    public static final List X3(fo foVar, Integer num) {
        List<Integer> e0 = foVar.e0(num.intValue());
        jk.p.h(e0, "getProfilesReferencingTask(...)");
        ArrayList arrayList = new ArrayList();
        for (Integer num2 : e0) {
            jk.p.f(num2);
            io c2 = foVar.c(num2.intValue());
            if (c2 != null) {
                arrayList.add(c2);
            }
        }
        return arrayList;
    }

    public static void X5(fo foVar, fn fnVar, String str, String str2, boolean z, int i2, Object obj) throws a4.b {
        if ((i2 & 8) != 0) {
            z = false;
        }
        W5(foVar, fnVar, str, str2, z);
    }

    public static final Boolean Y(StatusBarNotification statusBarNotification) {
        Bundle bundle;
        Notification notification = statusBarNotification.getNotification();
        Object obj = (notification == null || (bundle = notification.extras) == null) ? null : bundle.get("android.template");
        if (!(obj instanceof String)) {
            obj = null;
        }
        String str = (String) obj;
        if (str != null) {
            return Boolean.valueOf(sk.q.U(str, "MediaStyle", false, 2, null));
        }
        return null;
    }

    public static final pe Y0(fn fnVar, Context context, String str, boolean z, boolean z2) {
        jk.p.i(fnVar, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "actionNameForLogs");
        pe t0 = fn.t0(context, str, null, null, Integer.valueOf(fnVar.P0()), z, z2);
        jk.p.h(t0, "edit(...)");
        return t0;
    }

    public static final List<File> Y1(File file) {
        jk.p.i(file, "<this>");
        return c1(file, false);
    }

    public static final String Y2(int i2) {
        return e5(i2, 2);
    }

    public static final String Y3(File file) {
        jk.p.i(file, "<this>");
        return file.getAbsolutePath();
    }

    public static final boolean Y4(IntentFilter intentFilter, IntentFilter intentFilter2) {
        jk.p.i(intentFilter, "<this>");
        jk.p.i(intentFilter2, "other");
        return (R0(intentFilter.actionsIterator(), intentFilter2.actionsIterator()) || R0(intentFilter.typesIterator(), intentFilter2.typesIterator()) || R0(intentFilter.schemesIterator(), intentFilter2.schemesIterator()) || R0(intentFilter.categoriesIterator(), intentFilter2.categoriesIterator())) ? false : true;
    }

    public static final net.dinglisch.android.taskerm.pi Y5(fo foVar, int i2) {
        return foVar.w(i2);
    }

    private static final String Z(String str, String str2) {
        if (str == null && str2 == null) {
            return "Unkown";
        }
        if (str == null) {
            jk.p.f(str2);
            return str2;
        }
        if (str2 == null) {
            return str;
        }
        return str + "/" + str2;
    }

    public static pe Z0(fn fnVar, Context context, String str, boolean z, boolean z2, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            z = true;
        }
        if ((i2 & 8) != 0) {
            z2 = false;
        }
        return Y0(fnVar, context, str, z, z2);
    }

    public static final String Z1(sk.n nVar, String str) {
        List<String> a2;
        jk.p.i(nVar, "<this>");
        jk.p.i(str, "inString");
        sk.j d2 = sk.n.d(nVar, str, 0, 2, null);
        if (d2 == null || (a2 = d2.a()) == null) {
            return null;
        }
        return a2.get(1);
    }

    public static final String Z2(int i2) {
        return e5(i2, 4);
    }

    public static final String Z3(double d2, int i2) {
        return sk.q.I(String.valueOf(m5(d2, i2)), ",", ".", false, 4, null);
    }

    public static final boolean Z4(String str, String str2) {
        if (str2 == null || str2.length() == 0 || str == null || str.length() == 0) {
            return jk.p.d(str, str2);
        }
        ArrayList arrayList = new ArrayList();
        g0(arrayList, str2, new String[]{str});
        return !arrayList.isEmpty();
    }

    public static final h0 Z5(int i2, Context context) {
        jk.p.i(context, "context");
        if (i2 <= 0) {
            return null;
        }
        return a6(i2, context);
    }

    public static final File a0(File file) {
        jk.p.i(file, "it");
        return file.getParentFile();
    }

    public static final boolean a1(Object obj, Object... objArr) {
        jk.p.i(objArr, "other");
        for (Object obj2 : objArr) {
            if (!jk.p.d(obj, obj2)) {
                return false;
            }
        }
        return true;
    }

    public static final Intent a2(Intent intent, Context context) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "content");
        ResolveInfo resolveActivity = context.getPackageManager().resolveActivity(intent, 65536);
        if (resolveActivity == null) {
            return intent;
        }
        if (resolveActivity.activityInfo.name.equals("com.android.internal.app.ResolverActivity")) {
            return null;
        }
        Intent intent2 = new Intent(intent);
        intent2.setComponent(O1(resolveActivity));
        return intent2;
    }

    public static final com.joaomgcd.taskerm.inputoutput.a a3(net.dinglisch.android.taskerm.j2 j2Var, Context context) {
        jk.p.i(j2Var, "<this>");
        jk.p.i(context, "context");
        int j2 = j2Var.j();
        com.joaomgcd.taskerm.inputoutput.a aVar = new com.joaomgcd.taskerm.inputoutput.a();
        pk.f s = pk.j.s(0, net.dinglisch.android.taskerm.i2.J(j2));
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(s, 10));
        Iterator<Integer> it = s.iterator();
        while (it.hasNext()) {
            int d2 = ((kotlin.collections.j0) it).d();
            String m2 = net.dinglisch.android.taskerm.i2.m(context.getResources(), j2, d2);
            int i2 = d2 + 1;
            arrayList.add(new cg.e(null, "evtprm" + i2, i2 + ". " + m2, "2131889614: " + m2, false, 0, 0, false, 240, null));
        }
        aVar.addAll(arrayList);
        return aVar;
    }

    public static final String a4(float f2, int i2) {
        return Z3(f2, i2);
    }

    public static final boolean a5(BluetoothDevice bluetoothDevice, String str) {
        jk.p.i(str, "deviceToConnect");
        return bluetoothDevice != null && (b5(bluetoothDevice.getName(), str) || b5(bluetoothDevice.getAddress(), str));
    }

    public static final h0 a6(int i2, Context context) {
        jk.p.i(context, "context");
        return new h0(context, i2, new Object[0]);
    }

    public static final CharSequence b0(Pair pair) {
        jk.p.i(pair, "it");
        return pair.getFirst() + "=" + l7.o0(pair.getSecond().toString());
    }

    public static final boolean b1(Object obj, Object... objArr) {
        jk.p.i(objArr, "other");
        for (Object obj2 : objArr) {
            if (jk.p.d(obj, obj2)) {
                return true;
            }
        }
        return false;
    }

    public static final String b2(JSONObject jSONObject) {
        jk.p.i(jSONObject, "<this>");
        StringBuilder sb = new StringBuilder();
        Iterator<String> keys = jSONObject.keys();
        jk.p.h(keys, "keys(...)");
        while (keys.hasNext()) {
            String next = keys.next();
            String optString = jSONObject.optString(next);
            if (optString != null) {
                if (sb.length() > 0) {
                    sb.append("&");
                }
                sb.append(next);
                sb.append("=");
                sb.append(l7.o0(optString));
            }
        }
        String sb2 = sb.toString();
        jk.p.h(sb2, "toString(...)");
        return sb2;
    }

    public static final rk.h<File> b3(File file) {
        jk.p.i(file, "<this>");
        return rk.k.n(file.getParentFile(), new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                File a0;
                a0 = b7.a0((File) obj);
                return a0;
            }
        });
    }

    public static final String b4(ScanResult scanResult) {
        jk.p.i(scanResult, "<this>");
        StringBuilder sb = new StringBuilder();
        sb.append(scanResult.SSID);
        sb.append("\n");
        sb.append("Mac: ");
        sb.append(scanResult.BSSID);
        sb.append("\n");
        sb.append("Frequency: ");
        sb.append(scanResult.frequency);
        sb.append("\n");
        sb.append("Cap: ");
        sb.append(scanResult.capabilities);
        sb.append("\n");
        sb.append("Signal: " + WifiManager.calculateSignalLevel(scanResult.level, 10));
        String sb2 = sb.toString();
        jk.p.h(sb2, "toString(...)");
        return sb2;
    }

    private static final boolean b5(String str, String str2) {
        if (str == null) {
            return false;
        }
        Locale locale = Locale.ROOT;
        String lowerCase = str.toLowerCase(locale);
        jk.p.h(lowerCase, "toLowerCase(...)");
        if (lowerCase == null) {
            return false;
        }
        String lowerCase2 = str2.toLowerCase(locale);
        jk.p.h(lowerCase2, "toLowerCase(...)");
        return sk.q.U(lowerCase, lowerCase2, false, 2, null);
    }

    public static final <T> T b6(int i2, Class<T> cls) {
        jk.p.i(cls, "clzz");
        if (!cls.isEnum()) {
            throw new ClassCastException(cls.getName() + " is not an enum");
        }
        T[] enumConstants = cls.getEnumConstants();
        if (enumConstants == null || enumConstants.length == 0) {
            throw new IndexOutOfBoundsException(cls.getName() + " enum doesn't have any elements");
        }
        if (i2 < 0) {
            return enumConstants[0];
        }
        if (enumConstants.length > i2) {
            return enumConstants[i2];
        }
        throw new IndexOutOfBoundsException(cls.getName() + " enum doesn't have " + (i2 + 1) + " elements");
    }

    public static final void c0(sj.d dVar, aa.i iVar) {
        jk.p.i(iVar, "it");
        try {
            iVar.l(v8.b.class);
            dVar.b(new ue());
        } catch (Exception e2) {
            dVar.onError(e2);
        }
    }

    public static final List<File> c1(File file, boolean z) {
        jk.p.i(file, "<this>");
        ArrayList arrayList = new ArrayList();
        d1(arrayList, z, file);
        return arrayList;
    }

    public static final String c2(long j2) {
        jk.i0 i0Var = new jk.i0();
        i0Var.i = j2 / 1000;
        String W = W(i0Var, 60);
        String W2 = W(i0Var, 60);
        String W3 = W(i0Var, 12);
        if (W == null) {
            return "0";
        }
        if (W2 != null) {
            W = W2 + ConstantsCommonTaskerServer.ID_SEPARATOR + W;
        }
        if (W3 == null) {
            return W;
        }
        return W3 + ConstantsCommonTaskerServer.ID_SEPARATOR + W;
    }

    public static final String c3(fo foVar, final Context context, String str) {
        jk.p.i(foVar, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, ProfileManager.EXTRA_PROFILE_NAME);
        HashMap<String, List<String>> T1 = foVar.T1(context, new HashSet(), true);
        jk.p.h(T1, "getNeededPermissions(...)");
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (Map.Entry<String, List<String>> entry : T1.entrySet()) {
            if (!jk.p.d(entry.getKey(), "android.permission.SCHEDULE_EXACT_ALARM")) {
                linkedHashMap.put(entry.getKey(), entry.getValue());
            }
        }
        String string = !linkedHashMap.isEmpty() ? context.getString(2131891312, str, kotlin.collections.t.n0(vc.X(linkedHashMap.keySet(), context), "\n", null, null, 0, null, new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                CharSequence d3;
                d3 = b7.d3(context, (String) obj);
                return d3;
            }
        }, 30, null)) : context.getString(2131891314, str);
        jk.p.f(string);
        return string + "\n\n" + D2(r1(foVar, null, 1, null), context);
    }

    public static final String c4(Bundle bundle, String str, String str2) {
        jk.p.i(str, "variableName");
        if (bundle == null) {
            return null;
        }
        String str3 = "";
        String str4 = sk.q.O(str, "%", false, 2, null) ? "" : "%";
        if (l7.x0(str2)) {
            str3 = str2 + "_";
        }
        return bundle.getString(str4 + str3 + str);
    }

    public static final <T> T c5(List<T> list, int i2, int i3) {
        jk.p.i(list, "<this>");
        T remove = list.remove(i2);
        list.add(i3, remove);
        return remove;
    }

    public static final <T> List<T> c6(int i2, Class<T> cls, ik.l<? super T, Integer> lVar) {
        jk.p.i(cls, "clzz");
        jk.p.i(lVar, "flagSelector");
        if (!cls.isEnum()) {
            throw new ClassCastException(cls.getName() + " is not an enum");
        }
        T[] enumConstants = cls.getEnumConstants();
        if (enumConstants == null) {
            return kotlin.collections.t.m();
        }
        ArrayList arrayList = new ArrayList();
        for (T t : enumConstants) {
            if (x4(i2, lVar.invoke(t).intValue())) {
                arrayList.add(t);
            }
        }
        return arrayList;
    }

    public static final void d0(sj.d dVar, aa.i iVar) {
        jk.p.i(iVar, "it");
        try {
            Object l2 = iVar.l(v8.b.class);
            if (l2 != null) {
                dVar.b(l2);
            } else {
                dVar.onError(new RuntimeException("Result was empty"));
            }
        } catch (Exception e2) {
            dVar.onError(e2);
        }
    }

    private static final void d1(ArrayList<File> arrayList, boolean z, File file) {
        Collection<? extends File> arrayList2;
        File[] listFiles = file.listFiles();
        if (listFiles == null) {
            listFiles = new File[0];
        }
        if (z) {
            arrayList2 = kotlin.collections.n.C0(listFiles);
        } else {
            arrayList2 = new ArrayList<>();
            for (File file2 : listFiles) {
                if (file2.isFile()) {
                    arrayList2.add(file2);
                }
            }
        }
        arrayList.addAll(arrayList2);
        ArrayList<File> arrayList3 = new ArrayList();
        for (File file3 : listFiles) {
            if (file3.isDirectory()) {
                arrayList3.add(file3);
            }
        }
        for (File file4 : arrayList3) {
            jk.p.f(file4);
            d1(arrayList, z, file4);
        }
    }

    public static final String d2(int i2) {
        String hexString = Integer.toHexString(i2);
        jk.p.h(hexString, "toHexString(...)");
        String upperCase = hexString.toUpperCase(Locale.ROOT);
        jk.p.h(upperCase, "toUpperCase(...)");
        return upperCase;
    }

    public static final CharSequence d3(Context context, String str) {
        jk.p.i(str, "it");
        return " - " + vc.V(str, context);
    }

    public static String d4(Bundle bundle, String str, String str2, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            str2 = null;
        }
        return c4(bundle, str, str2);
    }

    public static final <T> T d5(T t, String str) {
        jk.p.i(str, "errorMessage");
        if (t != null) {
            return t;
        }
        throw new RuntimeException(str);
    }

    public static final long d6(InputStream inputStream, File file) {
        jk.p.i(inputStream, "<this>");
        jk.p.i(file, "file");
        if (file.exists() && !file.isFile()) {
            throw new IllegalStateException("To write inputstream to file must pass file, was " + file.getAbsolutePath());
        }
        File parentFile = file.getParentFile();
        if (!parentFile.exists() && !parentFile.mkdirs()) {
            return 0L;
        }
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        long b2 = gk.a.b(inputStream, fileOutputStream, 0, 2, null);
        fileOutputStream.close();
        inputStream.close();
        return b2;
    }

    public static final CharSequence e0(byte b2) {
        jk.n0 n0Var = jk.n0.a;
        String format = String.format("%02X", Arrays.copyOf(new Object[]{Byte.valueOf(b2)}, 1));
        jk.p.h(format, "format(...)");
        return format;
    }

    public static final boolean e1(Writer writer) {
        if (writer == null) {
            return true;
        }
        try {
            writer.flush();
            writer.close();
            return true;
        } catch (IOException e2) {
            Log.e("Extensions", "failed to close output stream", e2);
            return false;
        }
    }

    public static final String e2(int i2) {
        int i3 = (i2 >> 24) & 255;
        int i4 = i2 & 16777215;
        if (i3 != 255) {
            String format = String.format("#%02X%06X", Integer.valueOf(i3), Integer.valueOf(i4));
            jk.p.f(format);
            return format;
        }
        String format2 = String.format("#%06X", Integer.valueOf(i4));
        jk.p.f(format2);
        return format2;
    }

    public static final ti.r<x1> e3(BluetoothAdapter bluetoothAdapter, Context context, int i2) {
        jk.p.i(bluetoothAdapter, "<this>");
        jk.p.i(context, "context");
        sj.d V = sj.d.V();
        jk.p.h(V, "create(...)");
        bluetoothAdapter.getProfileProxy(context, new g(V), i2);
        return V;
    }

    public static final List<fn> e4(io ioVar, fo foVar) {
        jk.p.i(ioVar, "<this>");
        jk.p.i(foVar, "data");
        return f3(foVar, ioVar);
    }

    public static final String e5(int i2, int i3) {
        return sk.q.r0(String.valueOf(i2), i3, '0');
    }

    public static final long e6(byte[] bArr, File file) {
        jk.p.i(bArr, "<this>");
        jk.p.i(file, "file");
        return d6(k2(bArr), file);
    }

    public static final <T> Boolean f0(Collection<T> collection, T... tArr) {
        jk.p.i(tArr, "items");
        if (collection != null) {
            return Boolean.valueOf(kotlin.collections.t.C(collection, tArr));
        }
        return null;
    }

    public static final String f1(int i2, int i3) {
        jk.n0 n0Var = jk.n0.a;
        String format = String.format("%0" + i3 + "d", Arrays.copyOf(new Object[]{Integer.valueOf(i2)}, 1));
        jk.p.h(format, "format(...)");
        return format;
    }

    public static final String f2(int i2, Context context, boolean z) {
        jk.p.i(context, "context");
        String e2 = e2(androidx.core.content.a.getColor(context, i2));
        if (e2 != null) {
            return z ? e2 : sk.q.z0(e2, "#");
        }
        return null;
    }

    public static final List<fn> f3(fo foVar, io ioVar) {
        jk.p.i(foVar, "<this>");
        jk.p.i(ioVar, "profile");
        int[] R0 = ioVar.R0();
        jk.p.h(R0, "getTaskIDs(...)");
        ArrayList arrayList = new ArrayList(R0.length);
        for (int i2 : R0) {
            arrayList.add(foVar.T(i2));
        }
        return kotlin.collections.t.b0(arrayList);
    }

    public static final String f4(byte[] bArr) {
        jk.p.i(bArr, "<this>");
        return new String(bArr, sk.d.b);
    }

    public static final void f5(MediaPlayer mediaPlayer, String str, Integer num) {
        jk.p.i(mediaPlayer, "<this>");
        jk.p.i(str, "base64EncodedString");
        String str2 = "data:audio/mp3;base64," + str;
        mediaPlayer.setAudioAttributes(new AudioAttributes.Builder().setLegacyStreamType(num != null ? num.intValue() : 3).build());
        mediaPlayer.setDataSource(str2);
        mediaPlayer.prepare();
        mediaPlayer.start();
    }

    @SuppressLint({"SimpleDateFormat"})
    public static final String f6(long j2, String str) {
        jk.p.i(str, "format");
        String format = new SimpleDateFormat(str).format(new Date(j2));
        jk.p.h(format, "format(...)");
        return format;
    }

    public static final void g0(List<String> list, String str, String[] strArr) {
        jk.p.i(list, "<this>");
        jk.p.i(str, "match");
        jk.p.i(strArr, "names");
        o0(list, str, strArr);
        E5(list, str);
    }

    public static final <TError extends h3> we<?, ?> g1(InputStream inputStream, Class<TError> cls) {
        jk.p.i(inputStream, "<this>");
        jk.p.i(cls, "clzz");
        try {
            try {
                we<?, ?> h1 = h1(inputStream, cls);
                if (!h1.b()) {
                    inputStream.close();
                    return h1;
                }
                Object d2 = h1.d();
                jk.p.g(d2, "null cannot be cast to non-null type com.joaomgcd.taskerm.util.ErrorPayload");
                we<?, ?> f2 = te.f((h3) d2);
                inputStream.close();
                return f2;
            } catch (IOException e2) {
                e2.printStackTrace();
                we<?, j3> c2 = te.c("Error getting error: " + e2);
                if (inputStream != null) {
                    inputStream.close();
                }
                return c2;
            }
        } catch (Throwable th2) {
            if (inputStream != null) {
                inputStream.close();
            }
            throw th2;
        }
    }

    public static final List<sg.k> g2(final go goVar, final Integer num, final Integer num2) {
        jk.p.i(goVar, "<this>");
        sg.a4 a4Var = (sg.a4) n6(null, new ik.a() {
            @Override
            public final Object e() {
                sg.a4 h2;
                h2 = b7.h2(num, goVar);
                return h2;
            }
        }, 1, null);
        if (a4Var == null) {
            a4Var = new sg.a4();
        }
        Iterable iterable = (List) n6(null, new ik.a() {
            @Override
            public final Object e() {
                List i2;
                i2 = b7.i2(num2, goVar);
                return i2;
            }
        }, 1, null);
        if (iterable == null) {
            iterable = new sg.a4();
        }
        sg.a4 a4Var2 = (sg.a4) n6(null, new ik.a() {
            @Override
            public final Object e() {
                sg.a4 j2;
                j2 = b7.j2(num2, goVar);
                return j2;
            }
        }, 1, null);
        if (a4Var2 == null) {
            a4Var2 = new sg.a4();
        }
        return sg.h4.F(kotlin.collections.t.y0(kotlin.collections.t.y0(a4Var, iterable), a4Var2));
    }

    public static final HashMap<Integer, Bundle> g3(fo foVar, Context context, List<? extends io> list, String str) {
        jk.p.i(context, "context");
        jk.p.i(list, "list");
        jk.p.i(str, "tag");
        HashMap<Integer, Bundle> hashMap = new HashMap<>();
        if (foVar == null) {
            return hashMap;
        }
        for (io ioVar : list) {
            Integer valueOf = Integer.valueOf(ioVar.C0());
            Bundle l0 = l0(foVar, context, ioVar, null, str);
            if (l0 != null) {
                hashMap.put(valueOf, l0);
            }
        }
        return hashMap;
    }

    public static final long g4(long j2) {
        return bi.G() - j2;
    }

    public static final <K, V> Map<K, V> g5(Map<K, ? extends V> map, Map<K, ? extends V> map2) {
        if (map == 0 && map2 == 0) {
            return null;
        }
        if (map == 0) {
            return map2;
        }
        if (map2 == 0) {
            return map;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap(map.size() + map2.size());
        linkedHashMap.putAll(map);
        linkedHashMap.putAll(map2);
        return linkedHashMap;
    }

    public static String g6(long j2, String str, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            str = "yyyy-MM-dd HH:mm";
        }
        return f6(j2, str);
    }

    public static final <T> boolean h0(Collection<T> collection, T t) {
        if (collection == null || collection.contains(t)) {
            return false;
        }
        return collection.add(t);
    }

    public static final <T> we<?, ?> h1(InputStream inputStream, Class<T> cls) {
        jk.p.i(inputStream, "<this>");
        jk.p.i(cls, "clazz");
        try {
            String h2 = gk.j.h(new BufferedReader(new InputStreamReader(inputStream, sk.d.b), 8192));
            try {
                return te.f(jk.p.d(cls, String.class) ? h2 : jk.p.d(cls, j3.class) ? new j3(h2) : eg.f.c().h(h2, cls));
            } catch (Exception unused) {
                return te.c(h2);
            }
        } catch (Exception e2) {
            return te.e(e2);
        }
    }

    public static final sg.a4 h2(Integer num, go goVar) {
        net.dinglisch.android.taskerm.pi w;
        if (num == null || (w = goVar.w(num.intValue())) == null) {
            return null;
        }
        return w.O();
    }

    public static final List<sg.a4> h3(go goVar, fn fnVar) {
        jk.p.i(goVar, "<this>");
        List<io> i3 = i3(goVar, fnVar);
        if (i3 == null) {
            return null;
        }
        ArrayList arrayList = new ArrayList();
        Iterator<T> it = i3.iterator();
        while (it.hasNext()) {
            sg.a4 O = ((io) it.next()).O();
            if (O != null) {
                arrayList.add(O);
            }
        }
        return arrayList;
    }

    public static final String h4(byte[] bArr) {
        jk.p.i(bArr, "<this>");
        StringBuilder sb = new StringBuilder();
        for (byte b2 : bArr) {
            jk.n0 n0Var = jk.n0.a;
            String format = String.format("%02X", Arrays.copyOf(new Object[]{Byte.valueOf(b2)}, 1));
            jk.p.h(format, "format(...)");
            sb.append(format);
        }
        String sb2 = sb.toString();
        jk.p.h(sb2, "toString(...)");
        return sb2;
    }

    public static final <T> List<T> h5(T t, Collection<? extends T> collection) {
        jk.p.i(collection, "list");
        ArrayList arrayList = new ArrayList(collection.size() + 1);
        arrayList.add(t);
        arrayList.addAll(collection);
        return arrayList;
    }

    public static final int h6(int i2, int i3, int i4) {
        return i2 == i3 ? i4 : (i3 <= i2 || i4 > i2) ? (i3 >= i2 || i4 < i2) ? i2 : i2 - 1 : i2 + 1;
    }

    public static final Bundle i0(fo foVar, Context context, Integer num, Bundle bundle, String str) {
        Bundle k0;
        jk.p.i(context, "context");
        jk.p.i(str, "tag");
        return (foVar == null || num == null || (k0 = k0(foVar, context, foVar.T(num.intValue()), bundle, str)) == null) ? bundle : k0;
    }

    public static final <T> List<String> i1(Collection<? extends T> collection, String str, ik.l<? super T, String> lVar) {
        jk.p.i(collection, "<this>");
        jk.p.i(lVar, "transformer");
        if (str == null || str.length() == 0) {
            return kotlin.collections.t.m();
        }
        ArrayList arrayList = new ArrayList();
        Collection<? extends T> collection2 = collection;
        ArrayList arrayList2 = new ArrayList(kotlin.collections.t.w(collection2, 10));
        Iterator<T> it = collection2.iterator();
        while (it.hasNext()) {
            arrayList2.add(lVar.invoke(it.next()));
        }
        g0(arrayList, str, (String[]) arrayList2.toArray(new String[0]));
        return kotlin.collections.t.O0(arrayList);
    }

    public static final List i2(Integer num, go goVar) {
        List<sg.a4> h3;
        if (num == null || (h3 = h3(goVar, goVar.T(num.intValue()))) == null) {
            return null;
        }
        return kotlin.collections.t.x(h3);
    }

    public static final List<io> i3(go goVar, fn fnVar) {
        List<Integer> e0;
        jk.p.i(goVar, "<this>");
        ArrayList arrayList = null;
        if (fnVar != null && (e0 = goVar.e0(fnVar.P0())) != null) {
            arrayList = new ArrayList(kotlin.collections.t.w(e0, 10));
            for (Integer num : e0) {
                jk.p.f(num);
                arrayList.add(goVar.c(num.intValue()));
            }
        }
        return arrayList;
    }

    public static final String i4(byte[] bArr) {
        jk.p.i(bArr, "<this>");
        return kotlin.collections.n.j0(bArr, ConstantsCommonTaskerServer.ID_SEPARATOR, null, null, 0, null, new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                CharSequence e0;
                e0 = b7.e0(((Byte) obj).byteValue());
                return e0;
            }
        }, 30, null);
    }

    public static final boolean i5(BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        return ((Boolean) mi.k(bluetoothDevice, "removeBond", "btdeviceremovebond", false, 4, null).a()).booleanValue();
    }

    public static final String i6(int i2, Context context, Locale locale, Object... objArr) {
        jk.p.i(context, "context");
        jk.p.i(locale, "locale");
        jk.p.i(objArr, "paramsForFormat");
        Configuration configuration = new Configuration(context.getResources().getConfiguration());
        configuration.setLocale(locale);
        Context createConfigurationContext = context.createConfigurationContext(configuration);
        jk.p.h(createConfigurationContext, "createConfigurationContext(...)");
        String g2 = net.dinglisch.android.taskerm.oh.g(createConfigurationContext, i2, Arrays.copyOf(objArr, objArr.length));
        jk.p.h(g2, "getString(...)");
        return g2;
    }

    public static final void j0(go goVar, Context context, Collection<String> collection, io ioVar, Integer num) {
        Integer num2;
        jk.p.i(goVar, "<this>");
        jk.p.i(context, "context");
        jk.p.i(collection, "globalUserVars");
        if (ioVar != null) {
            sg.a4 O = ioVar.O();
            if (O != null) {
                O.x(context, collection, 2131891243);
            }
            int E = goVar.E(ioVar.C0());
            num2 = Integer.valueOf(E);
            goVar.Q(context, collection, E, 2131891243);
        } else {
            num2 = null;
        }
        if (num == null || jk.p.d(num, num2)) {
            return;
        }
        goVar.Q(context, collection, num.intValue(), null);
    }

    public static List j1(Collection collection, String str, ik.l lVar, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj2) {
                    String k1;
                    k1 = b7.k1(obj2);
                    return k1;
                }
            };
        }
        return i1(collection, str, lVar);
    }

    public static final sg.a4 j2(Integer num, go goVar) {
        fn T;
        if (num == null || (T = goVar.T(num.intValue())) == null) {
            return null;
        }
        return T.O();
    }

    public static final Integer[] j3(BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothDevice, "<this>");
        ParcelUuid[] uuids = bluetoothDevice.getUuids();
        if (uuids == null) {
            return new Integer[0];
        }
        ArrayList arrayList = new ArrayList();
        s2.a aVar = s2.a;
        if (C0(aVar.l(), uuids)) {
            arrayList.add(5);
        }
        if (C0(aVar.a(), uuids) || C0(aVar.b(), uuids)) {
            arrayList.add(2);
        }
        if (C0(aVar.f(), uuids)) {
            arrayList.add(1);
        }
        if (C0(aVar.g(), uuids)) {
            arrayList.add(19);
        }
        return (Integer[]) arrayList.toArray(new Integer[0]);
    }

    public static final String[] j4(Network network, Context context) {
        jk.p.i(network, "<this>");
        jk.p.i(context, "context");
        return t3(network, context, y1(), new ik.p() {
            @Override
            public final Object n(Object obj, Object obj2) {
                boolean k4;
                k4 = b7.k4((NetworkCapabilities) obj, ((Integer) obj2).intValue());
                return Boolean.valueOf(k4);
            }
        });
    }

    public static final Intent j5(Intent intent) {
        Set<String> keySet;
        if (intent == null) {
            return null;
        }
        Bundle extras = intent.getExtras();
        if (extras == null || (keySet = extras.keySet()) == null) {
            return intent;
        }
        Iterator<T> it = keySet.iterator();
        while (it.hasNext()) {
            intent.removeExtra((String) it.next());
        }
        return intent;
    }

    public static final String j6(int i2, Context context, Object... objArr) {
        jk.p.i(context, "context");
        jk.p.i(objArr, "paramsForFormat");
        String g2 = net.dinglisch.android.taskerm.oh.g(context, i2, Arrays.copyOf(objArr, objArr.length));
        jk.p.h(g2, "getString(...)");
        return g2;
    }

    public static final Bundle k0(fo foVar, Context context, fn fnVar, Bundle bundle, String str) {
        jk.p.i(context, "context");
        jk.p.i(str, "tag");
        if (foVar == null) {
            return bundle;
        }
        if (fnVar == null) {
            return bundle;
        }
        sg.a4 O = fnVar.O();
        sg.a4 r3 = r3(foVar, fnVar);
        if (O == null && r3 == null) {
            return bundle;
        }
        if (bundle == null) {
            bundle = new Bundle();
        }
        if (O != null) {
            O.u(context, bundle);
        }
        if (r3 != null) {
            r3.u(context, bundle);
        }
        return bundle;
    }

    public static final String k1(Object obj) {
        return String.valueOf(obj);
    }

    public static final ByteArrayInputStream k2(byte[] bArr) {
        jk.p.i(bArr, "<this>");
        return new ByteArrayInputStream(bArr);
    }

    public static final net.dinglisch.android.taskerm.pi k3(fo foVar, net.dinglisch.android.taskerm.f5 f5Var) {
        jk.p.i(foVar, "<this>");
        if (f5Var == null) {
            return null;
        }
        if (f5Var instanceof io) {
            return n3(foVar, (io) f5Var);
        }
        if (f5Var instanceof fn) {
            return m3(foVar, (fn) f5Var);
        }
        if (f5Var instanceof mj) {
            return l3(foVar, (mj) f5Var);
        }
        return null;
    }

    public static final boolean k4(NetworkCapabilities networkCapabilities, int i2) {
        jk.p.i(networkCapabilities, "$this$getPropStrings");
        return networkCapabilities.hasTransport(i2);
    }

    public static final void k5(View view) {
        jk.p.i(view, "<this>");
        ViewParent parent = view.getParent();
        jk.p.g(parent, "null cannot be cast to non-null type android.view.ViewManager");
        ((ViewManager) parent).removeView(view);
    }

    public static final void k6(Context context, ik.a<vj.e0> aVar) {
        jk.p.i(context, "context");
        jk.p.i(aVar, "block");
        try {
            aVar.e();
        } catch (Throwable th2) {
            xg.e2.R1(context, th2);
        }
    }

    public static final Bundle l0(fo foVar, Context context, io ioVar, Bundle bundle, String str) {
        jk.p.i(context, "context");
        jk.p.i(str, "tag");
        if (foVar == null) {
            return bundle;
        }
        if (ioVar == null) {
            return bundle;
        }
        sg.a4 O = ioVar.O();
        sg.a4 s3 = s3(foVar, ioVar);
        if ((O != null && !O.isEmpty()) || (s3 != null && !s3.isEmpty())) {
            if (bundle == null) {
                bundle = new Bundle();
            }
            if (O != null) {
                O.u(context, bundle);
            }
            if (s3 != null) {
                s3.u(context, bundle);
            }
        }
        return bundle;
    }

    public static final HashMap<String, Object> l1(BaseBundle baseBundle) {
        HashMap<String, Object> hashMap = new HashMap<>();
        if (baseBundle == null) {
            return hashMap;
        }
        Set<String> keySet = baseBundle.keySet();
        if (keySet != null) {
            for (String str : keySet) {
                if (str != null) {
                    hashMap.put(str, baseBundle.get(str));
                }
            }
        }
        return hashMap;
    }

    public static final Integer l2(Bundle bundle, String str) {
        jk.p.i(str, "key");
        if (bundle != null && bundle.containsKey(str)) {
            return Integer.valueOf(bundle.getInt(str));
        }
        return null;
    }

    public static final net.dinglisch.android.taskerm.pi l3(final fo foVar, mj mjVar) {
        jk.p.i(foVar, "<this>");
        if (mjVar == null) {
            return null;
        }
        final jk.h0 h0Var = new jk.h0();
        int E2 = foVar.E2(mjVar.getName());
        h0Var.i = E2;
        if (E2 == -1) {
            return null;
        }
        return (net.dinglisch.android.taskerm.pi) n6(null, new ik.a() {
            @Override
            public final Object e() {
                net.dinglisch.android.taskerm.pi p3;
                p3 = b7.p3(fo.this, h0Var);
                return p3;
            }
        }, 1, null);
    }

    public static final Boolean l4(Boolean bool) {
        Boolean bool2 = Boolean.TRUE;
        if (jk.p.d(bool, bool2)) {
            return bool2;
        }
        return null;
    }

    public static final void l5(net.dinglisch.android.taskerm.c cVar, Context context, Bundle bundle) {
        jk.p.i(cVar, "<this>");
        jk.p.i(context, "context");
        jk.p.i(bundle, "taskVars");
        int j2 = cVar.j();
        Iterator<Integer> it = pk.j.s(0, cVar.e0()).iterator();
        while (it.hasNext()) {
            int d2 = ((kotlin.collections.j0) it).d();
            pr C = cVar.C(d2);
            if (C.k() && !qf.p.i.h(j2, d2)) {
                C.n(context, bundle);
            }
        }
    }

    public static final java.lang.Object l6(android.content.Context r4, ik.l<? super zj.e<? super vj.e0>, ? extends java.lang.Object> r5, zj.e<? super vj.e0> r6) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.util.b7.l6(android.content.Context, ik.l, zj.e):java.lang.Object");
    }

    public static final <T> List<T> m0(Collection<? extends T> collection, Iterable<? extends T> iterable) {
        if (collection != null) {
            return iterable == null ? kotlin.collections.t.O0(collection) : kotlin.collections.t.y0(collection, iterable);
        }
        if (iterable != null) {
            return kotlin.collections.t.O0(iterable);
        }
        return null;
    }

    public static final Map<String, Object> m1(MediaMetadata mediaMetadata, Context context) {
        jk.p.i(mediaMetadata, "<this>");
        jk.p.i(context, "context");
        Set<String> keySet = mediaMetadata.keySet();
        jk.p.h(keySet, "keySet(...)");
        Set<String> set = keySet;
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(set, 10));
        for (String str : set) {
            Object string = mediaMetadata.getString(str);
            if (string == null) {
                Bitmap bitmap = mediaMetadata.getBitmap(str);
                string = bitmap != null ? bg.l.s(bitmap, context, (r13 & 2) != 0 ? null : null, (r13 & 4) != 0 ? null : "metadata", (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null) : null;
                if (string == null) {
                    string = Long.valueOf(mediaMetadata.getLong(str));
                }
            }
            arrayList.add(new Pair(str, string));
        }
        return kotlin.collections.m0.n(arrayList);
    }

    public static final <T1, T2> Map<T2, T1> m2(Map<T1, ? extends T2> map) {
        jk.p.i(map, "<this>");
        List<Pair> t = kotlin.collections.m0.t(map);
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(t, 10));
        for (Pair pair : t) {
            arrayList.add(new Pair(pair.getSecond(), pair.getFirst()));
        }
        return kotlin.collections.m0.n(arrayList);
    }

    public static final net.dinglisch.android.taskerm.pi m3(final fo foVar, fn fnVar) {
        String string;
        jk.p.i(foVar, "<this>");
        if (fnVar == null) {
            return null;
        }
        final jk.h0 h0Var = new jk.h0();
        int n1 = fnVar.n1(foVar);
        h0Var.i = n1;
        if (n1 == -1 && (string = fnVar.l().getString("%scene_name")) != null) {
            h0Var.i = foVar.E2(string);
        }
        if (h0Var.i == -1) {
            return null;
        }
        return (net.dinglisch.android.taskerm.pi) n6(null, new ik.a() {
            @Override
            public final Object e() {
                net.dinglisch.android.taskerm.pi o3;
                o3 = b7.o3(fo.this, h0Var);
                return o3;
            }
        }, 1, null);
    }

    public static final String m4(BluetoothDevice bluetoothDevice) {
        if (bluetoothDevice == null) {
            return null;
        }
        int type = bluetoothDevice.getType();
        if (type == 1) {
            return "classic";
        }
        if (type == 2) {
            return "le";
        }
        if (type != 3) {
            return null;
        }
        return "dual";
    }

    public static final double m5(double d2, int i2) {
        return new BigDecimal(d2).setScale(i2, 6).doubleValue();
    }

    public static final <T> T m6(ik.l<? super Throwable, ? extends T> lVar, ik.a<? extends T> aVar) {
        jk.p.i(aVar, "block");
        try {
            return aVar.e();
        } catch (Throwable th2) {
            net.dinglisch.android.taskerm.o7.g("TRYORNULL", "Error", th2);
            if (lVar != null) {
                return lVar.invoke(th2);
            }
            return null;
        }
    }

    public static final <T> ArrayList<T> n0(ArrayList<T> arrayList, T t) {
        if (arrayList == null) {
            arrayList = new ArrayList<>();
        }
        arrayList.add(t);
        return arrayList;
    }

    private static final HashMap<Integer, String> n1() {
        return kotlin.collections.m0.g(new Pair(0, "mms"), new Pair(1, "supl"), new Pair(2, "dun"), new Pair(3, "fota"), new Pair(4, "ims"), new Pair(5, "cbs"), new Pair(6, "wifi_p2p"), new Pair(7, "ia"), new Pair(8, "rcs"), new Pair(9, "xcap"), new Pair(10, "eims"), new Pair(11, "not_metered"), new Pair(12, "internet"), new Pair(13, "not_restricted"), new Pair(14, "trusted"), new Pair(15, "not_vpn"), new Pair(16, "validated"), new Pair(17, "captive_portal"), new Pair(18, "not_roaming"), new Pair(19, "foreground"), new Pair(20, "not_congested"), new Pair(21, "not_suspended"), new Pair(22, "oem_paid"), new Pair(23, "mcx"), new Pair(24, "partial_connectivity"));
    }

    public static final String n2(Object obj) {
        jk.p.i(obj, "<this>");
        return eg.f.c().r(obj);
    }

    public static final net.dinglisch.android.taskerm.pi n3(fo foVar, io ioVar) {
        int E;
        jk.p.i(foVar, "<this>");
        if (ioVar == null || (E = foVar.E(ioVar.C0())) == -1) {
            return null;
        }
        return foVar.w(E);
    }

    public static final boolean n4(fo foVar) {
        if (foVar == null || !foVar.u3(47)) {
            return false;
        }
        List<net.dinglisch.android.taskerm.c> v1 = foVar.v1(47, false);
        jk.p.f(v1);
        if (v1 != null && v1.isEmpty()) {
            return false;
        }
        for (net.dinglisch.android.taskerm.c cVar : v1) {
            jk.p.f(cVar);
            Boolean bool = Boolean.TRUE;
            if (t0(cVar, 10, bool) || t0(cVar, 9, bool)) {
                return true;
            }
        }
        return false;
    }

    public static final double n5(float f2, int i2) {
        return m5(f2, i2);
    }

    public static Object n6(ik.l lVar, ik.a aVar, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            lVar = null;
        }
        return m6(lVar, aVar);
    }

    public static final void o0(List<String> list, String str, String[] strArr) {
        jk.p.i(list, "<this>");
        jk.p.i(str, "match");
        jk.p.i(strArr, "names");
        String lowerCase = str.toLowerCase(Locale.ROOT);
        jk.p.h(lowerCase, "toLowerCase(...)");
        List J0 = sk.q.J0(lowerCase, new String[]{" "}, false, 0, 6, null);
        for (String str2 : strArr) {
            String lowerCase2 = str2.toLowerCase(Locale.ROOT);
            jk.p.h(lowerCase2, "toLowerCase(...)");
            if (J0 == null || !J0.isEmpty()) {
                Iterator it = J0.iterator();
                while (it.hasNext()) {
                    if (!sk.q.U(lowerCase2, (String) it.next(), false, 2, null)) {
                        break;
                    }
                }
            }
            h0(list, str2);
        }
    }

    public static final HashMap<String, Object> o1(Intent intent) {
        return x1(intent != null ? intent.getExtras() : null);
    }

    public static final String o2(Object obj) {
        jk.p.i(obj, "<this>");
        return eg.f.d().r(obj);
    }

    public static final net.dinglisch.android.taskerm.pi o3(fo foVar, jk.h0 h0Var) {
        return foVar.w(h0Var.i);
    }

    public static final Object o4(Class<?> cls, Context context, String str, Class<?> cls2) {
        Object t;
        jk.p.i(cls, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "stringValue");
        if (jk.p.d(cls, String.class) || jk.p.d(cls, CharSequence.class)) {
            return str;
        }
        if (!jk.p.d(cls, Boolean.class)) {
            Class cls3 = Boolean.TYPE;
            if (!jk.p.d(cls, cls3)) {
                Class cls4 = Integer.TYPE;
                if (jk.p.d(cls, cls4) || jk.p.d(cls, Integer.class)) {
                    t = sk.q.t(str);
                    if (t == null) {
                        throw new RuntimeException("Parameter " + str + " should be a number but cannot be converted to it");
                    }
                } else {
                    if (!jk.p.d(cls, Long.TYPE)) {
                        if (jk.p.d(cls, AppBasic.class)) {
                            try {
                                return App.Companion.a(context, str);
                            } catch (Exception e2) {
                                throw new RuntimeException("Parameter " + str + " should be an app but cannot be converted to it: " + e2.getMessage());
                            }
                        }
                        if (jk.p.d(cls, List.class)) {
                            if (cls2 != null) {
                                return u2(str, context, cls2);
                            }
                            throw new RuntimeException("Value of type list must have generic type");
                        }
                        if (jk.p.d(cls, String[].class)) {
                            List<Object> J3 = J3(str, context, String.class);
                            ArrayList arrayList = new ArrayList(kotlin.collections.t.w(J3, 10));
                            Iterator<T> it = J3.iterator();
                            while (it.hasNext()) {
                                arrayList.add(String.valueOf(it.next()));
                            }
                            return arrayList.toArray(new String[0]);
                        }
                        if (jk.p.d(cls, int[].class)) {
                            return B1(str, context, cls4);
                        }
                        if (jk.p.d(cls, boolean[].class)) {
                            return B1(str, context, cls3);
                        }
                        if (jk.p.d(cls, Bitmap.class)) {
                            return bg.l.m(str, context, null, null, 6, null);
                        }
                        return null;
                    }
                    t = sk.q.v(str);
                    if (t == null) {
                        throw new RuntimeException("Parameter " + str + " should be a number (long) but cannot be converted to it");
                    }
                }
                return t;
            }
        }
        return Boolean.valueOf(Boolean.parseBoolean(str));
    }

    public static final void o5(View view, ik.l<? super View, vj.e0> lVar) {
        jk.p.i(lVar, "block");
        if (view == null) {
            return;
        }
        view.getViewTreeObserver().addOnPreDrawListener(new i(view, lVar));
    }

    public static final <T> java.lang.Object o6(ik.l<? super java.lang.Throwable, ? extends T> r4, ik.l<? super zj.e<? super T>, ? extends java.lang.Object> r5, zj.e<? super T> r6) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.util.b7.o6(ik.l, ik.l, zj.e):java.lang.Object");
    }

    public static final void p0(final EditText editText, final String str) {
        jk.p.i(editText, "<this>");
        if (str == null || str.length() == 0) {
            return;
        }
        xg.e2.a1(new ik.a() {
            @Override
            public final Object e() {
                vj.e0 q0;
                q0 = b7.q0(editText, str);
                return q0;
            }
        });
    }

    public static final List<net.dinglisch.android.taskerm.f5> p1(net.dinglisch.android.taskerm.pi piVar, fo foVar, ik.l<? super net.dinglisch.android.taskerm.f5, Boolean> lVar) {
        Object obj;
        jk.p.i(piVar, "<this>");
        jk.p.i(foVar, "taskerData");
        Integer y2 = foVar.y2(piVar.getName());
        if (y2 == null) {
            return kotlin.collections.t.m();
        }
        int intValue = y2.intValue();
        if (lVar == null) {
            lVar = new ik.l() {
                @Override
                public final Object invoke(Object obj2) {
                    boolean s1;
                    s1 = b7.s1((net.dinglisch.android.taskerm.f5) obj2);
                    return Boolean.valueOf(s1);
                }
            };
        }
        ArrayList<fn> R2 = foVar.R2(intValue);
        jk.p.h(R2, "getTasksInProject(...)");
        ArrayList arrayList = new ArrayList();
        for (Object obj2 : R2) {
            if (lVar.invoke(obj2).booleanValue()) {
                arrayList.add(obj2);
            }
        }
        List R0 = kotlin.collections.t.R0(arrayList);
        List<io> s2 = foVar.s2(intValue);
        jk.p.h(s2, "getProfilesInProject(...)");
        ArrayList<io> arrayList2 = new ArrayList();
        for (Object obj3 : s2) {
            if (lVar.invoke(obj3).booleanValue()) {
                arrayList2.add(obj3);
            }
        }
        for (io ioVar : arrayList2) {
            jk.p.f(ioVar);
            for (fn fnVar : e4(ioVar, foVar)) {
                if (lVar.invoke(fnVar).booleanValue()) {
                    Iterator it = R0.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            obj = null;
                            break;
                        }
                        obj = it.next();
                        if (((fn) obj).P0() == fnVar.P0()) {
                            break;
                        }
                    }
                    if (obj == null) {
                        R0.add(fnVar);
                    }
                }
            }
        }
        return kotlin.collections.t.y0(arrayList2, R0);
    }

    public static final String[] p2(List<ComponentName> list, Context context) {
        jk.p.i(context, "context");
        if (list != null) {
            ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
            Iterator<T> it = list.iterator();
            while (it.hasNext()) {
                arrayList.add(ExtensionsContextKt.a2(context, (ComponentName) it.next()));
            }
            String[] strArr = (String[]) arrayList.toArray(new String[0]);
            if (strArr != null) {
                return strArr;
            }
        }
        return new String[0];
    }

    public static final net.dinglisch.android.taskerm.pi p3(fo foVar, jk.h0 h0Var) {
        return foVar.w(h0Var.i);
    }

    public static Object p4(Class cls, Context context, String str, Class cls2, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            cls2 = null;
        }
        return o4(cls, context, str, cls2);
    }

    public static final <T> boolean p5(Collection<? extends T> collection, Collection<? extends T> collection2) {
        if (collection2 == null) {
            return collection == null;
        }
        if (collection == null) {
            return false;
        }
        return collection.size() == collection2.size() && collection.containsAll(collection2);
    }

    public static Object p6(ik.l lVar, ik.l lVar2, zj.e eVar, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            lVar = null;
        }
        return o6(lVar, lVar2, eVar);
    }

    public static final vj.e0 q0(EditText editText, String str) {
        Editable text = editText.getText();
        String obj = text != null ? text.toString() : null;
        if (obj != null && obj.length() != 0) {
            if (sk.q.A(obj, "/", false, 2, null)) {
                obj = obj.substring(0, obj.length() - 1);
                jk.p.h(obj, "substring(...)");
            }
            str = obj + "/" + str;
        }
        editText.setText(str);
        return vj.e0.a;
    }

    public static final List<net.dinglisch.android.taskerm.f5> q1(fo foVar, ik.l<? super net.dinglisch.android.taskerm.f5, Boolean> lVar) {
        jk.p.i(foVar, "<this>");
        List<net.dinglisch.android.taskerm.pi> z2 = foVar.z2();
        ik.l<? super net.dinglisch.android.taskerm.f5, Boolean> lVar2 = lVar == null ? new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                boolean t1;
                t1 = b7.t1((net.dinglisch.android.taskerm.f5) obj);
                return Boolean.valueOf(t1);
            }
        } : lVar;
        jk.p.f(z2);
        ArrayList arrayList = new ArrayList();
        for (Object obj : z2) {
            if (lVar2.invoke(obj).booleanValue()) {
                arrayList.add(obj);
            }
        }
        ArrayList arrayList2 = new ArrayList(kotlin.collections.t.w(z2, 10));
        for (net.dinglisch.android.taskerm.pi piVar : z2) {
            jk.p.f(piVar);
            arrayList2.add(p1(piVar, foVar, lVar));
        }
        return kotlin.collections.t.y0(arrayList, kotlin.collections.t.x(arrayList2));
    }

    public static final io q2(fo foVar, fn fnVar) {
        jk.p.i(foVar, "<this>");
        if (fnVar == null || fnVar.Y0() == -1) {
            return null;
        }
        return foVar.c(fnVar.Y0());
    }

    public static final sg.a4 q3(fo foVar, mj mjVar) {
        jk.p.i(foVar, "<this>");
        jk.p.i(mjVar, "scene");
        net.dinglisch.android.taskerm.pi l3 = l3(foVar, mjVar);
        if (l3 != null) {
            return l3.O();
        }
        return null;
    }

    public static final String q4(Boolean bool) {
        return jk.p.d(bool, Boolean.TRUE) ? "true" : "false";
    }

    public static final void q5(bn bnVar, Context context, String str, Object obj) {
        Bundle b2;
        jk.p.i(bnVar, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "tag");
        b2 = dg.c.i.b(context, (r13 & 2) != 0 ? null : null, (r13 & 4) != 0 ? null : dg.d.a(context, obj), (r13 & 8) != 0 ? null : null, (r13 & 16) != 0 ? null : null);
        bnVar.g1(str, b2);
    }

    public static final <T> Object q6(ik.l<? super zj.e<? super T>, ? extends Object> lVar, zj.e<? super T> eVar) {
        return o6(new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                Object r6;
                r6 = b7.r6((Throwable) obj);
                return r6;
            }
        }, lVar, eVar);
    }

    public static final boolean r0(io ioVar, sn snVar) {
        jk.p.i(ioVar, "<this>");
        jk.p.i(snVar, "context");
        List<bn> X2 = X2(ioVar, snVar);
        if (X2 != null && X2.isEmpty()) {
            return true;
        }
        Iterator<T> it = X2.iterator();
        while (it.hasNext()) {
            if (!((bn) it.next()).K0()) {
                return false;
            }
        }
        return true;
    }

    public static List r1(fo foVar, ik.l lVar, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            lVar = null;
        }
        return q1(foVar, lVar);
    }

    public static final LinkProperties r2(Network network, Context context) {
        jk.p.i(network, "<this>");
        jk.p.i(context, "context");
        ConnectivityManager l1 = ExtensionsContextKt.l1(context);
        if (l1 != null) {
            return l1.getLinkProperties(network);
        }
        return null;
    }

    public static final sg.a4 r3(fo foVar, fn fnVar) {
        jk.p.i(foVar, "<this>");
        net.dinglisch.android.taskerm.pi m3 = m3(foVar, fnVar);
        if (m3 != null) {
            return m3.O();
        }
        return null;
    }

    public static final boolean r4(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        return F4(sensor) || P4(sensor);
    }

    public static final void r5(fo foVar, Context context) {
        jk.p.i(foVar, "<this>");
        jk.p.i(context, "context");
        foVar.w4(context).G4(context, pp.R0(context), context.getResources(), new Date().getTime(), true, true);
    }

    public static final Object r6(Throwable th2) {
        jk.p.i(th2, "it");
        return null;
    }

    public static final boolean s0(int[] iArr) {
        jk.p.i(iArr, "<this>");
        if (iArr.length < 2) {
            return true;
        }
        List<Integer> v0 = kotlin.collections.n.v0(iArr);
        int size = v0.size() - 1;
        int i2 = 0;
        while (i2 < size) {
            int intValue = v0.get(i2).intValue() + 1;
            i2++;
            if (intValue != v0.get(i2).intValue()) {
                return false;
            }
        }
        return true;
    }

    public static final boolean s1(net.dinglisch.android.taskerm.f5 f5Var) {
        jk.p.i(f5Var, "it");
        return true;
    }

    public static final ArrayList<UsageEvents.Event> s2(UsageEvents usageEvents, Integer num) {
        if (usageEvents == null) {
            return new ArrayList<>();
        }
        ArrayList<UsageEvents.Event> arrayList = new ArrayList<>();
        while (usageEvents.hasNextEvent()) {
            UsageEvents.Event event = new UsageEvents.Event();
            if (usageEvents.getNextEvent(event) && (num == null || event.getEventType() == num.intValue())) {
                arrayList.add(event);
            }
        }
        return arrayList;
    }

    public static final sg.a4 s3(fo foVar, io ioVar) {
        jk.p.i(foVar, "<this>");
        net.dinglisch.android.taskerm.pi n3 = n3(foVar, ioVar);
        if (n3 != null) {
            return n3.O();
        }
        return null;
    }

    public static final List<ComponentName> s4(List<ComponentName> list) {
        if (list == null) {
            return kotlin.collections.t.m();
        }
        ArrayList arrayList = new ArrayList();
        for (Object obj : list) {
            ComponentName componentName = (ComponentName) obj;
            if (l7.V(componentName.getPackageName()) != null && l7.V(componentName.getClassName()) != null) {
                arrayList.add(obj);
            }
        }
        return arrayList;
    }

    public static final void s5(HttpURLConnection httpURLConnection, String str) {
        jk.p.i(httpURLConnection, "<this>");
        jk.p.i(str, "auth");
        Pair<String, String> o = lg.n1.o(str);
        httpURLConnection.setRequestProperty(o.getFirst(), o.getSecond());
    }

    public static final void s6(Activity activity, int i2, String str) {
        jk.p.i(activity, "<this>");
        jk.p.i(str, "tag");
        try {
            activity.setRequestedOrientation(i2);
        } catch (Exception e2) {
            net.dinglisch.android.taskerm.o7.g(str, "Can't set orientation", e2);
        }
    }

    public static final boolean t0(net.dinglisch.android.taskerm.c cVar, int i2, Object obj) {
        jk.p.i(cVar, "<this>");
        if (obj == null) {
            return !cVar.C(i2).k();
        }
        if (obj instanceof String) {
            return jk.p.d(cVar.N(i2).w(), obj);
        }
        if (obj instanceof Boolean) {
            return jk.p.d(Boolean.valueOf(cVar.i(i2).T()), obj);
        }
        boolean z = obj instanceof Integer;
        if (z) {
            return z && cVar.y(i2).v() == ((Number) obj).intValue();
        }
        return false;
    }

    public static final boolean t1(net.dinglisch.android.taskerm.f5 f5Var) {
        jk.p.i(f5Var, "it");
        return true;
    }

    public static final String[] t2(String str) {
        if (str == null || str.length() == 0) {
            return null;
        }
        List J0 = sk.q.J0(str, new String[]{","}, false, 0, 6, null);
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(J0, 10));
        Iterator it = J0.iterator();
        while (it.hasNext()) {
            String obj = sk.q.g1((String) it.next()).toString();
            if (!wp.c1(obj)) {
                throw new RuntimeException(obj + " is not a valid variable name");
            }
            arrayList.add(obj);
        }
        return (String[]) arrayList.toArray(new String[0]);
    }

    private static final String[] t3(Network network, Context context, HashMap<Integer, String> hashMap, ik.p<? super NetworkCapabilities, ? super Integer, Boolean> pVar) {
        NetworkCapabilities I1 = I1(network, context);
        if (I1 == null) {
            return null;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (Map.Entry<Integer, String> entry : hashMap.entrySet()) {
            if (pVar.n(I1, entry.getKey()).booleanValue()) {
                linkedHashMap.put(entry.getKey(), entry.getValue());
            }
        }
        ArrayList arrayList = new ArrayList(linkedHashMap.size());
        Iterator it = linkedHashMap.entrySet().iterator();
        while (it.hasNext()) {
            arrayList.add((String) ((Map.Entry) it.next()).getValue());
        }
        return (String[]) arrayList.toArray(new String[0]);
    }

    public static final boolean t4(fo foVar, int i2) {
        jk.p.i(foVar, "<this>");
        return X0(foVar, i2, new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                boolean u4;
                u4 = b7.u4((net.dinglisch.android.taskerm.j2) obj);
                return Boolean.valueOf(u4);
            }
        });
    }

    public static final int t5(int i2, float f2) {
        return Color.argb(lk.a.d(Color.alpha(i2) * f2), Color.red(i2), Color.green(i2), Color.blue(i2));
    }

    public static final ti.b t6(MediaPlayer mediaPlayer) {
        jk.p.i(mediaPlayer, "<this>");
        if (!mediaPlayer.isPlaying()) {
            ti.b k2 = ti.b.k();
            jk.p.h(k2, "complete(...)");
            return k2;
        }
        final sj.a L = sj.a.L();
        jk.p.h(L, "create(...)");
        mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public final void onCompletion(MediaPlayer mediaPlayer2) {
                b7.u6(sj.a.this, mediaPlayer2);
            }
        });
        return L;
    }

    public static final <T> Object u0(aa.i<T> iVar, zj.e<? super T> eVar) {
        if (iVar.o()) {
            return iVar.k();
        }
        zj.k kVar = new zj.k(ak.b.b(eVar));
        iVar.f(new j(new a(kVar))).d(new b(kVar));
        Object a2 = kVar.a();
        if (a2 == ak.b.c()) {
            bk.h.c(eVar);
        }
        return a2;
    }

    public static final <T> boolean u1(Iterable<? extends T> iterable) {
        jk.p.i(iterable, "<this>");
        if ((iterable instanceof Collection) && ((Collection) iterable).isEmpty()) {
            return true;
        }
        Iterator<? extends T> it = iterable.iterator();
        while (it.hasNext()) {
            if (it.next() != null) {
                return false;
            }
        }
        return true;
    }

    private static final List<Object> u2(String str, Context context, Class<?> cls) {
        return kotlin.collections.t.O0(J3(str, context, cls));
    }

    public static final String u3(double d2, boolean z, int i2) {
        if (z) {
            return Z3(d2, i2);
        }
        return null;
    }

    public static final boolean u4(net.dinglisch.android.taskerm.j2 j2Var) {
        jk.p.i(j2Var, "it");
        return true;
    }

    public static final void u5(View view, int i2) {
        jk.p.i(view, "<this>");
        GradientDrawable gradientDrawable = (GradientDrawable) view.getBackground();
        if (gradientDrawable != null) {
            gradientDrawable.setColor(i2);
        }
    }

    public static final void u6(sj.a aVar, MediaPlayer mediaPlayer) {
        aVar.a();
    }

    public static final Object v0(hl.e eVar, zj.e<? super hl.d0> eVar2) {
        zj.k kVar = new zj.k(ak.b.b(eVar2));
        eVar.C(new e(kVar));
        Object a2 = kVar.a();
        if (a2 == ak.b.c()) {
            bk.h.c(eVar2);
        }
        return a2;
    }

    public static final List<sg.k> v1(net.dinglisch.android.taskerm.f5 f5Var, fo foVar) {
        List m2;
        jk.p.i(f5Var, "<this>");
        jk.p.i(foVar, "data");
        Collection O = f5Var.O();
        if (O == null) {
            O = kotlin.collections.t.m();
        }
        List T3 = f5Var instanceof io ? T3((io) f5Var, foVar, null, 2, null) : kotlin.collections.t.m();
        if (f5Var instanceof net.dinglisch.android.taskerm.pi) {
            net.dinglisch.android.taskerm.pi piVar = (net.dinglisch.android.taskerm.pi) f5Var;
            List<io> y = piVar.y(foVar);
            if (y == null) {
                y = kotlin.collections.t.m();
            }
            ArrayList arrayList = new ArrayList();
            Iterator<T> it = y.iterator();
            while (it.hasNext()) {
                sg.a4 O2 = ((io) it.next()).O();
                if (O2 != null) {
                    arrayList.add(O2);
                }
            }
            List x = kotlin.collections.t.x(arrayList);
            ArrayList arrayList2 = new ArrayList();
            for (io ioVar : y) {
                jk.p.f(ioVar);
                List<sg.k> S3 = S3(ioVar, foVar, new ik.l() {
                    @Override
                    public final Object invoke(Object obj) {
                        boolean w1;
                        w1 = b7.w1((fn) obj);
                        return Boolean.valueOf(w1);
                    }
                });
                if (S3 != null) {
                    arrayList2.add(S3);
                }
            }
            List x2 = kotlin.collections.t.x(arrayList2);
            List<fn> M = piVar.M(foVar);
            jk.p.h(M, "getTasks(...)");
            ArrayList arrayList3 = new ArrayList();
            for (Object obj : M) {
                if (((fn) obj).x()) {
                    arrayList3.add(obj);
                }
            }
            ArrayList arrayList4 = new ArrayList();
            Iterator it2 = arrayList3.iterator();
            while (it2.hasNext()) {
                sg.a4 O3 = ((fn) it2.next()).O();
                if (O3 != null) {
                    arrayList4.add(O3);
                }
            }
            m2 = kotlin.collections.t.y0(kotlin.collections.t.y0(x, x2), kotlin.collections.t.x(arrayList4));
        } else {
            m2 = kotlin.collections.t.m();
        }
        return kotlin.collections.t.y0(kotlin.collections.t.y0(O, T3), m2);
    }

    public static final String v2(Sensor sensor, Context context) {
        jk.p.i(sensor, "<this>");
        jk.p.i(context, "context");
        return "Name: " + sensor.getName() + "\nType: " + sensor.getType() + " - " + sensor.getStringType() + "\nVendor: " + sensor.getVendor() + "\nMode: " + y3(sensor, context) + "\nWake Up: " + sensor.isWakeUpSensor() + "\nPower: " + sensor.getPower() + " mA\nResolution: " + sensor.getResolution() + "\nMin Delay: " + B2(sensor.getMinDelay()) + "\nMax Delay: " + B2(sensor.getMaxDelay()) + "\nMax Range: " + sensor.getMaximumRange();
    }

    public static final HashMap<String, String> v3(Uri uri) {
        String queryParameter;
        if (uri == null) {
            return new HashMap<>();
        }
        Set<String> queryParameterNames = uri.getQueryParameterNames();
        jk.p.h(queryParameterNames, "getQueryParameterNames(...)");
        ArrayList arrayList = new ArrayList();
        for (String str : queryParameterNames) {
            Pair pair = null;
            if (str != null && (queryParameter = uri.getQueryParameter(str)) != null) {
                pair = new Pair(str, queryParameter);
            }
            if (pair != null) {
                arrayList.add(pair);
            }
        }
        Pair[] pairArr = (Pair[]) arrayList.toArray(new Pair[0]);
        return kotlin.collections.m0.g((Pair[]) Arrays.copyOf(pairArr, pairArr.length));
    }

    public static final boolean v4(fo foVar, fn fnVar) {
        jk.p.i(foVar, "<this>");
        jk.p.i(fnVar, "task");
        List<io> i3 = i3(foVar, fnVar);
        if (i3 == null || i3.isEmpty()) {
            return false;
        }
        Iterator<T> it = i3.iterator();
        while (it.hasNext()) {
            if (((io) it.next()).h1()) {
                return true;
            }
        }
        return false;
    }

    public static final void v5(HttpURLConnection httpURLConnection, String str) {
        jk.p.i(httpURLConnection, "<this>");
        jk.p.i(str, "contentType");
        httpURLConnection.setRequestProperty(lg.n1.A(), str);
    }

    public static final java.lang.Object v6(ik.a<java.lang.Boolean> r7, long r8, long r10, zj.e<? super vj.e0> r12) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.util.b7.v6(ik.a, long, long, zj.e):java.lang.Object");
    }

    public static final Object w0(aa.i<Void> iVar, zj.e<? super vj.e0> eVar) {
        if (iVar.o()) {
            return vj.e0.a;
        }
        zj.k kVar = new zj.k(ak.b.b(eVar));
        iVar.f(new j(new c(kVar))).d(new d(kVar));
        Object a2 = kVar.a();
        if (a2 == ak.b.c()) {
            bk.h.c(eVar);
        }
        return a2 == ak.b.c() ? a2 : vj.e0.a;
    }

    public static final boolean w1(fn fnVar) {
        jk.p.i(fnVar, "it");
        return !fnVar.x();
    }

    public static final String w2(BluetoothClass bluetoothClass, Context context) {
        jk.p.i(context, "context");
        if (bluetoothClass == null) {
            return null;
        }
        return net.dinglisch.android.taskerm.i1.l(context.getResources(), bluetoothClass.getMajorDeviceClass());
    }

    public static final String w3(HashMap<? extends Object, ? extends Object> hashMap) {
        List t;
        if (hashMap == null || (t = kotlin.collections.m0.t(hashMap)) == null) {
            return null;
        }
        return kotlin.collections.t.n0(t, "&", null, null, 0, null, new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                CharSequence b0;
                b0 = b7.b0((Pair) obj);
                return b0;
            }
        }, 30, null);
    }

    public static final boolean w4(StatusBarNotification statusBarNotification, String str) {
        Bundle bundle;
        jk.p.i(statusBarNotification, "<this>");
        jk.p.i(str, "key");
        Notification notification = statusBarNotification.getNotification();
        if (notification == null || (bundle = notification.extras) == null) {
            return false;
        }
        return bundle.containsKey(str);
    }

    public static final Intent w5(Intent intent, Context context, String str, boolean z) {
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "packageName");
        return C5(intent, context, "https://play.google.com/store/apps/details?id=" + str, z);
    }

    public static Object w6(ik.a aVar, long j2, long j3, zj.e eVar, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            j3 = 0;
        }
        return v6(aVar, j2, j3, eVar);
    }

    public static final float x0(float f2, float f3, float f4) {
        return Math.min(Math.max(f2, f3), f4);
    }

    public static final HashMap<String, Object> x1(final BaseBundle baseBundle) {
        HashMap<String, Object> hashMap = new HashMap<>();
        if (baseBundle == null) {
            return hashMap;
        }
        Set<String> keySet = baseBundle.keySet();
        if (keySet != null) {
            for (final String str : keySet) {
                if (str != null) {
                    final Object n6 = n6(null, new ik.a() {
                        @Override
                        public final Object e() {
                            Object U;
                            U = b7.U(baseBundle, str);
                            return U;
                        }
                    }, 1, null);
                    Object n62 = n6(null, new ik.a() {
                        @Override
                        public final Object e() {
                            Object V;
                            V = b7.V(n6);
                            return V;
                        }
                    }, 1, null);
                    if (n62 != null) {
                        hashMap.put(str, n62);
                    }
                }
            }
        }
        return hashMap;
    }

    public static final String x2(InputStream inputStream) {
        jk.p.i(inputStream, "<this>");
        return u8.b(inputStream);
    }

    public static final long x3(int i2) {
        if (i2 == 0) {
            return 3000L;
        }
        if (i2 != 1) {
            return i2;
        }
        return 4500L;
    }

    public static final boolean x4(int i2, int i3) {
        return (i2 & i3) != 0;
    }

    public static final <T> boolean x5(AtomicReference<T> atomicReference, T t) {
        jk.p.i(atomicReference, "<this>");
        return a.a(atomicReference, (Object) null, t);
    }

    public static final Intent x6(Intent intent, Context context, String str, boolean z, Intent intent2, Boolean bool) {
        Intent a2;
        Uri data;
        String uri;
        jk.p.i(intent, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "chooserTitle");
        Intent createChooser = Intent.createChooser(intent, str);
        PackageManager packageManager = context.getPackageManager();
        if (jk.p.d(bool, Boolean.TRUE) && jk.p.d(intent.getAction(), "android.intent.action.VIEW") && r.a.G()) {
            List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 131072);
            jk.p.h(queryIntentActivities, "queryIntentActivities(...)");
            ?? z6 = z6(queryIntentActivities, intent);
            if (jk.p.d(intent.getAction(), "android.intent.action.VIEW") && (data = intent.getData()) != null && (uri = data.toString()) != null && sk.q.O(uri, "http", false, 2, null)) {
                List<ResolveInfo> queryIntentActivities2 = packageManager.queryIntentActivities(new Intent("android.intent.action.VIEW", Uri.parse("https://bla.com")), 131072);
                jk.p.h(queryIntentActivities2, "queryIntentActivities(...)");
                List y0 = kotlin.collections.t.y0(z6, z6(queryIntentActivities2, intent));
                HashSet hashSet = new HashSet();
                z6 = new ArrayList();
                for (Object obj : y0) {
                    if (hashSet.add(((Intent) obj).getComponent())) {
                        z6.add(obj);
                    }
                }
            }
            createChooser.putExtra("android.intent.extra.ALTERNATE_INTENTS", (Parcelable[]) z6.toArray(new Intent[0]));
            jk.p.f(createChooser);
            return createChooser;
        }
        if (intent2 == null) {
            jk.p.f(createChooser);
            return createChooser;
        }
        if (z && (a2 = a2(intent2, context)) != null) {
            intent.setComponent(a2.getComponent());
            return intent;
        }
        List<ResolveInfo> queryIntentActivities3 = packageManager.queryIntentActivities(intent2, 0);
        jk.p.h(queryIntentActivities3, "queryIntentActivities(...)");
        List<Intent> z62 = z6(queryIntentActivities3, intent);
        if (z62.isEmpty()) {
            return intent;
        }
        List<ResolveInfo> queryIntentActivities4 = packageManager.queryIntentActivities(intent, 0);
        jk.p.h(queryIntentActivities4, "queryIntentActivities(...)");
        ArrayList<ResolveInfo> arrayList = new ArrayList();
        for (Object obj2 : queryIntentActivities4) {
            ResolveInfo resolveInfo = (ResolveInfo) obj2;
            if (!z62.isEmpty()) {
                Iterator it = z62.iterator();
                while (it.hasNext()) {
                    ComponentName component = ((Intent) it.next()).getComponent();
                    jk.p.f(resolveInfo);
                    if (jk.p.d(component, O1(resolveInfo))) {
                        break;
                    }
                }
            }
            arrayList.add(obj2);
        }
        ArrayList arrayList2 = new ArrayList(kotlin.collections.t.w(arrayList, 10));
        for (ResolveInfo resolveInfo2 : arrayList) {
            jk.p.f(resolveInfo2);
            arrayList2.add(O1(resolveInfo2));
        }
        ComponentName[] componentNameArr = (ComponentName[]) arrayList2.toArray(new ComponentName[0]);
        if (!(componentNameArr.length == 0)) {
            createChooser.putExtra("android.intent.extra.EXCLUDE_COMPONENTS", componentNameArr);
        }
        jk.p.f(createChooser);
        return createChooser;
    }

    public static final int y0(int i2, int i3, int i4) {
        return Math.min(Math.max(i2, i3), i4);
    }

    private static final HashMap<Integer, String> y1() {
        return kotlin.collections.m0.g(new Pair(0, "cellular"), new Pair(1, "wifi"), new Pair(2, "bluetooth"), new Pair(3, "ethernet"), new Pair(4, "vpn"), new Pair(5, "wifi_aware"), new Pair(6, "lowpan"), new Pair(8, "usb"));
    }

    public static final String y2(byte[] bArr) {
        jk.p.i(bArr, "<this>");
        return x2(k2(bArr));
    }

    public static final String y3(Sensor sensor, Context context) {
        jk.p.i(sensor, "<this>");
        jk.p.i(context, "context");
        return j6(z3(sensor), context, new Object[0]);
    }

    public static final void y4(EditText editText, String str) {
        jk.p.i(editText, "<this>");
        jk.p.i(str, "value");
        Editable text = editText.getText();
        int selectionStart = editText.getSelectionStart();
        int selectionEnd = editText.getSelectionEnd();
        if (selectionEnd > selectionStart) {
            text.delete(selectionStart, selectionEnd);
        }
        text.insert(selectionStart, str);
    }

    public static final void y5(View view, int i2) {
        jk.p.i(view, "<this>");
        view.getLayoutParams().height = i2;
        view.getLayoutParams().width = i2;
    }

    public static Intent y6(Intent intent, Context context, String str, boolean z, Intent intent2, Boolean bool, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            z = false;
        }
        return x6(intent, context, str, z, (i2 & 8) != 0 ? null : intent2, (i2 & 16) != 0 ? null : bool);
    }

    public static final boolean z0(BluetoothProfile bluetoothProfile, BluetoothDevice bluetoothDevice) {
        jk.p.i(bluetoothProfile, "<this>");
        jk.p.i(bluetoothDevice, "bluetoothDevice");
        return ((Boolean) mi.k(bluetoothProfile, "connect", "a2dpconnect", false, 4, null).b(bluetoothDevice)).booleanValue();
    }

    public static final <T> boolean z1(Iterable<? extends T> iterable) {
        jk.p.i(iterable, "<this>");
        if ((iterable instanceof Collection) && ((Collection) iterable).isEmpty()) {
            return false;
        }
        Iterator<? extends T> it = iterable.iterator();
        while (it.hasNext()) {
            if (it.next() == null) {
                return true;
            }
        }
        return false;
    }

    public static final String z2(double d2, boolean z) {
        return u3(d2, z, 2);
    }

    public static final int z3(Sensor sensor) {
        jk.p.i(sensor, "<this>");
        int reportingMode = sensor.getReportingMode();
        if (reportingMode == 0) {
            return 2131889547;
        }
        if (reportingMode == 1) {
            return 2131889313;
        }
        if (reportingMode != 2) {
            return reportingMode != 3 ? 2131891293 : 2131890682;
        }
        return 2131889323;
    }

    @TargetApi(30)
    public static final boolean z4(TelephonyDisplayInfo telephonyDisplayInfo) {
        int overrideNetworkType;
        if (telephonyDisplayInfo == null || r.a.t()) {
            return false;
        }
        overrideNetworkType = telephonyDisplayInfo.getOverrideNetworkType();
        return b1(Integer.valueOf(overrideNetworkType), 2, 3, 4);
    }

    public static final void z5(Bundle bundle, Context context, String str, String str2, String str3, Integer num, Integer[] numArr, Integer num2, StructureType structureType) {
        jk.p.i(bundle, "<this>");
        jk.p.i(context, "context");
        jk.p.i(str, "key");
        if (str2 == null || str2.length() == 0) {
            wp.H(context, str, false, true, false, true, bundle, false, num2, num);
        } else {
            wp.X1(context, str, str2, true, bundle, str3, num, numArr, num2, structureType);
        }
    }

    private static final List<Intent> z6(List<? extends ResolveInfo> list, Intent intent) {
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
        for (ResolveInfo resolveInfo : list) {
            Intent intent2 = new Intent(intent);
            ActivityInfo activityInfo = resolveInfo.activityInfo;
            intent2.setComponent(new ComponentName(activityInfo.packageName, activityInfo.name));
            arrayList.add(intent2);
        }
        return arrayList;
    }
}