ModV2.0.4 v1.86526672844804版本的 MD5 值为:ab8437a2d03fc69805a8b4199bd7fecb

以下内容为反编译后的 gy.java 源代码,内容仅作参考


package net.dinglisch.android.taskerm;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import com.joaomgcd.taskerm.notification.aw;
import com.joaomgcd.taskerm.structuredoutput.StructureType;
import java.util.ArrayList;
import java.util.List;
import net.danlew.android.joda.R;
public final class gy {
    public static final a f13587a = new a(null);
    private static final c.e f13588b = c.f.a(b.f13629a);
    private static final c.e f13589c = c.f.a(c.f13630a);

    public static final String a(Context context, String str, String str2, Bundle bundle) {
        return f13587a.a(context, str, str2, bundle);
    }

    public static final String a(Context context, String str, String str2, Bundle bundle, boolean z) {
        return f13587a.a(context, str, str2, bundle, z);
    }

    public static final String a(String str) {
        return f13587a.a(str);
    }

    public static final String a(boolean z) {
        return f13587a.a(z);
    }

    public static final aq a(Context context, String str, Bundle bundle, String str2) {
        return f13587a.a(context, str, bundle, str2);
    }

    public static final void a(Context context) {
        f13587a.a(context);
    }

    public static final void a(Context context, List<String> list, Bundle bundle) {
        f13587a.a(context, list, bundle);
    }

    public static final void a(Bundle bundle, String str, StructureType structureType) {
        a.a(f13587a, bundle, str, structureType, null, null, 24, null);
    }

    public static final void a(Bundle bundle, String str, StructureType structureType, Context context) {
        a.a(f13587a, bundle, str, structureType, context, null, 16, null);
    }

    public static final boolean a(String str, String str2) {
        return f13587a.a(str, str2);
    }

    public static final List<String> b(Context context, String str, String str2, Bundle bundle) {
        return f13587a.b(context, str, str2, bundle);
    }

    public static final boolean b(String str) {
        return f13587a.b(str);
    }

    public static final ar c(Context context, String str, String str2, Bundle bundle) {
        return f13587a.c(context, str, str2, bundle);
    }

    public static final boolean c(String str) {
        return f13587a.d(str);
    }

    public static final class a {
        static final c.j.g[] f13590a = {c.f.b.x.a(new c.f.b.v(c.f.b.x.a(a.class), "valueForMatchingItemRegex", "getValueForMatchingItemRegex()Lkotlin/text/Regex;")), c.f.b.x.a(new c.f.b.v(c.f.b.x.a(a.class), "valueForMatchingItemRegexWithRegex", "getValueForMatchingItemRegexWithRegex()Lkotlin/text/Regex;")), c.f.b.x.a(new c.f.b.t(c.f.b.x.a(a.class), "edit", "<v#0>"))};

        public static final class h extends c.f.b.l implements c.f.a.a {
            public static final h f13602a = new h();

            h() {
                super(0);
            }

            @Override
            public final Void invoke() {
                return null;
            }
        }

        private final c.l.k c() {
            c.e eVar = gy.f13588b;
            c.j.g gVar = f13590a[0];
            return (c.l.k) eVar.b();
        }

        private final c.l.k d() {
            c.e eVar = gy.f13589c;
            c.j.g gVar = f13590a[1];
            return (c.l.k) eVar.b();
        }

        public final String a(boolean z) {
            return z ? "true" : "false";
        }

        public static final class o extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.notification.aw, c.s> {
            final Context f13612a;
            final String f13613b;

            o(Context context, String str) {
                super(1);
                this.f13612a = context;
                this.f13613b = str;
            }

            @Override
            public c.s invoke(com.joaomgcd.taskerm.notification.aw awVar) {
                a(awVar);
                return c.s.f2131a;
            }

            public final void a(com.joaomgcd.taskerm.notification.aw awVar) {
                c.f.b.k.b(awVar, "receiver$0");
                awVar.a(gy.f13587a.b());
                awVar.a(gy.f13587a.a());
                awVar.a(new com.joaomgcd.taskerm.notification.g(this.f13612a, "https://tasker.joaoapps.com/userguide/en/variables.html#json", true, null, 8, null));
            }
        }

        public static final class p extends c.f.b.l implements c.f.a.b<com.joaomgcd.taskerm.notification.aw, c.s> {
            final Context f13614a;
            final String f13615b;

            p(Context context, String str) {
                super(1);
                this.f13614a = context;
                this.f13615b = str;
            }

            @Override
            public c.s invoke(com.joaomgcd.taskerm.notification.aw awVar) {
                a(awVar);
                return c.s.f2131a;
            }

            public final void a(com.joaomgcd.taskerm.notification.aw awVar) {
                c.f.b.k.b(awVar, "receiver$0");
                awVar.a(gy.f13587a.b());
                awVar.a(gy.f13587a.a());
                awVar.a(new com.joaomgcd.taskerm.notification.g(this.f13614a, "https://tasker.joaoapps.com/userguide/en/variables.html#html", true, null, 8, null));
            }
        }

        public static final class q extends c.f.b.l implements c.f.a.a<c.s> {
            public static final q f13616a = new q();

            q() {
                super(0);
            }

            public final void a() {
            }

            @Override
            public c.s invoke() {
                a();
                return c.s.f2131a;
            }
        }

        public static final class r extends c.f.b.l implements c.f.a.a<c.s> {
            public static final r f13617a = new r();

            r() {
                super(0);
            }

            public final void a() {
            }

            @Override
            public c.s invoke() {
                a();
                return c.s.f2131a;
            }
        }

        public static final class v extends c.f.b.l implements c.f.a.a<c.s> {
            public static final v f13625a = new v();

            v() {
                super(0);
            }

            public final void a() {
            }

            @Override
            public c.s invoke() {
                a();
                return c.s.f2131a;
            }
        }

        public static final class w extends c.f.b.l implements c.f.a.a<Boolean> {
            public static final w f13626a = new w();

            w() {
                super(0);
            }

            public final boolean a() {
                return false;
            }

            @Override
            public Boolean invoke() {
                return Boolean.valueOf(a());
            }
        }

        public static final class x extends c.f.b.l implements c.f.a.b<String, Boolean> {
            final Context f13627a;

            x(Context context) {
                super(1);
                this.f13627a = context;
            }

            @Override
            public Boolean invoke(String str) {
                return Boolean.valueOf(a(str));
            }

            public final boolean a(String str) {
                c.f.b.k.b(str, "realVarName");
                return com.joaomgcd.taskerm.structuredoutput.a.f9042a.a(this.f13627a, str);
            }
        }

        public static final class y extends c.f.b.l implements c.f.a.m<Bundle, String, Boolean> {
            public static final y f13628a = new y();

            y() {
                super(2);
            }

            @Override
            public Boolean invoke(Bundle bundle, String str) {
                return Boolean.valueOf(a(bundle, str));
            }

            public final boolean a(Bundle bundle, String str) {
                c.f.b.k.b(bundle, "bundle");
                c.f.b.k.b(str, "realVarName");
                return bundle.getBoolean(gy.f13587a.j(str));
            }
        }

        private a() {
        }

        public a(c.f.b.g gVar) {
            this();
        }

        private final boolean f(String str) {
            return c.l.n.b((CharSequence) str, (CharSequence) ".", false, 2, (Object) null);
        }

        private final boolean g(String str) {
            String str2 = str;
            return c.l.n.b((CharSequence) str2, (CharSequence) "[", false, 2, (Object) null) && c.l.n.b((CharSequence) str2, (CharSequence) "]", false, 2, (Object) null);
        }

        public final String a(String str) {
            List<String> h2;
            if (gy.f13587a.b(str)) {
                if (str == null || (h2 = gy.f13587a.h(str)) == null) {
                    return null;
                }
                return (String) c.a.j.a((List<? extends Object>) h2, 0);
            }
            return str;
        }

        public final boolean b(String str) {
            if (str == null) {
                return false;
            }
            return gy.f13587a.f(str) || gy.f13587a.g(str);
        }

        private final List<String> h(String str) {
            if (gy.f13587a.g(str)) {
                List b2 = c.l.n.b((CharSequence) str, new String[]{"["}, false, 0, 6, (Object) null);
                List b3 = c.l.n.b((CharSequence) ((String) b2.get(1)), new String[]{"]"}, false, 0, 6, (Object) null);
                String str2 = (String) b3.get(1);
                return c.a.j.b((String) b2.get(0), (String) b3.get(0));
            }
            return c.a.j.b(c.l.n.a(str, ".", (String) null, 2, (Object) null), c.l.n.b(str, ".", (String) null, 2, (Object) null));
        }

        private final fr a(Context context, String str, StructureType structureType, Bundle bundle, boolean z, c.f.a.b<? super String, String> bVar) {
            String str2;
            a aVar = this;
            if (aVar.b(str)) {
                List<String> h2 = aVar.h(str);
                String str3 = h2.get(1);
                String invoke = bVar.invoke(h2.get(0));
                if (invoke != null) {
                    if (!c.l.n.b((CharSequence) str3, (CharSequence) "%", false, 2, (Object) null) || (str2 = aVar.a(context, str3, (String) null, bundle, z)) == null) {
                        str2 = str3;
                    }
                    d dVar = new d(structureType);
                    if (com.joaomgcd.taskerm.n.l.a(invoke)) {
                        return new fr(dVar.invoke(StructureType.JSON, new e(invoke)), str2);
                    }
                    if (com.joaomgcd.taskerm.l.b.a(invoke)) {
                        return new fr(dVar.invoke(StructureType.HTML_XML, new f(invoke)), str2);
                    }
                    if (com.joaomgcd.taskerm.h.c.a(invoke)) {
                        return new fr(dVar.invoke(StructureType.CSV, new g(invoke)), str2);
                    }
                    return null;
                }
                return null;
            }
            return null;
        }

        public static final class d extends c.f.b.l implements c.f.a.m<StructureType, c.f.a.a<? extends com.joaomgcd.taskerm.util.di>, com.joaomgcd.taskerm.util.di> {
            final StructureType f13597a;

            d(StructureType structureType) {
                super(2);
                this.f13597a = structureType;
            }

            @Override
            public final com.joaomgcd.taskerm.util.di invoke(StructureType structureType, c.f.a.a<? extends com.joaomgcd.taskerm.util.di> aVar) {
                c.f.b.k.b(structureType, "acceptableType");
                c.f.b.k.b(aVar, "constructor");
                if (com.joaomgcd.taskerm.util.an.a(this.f13597a, StructureType.None, StructureType.Auto, structureType)) {
                    return (com.joaomgcd.taskerm.util.di) com.joaomgcd.taskerm.util.an.a((c.f.a.b) null, new AnonymousClass1(aVar), 1, (Object) null);
                }
                return null;
            }

            public static final class AnonymousClass1 extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.util.di> {
                final c.f.a.a f13598a;

                AnonymousClass1(c.f.a.a aVar) {
                    super(0);
                    this.f13598a = aVar;
                }

                @Override
                public final com.joaomgcd.taskerm.util.di invoke() {
                    return (com.joaomgcd.taskerm.util.di) this.f13598a.invoke();
                }
            }
        }

        public static final class e extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.n.k> {
            final String f13599a;

            e(String str) {
                super(0);
                this.f13599a = str;
            }

            @Override
            public final com.joaomgcd.taskerm.n.k invoke() {
                return new com.joaomgcd.taskerm.n.k(this.f13599a);
            }
        }

        public static final class f extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.l.a> {
            final String f13600a;

            f(String str) {
                super(0);
                this.f13600a = str;
            }

            @Override
            public final com.joaomgcd.taskerm.l.a invoke() {
                return new com.joaomgcd.taskerm.l.a(this.f13600a);
            }
        }

        public static final class g extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.h.b> {
            final String f13601a;

            g(String str) {
                super(0);
                this.f13601a = str;
            }

            @Override
            public final com.joaomgcd.taskerm.h.b invoke() {
                return new com.joaomgcd.taskerm.h.b(this.f13601a);
            }
        }

        public final String b(Bundle bundle, String str) {
            return com.joaomgcd.taskerm.util.ao.A(bundle.getString(str));
        }

        public final net.dinglisch.android.taskerm.r c(String str) {
            c.f.b.k.b(str, "variableNameInput");
            c.l.k kVar = new c.l.k("(.+?)([\\d]+)$");
            c.l.k kVar2 = new c.l.k("(.+?)\\(([\\d]+)\\)$");
            String str2 = str;
            c.l.i c2 = kVar.c(str2);
            if (c2 == null) {
                c2 = kVar2.c(str2);
            }
            if (c2 != null) {
                String str3 = c2.d().get(1);
                Integer c3 = c.l.n.c(c2.d().get(2));
                if (c3 != null) {
                    return new net.dinglisch.android.taskerm.r(str3, c3.intValue());
                }
                return null;
            }
            return null;
        }

        public final boolean a(String str, String str2) {
            c.f.b.k.b(str, "input");
            c.f.b.k.b(str2, "variable");
            a aVar = this;
            net.dinglisch.android.taskerm.r c2 = aVar.c(str2);
            if (c2 != null) {
                net.dinglisch.android.taskerm.r c3 = aVar.c(str);
                if (c3 != null) {
                    return gx.a(str, c2.a(), true) && (c3.b() == c2.b());
                }
                return false;
            }
            return gx.a(str, str2, true);
        }

        public final String a(Context context, String str, String str2, Bundle bundle, boolean z) {
            StringBuilder sb;
            c.f.b.k.b(context, "context");
            String A = com.joaomgcd.taskerm.util.ao.A(str);
            if (A != null) {
                if (!z) {
                    a aVar = this;
                    if (aVar.b(A)) {
                        List<String> h2 = aVar.h(A);
                        String str3 = h2.get(0);
                        String str4 = h2.get(1);
                        String a2 = aVar.a(context, str3, (String) null, bundle, z);
                        if (a2 != null) {
                            if (com.joaomgcd.taskerm.n.l.a(a2) || com.joaomgcd.taskerm.l.b.a(a2) || com.joaomgcd.taskerm.h.c.a(a2)) {
                                return gx.o(str3) ? aVar.b(context, str, str2, bundle, z) : aVar.c(context, str, str2, bundle, z);
                            }
                            if (aVar.f(A)) {
                                sb = new StringBuilder();
                                sb.append(a2);
                                sb.append('.');
                                sb.append(str4);
                            } else {
                                sb = new StringBuilder();
                                sb.append(a2);
                                sb.append('[');
                                sb.append(str4);
                                sb.append(']');
                            }
                            return sb.toString();
                        }
                        return str2;
                    }
                }
                return gx.o(A) ? b(context, str, str2, bundle, z) : gx.b(context, A, str2);
            }
            return str2;
        }

        public final com.joaomgcd.taskerm.notification.an a() {
            return new com.joaomgcd.taskerm.notification.an("easystructureread", "Easy Data Reading", "Notifications related to easily reading data with Tasker like JSON or HTML.", 5, null, null, false, null, false, null, null, 2032, null);
        }

        public final com.joaomgcd.taskerm.notification.av b() {
            return new com.joaomgcd.taskerm.notification.av((int) R.drawable.mw_action_line_style);
        }

        private final <T> T a(Bundle bundle, Context context, String str, c.f.a.a<? extends T> aVar, c.f.a.b<? super String, ? extends T> bVar, c.f.a.m<? super Bundle, ? super String, ? extends T> mVar) {
            if (bundle != null && str != null) {
                a aVar2 = this;
                if (aVar2.b(str)) {
                    String str2 = aVar2.h(str).get(0);
                    return !com.joaomgcd.taskerm.util.ao.x(str2) ? bVar.invoke(str2) : mVar.invoke(bundle, str2);
                }
            }
            return aVar.invoke();
        }

        public final StructureType a(Bundle bundle, Context context, String str) {
            c.f.b.k.b(context, "context");
            return (StructureType) a(bundle, context, str, h.f13602a, new i(context), j.f13604a);
        }

        public static final class i extends c.f.b.l implements c.f.a.b<String, StructureType> {
            final Context f13603a;

            i(Context context) {
                super(1);
                this.f13603a = context;
            }

            @Override
            public final StructureType invoke(String str) {
                c.f.b.k.b(str, "realVarName");
                return com.joaomgcd.taskerm.structuredoutput.b.f9043a.a(this.f13603a, str);
            }
        }

        public static final class j extends c.f.b.l implements c.f.a.m<Bundle, String, StructureType> {
            public static final j f13604a = new j();

            j() {
                super(2);
            }

            @Override
            public final StructureType invoke(Bundle bundle, String str) {
                c.f.b.k.b(bundle, "bundle");
                c.f.b.k.b(str, "realVarName");
                return gy.f13587a.a(bundle, str);
            }
        }

        public final StructureType a(Bundle bundle, String str) {
            String i2;
            int i3;
            if (bundle == null || str == null || (i2 = i(str)) == null || (i3 = bundle.getInt(i2)) == 0) {
                return null;
            }
            return (StructureType) ((Enum) com.joaomgcd.taskerm.util.an.a(i3, StructureType.class));
        }

        public final boolean b(Bundle bundle, Context context, String str) {
            return ((Boolean) a(bundle, context, str, w.f13626a, new x(context), y.f13628a)).booleanValue();
        }

        public final StructureType a(String str, Context context) {
            if (str != null) {
                a aVar = this;
                if (aVar.b(str)) {
                    return com.joaomgcd.taskerm.structuredoutput.b.f9043a.a(context, aVar.h(str).get(0));
                }
                return null;
            }
            return null;
        }

        public static final class m extends c.f.b.l implements c.f.a.b<String, String> {
            final Bundle f13608a;

            m(Bundle bundle) {
                super(1);
                this.f13608a = bundle;
            }

            @Override
            public final String invoke(String str) {
                c.f.b.k.b(str, "it");
                return gy.f13587a.b(this.f13608a, str);
            }
        }

        public static final class n extends c.f.b.l implements c.f.a.b<String, StructureType> {
            final Bundle f13609a;
            final Context f13610b;
            final String f13611c;

            n(Bundle bundle, Context context, String str) {
                super(1);
                this.f13609a = bundle;
                this.f13610b = context;
                this.f13611c = str;
            }

            @Override
            public final StructureType invoke(String str) {
                c.f.b.k.b(str, "it");
                return gy.f13587a.a(this.f13609a, this.f13610b, this.f13611c);
            }
        }

        private final String b(Context context, String str, String str2, Bundle bundle, boolean z) {
            return bundle == null ? str2 : a(context, str, str2, bundle, z, new m(bundle), new n(bundle, context, str));
        }

        public static final class k extends c.f.b.l implements c.f.a.b<String, String> {
            final Context f13605a;
            final String f13606b;

            k(Context context, String str) {
                super(1);
                this.f13605a = context;
                this.f13606b = str;
            }

            @Override
            public final String invoke(String str) {
                c.f.b.k.b(str, "it");
                return gx.b(this.f13605a, str, this.f13606b);
            }
        }

        public static final class l extends c.f.b.l implements c.f.a.b<String, StructureType> {
            final Context f13607a;

            l(Context context) {
                super(1);
                this.f13607a = context;
            }

            @Override
            public final StructureType invoke(String str) {
                c.f.b.k.b(str, "it");
                return gy.f13587a.a(str, this.f13607a);
            }
        }

        private final String c(Context context, String str, String str2, Bundle bundle, boolean z) {
            return a(context, str, str2, bundle, z, new k(context, str2), new l(context));
        }

        private final String a(Context context, String str, String str2, Bundle bundle, boolean z, c.f.a.b<? super String, String> bVar, c.f.a.b<? super String, ? extends StructureType> bVar2) {
            String str3;
            StringBuilder sb;
            String str4;
            StringBuilder sb2;
            if (str == null) {
                return str2;
            }
            if (z) {
                String invoke = bVar.invoke(str);
                return invoke != null ? invoke : str2;
            }
            a aVar = this;
            if (!aVar.b(str)) {
                String invoke2 = bVar.invoke(str);
                return invoke2 != null ? invoke2 : str2;
            }
            StructureType invoke3 = bVar2.invoke(str);
            if (invoke3 == null) {
                List<String> h2 = aVar.h(str);
                String A = com.joaomgcd.taskerm.util.ao.A(bVar.invoke(h2.get(0)));
                if (A != null) {
                    if (aVar.f(str)) {
                        sb2 = new StringBuilder();
                        sb2.append(A);
                        sb2.append('.');
                        sb2.append(h2.get(1));
                    } else {
                        sb2 = new StringBuilder();
                        sb2.append(A);
                        sb2.append('[');
                        sb2.append(h2.get(1));
                        sb2.append(']');
                    }
                    return sb2.toString();
                }
                return str2;
            }
            fr a2 = aVar.a(context, str, invoke3, bundle, z, bVar);
            if (a2 == null) {
                String invoke4 = bVar.invoke(str);
                if (invoke4 != null) {
                    if (com.joaomgcd.taskerm.n.l.a(invoke4) && com.joaomgcd.taskerm.notification.aw.f8309b.b(context, "potentialjsonalert")) {
                        com.joaomgcd.taskerm.n.k kVar = (com.joaomgcd.taskerm.n.k) com.joaomgcd.taskerm.util.an.a((c.f.a.b) null, new t(invoke4), 1, (Object) null);
                        if (kVar != null) {
                            String a3 = kVar.a();
                            if (a3 == null) {
                                a3 = "example";
                            }
                            if (gx.c('%' + a3)) {
                                sb = new StringBuilder();
                                sb.append(str);
                                sb.append('.');
                                sb.append(a3);
                            } else {
                                sb = new StringBuilder();
                                sb.append(str);
                                sb.append('[');
                                sb.append(a3);
                                sb.append(']');
                            }
                            String sb3 = sb.toString();
                            aw.a aVar2 = com.joaomgcd.taskerm.notification.aw.f8309b;
                            String a4 = com.joaomgcd.taskerm.util.an.a((int) R.string.json_reading, context, new Object[0]);
                            Object[] objArr = new Object[2];
                            objArr[0] = sb3;
                            Object a5 = kVar.a(a3);
                            objArr[1] = (a5 == null || (r0 = a5.toString()) == null) ? "null" : "null";
                            str3 = "potentialhtmlalert";
                            com.joaomgcd.taskerm.rx.h.a(aVar2.b(context, "potentialjsonalert", a4, com.joaomgcd.taskerm.util.an.a((int) R.string.json_reading_tip, context, objArr), new o(context, str)), context, q.f13616a);
                        }
                        if (invoke4 != null) {
                            return invoke4;
                        }
                    } else {
                        str3 = "potentialhtmlalert";
                    }
                    if (com.joaomgcd.taskerm.l.b.a(invoke4) && com.joaomgcd.taskerm.notification.aw.f8309b.b(context, str3) && ((com.joaomgcd.taskerm.l.a) com.joaomgcd.taskerm.util.an.a((c.f.a.b) null, new s(invoke4), 1, (Object) null)) != null) {
                        com.joaomgcd.taskerm.rx.h.a(com.joaomgcd.taskerm.notification.aw.f8309b.b(context, str3, com.joaomgcd.taskerm.util.an.a((int) R.string.html_reading, context, new Object[0]), com.joaomgcd.taskerm.util.an.a((int) R.string.html_reading_tip, context, str + "[div]"), new p(context, str)), context, r.f13617a);
                    }
                    if (invoke4 != null) {
                    }
                }
                return str2;
            }
            com.joaomgcd.taskerm.util.di c2 = a2.c();
            String d2 = a2.d();
            if (c2 != null && (str4 = (String) com.joaomgcd.taskerm.util.an.a((c.f.a.b) null, new u(c2, bundle, context, str, d2), 1, (Object) null)) != null) {
                return str4;
            }
            return str2;
        }

        public static final class t extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.n.k> {
            final String f13619a;

            t(String str) {
                super(0);
                this.f13619a = str;
            }

            @Override
            public final com.joaomgcd.taskerm.n.k invoke() {
                return new com.joaomgcd.taskerm.n.k(this.f13619a);
            }
        }

        public static final class s extends c.f.b.l implements c.f.a.a<com.joaomgcd.taskerm.l.a> {
            final String f13618a;

            s(String str) {
                super(0);
                this.f13618a = str;
            }

            @Override
            public final com.joaomgcd.taskerm.l.a invoke() {
                return new com.joaomgcd.taskerm.l.a(this.f13618a);
            }
        }

        public static final class u extends c.f.b.l implements c.f.a.a<String> {
            final com.joaomgcd.taskerm.util.di f13620a;
            final Bundle f13621b;
            final Context f13622c;
            final String f13623d;
            final String f13624e;

            u(com.joaomgcd.taskerm.util.di diVar, Bundle bundle, Context context, String str, String str2) {
                super(0);
                this.f13620a = diVar;
                this.f13621b = bundle;
                this.f13622c = context;
                this.f13623d = str;
                this.f13624e = str2;
            }

            @Override
            public final String invoke() {
                Object a2;
                if (this.f13620a instanceof com.joaomgcd.taskerm.n.k) {
                    a2 = ((com.joaomgcd.taskerm.n.k) this.f13620a).a(this.f13624e, gy.f13587a.b(this.f13621b, this.f13622c, this.f13623d));
                } else {
                    a2 = this.f13620a.a(this.f13624e);
                }
                if (a2 != null) {
                    return com.joaomgcd.taskerm.util.an.a(a2, (Integer) 10);
                }
                return null;
            }
        }

        public final aq a(Context context, String str, Bundle bundle, String str2) {
            String A;
            ArrayList arrayList;
            com.joaomgcd.taskerm.util.di a2;
            List<Object> b2;
            c.f.b.k.b(context, "context");
            if (str == null || bundle == null || !gx.e(str)) {
                return null;
            }
            a aVar = this;
            StructureType a3 = aVar.a(bundle, context, str);
            b bVar = new b(bundle, context, str);
            if (a3 != null) {
                fr a4 = aVar.a(context, str, a3, bundle, false, (c.f.a.b<? super String, String>) new c(bundle, context));
                if (a4 == null || (a2 = a4.a()) == null || (b2 = a2.b(a4.b())) == null) {
                    arrayList = null;
                } else {
                    List<Object> list = b2;
                    ArrayList arrayList2 = new ArrayList(c.a.j.a((Iterable) list, 10));
                    for (Object obj : list) {
                        arrayList2.add(com.joaomgcd.taskerm.util.an.a(obj, (Integer) 10));
                    }
                    arrayList = arrayList2;
                }
                if (arrayList != null) {
                    return bVar.invoke(arrayList);
                }
            }
            if (aVar.b(str) && (A = com.joaomgcd.taskerm.util.ao.A(aVar.a(context, str, str, bundle, false))) != null) {
                StringBuilder sb = new StringBuilder();
                sb.append(A);
                sb.append('(');
                if (str2 == null) {
                    str2 = "";
                }
                sb.append(str2);
                sb.append(')');
                String sb2 = sb.toString();
                if (sb2 != null) {
                    return new aq(null, c.a.j.a(sb2), null, 5, null);
                }
            }
            return null;
        }

        public static final class b extends c.f.b.l implements c.f.a.b<List<? extends String>, aq> {
            final Bundle f13592a;
            final Context f13593b;
            final String f13594c;

            b(Bundle bundle, Context context, String str) {
                super(1);
                this.f13592a = bundle;
                this.f13593b = context;
                this.f13594c = str;
            }

            @Override
            public final aq invoke(List<String> list) {
                ArrayList arrayList;
                c.f.b.k.b(list, "result");
                Object clone = this.f13592a.clone();
                if (clone == null) {
                    throw new c.q("null cannot be cast to non-null type android.os.Bundle");
                }
                Bundle bundle = (Bundle) clone;
                gx.a(this.f13593b, this.f13594c, list, bundle);
                if (gx.o(this.f13594c)) {
                    arrayList = null;
                } else {
                    List<String> list2 = list;
                    ArrayList arrayList2 = new ArrayList(c.a.j.a((Iterable) list2, 10));
                    int i = 0;
                    for (Object obj : list2) {
                        int i2 = i + 1;
                        if (i < 0) {
                            c.a.j.b();
                        }
                        String str = (String) obj;
                        arrayList2.add(this.f13594c + i2);
                        i = i2;
                    }
                    arrayList = arrayList2;
                }
                return new aq(bundle, null, arrayList, 2, null);
            }
        }

        public static final class c extends c.f.b.l implements c.f.a.b<String, String> {
            final Bundle f13595a;
            final Context f13596b;

            c(Bundle bundle, Context context) {
                super(1);
                this.f13595a = bundle;
                this.f13596b = context;
            }

            @Override
            public final String invoke(String str) {
                c.f.b.k.b(str, "it");
                return gx.o(str) ? gy.f13587a.b(this.f13595a, str) : gx.e(this.f13596b, str);
            }
        }

        public static void a(a aVar, Bundle bundle, String str, StructureType structureType, Context context, Boolean bool, int i2, Object obj) {
            if ((i2 & 8) != 0) {
                context = null;
            }
            Context context2 = context;
            if ((i2 & 16) != 0) {
                bool = null;
            }
            aVar.a(bundle, str, structureType, context2, bool);
        }

        public final void a(Bundle bundle, String str, StructureType structureType, Context context, Boolean bool) {
            if (bundle == null || str == null) {
                return;
            }
            a aVar = this;
            if (aVar.d(str)) {
                return;
            }
            String i2 = aVar.i(str);
            if (structureType == null) {
                bundle.remove(i2);
                return;
            }
            boolean booleanValue = bool != null ? bool.booleanValue() : false;
            int valueForBundle = structureType.getValueForBundle();
            if (!gx.o(str)) {
                if (context != null) {
                    com.joaomgcd.taskerm.structuredoutput.b.f9043a.a(context, str, structureType);
                    com.joaomgcd.taskerm.structuredoutput.a.f9042a.a(context, str, booleanValue);
                    return;
                }
                return;
            }
            bundle.putInt(i2, valueForBundle);
            String j2 = aVar.j(str);
            if (!booleanValue) {
                bundle.remove(j2);
            } else {
                bundle.putBoolean(j2, booleanValue);
            }
        }

        public final boolean d(String str) {
            if (str != null) {
                return c.l.n.b(str, "#@superstructuretypeyeaaahh@#", false, 2, (Object) null);
            }
            return false;
        }

        private final String i(String str) {
            if (gy.f13587a.d(str)) {
                return str;
            }
            return str + "#@superstructuretypeyeaaahh@#";
        }

        public final String e(String str) {
            c.f.b.k.b(str, "regularVarName");
            return i(str);
        }

        public final String j(String str) {
            if (gy.f13587a.d(str)) {
                return str;
            }
            return str + "#@ohmyjsonsmartsearchdisabledOHNO!@#";
        }

        public final String a(Context context, String str, String str2, Bundle bundle) {
            c.f.b.k.b(context, "context");
            c.f.b.k.b(str, "arrayName");
            c.f.b.k.b(str2, "arrayJoiner");
            return c.a.j.a(com.joaomgcd.taskerm.util.ao.b(str, context, bundle), str2, null, null, 0, null, null, 62, null);
        }

        public final List<String> b(Context context, String str, String str2, Bundle bundle) {
            c.f.b.k.b(context, "context");
            c.f.b.k.b(str, "arrayName");
            c.f.b.k.b(str2, "indexes");
            ArrayList arrayList = new ArrayList();
            for (String str3 : c.l.n.b((CharSequence) str2, new String[]{","}, false, 0, 6, (Object) null)) {
                Integer c2 = c.l.n.c(str3);
                if (c2 != null) {
                    arrayList.add(c2);
                }
            }
            return a(context, str, arrayList, bundle);
        }

        public final List<String> a(Context context, String str, List<Integer> list, Bundle bundle) {
            c.f.b.k.b(context, "context");
            c.f.b.k.b(str, "arrayName");
            c.f.b.k.b(list, "indexes1Based");
            List<Integer> list2 = list;
            ArrayList arrayList = new ArrayList(c.a.j.a((Iterable) list2, 10));
            for (Number number : list2) {
                arrayList.add(Integer.valueOf(number.intValue() - 1));
            }
            ArrayList arrayList2 = arrayList;
            ArrayList arrayList3 = new ArrayList();
            int i2 = 0;
            for (Object obj : com.joaomgcd.taskerm.util.ao.b(str, context, bundle)) {
                int i3 = i2 + 1;
                if (i2 < 0) {
                    c.a.j.b();
                }
                String str2 = (String) obj;
                if (arrayList2.contains(Integer.valueOf(i2))) {
                    arrayList3.add(obj);
                }
                i2 = i3;
            }
            return arrayList3;
        }

        public final ar c(Context context, String str, String str2, Bundle bundle) {
            c.f.b.k.b(context, "context");
            c.f.b.k.b(str, "expr");
            c.f.b.k.b(str2, "lookupVarName");
            ar arVar = new ar(c.a.j.a("0"), null);
            String str3 = str;
            boolean z = false;
            c.l.i a2 = c.l.k.a(c.l.n.b((CharSequence) str3, (CharSequence) "~R", false, 2, (Object) null) ? d() : c(), str3, 0, 2, null);
            if (a2 != null) {
                List<String> d2 = a2.d();
                String str4 = (String) c.a.j.a((List<? extends Object>) d2, 3);
                String str5 = str4;
                if ((str5 == null || str5.length() == 0) ? true : true) {
                    bo.d("Variables", "empty content specifier for $?");
                    return arVar;
                }
                List<Integer> a3 = com.joaomgcd.taskerm.util.an.a((List) gx.a(context, str2, gx.b(context, str4, bundle), bundle));
                return a3 != null ? new ar(a(context, str2, a3, bundle), com.joaomgcd.taskerm.util.ao.A((String) c.a.j.a((List<? extends Object>) d2, 1))) : arVar;
            }
            return arVar;
        }

        public static final class C0296a extends c.f.b.l implements c.f.a.a<SharedPreferences.Editor> {
            final Context f13591a;

            C0296a(Context context) {
                super(0);
                this.f13591a = context;
            }

            @Override
            public final SharedPreferences.Editor invoke() {
                return gx.a(this.f13591a).edit();
            }
        }

        public final void a(Context context, List<String> list, Bundle bundle) {
            c.f.b.k.b(context, "context");
            if (list == null) {
                return;
            }
            c.e a2 = c.f.a(new C0296a(context));
            c.j.g gVar = f13590a[2];
            boolean z = false;
            for (String str : list) {
                if (!gx.o(str)) {
                    ((SharedPreferences.Editor) a2.b()).remove(str);
                    z = true;
                } else if (bundle != null) {
                    bundle.remove(str);
                }
            }
            if (z) {
                ((SharedPreferences.Editor) a2.b()).commit();
            }
        }

        public final void a(Context context) {
            c.f.b.k.b(context, "context");
            if (net.dinglisch.android.taskerm.q.a(context)) {
                return;
            }
            com.joaomgcd.taskerm.rx.h.a(aw.a.a(com.joaomgcd.taskerm.notification.aw.f8309b, context, "winvarwihtoutaccessibility", com.joaomgcd.taskerm.util.an.a((int) R.string.win_var_without_accessibility, context, new Object[0]), com.joaomgcd.taskerm.util.an.a((int) R.string.win_var_without_accessibility_explained, context, new Object[0]), null, 16, null), context, v.f13625a);
        }
    }

    static final class b extends c.f.b.l implements c.f.a.a<c.l.k> {
        public static final b f13629a = new b();

        b() {
            super(0);
        }

        @Override
        public final c.l.k invoke() {
            return new c.l.k("^\\$((.|\n)*)\\?(.+)");
        }
    }

    static final class c extends c.f.b.l implements c.f.a.a<c.l.k> {
        public static final c f13630a = new c();

        c() {
            super(0);
        }

        @Override
        public final c.l.k invoke() {
            return new c.l.k("^\\$((.|\n)*)\\?(!?~R.+)");
        }
    }
}