package aicg.wipf.vzuj

import android.view.View
import com.test.basd.smartjunkcleaner.R
import org.json.JSONObject
import java.text.SimpleDateFormat
import java.util.Locale

object Kmqp {

    private val aesMap = mutableMapOf<Int, String>()

    private fun Long.ޙޗބޣލތށޏ(): String {
        return ޛކޖޓޏޝގޝ()
    }

    fun Long.toFormatTime(): String {
        return ރނޞމޖށޚޛ()
    }

    private fun Long.ރނޞމޖށޚޛ(): String {
        return ޙޗބޣލތށޏ()
    }

    private fun Collection<View>.ބސލޒޙގޜޏ(listener: (View) -> Unit) {
        ދޚޝޒޥޝޥރ(listener)
    }

    fun Number.toFormatSize(count: Int = 1): String {
        class ޛޝގޜގޓވދ<T, K>(val ޠހއޕރޙޓފ: T, val ރޅޟތވސހމ: K) {
            init {
                println("ޤޥރޣޅޖގޅ")
            }
        }
        val ލޖށށލޙޓޒ = ޛޝގޜގޓވދ("ޅޒވސށއޑޒ", 5597)
        println(ލޖށށލޙޓޒ)
        var suffix = "B"
        var fSize = this.toDouble()
        if (fSize > 1024) {
            suffix = "KB"
            fSize /= 1024.0
        }
        if (fSize > 1024) {
            suffix = "MB"
            val ވސޠތފޛސރ: (Int, Int) -> Int = { ޝފޑޚއބޅޕ, ޟޟޜޜޟތހޑ -> ޝފޑޚއބޅޕ + ޟޟޜޜޟތހޑ }
            println(ވސޠތފޛސރ.invoke(489, 9435))
            fSize /= 1024.0
        }
        if (fSize > 1024) {
            fun ތޒޥޓޡޚޝޘ(ފސޝޣޙޢޔގ: Int, ޕފވޅރއވޡ: Int): Int {
                return ފސޝޣޙޢޔގ + ޕފވޅރއވޡ
            }
            val ޞޛޘޙޗޛޝށ = ތޒޥޓޡޚޝޘ(9833, 2636)
            println(ޞޛޘޙޗޛޝށ)
            suffix = "GB"
            fSize /= 1024.0
        }
        return String.format(R.string.ލޢތސޘ_D.string((count).toString()), fSize, suffix)
    }

    fun String.decode() = Msld.decrypt(this)
        .replace("\\r", "\r")
        .replace("\\n", "\n")
        .replace("\\'", "'")
        .replace("\\\"", "\"")
        .replace("\\?", "?")
        .replace("&amp;", "&")

    fun Int.string(vararg arg: Any) = try {
        (aesMap[this] ?: Qqmq.context.getString(this).decode()).run {
            aesMap[this@string] = this
            val ޞސޓޙހޓޟޝ = { އހނޅމނގޓ: String -> println(އހނޅމނގޓ) }
            ޞސޓޙހޓޟޝ("ޛޟޠޔޜކޏލ!")
            String.format(this, *arg)
        }
    } catch (_: Exception) {
        ""
    }

    private fun Collection<View>.ދޚޝޒޥޝޥރ(listener: (View) -> Unit) {
        class ޑޘށފގޘޠޓ(val ޟލޕޤޅސޖސ: String, val ޣދޜފޚޜޛޢ: Int)
        println(ޑޘށފގޘޠޓ("ޟހޙކޕޗޠޔ", 3491))
        this.forEach {
            val ޅލޚޝމޠށތ = 9878
            val ޤގޥކޚޖޤޜ = 584
            val ވޗޟފގރދހ = ޅލޚޝމޠށތ * ޤގޥކޚޖޤޜ * ޤގޥކޚޖޤޜ
            println(ވޗޟފގރދހ)
            it.setTrackedOnClickListener(listener)
        }
    }

    private fun Long.ޛކޖޓޏޝގޝ(): String {
        class ކސދޞނޥޡރ {
            inner class ޙޙޡމސމޛޙ {
                fun ފޣގސޗހޜގ() {
                    println("ޡވޒޑޅލޞޑ")
                }
            }
        }
        val ޗފޖޕޑޥޡބ = ކސދޞނޥޡރ().ޙޙޡމސމޛޙ()
        ޗފޖޕޑޥޡބ.ފޣގސޗހޜގ()
        return ގލޞޣޔޖޏމ()
    }

    fun Collection<View>.setTrackedOnClickListener(listener: (View) -> Unit) {
        ބސލޒޙގޜޏ(listener)
    }

    private fun View.ޡސޗޖރޟނޒ(action: (view: View) -> Unit) {
        class ޕށޝޡޘޖޏށ<T>(val އފށލޓޤޓޑ: T)
        val ޠދލގޜހޝސ = ޕށޝޡޘޖޏށ(7116)
        val ޒކލޚޖޗމޚ = ޕށޝޡޘޖޏށ("ޜކޘޟޗޓފޗ")
        println(ޠދލގޜހޝސ.އފށލޓޤޓޑ)
        println(ޒކލޚޖޗމޚ.އފށލޓޤޓޑ)
        setOnClickListener {
            action(this)

            val ހޖވޡޘހޑއ: (Int, Int) -> Int = { ވޥމސޢޝޘވ, ޕތޜޚޓލޛދ -> ވޥމސޢޝޘވ + ޕތޜޚޓލޛދ }
            println(ހޖވޡޘހޑއ.invoke(3046, 6787))
            var view: View? = this
            fun ލޡކޗޝއޗލ() {
                fun ޞފދޤކޛޗބ(ޏޅމޔޜޢޏޚ: Int) {
                    println(ޏޅމޔޜޢޏޚ)
                }
                ޞފދޤކޛޗބ(5543)
                ޞފދޤކޛޗބ(6733)
                ޞފދޤކޛޗބ(6705)
            }
            ލޡކޗޝއޗލ()
            while (view != null) {
                try {
                    val obj = JSONObject()
                    obj.put(R.string.ނޖޞއޏ_D.string(), resources.getResourceEntryName(view.id))
                    fun ދމއޙރޅޒޤ(ޞޚޙތށޟޚހ: Int, ޜބޙޡށޏވޝ: Int): Int {
                        return ޞޚޙތށޟޚހ + ޜބޙޡށޏވޝ
                    }
                    println(ދމއޙރޅޒޤ(9759, 1363))
                    Opze.event(R.string.ޚޑޙސޣ_D.string(), ext = obj)
                    class ޘޙޞތސޅނޙ {
                        val ބވށސޣޥކޕ by lazy {
                            println("ކނދޜނޙޛލ")
                            "ޑނޞޜނޗޟސ!"
                        }
                    }
                    val މޙޔޥޖޔޡރ = ޘޙޞތސޅނޙ()
                    println(މޙޔޥޖޔޡރ.ބވށސޣޥކޕ)
                    break
                } catch (_: Exception) {
                    view = view.parent as? View
                }
            }
        }
    }

    private fun Long.ގލޞޣޔޖޏމ(): String {
        return SimpleDateFormat(R.string.ޤޚޝޡމ_D.string(), Locale.getDefault()).format(this)
    }

    fun View.setTrackedOnClickListener(action: (view: View) -> Unit) {
        fun ޚރފވށނޒފ(ޔޖޅޒޜސޜޢ: Int, ޝޒޒލޒޢޤދ: Int): Int {
            return ޔޖޅޒޜސޜޢ + ޝޒޒލޒޢޤދ
        }
        println(ޚރފވށނޒފ(4208, 424))
        ޡސޗޖރޟނޒ(action)
    }
}