<?php
namespace Claromentis\Search\UI;

$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"] = (@$GLOBALS["__65da1b1ec2" . "d6653e8a0ab7" . "848e536215"] ?: array()) + array("_d706c160e4" . "5bf7434fff8" . "2a5976f0e19" => base64_decode("YXJyY" . "Xlfa2" . "V5cw=" . "="), "parameter" . "s" => base64_decode("cGFyYW1ld" . "GVycw=="), "_78afaea" . "ff5f62c2" . "0b8d3a0a" . "16b0ace7" . "b" => base64_decode("c2VhcmNoL3VpL2FkdmFuY2VkX3NlYXJjaF9idXR0b24uaHRtbA" . "=="), "_31767d7ad58e706dbf47b7a51" . "a0fe6c4" => base64_decode("Y29" . "1bn" . "Q="), "_b66252d7b" . "bf361012a6" . "531a8e3a73" . "230" => base64_decode("YXJyYXlfZGlmZg=" . "="), "_4d707fab93beb" . "b00bbe69e81596" . "97c90" => base64_decode(""));
use Claromentis\Search\Application\AdvancedSearchButtonInterface;
use Claromentis\Search\Application\ApplicationInterface;
use Claromentis\Search\Config\Applications;
use Claromentis\Search\Parameters;
class AdvancedSearchButton extends \TemplaterComponentTmpl
{
    public function Show($attributes)
    {
        $sp = $attributes[$GLOBALS["__65da1b1ec2d6653" . "e8a0ab7848e536215"]["param" . "eters"]];
        if (!$sp instanceof Parameters) {
            return $GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_4d707fab93bebb00bb" . "e69e8159697c90"];
        }
        $apps_list = new Applications();
        $_f3e72c5e54a6dd0fb5c5005cd9574e42 = $apps_list->GetSelectedAll();
        $_17728688d370dbb69c53d9e641c4b0e0 = $sp->GetObjectTypesList();
        $_58ffdc5a290a75319499791b0ed95169 = $this->FindMatchingApp($_f3e72c5e54a6dd0fb5c5005cd9574e42, $_17728688d370dbb69c53d9e641c4b0e0);
        if ($_58ffdc5a290a75319499791b0ed95169) {
            
            
            $args = $_58ffdc5a290a75319499791b0ed95169->ShowAdvancedSearchButton($sp);
            $template = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_78afaeaff5f6" . "2c20b8d3a0a16" . "b0ace7b"];
            return $this->CallTemplater($template, $args);
        }
        return $GLOBALS["__65da1b1ec2d6653e8a0ab" . "7848e536215"]["_4d707fab93bebb00bbe69" . "e8159697c90"];
    }
    protected function FindMatchingApp($_f3e72c5e54a6dd0fb5c5005cd9574e42, $_17728688d370dbb69c53d9e641c4b0e0)
    {
        foreach ($_f3e72c5e54a6dd0fb5c5005cd9574e42 as $_f44467aacb8a4520c7382769d24aa422) {
            
            
            if ($_f44467aacb8a4520c7382769d24aa422 instanceof AdvancedSearchButtonInterface) {
                $_4b7300c1f8c561c5e59b75b6ba8eeccf = $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_d706c16" . "0e45bf74" . "34fff82a" . "5976f0e1" . "9"]($_f44467aacb8a4520c7382769d24aa422->GetTypes());
                if ($GLOBALS["__65da1b1ec2d6653e8a0ab7848e5" . "36215"]["_31767d7ad58e706db" . "f47b7a51a0fe6c4"]($GLOBALS["__65da1b1ec2d6653e8a" . "0ab7848e536215"]["_b66252d7bb" . "f361012a653" . "1a8e3a73230"]($_17728688d370dbb69c53d9e641c4b0e0, $_4b7300c1f8c561c5e59b75b6ba8eeccf)) == 0) {
                    return $_f44467aacb8a4520c7382769d24aa422;
                }
            }
        }
        return null;
    }
}