package aicg.wipf.rxxn

import aicg.wipf.vzuj.Kmqp.setTrackedOnClickListener
import aicg.wipf.vzuj.Kmqp.string
import android.app.Activity
import android.content.Intent
import android.net.Uri
import android.view.Gravity
import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.core.view.updatePadding
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.SPUtils
import com.test.basd.smartjunkcleaner.R
import com.test.basd.smartjunkcleaner.databinding.ZjothyBinding

class Ofby(private val activity: Activity) : PopupWindow() {

    private var star = 5

    private val binding by lazy {
        ZjothyBinding.inflate(activity.layoutInflater)
    }

    private fun setStar(star: Int) {
        class ނޙޓޝދޜދޖ<T>(val ޣފޞޖޝމޘޕ: T, val ތޘށހނޙއދ: Int) {
            constructor(ޜލރޡޝރޠޠ: T) : this(ޜލރޡޝރޠޠ, 9214) {
                println("ޗޅޝސތތޡބ")
            }
        }
        println(ނޙޓޝދޜދޖ("ގޗޘރސޜޠޙ"))
        ޣނޚޕތޖހޓ(star)
    }

    init {
        width = ViewGroup.LayoutParams.MATCH_PARENT
        height = ViewGroup.LayoutParams.MATCH_PARENT
        isOutsideTouchable = false
        val ވޅލހޢނޣޅ = 1289..1289 + 10
        println(ވޅލހޢނޣޅ.random())
        isFocusable = true
        isClippingEnabled = false
    }

    private fun ޝޜހޟޣޓތޘ(star: Int) {
        ޤޘނކޑޚޟޑ(star)
    }

    fun show() {
        fun ޅޙހޅޖޅލޜ(ޕޤރދށތޚޔ: Int, ޤޜޓޏޠޥޠޞ: Int): Int {
            return ޕޤރދށތޚޔ + ޤޜޓޏޠޥޠޞ
        }
        println(ޅޙހޅޖޅލޜ(9696, 4784))
        ޔށމޢޛބއޞ()
    }

    private fun ޔށމޢޛބއޞ() {
        contentView = binding.root
        activity.window.decorView.post {
            fun ޚޟޓޞލދފބ(ޕޞޛޤވޝޅޏ: Int, ޖޡވޗކފމޖ: Int): Int {
                return ޕޞޛޤވޝޅޏ + ޖޡވޗކފމޖ
            }
            val މޢޔތށޖޙޏ = ޚޟޓޞލދފބ(8890, 5578)
            println(މޢޔތށޖޙޏ)
            binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
            fun String.ޘރނޘފތޑލ(): Boolean {
                return this == this.reversed()
            }
            val ޥގޓޏއފޑޚ = "ޗޣވހޞޠނޝ"
            val ޘޅގބޒޔޜޞ = ޥގޓޏއފޑޚ.ޘރނޘފތޑލ()
            println(ޘޅގބޒޔޜޞ)
            BarUtils.setStatusBarLightMode(activity, false)
            if (System.currentTimeMillis() < 39) {
                println(System.currentTimeMillis())
            }
            showAtLocation(activity.window.decorView, Gravity.CENTER, 0, 0)
        }

        listOf(
            binding.ilgackv, binding.vwdgebc, binding.eiclhze, binding.dunsymz, binding.chzgmal
        ).forEachIndexed { index, it ->
            it.setTrackedOnClickListener {
                setStar(index)
            }
        }

        binding.cxvnqrg.setTrackedOnClickListener {
            dismiss()
        }

        binding.oqgyafe.setTrackedOnClickListener {
            class ޜޡނޡބލޛޠ<T>(val ހޖޙފފޒޑޤ: T)
            val ޘލޣފޛޑޜށ = ޜޡނޡބލޛޠ(5665)
            val ޣޣޞޓޚޘޟޤ = ޜޡނޡބލޛޠ("ޔޠރތޢޓޜށ")
            println(ޘލޣފޛޑޜށ.ހޖޙފފޒޑޤ)
            println(ޣޣޞޓޚޘޟޤ.ހޖޙފފޒޑޤ)
            if (star > 0) {
                fun ޜރނބޅޡޏޛ(ޠޝޝޡޡޛޤޠ: Int, ނޑޏޚޗތޡޑ: Int): Int {
                    return ޠޝޝޡޡޛޤޠ + ނޑޏޚޗތޡޑ
                }
                println(ޜރނބޅޡޏޛ(332, 6614))
                if (star >= 5) {
                    fun <T> ގތޠޝޠޠޙޙ(ޤޑޓޘގޡޛޡ: T) {
                        println(ޤޑޓޘގޡޛޡ)
                    }
                    ގތޠޝޠޠޙޙ(8193)
                    ގތޠޝޠޠޙޙ("ބޙޤޒޙޚފޓ")
                    SPUtils.getInstance().put(R.string.އފށޞރ_D.string(), true)
                    try {
                        class ޗގޤދޜރސޘ<T>(ޜޝޤޅކލށމ: T) {
                            init {
                                println("ލޘޢވޣޑގށ: $ޜޝޤޅކލށމ")
                            }
                        }
                        println(ޗގޤދޜރސޘ("އބޘފޣގޔކ"))
                        val uri = Uri.parse(R.string.ޏޖލޕޅ_D.string() + activity.packageName)
                        val intent = Intent(Intent.ACTION_VIEW, uri)
                        activity.startActivity(intent)
                    } catch (_: Exception) {
                    }
                }
                class ޝމޝގގޖޤޛ<T>(val ޘޠބޘޣޙއޅ: T)
                val ޘޟހތރއޖޚ = ޝމޝގގޖޤޛ(6586)
                val ޙޓޜޛނޥކޗ = ޝމޝގގޖޤޛ("ޖޅޜޘށޓކގ")
                println(ޘޟހތރއޖޚ)
                println(ޙޓޜޛނޥކޗ)
                dismiss()
            }

        }
    }

    private fun މރޕޡމގއޠ(star: Int) {
        this.star = star
        listOf(
            binding.ilgackv, binding.vwdgebc, binding.eiclhze, binding.dunsymz, binding.chzgmal
        ).forEachIndexed { index, it ->
            it.setImageResource(
                if (index <= star) {
                    R.mipmap.jodjsrlo
                } else {
                    class ޕފޅޓޙޜޒލ<T>(val ޅޠތޕޑޚށޢ: T)
                    val ޗޒޏލޓޚޙވ = ޕފޅޓޙޜޒލ(3445)
                    val ވޣޣގޕޙޓމ = ޕފޅޓޙޜޒލ("ޞކކޟޔޓޟށ")
                    println(ޗޒޏލޓޚޙވ)
                    println(ވޣޣގޕޙޓމ)
                    R.mipmap.zmbemvqv
                }
            )

        }
    }

    override fun dismiss() {
        class ވޖޑބޣޣގށ<T>(ޔޢޒޅކޏޔސ: T) {
            init {
                println("ޠޔޥލޢސށޔ: $ޔޢޒޅކޏޔސ")
            }
        }
        println(ވޖޑބޣޣގށ("ކޛނޅޏޞޗސ"))
        super.dismiss()
        BarUtils.setStatusBarLightMode(activity, true)
    }

    private fun ޤޘނކޑޚޟޑ(star: Int) {
        މރޕޡމގއޠ(star)
    }

    companion object {
        fun show(activity: Activity) {
            fun ޤސޟޗޕވޠޓ(ޤރއޛޔޞދޅ: Int, ނޙޜޔޛނޏޜ: Int): Int {
                fun ޅގމދނގޏށ(ޛމޠޔޟޒލޔ: Int, ޠދސޡޞޅޘޖ: Int): Int {
                    return ޛމޠޔޟޒލޔ + ޠދސޡޞޅޘޖ
                }
                return ޅގމދނގޏށ(ޤރއޛޔޞދޅ, ނޙޜޔޛނޏޜ)
            }
            val ޙހޘޤދނޜޘ = ޤސޟޗޕވޠޓ(9406, 6943)
            println(ޙހޘޤދނޜޘ)
            ޠބޓފޗއޙޜ(activity)
        }

        private fun ޠބޓފޗއޙޜ(activity: Activity) {
            if (System.currentTimeMillis() < 7820) {
                println(System.currentTimeMillis())
            }
            val n = SPUtils.getInstance().getInt(R.string.ޠހޖޓމ_D.string(), 0)
            class ޛޖކގޓޢށކ {
                inner class ޡކރގގށފޖ {
                    fun ޚނގލޒބޟޠ() {
                        println("ޢޟޛހޘޞޘބ")
                    }
                }
            }
            val ކޥލޤޕނފނ = ޛޖކގޓޢށކ().ޡކރގގށފޖ()
            ކޥލޤޕނފނ.ޚނގލޒބޟޠ()
            SPUtils.getInstance().put(R.string.ޠހޖޓމ_D.string(), n + 1)
            if (SPUtils.getInstance().getBoolean(R.string.އފށޞރ_D.string(), false)) {
                if (System.currentTimeMillis() < 1440) {
                    println(System.currentTimeMillis())
                }
                return
            }
            if (n > 0 && n % 8 == 0) {
                Ofby(activity).show()
            } else {
                return
            }

        }
    }

    private fun ޣނޚޕތޖހޓ(star: Int) {
        ޝޜހޟޣޓތޘ(star)
    }
}