<?php
namespace Claromentis\Core\Mail;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] ?: array()) + array("_70809333a0f254a" . "cf7a1ad0c7dadd46" . "b" => base64_decode("OiA" . "="), "_85c0317cbb078f0" . "94e67deb8c98747c" . "a" => base64_decode("cGFuZWxzLnN5c2FkbWlu" . "Lm1haWwuY29uZmlnLnRl" . "c3QudW5rbm93bg=="), "_f0ccbc78e1f" . "d1e8a7c4363b" . "e78c343e3" => base64_decode("VGVzdGluZyBtYWlsIGNvbmZpZyBmb3IgZHJpdmVyIA=" . "="), "_4d707fab93bebb" . "00bbe69e8159697" . "c90" => base64_decode(""), "_bda7e68ddb54572" . "41ee6582bba13bd0" . "7" => base64_decode("TWFpbCBhZGRlZCB0by" . "BxdWV1ZS4gVG86IA=="), "_7979807b431a2ee1f6b" . "f33646d2034f4" => base64_decode("OiBQYXJ" . "hbWV0ZX" . "JzOiA="), "_e8ac993f74f781a14ff7" . "c657429b7e5a" => base64_decode("RXJyb3Igc2VuZGluZyBxdWV1ZWQgZW1haWw6I" . "A=="), "_ce43e24de71081161087b" . "7fbdcab4ad0" => base64_decode("VW5leHBlY3RlZCBEcml2ZXIgRXh" . "jZXB0aW9uIHJlY2VpdmVk"), "_04ddd04957d" . "72dac88ea1b1" . "65c2f5924" => base64_decode("cGFuZWxzLnN5c2FkbWluLm1haWwuZXJyb3IudW5rbm93bl9kcml2ZX" . "I="), "_ed4f1afa017a1600d3" . "2ec1279b1db7f9" => base64_decode("RXJyb3Igc2VuZ" . "GluZyBlbWFpbD" . "og"), "_49048c556025" . "977386e4c56ad" . "7008110" => base64_decode("Y2ZnX21haWxfc2VuZF9kc" . "ml2ZXI="), "_71f67ca07becf001108d725cc02b17" . "c7" => base64_decode("JyBpcyBpbnZhbGlkLCBjYW5ub3Qgc2V0IFN5c3RlbSBBZGRyZXNzJyB" . "uYW1l"), "defa" . "ult" => base64_decode("ZGVm" . "YXVs" . "dA=="), "_54fa8523f2845872533bf" . "b14523f79ed" => base64_decode("ZW" . "52"), "_97d096927c9f0d2fdc5bc375847d7e" . "2e" => base64_decode("Jz" . "og"), "_05d1cbacb08ef28281e0c7d1da" . "cbed6f" => base64_decode("Q29ubmVjdGlvbiB0ZXN" . "0IHN1Y2NlZWRlZA=="), "_475c6eb871647a4678d99bf178e64" . "2b0" => base64_decode("VW5rbm93biBtYWlsIGRyaXZ" . "lciAn"), "_2b9b83b1" . "6cb8aa329" . "cf0691ef4" . "33f372" => base64_decode("c3lz" . "dGVt"), "_44c743290e" . "d5cb96218e0" . "4f53652030e" => base64_decode("cGFuZWxzLnN5c2FkbWluLm1" . "haWwuY29uZmlnLnRlc3RfZm" . "FpbF9kZXRhaWw="), "_173260988afa5a3136943cc7af8" . "28c7d" => base64_decode("U2VuZGluZyBlb" . "WFpbCB1c2luZy" . "A="), "_fe2227f1e9734bb5d320f2a" . "51d8c8bb0" => base64_decode("JyBub3Qgc2V0LCBjYW5ub3Qgc2V0IFN5c3RlbSBBZGRyZXNzJyB" . "uYW1l"), "_f86bedc6cc7ac8e91295ee2b6a" . "ff6c62" => base64_decode("VGVzdCB1bmlt" . "cGxlbWVudGVk" . "IHVzaW5nIGRy" . "aXZlciAn"), "_de6aba6b4739ba89201909c" . "f3aa4dd6c" => base64_decode("Q0xBUk9fTUFJ" . "TF9TRU5EX1BB" . "UkFNUw=="), "_e92ad742fc1" . "2ec1dd5c3055" . "7fafca331" => base64_decode("Ig=" . "="), "_5e30c4717ced36cff9e93e19a5c5" . "76cc" => base64_decode("aXNfc3RyaW5" . "n"), "_a5f1edc402770626885c971a8f455f4" . "9" => base64_decode("Q0xBUk9fTUFJTF9TRU5EX0RSSVZFUg=" . "="), "_e608e5b5c4c34a67ba97ef84c1e1619" . "9" => base64_decode("Jw" . "=="), "_6f756009a944ef03ce7f7a7aaa" . "c1f710" => base64_decode("c2Vjd" . "XJl"), "_409519c" . "faf0be8f" . "908611ad" . "20935119" . "1" => base64_decode("LCBTdWJqZWN0" . "OiAi"), "_0c5123aa744f69bbc0e8b3ea2f6e847" . "d" => base64_decode("bG1" . "zZw" . "=="), "_ddd3110b" . "d20b83fad" . "9f530b65c" . "4275f8" => base64_decode("VXNpbmcgZHJpdmVyIC" . "c="), "_357e47289293dca0919123ccaca7fd5" . "9" => base64_decode("RGVmYXVsdCBtY" . "WlsIGRyaXZlci" . "Bub3QgZm91bmQ" . "="), "_7aefd482de7885f4293" . "c2926df28c235" => base64_decode("anNvbl9lbmNvZ" . "GU="), "valu" . "e" => base64_decode("dmFsdW" . "U="), "_f69812ed2c66c3cd2e502c9eac3" . "591ee" => base64_decode("bWFpbA=" . "="), "_c726fd7c5fa88" . "06fac00fdf09b4" . "de13b" => base64_decode("Q29u" . "Zmln" . "ICc="), "_7f628626d" . "d1d55c71b1" . "fc0932ffd1" . "d2c" => base64_decode("aXNfYXJ" . "yYXk="), "_49c6565477ee9f" . "822b499a53e6d29" . "95f" => base64_decode("YXJyYXlfa2V5X" . "2V4aXN0cw=="), "_9d82046795d3f4697" . "915753fbb8af944" => base64_decode("Y2ZnX21haWxfc2VuZF9wYXJhbXM" . "="), "_9f27f4abef4c53e" . "bd91a40df6d4442d" . "9" => base64_decode("VGVzdCB1bmltcGxlbWVudGVkIHV" . "zaW5nIGRyaXZlciA="));
use Claromentis\Core\Admin\PanelsList;
use Claromentis\Core\Audit\Audit;
use Claromentis\Core\Config;
use Claromentis\Core\Mail\Exception\AddressInvalidException;
use Claromentis\Core\Mail\Exception\DsnException;
use Claromentis\Core\Mail\Exception\EmailInvalidException;
use Claromentis\Core\Mail\Exception\MailConnectionTestException;
use Claromentis\Core\Mail\Exception\MailConnectionTestNotImplementedException;
use Claromentis\Core\Mail\Exception\MailSendException;
use Claromentis\Core\Mail\Send\Driver\AbstractSendDriver;
use Claromentis\Core\Mail\Send\MailFactory;
use Claromentis\Core\Mail\Send\MailQueue;
use Claromentis\Core\Security\Exception\AdminAccessDeniedException;
use Claromentis\Core\Security\SecurityContext;
use Claromentis\Core\TextUtil\ClaText;
use Claromentis\Core\Util\StringUtil;
use Exception;
use LogicException;
use Monolog\Logger;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
use Psr\Log\NullLogger;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\Transport\TransportInterface;
use Symfony\Component\Mime\Address as SymfonyAddress;
use Symfony\Component\Mime\Email as SymfonyEmail;
use Throwable;




class Api implements LoggerAwareInterface
{
    use LoggerAwareTrait;
    public const CONFIG_SYSTEM_EMAIL = 'systemEmail';
    public const CONFIG_SYSTEM_NAME = 'systemName';
    
    
    
    
    
    
    public const DEFAULT_MAIL_DRIVER = 'mail';
    protected PanelsList $panelsList;
    private Audit $audit;
    private ClaText $claText;
    private Config\Config $coreConfig;
    private MailFactory $mailFactory;
    private MailQueue $mailQueue;
    private Utility $utility;
    private ?TransportInterface $cachedTransport = null;
    public function __construct(MailFactory $_30975c67491190ff76aabd9b212b3323, MailQueue $_0f7b3ada6dd559ff0e38226ebe686109, Utility $_99d5ea20132b2d99e3984089fae556d9, Config\LayeredConfig $_e7c02b1e54c31b0da5aa531667c59980, ClaText $claText, Audit $audit, PanelsList $panelsList, LoggerInterface $logger = null)
    {
        $this->mailFactory = $_30975c67491190ff76aabd9b212b3323;
        $this->mailQueue = $_0f7b3ada6dd559ff0e38226ebe686109;
        $this->utility = $_99d5ea20132b2d99e3984089fae556d9;
        $this->coreConfig = $_e7c02b1e54c31b0da5aa531667c59980;
        $this->claText = $claText;
        $this->audit = $audit;
        $this->panelsList = $panelsList;
        $this->logger = $logger ?? new NullLogger();
    }
    
    
    
    
    
    
    public function getDefaultTransport() : TransportInterface
    {
        if ($this->cachedTransport === null) {
            $this->cachedTransport = $this->createDefaultTransport();
        }
        return $this->cachedTransport;
    }
    
    
    
    
    
    
    
    public function createAddress(string $_4defe7be81f86ea1db6af4de0d32c046, string $_c84c2e10d1dd477e984db77acda50e77 = '') : SymfonyAddress
    {
        return $this->mailFactory->createAddress($_4defe7be81f86ea1db6af4de0d32c046, $_c84c2e10d1dd477e984db77acda50e77);
    }
    
    
    
    
    
    
    
    public function createSystemAddress() : SymfonyAddress
    {
        $_b2adb496f37d22c01c9a6248d9104b61 = $this->coreConfig->get(self::CONFIG_SYSTEM_EMAIL);
        if ($_b2adb496f37d22c01c9a6248d9104b61 === null) {
            throw Config\Exception\ValueException::undefinedConfig(self::CONFIG_SYSTEM_EMAIL);
        }
        if (!$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_5e30c4717ced36cff9e93e19a5c5" . "76cc"]($_b2adb496f37d22c01c9a6248d9104b61)) {
            throw Config\Exception\ValueException::invalidConfig(self::CONFIG_SYSTEM_EMAIL, $_b2adb496f37d22c01c9a6248d9104b61);
        }
        $_1ab9364741e2bcd0390100860f733720 = $this->coreConfig->get(self::CONFIG_SYSTEM_NAME);
        if (!isset($_1ab9364741e2bcd0390100860f733720)) {
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_c726fd7c5fa8806fac00fdf09" . "b4de13b"] . self::CONFIG_SYSTEM_NAME . $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_fe2227f1e9734bb5d320f2a" . "51d8c8bb0"]);
            $_1ab9364741e2bcd0390100860f733720 = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_4d707fab93bebb00b" . "be69e8159697c90"];
        } elseif (!$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_5e30c4717ced36cff9" . "e93e19a5c576cc"]($_1ab9364741e2bcd0390100860f733720)) {
            $this->logger->warning($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_c726fd7c5fa8806fac00fdf09b4de13" . "b"] . self::CONFIG_SYSTEM_NAME . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_71f67ca07bec" . "f001108d725cc" . "02b17c7"]);
            $_1ab9364741e2bcd0390100860f733720 = $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_4d707fa" . "b93bebb0" . "0bbe69e8" . "159697c9" . "0"];
        }
        try {
            return $this->mailFactory->createAddress($_b2adb496f37d22c01c9a6248d9104b61, $_1ab9364741e2bcd0390100860f733720);
        } catch (AddressInvalidException $_c35473364fa7a050299058f332ec29c1) {
            throw Config\Exception\ValueException::invalidConfig(self::CONFIG_SYSTEM_EMAIL, $_b2adb496f37d22c01c9a6248d9104b61, $_c35473364fa7a050299058f332ec29c1);
        }
    }
    
    
    
    
    
    
    
    public function createPlainTextBodyFromHtmlBody(string $_4c80eed30fc7fbec8bba5337bda31bd8) : string
    {
        return $this->claText->Html2Plain($_4c80eed30fc7fbec8bba5337bda31bd8);
    }
    
    
    
    
    
    
    public function queue(SymfonyEmail $_c2f6f7dc50f77b2d217bd2e23a6ff2a0) : void
    {
        $this->mailQueue->save($_c2f6f7dc50f77b2d217bd2e23a6ff2a0);
        $this->audit->Success($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_2b9b83b16cb8" . "aa329cf0691ef" . "433f372"], $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_f69812ed2c66c3cd2" . "e502c9eac3591ee"], 0, $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_bda7e68ddb5457241" . "ee6582bba13bd07"] . $this->utility->createAddressString($_c2f6f7dc50f77b2d217bd2e23a6ff2a0->getTo()) . $GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_409519cfaf0be8f908611ad20935" . "1191"] . $_c2f6f7dc50f77b2d217bd2e23a6ff2a0->getSubject() . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_e92ad742fc12ec1dd5c30557fafca3" . "31"]);
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function sendSystemEmail($_0e4c020a77dcb5d5f8684e4d4d3e80ec, string $_f656816961e8573806141c558b184fe2, ?string $_4c80eed30fc7fbec8bba5337bda31bd8 = null, $_c49fa31c9665197cc1250a0d4bcfb78f = null, $_f72b06c6fd9f67040ec629a7b8dcb371 = null, $_4e7ab34a53ffb13eb0838003f33034d4 = null, ?int $_3f650f992b0f74b15a3ed91adea9a2c4 = null, ?string $_6b60bb9615129d9f04d20a30d5aa1331 = null) : void
    {
        try {
            $this->sendEmail($this->createEmail($this->createSystemAddress(), $_0e4c020a77dcb5d5f8684e4d4d3e80ec, $_f656816961e8573806141c558b184fe2, $_4c80eed30fc7fbec8bba5337bda31bd8, $_c49fa31c9665197cc1250a0d4bcfb78f, $_f72b06c6fd9f67040ec629a7b8dcb371, $_4e7ab34a53ffb13eb0838003f33034d4, $_3f650f992b0f74b15a3ed91adea9a2c4, $_6b60bb9615129d9f04d20a30d5aa1331));
        } catch (Config\Exception\ValueException $_c35473364fa7a050299058f332ec29c1) {
            throw MailSendException::failed($_c35473364fa7a050299058f332ec29c1);
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function createAndSendEmail(SymfonyAddress $_eeece82ed3eaf4687dfe36e1210866e8, $_0e4c020a77dcb5d5f8684e4d4d3e80ec, string $_f656816961e8573806141c558b184fe2, ?string $_4c80eed30fc7fbec8bba5337bda31bd8 = null, $_c49fa31c9665197cc1250a0d4bcfb78f = null, $_f72b06c6fd9f67040ec629a7b8dcb371 = null, $_4e7ab34a53ffb13eb0838003f33034d4 = null, ?int $_3f650f992b0f74b15a3ed91adea9a2c4 = null, ?string $_6b60bb9615129d9f04d20a30d5aa1331 = null) : void
    {
        $this->sendEmail($this->createEmail($_eeece82ed3eaf4687dfe36e1210866e8, $_0e4c020a77dcb5d5f8684e4d4d3e80ec, $_f656816961e8573806141c558b184fe2, $_4c80eed30fc7fbec8bba5337bda31bd8, $_c49fa31c9665197cc1250a0d4bcfb78f, $_f72b06c6fd9f67040ec629a7b8dcb371, $_4e7ab34a53ffb13eb0838003f33034d4, $_3f650f992b0f74b15a3ed91adea9a2c4, $_6b60bb9615129d9f04d20a30d5aa1331));
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function createEmail(SymfonyAddress $_eeece82ed3eaf4687dfe36e1210866e8, $_0e4c020a77dcb5d5f8684e4d4d3e80ec, string $_f656816961e8573806141c558b184fe2, ?string $_4c80eed30fc7fbec8bba5337bda31bd8 = null, $_c49fa31c9665197cc1250a0d4bcfb78f = null, $_f72b06c6fd9f67040ec629a7b8dcb371 = null, $_4e7ab34a53ffb13eb0838003f33034d4 = null, ?int $_3f650f992b0f74b15a3ed91adea9a2c4 = null, ?string $_6b60bb9615129d9f04d20a30d5aa1331 = null) : SymfonyEmail
    {
        if (!$GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_7f628626dd1d" . "55c71b1fc0932" . "ffd1d2c"]($_0e4c020a77dcb5d5f8684e4d4d3e80ec)) {
            $_0e4c020a77dcb5d5f8684e4d4d3e80ec = [$_0e4c020a77dcb5d5f8684e4d4d3e80ec];
        }
        if (isset($_c49fa31c9665197cc1250a0d4bcfb78f) && !$GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_7f628626dd" . "1d55c71b1fc" . "0932ffd1d2c"]($_c49fa31c9665197cc1250a0d4bcfb78f)) {
            $_c49fa31c9665197cc1250a0d4bcfb78f = [$_c49fa31c9665197cc1250a0d4bcfb78f];
        }
        if (isset($_f72b06c6fd9f67040ec629a7b8dcb371) && !$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_7f628626dd1d55c71b" . "1fc0932ffd1d2c"]($_f72b06c6fd9f67040ec629a7b8dcb371)) {
            $_f72b06c6fd9f67040ec629a7b8dcb371 = [$_f72b06c6fd9f67040ec629a7b8dcb371];
        }
        if (isset($_4e7ab34a53ffb13eb0838003f33034d4) && !$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_7f628626d" . "d1d55c71b1" . "fc0932ffd1" . "d2c"]($_4e7ab34a53ffb13eb0838003f33034d4)) {
            $_4e7ab34a53ffb13eb0838003f33034d4 = [$_4e7ab34a53ffb13eb0838003f33034d4];
        }
        if (isset($_4c80eed30fc7fbec8bba5337bda31bd8) && !isset($_6b60bb9615129d9f04d20a30d5aa1331)) {
            $_6b60bb9615129d9f04d20a30d5aa1331 = $this->createPlainTextBodyFromHtmlBody($_4c80eed30fc7fbec8bba5337bda31bd8);
        }
        return $this->mailFactory->createEmail($_eeece82ed3eaf4687dfe36e1210866e8, $_0e4c020a77dcb5d5f8684e4d4d3e80ec, $_f656816961e8573806141c558b184fe2, $_4c80eed30fc7fbec8bba5337bda31bd8, $_6b60bb9615129d9f04d20a30d5aa1331, $_c49fa31c9665197cc1250a0d4bcfb78f, $_f72b06c6fd9f67040ec629a7b8dcb371, $_4e7ab34a53ffb13eb0838003f33034d4, $_3f650f992b0f74b15a3ed91adea9a2c4);
    }
    
    
    
    
    
    
    
    
    
    
    
    public function sendEmail(SymfonyEmail $_c2f6f7dc50f77b2d217bd2e23a6ff2a0, ?TransportInterface $_47db1fc36ccc4f4e8679430f0c7b17c8 = null) : void
    {
        try {
            $_47db1fc36ccc4f4e8679430f0c7b17c8 = $_47db1fc36ccc4f4e8679430f0c7b17c8 ?? $this->getDefaultTransport();
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_173260988afa5a3136943cc7a" . "f828c7d"] . $_47db1fc36ccc4f4e8679430f0c7b17c8);
            $_47db1fc36ccc4f4e8679430f0c7b17c8->send($_c2f6f7dc50f77b2d217bd2e23a6ff2a0);
        } catch (TransportExceptionInterface|Exception $_c35473364fa7a050299058f332ec29c1) {
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_ed4f1afa017a1600d32ec1279b1db" . "7f9"] . $_c35473364fa7a050299058f332ec29c1);
            throw MailSendException::failed($_c35473364fa7a050299058f332ec29c1);
        }
    }
    
    
    
    
    
    
    public function processQueue(?int $_f11369824f533e8206f9ccc0c9aab3a0) : void
    {
        $this->sendQueued($_f11369824f533e8206f9ccc0c9aab3a0);
        $this->mailQueue->deleteSentMail();
    }
    
    
    
    
    
    
    private function sendQueued(?int $_f11369824f533e8206f9ccc0c9aab3a0) : void
    {
        $_f2e90e88b5f7e0dea9318d967a6ebd42 = $this->mailQueue->get(false, $_f11369824f533e8206f9ccc0c9aab3a0);
        foreach ($_f2e90e88b5f7e0dea9318d967a6ebd42 as $id => $_c2f6f7dc50f77b2d217bd2e23a6ff2a0) {
            $this->mailQueue->incrementSendAttempt($id);
            try {
                $this->sendEmail($_c2f6f7dc50f77b2d217bd2e23a6ff2a0, $this->getDefaultTransport());
            } catch (Config\Exception\ValueException|DsnException $_c35473364fa7a050299058f332ec29c1) {
                $this->logger->critical($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_e8ac993f74f781a14ff7c657429" . "b7e5a"] . $_c35473364fa7a050299058f332ec29c1);
                continue;
            } catch (MailSendException $_c35473364fa7a050299058f332ec29c1) {
                $this->logger->warning($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_e8ac993f74f781a14ff7c" . "657429b7e5a"] . $_c35473364fa7a050299058f332ec29c1);
            }
            $this->mailQueue->markAsSent($id);
        }
    }
    
    
    
    
    
    
    
    
    
    private function createDefaultTransport() : TransportInterface
    {
        try {
            return $this->mailFactory->createTransportFromConfig($this->coreConfig);
        } catch (MailSendException $_c35473364fa7a050299058f332ec29c1) {
            throw new MailSendException($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_ce43e24de71081161087b7fbdcab" . "4ad0"], 0, $_c35473364fa7a050299058f332ec29c1);
        }
    }
    
    
    
    
    
    
    
    
    
    
    public function createTransportFromDsn(string $_c7f99fae10c5fea93a555050524a9f0e) : TransportInterface
    {
        return $this->mailFactory->createTransportFromDsn($_c7f99fae10c5fea93a555050524a9f0e);
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function saveConfiguration(SecurityContext $context, string $_69f63d634889ca8c0fd6310468af35b9, array $_f56e92e2b328797520a80ee0c4fb95c5) : void
    {
        
        
        $_9c58d9e285fddad133acf2e9dff4c4b5 = $this->panelsList->GetOne($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_2b9b83b16cb8a" . "a329cf0691ef43" . "3f372"]);
        if (!$_9c58d9e285fddad133acf2e9dff4c4b5->IsAccessible($context)) {
            throw new AdminAccessDeniedException($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_2b9b83b16cb8aa329cf0691ef4" . "33f372"]);
        }
        $_ba6d96e59a7b293c2883196b6bd04810 = false;
        $_7edf5300814a7e43425b2a86d6a77c76 = [];
        foreach ($this->getAllDrivers() as $_1689db965dcd5989e8faf51389aad5c4) {
            if ($_69f63d634889ca8c0fd6310468af35b9 === $_1689db965dcd5989e8faf51389aad5c4->getInternalName()) {
                $_ba6d96e59a7b293c2883196b6bd04810 = true;
            }
            $_147aa65e6f86b03cd87a88a580320c7e = $_1689db965dcd5989e8faf51389aad5c4->getConfigParametersDefinition();
            foreach ($_147aa65e6f86b03cd87a88a580320c7e as $_6d7b286a47d7a62ccc452569f2a7e30b => $_e25ec43f6bf86add43db264a786bfcaa) {
                if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_49c6565477ee9f822b499a53e6d2995" . "f"]($_6d7b286a47d7a62ccc452569f2a7e30b, $_f56e92e2b328797520a80ee0c4fb95c5)) {
                    $value = $_f56e92e2b328797520a80ee0c4fb95c5[$_6d7b286a47d7a62ccc452569f2a7e30b];
                } else {
                    $value = $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_49c6565477ee9f822b499a53e6d299" . "5f"]($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["valu" . "e"], $_e25ec43f6bf86add43db264a786bfcaa) ? $_e25ec43f6bf86add43db264a786bfcaa[$GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["va" . "lu" . "e"]] : $_e25ec43f6bf86add43db264a786bfcaa[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["de" . "fa" . "ul" . "t"]];
                }
                $_97dea5086bb7551c9aab10f37e124446 = false;
                if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_49c6565477ee9f82" . "2b499a53e6d2995f"]($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["de" . "fa" . "ul" . "t"], $_e25ec43f6bf86add43db264a786bfcaa) && $value === $_e25ec43f6bf86add43db264a786bfcaa[$GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["defa" . "ult"]]) {
                    $_97dea5086bb7551c9aab10f37e124446 = true;
                }
                if (!$_97dea5086bb7551c9aab10f37e124446 && $value !== null && $value !== $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_4d707fab93bebb00bbe69e81596" . "97c90"]) {
                    $_7edf5300814a7e43425b2a86d6a77c76[$_6d7b286a47d7a62ccc452569f2a7e30b] = $value;
                }
            }
        }
        if (!$_ba6d96e59a7b293c2883196b6bd04810) {
            throw new MailSendException($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_0c5123aa744f69bbc0e8b3ea2f6e847" . "d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_04ddd04957d7" . "2dac88ea1b165" . "c2f5924"], $_69f63d634889ca8c0fd6310468af35b9));
        }
        $this->coreConfig->set($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_9d82046795d3f4697915" . "753fbb8af944"], $_7edf5300814a7e43425b2a86d6a77c76);
        $this->coreConfig->set($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_49048c556025977386e4" . "c56ad7008110"], $_69f63d634889ca8c0fd6310468af35b9);
        $this->coreConfig->save();
    }
    
    
    
    
    
    
    
    
    
    public function testConnection(string $_69f63d634889ca8c0fd6310468af35b9, array $_1403528d44504acbeae423595d0a3297) : void
    {
        try {
            $_1689db965dcd5989e8faf51389aad5c4 = $this->mailFactory->createDriver($_69f63d634889ca8c0fd6310468af35b9, $_1403528d44504acbeae423595d0a3297);
        } catch (MailSendException $throwable) {
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_475c6eb871647a4678d99bf178e" . "642b0"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_e608e5b5c4c34a67ba97" . "ef84c1e16199"]);
            $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_0c5123aa744f69bbc0e8b3ea2f6" . "e847d"]($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_85c0317cbb" . "078f094e67d" . "eb8c98747ca"], $_69f63d634889ca8c0fd6310468af35b9);
            throw new MailConnectionTestException($_e05e0022a2e5ad344b9c4a0d3f64e1a5, $throwable->getCode(), $throwable);
        }
        
        
        $_1403528d44504acbeae423595d0a3297 = $_1403528d44504acbeae423595d0a3297 + $_1689db965dcd5989e8faf51389aad5c4->getParamDefaults();
        
        
        if (!$this->logger instanceof Logger || $this->logger->isHandling(LogLevel::INFO)) {
            
            
            $_74945bdd0b6ec4f05715189c617e4a77 = [];
            $_4defcee774cdbb26aef4a747fae82dfa = $_1689db965dcd5989e8faf51389aad5c4->getConfigParametersDefinition();
            foreach ($_4defcee774cdbb26aef4a747fae82dfa as $_6d7b286a47d7a62ccc452569f2a7e30b => $_13d133c615714d50832f54e91fea8fb0) {
                $value = $_1403528d44504acbeae423595d0a3297[$_6d7b286a47d7a62ccc452569f2a7e30b];
                if ($GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_49c6565477ee9f822b499a53e6d2995" . "f"]($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_6f756009a944ef03ce7f7a7aaac" . "1f710"], $_13d133c615714d50832f54e91fea8fb0) && $_13d133c615714d50832f54e91fea8fb0[$GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_6f756009a944ef03ce7f7a7a" . "aac1f710"]] === true) {
                    $value = StringUtil::obfuscateSensitiveValue($value);
                }
                $_74945bdd0b6ec4f05715189c617e4a77[$_6d7b286a47d7a62ccc452569f2a7e30b] = $value;
            }
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_f0ccbc78e1fd1e8a7c4363b" . "e78c343e3"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_7979807b431a2ee1f" . "6bf33646d2034f4"] . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_7aefd482de7885f4293c2926df28c" . "235"]($_74945bdd0b6ec4f05715189c617e4a77));
        }
        try {
            $_1689db965dcd5989e8faf51389aad5c4->testConnection($_1403528d44504acbeae423595d0a3297);
            $this->logger->info($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_05d1cbacb0" . "8ef28281e0c" . "7d1dacbed6f"]);
        } catch (MailConnectionTestNotImplementedException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_f86bedc6c" . "c7ac8e9129" . "5ee2b6aff6" . "c62"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_97d096927c9f0d2fdc5bc37584" . "7d7e2e"] . $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
            
            
            throw MailConnectionTestNotImplementedException::notImplemented($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_0c5123aa744f69bbc0e8b3" . "ea2f6e847d"]($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_44c743290ed5c" . "b96218e04f5365" . "2030e"], $_69f63d634889ca8c0fd6310468af35b9, $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_ddd3110bd20b83f" . "ad9f530b65c4275f" . "8"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_97d096927" . "c9f0d2fdc5" . "bc375847d7" . "e2e"] . $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
            throw new MailConnectionTestException($_e05e0022a2e5ad344b9c4a0d3f64e1a5, $_fe441aa3ef350bfb1a1a1ad8520dd530->getCode(), $_fe441aa3ef350bfb1a1a1ad8520dd530);
        }
    }
    
    
    
    
    
    
    public function testCurrentConnection() : void
    {
        $_1689db965dcd5989e8faf51389aad5c4 = $this->getDriverFromConfig($this->coreConfig);
        try {
            $_1689db965dcd5989e8faf51389aad5c4->testConnection($_1689db965dcd5989e8faf51389aad5c4->getParamValues());
        } catch (MailConnectionTestNotImplementedException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_9f27f4abef4c53ebd91" . "a40df6d4442d9"] . $_1689db965dcd5989e8faf51389aad5c4->getInternalName() . ($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_70809333a0f254acf7a1ad0c7da" . "dd46b"] . $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage()));
            
            
            throw MailConnectionTestNotImplementedException::notImplemented($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (LogicException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new MailConnectionTestException($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_0c5123aa744f69bbc0e8b3ea2f6e" . "847d"]($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_44c743290ed5" . "cb96218e04f53" . "652030e"], $_1689db965dcd5989e8faf51389aad5c4->getDisplayName(), $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage()), $_fe441aa3ef350bfb1a1a1ad8520dd530->getCode(), $_fe441aa3ef350bfb1a1a1ad8520dd530);
        }
    }
    
    
    
    
    
    
    
    
    public function isConfigReadOnly() : bool
    {
        
        
        if (!$this->coreConfig->hasProvider($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_54fa8523f2845872533" . "bfb14523f79ed"])) {
            return false;
        }
        
        
        if ($this->coreConfig->getProvider($GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_54fa8523f2845872533bfb145" . "23f79ed"])->has($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_a5f1edc4027706268" . "85c971a8f455f49"]) || $this->coreConfig->getProvider($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_54fa8523f2845872533" . "bfb14523f79ed"])->has($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_de6aba6b4739ba89" . "201909cf3aa4dd6c"])) {
            return true;
        }
        return false;
    }
    
    
    
    
    
    
    
    
    
    public function hasDriver(string $_69f63d634889ca8c0fd6310468af35b9) : bool
    {
        return $this->mailFactory->canCreateDriver($_69f63d634889ca8c0fd6310468af35b9);
    }
    
    
    
    
    
    
    public function getConfiguredDriverName() : string
    {
        return $this->coreConfig->get($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_49048c556025977386e4c56ad700" . "8110"]) ?? self::DEFAULT_MAIL_DRIVER;
    }
    
    
    
    
    
    
    
    
    
    public function getAllDrivers() : array
    {
        $_1403528d44504acbeae423595d0a3297 = $this->coreConfig->get($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_9d82046795d3f469791575" . "3fbb8af944"]);
        return $this->mailFactory->createAllDrivers($_1403528d44504acbeae423595d0a3297);
    }
    
    
    
    
    
    
    
    public function getAvailableDrivers() : array
    {
        $_f4878b86ff00dbcaaa2e4a90d0e53908 = $this->coreConfig->get($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_49048c556025977386e4" . "c56ad7008110"]);
        $_a97e7c4fb65cf7ad7101bd1098f393e4 = $this->getAllDrivers();
        $drivers = [];
        foreach ($_a97e7c4fb65cf7ad7101bd1098f393e4 as $_69f63d634889ca8c0fd6310468af35b9 => $_1689db965dcd5989e8faf51389aad5c4) {
            if ($_1689db965dcd5989e8faf51389aad5c4->IsAvailable() || $_69f63d634889ca8c0fd6310468af35b9 === $_f4878b86ff00dbcaaa2e4a90d0e53908) {
                $drivers[$_69f63d634889ca8c0fd6310468af35b9] = $_1689db965dcd5989e8faf51389aad5c4;
            }
        }
        return $drivers;
    }
    
    
    
    
    
    
    
    public function getDriverFromConfig(Config\Config $config) : AbstractSendDriver
    {
        $_69f63d634889ca8c0fd6310468af35b9 = $config->get($GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_49048c55602597" . "7386e4c56ad7008" . "110"]);
        
        
        $_1689db965dcd5989e8faf51389aad5c4 = $this->getDriver($_69f63d634889ca8c0fd6310468af35b9);
        if ($_1689db965dcd5989e8faf51389aad5c4 !== null) {
            return $_1689db965dcd5989e8faf51389aad5c4;
        }
        
        
        $_1689db965dcd5989e8faf51389aad5c4 = $this->getDriver(self::DEFAULT_MAIL_DRIVER);
        if ($_1689db965dcd5989e8faf51389aad5c4 !== null) {
            return $_1689db965dcd5989e8faf51389aad5c4;
        }
        
        
        throw new LogicException($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_357e47289293dca0919123ccaca" . "7fd59"]);
    }
    
    
    
    
    
    
    
    
    
    public function getDriver(string $_69f63d634889ca8c0fd6310468af35b9, bool $_d6895f4886c547b5b9e0a598446c66c2 = false) : ?AbstractSendDriver
    {
        try {
            $drivers = $_d6895f4886c547b5b9e0a598446c66c2 ? $this->getAllDrivers() : $this->getAvailableDrivers();
        } catch (Throwable $throwable) {
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_475c6eb871647a4" . "678d99bf178e642b" . "0"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_e608e5b" . "5c4c34a6" . "7ba97ef8" . "4c1e1619" . "9"]);
            $this->logger->error($throwable);
            return null;
        }
        foreach ($drivers as $name => $_1689db965dcd5989e8faf51389aad5c4) {
            if ($name === $_69f63d634889ca8c0fd6310468af35b9) {
                return $_1689db965dcd5989e8faf51389aad5c4;
            }
        }
        return null;
    }
}