<?php

if (!defined('VCV_E2E')) {
    header('Status: 403 Forbidden');
    header('HTTP/1.1 403 Forbidden');
    exit;
}

if (isset($_GET['php-e2e-action'])
    && $_GET['php-e2e-action'] === 'test-themeEditor-in-header-source-js-location') {
    // We are on PRE wordpress init stage.
    // Tests related to VC-1210 -> source css and global template location
    // File required to quickly pre-create vcv_templates and vcv_header and set it to post
    define('WP_USE_THEMES', true);
    add_action('init', [TestThemeEditorSourceHeaderJsLocation::class, 'createInstance']);

    class TestThemeEditorSourceHeaderJsLocation
    {
        /**
         * @var int|\WP_Error
         */
        protected $postId;

        /**
         * @var int|\WP_Error
         */
        protected $templateId = [];

        /**
         * @var int|\WP_Error
         */
        protected $headerId;

        protected $uniqueId = [];

        public function __construct()
        {
            $this->uniqueId['header'] = time() . '-' . mt_rand(1000, 1000 ** 2);
            $this->createTemplate('header');
            $this->createHeader();
            $this->createPost();

            add_action('wp_loaded', [$this, 'setupPage']);
        }

        public static function createInstance()
        {
            return new self();
        }

        public function createTemplate($type)
        {
            // Set up the WordPress query.
            $this->templateId[ $type ] = e2e_create_post(
                [
                    'post_title' => 'test-themeEditor-source-css-location-template',
                    'post_content' => '<!--vcv no format--><div class="vce-row-container"><div class="vce-row vce-row--col-gap-30 vce-row-columns--top vce-row-content--top" id="el-e3d7933d" data-vce-do-apply="all el-e3d7933d"><div class="vce-row-content" data-vce-element-content="true"><div class="vce-col" id="el-926a5dff"><div class="vce-col-inner" data-vce-do-apply="border margin background  el-926a5dff"><div class="vce-col-content" data-vce-element-content="true" data-vce-do-apply="padding el-926a5dff"><div class="vce-tabs-with-slide vce-tabs-with-slide-align--left vce-tabs-with-slide-color--8ab2de" id="el-6ef80d90" data-vce-do-apply="all el-6ef80d90" data-active-tab="1"><div class="vce-tabs-with-slide-inner"><div class="vce-tabs-with-slide-container"><div class="vce-tabs-with-slide-list"><span class="vce-tabs-with-slide-slider"></span><div class="vce-tabs-with-slide-tab" data-vce-target-model-id="5fc8f36c" data-vce-tab="true" style=""><a class="vce-tabs-with-slide-tab-title" data-vce-use-cache="false" data-vce-tabs="true" data-vce-target="[data-model-id=5fc8f36c]" data-vce-container=".vce-tabs-with-slide-inner" href="#el-5fc8f36c" style="">New tab</a></div><div class="vce-tabs-with-slide-tab" data-vce-target-model-id="2797482e" data-vce-tab="true" style=""><a class="vce-tabs-with-slide-tab-title" data-vce-use-cache="false" data-vce-tabs="true" data-vce-target="[data-model-id=2797482e]" data-vce-container=".vce-tabs-with-slide-inner" href="#el-2797482e">New tab</a></div></div></div><div class="vce-tabs-with-slide-panels-container"><div class="vce-tabs-with-slide-panels"><div class="vce-tabs-with-slide-panel" id="el-5fc8f36c" data-model-id="5fc8f36c" data-vce-content=".vce-tabs-with-slide-panel-body"><div class="vce-tabs-with-slide-tab-inner"><div class="vce-tabs-with-slide-panel-heading"><a class="vce-tabs-with-slide-panel-title" href="#el-5fc8f36c" data-vce-target="[data-model-id=5fc8f36c]" data-vce-use-cache="false" data-vce-accordion="" data-vce-container=".vce-tabs-with-slide-inner"><span>New tab</span></a></div><div class="vce-tabs-with-slide-panel-body" data-vce-do-apply="all el-5fc8f36c" style=""><div class="vce-tabs-with-slide-element-container" data-js-panel-body=""><div class="vce-faq-toggle vce-faq-toggle-color--fff vce-faq-toggle-shape-color--1D64C5 vce-faq-toggle-shape--rounded"><div class="vce-faq-toggle-wrapper vce" id="el-e0e41813" data-vce-do-apply="margin padding border background  el-e0e41813"><div class="vce-faq-toggle-inner"><div class="vce-faq-toggle-title"><h3 class="vce-faq-toggle-title-text"><i class="vce-faq-toggle-icon"></i>What is frequently asked questions?</h3></div><div class="vce-faq-toggle-text-block"><p>Frequently asked questions (FAQ) or Questions and Answers (Q&amp;A), are listed questions and answers, all supposed to be commonly asked in some context, and pertaining to a particular topic.</p></div></div></div></div></div></div></div></div><div class="vce-tabs-with-slide-panel" id="el-2797482e" data-model-id="2797482e" data-vce-content=".vce-tabs-with-slide-panel-body"><div class="vce-tabs-with-slide-tab-inner"><div class="vce-tabs-with-slide-panel-heading"><a class="vce-tabs-with-slide-panel-title" href="#el-2797482e" data-vce-target="[data-model-id=2797482e]" data-vce-use-cache="false" data-vce-accordion="" data-vce-container=".vce-tabs-with-slide-inner"><span>New tab</span></a></div><div class="vce-tabs-with-slide-panel-body" data-vce-do-apply="all el-2797482e" style="height: 0px;"><div class="vce-tabs-with-slide-element-container" data-js-panel-body=""><div class="vce-text-block"><div class="vce-text-block-wrapper vce" id="el-b32364c7" data-vce-do-apply="all el-b32364c7"><h2>Typography is the art and technique</h2>
<p>Typography is the art and technique of arranging type to make written language legible, readable and appealing when displayed. The arrangement of type involves selecting typefaces, point size, line length, line-spacing (leading), letter-spacing (tracking), and adjusting the space within letters pairs (kerning).</p></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><!--vcv no format-->',
                    'post_status' => 'publish',
                    'post_type' => 'vcv_templates',
                    'meta_input' => [
                        'vcv-pageContent' => '%7B%22elements%22%3A%7B%22e3d7933d%22%3A%7B%22columnGap%22%3A%2230%22%2C%22size%22%3A%22auto%22%2C%22contentPosition%22%3A%22top%22%2C%22designOptionsAdvanced%22%3A%7B%7D%2C%22columnBackground%22%3A%22%22%2C%22customClass%22%3A%22%22%2C%22sticky%22%3A%7B%7D%2C%22parent%22%3Afalse%2C%22hidden%22%3Afalse%2C%22layout%22%3A%7B%7D%2C%22boxShadow%22%3A%7B%7D%2C%22rowWidth%22%3A%22boxed%22%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2Felements%2Frow%2Frow%2Fpublic%2F%22%2C%22order%22%3A0%2C%22metaCustomId%22%3A%22%22%2C%22removeSpaces%22%3Afalse%2C%22fullHeight%22%3Afalse%2C%22parallax%22%3A%7B%7D%2C%22metaIsElementLocked%22%3Afalse%2C%22dividers%22%3A%7B%7D%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22row%22%2C%22id%22%3A%22e3d7933d%22%2C%22equalHeight%22%3Afalse%2C%22columnPosition%22%3A%22top%22%7D%2C%22926a5dff%22%3A%7B%22size%22%3A%7B%7D%2C%22designOptionsAdvanced%22%3A%7B%7D%2C%22disableStacking%22%3Afalse%2C%22firstInRow%22%3A%7B%7D%2C%22customClass%22%3A%22%22%2C%22sticky%22%3A%7B%7D%2C%22parent%22%3A%22e3d7933d%22%2C%22hidden%22%3Afalse%2C%22boxShadow%22%3A%7B%7D%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2Felements%2Fcolumn%2Fcolumn%2Fpublic%2F%22%2C%22order%22%3A0%2C%22metaCustomId%22%3A%22%22%2C%22parallax%22%3A%7B%7D%2C%22metaIsElementLocked%22%3Afalse%2C%22dividers%22%3A%7B%7D%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22column%22%2C%22id%22%3A%22926a5dff%22%2C%22lastInRow%22%3A%7B%7D%7D%2C%226ef80d90%22%3A%7B%22autoPlayDelay%22%3A%221%22%2C%22designOptions%22%3A%7B%7D%2C%22autoPlay%22%3Afalse%2C%22alignment%22%3A%22left%22%2C%22customClass%22%3A%22%22%2C%22parent%22%3A%22926a5dff%22%2C%22hidden%22%3Afalse%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2FdevElements%2FtabsWithSlide%2FtabsWithSlide%2Fpublic%2F%22%2C%22order%22%3A0%2C%22activeTab%22%3A%221%22%2C%22metaCustomId%22%3A%22%22%2C%22slideColor%22%3A%22%238ab2de%22%2C%22metaIsElementLocked%22%3Afalse%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22tabsWithSlide%22%2C%22id%22%3A%226ef80d90%22%2C%22animateTitles%22%3Atrue%7D%2C%225fc8f36c%22%3A%7B%22designOptions%22%3A%7B%7D%2C%22tabTitle%22%3A%22New%20tab%22%2C%22customClass%22%3A%22%22%2C%22parent%22%3A%226ef80d90%22%2C%22hidden%22%3Afalse%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2FdevElements%2Ftab%2Ftab%2Fpublic%2F%22%2C%22order%22%3A0%2C%22metaCustomId%22%3A%22%22%2C%22metaIsElementLocked%22%3Afalse%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22tab%22%2C%22id%22%3A%225fc8f36c%22%7D%2C%222797482e%22%3A%7B%22designOptions%22%3A%7B%7D%2C%22tabTitle%22%3A%22New%20tab%22%2C%22customClass%22%3A%22%22%2C%22parent%22%3A%226ef80d90%22%2C%22hidden%22%3Afalse%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2FdevElements%2Ftab%2Ftab%2Fpublic%2F%22%2C%22order%22%3A1%2C%22metaCustomId%22%3A%22%22%2C%22metaIsElementLocked%22%3Afalse%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22tab%22%2C%22id%22%3A%222797482e%22%7D%2C%22e0e41813%22%3A%7B%22iconHoverColor%22%3A%22%23e6e6e6%22%2C%22darkTextSkin%22%3Afalse%2C%22designOptions%22%3A%7B%7D%2C%22textBlock%22%3A%22%3Cp%3EFrequently%20asked%20questions%20(FAQ)%20or%20Questions%20and%20Answers%20(Q%26A)%2C%20are%20listed%20questions%20and%20answers%2C%20all%20supposed%20to%20be%20commonly%20asked%20in%20some%20context%2C%20and%20pertaining%20to%20a%20particular%20topic.%3C%2Fp%3E%22%2C%22shape%22%3A%22rounded%22%2C%22shapeColor%22%3A%22%231D64C5%22%2C%22titleText%22%3A%22What%20is%20frequently%20asked%20questions%3F%22%2C%22customClass%22%3A%22%22%2C%22shapeHoverColor%22%3A%22%23164d99%22%2C%22parent%22%3A%225fc8f36c%22%2C%22hidden%22%3Afalse%2C%22iconColor%22%3A%22%23fff%22%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2FdevElements%2FfaqToggle%2FfaqToggle%2Fpublic%2F%22%2C%22order%22%3A0%2C%22metaCustomId%22%3A%22%22%2C%22metaIsElementLocked%22%3Afalse%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22faqToggle%22%2C%22id%22%3A%22e0e41813%22%2C%22customHoverColors%22%3Afalse%2C%22elementTag%22%3A%22h3%22%7D%2C%22b32364c7%22%3A%7B%22darkTextSkin%22%3Afalse%2C%22designOptions%22%3A%7B%7D%2C%22output%22%3A%22%3Ch2%3ETypography%20is%20the%20art%20and%20technique%3C%2Fh2%3E%5Cn%3Cp%3ETypography%20is%20the%20art%20and%20technique%20of%20arranging%20type%20to%20make%20written%20language%20legible%2C%20readable%20and%20appealing%20when%20displayed.%20The%20arrangement%20of%20type%20involves%20selecting%20typefaces%2C%20point%20size%2C%20line%20length%2C%20line-spacing%20(leading)%2C%20letter-spacing%20(tracking)%2C%20and%20adjusting%20the%20space%20within%20letters%20pairs%20(kerning).%3C%2Fp%3E%22%2C%22customClass%22%3A%22%22%2C%22parent%22%3A%222797482e%22%2C%22hidden%22%3Afalse%2C%22metaAssetsPath%22%3A%22http%3A%2F%2F127.0.0.1%3A8000%2Fwp-content%2Fplugins%2Fvisualcomposer%2Felements%2FtextBlock%2FtextBlock%2Fpublic%2F%22%2C%22order%22%3A0%2C%22metaCustomId%22%3A%22%22%2C%22metaIsElementLocked%22%3Afalse%2C%22assetsLibrary%22%3A%5B%22animate%22%5D%2C%22metaElementAssets%22%3A%7B%7D%2C%22customHeaderTitle%22%3A%22%22%2C%22tag%22%3A%22textBlock%22%2C%22id%22%3A%22b32364c7%22%7D%7D%7D',
                        '_vcv-type' => 'custom',
                        'vcvSourceAssetsFiles' => unserialize(
                            'a:2:{s:9:"jsBundles";a:5:{i:0;s:54:"assetsLibrary/accordion/dist/accordion.bundle.js?v=dev";i:1;s:44:"assetsLibrary/tabs/dist/tabs.bundle.js?v=dev";i:2;s:130:"http://127.0.0.1:8000/wp-content/plugins/visualcomposer/devElements/tabsWithSlide/tabsWithSlide/public/dist/vcTabsWithSlide.min.js";i:3;s:54:"assetsLibrary/faqToggle/dist/faqToggle.bundle.js?v=dev";i:4;s:116:"http://127.0.0.1:8000/wp-content/plugins/visualcomposer/devElements/faqToggle/faqToggle/public/dist/faqToggle.min.js";}s:10:"cssBundles";a:0:{}}'
                        ),
                        'vcv-globalElementsCssData' => unserialize(
                            'a:7:{s:8:"e3d7933d";a:4:{s:3:"tag";s:3:"row";s:7:"baseCss";s:7301:".vce{margin-bottom:30px}.vce-row-container{width:100%}.vce-row{position:relative;display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column;margin-left:0;margin-right:0;transition:box-shadow .2s}.vce-row-content>.vce-col:last-child{margin-right:0}.vce-row-full-height{min-height:100vh}.vce-row-content{-ms-flex:1 1 auto;-webkit-flex:1 1 auto;flex:1 1 auto;display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-direction:row;-webkit-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;-webkit-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:start;-webkit-justify-content:flex-start;justify-content:flex-start;-ms-flex-line-pack:start;-webkit-align-content:flex-start;align-content:flex-start;-ms-flex-align:start;-webkit-align-items:flex-start;align-items:flex-start;min-height:1em;position:relative}.vce-row-wrap--reverse>.vce-row-content{-ms-flex-wrap:wrap-reverse;-webkit-flex-wrap:wrap-reverse;flex-wrap:wrap-reverse;-ms-flex-line-pack:end;-webkit-align-content:flex-end;align-content:flex-end;-ms-flex-align:end;-webkit-align-items:flex-end;align-items:flex-end}.vce-row-columns--top>.vce-row-content{-ms-flex-line-pack:start;-webkit-align-content:flex-start;align-content:flex-start}.vce-row-columns--top.vce-row-wrap--reverse>.vce-row-content{-ms-flex-line-pack:end;-webkit-align-content:flex-end;align-content:flex-end}.vce-row-columns--middle>.vce-row-content{-ms-flex-line-pack:center;-webkit-align-content:center;align-content:center}.vce-row-columns--bottom>.vce-row-content{-ms-flex-line-pack:end;-webkit-align-content:flex-end;align-content:flex-end}.vce-row-columns--bottom.vce-row-wrap--reverse>.vce-row-content{-ms-flex-line-pack:start;-webkit-align-content:flex-start;align-content:flex-start}.vce-row-columns--bottom>.vce-row-content:after,.vce-row-columns--middle>.vce-row-content:after,.vce-row-columns--top>.vce-row-content:after{content:"";width:100%;height:0;overflow:hidden;visibility:hidden;display:block}.vce-row-content--middle>.vce-row-content>.vce-col>.vce-col-inner{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column}.vce-row-content--bottom>.vce-row-content>.vce-col>.vce-col-inner{display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-pack:end;-webkit-justify-content:flex-end;justify-content:flex-end;-ms-flex-direction:column;-webkit-flex-direction:column;flex-direction:column}.vce-row-equal-height>.vce-row-content{-ms-flex-align:stretch;-webkit-align-items:stretch;align-items:stretch}.vce-row-columns--stretch>.vce-row-content{-ms-flex-line-pack:stretch;-webkit-align-content:stretch;align-content:stretch;-ms-flex-align:stretch;-webkit-align-items:stretch;align-items:stretch}.vce-row[data-vce-full-width=true]{position:relative;box-sizing:border-box}.vce-row[data-vce-stretch-content=true]{padding-left:30px;padding-right:30px}.vce-row[data-vce-stretch-content=true].vce-row-no-paddings{padding-left:0;padding-right:0}.vce-row.vce-element--has-background{padding-left:30px;padding-right:30px;padding-top:30px}.vce-row.vce-element--has-background[data-vce-full-width=true]:not([data-vce-stretch-content=true]){padding-left:0;padding-right:0}.vce-row.vce-element--has-background.vce-row--has-col-background{padding-bottom:30px}.vce-row>.vce-row-content>.vce-col.vce-col--all-last{margin-right:0}.rtl .vce-row>.vce-row-content>.vce-col.vce-col--all-last,.rtl.vce-row>.vce-row-content>.vce-col.vce-col--all-last{margin-left:0}@media (min-width:0) and (max-width:543px){.vce-row.vce-element--xs--has-background{padding-left:30px;padding-right:30px;padding-top:30px}.vce-row.vce-element--xs--has-background[data-vce-full-width=true]:not([data-vce-stretch-content=true]){padding-left:0;padding-right:0}.vce-row.vce-element--xs--has-background.vce-row--xs--has-col-background{padding-bottom:30px}.vce-row.vce-element--xs--has-background.vce-row--has-col-background{padding-bottom:30px}.vce-row.vce-element--has-background.vce-row--xs--has-col-background{padding-bottom:30px}.vce-row>.vce-row-content>.vce-col.vce-col--xs-last{margin-right:0}.rtl .vce-row>.vce-row-content>.vce-col.vce-col--xs-last,.rtl.vce-row>.vce-row-content>.vce-col.vce-col--xs-last{margin-left:0}}@media (min-width:544px) and (max-width:767px){.vce-row.vce-element--sm--has-background{padding-left:30px;padding-right:30px;padding-top:30px}.vce-row.vce-element--sm--has-background[data-vce-full-width=true]:not([data-vce-stretch-content=true]){padding-left:0;padding-right:0}.vce-row.vce-element--sm--has-background.vce-row--sm--has-col-background{padding-bottom:30px}.vce-row.vce-element--sm--has-background.vce-row--has-col-background{padding-bottom:30px}.vce-row.vce-element--has-background.vce-row--sm--has-col-background{padding-bottom:30px}.vce-row>.vce-row-content>.vce-col.vce-col--sm-last{margin-right:0}.rtl .vce-row>.vce-row-content>.vce-col.vce-col--sm-last,.rtl.vce-row>.vce-row-content>.vce-col.vce-col--sm-last{margin-left:0}}@media (min-width:768px) and (max-width:991px){.vce-row.vce-element--md--has-background{padding-left:30px;padding-right:30px;padding-top:30px}.vce-row.vce-element--md--has-background[data-vce-full-width=true]:not([data-vce-stretch-content=true]){padding-left:0;padding-right:0}.vce-row.vce-element--md--has-background.vce-row--md--has-col-background{padding-bottom:30px}.vce-row.vce-element--md--has-background.vce-row--has-col-background{padding-bottom:30px}.vce-row.vce-element--has-background.vce-row--md--has-col-background{padding-bottom:30px}.vce-row>.vce-row-content>.vce-col.vce-col--md-last{margin-right:0}.rtl .vce-row>.vce-row-content>.vce-col.vce-col--md-last,.rtl.vce-row>.vce-row-content>.vce-col.vce-col--md-last{margin-left:0}}@media (min-width:992px) and (max-width:1199px){.vce-row.vce-element--lg--has-background{padding-left:30px;padding-right:30px;padding-top:30px}.vce-row.vce-element--lg--has-background[data-vce-full-width=true]:not([data-vce-stretch-content=true]){padding-left:0;padding-right:0}.vce-row.vce-element--lg--has-background.vce-row--lg--has-col-background{padding-bottom:30px}.vce-row.vce-element--lg--has-background.vce-row--has-col-background{padding-bottom:30px}.vce-row.vce-element--has-background.vce-row--lg--has-col-background{padding-bottom:30px}.vce-row>.vce-row-content>.vce-col.vce-col--lg-last{margin-right:0}.rtl .vce-row>.vce-row-content>.vce-col.vce-col--lg-last,.rtl.vce-row>.vce-row-content>.vce-col.vce-col--lg-last{margin-left:0}}@media (min-width:1200px){.vce-row.vce-element--xl--has-background{padding-left:30px;padding-right:30px;padding-top:30px}.vce-row.vce-element--xl--has-background[data-vce-full-width=true]:not([data-vce-stretch-content=true]){padding-left:0;padding-right:0}.vce-row.vce-element--xl--has-background.vce-row--xl--has-col-background{padding-bottom:30px}.vce-row.vce-element--xl--has-background.vce-row--has-col-background{padding-bottom:30px}.vce-row.vce-element--has-background.vce-row--xl--has-col-background{padding-bottom:30px}.vce-row>.vce-row-content>.vce-col.vce-col--xl-last{margin-right:0}.rtl .vce-row>.vce-row-content>.vce-col.vce-col--xl-last,.rtl.vce-row>.vce-row-content>.vce-col.vce-col--xl-last{margin-left:0}}";s:13:"attributesCss";s:705:" @media all and (min-width:544px){.vce-row--col-gap-30#el-e3d7933d>.vce-row-content>.vce-col--sm-auto{-webkit-flex:1 1 0;-ms-flex:1 1 0px;flex:1 1 0;width:auto;max-width:none}} @media all and (min-width:768px){.vce-row--col-gap-30#el-e3d7933d>.vce-row-content>.vce-col--md-auto{-webkit-flex:1 1 0;-ms-flex:1 1 0px;flex:1 1 0;width:auto;max-width:none}} @media all and (min-width:992px){.vce-row--col-gap-30#el-e3d7933d>.vce-row-content>.vce-col--lg-auto{-webkit-flex:1 1 0;-ms-flex:1 1 0px;flex:1 1 0;width:auto;max-width:none}} @media all and (min-width:1200px){.vce-row--col-gap-30#el-e3d7933d>.vce-row-content>.vce-col--xl-auto{-webkit-flex:1 1 0;-ms-flex:1 1 0px;flex:1 1 0;width:auto;max-width:none}}";s:9:"mixinsCss";s:297:".vce-row--col-gap-30>.vce-row-content>.vce-col{margin-right:30px}.vce-row--col-gap-30>.vce-row-content>.vce-column-resizer .vce-column-resizer-handler{width:30px}.rtl .vce-row--col-gap-30>.vce-row-content>.vce-col,.rtl.vce-row--col-gap-30>.vce-row-content>.vce-col{margin-left:30px;margin-right:0}";}s:8:"926a5dff";a:4:{s:3:"tag";s:6:"column";s:13:"attributesCss";s:0:"";s:9:"mixinsCss";s:0:"";s:7:"baseCss";s:3039:".vce-col{-ms-flex:0 0 100%;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%;box-sizing:border-box;display:-ms-flexbox;display:-webkit-flex;display:flex;min-width:1em;position:relative}.vce-col--auto{-ms-flex:1;-webkit-flex:1;flex:1;-ms-flex-preferred-size:auto;-webkit-flex-basis:auto;flex-basis:auto}.vce-col-content,.vce-col-inner{position:relative;overflow-wrap:break-word;transition:box-shadow .2s}.vce-col-inner{width:100%}.vce-col-direction--rtl{direction:rtl}.vce-element--has-background>.vce-col-inner>.vce-col-content{padding-top:30px;padding-left:30px;padding-right:30px}.vce-col.vce-col--all-hide{display:none}@media (min-width:0){.vce-col--xs-auto{-ms-flex:1 1 0;-webkit-flex:1 1 0;flex:1 1 0;width:auto}.vce-col--xs-1{-ms-flex:0 0 100%;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.vce-col.vce-col--xs-visible{display:-ms-flexbox;display:-webkit-flex;display:flex}.vce-col.vce-col--xs-hide{display:none}}.vce-row-container>.vce-row>.vce-row-content>.vce-col>.vce-col-inner{padding:0}@media (min-width:544px){.vce-col--sm-auto{-ms-flex:1 1 0;-webkit-flex:1 1 0;flex:1 1 0;width:auto}.vce-col--sm-1{-ms-flex:0 0 100%;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.vce-col.vce-col--sm-visible{display:-ms-flexbox;display:-webkit-flex;display:flex}.vce-col.vce-col--sm-hide{display:none}}@media (min-width:768px){.vce-col--md-auto{-ms-flex:1 1 0;-webkit-flex:1 1 0;flex:1 1 0;width:auto}.vce-col--md-1{-ms-flex:0 0 100%;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.vce-col.vce-col--md-visible{display:-ms-flexbox;display:-webkit-flex;display:flex}.vce-col.vce-col--md-hide{display:none}}@media (min-width:992px){.vce-col--lg-auto{-ms-flex:1 1 0;-webkit-flex:1 1 0;flex:1 1 0;width:1px}.vce-col--lg-1{-ms-flex:0 0 100%;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.vce-col.vce-col--lg-visible{display:-ms-flexbox;display:-webkit-flex;display:flex}.vce-col.vce-col--lg-hide{display:none}}@media (min-width:1200px){.vce-col--xl-auto{-ms-flex:1 1 0;-webkit-flex:1 1 0;flex:1 1 0;width:auto}.vce-col--xl-1{-ms-flex:0 0 100%;-webkit-flex:0 0 100%;flex:0 0 100%;max-width:100%}.vce-col.vce-col--xl-visible{display:-ms-flexbox;display:-webkit-flex;display:flex}.vce-col.vce-col--xl-hide{display:none}}@media (min-width:0) and (max-width:543px){.vce-element--xs--has-background>.vce-col-inner>.vce-col-content{padding-top:30px;padding-left:30px;padding-right:30px}}@media (min-width:544px) and (max-width:767px){.vce-element--sm--has-background>.vce-col-inner>.vce-col-content{padding-top:30px;padding-left:30px;padding-right:30px}}@media (min-width:768px) and (max-width:991px){.vce-element--md--has-background>.vce-col-inner>.vce-col-content{padding-top:30px;padding-left:30px;padding-right:30px}}@media (min-width:992px) and (max-width:1199px){.vce-element--lg--has-background>.vce-col-inner>.vce-col-content{padding-top:30px;padding-left:30px;padding-right:30px}}@media (min-width:1200px){.vce-element--xl--has-background>.vce-col-inner>.vce-col-content{padding-top:30px;padding-left:30px;padding-right:30px}}";}s:8:"6ef80d90";a:4:{s:3:"tag";s:13:"tabsWithSlide";s:13:"attributesCss";s:0:"";s:7:"baseCss";s:7724:".vce-tabs-with-slide-panels,.vce-tabs-with-slide-panels-container{box-sizing:border-box;position:relative}.vce-tabs-with-slide-panel{display:block}.vce-tabs-with-slide-panel-heading{border-bottom:1px solid rgba(128,128,128,.5);box-sizing:border-box;transition:background .2s ease-in-out}.vce-tabs-with-slide .vce-tabs-with-slide-panel-title{margin:0;line-height:1;background:0 0;display:block;padding:15px 0;box-sizing:border-box;text-decoration:none;color:inherit;position:relative;transition:color .2s ease-in-out;border:none;box-shadow:none}.vce-tabs-with-slide .vce-tabs-with-slide-panel-title:focus,.vce-tabs-with-slide .vce-tabs-with-slide-panel-title:hover{text-decoration:none;outline:0;box-shadow:none}.vce-tabs-with-slide-panel-body{box-sizing:content-box;display:none;overflow:hidden;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0);transition:padding .2s ease-in-out;padding-top:20px}.vce-tabs-with-slide-panel-body>:last-child{margin-bottom:0}.vce-tabs-with-slide .vce-tabs-with-slide-panel-title{overflow:hidden}.vce-tabs-with-slide .vce-tabs-with-slide-panel-title>span{position:relative;padding:0 0 14px 0}.vce-tabs-with-slide .vce-tabs-with-slide-panel-title>span:before{content:\'\';position:absolute;bottom:-1px;left:0;right:0;height:3px;opacity:0;visibility:hidden;transition:all .5s ease}.vce-tabs-with-slide .vce-tabs-with-slide-panel-title>span:after{content:\'.\';font-size:0}.vce-tabs-with-slide.vce-tabs-with-slide-animate-titles--off>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-panels-container>.vce-tabs-with-slide-panels>.vce-tabs-with-slide-panel>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading .vce-tabs-with-slide-panel-title span::before{transition:none}.vce-tabs-with-slide-panel[data-vcv-position-to-active=before]>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading>.vce-tabs-with-slide-panel-title>span:before{left:100vw;right:-100vw}.vce-tabs-with-slide-panel[data-vcv-active=true]{display:block}.vce-tabs-with-slide-panel[data-vcv-active=true]>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-body{display:block}.vce-tabs-with-slide-panel[data-vcv-active=true]>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading .vce-tabs-with-slide-panel-title>a:hover{cursor:default}.vce-tabs-with-slide-panel[data-vcv-active=true]>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading .vce-tabs-with-slide-panel-title>span:before{left:0;right:0;opacity:1;visibility:visible}.vce-tabs-with-slide-panel[data-vcv-position-to-active=after]>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading>.vce-tabs-with-slide-panel-title>span:before{left:-100vw;right:100vw}.vce-tabs-with-slide-panel[data-vcv-animating=true] .vce-tabs-with-slide-panel-body{display:block;min-height:0}.vce-tabs-with-slide-o-all-clickable .vce-tabs-with-slide-panel .vce-tabs-with-slide-panel-title>a:hover{cursor:pointer}.vce-tabs-with-slide-container{display:block;position:relative;z-index:3;text-align:center}.vce-tabs-with-slide{position:relative}.vce-tabs-with-slide.vce-tabs-with-slide-align--left .vce-tabs-with-slide-panel-heading{text-align:left}.vce-tabs-with-slide.vce-tabs-with-slide-align--left .vce-tabs-with-slide-container{text-align:left}.vce-tabs-with-slide.vce-tabs-with-slide-align--center .vce-tabs-with-slide-panel-heading{text-align:center}.vce-tabs-with-slide.vce-tabs-with-slide-align--center .vce-tabs-with-slide-container{text-align:center}.vce-tabs-with-slide.vce-tabs-with-slide-align--right .vce-tabs-with-slide-panel-heading{text-align:right}.vce-tabs-with-slide.vce-tabs-with-slide-align--right .vce-tabs-with-slide-container{text-align:right}.vce-tabs-with-slide .vce-tabs-with-slide-list{list-style-type:none;padding:0;margin:0;box-sizing:border-box;display:inline-block;position:relative;overflow:hidden;letter-spacing:-.31em;vertical-align:top}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab{display:inline-block;padding:0;margin:0;border-bottom:1px solid rgba(128,128,128,.5);overflow:hidden;letter-spacing:normal;vertical-align:bottom}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab::after{content:"";display:table;clear:both}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab:first-of-type>.vce-tabs-with-slide-tab-title{margin-left:0}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab:last-of-type>.vce-tabs-with-slide-tab-title{margin-right:0}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab>.vce-tabs-with-slide-tab-title{border:0;margin:0 20px;padding:15px 0;display:block;box-sizing:border-box;position:relative;text-decoration:none;color:inherit;transition:background .2s ease-in,color .2s ease-in;box-shadow:none}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab>.vce-tabs-with-slide-tab-title:after{content:\'.\';font-size:0}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab>.vce-tabs-with-slide-tab-title:focus,.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab>.vce-tabs-with-slide-tab-title:hover{text-decoration:none;outline:0;box-shadow:none}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab:after,.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab:before{display:none}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab[data-vcv-active=true]>.vce-tabs-with-slide-tab-title{cursor:default;text-decoration:none;color:inherit;transition:background .2s ease-in-out,color .2s ease-in-out;box-shadow:none}.vce-tabs-with-slide .vce-tabs-with-slide-list .vce-tabs-with-slide-tab[data-vcv-active=true]>.vce-tabs-with-slide-tab-title:hover{cursor:default;box-shadow:none}.vce-tabs-with-slide.vce-tabs-with-slide-animate-titles--off>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container .vce-tabs-with-slide-tab[data-vcv-active=true] .vce-tabs-with-slide-tab-title::before{content:\'\';position:absolute;bottom:-1px;left:0;right:0;height:3px}.vce-tabs-with-slide>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container>.vce-tabs-with-slide-list .vce-tabs-with-slide-slider{position:absolute;display:block;bottom:1px;height:2px;left:0;transition:all .5s ease}.vce-tabs-with-slide-icon{font-size:1.15em;line-height:0;display:inline}.vce-tabs-with-slide-icon::before{display:inline}.vce-tabs-with-slide-title-text:not(:empty):not(:first-child),.vce-tabs-with-slide-title-text:not(:empty)~*{margin-left:15px}.vce-tabs-with-slide-title-text:empty{display:inline-block}.vce-tabs-with-slide-icon.fa,.vce-tabs-with-slide-icon.vc_li{vertical-align:middle}.vce-tabs-with-slide>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container{position:absolute;pointer-events:none;visibility:hidden;opacity:0;height:0}.vce-tabs-with-slide>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-panels-container>.vce-tabs-with-slide-panels>.vce-tabs-with-slide-panel>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading{display:none}.vce-tabs-with-slide[data-vcv-tabs-state=tabs]>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container{position:relative;pointer-events:auto;visibility:visible;opacity:1;height:auto}.vce-tabs-with-slide[data-vcv-tabs-state=accordion]>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-panels-container>.vce-tabs-with-slide-panels>.vce-tabs-with-slide-panel>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading{display:block}.vce-tabs-with-slide.vce-tabs-with-slide--empty>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container{height:0}.vce-tabs-with-slide.vce-tabs-with-slide--empty .vce-tabs-with-slide-panels{padding:0 0 20px}.vce-tabs-with-slide.vce-tabs-with-slide--empty .vcv-row-control-container{margin:0}";s:9:"mixinsCss";s:603:".vce-tabs-with-slide-color--8ab2de>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container .vce-tabs-with-slide-list .vce-tabs-with-slide-slider{background:#8ab2de}.vce-tabs-with-slide-color--8ab2de>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-container .vce-tabs-with-slide-tab-title::before{background:#8ab2de}.vce-tabs-with-slide-color--8ab2de>.vce-tabs-with-slide-inner>.vce-tabs-with-slide-panels-container>.vce-tabs-with-slide-panels>.vce-tabs-with-slide-panel>.vce-tabs-with-slide-tab-inner>.vce-tabs-with-slide-panel-heading .vce-tabs-with-slide-panel-title span::before{background:#8ab2de}";}s:8:"5fc8f36c";a:4:{s:3:"tag";s:3:"tab";s:13:"attributesCss";s:0:"";s:9:"mixinsCss";s:0:"";s:7:"baseCss";s:0:"";}s:8:"2797482e";a:4:{s:3:"tag";s:3:"tab";s:13:"attributesCss";s:0:"";s:9:"mixinsCss";s:0:"";s:7:"baseCss";s:0:"";}s:8:"e0e41813";a:4:{s:3:"tag";s:9:"faqToggle";s:13:"attributesCss";s:0:"";s:7:"baseCss";s:1316:".vce-faq-toggle .vce-faq-toggle-text-block>:last-child{margin-bottom:0}.vce-faq-toggle .vce-faq-toggle-text-block>:first-child{margin-top:0}.vce-faq-toggle-title{padding-left:33px;position:relative;cursor:pointer}.rtl .vce-faq-toggle-title,[dir=rlt] .vce-faq-toggle-title{padding-left:initial;padding-right:33px}.vce-faq-toggle-title-text{position:relative}.vce-faq-toggle-icon{position:absolute;left:-33px;top:50%;-webkit-transform:translate(0,-50%);transform:translate(0,-50%);height:22px;width:22px;transition:background-color .2s ease-in-out}.rtl .vce-faq-toggle-icon,[dir=rlt] .vce-faq-toggle-icon{left:auto;right:-33px}.vce-faq-toggle-icon::after,.vce-faq-toggle-icon::before{content:\'\';display:block;position:absolute;box-sizing:border-box;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);left:50%;top:50%;transition:background-color .2s ease-in-out,opacity .2s ease-in-out}.vce-faq-toggle-icon::before{height:2px;width:10px}.vce-faq-toggle-icon::after{height:10px;width:2px;opacity:1}.vce-faq-toggle-state--opened .vce-faq-toggle-icon::after{opacity:0}.vce-faq-toggle-text-block{padding-left:33px}.vce-faq-toggle-shape--rounded .vce-faq-toggle-icon{border-radius:5px}.vce-faq-toggle-shape--round .vce-faq-toggle-icon{border-radius:50%}.vce-faq-toggle-inner>:nth-child(even){display:none}";s:9:"mixinsCss";s:544:".vce-faq-toggle-color--fff .vce-faq-toggle-icon::after,.vce-faq-toggle-color--fff .vce-faq-toggle-icon::before{background-color:#fff} .vce-faq-toggle-shape-color--1D64C5 .vce-faq-toggle-icon{background-color:#1d64c5} .vce-faq-toggle-hover-color--e6e6e6 .vce-faq-toggle-title:hover .vce-faq-toggle-icon::after,.vce-faq-toggle-hover-color--e6e6e6 .vce-faq-toggle-title:hover .vce-faq-toggle-icon::before{background-color:#e6e6e6} .vce-faq-toggle-shape-hover-color--164d99 .vce-faq-toggle-title:hover .vce-faq-toggle-icon{background-color:#164d99}";}s:8:"b32364c7";a:4:{s:3:"tag";s:9:"textBlock";s:7:"baseCss";s:0:"";s:13:"attributesCss";s:0:"";s:9:"mixinsCss";s:0:"";}}'
                        ),
                    ],
                ]
            );
            vcevent(
                'vcv:assets:file:generate',
                ['response' => [], 'payload' => ['sourceId' => $this->templateId[ $type ]]]
            );
        }

        public function createHeader()
        {
            // Set up the WordPress query.
            $this->headerId = e2e_create_post(
                [
                    'post_title' => 'test-themeEditor-source-css-location-header',
                    'post_content' => sprintf(
                        'This is header with globalTemplate element inside: <div id="vcv-global-template-%s">[vcv_global_template id="%d"]</div>',
                        $this->uniqueId['header'],
                        $this->templateId['header']
                    ),
                    'post_status' => 'publish',
                    'post_type' => 'vcv_headers',
                ]
            );
        }

        public function createPost()
        {
            // Set up the WordPress query.
            $pageLayout = isset($_GET['php-e2e-layout']) ? $_GET['php-e2e-layout'] : 'header-footer-layout';
            $this->postId = e2e_create_post(
                [
                    'post_title' => 'test-themeEditor-source-css-location-page',
                    'post_content' => sprintf(
                        '
                            Hello From Tests :)  Current ID:<span id="e2e-current-id">[e2e_get_current_id]</span>,
                            Template ID header:<span id="e2e-template-header-id">%d</span>
                            Header ID:<span id="e2e-header-id">%d</span>
                            Unique ID HEADER:<span id="e2e-unique-header-id">%s</span>
                        ',
                        $this->templateId['header'], // span
                        $this->headerId,
                        $this->uniqueId['header']
                    ),
                    'post_status' => 'publish',
                    'post_type' => 'page',
                    'meta_input' => [
                        '_vcv-page-template' => $pageLayout,
                        '_vcv-page-template-type' => 'vc-theme',
                        '_vcv-page-template-stretch' => '0',
                        '_vcv-pageTitleDisabled' => '',
                        '_vcv-HeaderTemplateId' => $this->headerId,
                        '_vcv-FooterTemplateId' => '',
                        '_vcv-SidebarTemplateId' => '',
                    ],
                ]
            );
        }

        public function setupPage()
        {
            // Create rewrite rules, to avoid 404 issues and extra redirects
            e2e_add_rewrite_rules();

            // Setup global query
            wp(['p' => $this->postId, 'post_type' => 'page']);

            // Load the theme template.
            require_once ABSPATH . WPINC . '/template-loader.php';
        }
    }
}
