@include('shared.toastr')
@php
$runtimeThemeManager = app(\App\Services\ThemeManager::class);
$runtimeThemeSlug = data_get($activeTheme ?? [], 'slug', $runtimeThemeManager->activeSlug());
$runtimeTheme = $runtimeThemeManager->theme((string) $runtimeThemeSlug);
$runtimePalette = $runtimeThemeManager->palette((string) $runtimeThemeSlug);
$runtimeTemplate = $runtimeThemeManager->record((string) $runtimeThemeSlug);
try {
$runtimeCms = app(\App\Services\CmsSettingsService::class)->get();
} catch (\Throwable $e) {
$runtimeCms = [];
}
$runtimeBranding = (array) data_get($runtimeCms, 'branding', []);
$runtimeHeaderInfo = (array) data_get($runtimeCms, 'header_footer.header', []);
$runtimeFooterInfo = (array) data_get($runtimeCms, 'header_footer.footer', []);
$runtimeToUrl = static function (?string $path): ?string {
$path = trim((string) $path);
if ($path === '') return null;
if (\Illuminate\Support\Str::startsWith($path, ['http://', 'https://', '//'])) return $path;
if (\Illuminate\Support\Str::startsWith($path, '/')) return url($path);
return asset($path);
};
$runtimeLogo = \App\Support\BrandLogo::url('main_menu', $runtimeCms, \App\Support\BrandLogo::themeSurface((string) $runtimeThemeSlug));
$runtimeLogoLight = \App\Support\BrandLogo::url('main_menu', $runtimeCms, 'dark');
$runtimeFooterLogo = \App\Support\BrandLogo::url('footer', $runtimeCms, 'dark');
$runtimeFooterBuilder = null;
if (!($themeRendersFooter ?? false)) {
try {
$runtimeFooterBuilder = app(\App\Services\FooterBuilderService::class)->payload($runtimeCms, (string) $runtimeThemeSlug);
} catch (\Throwable $e) {
$runtimeFooterBuilder = \App\Services\FooterBuilderService::defaultBuilder();
$runtimeFooterBuilder['company'] = [];
$runtimeFooterBuilder['social'] = [];
}
if (($useNativeFooterByDefault ?? false) && !is_array(data_get($runtimeCms, 'header_footer.footer.builders.'.$runtimeThemeSlug, data_get($runtimeFooterInfo, 'builder')))) {
$runtimeFooterBuilder['enabled'] = 'no';
}
$runtimeFooterBuilder['company']['logo_url'] = $runtimeFooterLogo;
}
$runtimeSiteName = (string) data_get($runtimeBranding, 'site_name', site_brand_name());
$runtimeLogoWidth = max(0, (int) data_get($runtimeBranding, 'logo_width', 0));
$runtimeLogoHeight = max(0, (int) data_get($runtimeBranding, 'logo_height', 0));
$runtimeLogoMaxHeight = max(10, (int) data_get($runtimeBranding, 'logo_max_height', 42));
$runtimeLogoObjectFit = in_array(data_get($runtimeBranding, 'logo_object_fit'), ['contain','cover','fill','none','scale-down'], true)
? data_get($runtimeBranding, 'logo_object_fit')
: 'contain';
$runtimeUseCustomColors = data_get($runtimeCms, 'colors.customized', 'no') === 'yes';
$runtimePrimary = $runtimeUseCustomColors
? (string) data_get($runtimeCms, 'colors.primary', $runtimePalette['primary'] ?? '#0B5ED7')
: (string) ($runtimePalette['primary'] ?? '#0B5ED7');
$runtimeSecondary = $runtimeUseCustomColors
? (string) data_get($runtimeCms, 'colors.secondary', $runtimePalette['secondary'] ?? '#071A2E')
: (string) ($runtimePalette['secondary'] ?? '#071A2E');
$runtimeAccent = $runtimeUseCustomColors
? (string) data_get($runtimeCms, 'colors.accent', $runtimePalette['accent'] ?? '#F2C94C')
: (string) ($runtimePalette['accent'] ?? '#F2C94C');
$runtimeButtonBg = $runtimeUseCustomColors
? (string) data_get($runtimeCms, 'colors.btn_primary_bg', $runtimePrimary)
: $runtimePrimary;
$runtimeButtonText = $runtimeUseCustomColors
? (string) data_get($runtimeCms, 'colors.btn_primary_text', '#FFFFFF')
: '#FFFFFF';
$runtimeDesign = (array) data_get($runtimeTheme, 'theme_meta.design', []);
$runtimeDesignValue = static fn (string $key, mixed $default = null): mixed => data_get($runtimeDesign, $key, $default);
$runtimeDesignHeaderBg = trim((string) $runtimeDesignValue('header_bg', ''));
$runtimeDesignMenuText = trim((string) $runtimeDesignValue('menu_text', ''));
$runtimeDesignBannerTitle = trim((string) $runtimeDesignValue('banner_title', ''));
$runtimeDesignBannerText = trim((string) $runtimeDesignValue('banner_text', ''));
$runtimeDesignCtaBg = trim((string) $runtimeDesignValue('cta_bg', $runtimeButtonBg));
$runtimeDesignCtaText = trim((string) $runtimeDesignValue('cta_text', $runtimeButtonText));
$runtimeDesignCtaHover = trim((string) $runtimeDesignValue('cta_hover_bg', $runtimeAccent));
$runtimeDesignPageBg = trim((string) $runtimeDesignValue('page_bg', ''));
$runtimeDesignBodyText = trim((string) $runtimeDesignValue('body_text', ''));
$runtimeDesignHeading = trim((string) $runtimeDesignValue('section_heading', ''));
$runtimeDesignFooterBg = trim((string) $runtimeDesignValue('footer_bg', ''));
$runtimeDesignDropdownBg = trim((string) $runtimeDesignValue('dropdown_bg', ''));
$runtimeDesignBorder = trim((string) $runtimeDesignValue('border', ''));
$runtimeDesignOverlay = array_key_exists('banner_overlay', $runtimeDesign)
? max(0, min(95, (int) $runtimeDesignValue('banner_overlay', 35))) / 100
: null;
$runtimeHeroImage = $runtimeToUrl($runtimeDesignValue('hero_image_url'));
$runtimeBannerAltImage = $runtimeToUrl($runtimeDesignValue('banner_alt_image_url'));
$runtimeSectionImage = $runtimeToUrl($runtimeDesignValue('section_image_url'));
$runtimeAuthImage = $runtimeToUrl($runtimeDesignValue('auth_image_url'));
try {
$runtimeMenuService = app(\App\Services\PublicMenuService::class);
$runtimeMainMenu = $runtimeMenuService->items('main', (string) $runtimeThemeSlug);
} catch (\Throwable $e) {
$runtimeMainMenu = [];
}
$runtimeLanguageConfig = \App\Support\WebsiteLanguage::configuration((array) $runtimeCms);
$runtimeLanguageEnabled = $runtimeLanguageConfig['enabled'];
$runtimeLanguageItems = $runtimeLanguageConfig['languages'];
$runtimeLoginUrl = trading_login_url();
$runtimeRegisterUrl = trading_register_url();
$runtimeRecaptchaService = app(\App\Services\GoogleRecaptchaService::class);
$runtimeContactRecaptchaEnabled = $runtimeRecaptchaService->enabledFor('public_contact');
$runtimeContactRecaptchaSiteKey = $runtimeContactRecaptchaEnabled ? $runtimeRecaptchaService->siteKey() : null;
$runtimeContactRecaptchaTheme = $runtimeRecaptchaService->theme();
$runtimeContactRecaptchaSize = $runtimeRecaptchaService->size();
$runtimeDefaultCssData = $runtimeTemplate?->default_css;
$runtimeDefaultCss = is_string($runtimeDefaultCssData)
? $runtimeDefaultCssData
: (is_array($runtimeDefaultCssData)
? collect($runtimeDefaultCssData)
->filter(static fn ($value, $key): bool => is_string($value) && (is_int($key) || $key === 'raw_css'))
->implode("\n")
: '');
$runtimeTechnicalBrands = array_values(array_filter([data_get($runtimeBranding, 'brand_name'), $runtimeSiteName, data_get($runtimeBranding, 'domain_name'), data_get($runtimeCms, 'legal.company_name')]));
$runtimeFxzoneIcons = $runtimeThemeSlug === 'fxzone' ? \App\Support\FxzoneIcons::catalogue() : [];
$runtimeDesignHash = sha1('cms-live-v2|'.json_encode($runtimeDesign).$runtimePrimary.$runtimeSecondary.$runtimeAccent);
@endphp
@include('themes.includes.site-loader-head')
@include('themes.includes.footer-image-styles')
@include('shared.favicon', ['faviconCms' => $runtimeCms])
@if(filled($runtimeTemplate?->custom_head))
{!! $runtimeTemplate->custom_head !!}
@endif
@include('shared.logo-assets', ['logoCms' => $runtimeCms, 'logoTheme' => $runtimeThemeSlug])
@if($runtimeThemeSlug === 'fxzone')
@endif
@include('shared.language-assets', ['cms' => $runtimeCms, 'languageScope' => 'website'])