<?php

/**
 * Header class for Header Footer Grid.
 *
 * Name:    Header Footer Grid
 * Author:  
 *
 * @version 1.0.0
 * @package HFG
 */

namespace HFG\Core\Builder;

use HFG\Core\Customizer\Header_Presets;
use HFG\Main;
use Solace\Core\Dynamic_Css;
use Solace\Core\Settings\Mods;
use Solace\Core\Styles\Dynamic_Selector;
use Solace\Core\Theme_Info;
use Solace\Customizer\Controls\React\Presets_Selector;
use HFG\Core\Settings\Manager as SettingsManager;
use WP_Customize_Control;
use WP_Customize_Manager;

/**
 * Class Header
 *
 * @package HFG\Core\Builder
 */
class Header extends Abstract_Builder
{
	use Theme_Info;

	/**
	 * Builder name.
	 */
	const BUILDER_NAME = 'header';

	/**
	 * Settings ids.
	 */
	const BACKGROUND_HEADING = 'background_heading';
	const ADVANCED_STYLE     = 'advanced_style';
	const BACKGROUND_SETTING = 'background';

	/**
	 * Default color for global header background
	 *
	 * @var string Background default color.
	 */
	protected $default_background = 'var(--sol-color-background)';

	/**
	 * Header init.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function init()
	{
		$this->set_property('title', __('Header Builder', 'solace'));
		$this->set_property(
			'description',
			apply_filters(
				'hfg_header_panel_description',
				sprintf(
					/* translators: %s link to documentation */
					esc_html__('Design your %1$s by dragging, dropping and resizing all the elements in real-time.', 'solace'),
					/* translators: %s builder type */
					$this->get_property('title'),
				)
			)
		);
		$migrated_hfg = solace_is_new_builder();

		add_filter('hfg_header_wrapper_class', [$this, 'add_class_to_header_wrapper']);
		// add_action( 'wp_enqueue_scripts', [ $this, 'load_scripts' ] );
		
	}

	/**
	 * Load Component Scripts
	 *
	 * @return void
	 */
	public function load_scripts()
	{
		wp_add_inline_style( 'solace-style', $this->toggle_style() );
	}

	/**
	 * Get CSS to use as inline script
	 *
	 * @return string
	 */
	public function toggle_style()
	{
		$css = '';

		$css .= $this->generate_background_css('hfg_header_layout_top_background', 'body.elementor-page header .header-top');
		$css .= $this->generate_background_css('hfg_header_layout_main_background', 'body.elementor-page header .header-main');
		$css .= $this->generate_background_css('hfg_header_layout_bottom_background', 'body.elementor-page header .header-bottom');

		return Dynamic_Css::minify_css($css);
	}
	
	private function generate_background_css($theme_mod, $selector)
	{
		$row_background = get_theme_mod($theme_mod);
	
		if (is_array($row_background) && $row_background['type'] === 'color' && isset($row_background['toggleElementor']) && $row_background['toggleElementor']) {
			$css = $selector . ' { background: var(--bgcolorelementor); }';
			return $css;
		}
	
		return '';
	}

	/**
	 * Called to register component controls.
	 *
	 * @param WP_Customize_Manager $wp_customize The Customize Manager.
	 *
	 * @return WP_Customize_Manager
	 * @since   1.0.0
	 * @access  public
	 */
	public function customize_register(WP_Customize_Manager $wp_customize)
	{
		if (!solace_is_new_builder()) {
			return parent::customize_register($wp_customize);
		}

		$section = $wp_customize->get_section('solace_pro_global_header_settings');
		if (!empty($section)) {
			$section->priority = 201;
		}

		$wp_customize->add_section(
			'solace_header_presets',
			[
				'title'    => __('Header Presets', 'solace'),
				'priority' => 200,
				'panel'    => 'hfg_header',
			]
		);

		$wp_customize->add_setting(
			'hfg_solace_header_presets',
			[
				'sanitize_callback' => 'sanitize_text_field',
				'label'             => __('Header Presets', 'solace'),
			]
		);

		$wp_customize->add_control(
			new Presets_Selector(
				$wp_customize,
				'hfg_solace_header_presets',
				[
					'section'   => 'solace_header_presets',
					'transport' => 'postMessage',
					'priority'  => 30,
					'presets'   => $this->get_header_presets(),
					'builder'   => $this->layout_control_id,
				]
			)
		);

		$wp_customize->add_section(
			'solace_pro_global_header_settings',
			[
				'title'    => __('Global Header Settings', 'solace'),
				'priority' => 200,
				'panel'    => 'hfg_header',
			]
		);

		$this->customize_global_header();

		SettingsManager::get_instance()->load('solace_pro_global_header_settings', $wp_customize);

		$tabs = $wp_customize->get_control('solace_pro_global_header_settings_tabs');
		$this->move_pro_controls($wp_customize, $tabs);

		return parent::customize_register($wp_customize);
	}

	/**
	 * Moves the controls from pro in the specific tabs so that they
	 * merge well with the Solace global header setting
	 *
	 * @param WP_Customize_Manager $wp_customize The Customize Manager.
	 * @param WP_Customize_Control $global_settings_tabs The Tabs Control.
	 */
	private function move_pro_controls(WP_Customize_Manager $wp_customize, WP_Customize_Control $global_settings_tabs)
	{
		if (!property_exists($global_settings_tabs, 'controls') || !property_exists($global_settings_tabs, 'tabs')) {
			return;
		}

		if ($wp_customize->get_control('solace_transparent_header') !== null) {
			$global_settings_tabs->controls['style']['solace_transparent_header'] = [];
		}

		if ($wp_customize->get_control('solace_transparent_only_on_home') !== null) {
			$wp_customize->get_control('solace_transparent_only_on_home')->priority   = 10;
			$global_settings_tabs->controls['style']['solace_transparent_only_on_home'] = [];
		}

		if ($wp_customize->get_control('solace_global_header') !== null) {
			$global_settings_tabs->tabs['general']                           = [
				'label' => esc_html__('General', 'solace'),
				'icon'  => 'admin-generic',
			];
			$global_settings_tabs->controls['general']['solace_global_header'] = [];
		}

		if ($wp_customize->get_control('solace_header_conditional_selector') !== null) {
			$global_settings_tabs->controls['general']['solace_header_conditional_selector'] = [];
		}

		// sorts the tabs so the general tab is showed first
		ksort($global_settings_tabs->tabs);
	}

	/**
	 * Registers controls for global header background
	 */
	private function customize_global_header()
	{
		$section_id = 'solace_pro_global_header_settings';

		SettingsManager::get_instance()->add(
			[
				'id'        => self::BACKGROUND_HEADING,
				'group'     => $section_id,
				'label'     => esc_html__('Background', 'solace'),
				'section'   => $section_id,
				'tab'       => 'style',
				'priority'  => 15,
				'transport' => 'postMessage',
				'type'      => 'Solace\Customizer\Controls\Heading',
				'options'   => [
					'accordion'        => true,
					'controls_to_wrap' => 20,
					'expanded'         => true,
					'class'            => 'background-accordion',
				],
			]
		);

		SettingsManager::get_instance()->add(
			[
				'id'                 => self::ADVANCED_STYLE,
				'group'              => $section_id,
				'label'              => esc_html__('Enable Advanced Options', 'solace'),
				'section'            => $section_id,
				'tab'                => 'style',
				'type'               => 'solace_toggle_control',
				'priority'           => 25,
				'transport'          => 'refresh',
				'sanitize_callback'  => 'solace_sanitize_checkbox',
				'default'            => true,
				'conditional_header' => true,
			]
		);

		SettingsManager::get_instance()->add(
			[
				'id'                    => self::BACKGROUND_SETTING,
				'group'                 => $section_id,
				'section'               => $section_id,
				'tab'                   => 'style',
				'label'                 => esc_html__('Global', 'solace'),
				'type'                  => '\Solace\Customizer\Controls\React\Background',
				'live_refresh_selector' => true,
				'live_refresh_css_prop' => [
					'cssVar' => [
						'vars'     => 'backgroundControl',
						'selector' => '.global-styled',
					],
				],
				'options'               => [
					'priority'        => 30,
					'active_callback' => [$this, 'has_global_background'],
				],
				'default'               => [
					'type'       => 'color',
					'colorValue' => $this->default_background,
				],
				'transport'             => 'postMessage',
				'sanitize_callback'     => 'solace_sanitize_background',
				'conditional_header'    => true,
			]
		);

		foreach ($this->get_rows() as $row => $row_data) {
			if ($row === 'sidebar') {
				continue;
			}

			SettingsManager::get_instance()->add(
				[
					'id'                => $row . '_shortcut',
					'group'             => $section_id,
					'section'           => $section_id,
					'tab'               => 'style',
					'transport'         => 'postMessage',
					'sanitize_callback' => 'esc_attr',
					'type'              => '\Solace\Customizer\Controls\Button',
					'priority'          => 35,
					'options'           => [
						'button_text'      => $row_data['title'],
						'button_class'     => 'button_background',
						'icon_class'       => 'edit',
						'shortcut'         => true,
						'is_button'        => false,
						'control_to_focus' => 'hfg_header_layout_' . $row . '_background',
						'active_callback'  => [$this, 'has_not_global_background'],
					],
				]
			);

			SettingsManager::get_instance()->add(
				[
					'id'                => $row . '_shortcut',
					'group'             => $section_id,
					'section'           => 'hfg_header_layout_' . $row,
					'label'              => __( 'Hide Row', 'solace' ),
					'type'               => 'solace_toggle_control',
					'priority'           => 25,
					'transport'          => 'refresh',
					'sanitize_callback'  => 'solace_sanitize_checkbox',
					'default'            => false,
					'conditional_header' => true,
				]
			);

		}
	}

	/**
	 * Adds a class to the header wrapper.
	 *
	 * @param string $classes Existing classes.
	 * @return string Updated classes.
	 */
	public function add_class_to_header_wrapper($classes)
	{
		return $classes . ($this->has_global_background() ? ' global-styled' : '');
	}

	/**
	 * Returns true if individual options from header background are disabled
	 *
	 * @return bool
	 */
	public function has_global_background()
	{
		return !get_theme_mod('solace_pro_global_header_settings_advanced_style', true);
	}

	/**
	 * Returns true if individual options from header background are active
	 *
	 * @return bool
	 */
	public function has_not_global_background()
	{
		return !$this->has_global_background();
	}

	/**
	 * Method called via hook.
	 *
	 * @since   1.0.0
	 * @access  public
	 */
	public function load_template()
	{
		Main::get_instance()->load('header-wrapper');
	}

	/**
	 * Get builder id.
	 *
	 * @return string Builder id.
	 */
	public function get_id()
	{
		return self::BUILDER_NAME;
	}

	/**
	 * Render builder row.
	 *
	 * @param string $device_id The device id.
	 * @param string $row_id The row id.
	 * @param array  $row_details Row data.
	 */
	public function render_row($device_id, $row_id, $row_details)
	{

		$name = $row_id;

		if ($row_id === 'sidebar' && $device_id === 'mobile') {
			$name = 'mobile';
		}

		Main::get_instance()->load('row-wrapper', $name);
	}

	/**
	 * Method to add global header css styles.
	 *
	 * @param array $css_array An array containing css rules.
	 * @return array
	 */
	public function add_style(array $css_array = array())
	{
		$background = get_theme_mod(
			'solace_pro_global_header_settings_background',
			[
				'type'       => 'color',
				'colorValue' => 'var(--sol-color-background)',
			]
		);

		$rules         = [];
		$control_id    = 'solace_pro_global_header_settings_background';
		$selector      = '.global-styled';
		$default_color = 'var(--sol-color-background)';

		if ($background['type'] === 'color' && !empty($background['colorValue'])) {
			$rules = array_merge(
				$rules,
				[
					'--bgcolor' => [
						Dynamic_Selector::META_KEY     => $control_id . '.colorValue',
						Dynamic_Selector::META_DEFAULT => $default_color,
					],
				]
			);
		}

		if ($background['type'] === 'image') {
			$rules = array_merge(
				$rules,
				[
					'--overlaycolor'     => [
						Dynamic_Selector::META_KEY => $control_id . '.overlayColorValue',
					],
					'--bgimage'          => [
						Dynamic_Selector::META_KEY    => $control_id,
						Dynamic_Selector::META_FILTER => function ($css_prop, $value, $meta, $device) {
							$image = $this->get_row_featured_image($value['imageUrl'], $value['useFeatured'], $meta);
							return sprintf('%s:%s;', $css_prop, $image);
						},
					],
					'--bgposition'       => [
						Dynamic_Selector::META_KEY    => $control_id,
						Dynamic_Selector::META_FILTER => function ($css_prop, $value, $meta, $device) {
							if (!$this->is_valid_focus_point($value['focusPoint'])) {
								return '';
							}

							$parsed_position = round($value['focusPoint']['x'] * 100) . '% ' . round($value['focusPoint']['y'] * 100) . '%;';

							return sprintf('%s:%s;', $css_prop, $parsed_position);
						},
					],
					'--bgattachment'     => [
						Dynamic_Selector::META_KEY    => $control_id,
						Dynamic_Selector::META_FILTER => function ($css_prop, $value, $meta, $device) {
							if (!isset($value['fixed']) || $value['fixed'] !== true) {
								return '';
							}

							return sprintf('%s:fixed;', $css_prop);
						},
					],
					'--bgoverlayopacity' => [
						Dynamic_Selector::META_KEY    => $control_id,
						Dynamic_Selector::META_FILTER => function ($css_prop, $value, $meta, $device) {
							if (!isset($value['overlayOpacity'])) {
								return '';
							}

							return sprintf('%s:%s;', $css_prop, $value['overlayOpacity'] / 100);
						},
					],
				]
			);
		}

		$css_array[] = [
			Dynamic_Selector::KEY_SELECTOR => $selector,
			Dynamic_Selector::KEY_RULES    => $rules,
		];

		return parent::add_style($css_array);
	}

	/**
	 * Return  the builder rows.
	 *
	 * @return array
	 * @since   1.0.0
	 * @updated 1.0.1
	 * @access  protected
	 */
	protected function get_rows()
	{
		return [
			'top'     => array(
				'title'       => esc_html__('Header Top', 'solace'),
				'description' => $this->get_property('description'),
			),
			'main'    => array(
				'title'       => esc_html__('Header Main', 'solace'),
				'description' => $this->get_property('description'),
			),
			'bottom'  => array(
				'title'       => esc_html__('Header Bottom', 'solace'),
				'description' => $this->get_property('description'),
			),
			'sidebar' => array(
				'title'       => esc_html__('Mobile Sidebar', 'solace'),
				'description' => $this->get_property('description'),
			),
		];
	}


	/**
	 * Get the header presets.
	 *
	 * @return array
	 */
	private function get_header_presets()
	{
		$presets = [
			[
				'label' => 'Preset 1',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header1.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}, {\"id\":\"header_search_responsive\"}, {\"id\":\"primary-menu\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			[
				'label' => 'Preset 2',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header2.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"header_search_responsive\"}, {\"id\":\"primary-menu\"}],\"c-left\":[],\"center\":[{\"id\":\"logo\"}],\"c-right\":[],\"right\":[{\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			// [
			// 	'label' => 'Preset 3',
			// 	'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header3.png',
			// 	'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}, {\"id\":\"header_search_responsive\"}, {\"id\":\"primary-menu\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			// ],
			// [
			// 	'label' => 'Preset 4',
			// 	'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header4.png',
			// 	'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}, {\"id\":\"header_search\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}]},\"bottom\":{\"left\":[{\"id\":\"primary-menu\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			// ],
			[
				'label' => 'Preset 5',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header5.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}, {\"id\":\"header_search\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}]},\"bottom\":{\"left\":[{\"id\":\"primary-menu\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			[
				'label' => 'Preset 6',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header6.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"header_search_responsive\"}, {\"id\":\"nav-icon\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			[
				'label' => 'Preset 7',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header7.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"nav-icon\"}],\"c-left\":[],\"center\":[{\"id\":\"logo\"}],\"c-right\":[],\"right\":[{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			[
				'label' => 'Preset 8',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header8.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}, {\"id\":\"primary-menu\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"button_base\"}, {\"id\":\"button_base2\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			[
				'label' => 'Preset 9',
				'image' => SOLACE_ASSETS_URL . 'img/customizer/header/header9.png',
				'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[{\"id\":\"primary-menu\"}],\"c-right\":[],\"right\":[{\"id\":\"button_base\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"logo\"}],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[{\"id\":\"nav-icon\"},{\"id\":\"header_search_responsive\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[{\"id\":\"primary-menu\"}]}}"}',
			],
			// [
			// 	'label' => 'Demo 1',
			// 	'image' => SOLACE_ASSETS_URL . 'img/header-presets/demo1.png',
			// 	'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[{\"id\":\"header_search_responsive\"},{\"id\":\"nav-icon\"}, {\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}, {\"id\":\"custom_html\"}],\"c-left\":[],\"center\":[{\"id\":\"logo\"}, {\"id\":\"primary-menu\"}, {\"id\":\"button_base\"}],\"c-right\":[],\"right\":[{\"id\":\"secondary-menu\"}, {\"id\":\"header-widgets\"}, {\"id\":\"header_social\"}, {\"id\":\"header_search\"}, {\"id\":\"header_contact\"}]},\"main\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[]}}"}',
			// ],
			// [
			// 	'label' => 'Demo 2',
			// 	'image' => SOLACE_ASSETS_URL . 'img/header-presets/demo2.png',
			// 	'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[{\"id\":\"header_search_responsive\"},{\"id\":\"nav-icon\"}, {\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}, {\"id\":\"custom_html\"}],\"c-left\":[],\"center\":[{\"id\":\"logo\"}, {\"id\":\"primary-menu\"}, {\"id\":\"button_base\"}],\"c-right\":[],\"right\":[{\"id\":\"secondary-menu\"}, {\"id\":\"header-widgets\"}, {\"id\":\"header_social\"}, {\"id\":\"header_search\"}, {\"id\":\"header_contact\"}]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[]}}"}',
			// ],
			// [
			// 	'label' => 'Demo 3',
			// 	'image' => SOLACE_ASSETS_URL . 'img/header-presets/demo3.png',
			// 	'setup' => '{"hfg_header_layout_v2":"{\"desktop\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"bottom\":{\"left\":[{\"id\":\"header_search_responsive\"},{\"id\":\"nav-icon\"}, {\"id\":\"header_account\"}, {\"id\":\"header_cart_icon\"}, {\"id\":\"custom_html\"}],\"c-left\":[],\"center\":[{\"id\":\"logo\"}, {\"id\":\"primary-menu\"}, {\"id\":\"button_base\"}],\"c-right\":[],\"right\":[{\"id\":\"secondary-menu\"}, {\"id\":\"header-widgets\"}, {\"id\":\"header_social\"}, {\"id\":\"header_search\"}, {\"id\":\"header_contact\"}]}},\"mobile\":{\"top\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"main\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"bottom\":{\"left\":[],\"c-left\":[],\"center\":[],\"c-right\":[],\"right\":[]},\"sidebar\":[]}}"}',
			// ],
		];

		return apply_filters('solace_header_presets_v2', $presets);
	}
}
