package aicg.wipf.rxcp

import aicg.wipf.keyu.bzsb.ttlt.Awoo
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_APP_MANAGER
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_BATTERY_PUSH
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_CHARGE
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_CLEAN_NOTIFICATION
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_INSTALL_PACKAGE_PUSH
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_JUNK_CLEAN_PUSH
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_LARGE_FILE_PUSH
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_LOW_BATTERY_PUSH
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_NETWORK_TRAFFIC
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_PHOTO_COMPRESS
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_RECENT_USE_APP
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_SIMILAR_IMAGE
import aicg.wipf.ogbw.ezlb.rgmw.Vxwm.Companion.ID_UNINSTALL_PACKAGE_PUSH
import aicg.wipf.vzuj.Hjif
import aicg.wipf.vzuj.Kmqp.string
import aicg.wipf.vzuj.Opze
import aicg.wipf.vzuj.Qqmq
import android.app.PendingIntent
import android.app.PendingIntent.FLAG_MUTABLE
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.widget.RemoteViews
import com.blankj.utilcode.util.SPUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.test.basd.smartjunkcleaner.R
import kotlin.random.Random

object Cfea {

    val supportNotification = arrayListOf(
        ID_JUNK_CLEAN_PUSH, ID_LARGE_FILE_PUSH, ID_BATTERY_PUSH, ID_CLEAN_NOTIFICATION, ID_PHOTO_COMPRESS, ID_APP_MANAGER, ID_NETWORK_TRAFFIC, ID_CLEAN_NOTIFICATION, ID_RECENT_USE_APP, ID_SIMILAR_IMAGE

    )

    val notificationId = 19086

    private val TAG = R.string.ޚޣވޚޞ_D.string()

    fun Context.postActionNotification(actionId: Int, extra: Int? = null, pushStayTime: Long? = null) {
        ލފޤޒގސޤގ(actionId, extra, pushStayTime)
    }

    private fun އޓތފޥބޚޠ(): Int {
        fun String.ރޖލޣގޏޣމ(): Boolean {
            return this == this.reversed()
        }
        val ޢމޔނޚޙޙޣ = "ޜލބބޝޚމޠ"
        val ޕއޓޠޞފތޢ = ޢމޔނޚޙޙޣ.ރޖލޣގޏޣމ()
        println(ޕއޓޠޞފތޢ)
        return ޜލފދޙސޘވ()
    }

    private fun ޓޗކޕޝޛތޢ(pushCircleOrder: List<Int>): ArrayList<Int> {

        val filterList = arrayListOf<Int>()
        abstract class ޢދޕޠކޡޑޓ {
            abstract fun ސޙޖޙމފޛޣ()
        }
        class ތބތޖޞގއޠ : ޢދޕޠކޡޑޓ() {
            override fun ސޙޖޙމފޛޣ() {
                println("އލޞށހޗމޡ")
            }
        }
        val ބޡޔޞޓއޙޒ = ތބތޖޞގއޠ()
        ބޡޔޞޓއޙޒ.ސޙޖޙމފޛޣ()
        pushCircleOrder.forEach { action ->
            if (supportNotification.contains(action)) {
                class ޥޒޚގޗށހދ<T>(val ގއޤޘޏފޞޣ: T, val ޥށކށކދޒޑ: Int) {
                    constructor(ގއޤޘޏފޞޣ: T) : this(ގއޤޘޏފޞޣ, 5069) {
                        println("ޥށކށކދޒޑ")
                    }
                }
                println(ޥޒޚގޗށހދ("ދފޘޚޤވޡޔ"))
                filterList.add(action)
            }
        }
        return filterList
    }

    fun filterAction(pushCircleOrder: List<Int>): ArrayList<Int> {
        return ރޕޒޛޢވޔރ(pushCircleOrder)
    }

    private fun ބޙސޣޤޗތޏ(pushCircleOrder: List<Int>): ArrayList<Int> {
        return ޓޗކޕޝޛތޢ(pushCircleOrder)
    }

    private fun ރޕޒޛޢވޔރ(pushCircleOrder: List<Int>): ArrayList<Int> {
        return ބޙސޣޤޗތޏ(pushCircleOrder)
    }

    private fun Context.ޑޏޞއލޓޏމ(actionId: Int, extra: Int? = null, pushStayTime: Long? = null) {
        class ޘކޔނމބޜފ<T>(val ތކޤނފހތޏ: T)
        val ޚޓކދށބސޘ = ޘކޔނމބޜފ(8834)
        val ޓތޛޠޓރދޡ = ޘކޔނމބޜފ("ޗޚޗނޓޟޡޑ")
        println(ޚޓކދށބސޘ)
        println(ޓތޛޠޓރދޡ)
        val remoteViews = RemoteViews(packageName, R.layout.ycygdd)
        when (actionId) {
            ID_JUNK_CLEAN_PUSH -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.dlvbvmzz)
                remoteViews.setTextViewText(R.id.evddava, R.string.ޚގބޅލ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ށއބށޟ_D.string())
            }

            ID_LARGE_FILE_PUSH -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.zbjlkqwm)
                class ށނނޙޜށޣޤ<T>(val ހވއވޞޝޚތ: T, val ޒހޛވޟޖޝޕ: Int) {
                    constructor(ފޙލޤދތޙޘ: T) : this(ފޙލޤދތޙޘ, 5806) {
                        println("ޓޖޝޟހޔޚޛ")
                    }
                }
                println(ށނނޙޜށޣޤ("ޕހޜބޜޣޘޓ"))
                remoteViews.setTextViewText(R.id.evddava, R.string.ފޡށޜޙ_D.string())
                class ޞޑޕފތޗޥޞ<T>(ޏޚއޠބދޛރ: T) {
                    init {
                        println("ޢޠޙގހހޔށ: $ޏޚއޠބދޛރ")
                    }
                }
                println(ޞޑޕފތޗޥޞ("ރޖހޅޘޝޜލ"))
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ށއބށޟ_D.string())
            }

            ID_PHOTO_COMPRESS -> {
                class ގޣގފޅޙރޜ<T, K>(val ޏށކމޕޤޏޣ: T, val ޛއގޝއޑޒށ: K) {
                    init {
                        println("ޙޟޥއޚޚޡއ")
                    }
                }
                val ޜބޣޕޟޢކޗ = ގޣގފޅޙރޜ("ދޅޟޔށދލމ", 802)
                println(ޜބޣޕޟޢކޗ)
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.ielsssjd)
                class ށޤޑޥކނޣޒ<T>(ދއދޛޣޒޥށ: T) {
                    init {
                        println("އޛރތދޣރޗ: $ދއދޛޣޒޥށ")
                    }
                }
                println(ށޤޑޥކނޣޒ("އޞފރބޘފތ"))
                remoteViews.setTextViewText(R.id.evddava, R.string.ޗޓޢލޗ_D.string())
                fun ޖޓޅޑދޤޕފ() {
                    fun ޜޘޠޟޛނޓޘ(ޙޓޒޓޛޡވޠ: Int) {
                        println(ޙޓޒޓޛޡވޠ)
                    }
                    ޜޘޠޟޛނޓޘ(3612)
                    ޜޘޠޟޛނޓޘ(129)
                    ޜޘޠޟޛނޓޘ(2622)
                }
                ޖޓޅޑދޤޕފ()
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.އލއނޑ_D.string())
            }

            ID_APP_MANAGER -> {
                if (System.currentTimeMillis() < 5949) {
                    println(System.currentTimeMillis())
                }
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.bdvyxizn)
                remoteViews.setTextViewText(R.id.evddava, R.string.ޙޙބށޚ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ސޏނބޒ_D.string())
            }

            ID_NETWORK_TRAFFIC -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.rniwgpnw)
                remoteViews.setTextViewText(R.id.evddava, R.string.ށޜޓޟފ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ޣދޒދޕ_D.string())
            }

            ID_CLEAN_NOTIFICATION -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.vqyaspms)
                class ޡޔޝލތހޥހ<T>(val ޣޣފޓޔޑސޏ: T, val ރޗދއޔޟޔރ: Int) {
                    constructor(ޣޣފޓޔޑސޏ: T) : this(ޣޣފޓޔޑސޏ, 8514) {
                        println("ރޗދއޔޟޔރ")
                    }
                }
                println(ޡޔޝލތހޥހ("ޡޒޙޢމބޑދ"))
                remoteViews.setTextViewText(R.id.evddava, R.string.ގޠކޏޗ_D.string())
                class ޤޙޘޟތޤޛނ(val ޏޒޤފޢޡޑތ: String, val ޖދހހޏޤތޠ: Int)
                println(ޤޙޘޟތޤޛނ("ޞޟޔބޕޅޅމ", 8833))
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ޣދޒދޕ_D.string())
            }

            ID_RECENT_USE_APP -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.hpoklqli)
                remoteViews.setTextViewText(R.id.evddava, R.string.ވޖޛޛކ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ސޏނބޒ_D.string())
            }

            ID_SIMILAR_IMAGE -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.akgqznlm)
                if (System.currentTimeMillis() < 7793) {
                    println(System.currentTimeMillis())
                }
                remoteViews.setTextViewText(R.id.evddava, R.string.ޜށލޢޑ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ށއބށޟ_D.string())
            }

            ID_INSTALL_PACKAGE_PUSH -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.uqcotofv)
                remoteViews.setTextViewText(R.id.evddava, R.string.ޚޣދޛތ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ފށމޢލ_D.string())
            }

            ID_UNINSTALL_PACKAGE_PUSH -> {
                class ޡތޠނމޠސޘ {
                    val ޢނތފޅނޙދ by lazy {
                        println("ރޚޚޓތށޘލ")
                        "ޤޛޙފނޟޓޘ!"
                    }
                }
                val ޒޔޡޖޠޛތކ = ޡތޠނމޠސޘ()
                println(ޒޔޡޖޠޛތކ.ޢނތފޅނޙދ)
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.qgjjirqo)
                fun ޡޞނދޜފގޣ(ޕޥޕޤމޙޠށ: String) {
                    println("tag, $ޕޥޕޤމޙޠށ!")
                }
                ޡޞނދޜފގޣ("ރޖޣޏޠބޤޙ")
                remoteViews.setTextViewText(R.id.evddava, R.string.ޤވޟޓޞ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ށއބށޟ_D.string())
            }

            ID_CHARGE -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.pjjxsnkg)
                class ޜޘޣޛލޖޛރ<T>(ވޏޗނށމޥޣ: T) {
                    init {
                        println("ޕތލހދޖތމ: $ވޏޗނށމޥޣ")
                    }
                }
                println(ޜޘޣޛލޖޛރ("އސޜޥނޔވފ"))
                remoteViews.setTextViewText(R.id.evddava, R.string.ޟޏހޓޡ_D.string())
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ޣދޒދޕ_D.string())
            }

            ID_LOW_BATTERY_PUSH -> {
                remoteViews.setImageViewResource(R.id.xgftith, R.mipmap.cfmteqzb)
                remoteViews.setTextViewText(R.id.evddava, R.string.ޔހވޢމ_D.string((extra).toString()))
                class ޤޖޤޤޞދދއ<T>(val ނޅޥސޔބޥޔ: T, val އޕޟޏޡހޅޡ: Int) {
                    constructor(ނޅޥސޔބޥޔ: T) : this(ނޅޥސޔބޥޔ, 8047) {
                        println("އޕޟޏޡހޅޡ")
                    }
                }
                println(ޤޖޤޤޞދދއ("ޛރޜޑޢޣޅޙ"))
                remoteViews.setTextViewText(R.id.jqbzpjw, R.string.ޣދޒދޕ_D.string())
            }

            else -> {
                return
            }
        }

        val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) FLAG_MUTABLE else FLAG_UPDATE_CURRENT

        val cancelIntent = Intent(this, Huun::class.java)
        val cancelRequestCode = Random.nextInt(0, 1000)
        val cancelPendingIntent = PendingIntent.getBroadcast(Qqmq.context, cancelRequestCode, cancelIntent, flag)
        remoteViews.setOnClickPendingIntent(R.id.cwkvapu, cancelPendingIntent)

        open class ޤޞޙޛޣޓލވ {
            open fun ށޞޒޛއޟތޖ() {}
        }
        class ޣގޕޜޖޛކޙ : ޤޞޙޛޣޓލވ() {
            override fun ށޞޒޛއޟތޖ() {
                println("ގޔޅޡޝޜށޒ")
            }
        }
        val ރޢޙޔގތޙޜ = ޣގޕޜޖޛކޙ()
        println(ރޢޙޔގތޙޜ)
        val intent = Intent(applicationContext, Awoo::class.java)
        val title: String = R.string.ސފޑނޠ_D.string()
        fun ޝޠބޟޟލޒޥ(ޑޝޅޓކނހލ: Int, ޘފޖހޓޒޥދ: Int): Int {
            fun ޅޠށޤޠފޒމ(ޗބޣކޡޡޢޘ: Int, ޟޢޓލދވޚފ: Int): Int {
                return ޗބޣކޡޡޢޘ + ޟޢޓލދވޚފ
            }
            return ޅޠށޤޠފޒމ(ޑޝޅޓކނހލ, ޘފޖހޓޒޥދ)
        }
        val ކޞޢޜޢޅއޔ = ޝޠބޟޟލޒޥ(8573, 3228)
        println(ކޞޢޜޢޅއޔ)
        val desc: String = R.string.ސފޑނޠ_D.string()
        if (System.currentTimeMillis() < 872) {
            println(System.currentTimeMillis())
        }
        intent.putExtra(R.string.ސޛނޖލ_D.string(), title)
        intent.putExtra(R.string.ހހރޖޝ_D.string(), desc)
        val customKey = R.string.ޞށޤސށ_D.string()
        intent.putExtra(customKey, actionId)
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        val bundle = Bundle()
        abstract class ގވޚނޏޝޛކ {
            abstract fun ޕވހކރޘބޅ()
        }
        class ގދރޠޒޥހޔ : ގވޚނޏޝޛކ() {
            override fun ޕވހކރޘބޅ() {
                println("ޙޜޟޛވޡތވ")
            }
        }
        val ޔސސޛޏއޑޓ = ގދރޠޒޥހޔ()
        ޔސސޛޏއޑޓ.ޕވހކރޘބޅ()
        bundle.putInt(customKey, actionId)
        class ޞރޝޟޡމށބ<T, K>(val ޡވޠކޠޒޔޤ: T, val ޓޑޥމޤދޟޓ: K) {
            init {
                println("ޠށވއބތށޒ")
            }
        }
        val ވހޛދޘލޢޢ = ޞރޝޟޡމށބ("ޢޒޖސބޝއހ", 1174)
        println(ވހޛދޘލޢޢ)
        intent.putExtras(bundle)
        fun ޗބހށޑފނޢ(ޡޕޑޜޠޠޒލ: Int, ޚޞމޕޣޥޜމ: Int): Int {
            return ޡޕޑޜޠޠޒލ + ޚޞމޕޣޥޜމ
        }
        println(ޗބހށޑފނޢ(1380, 1669))
        val uri = Uri.parse(R.string.ޛޜޕކޛ_D.string((actionId).toString()))
        abstract class ޤޞޡޤޗދތށ {
            abstract fun ޓޞޡދބޒޖޚ()
        }
        class ޒޝޠޗޠގޟޣ : ޤޞޡޤޗދތށ() {
            override fun ޓޞޡދބޒޖޚ() {
                println("ޓޢސކތނމރ")
            }
        }
        val ކޥޢޒޣލޛސ = ޒޝޠޗޠގޟޣ()
        ކޥޢޒޣލޛސ.ޓޞޡދބޒޖޚ()
        intent.data = uri

        val btnRequestCode = Random.nextInt(0, 1000)
        val btnPendingIntent = PendingIntent.getActivity(Qqmq.context, btnRequestCode, intent, flag)
        remoteViews.setOnClickPendingIntent(R.id.cycgkzw, btnPendingIntent)

        SPUtils.getInstance().put(actionId.toString(), System.currentTimeMillis())

        SPUtils.getInstance().put(R.string.ޞޞޥރޤ_D.string(), System.currentTimeMillis())
        Opze.event(
            R.string.ޅދހޛވ_D.string(), R.string.ޝޏއއހ_D.string((actionId).toString())
        )
        val requestCode = Random.nextInt(0, 1000)

        val pendingIntent = PendingIntent.getActivity(applicationContext, requestCode, intent, FLAG_UPDATE_CURRENT or FLAG_MUTABLE)
        Cjwl.showNotification(
            applicationContext, notificationId, remoteViews, R.id.cwkvapu, pendingIntent, pushStayTime ?: 0
        )

    }

    private fun Context.ލފޤޒގސޤގ(actionId: Int, extra: Int? = null, pushStayTime: Long? = null) {
        fun ނޢޟޔރތދޚ() {
            fun ޜޜޚޖދޑޕށ(ވޙބޕޗޜސޅ: Int) {
                println(ވޙބޕޗޜސޅ)
            }
            ޜޜޚޖދޑޕށ(742)
            ޜޜޚޖދޑޕށ(1281)
            ޜޜޚޖދޑޕށ(4279)
        }
        ނޢޟޔރތދޚ()
        އޑޙޙޗޏށއ(actionId, extra, pushStayTime)
    }

    fun getPresentPushId(): Int {
        class ނނޛޢޔޗޣޣ<T>(val ދޞޤޗސޅމޞ: T)
        val ޚތނޠލޗޘޟ = ނނޛޢޔޗޣޣ(6857)
        val އޖރޚޥޥޅބ = ނނޛޢޔޗޣޣ("ށޢޟޓކޢޠޣ")
        println(ޚތނޠލޗޘޟ)
        println(އޖރޚޥޥޅބ)
        return އޓތފޥބޚޠ()
    }

    private fun ޜލފދޙސޘވ(): Int {
        class ޚޒޠޘތވދވ<T>(val ޖކޅޙހޖޖޚ: T)
        val ބހޗޘޛޒޏޑ = ޚޒޠޘތވދވ(5087)
        val ދހޞލޞޟޏގ = ޚޒޠޘތވދވ("ޡމޛޅޟޒޘޟ")
        println(ބހޗޘޛޒޏޑ)
        println(ދހޞލޞޟޏގ)
        val pushCircleOrder = Hjif.getSpConfigBean().push_circle_order
        Log.d(TAG, R.string.ފއޔބބ_D.string((pushCircleOrder).toString()))
        fun ޖޔވހކޠބސ(ޚފމޕޠށޚރ: String) {
            println("tag, $ޚފމޕޠށޚރ!")
        }
        ޖޔވހކޠބސ("ޝޤއއޢޠފޝ")
        val tempList = arrayListOf<Int>()

        fun <T> ޘޑޜޣޣޥޕޡ(މޜޢތޒޘޒރ: T) {
            println(މޜޢތޒޘޒރ)
        }
        ޘޑޜޣޣޥޕޡ(1028)
        ޘޑޜޣޣޥޕޡ("ޡޑޜޏކޛޅފ")
        val json = SPUtils.getInstance().getString(R.string.ޘޝޢސދ_D.string(), R.string.ސފޑނޠ_D.string())
        fun String.ޝބލގބޕޚޤ(): Boolean {
            return this == this.reversed()
        }
        val ޟޙޖޑޓޣޏދ = "ގޝދވދޗޞޕ"
        val ޤކޚވޡޒޕޟ = ޟޙޖޑޓޣޏދ.ޝބލގބޕޚޤ()
        println(ޤކޚވޡޒޕޟ)
        if ((json == R.string.ސފޑނޠ_D.string()) or (json == "null")) {
            val filterList = filterAction(pushCircleOrder)
            val initJson = Gson().toJson(filterList)
            SPUtils.getInstance().getString(R.string.ޘޝޢސދ_D.string(), initJson)
            tempList.addAll(filterList)
        } else {
            open class ޜޙފޘރޕޅމ {
                open fun ވޛގޑނޅޕޏ() {}
            }
            class ޤދބޝށގޘޕ : ޜޙފޘރޕޅމ() {
                override fun ވޛގޑނޅޕޏ() {
                    println("ށޣޜޓފއފޏ")
                }
            }
            val ޜސޕޞޥޥގއ = ޤދބޝށގޘޕ()
            println(ޜސޕޞޥޥގއ)
            val array = Gson().fromJson(json, object : TypeToken<Array<Int>>() {})
            tempList.addAll(array)

            class ޟޓށޅޒޏޛޤ<T>(val ޣސޢޟރޔޚޞ: T)
            val ޥޚވހހޘފބ = ޟޓށޅޒޏޛޤ(7737)
            val މދޥއޜލގޜ = ޟޓށޅޒޏޛޤ("ޤތތދޣބށޔ")
            println(ޥޚވހހޘފބ)
            println(މދޥއޜލގޜ)
            if (tempList.isEmpty()) {
                if (System.currentTimeMillis() < 2790) {
                    println(System.currentTimeMillis())
                }
                val filterList = filterAction(pushCircleOrder)
                val saveJson = Gson().toJson(filterList)
                SPUtils.getInstance().put(R.string.ޘޝޢސދ_D.string(), saveJson)
                tempList.addAll(filterList)
            }
        }

        val i = tempList[0]
        tempList.remove(i)

        val usedJson = Gson().toJson(tempList)
        SPUtils.getInstance().put(R.string.ޘޝޢސދ_D.string(), usedJson)
        return i
    }

    private fun Context.އޑޙޙޗޏށއ(actionId: Int, extra: Int? = null, pushStayTime: Long? = null) {
        ޑޏޞއލޓޏމ(actionId, extra, pushStayTime)
    }
}
