<?php
namespace Claromentis\Core\Mail;

$GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"] = (@$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"] ?: array()) + array("_2b9b83b16cb8aa329c" . "f0691ef433f372" => base64_decode("c3lzd" . "GVt"), "_e608e5b5c4c34a67ba97ef8" . "4c1e16199" => base64_decode("J" . "w" . "=" . "="), "_a5f1edc402770626885c971a" . "8f455f49" => base64_decode("Q0xBUk9fTUFJTF" . "9TRU5EX0RSSVZF" . "Ug=="), "_ce43e24de71081161087b7" . "fbdcab4ad0" => base64_decode("VW5leHBlY3RlZCBEcml2ZXIgRXhjZXB0aW9uIHJlY2VpdmV" . "k"), "_49c6565477ee" . "9f822b499a53e" . "6d2995f" => base64_decode("YXJyYXlfa2V" . "5X2V4aXN0cw" . "=="), "_04ddd04957d72dac" . "88ea1b165c2f5924" => base64_decode("cGFuZWxzLnN5c2FkbWluLm1haWwuZXJyb3IudW5rbm93bl9" . "kcml2ZXI="), "_de6aba6b473" . "9ba89201909c" . "f3aa4dd6c" => base64_decode("Q0xBUk9fTUFJTF9TRU5EX1BBUk" . "FNUw=="), "_71f67ca07b" . "ecf001108d7" . "25cc02b17c7" => base64_decode("JyBpcyBpbnZhbGlkLCBjYW5ub3Qgc2V0IFN5c3RlbSBBZGR" . "yZXNzJyBuYW1l"), "_05d1cbacb08ef28281e0c7d" . "1dacbed6f" => base64_decode("Q29ubmVjdGlvbiB0ZXN0IHN1Y2NlZWRl" . "ZA=="), "_f86bedc6cc7ac8e91" . "295ee2b6aff6c62" => base64_decode("VGVzdCB1bmltcGxlbWVudG" . "VkIHVzaW5nIGRyaXZlciAn"), "_9d82046795d3f4697915753fbb8a" . "f944" => base64_decode("Y2ZnX21haWxfc2VuZF9wYXJhbX" . "M="), "_e92ad742fc12ec1dd5c30557fafca3" . "31" => base64_decode("Ig" . "=="), "_357e47289293dca" . "0919123ccaca7fd5" . "9" => base64_decode("RGVmYXVsdCBtYWlsIGRy" . "aXZlciBub3QgZm91bmQ="), "_f0ccbc78e1fd1e8a7c4363" . "be78c343e3" => base64_decode("VGVzdGluZyBtYWlsIGNvbmZpZyBmb3IgZHJpdmVyIA" . "=="), "_85c0317cbb078f" . "094e67deb8c9874" . "7ca" => base64_decode("cGFuZWxzLnN5c2FkbWluLm1haWwuY29uZmlnL" . "nRlc3QudW5rbm93bg=="), "_ddd3110bd20b83f" . "ad9f530b65c4275f" . "8" => base64_decode("VXNpbmcg" . "ZHJpdmVy" . "ICc="), "_54fa8523f284587" . "2533bfb14523f79e" . "d" => base64_decode("ZW" . "52"), "_9f27f4abef4c53ebd91a40d" . "f6d4442d9" => base64_decode("VGVzdCB1bmltcGxlbWVudGVkIHVzaW5nIGRyaXZlci" . "A="), "_49048c556025977386e4c56ad70" . "08110" => base64_decode("Y2ZnX21haWxfc2VuZF" . "9kcml2ZXI="), "_97d096927c9f0d2f" . "dc5bc375847d7e2e" => base64_decode("Jzo" . "g"), "_7aefd482de7885f4293c292" . "6df28c235" => base64_decode("anNvbl9lbmNv" . "ZGU="), "_c726fd7c5fa8806fac" . "00fdf09b4de13b" => base64_decode("Q29uZml" . "nICc="), "_fe2227f1e9734bb5d320f2a51d8c8" . "bb0" => base64_decode("JyBub3Qgc2V0LCBjYW5ub3Qgc2V0IFN5c" . "3RlbSBBZGRyZXNzJyBuYW1l"), "val" . "ue" => base64_decode("dmFsd" . "WU="), "_70809333a0f254acf7a1" . "ad0c7dadd46b" => base64_decode("OiA" . "="), "_475c6eb871647a4678d99bf17" . "8e642b0" => base64_decode("VW5rbm93biBtYWlsIGRy" . "aXZlciAn"), "_0c5123aa744f69" . "bbc0e8b3ea2f6e8" . "47d" => base64_decode("bG1z" . "Zw=="), "_f69812ed2c" . "66c3cd2e502" . "c9eac3591ee" => base64_decode("bWFpb" . "A=="), "_44c743290ed5cb96218e04f" . "53652030e" => base64_decode("cGFuZWxzLnN5c2FkbWluLm1haWwuY29uZmln" . "LnRlc3RfZmFpbF9kZXRhaWw="), "_ed4f1afa017a1600d32ec1279b1db7" . "f9" => base64_decode("RXJyb3Igc2" . "VuZGluZyBl" . "bWFpbDog"), "_5e30c4717ced36cff9e93e19a5c576" . "cc" => base64_decode("aXNfc3RyaW" . "5n"), "_7979807b431a2ee1f6bf33646" . "d2034f4" => base64_decode("OiBQYXJhbW" . "V0ZXJzOiA="), "_7f628626dd1d55c71b1fc093" . "2ffd1d2c" => base64_decode("aXNfYXJyYX" . "k="), "_4d707fab93bebb00bbe69e81" . "59697c90" => base64_decode(""), "_409519cfaf0be8f908611ad2093" . "51191" => base64_decode("LCBTdWJqZWN0" . "OiAi"), "_6f756009a944ef03ce7f7a7aaac1" . "f710" => base64_decode("c2VjdXJ" . "l"), "_e8ac993f74f781a" . "14ff7c657429b7e5" . "a" => base64_decode("RXJyb3Igc2VuZGluZyBxdWV1ZWQgZW1haWw6IA=" . "="), "de" . "fa" . "ul" . "t" => base64_decode("ZGVmY" . "XVsdA" . "=="), "_bda7e68ddb5457241ee6582bba13bd0" . "7" => base64_decode("TWFpbCBhZGRlZCB0byBxdWV1Z" . "S4gVG86IA=="), "_173260988afa5a3136943cc7af" . "828c7d" => base64_decode("U2VuZGluZyBlb" . "WFpbCB1c2luZy" . "A="));
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 $_0f6231d620cefa9f483e066651e8bc61, Audit $audit, PanelsList $panelsList, LoggerInterface $logger = null)
    {
        $this->mailFactory = $_30975c67491190ff76aabd9b212b3323;
        $this->mailQueue = $_0f7b3ada6dd559ff0e38226ebe686109;
        $this->utility = $_99d5ea20132b2d99e3984089fae556d9;
        $this->coreConfig = $_e7c02b1e54c31b0da5aa531667c59980;
        $this->claText = $_0f6231d620cefa9f483e066651e8bc61;
        $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["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_5e30c4717ced36cff9" . "e93e19a5c576cc"]($_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["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_c726fd7c5fa8" . "806fac00fdf09" . "b4de13b"] . self::CONFIG_SYSTEM_NAME . $GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"]["_fe2227f1e9734bb5d" . "320f2a51d8c8bb0"]);
            $_1ab9364741e2bcd0390100860f733720 = $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_4d707fab93bebb00bbe69e8159697" . "c90"];
        } elseif (!$GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_5e30c4717ce" . "d36cff9e93e1" . "9a5c576cc"]($_1ab9364741e2bcd0390100860f733720)) {
            $this->logger->warning($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_c726fd7c5fa8806fac00fdf09b4de1" . "3b"] . self::CONFIG_SYSTEM_NAME . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_71f67ca07becf001108d7" . "25cc02b17c7"]);
            $_1ab9364741e2bcd0390100860f733720 = $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_4d707fab93b" . "ebb00bbe69e8" . "159697c90"];
        }
        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["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_2b9b83b16c" . "b8aa329cf06" . "91ef433f372"], $GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_f69812ed2c66c3cd2e502c9eac35" . "91ee"], 0, $GLOBALS["__65da1b1e" . "c2d6653e8a" . "0ab7848e53" . "6215"]["_bda7e68ddb5457241e" . "e6582bba13bd07"] . $this->utility->createAddressString($_c2f6f7dc50f77b2d217bd2e23a6ff2a0->getTo()) . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_409519cf" . "af0be8f90" . "8611ad209" . "351191"] . $_c2f6f7dc50f77b2d217bd2e23a6ff2a0->getSubject() . $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_e92ad742fc12ec1" . "dd5c30557fafca33" . "1"]);
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    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"]["_7f628626dd1d55" . "c71b1fc0932ffd1" . "d2c"]($_0e4c020a77dcb5d5f8684e4d4d3e80ec)) {
            $_0e4c020a77dcb5d5f8684e4d4d3e80ec = [$_0e4c020a77dcb5d5f8684e4d4d3e80ec];
        }
        if (isset($_c49fa31c9665197cc1250a0d4bcfb78f) && !$GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_7f628626dd1d55c71b1fc0932" . "ffd1d2c"]($_c49fa31c9665197cc1250a0d4bcfb78f)) {
            $_c49fa31c9665197cc1250a0d4bcfb78f = [$_c49fa31c9665197cc1250a0d4bcfb78f];
        }
        if (isset($_f72b06c6fd9f67040ec629a7b8dcb371) && !$GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_7f628626dd1d55c71b" . "1fc0932ffd1d2c"]($_f72b06c6fd9f67040ec629a7b8dcb371)) {
            $_f72b06c6fd9f67040ec629a7b8dcb371 = [$_f72b06c6fd9f67040ec629a7b8dcb371];
        }
        if (isset($_4e7ab34a53ffb13eb0838003f33034d4) && !$GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_7f628626dd1d55c71b" . "1fc0932ffd1d2c"]($_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["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_173260988afa5a3136943cc7" . "af828c7d"] . $_47db1fc36ccc4f4e8679430f0c7b17c8);
            $_47db1fc36ccc4f4e8679430f0c7b17c8->send($_c2f6f7dc50f77b2d217bd2e23a6ff2a0);
        } catch (TransportExceptionInterface|Exception $_c35473364fa7a050299058f332ec29c1) {
            $this->logger->error($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_ed4f1afa017a1600d32ec12" . "79b1db7f9"] . $_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["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_e8ac993" . "f74f781a" . "14ff7c65" . "7429b7e5" . "a"] . $_c35473364fa7a050299058f332ec29c1);
                continue;
            } catch (MailSendException $_c35473364fa7a050299058f332ec29c1) {
                $this->logger->warning($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_e8ac993f74f781a14ff7c657" . "429b7e5a"] . $_c35473364fa7a050299058f332ec29c1);
            }
            $this->mailQueue->markAsSent($id);
        }
    }
    
    
    
    
    
    
    
    
    
    private function createDefaultTransport() : TransportInterface
    {
        try {
            return $this->mailFactory->createTransportFromConfig($this->coreConfig);
        } catch (MailSendException $_c35473364fa7a050299058f332ec29c1) {
            throw new MailSendException($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_ce43e24de7108" . "1161087b7fbdca" . "b4ad0"], 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"]["_2b9b83b16cb" . "8aa329cf0691" . "ef433f372"]);
        if (!$_9c58d9e285fddad133acf2e9dff4c4b5->IsAccessible($context)) {
            throw new AdminAccessDeniedException($GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_2b9b83b16cb8aa329cf0691ef43" . "3f372"]);
        }
        $_ba6d96e59a7b293c2883196b6bd04810 = false;
        $_7edf5300814a7e43425b2a86d6a77c76 = [];
        foreach ($this->getAllDrivers() as $_1689db965dcd5989e8faf51389aad5c4) {
            if ($_69f63d634889ca8c0fd6310468af35b9 === $_1689db965dcd5989e8faf51389aad5c4->getInternalName()) {
                $_ba6d96e59a7b293c2883196b6bd04810 = true;
            }
            $_147aa65e6f86b03cd87a88a580320c7e = $_1689db965dcd5989e8faf51389aad5c4->getConfigParametersDefinition();
            foreach ($_147aa65e6f86b03cd87a88a580320c7e as $_6d7b286a47d7a62ccc452569f2a7e30b => $_e25ec43f6bf86add43db264a786bfcaa) {
                if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_49c6565477ee9f822b" . "499a53e6d2995f"]($_6d7b286a47d7a62ccc452569f2a7e30b, $_f56e92e2b328797520a80ee0c4fb95c5)) {
                    $value = $_f56e92e2b328797520a80ee0c4fb95c5[$_6d7b286a47d7a62ccc452569f2a7e30b];
                } else {
                    $value = $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_49c6565477ee9f822b499a" . "53e6d2995f"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["val" . "ue"], $_e25ec43f6bf86add43db264a786bfcaa) ? $_e25ec43f6bf86add43db264a786bfcaa[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["v" . "a" . "l" . "u" . "e"]] : $_e25ec43f6bf86add43db264a786bfcaa[$GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["de" . "fa" . "ul" . "t"]];
                }
                $_97dea5086bb7551c9aab10f37e124446 = false;
                if ($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_49c6565477ee9f822b499a5" . "3e6d2995f"]($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["de" . "fa" . "ul" . "t"], $_e25ec43f6bf86add43db264a786bfcaa) && $value === $_e25ec43f6bf86add43db264a786bfcaa[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["defa" . "ult"]]) {
                    $_97dea5086bb7551c9aab10f37e124446 = true;
                }
                if (!$_97dea5086bb7551c9aab10f37e124446 && $value !== null && $value !== $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_4d707fab93bebb00bbe69e81596" . "97c90"]) {
                    $_7edf5300814a7e43425b2a86d6a77c76[$_6d7b286a47d7a62ccc452569f2a7e30b] = $value;
                }
            }
        }
        if (!$_ba6d96e59a7b293c2883196b6bd04810) {
            throw new MailSendException($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_0c5123aa744f69bbc" . "0e8b3ea2f6e847d"]($GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_04ddd04957d72dac88ea1b16" . "5c2f5924"], $_69f63d634889ca8c0fd6310468af35b9));
        }
        $this->coreConfig->set($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_9d82046795d3f4697915753" . "fbb8af944"], $_7edf5300814a7e43425b2a86d6a77c76);
        $this->coreConfig->set($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_49048c556025977386" . "e4c56ad7008110"], $_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["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_475c6eb871647a4678d99bf1" . "78e642b0"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_e608e5b5c4c34a67ba97ef84c" . "1e16199"]);
            $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d665" . "3e8a0ab7848e5362" . "15"]["_0c5123aa744f69bbc0e8b3ea2f" . "6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_85c0317cbb078f094e6" . "7deb8c98747ca"], $_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["__65da1b1ec2d6653e8a0ab7848e5362" . "15"]["_49c656547" . "7ee9f822b4" . "99a53e6d29" . "95f"]($GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_6f756009a944ef03c" . "e7f7a7aaac1f710"], $_13d133c615714d50832f54e91fea8fb0) && $_13d133c615714d50832f54e91fea8fb0[$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_6f756009a944ef" . "03ce7f7a7aaac1f" . "710"]] === true) {
                    $value = StringUtil::obfuscateSensitiveValue($value);
                }
                $_74945bdd0b6ec4f05715189c617e4a77[$_6d7b286a47d7a62ccc452569f2a7e30b] = $value;
            }
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_f0ccbc78e1fd1e8a7c4363be78c3" . "43e3"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_7979807b431a2ee1f6bf33646d2034" . "f4"] . $GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_7aefd482de7885" . "f4293c2926df28c" . "235"]($_74945bdd0b6ec4f05715189c617e4a77));
        }
        try {
            $_1689db965dcd5989e8faf51389aad5c4->testConnection($_1403528d44504acbeae423595d0a3297);
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_05d1cbacb08ef2828" . "1e0c7d1dacbed6f"]);
        } catch (MailConnectionTestNotImplementedException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_f86bedc6cc7ac8e91295ee2b6af" . "f6c62"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_97d096927c9f0d2f" . "dc5bc375847d7e2e"] . $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
            
            
            throw MailConnectionTestNotImplementedException::notImplemented($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (Exception $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            $_e05e0022a2e5ad344b9c4a0d3f64e1a5 = $GLOBALS["__65da1b1ec2d6653e8a0" . "ab7848e536215"]["_0c5123aa744f69bbc0e8b3ea2f6e" . "847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_44c743290e" . "d5cb96218e0" . "4f53652030e"], $_69f63d634889ca8c0fd6310468af35b9, $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
            $this->logger->info($GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_ddd3110bd20b83fad9f530b65c4275" . "f8"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_97d096927c9f0d2fdc5bc3758" . "47d7e2e"] . $_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"]["_9f27f4abef4c53ebd91a40" . "df6d4442d9"] . $_1689db965dcd5989e8faf51389aad5c4->getInternalName() . ($GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["_70809333a0f254acf7a1ad0c7dadd46" . "b"] . $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage()));
            
            
            throw MailConnectionTestNotImplementedException::notImplemented($_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage());
        } catch (LogicException $_fe441aa3ef350bfb1a1a1ad8520dd530) {
            throw new MailConnectionTestException($GLOBALS["__65da1b1ec2d6" . "653e8a0ab7848e" . "536215"]["_0c5123aa744f69bb" . "c0e8b3ea2f6e847d"]($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_44c743290ed5cb96218e04f536" . "52030e"], $_1689db965dcd5989e8faf51389aad5c4->getDisplayName(), $_fe441aa3ef350bfb1a1a1ad8520dd530->getMessage()), $_fe441aa3ef350bfb1a1a1ad8520dd530->getCode(), $_fe441aa3ef350bfb1a1a1ad8520dd530);
        }
    }
    
    
    
    
    
    
    
    
    public function isConfigReadOnly() : bool
    {
        
        
        if (!$this->coreConfig->hasProvider($GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_54fa8523f2845872533bfb1" . "4523f79ed"])) {
            return false;
        }
        
        
        if ($this->coreConfig->getProvider($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_54fa8523f2845872533bfb14523f7" . "9ed"])->has($GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_a5f1edc402770626885c97" . "1a8f455f49"]) || $this->coreConfig->getProvider($GLOBALS["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_54fa8523f28" . "45872533bfb1" . "4523f79ed"])->has($GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"]["_de6aba6b4739ba89201909cf3aa" . "4dd6c"])) {
            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"]["_49048c556025977386e4c56ad7" . "008110"]) ?? self::DEFAULT_MAIL_DRIVER;
    }
    
    
    
    
    
    
    
    
    
    public function getAllDrivers() : array
    {
        $_1403528d44504acbeae423595d0a3297 = $this->coreConfig->get($GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_9d82046795d3f4697915753fbb8af94" . "4"]);
        return $this->mailFactory->createAllDrivers($_1403528d44504acbeae423595d0a3297);
    }
    
    
    
    
    
    
    
    public function getAvailableDrivers() : array
    {
        $_f4878b86ff00dbcaaa2e4a90d0e53908 = $this->coreConfig->get($GLOBALS["__65da1b1ec2d6653e8a0ab7848e536" . "215"]["_49048c556025977386e4c56" . "ad7008110"]);
        $_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["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_49048c556025977386e4c56ad7008" . "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["__65da1b1ec2d6653e8a0ab7848e" . "536215"]["_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["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_475c6eb87" . "1647a4678d" . "99bf178e64" . "2b0"] . $_69f63d634889ca8c0fd6310468af35b9 . $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_e608e5b5c4c34a67ba97ef84c1e16" . "199"]);
            $this->logger->error($throwable);
            return null;
        }
        foreach ($drivers as $name => $_1689db965dcd5989e8faf51389aad5c4) {
            if ($name === $_69f63d634889ca8c0fd6310468af35b9) {
                return $_1689db965dcd5989e8faf51389aad5c4;
            }
        }
        return null;
    }
}