package aicg.wipf.keyu.bzsb.fdjl

import aicg.wipf.vzuj.Kmqp.string
import android.app.Activity
import android.graphics.Bitmap
import android.os.Build
import android.util.Log
import android.webkit.CookieManager
import android.webkit.WebChromeClient
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import com.blankj.utilcode.util.SPUtils
import com.test.basd.smartjunkcleaner.R

class Gkbv(listener: WebViewListener, val str: String) {

    var url = str

    private val mWebView = WebView(listener.activity)

    var icon: Bitmap? = null

    private val settings = mWebView.settings

    var title = str

    var progress = 0

    var isHome = false

    private fun ށކޤށހޏބހ() {
        ޣޔށޓޞޢޙތ()
    }

    init {
        mWebView.drawingCacheBackgroundColor = -1
        fun ޝގޣއޅވޒޕ() {
            fun ޒއތގސޝޗޤ(ޒދޟށޗޕހޘ: Int) {
                println(ޒދޟށޗޕހޘ)
            }
            ޒއތގސޝޗޤ(4072)
            ޒއތގސޝޗޤ(484)
            ޒއތގސޝޗޤ(1163)
        }
        ޝގޣއޅވޒޕ()
        mWebView.isFocusableInTouchMode = true
        mWebView.isFocusable = true
        class ޜޘޑޏފފޗޘ {
            inner class ވޙދބޡފވއ {
                fun ޓޝޤކޞޥމޔ() {
                    println("ޔޝޏހކޏރޒ")
                }
            }
        }
        val ނޘތއޞޟވބ = ޜޘޑޏފފޗޘ().ވޙދބޡފވއ()
        ނޘތއޞޟވބ.ޓޝޤކޞޥމޔ()
        mWebView.isDrawingCacheEnabled = false
        mWebView.setWillNotCacheDrawing(true)
        if (Build.VERSION.SDK_INT <= 22) {
            mWebView.isAnimationCacheEnabled = false
            mWebView.isAlwaysDrawnWithCacheEnabled = false
        }
        mWebView.setBackgroundColor(-1)
        mWebView.isScrollbarFadingEnabled = true
        abstract class ޜޗޤޖޕޒޚޘ {
            abstract fun ޖއޞޓޗޘޡށ()
        }
        class ޢޠލޟޕވށޝ : ޜޗޤޖޕޒޚޘ() {
            override fun ޖއޞޓޗޘޡށ() {
                println("ޠޒޠޝތބސޢ")
            }
        }
        val ޞސޢޝޜޣއޝ = ޢޠލޟޕވށޝ()
        ޞސޢޝޜޣއޝ.ޖއޞޓޗޘޡށ()
        mWebView.isSaveEnabled = true
        mWebView.setNetworkAvailable(true)
        fun ގޟވޔޤރބޘ(ށބޒބހޏޢރ: Int, ބޅޚލޣޗޗށ: Int): Int {
            return ށބޒބހޏޢރ + ބޅޚލޣޗޗށ
        }
        println(ގޟވޔޤރބޘ(983, 8085))
        mWebView.webChromeClient = object : WebChromeClient() {
            override fun onProgressChanged(view: WebView?, newProgress: Int) {
                ދޤތކޘޡބޒ(view, newProgress)
            }

            private fun ދޤތކޘޡބޒ(view: WebView?, newProgress: Int) {
                progress = newProgress
                listener.onProgressChanged(newProgress)
            }

            override fun onReceivedTitle(view: WebView?, title: String?) {
                ލވޛޝސޅޢޣ(view, title)
            }

            private fun ލވޛޝސޅޢޣ(view: WebView?, title: String?) {
                ޜޛޓކޢރޠޏ(view, title)
            }

            private fun ޜޛޓކޢރޠޏ(view: WebView?, title: String?) {
                Log.d("ޗމކޥމޖޜރ", "ޗމކޥމޖޜރ")
                ސޜޡހތވޓޛ(view, title)
            }

            private fun ސޜޡހތވޓޛ(view: WebView?, title: String?) {
                this@Gkbv.title = title?.takeIf { it.isNotBlank() } ?: str
                listener.onReceivedTitle(title ?: str)
            }

            override fun onReceivedIcon(view: WebView?, icon: Bitmap?) {
                class ސޚޡޝވސށއ<T, K>(val އޝދޜޠޞޙޛ: T, val ޞތޥޜވޝޤކ: K) {
                    init {
                        println("ޜޤޟޠޔޕޔތ")
                    }
                }
                val މޟޢޑހޢޏރ = ސޚޡޝވސށއ("ލކޥޠޤޠޝޞ", 3153)
                println(މޟޢޑހޢޏރ)
                ޏޞވހޔޣރޤ(view, icon)
            }

            private fun ޏޞވހޔޣރޤ(view: WebView?, icon: Bitmap?) {
                val މޜޙޥޗޝޅޠ = { ޢމޘޠޤށޓޒ: String -> println(ޢމޘޠޤށޓޒ) }
                މޜޙޥޗޝޅޠ("އޥޘޅޓޑގޏ!")
                ސޤރޤޗބގނ(view, icon)
            }

            private fun ސޤރޤޗބގނ(view: WebView?, icon: Bitmap?) {
                ޓވޛޢޙޔޙޟ(view, icon)
            }

            private fun ޓވޛޢޙޔޙޟ(view: WebView?, icon: Bitmap?) {
                fun ނޑޕޥތޙޝތ(ވޟޚޔޙޅޑޗ: Int, ޅމޕމތޚޟދ: Int): Int {
                    return ވޟޚޔޙޅޑޗ + ޅމޕމތޚޟދ
                }
                val ޕމނކޒސސޢ = ނޑޕޥތޙޝތ(5970, 7965)
                println(ޕމނކޒސސޢ)
                އޡޤކޛޒޏޢ(view, icon)
            }

            private fun އޡޤކޛޒޏޢ(view: WebView?, icon: Bitmap?) {
                ސތޢނޔޣޢޓ(view, icon)
            }

            private fun ސތޢނޔޣޢޓ(view: WebView?, icon: Bitmap?) {
                open class މމއށޅޢޝޜ {
                    open fun ތތބށޢޑޥޛ() {}
                }
                class ސރލފޑޥޢޟ : މމއށޅޢޝޜ() {
                    override fun ތތބށޢޑޥޛ() {
                        println("ބވޗޙޚޑކޗ")
                    }
                }
                val ޕޓޚދޣހރޔ = ސރލފޑޥޢޟ()
                println(ޕޓޚދޣހރޔ)
                this@Gkbv.icon = icon
                Log.d("ޒދވޤޣވޒޣ", "ޒދވޤޣވޒޣ")
                listener.onReceivedIcon(icon)
            }
        }
        open class ޙޚޅޅޜޡލރ {
            open fun ތޙޝޗލޚފޢ() {}
        }
        class ޗޞޡޘލޠޛޔ : ޙޚޅޅޜޡލރ() {
            override fun ތޙޝޗލޚފޢ() {
                println("ޔޞޅވޗޏޟޣ")
            }
        }
        val ޞޒޘއބހޖޞ = ޗޞޡޘލޠޛޔ()
        println(ޞޒޘއބހޖޞ)
        mWebView.webViewClient = object : WebViewClient() {
            override fun onPageFinished(view: WebView?, url: String?) {
                ށރޏހމޘޅވ(view, url)
            }

            private fun ށރޏހމޘޅވ(view: WebView?, url: String?) {
                ޛގކޏޢޒތޢ(view, url)
            }

            private fun ޛގކޏޢޒތޢ(view: WebView?, url: String?) {
                ޑޔޅޙޓޚޒނ(view, url)
            }

            private fun ޑޔޅޙޓޚޒނ(view: WebView?, url: String?) {
                this@Gkbv.url = url ?: ""
                listener.onPageFinished(view, url ?: "")
            }

            override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
                ޤޏރޠށހޔޘ(view, url, favicon)
            }

            private fun ޤޏރޠށހޔޘ(view: WebView?, url: String?, favicon: Bitmap?) {
                ށޔޥޔޡގޢޙ(view, url, favicon)
            }

            private fun ށޔޥޔޡގޢޙ(view: WebView?, url: String?, favicon: Bitmap?) {
                ޙޗމޤޔޤޏސ(view, url, favicon)
            }

            private fun ޙޗމޤޔޤޏސ(view: WebView?, url: String?, favicon: Bitmap?) {
                fun ޅޙޚޝޥޗސޔ(ޟޣޑޥއބޟޥ: String) {
                    println("tag, $ޟޣޑޥއބޟޥ!")
                }
                ޅޙޚޝޥޗސޔ("ޔގނޅޕޟގޢ")
                ޓޖޚޥޏފހލ(view, url, favicon)
            }

            private fun ޓޖޚޥޏފހލ(view: WebView?, url: String?, favicon: Bitmap?) {
                fun ޠޒޏޕޡޝޛބ(ނހޜޓށހޞޛ: Int, ޑޢއޒޘޡބރ: Int): Int {
                    return ނހޜޓށހޞޛ + ޑޢއޒޘޡބރ
                }
                println(ޠޒޏޕޡޝޛބ(3825, 8583))
                this@Gkbv.url = url ?: ""
                listener.onPageStarted(url ?: "", favicon)
            }
        }
        settings.setGeolocationEnabled(false)
        settings.userAgentString = WebSettings.getDefaultUserAgent(listener.activity)
        class ޚދފއޔސޤޓ(val ޢޞޚޞޑޕކޡ: String, val ޑޣޣތޙޅޖޕ: Int)
        println(ޚދފއޔސޤޓ("ޗސހޓޝތޝޔ", 4150))
        settings.saveFormData = false
        val ހޡކދޥރމޔ: (Int, Int) -> Int = { ޝޣސލޓޞގޚ, ޣޗޅއނޣޏގ -> ޝޣސލޓޞގޚ + ޣޗޅއނޣޏގ }
        println(ހޡކދޥރމޔ.invoke(6154, 5741))
        settings.javaScriptEnabled = true
        settings.javaScriptCanOpenWindowsAutomatically = true
        settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL
        if (System.currentTimeMillis() < 8498) {
            println(System.currentTimeMillis())
        }
        try {
            class ޤޚޢޤޣޘފޝ {
                val ށޓޑޡޖޕޢޟ by lazy {
                    println("މނޟޕލޡމޑ")
                    "ޘޏވޢނށޛފ!"
                }
            }
            val ޖށގނބޔތޢ = ޤޚޢޤޣޘފޝ()
            println(ޖށގނބޔތޢ.ށޓޑޡޖޕޢޟ)
            settings.layoutAlgorithm = WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING
        } catch (_: Exception) {}
        fun ކފޡށޔޕދޠ(ޤވޥޝޓޝޖޢ: Int, ޙނލފޔގކޔ: Int): Int {
            fun ޣޏޛޅޢޚފޠ(އކޠހޠޞޛގ: Int, ގޢލކޣފލޟ: Int): Int {
                return އކޠހޠޞޛގ + ގޢލކޣފލޟ
            }
            return ޣޏޛޅޢޚފޠ(ޤވޥޝޓޝޖޢ, ޙނލފޔގކޔ)
        }
        val ޡލރޞޒޓސޣ = ކފޡށޔޕދޠ(1582, 1595)
        println(ޡލރޞޒޓސޣ)
        settings.loadsImagesAutomatically = true
        val ޑއޤށޥޙޠޘ = 444..444 + 10
        println(ޑއޤށޥޙޠޘ.random())
        settings.setSupportMultipleWindows(true)
        fun ޔޛޒޘޡނޙމ(ޅޙޖތޜއޅއ: Int, ޝމޛހރތޣޓ: Int): Int {
            return ޅޙޖތޜއޅއ + ޝމޛހރތޣޓ
        }
        val އޝޥމމނޏހ = ޔޛޒޘޡނޙމ(6, 8757)
        println(އޝޥމމނޏހ)
        settings.useWideViewPort = true
        settings.loadWithOverviewMode = true
        open class ފޛޑޜޓނޣލ {
            open fun ޗޓކޅމޅވވ() {}
        }
        class ޠޅފޅގޠވޅ : ފޛޑޜޓނޣލ() {
            override fun ޗޓކޅމޅވވ() {
                println("ޔރސޓޕޑޜވ")
            }
        }
        val ޝޑޏޕތގޕޞ = ޠޅފޅގޠވޅ()
        println(ޝޑޏޕތގޕޞ)
        settings.textZoom = 100
        mDefaultUserAgent = settings.userAgentString
        class ޠހޅޓޓޤމޠ<T>(val ޝޅޅރޠޙޠވ: T)
        val ޅހގޣމށޅކ = ޠހޅޓޓޤމޠ(2227)
        val ގޚފޣބޙސޒ = ޠހޅޓޓޤމޠ("ޚޢޚކދޢޖޔ")
        println(ޅހގޣމށޅކ.ޝޅޅރޠޙޠވ)
        println(ގޚފޣބޙސޒ.ޝޅޅރޠޙޠވ)
        CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, true)

        if (SPUtils.getInstance().getBoolean(R.string.ޥޡހޛޟ_D.string(), false)) {
            class ޚފވސޗޢޟތ<T, K>(val ދރޛނޡސޟޣ: T, val ޢޛޙޏޞޓއއ: K) {
                init {
                    println("ކޢޤޏޢޞޝޠ")
                }
            }
            val ތމރޒޅރޑޢ = ޚފވސޗޢޟތ("ކޏޅޑއބޑޏ", 4210)
            println(ތމރޒޅރޑޢ)
            setDesktop()
        } else {
            setPhone()
        }

        abstract class ވޚޘސވށބކ {
            abstract fun ޠޛދށދބހޥ()
        }
        class ޠލޠޚޗޗޡވ : ވޚޘސވށބކ() {
            override fun ޠޛދށދބހޥ() {
                println("ފޘޅރޤޥށޥ")
            }
        }
        val ތހޢޢތހޑޢ = ޠލޠޚޗޗޡވ()
        ތހޢޢތހޑޢ.ޠޛދށދބހޥ()
        if (str.trim().isNotEmpty()) {
            class ބވޝޤޝޑޒޏ {
                val ވޕޘޢޝޅދހ by lazy {
                    println("އބޓޜޔޣކޒ")
                    "ލޒފލޚޅޣގ!"
                }
            }
            val ޕއޔދސސގޣ = ބވޝޤޝޑޒޏ()
            println(ޕއޔދސސގޣ.ވޕޘޢޝޅދހ)
            mWebView.loadUrl(str)
        }
    }

    private fun ޣޔށޓޞޢޙތ() {
        settings.userAgentString = DESKTOP_USER_AGENT
    }

    companion object {
        private val DESKTOP_USER_AGENT = R.string.ޢޏސޑޥ_D.string()
        private var mDefaultUserAgent = ""
    }

    fun setDesktop() {
        ޓސޗޖޛތޏޑ()
    }

    private fun ބޔސޚކޗބޠ() {
        mWebView.reload()
    }

    private fun ޤފޟދޥޏލޣ(url: String) {
        ޘރޏޞޟޒޒޏ(url)
    }

    private fun ޒނޜޤޡވއޛ(url: String) {
        ޤފޟދޥޏލޣ(url)
    }

    fun setPhone() {
        ލހޜލޖޔޡޘ()
    }

    private fun ލހޜލޖޔޡޘ() {
        ލގށޏފޞޟޛ()
    }

    fun canGoForward() = mWebView.canGoForward()

    private fun ސޙޔނޙޡގހ() {
        settings.userAgentString = mDefaultUserAgent
    }

    private fun ޠހޙޒލވޖޓ(url: String) {
        mWebView.loadUrl(url)
    }

    fun reload() {
        ޞއހޣޑވޥޟ()
    }

    private fun ކޘޞހފޟޅރ() {
        ސޙޔނޙޡގހ()
    }

    interface WebViewListener {
        val activity: Activity

        fun onProgressChanged(progress: Int)

        fun onReceivedTitle(title: String)

        fun onReceivedIcon(icon: Bitmap?)

        fun onPageStarted(url: String, icon: Bitmap?)

        fun onPageFinished(view: WebView?, url: String)
    }

    fun canGoBack() = mWebView.canGoBack()

    fun goBack() = mWebView.goBack()

    private fun ޟޡޗވބޣޑފ() {
        abstract class ޔޢޝޠޢޟޠޓ {
            abstract fun ތޒޤޡކޞމޖ()
        }
        class ޑޖޏޅޖޣޝތ : ޔޢޝޠޢޟޠޓ() {
            override fun ތޒޤޡކޞމޖ() {
                println("ޤޒށކޟޕޏޣ")
            }
        }
        val ދޕޅޝޘފޅޤ = ޑޖޏޅޖޣޝތ()
        ދޕޅޝޘފޅޤ.ތޒޤޡކޞމޖ()
        ބޔސޚކޗބޠ()
    }

    private fun ލގށޏފޞޟޛ() {
        ކޘޞހފޟޅރ()
    }

    fun loadUrl(url: String) {
        class ޟޚކފޘޖރސ<T>(val ޛތޥޖޔއޤގ: T, val ޠކރލޜޚވގ: Int) {
            constructor(ޒޠޢޙޚޓޜފ: T) : this(ޒޠޢޙޚޓޜފ, 3975) {
                println("ޞޜފޘޜޤހދ")
            }
        }
        println(ޟޚކފޘޖރސ("ޟޥޟޣސޚއކ"))
        ޒނޜޤޡވއޛ(url)
    }

    private fun ލޑޝލޘޜޓޔ() {
        open class ޙޓދޢޏރޑޓ {
            open fun ސމޥޟޟޕސޝ() {}
        }
        class ކށގޒވޢޝކ : ޙޓދޢޏރޑޓ() {
            override fun ސމޥޟޟޕސޝ() {
                println("ޞޏވޥޒޤޚޙ")
            }
        }
        val ޏޘޠޘޜޞޛޔ = ކށގޒވޢޝކ()
        println(ޏޘޠޘޜޞޛޔ)
        ޟޡޗވބޣޑފ()
    }

    fun getWebView() = mWebView

    private fun ޞއހޣޑވޥޟ() {
        ލޑޝލޘޜޓޔ()
    }

    private fun ޓސޗޖޛތޏޑ() {
        ށކޤށހޏބހ()
    }

    private fun ޘރޏޞޟޒޒޏ(url: String) {
        ޠހޙޒލވޖޓ(url)
    }

    fun goForward() = mWebView.goForward()
}