WordPress Page Builder – Beaver Builder - Version 2.0.6.2

Version Description

Download this release

Release Info

Developer pross
Plugin Icon 128x128 WordPress Page Builder – Beaver Builder
Version 2.0.6.2
Comparing to
See all releases

Code changes from version 2.0.6 to 2.0.6.2

changelog.txt CHANGED
@@ -1,3 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <h4>2.0.6 - 03/07/2018</h4>
2
  <p><strong>Responsive Fixes</strong></p>
3
  <ul>
1
+ <h4>2.0.6.2 - 03/13/2018</h4>
2
+ <p><strong>Bug Fixes</strong></p>
3
+ <ul>
4
+ <li>Fixed responsive display on new pages that are not saved as draft or published yet.</li>
5
+ <li>Fixed PHP fatal error if no timezone is selected in countdown module.</li>
6
+ <li>Fixed JSON parse error if quotes are used in nested forms.</li>
7
+ <li>Fixed PHP fatal error for users of WP 4.6 and below.</li>
8
+ <li>Fixed JS issue in global settings, a blank setting can cause a JS error.</li>
9
+ <li>Fixed layouts breaking when using the layout shortcode with Popup Maker.</li>
10
+ </ul>
11
+
12
+ <h4>2.0.6.1 - 03/09/2018</h4>
13
+ <p><strong>Enhancements</strong></p>
14
+ <ul>
15
+ <li>New filter: <code>fl_builder_render_module_html</code> added to <code>FLBuilder::render_module_html()</code>.</li>
16
+ <li>New actions: <code>fl_builder_render_module_html_before</code> and <code>fl_builder_render_module_html_after</code>.</li>
17
+ </ul>
18
+ <p><strong>Bug Fixes</strong></p>
19
+ <ul>
20
+ <li>Fixed a PHP fatal error when trying to upload icon sets.</li>
21
+ <li>Fixed settings trying to load from the server instead of the JS cache when dropping in a new module.</li>
22
+ </ul>
23
+
24
  <h4>2.0.6 - 03/07/2018</h4>
25
  <p><strong>Responsive Fixes</strong></p>
26
  <ul>
classes/class-fl-builder-admin-settings.php CHANGED
@@ -447,6 +447,11 @@ final class FLBuilderAdminSettings {
447
  $id = (int) $_POST['fl-new-icon-set'];
448
  $path = get_attached_file( $id );
449
  $new_path = $dir['path'] . 'icon-' . time() . '/';
 
 
 
 
 
450
  $unzipped = unzip_file( $path, $new_path );
451
 
452
  // Unzip failed.
447
  $id = (int) $_POST['fl-new-icon-set'];
448
  $path = get_attached_file( $id );
449
  $new_path = $dir['path'] . 'icon-' . time() . '/';
450
+
451
+ if ( ! function_exists( 'unzip_file' ) ) {
452
+ fl_builder_filesystem()->get_filesystem();
453
+ }
454
+
455
  $unzipped = unzip_file( $path, $new_path );
456
 
457
  // Unzip failed.
classes/class-fl-builder-ajax.php CHANGED
@@ -245,6 +245,21 @@ final class FLBuilderAJAX {
245
 
246
  return true;
247
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  }
249
 
250
  FLBuilderAJAX::init();
245
 
246
  return true;
247
  }
248
+
249
+ /**
250
+ * Is this an AJAX response?
251
+ * @since 2.0.7
252
+ * @return bool
253
+ */
254
+ static public function doing_ajax() {
255
+ if ( function_exists( 'wp_doing_ajax' ) ) {
256
+ return wp_doing_ajax();
257
+ }
258
+ if ( defined( 'DOING_AJAX' ) ) {
259
+ return DOING_AJAX;
260
+ }
261
+ return false;
262
+ }
263
  }
264
 
265
  FLBuilderAJAX::init();
classes/class-fl-builder-fonts.php CHANGED
@@ -229,7 +229,7 @@ final class FLBuilderFonts {
229
  */
230
  static public function add_font( $font ) {
231
 
232
- if ( 'Default' != $font['family'] ) {
233
 
234
  $system_fonts = apply_filters( 'fl_builder_font_families_system', FLBuilderFontFamilies::$system );
235
 
229
  */
230
  static public function add_font( $font ) {
231
 
232
+ if ( is_array( $font ) && 'Default' != $font['family'] ) {
233
 
234
  $system_fonts = apply_filters( 'fl_builder_font_families_system', FLBuilderFontFamilies::$system );
235
 
classes/class-fl-builder-loader.php CHANGED
@@ -46,7 +46,7 @@ if ( ! class_exists( 'FLBuilderLoader' ) ) {
46
  * @return void
47
  */
48
  static private function define_constants() {
49
- define( 'FL_BUILDER_VERSION', '2.0.6' );
50
  define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
51
  define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
52
  define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
46
  * @return void
47
  */
48
  static private function define_constants() {
49
+ define( 'FL_BUILDER_VERSION', '2.0.6.2' );
50
  define( 'FL_BUILDER_FILE', trailingslashit( dirname( dirname( __FILE__ ) ) ) . 'fl-builder.php' );
51
  define( 'FL_BUILDER_DIR', plugin_dir_path( FL_BUILDER_FILE ) );
52
  define( 'FL_BUILDER_URL', plugins_url( '/', FL_BUILDER_FILE ) );
classes/class-fl-builder-model.php CHANGED
@@ -472,6 +472,11 @@ final class FLBuilderModel {
472
  static public function is_builder_enabled( $post_id = null ) {
473
  global $wp_the_query;
474
 
 
 
 
 
 
475
  $query_id = ( isset( $wp_the_query->post->ID ) ) ? $wp_the_query->post->ID : false;
476
  $post_id = $post_id ? $post_id : self::get_post_id();
477
 
472
  static public function is_builder_enabled( $post_id = null ) {
473
  global $wp_the_query;
474
 
475
+ // If in iframe preview return true as the post might not be a draft yet.
476
+ if ( isset( $_GET['fl_builder_preview'] ) ) {
477
+ return true;
478
+ }
479
+
480
  $query_id = ( isset( $wp_the_query->post->ID ) ) ? $wp_the_query->post->ID : false;
481
  $post_id = $post_id ? $post_id : self::get_post_id();
482
 
classes/class-fl-builder-utils.php CHANGED
@@ -202,4 +202,17 @@ final class FLBuilderUtils {
202
  return strtolower( $text );
203
  }
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  }
202
  return strtolower( $text );
203
  }
204
 
205
+ /**
206
+ * Sanitize a value for js
207
+ * @since 2.0.7
208
+ */
209
+ static public function sanitize_number( $value ) {
210
+
211
+ if ( is_numeric( $value ) ) {
212
+ return $value;
213
+ }
214
+
215
+ return 0;
216
+ }
217
+
218
  }
classes/class-fl-builder.php CHANGED
@@ -820,7 +820,7 @@ final class FLBuilder {
820
  */
821
  static public function init_ui() {
822
  // Enable editing if the builder is active.
823
- if ( FLBuilderModel::is_builder_active() && ! defined( 'DOING_AJAX' ) ) {
824
 
825
  // Tell W3TC not to minify while the builder is active.
826
  define( 'DONOTMINIFY', true );
@@ -1351,7 +1351,9 @@ final class FLBuilder {
1351
  self::enqueue_layout_styles_scripts_by_id( $query_post->ID );
1352
 
1353
  // Print the styles since we are outside of the head tag.
1354
- wp_print_styles();
 
 
1355
 
1356
  // Render the builder content.
1357
  FLBuilder::render_content_by_id( $query_post->ID );
@@ -2046,7 +2048,11 @@ final class FLBuilder {
2046
  // Shorthand reference to the module's id.
2047
  $id = $module->node;
2048
 
2049
- include $module->dir . 'includes/frontend.php';
 
 
 
 
2050
  }
2051
 
2052
  /**
820
  */
821
  static public function init_ui() {
822
  // Enable editing if the builder is active.
823
+ if ( FLBuilderModel::is_builder_active() && ! FLBuilderAJAX::doing_ajax() ) {
824
 
825
  // Tell W3TC not to minify while the builder is active.
826
  define( 'DONOTMINIFY', true );
1351
  self::enqueue_layout_styles_scripts_by_id( $query_post->ID );
1352
 
1353
  // Print the styles since we are outside of the head tag.
1354
+ if ( ! did_action( 'wp_enqueue_scripts' ) ) {
1355
+ wp_print_styles();
1356
+ }
1357
 
1358
  // Render the builder content.
1359
  FLBuilder::render_content_by_id( $query_post->ID );
2048
  // Shorthand reference to the module's id.
2049
  $id = $module->node;
2050
 
2051
+ do_action( 'fl_builder_render_module_html_before', $type, $settings, $module );
2052
+
2053
+ include apply_filters( 'fl_builder_render_module_html', $module->dir . 'includes/frontend.php', $type, $settings, $module );
2054
+
2055
+ do_action( 'fl_builder_render_module_html_after', $type, $settings, $module );
2056
  }
2057
 
2058
  /**
fl-builder.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
- * Version: 2.0.6
7
  * Author: The Beaver Builder Team
8
  * Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
9
  * Copyright: (c) 2014 Beaver Builder
3
  * Plugin Name: Beaver Builder Plugin (Lite Version)
4
  * Plugin URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-uri
5
  * Description: A drag and drop frontend WordPress page builder plugin that works with almost any theme!
6
+ * Version: 2.0.6.2
7
  * Author: The Beaver Builder Team
8
  * Author URI: https://www.wpbeaverbuilder.com/?utm_medium=bb&utm_source=plugins-admin-page&utm_campaign=plugins-admin-author
9
  * Copyright: (c) 2014 Beaver Builder
includes/compatibility.php CHANGED
@@ -99,7 +99,7 @@ add_action( 'after_setup_theme', 'fl_builder_option_tree_support' );
99
  * @since 1.10.2
100
  */
101
  function fl_admin_ssl_upload_fix() {
102
- if ( defined( 'FORCE_SSL_ADMIN' ) && ! is_ssl() && is_admin() && defined( 'DOING_AJAX' ) && DOING_AJAX ) {
103
  if ( isset( $_POST['action'] ) && 'upload-attachment' === $_POST['action'] && true === apply_filters( 'fl_admin_ssl_upload_fix', true ) ) {
104
  force_ssl_admin( false );
105
  }
@@ -319,7 +319,7 @@ function fl_imember_shortcode_fix( $content ) {
319
  */
320
  add_action( 'plugins_loaded', 'fl_fix_nextgen_gallery' );
321
  function fl_fix_nextgen_gallery() {
322
- if ( isset( $_GET['fl_builder'] ) || isset( $_POST['fl_builder_data'] ) || wp_doing_ajax() ) {
323
  define( 'NGG_DISABLE_RESOURCE_MANAGER', true );
324
  }
325
  }
99
  * @since 1.10.2
100
  */
101
  function fl_admin_ssl_upload_fix() {
102
+ if ( defined( 'FORCE_SSL_ADMIN' ) && ! is_ssl() && is_admin() && FLBuilderAJAX::doing_ajax() ) {
103
  if ( isset( $_POST['action'] ) && 'upload-attachment' === $_POST['action'] && true === apply_filters( 'fl_admin_ssl_upload_fix', true ) ) {
104
  force_ssl_admin( false );
105
  }
319
  */
320
  add_action( 'plugins_loaded', 'fl_fix_nextgen_gallery' );
321
  function fl_fix_nextgen_gallery() {
322
+ if ( isset( $_GET['fl_builder'] ) || isset( $_POST['fl_builder_data'] ) || FLBuilderAJAX::doing_ajax() ) {
323
  define( 'NGG_DISABLE_RESOURCE_MANAGER', true );
324
  }
325
  }
includes/layout-js-config.php CHANGED
@@ -9,8 +9,8 @@ var FLBuilderLayoutConfig = {
9
  wpAjaxUrl : '<?php echo admin_url( 'admin-ajax.php' ); ?>'
10
  },
11
  breakpoints : {
12
- small : <?php echo $global_settings->responsive_breakpoint; ?>,
13
- medium : <?php echo $global_settings->medium_breakpoint; ?>
14
  },
15
  waypoint: {
16
  offset: 80
9
  wpAjaxUrl : '<?php echo admin_url( 'admin-ajax.php' ); ?>'
10
  },
11
  breakpoints : {
12
+ small : <?php echo FLBuilderUtils::sanitize_number( $global_settings->responsive_breakpoint ); ?>,
13
+ medium : <?php echo FLBuilderUtils::sanitize_number( $global_settings->medium_breakpoint ); ?>
14
  },
15
  waypoint: {
16
  offset: 80
includes/ui-field-form.php CHANGED
@@ -49,5 +49,5 @@
49
 
50
  #>
51
  <a class="fl-form-field-edit" href="javascript:void(0);" onclick="return false;" data-type="{{data.field.form}}">{{{label}}}</a>
52
- <input name="{{data.name}}" type="hidden" value='{{{data.value}}}' />
53
  </div>
49
 
50
  #>
51
  <a class="fl-form-field-edit" href="javascript:void(0);" onclick="return false;" data-type="{{data.field.form}}">{{{label}}}</a>
52
+ <input name="{{data.name}}" type="hidden" value='{{data.value}}' />
53
  </div>
includes/ui-settings-form.php CHANGED
@@ -111,6 +111,6 @@
111
  </div>
112
  </div>
113
  <# var settings = FLBuilder._getSettingsJSONForHTML( data.settings ); #>
114
- <input class="fl-builder-settings-json" type="hidden" value='{{{settings}}}' />
115
  </form>
116
  </script>
111
  </div>
112
  </div>
113
  <# var settings = FLBuilder._getSettingsJSONForHTML( data.settings ); #>
114
+ <input class="fl-builder-settings-json" type="hidden" value='{{settings}}' />
115
  </form>
116
  </script>
includes/updater-config.php CHANGED
@@ -3,7 +3,7 @@
3
  if ( class_exists( 'FLUpdater' ) ) {
4
  FLUpdater::add_product(array(
5
  'name' => 'Beaver Builder Plugin (Lite Version)',
6
- 'version' => '2.0.6',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin',
9
  ));
3
  if ( class_exists( 'FLUpdater' ) ) {
4
  FLUpdater::add_product(array(
5
  'name' => 'Beaver Builder Plugin (Lite Version)',
6
+ 'version' => '2.0.6.2',
7
  'slug' => 'bb-plugin',
8
  'type' => 'plugin',
9
  ));
js/fl-builder.js CHANGED
@@ -5143,6 +5143,11 @@
5143
  data.layout.nodePosition = FLBuilder._newModulePosition;
5144
  }
5145
 
 
 
 
 
 
5146
  // Render the module if a settings form is already open.
5147
  if ( $( 'form.fl-builder-settings' ).length ) {
5148
  if ( data.layout ) {
5143
  data.layout.nodePosition = FLBuilder._newModulePosition;
5144
  }
5145
 
5146
+ // Make sure we have settings before rendering the form.
5147
+ if ( ! data.settings ) {
5148
+ data.settings = FLBuilderSettingsConfig.defaults.modules[ data.type ];
5149
+ }
5150
+
5151
  // Render the module if a settings form is already open.
5152
  if ( $( 'form.fl-builder-settings' ).length ) {
5153
  if ( data.layout ) {
js/fl-builder.min.js CHANGED
@@ -1,9 +1,9 @@
1
  var FLBuilderColorPicker;!function(e,t){function i(){var t,i,l="backgroundImage";h?f="filter":(t=e('<div id="iris-gradtest" />'),i="linear-gradient(top,#fff,#000)",e.each(g,function(e,s){if(t.css(l,s+i),t.css(l).match("gradient"))return f=e,!1}),f===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css(this.bgImageString).match("gradient")&&(f="webkit")),t.remove())}function l(t,i){return t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),"webkit"===f?o(t,i):g[f]+"linear-gradient("+t+", "+i.join(", ")+")"}function s(t,i){var l,s,o,r,a,d,u,c,h;t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),l="top"===t?0:1,s=e(this),o=i.length-1,r="filter",a=1===l?"left":"top",d=1===l?"right":"bottom",u=1===l?"height":"width",c='<div class="iris-ie-gradient-shim" style="position:absolute;'+u+":100%;"+a+":%start%;"+d+":%end%;"+r+':%filter%;" data-color:"%color%"></div>',h="","static"===s.css("position")&&s.css({position:"relative"}),i=n(i),e.each(i,function(e,t){var s,n,r;return e!==o&&(s=i[e+1],void(t.stop!==s.stop&&(n=100-parseFloat(s.stop)+"%",t.octoHex=new Color(t.color).toIEOctoHex(),s.octoHex=new Color(s.color).toIEOctoHex(),r="progid:DXImageTransform.Microsoft.Gradient(GradientType="+l+", StartColorStr='"+t.octoHex+"', EndColorStr='"+s.octoHex+"')",h+=c.replace("%start%",t.stop).replace("%end%",n).replace("%filter%",r))))}),s.find(".iris-ie-gradient-shim").remove(),e(h).prependTo(s)}function o(t,i){var l=[];return t="top"===t?"0% 0%,0% 100%,":"0% 100%,100% 100%,",i=n(i),e.each(i,function(e,t){l.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+l.join(",")+")"}function n(t){var i=[],l=[],s=[],o=t.length-1;return e.each(t,function(e,t){var s=t,o=!1,n=t.match(/1?[0-9]{1,2}%$/);n&&(s=t.replace(/\s?1?[0-9]{1,2}%$/,""),o=n.shift()),i.push(s),l.push(o)}),l[0]===!1&&(l[0]="0%"),l[o]===!1&&(l[o]="100%"),l=r(l),e.each(l,function(e){s[e]={color:i[e],stop:l[e]}}),s}function r(t){var i,l,s,o,n=0,a=t.length-1,d=0,u=!1;if(t.length<=2||e.inArray(!1,t)<0)return t;for(;d<t.length-1;)u||t[d]!==!1?u&&t[d]!==!1&&(a=d,d=t.length):(n=d-1,u=!0),d++;for(l=a-n,o=parseInt(t[n].replace("%"),10),i=(parseFloat(t[a].replace("%"))-o)/l,d=n+1,s=1;d<a;)t[d]=o+s*i+"%",s++,d++;return r(t)}var a=[],d=navigator.userAgent.toLowerCase(),u="Microsoft Internet Explorer"===navigator.appName,c=u?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,h=u&&c<10,f=!1,g=["-moz-","-webkit-","-o-","-ms-"];flBuilderParseColorValue=function(e){var t=e.replace(/\s+/g,""),i=t.indexOf("rgba")!==-1?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100,l=i<100;return{value:t,alpha:i,rgba:l}},e.fn.flBuilderColorPickerGradient=function(){var t=arguments;return this.each(function(){h?s.apply(this,t):e(this).css("backgroundImage",l.apply(this,t))})},e.fn.flBuilderColorPickerRaninbowGradient=function(t,i){var l,s,o,n;for(t=t||"top",l=e.extend({},{s:100,l:50},i),s="hsl(%h%,"+l.s+"%,"+l.l+"%)",o=0,n=[];o<=360;)n.push(s.replace("%h%",o)),o+=30;return this.each(function(){e(this).flBuilderColorPickerGradient(t,n)})},FLBuilderColorPicker=function(t){this._html='<div class="fl-color-picker-ui"><div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="javascript:void(0);"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div></div>';var i={elements:null,color:"",mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},target:!1,width:200,presets:[],labels:{colorPresets:"Color Presets",colorPicker:"Color Picker",placeholder:"Paste color here...",removePresetConfirm:"Are you sure?",noneColorSelected:"None color selected.",alreadySaved:"%s is already a saved preset.",noPresets:"Add a color preset first.",presetAdded:"%s added to presets!"}};this.options=e.extend({},i,t),(h===!1||h===!0&&c>7)&&this._init()},FLBuilderColorPicker.prototype={_html:"",_color:"",_currentElement:"",_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_init:function(){var t=this;e(t.options.elements);this._color=new Color("#ff0000").setHSpace(t.options.mode),a=this.options.presets,f===!1&&i(),e("html").hasClass("fl-color-picker-init")?t.picker=e(".fl-color-picker-ui"):t.picker=e(this._html).appendTo("body"),u?9===c?t.picker.addClass("iris-ie-9"):c<=8&&t.picker.addClass("iris-ie-lt9"):d.indexOf("compatible")<0&&d.indexOf("khtml")<0&&d.match(/mozilla/)&&t.picker.addClass("iris-mozilla"),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},"hsv"===t.options.mode&&t._has("l",t.options.controls)?t.options.controls=t._defaultHSVControls:"hsl"===t.options.mode&&t._has("v",t.options.controls)&&(t.options.controls=t._defaultHSLControls),t.hue=t._color.h(),this._setTemplates(),this._ui=e(".fl-color-picker-ui"),this._iris=e(".iris-picker"),this._wrapper=e("body"),e("html").hasClass("fl-color-picker-init")||this._ui.prepend(this._hexHtml).append(this._presetsHtml),t.element=this._ui.find(".fl-color-picker-input"),t._initControls(),t.active="external",t._change(),t._addInputListeners(t.element),this._buildUI(),this._prepareColorFields(),this._pickerControls(),this._presetsControls(),this._buildAlphaUI(),e("html").addClass("fl-color-picker-init")},_prepareColorFields:function(){var t=this;e(".fl-color-picker-value").each(function(){var i=e(this),l=i.val(),s=i.parent().find(".fl-color-picker-color"),o=flBuilderParseColorValue(l),n="";if(l){if(s.hasClass("fl-color-picker-alpha-enabled")&&o.rgba)n=i.val().toString();else if(!s.hasClass("fl-color-picker-alpha-enabled")&&o.rgba){var r=l.replace("rgba","rgb");r=r.substr(0,r.lastIndexOf(","))+")",t._color._alpha=1,n=r,i.val(r)}else n="#"+i.val().toString();s.css({backgroundColor:n})}})},_setTemplates:function(){this._alphaHtml='<div class="fl-alpha-wrap"><div class="fl-alpha-slider"></div><div class="fl-alpha-slider-offset"></div><div class="fl-alpha-text"></div></div>',this._presetsHtml='<div class="fl-color-picker-presets"><div class="fl-color-picker-presets-toggle"><div class="fl-color-picker-presets-open-label fl-color-picker-active">'+this.options.labels.colorPresets+' <span class="fl-color-picker-icon-arrow-up"></span></div><div class="fl-color-picker-presets-close-label">'+this.options.labels.colorPicker+' <span class="fl-color-picker-icon-arrow-down"></span></div></div><ul class="fl-color-picker-presets-list"></ul></div>',this._hexHtml='<input type="text" class="fl-color-picker-input" maxlength="7" placeholder="'+this.options.labels.placeholder+'"><div class="fl-color-picker-preset-add"></div>',this._presetsTpl='<li class="fl-color-picker-preset"><span class="fl-color-picker-preset-color"></span> <span class="fl-color-picker-preset-label"></span> <span class="fl-color-picker-preset-remove fl-color-picker-icon-remove"></span></li>',this._noPresetsTpl='<li class="fl-color-picker-no-preset"><span class="fl-color-picker-preset-label">'+this.options.labels.noPresets+"</span></li>"},_has:function(t,i){var l=!1;return e.each(i,function(e,i){if(t===i)return l=!0,!1}),l},_buildUI:function(){var t=this;t._presetsList=this._ui.find(".fl-color-picker-presets-list"),t._presetsList.html(""),this.options.presets.length>0?e.each(this.options.presets,function(e,i){t._addPresetView(i)}):t._presetsList.append(this._noPresetsTpl)},_addPresetView:function(t){var i=this._presetsList.find(".fl-color-picker-no-preset");i.length>0&&i.remove();var l=e(this._presetsTpl),s=Color(t);l.attr("data-color",t).find(".fl-color-picker-preset-color").css({backgroundColor:s.toString()}).end().find(".fl-color-picker-preset-label").html(s.toString()),this._presetsList.append(l)},_addPresetFeedback:function(){this._ui.append('<div class="fl-color-picker-added"><div class="fl-color-picker-added-text"><div class="fl-color-picker-icon-check"></div> "'+this.options.labels.presetAdded.replace("%s",this._color.toString())+'"</div></div>'),this._ui.find(".fl-color-picker-added").hide().fadeIn(200).delay(2e3).fadeOut(200,function(){e(this).remove()})},_pickerControls:function(){var t=this;this._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),t._ui.position({my:"left top",at:"left bottom",of:i,collision:"flipfit",using:function(e,i){t._togglePicker(e)}})}).on("click",".fl-color-picker-clear",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),i.prev(".fl-color-picker-color").css({backgroundColor:"transparent"}).addClass("fl-color-picker-empty"),t._setColor(""),t.element.val(""),t._currentElement.val("").trigger("change")}),e(document).on("mousedown",function(t){0===e(t.target).closest(".fl-color-picker-ui").length&&e(".fl-color-picker-ui.fl-color-picker-active").removeClass("fl-color-picker-active")})},_presetsControls:function(){var t=this,i=t._ui.find(".fl-color-picker-preset-add"),l=t._ui.find(".fl-color-picker-presets"),s=l.find(".fl-color-picker-presets-open-label"),o=l.find(".fl-color-picker-presets-close-label"),n=l.find(".fl-color-picker-presets-list");i.off("click").on("click",function(){t._addPreset(t.element.val())}),n.css({height:t.element.innerHeight()+t._iris.innerHeight()+14+"px"}).hide(),l.off("click").on("click",".fl-color-picker-presets-toggle",function(){s.toggleClass("fl-color-picker-active"),o.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset",function(i){var l=new Color(e(this).data("color").toString());t._setColor(l),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:l.toString()}).removeClass("fl-color-picker-empty"),s.toggleClass("fl-color-picker-active"),o.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset-remove",function(i){i.stopPropagation(),t._removePreset(e(this).parent().data("color"))})},_removePreset:function(t){if(confirm(this.options.labels.removePresetConfirm)){var i=t.toString(),l=a.indexOf(i);l>-1&&(a.splice(l,1),this.options.presets=a,this._presetsList.find('.fl-color-picker-preset[data-color="'+i+'"]').slideUp(function(){e(this).remove()})),a.length<1&&this._presetsList.append(this._noPresetsTpl),e(this).trigger("presetRemoved",{presets:a})}},_addPreset:function(t){var i=t.toString().replace(/^#/,"");""===i?alert(this.options.labels.noneColorSelected):a.indexOf(i)>-1?alert(this.options.labels.alreadySaved.replace("%s","#"+i)):(this._addPresetView(i),this._addPresetFeedback(),a.push(i),this.options.presets=a,e(this).trigger("presetAdded",{presets:a}))},_togglePicker:function(e){var t=this;this._ui.hasClass("fl-color-picker-active")?(this._ui.removeClass("fl-color-picker-active"),e&&setTimeout(function(){t._ui.css(e),t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200)):(e&&t._ui.css(e),setTimeout(function(){t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200))},_paint:function(){var e=this;e._paintDimension("right","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var i,l=this,s=l._color,o=l.options.mode,n=l._getHSpaceColor(),r=l.controls[t],a=l.options.controls;if(t!==l.active&&("square"!==l.active||"strip"===t))switch(a[t]){case"h":if("hsv"===o){switch(n=s.clone(),t){case"horiz":n[a.vert](100);break;case"vert":n[a.horiz](100);break;case"strip":n.setHSpace("hsl")}i=n.toHsl()}else i="strip"===t?{s:n.s,l:n.l}:{s:100,l:n.l};r.flBuilderColorPickerRaninbowGradient(e,i);break;case"s":"hsv"===o?"vert"===t?i=[s.clone().a(0).s(0).toCSS("rgba"),s.clone().a(1).s(0).toCSS("rgba")]:"strip"===t?i=[s.clone().s(100).toCSS("hsl"),s.clone().s(0).toCSS("hsl")]:"horiz"===t&&(i=["#fff","hsl("+n.h+",100%,50%)"]):i="vert"===t&&"h"===l.options.controls.horiz?["hsla(0, 0%, "+n.l+"%, 0)","hsla(0, 0%, "+n.l+"%, 1)"]:["hsl("+n.h+",0%,50%)","hsl("+n.h+",100%,50%)"],r.flBuilderColorPickerGradient(e,i);break;case"l":i="strip"===t?["hsl("+n.h+",100%,100%)","hsl("+n.h+", "+n.s+"%,50%)","hsl("+n.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],r.flBuilderColorPickerGradient(e,i);break;case"v":i="strip"===t?[s.clone().v(100).toCSS(),s.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],r.flBuilderColorPickerGradient(e,i)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(e){var t,i=this,l=i.options,s=i.controls,o=s.square,n=i.picker.find(".iris-strip"),r="77.5%",a="12%",d=20,u=l.border?l.width-d:l.width;if(e&&(o.css("width",""),n.css("width",""),i.picker.css({width:"",height:""})),r=u*(parseFloat(r)/100),a=u*(parseFloat(a)/100),t=l.border?r+d:r,o.width(r).height(r),n.height(r).width(a),i.picker.css({width:l.width,height:t}),!l.palettes)return i.picker.css("paddingBottom","")},_addInputListeners:function(e){var t=this,i=100,l=function(i){var l=new Color(e.val()),s=e.val().replace(/^#/,""),o=t._currentElement.hasClass("fl-color-picker-empty");if(e.removeClass("iris-error"),l.error)""!==s&&e.addClass("iris-error");else if(l.toString()!==t._color.toString()||""!==t._color.toString()&&o)if("keyup"===i.type){if(s.match(/^[0-9a-fA-F]{3}$/))return;t._setColor(s),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:Color(s).toString()}).removeClass("fl-color-picker-empty"),t._currentElement.val(s).trigger("change")}else if("paste"===i.type)return s=i.originalEvent.clipboardData.getData("text").replace(/^#/,""),hex=Color(s).toString(),t._setColor(s),e.val(hex),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:hex}).removeClass("fl-color-picker-empty"),t._currentElement.val(s).trigger("change"),!1};e.on("change",l).on("keyup",t._debounce(l,i))},_initControls:function(){var t=this,i=t.controls,l=i.square,s=t.options.controls,o=t._scale[s.strip];i.stripSlider.slider({orientation:"horizontal",max:o,slide:function(e,i){t.active="strip","h"===s.strip&&(i.value=o-i.value),t._color[s.strip](i.value),t._change.apply(t,arguments)}}),i.squareDrag.draggable({containment:i.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(e,i){t._squareDrag(e,i)},start:function(){l.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){l.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(i){var l="ui-state-focus";i.preventDefault(),"mousedown"===i.type?(t.picker.find("."+l).removeClass(l).blur(),e(this).addClass(l).focus()):e(this).removeClass(l)}).on("keydown",function(e){var l=i.square,s=i.squareDrag,o=s.position(),n=2;switch(e.altKey&&(n*=10),e.keyCode){case 37:o.left-=n;break;case 38:o.top-=n;break;case 39:o.left+=n;break;case 40:o.top+=n;break;default:return!0}o.left=Math.max(0,Math.min(o.left,l.width())),o.top=Math.max(0,Math.min(o.top,l.height())),s.css(o),t._squareDrag(e,{position:o}),e.preventDefault()}),l.mousedown(function(i){var l,s;1===i.which&&e(i.target).is("div")&&(l=t.controls.square.offset(),s={top:i.pageY-l.top,left:i.pageX-l.left},i.preventDefault(),t._squareDrag(i,{position:s}),i.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(s).trigger(i))})},_squareDrag:function(e,t){var i=this,l=i.options.controls,s=i._squareDimensions(),o=Math.round((s.h-t.position.top)/s.h*i._scale[l.vert]),n=i._scale[l.horiz]-Math.round((s.w-t.position.left)/s.w*i._scale[l.horiz]);i._color[l.horiz](n)[l.vert](o),i.active="square",i._change.apply(i,arguments)},_setColor:function(e){var t,i,l=this,s=l.options.color;l.options.color=e,e=""+e,t=e.replace(/^#/,""),i=new Color(e).setHSpace(l.options.mode),i.error?l.options.color=s:(l._color=i,l.options.color=l._color.toString(),l.active="external",l._change())},_squareDimensions:function(e){var i,l,s=this.controls.square;return e!==t&&s.data("dimensions")?s.data("dimensions"):(l=this.controls.squareDrag,i={w:s.width(),h:s.height()},s.data("dimensions",i),i)},_isNonHueControl:function(e,t){return"square"===e&&"h"===this.options.controls.strip||"external"!==t&&("h"!==t||"strip"!==e)},_change:function(){var t=this,i=t.controls,l=t._getHSpaceColor(),s=["square","strip"],o=t.options.controls,n=o[t.active]||"external",r=t.hue;"strip"===t.active?s=[]:"external"!==t.active&&s.pop(),e.each(s,function(e,s){var n,r,a;if(s!==t.active)switch(s){case"strip":n="h"===o.strip?t._scale[o.strip]-l[o.strip]:l[o.strip],i.stripSlider.slider("value",n);break;case"square":r=t._squareDimensions(),a={left:l[o.horiz]/t._scale[o.horiz]*r.w,top:r.h-l[o.vert]/t._scale[o.vert]*r.h},t.controls.squareDrag.css(a)}}),l.h!==r&&t._isNonHueControl(t.active,n)&&t._color.h(r),t.hue=t._color.h(),t.options.color=t._color.toString(),t.element.is(":input")&&!t._color.error&&(t.element.removeClass("iris-error"),t.element.val()!==t._color.toString()&&(t.element.val(t._color.toString()),this._currentElement&&(this._currentElement.val(t._color.toString().replace(/^#/,"")).parent().find(".fl-color-picker-color").css({backgroundColor:t._color.toString()}).removeClass("fl-color-picker-empty"),t._wrapper.find(".fl-alpha-slider-offset").css("background-color",t._color.toString()),this._currentElement.trigger("change")))),t._paint(),t._inited=!0,t.active=!1},_debounce:function(e,t,i){var l,s;return function(){var o,n,r=this,a=arguments;return o=function(){l=null,i||(s=e.apply(r,a))},n=i&&!l,clearTimeout(l),l=setTimeout(o,t),n&&(s=e.apply(r,a)),s}},_buildAlphaUI:function(){var t=this;t._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement.val();i.hasClass("fl-color-picker-alpha-enabled")?(t._ui.find(".fl-alpha-wrap").length<=0&&e(t._alphaHtml).insertAfter(t._iris),t.picker.addClass("fl-color-alpha-enabled"),t._pickerAlphaControls()):t._ui.find(".fl-alpha-wrap").remove()})},_pickerAlphaControls:function(){var e=this,t=e._currentElement,i=flBuilderParseColorValue(t.val()),l=parseFloat(i.alpha/100),s=e._wrapper,o=e._ui,n=o.find(".fl-alpha-wrap"),r=n.find(".fl-alpha-slider"),a=n.find(".fl-alpha-text"),d=n.find(".fl-alpha-slider-offset");alphaHandle=n.find(".ui-slider-handle"),a.text(l<1?l:""),r.slider({orientation:"vertical",slide:function(t,i){var l=parseFloat(i.value/100);e._color._alpha=l,a.text(l<1?l:""),e._change.apply(e,arguments)},create:function(){d.css({backgroundColor:i.value}),s.on("click",".fl-color-picker-clear",function(){e._color._alpha=1,a.text(""),r.slider("value",100).trigger("slide")})},value:i.alpha,step:1,min:1,max:100})}}}(jQuery),function(e,t){var i=function(e,t){return this instanceof i?this._init(e,t):new i(e,t)};i.fn=i.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var i="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),i=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":i,this[i](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var e=new i(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"],l=t.length-1;l>=0;l--)e[t[l]]=this[t[l]];return e},setHSpace:function(e){return this._hSpace="hsv"===e?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,i=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),e.match(i)&&e.match(/\)$/)){if(t=e.replace(/(\s|%)/g,"").replace(i,"").replace(/,?\);?$/,"").split(","),t.length<3)return this._error();if(4===t.length&&(this.a(parseFloat(t.pop())),this.error))return this;for(var l=t.length-1;l>=0;l--)if(t[l]=parseInt(t[l],10),isNaN(t[l]))return this._error();return e.match(/^rgb/)?this.fromRgb({r:t[0],g:t[1],b:t[2]}):e.match(/^hsv/)?this.fromHsv({h:t[0],s:t[1],v:t[2]}):this.fromHsl({h:t[0],s:t[1],l:t[2]})}return this.fromHex(e)},fromRgb:function(e,i){return"object"!=typeof e||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),i))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var i,l,s,o,n,r,a,d;return"object"!=typeof e||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",r=e.h/360,a=e.s/100,d=e.l/100,0===a?i=l=s=d:(o=d<.5?d*(1+a):d+a-d*a,n=2*d-o,i=this.hue2rgb(n,o,r+1/3),l=this.hue2rgb(n,o,r),s=this.hue2rgb(n,o,r-1/3)),this.fromRgb({r:255*i,g:255*l,b:255*s},!0))},fromHsv:function(e){var i,l,s,o,n,r,a,d,u,c,h;if("object"!=typeof e||e.h===t||e.s===t||e.v===t)return this._error();switch(this._hsv=e,this._hSpace="hsv",i=e.h/360,l=e.s/100,s=e.v/100,a=Math.floor(6*i),d=6*i-a,u=s*(1-l),c=s*(1-d*l),h=s*(1-(1-d)*l),a%6){case 0:o=s,n=h,r=u;break;case 1:o=c,n=s,r=u;break;case 2:o=u,n=s,r=h;break;case 3:o=u,n=c,r=s;break;case 4:o=h,n=u,r=s;break;case 5:o=s,n=u,r=c}return this.fromRgb({r:255*o,g:255*n,b:255*r},!0)},fromInt:function(e,i){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),i===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},toString:function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){switch(e=e||"hex",t=parseFloat(t||this._alpha),e){case"rgb":case"rgba":var i=this.toRgb();return t<1?"rgba( "+i.r+", "+i.g+", "+i.b+", "+t+" )":"rgb( "+i.r+", "+i.g+", "+i.b+" )";case"hsl":case"hsla":var l=this.toHsl();return t<1?"hsla( "+l.h+", "+l.s+"%, "+l.l+"%, "+t+" )":"hsl( "+l.h+", "+l.s+"%, "+l.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e,t,i=this.toRgb(),l=i.r/255,s=i.g/255,o=i.b/255,n=Math.max(l,s,o),r=Math.min(l,s,o),a=(n+r)/2;if(n===r)e=t=0;else{var d=n-r;switch(t=a>.5?d/(2-n-r):d/(n+r),n){case l:e=(s-o)/d+(s<o?6:0);break;case s:e=(o-l)/d+2;break;case o:e=(l-s)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsl.h!==e&&(e=this._hsl.h),t=Math.round(100*t),0===t&&this._hsl.s&&(t=this._hsl.s),{h:e,s:t,l:Math.round(100*a)}},toHsv:function(){var e,t,i=this.toRgb(),l=i.r/255,s=i.g/255,o=i.b/255,n=Math.max(l,s,o),r=Math.min(l,s,o),a=n,d=n-r;if(t=0===n?0:d/n,n===r)e=t=0;else{switch(n){case l:e=(s-o)/d+(s<o?6:0);break;case s:e=(o-l)/d+2;break;case o:e=(l-s)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsv.h!==e&&(e=this._hsv.h),t=Math.round(100*t),0===t&&this._hsv.s&&(t=this._hsv.s),{h:e,s:t,v:Math.round(100*a)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return 1===t.length&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(!(e instanceof i))throw"getDistanceLuminosityFrom requires a Color object";var t=this.toLuminosity(),l=e.toLuminosity();return t>l?(t+.05)/(l+.05):(l+.05)/(t+.05)},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new i(t)},getReadableContrastingColor:function(e,l){if(!(e instanceof i))return this;var s=l===t?5:l,o=e.getDistanceLuminosityFrom(this),n=e.getMaxContrastColor(),r=n.getDistanceLuminosityFrom(e);if(r<=s)return n;if(o>=s)return this;for(var a=0===n.toInt()?-1:1;o<s&&(this.l(a,!0),o=this.getDistanceLuminosityFrom(e),0!==this._color&&16777215!==this._color););return this},a:function(e){if(e===t)return this._alpha;var i=parseFloat(e);return isNaN(i)?this._error():(this._alpha=i,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+30*e;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=30*e;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=60*e;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=120*e;return this.h(t,!0)},_partial:function(e){var i=l[e];return function(l,s){var o=this._spaceFunc("to",i.space);return l===t?o[e]:(s===!0&&(l=o[e]+l),i.mod&&(l%=i.mod),i.range&&(l=l<i.range[0]?i.range[0]:l>i.range[1]?i.range[1]:l),o[e]=l,this._spaceFunc("from",i.space,o))}},_spaceFunc:function(e,t,i){var l=t||this._hSpace,s=e+l.charAt(0).toUpperCase()+l.substr(1);return this[s](i)}};var l={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var s in l)l.hasOwnProperty(s)&&(i.fn[s]=i.fn._partial(s));"object"==typeof exports?module.exports=i:e.Color=i}(this),function(e){FLLightbox=function(e){this._init(e)},FLLightbox.closeParent=function(t){var i=e(t).closest(".fl-lightbox-wrap").attr("data-instance-id");_.isUndefined(i)||FLLightbox._instances[i].close()},FLLightbox.getResizableControlClass=function(){var t=e(".fl-lightbox-resizable").eq(0),i="fa fa-window-maximize";return t.length&&t.hasClass("fl-lightbox-width-full")&&(i="fa fa-window-minimize"),i},FLLightbox.unbindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._unbind()},FLLightbox.bindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._bind()},FLLightbox.closeAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e].close()},FLLightbox._instances={},FLLightbox.prototype={_id:null,_node:null,_visible:!1,_allowClosing:!0,_resizeTimer:null,_defaults:{className:"",destroyOnClose:!1,resizable:!1},open:function(e){this._bind(),this._node.show(),this._visible=!0,"undefined"!=typeof e?this.setContent(e):this._resize(),this.trigger("open"),FLBuilder.triggerHook("didShowLightbox",this)},close:function(){var e=this._node.data("parent");this._allowClosing&&(this.trigger("beforeCloseLightbox"),this._unbind(),this._node.hide(),this._visible=!1,this.trigger("close"),FLBuilder.triggerHook("didHideLightbox"),this._defaults.resizable&&_.isUndefined(e)&&FLBuilder.triggerHook("didHideAllLightboxes"),this._defaults.destroyOnClose&&this.destroy())},disableClose:function(){this._allowClosing=!1},enableClose:function(){this._allowClosing=!0},setContent:function(e){this._node.find(".fl-lightbox-content").html(e),this._resize()},empty:function(){this._node.find(".fl-lightbox-content").empty()},on:function(e,t){this._node.on(e,t)},off:function(e,t){this._node.off(e,t)},trigger:function(e,t){this._node.trigger(e,t)},destroy:function(){this._node.empty(),this._node.remove(),FLLightbox._instances[this._id]="undefined";try{delete FLLightbox._instances[this._id]}catch(e){}},_init:function(t){var i=0,l=null;for(l in FLLightbox._instances)i++;this._defaults=e.extend({},this._defaults,t),this._id=(new Date).getTime()+i,FLLightbox._instances[this._id]=this,this._render(),this._resizable()},_render:function(){this._node=e('<div class="fl-lightbox-wrap" data-instance-id="'+this._id+'"><div class="fl-lightbox-mask"></div><div class="fl-lightbox"><div class="fl-lightbox-content-wrap"><div class="fl-lightbox-content"></div></div></div></div>'),this._node.addClass(this._defaults.className),e("body").append(this._node)},_bind:function(){e(window).on("resize.fl-lightbox-"+this._id,this._delayedResize.bind(this))},_unbind:function(){e(window).off("resize.fl-lightbox-"+this._id)},_resizable:function(){var t=(e("body"),this._node.find(".fl-lightbox-mask")),i=this._node.find(".fl-lightbox"),l=e(".fl-lightbox-resizable").eq(0);this._defaults.resizable?(t.hide(),i.addClass("fl-lightbox-resizable"),i.delegate(".fl-lightbox-resize-toggle","click",this._resizeClicked.bind(this)),i.draggable({cursor:"move",handle:".fl-lightbox-header"}).resizable({handles:"all",minHeight:500,minWidth:380,start:this._resizeStart.bind(this),stop:this._resizeStop.bind(this)}),l.length&&l.hasClass("fl-lightbox-width-full")?(i.addClass("fl-lightbox-width-full"),i.draggable("disable")):this._restorePosition()):t.show(),this._resize()},_delayedResize:function(){clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(this._resize.bind(this),250)},_resize:function(){var t=this._node.find(".fl-lightbox"),i=parseInt(this._node.css("padding-top")),l=parseInt(this._node.css("padding-bottom")),s=parseInt(this._node.css("padding-left")),o=parseInt(this._node.css("padding-right")),n=t.height(),r=t.width(),a=e(window),d=a.height()-i-l,u=(a.width()-s-o,"0px");this._defaults.resizable?(r<600?t.addClass("fl-lightbox-width-slim"):t.removeClass("fl-lightbox-width-slim"),this._resizeEditors()):(d>n&&(u=(d-n-46)/2+"px"),t.attr("style","").css("margin",u+" auto 0")),this.trigger("resized")},_resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),e(".fl-builder-lightbox:visible").append('<div class="fl-builder-resizable-iframe-fix"></div>'),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},_resizeStop:function(t,i){var l=e(".fl-lightbox-resizable:visible");parseInt(l.css("top"))<0&&l.css("top","0"),this._savePosition(),e("body").removeClass("fl-builder-resizable-is-resizing"),e(".fl-builder-resizable-iframe-fix").remove(),FLBuilder._bindOverlayEvents()},_resizeClicked:function(){var t=e(".fl-lightbox-resizable"),i=(t.find(".fl-lightbox-resize-toggle"),this._node.find(".fl-lightbox"));i.hasClass("fl-lightbox-width-full")?this._resizeExitFull():this._resizeEnterFull(),this._resize()},_resizeEnterFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-maximize").addClass("fa-window-minimize"),t.addClass("fl-lightbox-width-full"),t.draggable("disable"),t.resizable("disable")},_resizeExitFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-minimize").addClass("fa-window-maximize"),t.removeClass("fl-lightbox-width-full"),t.draggable("enable"),t.resizable("enable")},_resizeEditors:function(){e(".fl-lightbox-resizable").each(function(){var t=e(this),i=t.find(".fl-builder-settings-fields").height(),l=t.find(".mce-edit-area > iframe, textarea.wp-editor-area, .ace_editor"),s=null;i<350&&(i=350),l.each(function(){s=e(this),s.hasClass("ace_editor")?(s.height(i-60),s.closest(".fl-field").data("editor").resize()):s.closest(".mce-container-body").find(".mce-toolbar-grp .mce-toolbar.mce-last").is(":visible")?s.height(i-175):s.height(i-150)})})},_savePosition:function(){var e=this._node.find(".fl-lightbox"),t={width:e.width(),height:e.height(),top:parseInt(e.css("top"))<0?"0px":e.css("top"),left:e.css("left")};e.closest(".fl-builder-ui-pinned").length||(FLBuilderConfig.userSettings.lightbox=t,FLBuilder.ajax({action:"save_lightbox_position",data:t}))},_restorePosition:function(){var e=this._node.find(".fl-lightbox"),t=FLBuilderConfig.userSettings.lightbox;t?e.css(t):e.css({top:25,left:FLBuilderConfig.isRtl?"-25":25})}}}(jQuery),function(e){FLIconSelector={_content:null,_lightbox:null,_rendered:!1,_filterText:"",open:function(e){FLIconSelector._rendered||FLIconSelector._render(),null===FLIconSelector._content?(FLIconSelector._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder.ajax({
2
  action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelector._lightbox.open(),FLIconSelector._lightbox.on("icon-selected",function(t,i){FLIconSelector._lightbox.off("icon-selected"),FLIconSelector._lightbox.close(),e(i)})},_render:function(){FLIconSelector._lightbox=new FLLightbox({className:"fl-icon-selector"}),FLIconSelector._rendered=!0,FLBuilder.addHook("endEditingSession",function(){FLIconSelector._lightbox.close()})},_getContentComplete:function(t){var i=JSON.parse(t);FLIconSelector._content=i.html,FLIconSelector._lightbox.setContent(i.html),e(".fl-icons-filter-select").on("change",FLIconSelector._filter),e(".fl-icons-filter-text").on("keyup",FLIconSelector._filter),e(".fl-icons-list i").on("click",FLIconSelector._select),e(".fl-icon-selector-cancel").on("click",e.proxy(FLIconSelector._lightbox.close,FLIconSelector._lightbox))},_filter:function(){var t=e(".fl-icons-filter-select").val(),i=e(".fl-icons-filter-text").val();"all"==t?e(".fl-icons-section").show():(e(".fl-icons-section").hide(),e(".fl-"+t).show()),FLIconSelector._filterText=i,""!==i?e(".fl-icons-list i").each(FLIconSelector._filterIcon):e(".fl-icons-list i").show()},_filterIcon:function(){var t=e(this);-1==t.attr("class").indexOf(FLIconSelector._filterText)?t.hide():t.show()},_select:function(){var t=e(this).attr("class");FLIconSelector._lightbox.trigger("icon-selected",t)}}}(jQuery),function(e){FLStyleSheet=function(t){"object"==typeof t&&e.extend(this,t),this._createSheet()},FLStyleSheet.prototype={id:null,_sheet:null,_sheetElement:null,updateRule:function(e,t,i){for(var l=this._sheet.cssRules?this._sheet.cssRules:this._sheet.rules,s=null,o=0;o<l.length;o++)l[o].selectorText.toLowerCase()==e.toLowerCase()&&(s=l[o]);if(s)if("object"==typeof t)for(o in t)s.style[this._toCamelCase(o)]=t[o];else s.style[this._toCamelCase(t)]=i;else this.addRule(e,t,i)},addRule:function(e,t,i){var l="",s="";if("object"==typeof t)for(s in t)l+=s+":"+t[s]+";";else l=t+":"+i+";";this._sheet.insertRule?this._sheet.insertRule(e+" { "+l+" }",this._sheet.cssRules.length):this._sheet.addRule(e,l)},destroy:function(){this._sheetElement&&(this._sheetElement.remove(),this._sheetElement=null),this._sheet&&(this._sheet=null)},disable:function(){this._sheet.disabled=!0},enable:function(){this._sheet.disabled=!1},_createSheet:function(){var t=this.id?' id="'+this.id+'"':"",i=this.className?' class="'+this.className+'"':"";this._sheet||(this._sheetElement=e('<style type="text/css"'+t+i+"></style>"),e("body").append(this._sheetElement),this._sheet=this._sheetElement[0].sheet)},_toCamelCase:function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}}(jQuery),function(e){FLBuilder={preview:null,_actionsLightbox:null,_addModuleAfterNodeRender:null,_colResizeData:null,_colResizing:!1,_contentClass:!1,_dragEnabled:!1,_dragging:!1,_dragInitialScrollTop:0,_exitUrl:null,_layout:null,_layoutSettingsCSSCache:null,_layoutSettingsCSSTimeout:null,_lightbox:null,_lightboxScrollbarTimeout:null,_loadedModuleAssets:[],_moduleHelpers:{},_multiplePhotoSelector:null,_newColParent:null,_newColPosition:0,_newColGroupParent:null,_newColGroupPosition:0,_newModuleParent:null,_newModulePosition:0,_newRowPosition:0,_selectedTemplateId:null,_selectedTemplateType:null,_singlePhotoSelector:null,_singleVideoSelector:null,_multipleAudiosSelector:null,_init:function(){FLBuilder._initJQueryReadyFix(),FLBuilder._initGlobalErrorHandling(),FLBuilder._initPostLock(),FLBuilder._initClassNames(),FLBuilder._initMediaUploader(),FLBuilder._initOverflowFix(),FLBuilder._initScrollbars(),FLBuilder._initLightboxes(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._initStrings(),FLBuilder._initTipTips(),FLBuilder._initTinyMCE(),FLBuilder._bindEvents(),FLBuilder._bindOverlayEvents(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder.addHook("didInitUI",FLBuilder._showTourOrTemplates.bind(FLBuilder)),FLBuilder.triggerHook("init")},_initJQueryReadyFix:function(){FLBuilderConfig.debug||(jQuery.fn.oldReady=jQuery.fn.ready,jQuery.fn.ready=function(t){return jQuery.fn.oldReady(function(){try{"function"==typeof t&&t(e)}catch(i){FLBuilder.logError(i)}})})},_initGlobalErrorHandling:function(){FLBuilderConfig.debug||(window.onerror=function(e,t,i,l,s){return FLBuilder.logGlobalError(e,t,i,l,s),!0})},_initPostLock:function(){"undefined"!=typeof wp.heartbeat&&(wp.heartbeat.interval(30),wp.heartbeat.enqueue("fl_builder_post_lock",{post_id:FLBuilderConfig.postId}))},_initClassNames:function(){e("html").addClass("fl-builder-edit"),e("body").addClass("fl-builder"),FLBuilderConfig.simpleUi&&e("body").addClass("fl-builder-simple"),FLBuilder._contentClass=".fl-builder-content-"+FLBuilderConfig.postId,e(FLBuilder._contentClass).addClass("fl-builder-content-editing")},_initMediaUploader:function(){wp.media.model.settings.post.id=FLBuilderConfig.postId},_initOverflowFix:function(){e(FLBuilder._contentClass).parents().css("overflow","visible")},_initScrollbars:function(){e(".fl-nanoscroller").nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},_initSortables:function(){var t={appendTo:"body",cursor:"move",cursorAt:{left:85,top:20},distance:1,helper:FLBuilder._blockDragHelper,start:FLBuilder._blockDragStart,sort:FLBuilder._blockDragSort,change:FLBuilder._blockDragChange,stop:FLBuilder._blockDragStop,placeholder:"fl-builder-drop-zone",tolerance:"intersect"},i="",l="";l="row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col-content":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-row:not(.fl-node-global) .fl-col-content",i=FLBuilderConfig.nestedColumns?l:"row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",e(".fl-builder-rows").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-row",stop:FLBuilder._rowDragStop})),e(".fl-builder-row-templates").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-row-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-rows").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-saved-row",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-modules, .fl-builder-widgets").sortable(e.extend({},t,{connectWith:l,items:".fl-builder-block-module",stop:FLBuilder._moduleDragStop})),e(".fl-builder-module-templates").sortable(e.extend({},t,{connectWith:l,items:".fl-builder-block-module-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-modules").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:l,items:".fl-builder-block-saved-module",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-row-sortable-proxy").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",helper:FLBuilder._rowDragHelper,start:FLBuilder._rowDragStart,stop:FLBuilder._rowDragStop})),e(".fl-col-sortable-proxy").sortable(e.extend({},t,{connectWith:l,helper:FLBuilder._colDragHelper,start:FLBuilder._colDragStart,stop:FLBuilder._colDragStop})),e(FLBuilder._contentClass+" .fl-col-content").sortable(e.extend({},t,{connectWith:l,handle:".fl-module-overlay .fl-block-overlay-actions .fl-block-move",helper:FLBuilder._moduleDragHelper,items:".fl-module, .fl-col-group",start:FLBuilder._moduleDragStart,stop:FLBuilder._moduleDragStop})),e(FLBuilder._contentClass+" .fl-row-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-group-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-drop-target").sortable(t)},_initStrings:function(){e.validator.messages.required=FLBuilderStrings.validateRequiredMessage},_bindEvents:function(){$excludedLinks=e(".fl-builder-bar a, .fl-builder--content-library-panel a, .fl-page-nav .nav a"),e("a").not($excludedLinks).on("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").on("click",FLBuilder._headerLinkClicked),e("body").delegate("button.fl-builder-button","mouseup",this._buttonMouseUp.bind(this)),e(document).on("heartbeat-tick",FLBuilder._initPostLock),e(window).on("beforeunload",FLBuilder._warnBeforeUnload),e("body").delegate(".fl-builder-has-submenu","click",FLBuilder._submenuParentClicked),e("body").delegate(".fl-builder-has-submenu a","click",FLBuilder._submenuChildClicked),e("body").delegate(".fl-builder-submenu","mouseenter",FLBuilder._submenuMouseenter),e("body").delegate(".fl-builder-submenu","mouseleave",FLBuilder._submenuMouseleave),e("body").delegate(".fl-builder-submenu .fl-builder-has-submenu","mouseenter",FLBuilder._submenuNestedParentMouseenter),e(".fl-builder-panel-actions .fl-builder-panel-close").on("click",FLBuilder._closePanel),e(".fl-builder-blocks-section-title").on("click",FLBuilder._blockSectionTitleClicked),e("body").delegate(".fl-builder-node-template-actions","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-delete","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","click",FLBuilder._editNodeTemplateClicked),e("body").delegate(".fl-builder-node-template-delete","click",FLBuilder._deleteNodeTemplateClicked),e("body").delegate(".fl-builder-block","mousedown",FLBuilder._blockDragInit),e("body").on("mouseup",FLBuilder._blockDragCancel),e("body").delegate(".fl-builder-actions .fl-builder-cancel-button","click",FLBuilder._cancelButtonClicked),e("body").delegate(".fl-builder-save-user-template-button","click",FLBuilder._saveUserTemplateClicked),e("body").delegate(".fl-builder-duplicate-layout-button","click",FLBuilder._duplicateLayoutClicked),e("body").delegate(".fl-builder-layout-settings-button","click",FLBuilder._layoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-save","click",FLBuilder._saveLayoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-builder-global-settings-button","click",FLBuilder._globalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-save","click",FLBuilder._saveGlobalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-user-template","click",FLBuilder._userTemplateClicked),e("body").delegate(".fl-user-template-edit","click",FLBuilder._editUserTemplateClicked),e("body").delegate(".fl-user-template-delete","click",FLBuilder._deleteUserTemplateClicked),e("body").delegate(".fl-builder-template-replace-button","click",FLBuilder._templateReplaceClicked),e("body").delegate(".fl-builder-template-append-button","click",FLBuilder._templateAppendClicked),e("body").delegate(".fl-builder-template-actions .fl-builder-cancel-button","click",FLBuilder._templateCancelClicked),e("body").delegate(".fl-builder-user-template-settings .fl-builder-settings-save","click",FLBuilder._saveUserTemplateSettings),e("body").delegate(".fl-builder-help-tour-button","click",FLBuilder._startHelpTour),e("body").delegate(".fl-builder-knowledge-base-button","click",FLBuilder._viewKnowledgeBaseClicked),e("body").delegate(".fl-builder-forums-button","click",FLBuilder._visitForumsClicked),e("body").delegate(".fl-builder-no-tour-button","click",FLBuilder._noTourButtonClicked),e("body").delegate(".fl-builder-yes-tour-button","click",FLBuilder._yesTourButtonClicked),e("body").delegate(".fl-builder-alert-close","click",FLBuilder._alertClose),e("body").delegate(".fl-block-overlay","contextmenu",FLBuilder._removeAllOverlays),e("body").delegate(".fl-row-overlay .fl-block-remove","click",FLBuilder._deleteRowClicked),e("body").delegate(".fl-row-overlay .fl-block-copy","click",FLBuilder._rowCopyClicked),e("body").delegate(".fl-row-overlay .fl-block-move","mousedown",FLBuilder._rowDragInit),e("body").delegate(".fl-row-overlay .fl-block-settings","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-row-overlay","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-builder-row-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-row-reset","click",FLBuilder._resetRowWidthClicked),e("body").delegate(".fl-col-overlay .fl-block-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-copy","click",FLBuilder._copyColClicked),e("body").delegate(".fl-col-overlay .fl-block-remove","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-col-overlay","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-col-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-col-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-delete","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-reset","click",FLBuilder._resetColumnWidthsClicked),e("body").delegate(".fl-block-col-submenu li","mouseenter",FLBuilder._showColHighlightGuide),e("body").delegate(".fl-block-col-submenu li","mouseleave",FLBuilder._removeColHighlightGuides),e("body").delegate(".fl-block-col-submenu .fl-block-col-move-parent","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit-parent","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-module-overlay .fl-block-remove","click",FLBuilder._deleteModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-copy","click",FLBuilder._moduleCopyClicked),e("body").delegate(".fl-module-overlay .fl-block-move","mousedown",FLBuilder._blockDragInit),e("body").delegate(".fl-module-overlay .fl-block-settings","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-module-overlay","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-builder-module-settings .fl-builder-settings-save","click",FLBuilder._saveModuleClicked),e("body").delegate(".fl-builder-settings-save-as","click",FLBuilder._showNodeTemplateSettings),e("body").delegate(".fl-builder-node-template-settings .fl-builder-settings-save","click",FLBuilder._saveNodeTemplate),e("body").delegate(".fl-builder-settings-tabs a","click",FLBuilder._settingsTabClicked),e("body").delegate(".fl-builder-settings-tabs a","show",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-tabs a","hide",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),e("body").delegate(".fl-builder-settings-tabs-overflow-menu > a","click",FLBuilder._settingsTabsToOverflowMenuItemClicked.bind(this)),e("body").delegate(".fl-builder-settings-tabs-more","click",FLBuilder._toggleTabsOverflowMenu.bind(this)),e("body").delegate(".fl-builder-settings-tabs-overflow-click-mask","click",FLBuilder._hideTabsOverflowMenu.bind(this)),e("body").delegate(".fl-help-tooltip-icon","mouseover",FLBuilder._showHelpTooltip),e("body").delegate(".fl-help-tooltip-icon","mouseout",FLBuilder._hideHelpTooltip),e("body").delegate(".fl-builder-field-add","click",FLBuilder._addFieldClicked),e("body").delegate(".fl-builder-field-copy","click",FLBuilder._copyFieldClicked),e("body").delegate(".fl-builder-field-delete","click",FLBuilder._deleteFieldClicked),e("body").delegate(".fl-builder-settings-fields select","change",FLBuilder._settingsSelectChanged),e("body").delegate(".fl-photo-field .fl-photo-select","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-edit","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-replace","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-remove","click",FLBuilder._singlePhotoRemoved),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-select","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-edit","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-add","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-video-field .fl-video-select","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-replace","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-select","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-edit","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-add","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-icon-field .fl-icon-select","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-replace","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-remove","click",FLBuilder._removeIcon),e("body").delegate(".fl-form-field .fl-form-field-edit","click",FLBuilder._formFieldClicked),e("body").delegate(".fl-form-field-settings .fl-builder-settings-save","click",FLBuilder._saveFormFieldClicked),e("body").delegate(".fl-layout-field-option","click",FLBuilder._layoutFieldClicked),e("body").delegate(".fl-link-field-select","click",FLBuilder._linkFieldSelectClicked),e("body").delegate(".fl-link-field-search-cancel","click",FLBuilder._linkFieldSelectCancelClicked),e("body").delegate(".fl-loop-data-source-select select[name=data_source]","change",FLBuilder._loopDataSourceChange),e("body").delegate(".fl-custom-query select[name=post_type]","change",FLBuilder._customQueryPostTypeChange),e("body").delegate(".fl-field input[type=number]","focus",FLBuilder._onNumberFieldFocus),e("body").delegate(".fl-field input[type=number]","blur",FLBuilder._onNumberFieldBlur),FLBuilder.addHook("didCompleteAJAX",FLBuilder._refreshSettingsPreviewReference),FLBuilder.addHook("didRenderLayoutComplete",FLBuilder._refreshSettingsPreviewReference)},_unbindEvents:function(){e("a").off("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").off("click",FLBuilder._headerLinkClicked)},_bindOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.delegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.delegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.delegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.delegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.delegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_destroyOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.undelegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.undelegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.undelegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.undelegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.undelegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_preventDefault:function(e){e.preventDefault()},_stopPropagation:function(e){e.stopPropagation()},_headerLinkClicked:function(t){var i=e(this),l=i.attr("href");this.hash||(t.preventDefault(),FLBuilderConfig.isUserTemplate||(FLBuilder._exitUrl=l.indexOf("?")>-1?l:l+"?fl_builder",FLBuilder.triggerHook("triggerDone")))},_warnBeforeUnload:function(){var t=e(".fl-builder-row-settings").length>0,i=e(".fl-builder-col-settings").length>0,l=e(".fl-builder-module-settings").length>0;if(t||i||l)return FLBuilderStrings.unloadWarning},_initTipTips:function(){e(".fl-tip:not(.fl-has-tip)").each(function(){var t=e(this);t.addClass("fl-has-tip"),void 0==t.attr("data-title")&&t.attr("data-title",t.attr("title"))}).tipTip({defaultPosition:"top",delay:1e3})},_hideTipTips:function(){e("#tiptip_holder").stop().hide()},_submenuParentClicked:function(t){var i=e("body"),l=e(this),s=l.find(".fl-builder-submenu");l.hasClass("fl-builder-submenu-open")?(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-right")):(l.offset().left+s.width()>e(window).width()&&l.addClass("fl-builder-submenu-right"),i.addClass("fl-builder-submenu-open"),l.addClass("fl-builder-submenu-open")),s.closest(".fl-row-overlay").addClass("fl-row-menu-active"),FLBuilder._hideTipTips(),t.preventDefault(),t.stopPropagation()},_submenuChildClicked:function(t){var i=e("body"),l=e(this).parents(".fl-builder-has-submenu");l.parents(".fl-builder-has-submenu").length||(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"))},_submenuMouseenter:function(t){var i=e(this),l=i.data("timeout");"undefined"!=typeof l&&clearTimeout(l)},_submenuMouseleave:function(t){var i=e("body"),l=e(this),s=setTimeout(function(){i.removeClass("fl-builder-submenu-open"),l.closest(".fl-builder-has-submenu").removeClass("fl-builder-submenu-open")},500);l.closest(".fl-row-overlay").removeClass("fl-row-menu-active"),l.data("timeout",s)},_submenuNestedParentMouseenter:function(t){var i=e(this),l=i.find(".fl-builder-submenu");i.width()+i.offset().left+l.width()>e(window).width()&&i.addClass("fl-builder-submenu-right")},_closeAllSubmenus:function(){e(".fl-builder-submenu-open").removeClass("fl-builder-submenu-open")},_upgradeClicked:function(){window.open(FLBuilderConfig.upgradeUrl)},_buttonMouseUp:function(t){e(t.currentTarget).blur()},_closePanel:function(){FLBuilder.triggerHook("hideContentPanel")},_showPanel:function(){FLBuilder.triggerHook("showContentPanel")},_togglePanel:function(){FLBuilder.triggerHook("toggleContentPanel")},_blockSectionTitleClicked:function(){var t=e(this),i=t.parent();i.hasClass("fl-active")?i.removeClass("fl-active"):(e(".fl-builder-blocks-section").removeClass("fl-active"),i.addClass("fl-active")),FLBuilder._initScrollbars()},_publishLayout:function(e){if(FLBuilder._triggerSettingsSave(!1,!0)){if(_.isUndefined(e))var e=!0;FLBuilder.ajax({action:"save_layout"},this._onPublishComplete.bind(this,e))}},_publishButtonClicked:function(e){FLBuilder._publishLayout(e)},_onPublishComplete:function(t){t&&(FLBuilderConfig.shouldRefreshOnPublish?FLBuilder._exit():FLBuilder._exitWithoutRefresh()),e("#wp-admin-bar-fl-builder-frontend-edit-link .fl-builder-admin-bar-status-dot").css("color","#6bc373"),FLBuilder.triggerHook("didPublishLayout")},_draftButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_draft"},FLBuilder._exit)},_discardButtonClicked:function(){var e=confirm(FLBuilderStrings.discardMessage);e?(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"clear_draft_layout"},FLBuilder._exit)):FLBuilder.triggerHook("didCancelDiscard")},_cancelButtonClicked:function(){FLBuilder._exitUrl=null,FLBuilder._actionsLightbox.close()},_exit:function(){var e=window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):(FLBuilder._exitUrl?e=FLBuilder._exitUrl:(e=e.replace("?fl_builder&","?"),e=e.replace("?fl_builder",""),e=e.replace("&fl_builder","")),window.location.href=e)},_exitWithoutRefresh:function(){window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):FLBuilder.triggerHook("endEditingSession")},_duplicateLayoutClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"duplicate_post"},FLBuilder._duplicateLayoutComplete)},_duplicateLayoutComplete:function(e){var t=FLBuilderConfig.adminUrl;window.location.href=t+"post.php?post="+e+"&action=edit"},_layoutSettingsClicked:function(){FLBuilderSettingsForms.render({id:"layout",className:"fl-builder-layout-settings",settings:FLBuilderSettingsConfig.settings.layout},function(){FLBuilder._layoutSettingsInitCSS()})},_layoutSettingsInitCSS:function(){var t=e(".fl-builder-settings #fl-field-css textarea:not(.ace_text-input)");t.on("change",FLBuilder._layoutSettingsCSSChanged),FLBuilder._layoutSettingsCSSCache=t.val()},_layoutSettingsCSSChanged:function(){FLBuilder._layoutSettingsCSSTimeout&&clearTimeout(FLBuilder._layoutSettingsCSSTimeout),FLBuilder._layoutSettingsCSSTimeout=setTimeout(e.proxy(FLBuilder._layoutSettingsCSSDoChange,this),600)},_layoutSettingsCSSDoChange:function(){var t=e(".fl-builder-settings"),i=e(this),l=i.parents("#fl-field-css");l.find(".ace_error").length>0||(t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(i.val()):e("#fl-builder-global-css").html(i.val()),FLBuilder._layoutSettingsCSSTimeout=null)},_saveLayoutSettingsClicked:function(){for(var t=e(this).closest(".fl-builder-settings"),i=t.serializeArray(),l={},s=0;s<i.length;s++)l[i[s].name]=i[s].value;FLBuilder.showAjaxLoader(),FLBuilder._lightbox.close(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_layout_settings",settings:l},function(){FLBuilder.triggerHook("didSaveLayoutSettingsComplete",l),FLBuilder._updateLayout()})},_cancelLayoutSettingsClicked:function(){var t=e(".fl-builder-settings");t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(FLBuilder._layoutSettingsCSSCache):e("#fl-builder-global-css").html(FLBuilder._layoutSettingsCSSCache),FLBuilder._layoutSettingsCSSCache=null},_globalSettingsClicked:function(){FLBuilderSettingsForms.render({id:"global",className:"fl-builder-global-settings",settings:FLBuilderSettingsConfig.settings.global},function(){FLBuilder._layoutSettingsInitCSS()})},_saveGlobalSettingsClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.showAjaxLoader(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_global_settings",settings:l},FLBuilder._saveGlobalSettingsComplete),FLBuilder._lightbox.close())},_saveGlobalSettingsComplete:function(e){FLBuilderConfig.global=JSON.parse(e),FLBuilder.triggerHook("didSaveGlobalSettingsComplete",FLBuilderConfig.global),FLBuilder._updateLayout()},_initTemplateSelector:function(){var t=e(FLBuilder._contentClass).find(".fl-row"),i=t.length>0;i||FLBuilder.ContentPanel.show("modules")},_requestTemplateInsert:function(e,t){FLBuilder.layoutHasContent()?0==e?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate(0,!1,t)):(FLBuilder._selectedTemplateId=e,FLBuilder._selectedTemplateType=t,FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(e,!1,t)},_showTemplateActions:function(){var e=[];e[10]={key:"template-replace",label:FLBuilderStrings.templateReplace},e[20]={key:"template-append",label:FLBuilderStrings.templateAppend},FLBuilder._showActionsLightbox({className:"fl-builder-template-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_templateReplaceClicked:function(){confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!1,FLBuilder._selectedTemplateType))},_templateAppendClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!0,FLBuilder._selectedTemplateType)},_templateCancelClicked:function(){FLBuilder.triggerHook("showContentPanel")},_applyTemplate:function(e,t,i){t="undefined"!=typeof t&&t?"1":"0",i="undefined"==typeof i?"core":i,FLBuilder._lightbox.close(),FLBuilder.showAjaxLoader(),"core"==i?FLBuilder.ajax({action:"apply_template",template_id:e,append:t},FLBuilder._applyTemplateComplete):FLBuilder.ajax({action:"apply_user_template",template_id:e,append:t},FLBuilder._applyUserTemplateComplete),FLBuilder.triggerHook("didApplyTemplate")},_applyTemplateComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didApplyTemplateComplete",t.config)},_applyUserTemplateComplete:function(t){var i=JSON.parse(t);null!==i.layout_css&&e("#fl-builder-layout-css").html(i.layout_css),FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didApplyTemplateComplete",i.config)},_saveUserTemplateClicked:function(){FLBuilderSettingsForms.render({id:"user_template",className:"fl-builder-user-template-settings",rules:{name:{required:!0}}})},_saveUserTemplateSettings:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.ajax({action:"save_user_template",settings:l},FLBuilder._saveUserTemplateSettingsComplete),FLBuilder._lightbox.close())},_saveUserTemplateSettingsComplete:function(e){if(e){var e=JSON.parse(e);FLBuilderConfig.contentItems.template.push(e),FLBuilder.triggerHook("contentItemsChanged")}},_userTemplateClicked:function(){var t=e(this).attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?"blank"==t?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate("blank",!1,"user")):(FLBuilder._selectedTemplateId=t,FLBuilder._selectedTemplateType="user",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(t,!1,"user")},_editUserTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteUserTemplateClicked:function(t){var i=e(this).closest(".fl-user-template"),l=i.attr("data-id"),s=(e(".fl-user-template[data-id="+l+"]"),null),o=null,n=null;if(confirm(FLBuilderStrings.deleteTemplate)){FLBuilder.ajax({action:"delete_user_template",template_id:l});for(o in FLBuilderConfig.contentItems.template)n=FLBuilderConfig.contentItems.template[o],n.postId==l&&(s=o);_.isNull(s)||(FLBuilderConfig.contentItems.template.splice(s,1),FLBuilder.triggerHook("contentItemsChanged"))}t.stopPropagation()},_viewKnowledgeBaseClicked:function(){window.open(FLBuilderConfig.help.knowledge_base_url)},_visitForumsClicked:function(){window.open(FLBuilderConfig.help.forums_url)},_showTourOrTemplates:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||(FLBuilderConfig.help.tour&&FLBuilderConfig.newUser?FLBuilder._showTourLightbox():FLBuilder._initTemplateSelector())},_showTourLightbox:function(){var e=wp.template("fl-tour-lightbox");FLBuilder._actionsLightbox.open(e())},_noTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._initTemplateSelector()},_yesTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_startHelpTour:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_setupEmptyLayout:function(){var t=e(FLBuilder._contentClass);FLBuilderConfig.isUserTemplate&&"module"==FLBuilderConfig.userTemplateType||(t.removeClass("fl-builder-empty"),t.find(".fl-builder-empty-message").remove(),t.find(".fl-row, .fl-builder-block").length||(t.addClass("fl-builder-empty"),t.append('<span class="fl-builder-empty-message">'+FLBuilderStrings.emptyMessage+"</span>"),
3
  FLBuilder._initSortables()))},_updateNode:function(t,i){e(".fl-node-"+t).length&&(FLBuilder._showNodeLoading(t),FLBuilder.ajax({action:"render_node",node_id:t},function(e){FLBuilder._renderLayout(JSON.parse(e),i)}.bind(this)))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},layoutHasContent:function(){return e(FLBuilder._contentClass).children(".fl-row").length>0},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=e(FLBuilder._contentClass+" .fl-row"),l=null,s=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),o=null,n=null,r=0;for(e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),i.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),i.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');r<i.length;r++)l=i.eq(r),0===l.find(".fl-col-group").length&&l.find(".fl-row-content").prepend('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(r=0;r<s.length;r++)o=s.eq(r),n=o.find("> .fl-col"),o.hasClass("fl-col-group-nested")||(o.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),o.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),n.append('<div class="fl-drop-target fl-col-drop-target"></div>'),n.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var i=t.clone();return t.clone().insertAfter(t),i.addClass("fl-builder-block-drag-helper"),i},_blockDragInit:function(t){var i=e(t.currentTarget),l=null,s=e(window).scrollTop(),o=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=s,i.closest("[data-node]").length>0?(l=i.closest("[data-node]"),l.addClass("fl-node-drag-init")):i.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===l&&e(this).offset().top-s>0&&(l=e(this))}),null!==l&&(o=l.offset().top-s),FLBuilder._highlightRowsAndColsForDrag(i),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),o>0&&scrollTo(0,l.offset().top-o),FLBuilder.triggerHook("didInitDrag")},_blockDragStart:function(t,i){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init"),FLBuilder.triggerHook("didStartDrag")},_blockDragSort:function(t,i){var l=i.placeholder.parent(),s=FLBuilderStrings.insert;FLBuilder._blockPreventSort(i.item,l)||(l.hasClass("fl-col-content")?s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:i.item.hasClass("fl-builder-block-module")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-module")||i.item.hasClass("fl-builder-block-module-template")?i.item.find(".fl-builder-block-title").text():i.item.attr("data-name"):l.hasClass("fl-col-drop-target")?s="":l.hasClass("fl-col-group-drop-target")?s="":l.hasClass("fl-row-drop-target")&&(s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),i.placeholder.html(s),i.item.hasClass("fl-node-global")||i.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?i.placeholder.addClass("fl-builder-drop-zone-global"):i.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.css("opacity","0"),t.placeholder.animate({opacity:"1"},100)},_blockPreventSort:function(t,i){var l=!1,s=t.hasClass("fl-builder-block-row"),o=t.hasClass("fl-col-sortable-proxy-item"),n=i.hasClass("fl-col-content"),r=i.hasClass("fl-col-drop-target"),a=i.parents(".fl-col-group:not(.fl-col-group-nested)"),d=i.parents(".fl-col-group-nested");return(s||o)&&n&&d.length>0&&(l=!0),n&&!i.find(".fl-module, .fl-col").length&&(s&&"1-col"==t.data("cols")?l=!0:o&&(l=!0)),s&&n&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(l=!0),o&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(n||r&&d.length>0)&&(l=!0),r&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(l=!0),r&&d.length>0&&d.find(".fl-col:visible").length>3&&(l=!0),l&&i.addClass("fl-sortable-disabled"),l},_blockDragStop:function(t,i){var l=e(window).scrollTop(),s=i.item.parent(),o=null;s.hasClass("fl-drop-target")&&s.closest("[data-node]").length?(s=s.closest("[data-node]"),o=s.offset().top-l):o=s.offset().top-l,s.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,s.offset().top-o),FLBuilder.triggerHook("didStopDrag")},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t})},_moveNode:function(e,t,i){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:i})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips(),FLBuilder._closeAllSubmenus()},_appendOverlay:function(e,t){var i=0,l=null,s=e.hasClass("fl-row"),o=s?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),n={top:parseInt(o.css("margin-top"),10),bottom:parseInt(o.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),l=e.find("> .fl-block-overlay"),n.top<0&&(i=parseInt(l.css("top"),10),i=isNaN(i)?0:i,l.css("top",n.top+i+"px")),n.bottom<0&&(i=parseInt(l.css("bottom"),10),i=isNaN(i)?0:i,l.css("bottom",n.bottom+i+"px")),l},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),i=t.data("original"),l=0,s=null,o=0,n=null,r=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=i&&(t.after(i),t.remove(),t=i),t.data("original",t.clone()),l=Math.floor(t[0].getBoundingClientRect().width)-8,s=t.find(" > i, > span.fl-builder-has-submenu");r<s.length;r++)n=s.eq(r),o+=Math.floor(n[0].getBoundingClientRect().width),o>l?(d.push(n),n.remove()):a.push(n);if(d.length>0){for(d.unshift(a.pop().remove()),r=0;r<d.length;r++)d[r].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[r].find(".fa").data("title"),submenu:d[r].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[r].data("title"),className:d[r].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height"),e("body").removeClass("fl-builder-row-resizing"),FLBuilder._closeAllSubmenus()},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),i=t.offset().top,l=null,s=null,o=wp.template("fl-row-overlay");t.closest(".fl-builder-node-loading").length||t.hasClass("fl-block-overlay-active")||(s=FLBuilder._appendOverlay(t,o({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;l=null===l||l>t?t:l}),null!==l&&l<i&&s.css("top",l-i-30+"px"),s.offset().top<43&&s.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}),FLBuilder._buildOverlayOverflowMenu(s))},_rowMouseleave:function(t){var i=e(t.toElement)||e(t.relatedTarget),l=i.hasClass("fl-row-overlay"),s=i.closest(".fl-row-overlay").length>0,o=i.is("#tiptip_holder"),n=i.closest("#tiptip_holder").length>0;l||s||o||n||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var i=e(t.target),l=e(".fl-row-sortable-proxy-item"),s=i.closest(".fl-row");s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=l[0],l.trigger(t)},_rowDragStart:function(t,i){var l=e(FLBuilder._contentClass+" .fl-row"),s=e(".fl-node-dragging");1===l.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),s.hide(),FLBuilder._blockDragStart(t,i)},_rowDragStop:function(t,i){var l=i.item,s=l.parent(),o=null,n=null,r=0;if(FLBuilder._blockDragStop(t,i),s.hasClass("fl-builder-rows"))return void l.remove();if(s.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-col-content")?FLBuilder._addColGroup(l.closest(".fl-col").attr("data-node"),l.attr("data-cols"),s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l)):s.hasClass("fl-col-drop-target")?FLBuilder._addCols(s.closest(".fl-col"),s.hasClass("fl-col-drop-target-last")?"after":"before",l.attr("data-cols"),s.closest(".fl-col-group-nested").length>0):s.hasClass("fl-col-group-drop-target")?(n=l.closest(".fl-col-group"),r=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(n),FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)):(o=l.closest(".fl-row"),r=o.length?e(FLBuilder._contentClass+" .fl-row").index(o):0,FLBuilder._addRow(l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)),l.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else o=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s.parent().hasClass("fl-builder-content")||(s.hasClass("fl-drop-target-last")?s.parent().after(o):s.parent().before(o),FLBuilder._reorderNode(o.attr("data-node"),o.index())),e(".fl-row-sortable-proxy").append(i.item)},_addRow:function(t,i){FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),i),FLBuilder._newRowPosition=i,FLBuilder.ajax({action:"render_new_row",cols:t,position:i},FLBuilder._addRowComplete)},_addRowComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=e(FLBuilder._contentClass),s=e(i.html).data("node"),o=FLBuilder._addModuleAfterNodeRender;i.nodeParent=l,i.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(i,function(){null!==o&&(e(".fl-node-"+s+" .fl-col-content").append(o),FLBuilder._reorderModule(o),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddRow",s)})},_deleteRowClicked:function(t){var i=e(this).closest(".fl-row"),l=null;i.find(".fl-module").length?(l=confirm(FLBuilderStrings.deleteRowMessage),l&&FLBuilder._deleteRow(i)):FLBuilder._deleteRow(i),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){var t=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:t}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays(),FLBuilder.triggerHook("didDeleteRow",t)},_rowCopyClicked:function(t){var i=e(this).closest(".fl-row"),l=i.attr("data-node"),s=e(FLBuilder._contentClass+" .fl-row").index(i)+1,o=i.clone(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newRowPosition=s,FLBuilder.ajax({action:"copy_row",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedRow=l,FLBuilder._rowCopyComplete(t)}),t.stopPropagation()},_rowCopyComplete:function(t){t.nodeParent=e(FLBuilder._contentClass),t.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(t,function(){FLBuilder.triggerHook("didDuplicateRow",{newNodeId:t.nodeId,oldNodeId:t.duplicatedRow}),t.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_rowSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-row").attr("data-node"),s=i.closest(".fl-block-overlay-global").length>0,o=null;s&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&(o=window.open(e('.fl-row[data-node="'+l+'"]').attr("data-template-url")),o.FLBuilderGlobalNodeId=l):i.hasClass("fl-block-settings")&&FLBuilderSettingsForms.render({id:"row",nodeId:l,className:"fl-builder-row-settings",attrs:'data-node="'+l+'"',buttons:s||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:s?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[l],preview:{type:"row"}},function(){e("#fl-field-width select").on("change",FLBuilder._rowWidthChanged),e("#fl-field-content_width select").on("change",FLBuilder._rowWidthChanged)}),t.stopPropagation()},_rowWidthChanged:function(){var t=e("#fl-field-width select").val(),i=e("#fl-field-content_width select").val(),l=e("#fl-field-max_content_width");"fixed"==t||"full"==t&&"fixed"==i?l.show():l.hide()},_resetRowWidthClicked:function(t){var i=e(this),l=i.closest(".fl-row"),s=l.attr("data-node"),o=l.find(".fl-row-content"),n=FLBuilderConfig.global.row_width+"px",r=e(".fl-builder-row-settings");l.hasClass("fl-row-fixed-width")&&l.css("max-width",n),o.css("max-width",n),r.length&&r.find("[name=max_content_width]").val(""),FLBuilder.ajax({action:"resize_row_content",node:s,width:""}),FLBuilder._closeAllSubmenus(),FLBuilder.triggerHook("didResetRowWidth",s),t.stopPropagation()},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),i.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),i.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_removeEmptyColHighlights:function(){e(".fl-row-highlight").removeClass("fl-row-highlight"),e(".fl-col-highlight").removeClass("fl-col-highlight")},_highlightRowsAndColsForDrag:function(t){var i="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+i).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",i=e(FLBuilder._contentClass),l=i.find(t+".fl-col-group:not(.fl-col-group-nested) > .fl-col > .fl-col-content"),s=i.find(t+".fl-col-group-nested .fl-col-content"),o=0;for(e(".fl-node-drag-init").hide();o<s.length;o++)FLBuilder._adjustColHeightForDrag(s.eq(o));for(o=0;o<l.length;o++)FLBuilder._adjustColHeightForDrag(l.eq(o));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),i=t.find("a"),l=t.closest(".fl-col"),s=l.parents(".fl-col"),o=e('<div class="fl-col-highlight-guide"></div>'),n=null,r=t.closest(".fl-block-overlay").offset().top;(i.hasClass("fl-block-col-move-parent")||i.hasClass("fl-block-col-edit-parent"))&&(l=s),l.hasClass("fl-col-highlight")||(l.find("> .fl-col-content").append(o),l.addClass("fl-col-has-highlight-guide"),n=o.offset().top,n>r&&o.css("top",r-n+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),i=t.closest(".fl-col-group"),l=i.hasClass("fl-col-group-has-child-loading"),s=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,n=t.closest(".fl-col-group").find("> .fl-col").length,r=i.find("> .fl-col").index(t),a=0===r,d=n===r+1,u=t.find(".fl-col").length>0,c=t.parents(".fl-col"),h=c.closest(".fl-col-group"),f=c.length>0,g=f?h.find("> .fl-col").length:0,p=h.find("> .fl-col").index(c),b=!!f&&0===p,m=!!f&&g===p+1,v=t.find("> .fl-col-content").width(),_=t.closest(".fl-row"),L=!!_.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,w=FLBuilderConfig.rowResize.userCanResizeRows,C=wp.template("fl-col-overlay"),F=null;FLBuilderConfig.simpleUi||s&&o&&"row"!=FLBuilderConfig.userTemplateType||t.find(".fl-module, .fl-builder-node-loading-placeholder").length>0||t.find(".fl-col").length>0||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),F=FLBuilder._appendOverlay(t,C({global:s,groupLoading:l,numCols:n,first:a,last:d,hasChildCols:u,hasParentCol:f,parentFirst:b,parentLast:m,numParentCols:g,contentWidth:v,rowIsFixedWidth:L,userCanResizeRows:w})),FLBuilder._buildOverlayOverflowMenu(F),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var i=e(this),l=e(t.toElement)||e(t.relatedTarget),s=i.find(".fl-module").length>0,o=l.is("#tiptip_holder"),n=l.closest("#tiptip_holder").length>0;o||n||s||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._closeAllSubmenus())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var i=e(t.target),l=e(".fl-col-sortable-proxy-item"),s=i.closest(".fl-col");i.hasClass("fl-block-col-move-parent")&&(s=s.parents(".fl-col")),s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=l[0],l.trigger(t)},_colDragStart:function(t,i){var l=e(".fl-node-dragging");l.hide(),FLBuilder._resetColumnWidths(l.parent()),FLBuilder._blockDragStart(t,i)},_colDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s=l.attr("data-node"),o=i.item.parent(),n=l.parent(),r=n.attr("data-node");newGroup=o.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=o.closest(".fl-row"),position=0,o.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-content")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=o.find("> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(i.item),FLBuilder._addColGroup(o.closest(".fl-col").attr("data-node"),s,position)):o.hasClass("fl-col-drop-target")?(o.hasClass("fl-col-drop-target-last")?o.parent().after(l):o.parent().before(l),FLBuilder._resetColumnWidths(newGroup),r==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:s,position:l.index()}):FLBuilder.ajax({action:"move_col",node_id:s,new_parent:newGroupId,position:l.index(),resize:[r,newGroupId]}),FLBuilder._resizeLayout()):o.hasClass("fl-col-group-drop-target")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),s,position)):o.hasClass("fl-row-drop-target")&&(l.remove(),position=o.closest(".fl-builder-content").find(".fl-row").index(newRow),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(s,position)),0===n.find(".fl-col").length&&n.remove(),e(".fl-col-sortable-proxy").append(i.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._closeAllSubmenus()},_colSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.find("> .fl-col-content"),o=i.closest(".fl-block-overlay-global").length>0,n=null;FLBuilder._colResizing||(i.hasClass("fl-block-col-edit-parent")&&(l=l.parents(".fl-col")),n=l.attr("data-node"),FLBuilderSettingsForms.render({id:"col",nodeId:n,className:"fl-builder-col-settings",attrs:'data-node="'+n+'"',badges:o?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[n],preview:{type:"col"}},function(){0===l.siblings(".fl-col").length?e("#fl-builder-settings-section-general").hide():s.width()<=40&&e("#fl-field-size").hide()}),t.stopPropagation())},_copyColClicked:function(t){var i=e(this).closest(".fl-col"),l=i.attr("data-node"),s=i.clone(),o=i.parent(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newColParent=o,FLBuilder._newColPosition=i.index()+1,FLBuilder._resetColumnWidths(o),FLBuilder.ajax({action:"copy_col",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedColumn=l,FLBuilder._copyColComplete(t)}),t.stopPropagation()},_copyColComplete:function(e){e.nodeParent=FLBuilder._newColParent,e.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateColumn",{newNodeId:e.nodeId,oldNodeId:e.duplicatedColumn}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_deleteColClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.closest(".fl-col-group"),o=l.parents(".fl-col"),n=o.length>0,r=o.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=l.siblings(".fl-col"),d=!0;l.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),n&&1===r.length&&(0===a.length?l=o:1!==a.length||a.find(".fl-module").length||(l=s)),d&&(FLBuilder._deleteCol(l),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.attr("data-node"),i=e.closest(".fl-row"),l=e.closest(".fl-col-group"),s=0;e.remove(),rowCols=i.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(i):(0===groupCols.length?l.remove():(s=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",s+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:groupCols})),FLBuilder.ajax({action:"delete_col",node_id:t,new_width:s}),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder.triggerHook("didDeleteColumn",t))},_addCols:function(e,t,i,l){var s=e.closest(".fl-col-group"),o=s.find(".fl-col").index(e);i="undefined"==typeof i?"1-col":i,l="undefined"!=typeof l&&l,"after"==t&&o++,FLBuilder._showNodeLoadingPlaceholder(s,o),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:i,nested:l?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var i=JSON.parse(t),l=null,s=FLBuilder._addModuleAfterNodeRender;FLBuilder._renderLayout(i,function(){null!==s&&(e('.fl-module[data-node="'+s.module.data("node")+'"]').remove(),l=e('.fl-col[data-node="'+s.colId+'"]'),"after"==s.position?l.next().find(".fl-col-content").append(s.module):l.prev().find(".fl-col-content").append(s.module),FLBuilder._reorderModule(s.module),FLBuilder._addModuleAfterNodeRender=null),FLBuilder.triggerHook("didAddColumn",i.nodeId),FLBuilder.triggerHook("didResetColumnWidths",{cols:e(".fl-node-"+i.nodeId).find("> .fl-col")})})},_addColGroup:function(t,i,l){var s=e(".fl-node-"+t);FLBuilder._newColGroupPosition=l,s.hasClass("fl-col")?FLBuilder._newColGroupParent=s.find(" > .fl-col-content"):FLBuilder._newColGroupParent=s.find(".fl-row-content"),FLBuilder._showNodeLoadingPlaceholder(FLBuilder._newColGroupParent,l),FLBuilder.ajax({action:"render_new_column_group",cols:i,node_id:t,position:l},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var i=JSON.parse(t),l=e(i.html),s=l.data("node"),o=l.find(".fl-col").data("node"),n=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColGroupParent,i.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(i,function(){i.nodeParent.hasClass("fl-col-content")&&i.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==n&&(e(".fl-node-"+o+" .fl-col-content").append(n),FLBuilder._reorderModule(n),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddColumnGroup",s)})},_initColDragResizing:function(){e(".fl-block-col-resize").not(".fl-block-row-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,i){var l=e(i.helper),s="",o=l.hasClass("fl-block-col-resize-parent"),n=o?l.closest(".fl-col").parents(".fl-col"):null,r=o?n.parents(".fl-col-group"):l.closest(".fl-col-group"),a=r.find("> .fl-col"),d=o?n:l.closest(".fl-col"),u=d.attr("data-node"),c=e("[data-node="+u+"] #fl-field-size input"),h=null,f=null,g=null,p=100,b=0,m=null,v=null;for(l.hasClass("fl-block-col-resize-e")?(s="e",h=d.nextAll(".fl-col").first()):(s="w",h=d.prevAll(".fl-col").first()),f=h.attr("data-node"),g=e("[data-node="+f+"] #fl-field-size input");b<a.length;b++)a.eq(b).data("node")!=d.data("node")&&a.eq(b).data("node")!=h.data("node")&&(p-=parseFloat(a.eq(b)[0].style.width));c.length?(m=c,v="col"):g.length&&(m=g,v="sibling"),FLBuilder._colResizeData={handle:l,feedbackLeft:l.find(".fl-block-col-resize-feedback-left"),feedbackRight:l.find(".fl-block-col-resize-feedback-right"),direction:s,groupWidth:r.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:h,offset:i.position.left,availWidth:p,setting:m,settingType:v},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var i=FLBuilder._colResizeData,l=FLBuilderConfig.isRtl?"w":"e",s=i.handle.closest(".fl-block-overlay"),o=(i.offset-t.position.left)/i.groupWidth,n=l==i.direction?100*(i.colWidth-o):100*(i.colWidth+o),r=Math.round(100*n)/100,a=i.availWidth-n,d=Math.round(100*a)/100,u=8,c=Math.round(100*(i.availWidth-u))/100;r<u?(r=u,d=c):d<u&&(r=c,d=u),l==i.direction?(i.feedbackLeft.html(r.toFixed(1)+"%").show(),i.feedbackRight.html(d.toFixed(1)+"%").show()):(i.feedbackLeft.html(d.toFixed(1)+"%").show(),i.feedbackRight.html(r.toFixed(1)+"%").show()),i.col.css("width",r+"%"),i.sibling.css("width",d+"%"),i.setting&&("col"===i.settingType?i.setting.val(parseFloat(i.col[0].style.width)):"sibling"===i.settingType&&i.setting.val(parseFloat(i.sibling[0].style.width))),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,i){var l=FLBuilder._colResizeData,s=FLBuilder._colResizeData.handle.closest(".fl-block-overlay"),o=l.col.data("node"),n=parseFloat(l.col[0].style.width),r=l.sibling.data("node"),a=parseFloat(l.sibling[0].style.width);FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:o,col_width:n,sibling_id:r,sibling_width:a}),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop"),FLBuilder.triggerHook("didResizeColumn",{colId:o,colWidth:n,siblingId:r,siblingWidth:a})},_resetColumnWidthsClicked:function(t){var i=e(this),l=!!i.closest(".fl-row-overlay").length,s=null,o=null,n=[],r=null,a=0,d=e(".fl-builder-col-settings"),u=null;o=l?i.closest(".fl-row").find(".fl-row-content > .fl-col-group"):i.parents(".fl-col-group").last(),o.each(function(){for(s=e(this),r=s.find(".fl-col-group"),n.push(s.data("node")),FLBuilder._resetColumnWidths(s),a=0;a<r.length;a++)FLBuilder._resetColumnWidths(r.eq(a)),n.push(r.eq(a).data("node"))}),d.length&&(u=e(".fl-node-"+d.attr("data-node")),d.find("#fl-field-size input").val(parseFloat(u[0].style.width))),FLBuilder.ajax({action:"reset_col_widths",group_id:n}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),i=0;i=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",i+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:t})},_moduleMouseenter:function(){var t=e(this),i=t.attr("data-name"),l=t.hasClass("fl-node-global"),s=t.parents(".fl-node-global").length>0,o=t.parents(".fl-col-group").last(),n=o.hasClass("fl-col-group-has-child-loading"),r=t.closest(".fl-col-group").find("> .fl-col").length,a=t.closest(".fl-col"),d=0===a.index(),u=r===a.index()+1,c=a.parents(".fl-col"),h=c.length>0,f=h?c.closest(".fl-col-group").find("> .fl-col").length:0,g=!!h&&0===c.index(),p=!!h&&f===c.index()+1,b=a.find("> .fl-col-content").width(),m=t.closest(".fl-row"),v=!!m.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,_=FLBuilderConfig.rowResize.userCanResizeRows,L=wp.template("fl-module-overlay"),w=null;FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),l&&s&&"row"!=FLBuilderConfig.userTemplateType||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(w=FLBuilder._appendOverlay(t,L({global:l,moduleName:i,groupLoading:n,numCols:r,colFirst:d,colLast:u,hasParentCol:h,numParentCols:f,parentFirst:g,parentLast:p,contentWidth:b,rowIsFixedWidth:v,userCanResizeRows:_})),FLBuilder._buildOverlayOverflowMenu(w),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var i=(e(this),e(t.toElement)||e(t.relatedTarget)),l=i.is("#tiptip_holder"),s=i.closest("#tiptip_holder").length>0;l||s||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),
4
- e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_moduleDragHelper:function(t,i){return e('<div class="fl-builder-block-drag-helper">'+i.attr("data-name")+"</div>")},_moduleDragStart:function(t,i){e(i.item).data("original-position",i.item.index()),FLBuilder._blockDragStart(t,i)},_moduleDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=0;if(s.hasClass("fl-builder-modules")||s.hasClass("fl-builder-widgets"))return void l.remove();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),r=0,o=l.closest(".fl-row"),n=s.find(".fl-row").index(o)):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),r=s.closest(".fl-row").attr("data-node"),o=l.closest(".fl-col-group"),n=s.find(" > .fl-col-group").index(o)):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),r=s.attr("data-node"),o=l.closest(".fl-col"),n=s.find(" > .fl-col").index(o)):(n=s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l),r=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),FLBuilder._addModule(s,r,l.attr("data-type"),n,l.attr("data-widget"),l.attr("data-alias")),l.remove()}else{if(s.hasClass("fl-sortable-disabled"))return e(t.target).append(i.item),e(t.target).children().eq(i.item.data("original-position")).before(i.item),void FLBuilder._highlightEmptyCols();s.hasClass("fl-row-drop-target")?(o=l.closest(".fl-row"),n=l.closest(".fl-builder-content").children(".fl-row").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addRow("1-col",n),l.remove()):s.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-col-group"),n=l.closest(".fl-row-content ").find(" > .fl-col-group").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),"1-col",n),l.remove()):s.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col"),n=l.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:l,colId:o.data("node"),position:n},FLBuilder._addCols(o,n,"1-col",l.closest(".fl-col-group-nested").length>0),l.remove()):FLBuilder._reorderModule(l)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),i=e.attr("data-parent"),l=e.attr("data-node"),s=e.index();t==i?FLBuilder._reorderNode(l,s):(e.attr("data-parent",t),FLBuilder._moveNode(t,l,s))},_deleteModuleClicked:function(t){var i=e(this).closest(".fl-module"),l=confirm(FLBuilderStrings.deleteModuleMessage);l&&(FLBuilder._deleteModule(i),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row"),i=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:i}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays(),FLBuilder.triggerHook("didDeleteModule",i)},_moduleCopyClicked:function(t){var i=e(this).closest(".fl-module"),l=i.attr("data-node"),s=i.index()+1,o=i.clone(),n=e(".fl-builder-module-settings[data-node="+l+"]"),r=null;n.length&&(r=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[l]=r),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newModuleParent=i.parent(),FLBuilder._newModulePosition=s,FLBuilder.ajax({action:"copy_module",node_id:l,settings:r},function(e){var t=JSON.parse(e);t.duplicatedModule=l,FLBuilder._moduleCopyComplete(t)}),t.stopPropagation()},_moduleCopyComplete:function(e){e.nodeParent=FLBuilder._newModuleParent,e.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateModule",{newNodeId:e.nodeId,oldNodeId:e.duplicatedModule}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_moduleSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-module").attr("data-type"),s=i.closest(".fl-module").attr("data-node"),o=i.closest(".fl-col").attr("data-node"),n=i.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings({type:l,nodeId:s,parentId:o,global:n})},_showModuleSettings:function(t,i){var l=FLBuilderSettingsConfig.modules[t.type],s=t.settings?t.settings:FLBuilderSettingsConfig.nodes[t.nodeId],o=e("head");-1===e.inArray(t.type,FLBuilder._loadedModuleAssets)&&(""!==l.assets.css&&o.append(l.assets.css),""!==l.assets.js&&o.append(l.assets.js),FLBuilder._loadedModuleAssets.push(t.type)),FLBuilderSettingsForms.render({type:"module",id:t.type,nodeId:t.nodeId,className:"fl-builder-module-settings fl-builder-"+t.type+"-settings",attrs:'data-node="'+t.nodeId+'" data-parent="'+t.parentId+'" data-type="'+t.type+'"',buttons:t.global||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:t.global?[FLBuilderStrings.global]:[],settings:s,legacy:t.legacy,helper:FLBuilder._moduleHelpers[t.type],rules:FLBuilder._moduleHelpers[t.type]?FLBuilder._moduleHelpers[t.type].rules:null,preview:{type:"module",layout:t.layout,callback:function(){FLBuilder.triggerHook("didAddModule",t.nodeId)}}},i)},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.attr("data-type"),l=(t.attr("data-node"),FLBuilder._moduleHelpers[i]),s=!0;"undefined"!=typeof l&&(t.find("label.error").remove(),t.validate().hideErrors(),s=t.validate().form(),s&&(s=l.submit())),s?FLBuilder._saveSettings():FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,i,l,s,o){FLBuilder._showNodeLoadingPlaceholder(e,l),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=l),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:i,position:l,node_preview:1,widget:"undefined"==typeof s?"":s,alias:"undefined"==typeof o?"":o},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){var i=JSON.parse(t);i.layout&&(i.layout.nodeParent=FLBuilder._newModuleParent,i.layout.nodePosition=FLBuilder._newModulePosition),e("form.fl-builder-settings").length?i.layout&&FLBuilder._renderLayout(i.layout):FLBuilder._showModuleSettings(i,function(){e(".fl-builder-module-settings").data("new-module","1")})},registerModuleHelper:function(t,i){var l={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},l,i)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.attr("data-node"),s=FLBuilderStrings.saveModule;return i.hasClass("fl-builder-row-settings")&&(s=FLBuilderStrings.saveRow),!!FLBuilder._triggerSettingsSave(!1,!1,!1)&&void FLBuilderSettingsForms.render({id:"node_template",nodeId:l,title:s,attrs:'data-node="'+l+'"',className:"fl-builder-node-template-settings",rules:{name:{required:!0}}},function(){FLBuilderConfig.userCanEditGlobalTemplates||e("#fl-field-global").hide()})},_saveNodeTemplate:function(){var t=e(".fl-builder-node-template-settings"),i=t.attr("data-node"),l=t.validate().form();l&&(FLBuilder._showNodeLoading(i),FLBuilder.ajax({action:"save_node_template",node_id:i,settings:FLBuilder._getSettings(t)},function(e){FLBuilder._saveNodeTemplateComplete(e),FLBuilder._hideNodeLoading(i)}),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var i=JSON.parse(t),l=e(".fl-builder-saved-"+i.type+"s"),s=l.find(".fl-builder-block"),o=null,n="",r=i.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block"),u={name:i.name,isGlobal:i.global,content:i.type,id:i.id,postID:i.postID,kind:"template",type:"user",link:i.link,category:{uncategorized:FLBuilderStrings.uncategorized}};if(FLBuilderConfig.contentItems.template.push(u),FLBuilder.triggerHook("contentItemsChanged"),i.layout&&(FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didSaveGlobalNodeTemplate",i.config)),0===s.length)l.append(d(i));else for(;a<s.length;a++){if(o=s.eq(a),n=o.text().toLowerCase().trim(),0===a&&r<n){l.prepend(d(i));break}if(r<n){o.before(d(i));break}if(s.length-1===a){l.append(d(i));break}}l.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=null,a="",d=null;if(s.hasClass("fl-builder-blocks-section-content"))return void l.remove();if(l.hasClass("fl-builder-block-saved-row")||l.hasClass("fl-builder-block-row-template"))r=l.closest(".fl-row"),n=r.length?e(FLBuilder._contentClass+" .fl-row").index(r):0,n=s.hasClass("fl-drop-target-last")?n+1:n,o=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=n,FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),n);else if(l.hasClass("fl-builder-block-saved-module")||l.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),o=0,n=s.find(".fl-row").index(l.closest(".fl-row"))):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),o=s.closest(".fl-row").attr("data-node"),n=s.find(" > .fl-col-group").index(l.closest(".fl-col-group"))):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),n=s.children(".fl-col").index(l.closest(".fl-col")),o=s.attr("data-node")):(n=s.children(".fl-module, .fl-builder-block").index(l),o=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),s.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=s,FLBuilder._newModulePosition=n),FLBuilder._showNodeLoadingPlaceholder(s,n)}FLBuilder.ajax({action:a,template_id:l.attr("data-id"),template_type:l.attr("data-type"),parent_id:o,position:n},function(e){if(a.indexOf("row")>-1){var t=JSON.parse(e);FLBuilder.triggerHook("didApplyRowTemplateComplete",t.config),d(t.layout)}else d(e)}),l.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var i=e(t.target),l=i.closest(".fl-builder-blocks-section"),s=l.find(".fl-builder-blocks-section-content"),o=s.find(".fl-builder-block"),n=i.closest(".fl-builder-block"),r=n.hasClass("fl-builder-block-global"),a=r?FLBuilder._updateLayout:void 0,d=r?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate,u=null;confirm(d)&&(n.remove(),1===o.length&&(n.hasClass("fl-builder-block-saved-row")?s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),n.hasClass("fl-builder-block-global")&&FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"delete_node_template",template_id:n.attr("data-id")},a),u=_.findIndex(FLBuilderConfig.contentItems.template,{id:n.attr("data-id"),type:"user"}),FLBuilderConfig.contentItems.template.splice(u,1),FLBuilder.triggerHook("contentItemsChanged"))},_initSettingsForms:function(){FLBuilder._initCodeFields(),FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initEditorFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder._initOrderingFields(),FLBuilder._initTimezoneFields(),FLBuilder._focusFirstSettingsControl(),FLBuilder._lightbox._resizeEditors(),e(".fl-builder-settings-fields").css("visibility","visible"),FLBuilder.triggerHook("settings-form-init")},_destroySettingsForms:function(){FLBuilder._destroyEditorFields()},_setSettingsFormContent:function(t){e(".fl-legacy-settings").remove(),e("body").append(t)},_settingsTabClicked:function(t){var i=e(this),l=i.closest(".fl-builder-settings"),s=i.attr("href").split("#").pop();FLBuilder._resetSettingsTabsState(),l.find(".fl-builder-settings-tab").removeClass("fl-active"),l.find("#"+s).addClass("fl-active"),l.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),l.find("a[href*="+s+"]").addClass("fl-active"),FLBuilder._focusFirstSettingsControl(),t.preventDefault()},_resetSettingsTabsState:function(){var t=e(".fl-lightbox:visible");FLBuilder._hideTabsOverflowMenu(),t.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),t.find(".fl-builder-settings-tabs-overflow-menu .fl-active").removeClass("fl-active"),t.find(".fl-contains-active").removeClass("fl-contains-active")},_calculateSettingsTabsOverflow:function(){var t=e(".fl-lightbox:visible"),i=t.outerWidth(),l=t.hasClass("fl-lightbox-width-slim"),s=t.find(".fl-builder-settings-tabs"),o=t.find(".fl-builder-settings-tabs-overflow-menu"),n=t.find(".fl-builder-settings-tabs-more"),r=s.find("a"),a=!1,d=i-60,u=0,c=l?16:30;o.html(""),FLBuilder._hideTabsOverflowMenu(),r.removeClass("fl-overflowed"),r.each(function(){if(!e(this).is(":visible"))return!0;if(!a){var t=e(this).textWidth()+c+12;u+=t,u>=d&&(a=!0)}if(a){var i=e(this).html(),l=e(this).attr("href"),s="";e(this).hasClass("fl-active")&&(s="fl-active"),e(this).hasClass("error")&&(s+=" error"),""!==s&&(s='class="'+s+'"');var n=e('<a href="'+l+'" '+s+">"+i+"</a>");o.append(n),e(this).addClass("fl-overflowed")}else e(this).removeClass("fl-overflowed")}),a?t.addClass("fl-lightbox-has-tab-overflow"):t.removeClass("fl-lightbox-has-tab-overflow"),o.find(".fl-active").length>0?n.addClass("fl-contains-active"):n.removeClass("fl-contains-active"),o.find(".error").length>0?n.addClass("fl-contains-errors"):n.removeClass("fl-contains-errors")},_settingsTabsToOverflowMenuItemClicked:function(t){var i=e(t.currentTarget),l=i.attr("href"),s=i.closest(".fl-lightbox-header-wrap").find(".fl-builder-settings-tabs"),o=s.find('a[href="'+l+'"]'),n=s.find(".fl-builder-settings-tabs-more");FLBuilder._resetSettingsTabsState(),o.trigger("click"),i.addClass("fl-active"),n.addClass("fl-contains-active"),FLBuilder._hideTabsOverflowMenu(),t.preventDefault()},_hasOverflowTabs:function(){var t=e(".fl-lightbox:visible"),i=t.find(".fl-builder-settings-tabs-overflow-menu a");return i.length>0},_showTabsOverflowMenu:function(){if(FLBuilder._hasOverflowTabs()){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","flex"),t.find(".fl-builder-settings-tabs-overflow-click-mask").show(),this.isShowingSettingsTabsOverflowMenu=!0}},_hideTabsOverflowMenu:function(){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","none"),t.find(".fl-builder-settings-tabs-overflow-click-mask").hide(),this.isShowingSettingsTabsOverflowMenu=!1},_toggleTabsOverflowMenu:function(e){FLBuilder.isShowingSettingsTabsOverflowMenu?FLBuilder._hideTabsOverflowMenu():FLBuilder._showTabsOverflowMenu(),e.stopPropagation()},_settingsCancelClicked:function(t){var i=e(".fl-builder-lightbox[data-parent]"),l=e(".fl-builder-module-settings"),s=null,o=null,n=null,r=null;return i.length>0?void FLBuilder._closeNestedSettings():(l.length>0&&"undefined"!=typeof l.data("new-module")?(s=e(FLBuilder.preview.state.html),o=e(".fl-node-"+l.data("node")),n=o.closest(".fl-col"),r=s.find(".fl-node-"+n.data("node")),r.length>0?FLBuilder._deleteModule(o):FLBuilder._deleteCol(n)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,void FLLightbox.closeParent(this))},_focusFirstSettingsControl:function(){var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab.fl-active"),l=i.find(".fl-field").first(),s=l.find('input:not([type="hidden"]), textarea, select, button, a, .fl-editor-field').first();if("undefined"!=typeof tinyMCE&&s.hasClass("fl-editor-field")){var o=s.find("textarea.wp-editor-area").attr("id");tinyMCE.get(o).focus()}else setTimeout(function(){s.focus().css("animation-name","fl-grab-attention")},300);l.css("animation-name","fl-grab-attention"),l.on("animationend",function(){l.css("animation-name","")})},_initSettingsValidation:function(t,i){var l=e(".fl-builder-settings").last();l.validate({ignore:".fl-ignore-validation",rules:t,messages:i,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab"),l=null,s=null,o=0;o<i.length;o++)l=i.eq(o),s=l.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+l.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),s.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"));FLBuilder._calculateSettingsTabsOverflow()},_getSettings:function(t){FLBuilder._updateEditorFields();var i=t.serializeArray(),l=0,s=0,o="",n="",r="",a=[],d=[],u={};for(l=0;l<i.length;l++)if(o=i[l].value.replace(/\r/gm,""),!(i[l].name.indexOf("flrich")>-1))if(i[l].name.indexOf("[")>-1){for(n=i[l].name.replace(/\[(.*)\]/,""),r=i[l].name.replace(n,""),a=[],d=r.match(/\[[^\]]*\]/g),s=0;s<d.length;s++)"[]"!=d[s]&&a.push(d[s].replace(/\[|\]/g,""));r.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]={}),"undefined"==typeof u[n][a[0]][a[1]]&&(u[n][a[0]][a[1]]={}),u[n][a[0]][a[1]]=o):r.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]=[]),u[n][a[0]].push(o)):r.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[n]&&(u[n]={}),u[n][a[0]]=o):r.match(/\[\]/)&&("undefined"==typeof u[n]&&(u[n]=[]),u[n].push(o))}else u[i[l].name]=o;for(r in u)if("undefined"!=typeof u["as_values_"+r]){u[r]=e.grep(u["as_values_"+r].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+r]}catch(c){}}return e.each(t.find("[name]"),function(t,i){var l=e(i).attr("name").replace(/\[(.*)\]/,"");l in u||(u[l]="")}),u=e.extend({},FLBuilder._getOriginalSettings(t),u)},_getSettingsJSONForHTML:function(e){return JSON.stringify(e).replace(/\'/g,"&#39;").replace("<wbr />","<wbr>")},_getOriginalSettings:function(t,i){var l=t.find(".fl-builder-settings-json"),s=t.data("node"),o=FLBuilderSettingsConfig.nodes,n=null,r={};if(s&&o[s]?n=o[s]:l.length&&(n=JSON.parse(l.val().replace(/&#39;/g,"'"))),n)for(key in n)(e("#fl-field-"+key).length||i)&&(r[key]=n[key]);return r},_saveSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.data("new-module"),s=i.attr("data-node"),o=FLBuilder._getSettings(i),n=FLBuilder.preview;return!_.isUndefined(t)&&_.isBoolean(t)||(t=!0),n&&!n._settingsHaveChanged()&&_.isUndefined(l)?void FLBuilder._lightbox.close():(FLBuilder._showNodeLoading(s),FLBuilderSettingsConfig.nodes[s]=o,FLBuilder.ajax({action:"save_settings",node_id:s,settings:o},FLBuilder._saveSettingsComplete.bind(this,t,n)),FLBuilder.triggerHook("didSaveNodeSettings",{nodeId:s,settings:o}),void FLBuilder._lightbox.close())},_saveSettingsComplete:function(e,t,i){var l=JSON.parse(i),s=function(){t&&l.layout.partial&&l.layout.nodeId===t.nodeId&&(t.clear(),t=null)};!0===e?FLBuilder._renderLayout(l.layout,s):s(),FLBuilder.triggerHook("didSaveNodeSettingsComplete",{nodeId:l.node_id,settings:l.settings})},_triggerSettingsSave:function(t,i,l){var s=FLBuilder._lightbox._node.find("form.fl-builder-settings"),o=FLBuilder._lightbox._node.data("instance-id"),n=FLLightbox._instances[o],r=e(".fl-lightbox-wrap[data-parent]:visible"),a=!1,d=!0;return t=!_.isUndefined(t)&&t,i=!_.isUndefined(i)&&i,l=!!_.isUndefined(l)||l,s.length&&(r.length&&(r.find(".fl-builder-settings-save").trigger("click"),(r.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),d&&!s.validate().form()&&(d=!1),a=FLBuilderSettingsForms.settingsHaveChanged(),d&&a&&(t&&n.disableClose(),s.find(".fl-builder-settings-save").trigger("click"),t&&n.enableClose(),(s.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),l&&(FLBuilder._destroySettingsForms(),!a&&FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)),a||t||n.close()),d||(FLBuilder.triggerHook("didFailSettingsSave"),FLBuilder._toggleSettingsTabErrors(),i&&!e(".fl-builder-alert-lightbox:visible").length&&FLBuilder.alert(FLBuilderStrings.settingsHaveErrors)),d},_refreshSettingsPreviewReference:function(){FLBuilder.preview&&FLBuilder.preview._initElementsAndClasses()},_openNestedSettings:function(t){t.className&&-1===t.className.indexOf("fl-builder-settings-lightbox")&&(t.className+=" fl-builder-settings-lightbox"),t=e.extend({className:"fl-builder-lightbox fl-builder-settings-lightbox",destroyOnClose:!0,resizable:!0},t);var i=e(".fl-lightbox-wrap:visible"),l=i.find(".fl-lightbox"),s=new FLLightbox(t),o=s._node,n=o.find(".fl-lightbox");return i.hide(),o.attr("data-parent",i.attr("data-instance-id")),n.attr("style",l.attr("style")),s.on("resized",FLBuilder._calculateSettingsTabsOverflow),s.open('<div class="fl-builder-lightbox-loading"></div>'),s},_closeNestedSettings:function(){var t=e(".fl-builder-lightbox[data-parent]:visible"),i=t.find(".fl-lightbox"),l=t.attr("data-instance-id"),s=FLLightbox._instances[l],o=t.attr("data-parent"),n=e('[data-instance-id="'+o+'"]'),r=n.find(".fl-lightbox"),a=n.find("form"),d=FLLightbox._instances[o];s.on("close",function(){r.attr("style",i.attr("style")),n.show(),d._resize(),n.find("label.error").remove(),a.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors()}),s.close()},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){var t=e(".fl-builder-settings:visible .fl-suggest-field"),i=null,l=null,s=null,o=[];t.each(function(){i=e(this),""!==i.attr("data-value")&&(FLBuilderSettingsForms.showFieldLoader(i),o.push({name:i.attr("name"),value:i.attr("data-value"),action:i.attr("data-action"),data:i.attr("data-action-data")}))}),o.length?FLBuilder.ajax({action:"get_autosuggest_values",fields:o},function(i){l=JSON.parse(i);for(s in l)e('.fl-suggest-field[name="'+s+'"]').attr("data-value",l[s]);t.each(FLBuilder._initAutoSuggestField)}):t.each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args"))),FLBuilderSettingsForms.hideFieldLoader(t)},_updateAutoSuggestField:function(t,i,l){e(this).siblings(".as-values").val(l.join(",")).trigger("change")},_initCodeFields:function(){e(".fl-builder-settings:visible").find(".fl-code-field").each(FLBuilder._initCodeField)},_initCodeField:function(){var t=e(this),i=t.find("textarea"),l=(i.attr("id"),i.data("editor")),s=i.data("wrap"),o=e("<div>",{position:"absolute",height:20*parseInt(i.attr("rows"),10)}),n=null;o.insertBefore(i),i.css("display","none"),ace.require("ace/ext/language_tools"),n=ace.edit(o[0]),n.$blockScrolling=1/0,n.getSession().setValue(i.val()),n.getSession().setMode("ace/mode/"+l),s&&n.getSession().setUseWrapMode(!0),n.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!1,showLineNumbers:!1,showFoldWidgets:!1}),n.getSession().on("change",function(e){i.val(n.getSession().getValue()).trigger("change")}),i.closest(".fl-field").data("editor",n)},_initMultipleFields:function(){for(var t=e(".fl-builder-settings:visible .fl-builder-field-multiples"),i=null,l=null,s=0,o=FLBuilderConfig.isRtl?{left:10}:{right:10};s<t.length;s++)i=t.eq(s),l=i.find(".fl-builder-field-multiple"),1===l.length?l.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):l.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:o,distance:5,opacity:.5,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer",axis:"y"})},_addFieldClicked:function(){var t=e(this),i=t.attr("data-field"),l=t.closest("tr").siblings("tr[data-field="+i+"]").last(),s=l.clone(),o=s.find(".fl-form-field"),n=null,r=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;s.find("th label span.fl-builder-field-index").html(r),s.find(".fl-form-field-preview-text").html(""),s.find("input, textarea, select").val(""),l.after(s),FLBuilder._initMultipleFields(),o.length&&(n=o.find(".fl-form-field-edit").data("type"),o.find("input").val(JSON.stringify(FLBuilderSettingsConfig.defaults.forms[n])))},_copyFieldClicked:function(){var t=e(this),i=t.closest("tr"),l=i.clone(),s=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;l.find("th label span.fl-builder-field-index").html(s),i.after(l),FLBuilder._renumberFields(i.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),i=t.parent(),l=confirm(FLBuilderStrings.deleteFieldMessage);l&&(t.remove(),FLBuilder._renumberFields(i),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),i=0;i<t.length;i++)t.eq(i).find("th label span.fl-builder-field-index").html(i+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),i=t.attr("data-toggle"),l=t.attr("data-hide"),s=t.attr("data-trigger"),o=t.val(),n=0;if("undefined"!=typeof i){i=JSON.parse(i);for(n in i)FLBuilder._settingsSelectToggle(i[n].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[n].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[n].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof i[o]&&(FLBuilder._settingsSelectToggle(i[o].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(i[o].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[o].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof l&&(l=JSON.parse(l),"undefined"!=typeof l[o]&&(FLBuilder._settingsSelectToggle(l[o].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[o].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[o].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof s&&(s=JSON.parse(s),"undefined"!=typeof s[o]&&"undefined"!=typeof s[o].fields))for(n=0;n<s[o].fields.length;n++)e("#fl-field-"+s[o].fields[n]).find("select").trigger("change");FLBuilder._calculateSettingsTabsOverflow()},_settingsSelectToggle:function(t,i,l,s){var o=0;if(s="undefined"==typeof s?"":s,"undefined"!=typeof t)for(;o<t.length;o++)e(".fl-builder-settings:visible").find(l+t[o]+s)[i](),e(l+t[o]+s).parent().find('.fl-field[data-type="code"]').each(function(){e(this).data("editor").resize()})},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded}}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}),FLBuilder._singlePhotoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="photo")},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=l.val(),o=null;e(this).hasClass("fl-photo-replace")?(t.reset(),i.addClass("fl-photo-empty"),l.val("")):""!==s?(o=wp.media.attachment(s),o.fetch(),t.add(o?[o]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-photo-preview img"),o=i.find("select");l.val(t.id),s.attr("src",FLBuilder._getPhotoSrc(t)),i.removeClass("fl-photo-empty").removeClass("fl-photo-no-attachment"),i.find("label.error").remove(),o.show(),o.html(FLBuilder._getPhotoSizeOptions(t)),o.trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-photo-field"),s=l.find("input[type=hidden]"),o=l.find("select");i&&i.reset(),l.addClass("fl-photo-empty"),s.val(""),o.html('<option value="" selected></option>'),o.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e,t){var i="",l=null,s=null,o="",n={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes||0===e.sizes.length)i+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else{t&&(t=t.replace(/https?/,""));for(l in e.sizes)o="undefined"!=typeof n[l]?n[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",s="",t?t===e.sizes[l].url.replace(/https?/,"")&&(s=' selected="selected"'):s="full"==l?' selected="selected"':"",i+='<option value="'+e.sizes[l].url+'"'+s+">"+o+e.sizes[l].width+" x "+e.sizes[l].height+"</option>"}return i},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""===l?"":JSON.parse(l),o=wp.media.gallery.defaults.id,n='[gallery ids="-1"]',r=null,a=null,d=null,u=null,c=[];if("object"==typeof s){for(u in s)c.push(s[u]);n='[gallery ids="'+c.join()+'"]'}r=wp.shortcode.next("gallery",n).shortcode,_.isUndefined(r.get("id"))&&!_.isUndefined(o)&&r.set("id",o),a=wp.media.gallery.attachments(r),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),d.props.set({query:!1}),d.unmirror(),
5
- d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var i=e(this).closest(".fl-multiple-photos-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-multiple-photos-count"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?s.html("1 "+FLBuilderStrings.photoSelected):s.html(o.length+" "+FLBuilderStrings.photosSelected),i.removeClass("fl-multiple-photos-empty"),i.find("label.error").remove(),l.val(JSON.stringify(o)).trigger("change")},_selectSingleVideo:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1}),FLBuilder._singleVideoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="video"),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-video-field"),l=i.find(".fl-video-preview-img"),s=i.find(".fl-video-preview-filename"),o=i.find("input[type=hidden]");l.html('<span class="dashicons dashicons-media-video"></span>'),s.html(t.filename),i.removeClass("fl-video-empty"),i.find("label.error").remove(),o.val(t.id).trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""==l?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(l).join()+'"]',o=wp.shortcode.next("playlist",s).shortcode,n=wp.media.playlist.defaults.id,r=null,a=null;_.isUndefined(o.get("id"))&&!_.isUndefined(n)&&o.set("id",n),r=wp.media.playlist.attachments(o),a=new wp.media.model.Selection(r.models,{props:r.props.toJSON(),multiple:!0}),a.playlist=r.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var i=e(this).closest(".fl-multiple-audios-field"),l=i.find(".fl-multiple-audios-count"),s=i.find("input[type=hidden]"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?l.html("1 "+FLBuilderStrings.audioSelected):l.html(o.length+" "+FLBuilderStrings.audiosSelected),s.val(JSON.stringify(o)).trigger("change"),i.removeClass("fl-multiple-audios-empty"),i.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var i=e(this).closest(".fl-icon-field"),l=i.find("input[type=hidden]"),s=i.find("i"),o=s.attr("data-icon");l.val(t).trigger("change"),s.removeClass(o),s.addClass(t),s.attr("data-icon",t),i.removeClass("fl-icon-empty"),i.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),i=t.find("input[type=hidden]"),l=t.find("i");i.val("").trigger("change"),l.removeClass(),l.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.attr("data-type"),s=t.siblings("input").val(),o=FLBuilder._moduleHelpers[l],n=(FLBuilderSettingsConfig.forms[l],FLBuilder._openNestedSettings({className:"fl-builder-lightbox fl-form-field-settings"}));""===s&&(s=JSON.stringify(FLBuilderSettingsConfig.forms[l])),FLBuilderSettingsForms.render({id:l,nodeId:i.attr("data-node"),nodeSettings:FLBuilder._getSettings(i),settings:JSON.parse(s.replace(/&#39;/g,"'")),lightbox:n,helper:o,rules:o?o.rules:null},function(){t.attr("id","fl-"+n._node.attr("data-instance-id")),n._node.find("form.fl-builder-settings").attr("data-type",l)})},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=t.attr("data-type"),s=FLBuilder._getSettings(t),o={},n=FLBuilder._moduleHelpers[l],r=e(".fl-builder-settings #fl-"+i),a=r.parent().attr("data-preview-text"),d=t.find("#fl-field-"+a),u=s[a],c=e('select[name="'+a+'"]'),h=document.createElement("div"),f=!0;return c.length>0&&(u=c.find('option[value="'+s[a]+'"]').text()),"undefined"!=typeof n&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=n.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof u&&("icon"===d.data("type")?u='<i class="'+u+'"></i>':u.length>35&&(h.innerHTML=u,u=(h.textContent||h.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),r.siblings(".fl-form-field-preview-text").html(u)),o=r.siblings("input").val().replace(/&#39;/g,"'"),""!=o&&(s=e.extend(JSON.parse(o),s)),r.siblings("input").val(JSON.stringify(s)).trigger("change"),FLBuilder._closeNestedSettings(),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-builder-settings:visible .fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),i=t.find(".fl-link-field-search-input");i.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:i.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,i){var l=e.closest(".fl-link-field"),s=l.find(".fl-link-field-search"),o=l.find(".fl-link-field-search-input"),n=l.find(".fl-link-field-input");n.val(t.value).trigger("keyup"),o.autoSuggest("remove",t.value),s.hide()},_linkFieldSelectClicked:function(){var t=e(this).closest(".fl-link-field").find(".fl-link-field-search");t.show(),t.find("input").focus()},_linkFieldSelectCancelClicked:function(){var t=e(this);t.parent().hide(),t.closest(".fl-link-field").find("input.fl-link-field-input").focus()},_initFontFields:function(){e(".fl-builder-settings:visible .fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),i=t.attr("data-value"),l=t.find(".fl-font-field-font"),s=t.find(".fl-font-field-weight");l.on("change",function(){FLBuilder._getFontWeights(l)}),i.indexOf("family")>-1&&(i=JSON.parse(i),l.val(i.family),l.trigger("change"),s.find("option[value="+i.weight+"]").length&&s.val(i.weight))},_getFontWeights:function(t){var i=t.next(".fl-font-field-weight"),l=t.val(),s={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},o={};i.html(""),o="undefined"!=typeof FLBuilderFontFamilies.system[l]?FLBuilderFontFamilies.system[l].weights:"undefined"!=typeof FLBuilderFontFamilies.google[l]?FLBuilderFontFamilies.google[l]:FLBuilderFontFamilies["default"][l],e.each(o,function(e,t){i.append('<option value="'+t+'">'+s[t]+"</option>")})},_initTinyMCE:function(){tinymce.ui.FloatPanel.zIndex=100100,e(".fl-builder-hidden-editor").each(FLBuilder._initEditorField)},_initEditorFields:function(){e(".fl-builder-settings:visible .fl-editor-field").each(FLBuilder._initEditorField)},_initEditorField:function(){var t=e(this),i=t.find("textarea"),l=t.attr("data-name"),s="flrich"+(new Date).getTime()+"_"+l,o=FLBuilderConfig.wp_editor,n=tinyMCEPreInit,r=Number(t.attr("data-buttons")),a=t.attr("data-rows"),d=null,u=null;o=o.replace(/flbuildereditor/g,s),n=JSON.parse(JSON.stringify(n).replace(/flbuildereditor/g,s)),i.after(o).remove(),e("textarea#"+s).val(i.val()),void 0!==typeof tinymce&&void 0!==n.mceInit[s]&&(d=n.mceInit[s],u=tinymce.$("#wp-"+s+"-wrap"),u.find("textarea").attr("rows",a),r||u.find(".wp-media-buttons").remove(),!u.hasClass("tmce-active")&&n.qtInit.hasOwnProperty(s)||d.wp_skip_init||tinymce.init(d)),void 0!==typeof quicktags&&quicktags(n.qtInit[s]),window.wpActiveEditor=s},_reinitEditorFields:function(){e(".fl-lightbox-resizable:visible").length&&setTimeout(function(){var t,i;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)i=tinymce.editors[t].id,tinyMCE.execCommand("mceRemoveEditor",!0,i),tinyMCE.execCommand("mceAddEditor",!0,i);FLBuilder.preview&&FLBuilder.preview._initDefaultFieldPreviews(e('.fl-field[data-type="editor"]'))}},1)},_destroyEditorFields:function(){var t;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinyMCE.execCommand("mceRemoveEditor",!0,tinymce.editors[t].id);e(".wplink-autocomplete").remove(),e(".ui-helper-hidden-accessible").remove()}},_updateEditorFields:function(){var t=e(".fl-builder-settings:visible textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),i=t.closest(".fl-editor-field"),l=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),s=t.attr("id"),o=i.attr("data-name"),n="undefined"!=typeof tinyMCE&&tinyMCE.get(s),r=t.siblings('textarea[name="'+o+'"]'),a=i.data("wpautop");0===r.length&&(r=e('<textarea name="'+o+'"></textarea>').hide(),t.after(r)),a?n&&l.hasClass("tmce-active")?r.val(n.getContent()):"undefined"!=typeof switchEditors?r.val(switchEditors.wpautop(t.val())):r.val(t.val()):(n&&l.hasClass("tmce-active")&&n.save(),r.val(t.val()))},_loopDataSourceChange:function(){var t=e(this).val();e(".fl-loop-data-source").hide(),e('.fl-loop-data-source[data-source="'+t+'"]').show()},_customQueryPostTypeChange:function(){var t=e(this).val();e(".fl-custom-query-filter").hide(),e(".fl-custom-query-"+t+"-filter").show()},_initOrderingFields:function(){e(".fl-builder-settings:visible .fl-ordering-field-options").each(FLBuilder._initOrderingField)},_initOrderingField:function(){e(this).sortable({items:".fl-ordering-field-option",containment:"parent",tolerance:"pointer",stop:FLBuilder._updateOrderingField})},_updateOrderingField:function(t){var i=e(t.target),l=i.siblings("input[type=hidden]"),s=[];i.find(".fl-ordering-field-option").each(function(){s.push(e(this).attr("data-key"))}),l.val(JSON.stringify(s)).trigger("change")},_onNumberFieldFocus:function(t){var i=e(t.currentTarget);i.addClass("mousetrap"),Mousetrap.bind("up",function(){i.attr("step",1)}),Mousetrap.bind("down",function(){i.attr("step",1)}),Mousetrap.bind("shift+up",function(){i.attr("step",10)}),Mousetrap.bind("shift+down",function(){i.attr("step",10)})},_onNumberFieldBlur:function(t){var i=e(t.currentTarget);i.attr("step",1).removeClass("mousetrap")},_initTimezoneFields:function(){e(".fl-builder-settings:visible .fl-field[data-type=timezone]").each(FLBuilder._initTimezoneField)},_initTimezoneField:function(){var t=e(this).find("select"),i=t.attr("data-value");t.find('option[value="'+i+'"]').attr("selected","selected")},ajax:function(t,i){var l;FLBuilder.triggerHook("didBeginAJAX",t);for(l in t)"undefined"==typeof t[l]&&(t[l]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=FLBuilderConfig.postId,t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.settings))),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.node_settings))),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof i&&i.call(this,e),FLBuilder.triggerHook("didCompleteAJAX",t)})},_ajaxComplete:function(){FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),i=null;if("undefined"!=typeof e)for(i in e)t+=t.indexOf("?")>-1?"&":"?",t+=i+"="+e[i];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_showNodeLoading:function(t){var i=e(".fl-node-"+t);i.addClass("fl-builder-node-loading")},_hideNodeLoading:function(t){var i=e(".fl-node-"+t);i.removeClass("fl-builder-node-loading")},_showNodeLoadingPlaceholder:function(t,i){var l=e('<div class="fl-builder-node-loading-placeholder"></div>');t.hasClass("fl-builder-content")?siblings=t.find(".fl-row"):t.hasClass("fl-row-content")?siblings=t.find(" > .fl-col-group"):t.hasClass("fl-col-group")?(t.addClass("fl-col-group-has-child-loading"),siblings=t.find(" > .fl-col")):siblings=t.find(" > .fl-col-group, > .fl-module"),0===siblings.length||siblings.length==i?t.append(l):siblings.eq(i).before(l)},_removeNodeLoadingPlaceholder:function(e){var t=e.prev(".fl-builder-node-loading-placeholder"),i=e.next(".fl-builder-node-loading-placeholder");t.length?t.remove():i.remove()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=FLBuilder._btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=FLBuilder._btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_btoa:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},_wpmedia_reset_errors:function(){e(".upload-error").remove(),e(".media-uploader-status").removeClass("errors").hide()},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox",resizable:!0}),FLBuilder._lightbox.on("resized",FLBuilder._calculateSettingsTabsOverflow),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._lightbox.on("beforeCloseLightbox",FLBuilder._destroyEditorFields),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_showLightbox:function(){FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder._removeAllOverlays(),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},alert:function(e){var t=new FLLightbox({className:"fl-builder-alert-lightbox",destroyOnClose:!0}),i=wp.template("fl-alert-lightbox");t.open(i({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},confirm:function(t){var i={message:"",ok:function(){},cancel:function(){},strings:{ok:FLBuilderStrings.ok,cancel:FLBuilderStrings.cancel}},l=e.extend({},i,"undefined"==typeof t?{}:t);lightbox=new FLLightbox({className:"fl-builder-confirm-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),template=wp.template("fl-confirm-lightbox"),lightbox.open(template(l)),lightbox._node.find(".fl-builder-confirm-ok").on("click",l.ok),lightbox._node.find(".fl-builder-confirm-cancel").on("click",l.cancel)},triggerHook:function(t,i){e("body").trigger("fl-builder."+t,i)},addHook:function(t,i){e("body").on("fl-builder."+t,i)},removeHook:function(t,i){e("body").off("fl-builder."+t,i)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,i,l,s){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",i).replace("{file}",t)),"undefined"!=typeof s&&"undefined"!=typeof s.stack&&(FLBuilder.log(s.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery),function(e){FLBuilderAJAXLayout=function(t,i){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=i,this._post=FLBuilderConfig.postId,this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId).eq(0)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback(),FLBuilder.triggerHook("didRenderLayoutComplete")},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),i="fl-row",l=this._data.scriptsStyles,s="";this._data.partial&&(i="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(i)||(s=e(this).remove(),l+=s[0].outerHTML)}),""!==l&&(l=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+l+"<div>":'<div class="fl-builder-node-scripts-styles">'+l+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=l}},_addNewHTML:function(){var t;this._data.partial?this._data.nodeParent?(t=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.hasClass("fl-col-group")?this._data.nodeParent.find(" > .fl-col"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),t=t.filter(":not(.fl-builder-node-clone)"),0===t.length||t.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):t.eq(this._data.nodePosition).before(this._data.html),this._data.nodeId&&FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+this._data.nodeId))):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html),FLBuilder.preview&&this._data.nodeId&&this._data.nodeId!=FLBuilder.preview.nodeId&&e(FLBuilder.preview.classes.node).length&&e(FLBuilder.preview.classes.node).html(FLBuilder.preview.elements.node.html())},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var i=e("<div>"+t+"</div>"),l="",s=null,o="",n=null,r=window.location,a=r.protocol+"//"+r.hostname+(r.port?":"+r.port:"");return i.find("script").each(function(){l=e(this).attr("src"),"undefined"!=typeof l&&(l=l.replace(a,""),s=e('script[src*="'+l+'"]'),s.length>0&&e(this).remove())}),i.find("link").each(function(){o=e(this).attr("href"),"undefined"!=typeof o&&(o=o.replace(a,""),n=e('link[href*="'+o+'"]'),n.length>0&&e(this).remove())}),i.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),function(e){FLBuilderPreview=function(e){this.type=e.type,this._saveState(),e.layout?FLBuilder._renderLayout(e.layout,function(){this._init(),e.callback&&e.callback()}.bind(this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_loaderTimeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(i)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._destroySheets(),this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview",className:"fl-builder-preview-style"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium",className:"fl-builder-preview-style"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive",className:"fl-builder-preview-style"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,i){this._styleSheet.updateRule(e,t,i)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),i=t>>16&255,l=t>>8&255,s=255&t;return[i,l,s]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,i){var l=FLBuilderResponsiveEditing._mode,s="default"==l?"":l.charAt(0).toUpperCase()+l.slice(1);this["_styleSheet"+s].updateRule(e,t,i)},_saveState:function(){var t=FLBuilderConfig.postId,i=e('link[href*="/cache/'+t+'"]').attr("href"),l=e('script[src*="/cache/'+t+'"]').attr("src"),s=e(FLBuilder._contentClass).html();this.state={css:i,js:l,html:s}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=t.attr("data-node"),l=FLBuilder._getSettings(t);FLBuilder._showNodeLoading(i),this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:i,node_preview:l},e.proxy(this._renderPreview,this))},delayPreview:function(t){var i="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),l=e(".fl-builder-widget-settings .fl-builder-settings-title"),s=e(".fl-builder-settings .fl-lightbox-header"),o=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.svg",n=e('<img class="fl-builder-preview-loader" src="'+o+'" />');this.delay(1e3,e.proxy(this.preview,this)),this._loaderTimeout=setTimeout(function(){e(".fl-builder-preview-loader").remove(),i.length>0?i.append(n):l.length>0?l.append(n):s.length>0&&s.append(n)},1500)},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._createSheets(),this._initElementsAndClasses(),null!==this._loaderTimeout&&clearTimeout(this._loaderTimeout),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){return this._settingsHaveChanged()?void FLBuilder._updateNode(this.nodeId,function(){this.clear()}.bind(this)):void this.clear()},cancel:function(){this._cancelDelay(),this._cancelPreview()},clear:function(){this.cancel(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var i=this.elements.textColor.val(),l=this.elements.linkColor.val(),s=this.elements.hoverColor.val(),o=this.elements.headingColor.val();l=""===l?i:l,s=""===s?i:s,o=""===o?i:o,this.delay(100,e.proxy(function(){""===i?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+i),""===l?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+l),""===s?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+s),""===o?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+o),this.updateCSSRule(this.classes.node+" h2","color","#"+o),this.updateCSSRule(this.classes.node+" h3","color","#"+o),this.updateCSSRule(this.classes.node+" h4","color","#"+o),this.updateCSSRule(this.classes.node+" h5","color","#"+o),this.updateCSSRule(this.classes.node+" h6","color","#"+o),this.updateCSSRule(this.classes.node+" h1 a","color","#"+o),this.updateCSSRule(this.classes.node+" h2 a","color","#"+o),this.updateCSSRule(this.classes.node+" h3 a","color","#"+o),this.updateCSSRule(this.classes.node+" h4 a","color","#"+o),this.updateCSSRule(this.classes.node+" h5 a","color","#"+o),this.updateCSSRule(this.classes.node+" h6 a","color","#"+o))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),
6
- bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var i,l,s;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(i=this.hexToRgb(this.elements.bgColor.val()),l=this.parseFloat(this.elements.bgOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",s)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var i=this.elements,l=i.bgVideoSource.val(),s=i.bgVideo.val(),o=i.bgVideoServiceUrl.val(),n="https://www.youtube.com/iframe_api",r="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==l&&""!=o?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(o)&&e('script[src*="youtube.com"').length<1?a.attr("src",n):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(o)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",r),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=s&&this.preview()},_bgSlideshowChange:function(t){var i=this.elements,l=i.bgSlideshowSource.val(),s=i.bgSlideshowPhotos.val(),o=i.bgSlideshowFeedUrl.val(),n=i.bgSlideshowSpeed.val(),r=i.bgSlideshowTransSpeed.val();"wordpress"==l&&""===s||"smugmug"==l&&""===o||isNaN(parseInt(n))||isNaN(parseInt(r))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var i,l,s;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(i=this.hexToRgb(this.elements.bgOverlayColor.val()),l=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",s)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var i,l,s;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(i=this.hexToRgb(this.elements.borderColor.val()),l=parseInt(this.elements.borderOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",s)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var i={},l=["Top","Bottom","Left","Right"],s=["","Medium","Responsive"],o=this.classes.settings,n="",r="",a=null,d=null;for(a=0;a<l.length;a++)for(d=0;d<s.length;d++)n=t+l[a]+s[d],r=t+"_"+l[a].toLowerCase(),""!=s[d]&&(r+="_"+s[d].toLowerCase()),i[n]=e(o+" input[name="+r+"]"),i[n].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,i)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,i=["Top","Bottom","Left","Right"],l="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),s={},o=0;o<i.length;o++)s[i[o].toLowerCase()]=this.elements[e+i[o]+l].val();return this._normalizeDimensionValues(s,e)},_responsiveDimensionChange:function(t){var i=this._getDimensions(t),l={},s="border"==t;e.each(i,function(e,i){l[t+"-"+e+(s?"-width":"")]=i}),this.updateResponsiveCSSRule(this.classes.content,l),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,i){var l=this,s=FLBuilderResponsiveEditing._mode,o="default"==s?"":s.charAt(0).toUpperCase()+s.slice(1),i=i.split("-");return"undefined"==typeof i[1]?i[1]="":i[1]=i[1].charAt(0).toUpperCase()+i[1].slice(1),e.map(t,function(e,s){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var n=i[0]+s.charAt(0).toUpperCase()+s.slice(1)+i[1]+o,r=l.elements[n].attr("placeholder");r&&(e=r)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[s]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),i=this.elements.node.find(".fl-bg-video"),l=null,s=null,o={top:0,bottom:0,left:0,right:0};(t.length>0||i.length>0)&&(l=this._getDimensions("margin"),s=this._getDimensions("border"),e.map(o,function(e,t){l[t]&&s[t]?o[t]="calc("+l[t]+"+"+s[t]+")":l[t]?o[t]=l[t]:s[t]&&(o[t]=s[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",o),FLBuilder._resizeLayout()),i.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",o))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),maxContentWidth:e(this.classes.settings+" input[name=max_content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.maxContentWidth.on("keyup",e.proxy(this._rowMaxContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node,i=this.elements.maxContentWidth.val();"full"==this.elements.width.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),t.removeClass("fl-row-align-bottom"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content"),i=this.elements.maxContentWidth.val();"full"==this.elements.contentWidth.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowMaxContentWidthChange:function(e){var t=this.elements.node,i=this.elements.content.find(".fl-row-content"),l=this.elements.maxContentWidth.val();""==l?l=FLBuilderConfig.global.row_width+"px":l+="px","fixed"==this.elements.width.val()&&t.css("max-width",l),"fixed"==this.elements.contentWidth.val()&&i.css("max-width",l)},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,i=100-t,l=parseFloat(this.elements.size.val()),s=this.elements.node.prev(".fl-col"),o=this.elements.node.next(".fl-col"),n=0===o.length?s:o,r=this.elements.node.siblings(".fl-col"),a=0;0===r.length||isNaN(l)||(r.each(function(){e(this).data("node")!=n.data("node")&&(i-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),l<t&&(l=t),l>i&&(l=i),n.css("width",100-a-l+"%"),this.elements.node.css("width",l+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(e){for(var e=_.isUndefined(e)?this.elements.settings.find(".fl-field"):e,t=null,i=null,l=0;l<e.length;l++)t=e.eq(l),i=t.data("preview"),"refresh"==i.type&&this._initFieldRefreshPreview(t),"text"==i.type&&this._initFieldTextPreview(t),"css"==i.type&&this._initFieldCSSPreview(t),"widget"==i.type&&this._initFieldWidgetPreview(t),"font"==i.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this.delayPreview,this);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"select":t.find("select").on("change",s);break;case"color":t.find(".fl-color-picker-value").on("change",s);break;case"photo":t.find("select").on("change",s);break;case"multiple-photos":t.find("input").on("change",s);break;case"photo-sizes":t.find("select").on("change",s);break;case"video":t.find("input").on("change",s);break;case"multiple-audios":t.find("input").on("change",s);break;case"icon":t.find("input").on("change",s);break;case"form":t.delegate("input","change",s);break;case"editor":this._addTextEditorCallback(t,l);break;case"code":t.find("textarea").on("change",s);break;case"post-type":t.find("select").on("change",s);break;case"suggest":t.find(".as-values").on("change",s),t.find("select").on("change",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"ordering":t.find("input[type=hidden]").on("change",s)}},_initFieldTextPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this._previewText,this,l);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"code":t.find("textarea").on("change",s);break;case"editor":this._addTextEditorCallback(t,l)}},_previewText:function(t,i){var l=this.elements.node.find(t.selector),s=e("<div>"+e(i.target).val()+"</div>");l.length>0&&(s.find("script").remove(),l.html(s.html()))},_previewTextEditor:function(t,i,l){var s=this.elements.node.find(t.selector),o="undefined"!=typeof tinyMCE?tinyMCE.get(i):null,n=e("#"+i),r="";s.length>0&&(r=e(o&&"none"==n.css("display")?"<div>"+o.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+n.val()+"</div>":"<div>"+switchEditors.wpautop(n.val())+"</div>"),r.find("script").remove(),s.html(r.html()))},_addTextEditorCallback:function(t,i){var l=t.find("textarea.wp-editor-area").attr("id"),s=null;if("refresh"==i.type)s=e.proxy(this.delayPreview,this);else{if("text"!=i.type)return;s=e.proxy(this._previewTextEditor,this,i,l)}e("#"+l).on("keyup",s),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(l),editor.on("change",s),editor.on("keyup",s))},_initFieldFontPreview:function(t){var i=t.data("type"),l=t.data("preview");l.id=t.attr("id");var s=e.proxy(this._previewFont,this,l);"font"==i&&t.find(".fl-font-field").on("change","select",s)},_previewFont:function(t,i){var l=e(i.delegateTarget),s=l.find(".fl-font-field-font"),o=e(s).find(":selected"),n=o.parent().attr("label"),r=l.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==n&&this._buildFontStylesheet(a,s.val(),r.val()),"Default"==s.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",s.val()),this.updateCSSRule(d,"font-weight",r.val()))},_buildFontStylesheet:function(t,i,l){var s=FLBuilderConfig.googleFontsUrl,o="",n={},r={};n[i]=[l],FLBuilderPreview._fontsList[t]=n,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var i=t[e];r[e]=r[e]||[],i=i.filter(function(t){return r[e].indexOf(t)<0}),r[e]=r[e].concat(i)})}),e.each(r,function(e,t){o+=e+":"+t.join()+"|"}),o=s+o.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",o).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",o)},_initFieldCSSPreview:function(e){var t=e.data("preview"),i=null;if("undefined"!=typeof t.rules)for(i in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[i]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,i){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,i));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,i))}},_previewCSS:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=t.property,o="undefined"==typeof t.unit?"":t.unit,n=e(i.target),r=n.val();"%"==o?r=parseInt(r)/100:""!==r&&(r+=o),n.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,s,r):this.updateCSSRule(l,s,r)},_previewColor:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=e(i.target),o=s.val(),n=""===o?"inherit":"#"+o;/^rgb/.test(o.replace(/\s+/g,""))&&(n=o),s.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,t.property,n):this.updateCSSRule(l,t.property,n)},_initFieldWidgetPreview:function(t){var i=e.proxy(this.delayPreview,this);t.find("input").on("keyup",i),t.find("input[type=checkbox]").on("click",i),t.find("textarea").on("keyup",i),t.find("select").on("change",i)},_getPreviewSelector:function(e,t){for(var i="",l=t.split(","),s=0;s<l.length;s++)l[s].indexOf("{node}")>-1?i=l[s].replace("{node}",e):i+=e+" "+l[s],s!=l.length-1&&(i+=", ");return i}}}(jQuery),function(e){var t={ignored:[],reparsed:[],width:null,callback:null,sheets:{},styles:[],queue:[],emPxValue:null,regex:{media:/@media[^{]*{([\s\S]+?})\s*}/gi,empty:/@media[^{]*{([^{}]*?)}/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)\}$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},ignore:function(e){Array.prototype.push.apply(this.ignored,e)},reparse:function(e){Array.prototype.push.apply(this.reparsed,e)},update:function(e,t){this.width=void 0===e?null:e,this.callback=void 0===t?null:t,i.update(),this.queueSheets()?this.runQueue():this.applyStyles()},queueSheets:function(){for(var t=e("link, style"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=!1,u=0,c=0;u<t.length;u++)if(element=t[u],i=element.href,l=element.id,s=element.tagName.toLowerCase(),o=element.rel,n=element.media,r=i?i:l?l:"style-"+u,a=!0,d=!1,"style"===s||i&&o&&"stylesheet"===o.toLowerCase()){for(c=0;c<this.ignored.length;c++)if(r.indexOf(this.ignored[c])>-1){d=!0;break}if(d)continue;for(c=0;c<this.reparsed.length;c++)if(r.indexOf(this.reparsed[c])>-1){this.sheets[r]=null;break}void 0!==this.sheets[r]&&this.sheets[r]||this.queue.push({element:t.eq(u),key:r,tagName:s,href:i,id:l,media:n})}return this.queue.length},runQueue:function(){var t;this.queue.length?(t=this.queue.shift(),"style"===t.tagName?(this.parse(t.element.html(),t),this.runQueue()):e.get(t.href,e.proxy(function(e){this.parse(e,t),this.runQueue()},this))):this.applyStyles()},parse:function(e,t){var i=this.regex,l=this.cleanStyles(e),s=l.match(i.media),o=s&&s.length||0,n=!o&&t.media,r=null,a=null,d=null,u="",c=0,h=0;for(s?u=l.replace(i.media,""):n&&"all"!=t.media?o=1:u=l,this.sheets[t.key]={element:t.element,key:t.key,tagName:t.tagName,href:t.href,id:t.id,all:u,queries:[]},c=0;c<o;c++)for(n?(r=t.media,l=this.convertURLs(l,t.href)):(r=s[c].match(i.findStyles)&&RegExp.$1,l=RegExp.$2&&this.convertURLs(RegExp.$2,t.href)),a=r.split(","),h=0;h<a.length;h++)r=a[h],d=r.split("(")[0].match(i.only)&&RegExp.$2,"print"!=d&&(r.replace(i.minmaxwh,"").match(i.other)||this.sheets[t.key].queries.push({minw:r.match(i.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(i.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),styles:l}))},applyStyles:function(){var t=e("head"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=null,u=!1;this.clearStyles();for(o in this.sheets)if(i="",l=e("<style></style>"),s=this.sheets[o],s.queries.length&&this.width){for(i+=s.all,r=0;r<s.queries.length;r++)n=s.queries[r],a=n.minw,d=n.maxw,u=!1,a&&(a=parseFloat(a)*(a.indexOf("em")>-1?this.getEmPxValue():1),this.width>=a&&(i+=n.styles,u=!0)),d&&!u&&(d=parseFloat(d)*(d.indexOf("em")>-1?this.getEmPxValue():1),this.width<=d&&(i+=n.styles));this.styles.push(l),t.append(l),l.html(i),s.element.remove()}},clearStyles:function(){var t=e("head"),i=null,l=this.styles.slice(0);this.styles=[];for(i in this.sheets)this.sheets[i].element.parent().length||t.append(this.sheets[i].element);setTimeout(function(){for(var e=0;e<l.length;e++)l[e].empty(),l[e].remove()},50)},cleanStyles:function(e){var t=this.regex;return e.replace(t.comments,"").replace(t.keyframes,"").replace(t.empty,"")},convertURLs:function(e,t){return t?(t=t.substring(0,t.lastIndexOf("/")),t.length&&(t+="/"),e.replace(this.regex.urls,"$1"+t+"$2$3")):e},getEmPxValue:function(){if(this.emPxValue)return this.emPxValue;var e=null,t=window.document,i=t.documentElement,l=t.body,s=t.createElement("div"),o=i.style.fontSize,n=l&&l.style.fontSize,r=!1;return s.style.cssText="position:absolute;font-size:1em;width:1em",l||(l=r=t.createElement("body"),l.style.background="none"),i.style.fontSize="100%",l.style.fontSize="100%",l.appendChild(s),r&&i.insertBefore(l,i.firstChild),e=parseFloat(s.offsetWidth),r?i.removeChild(l):l.removeChild(s),i.style.fontSize=o,n?l.style.fontSize=n:l.style.fontSize="",this.emPxValue=e,e}},i={_functions:null,update:function(){var e;if(!this._functions){this._functions={};for(e in l)this._functions[e]=jQuery.fn[e]}if(t.width)for(e in l)jQuery.fn[e]=l[e];else for(e in this._functions)jQuery.fn[e]=this._functions[e]}},l={width:function(l){return void 0!=l?i._functions.width.call(this,l):e.isWindow(this[0])?t.width:i._functions.width.call(this)}};FLBuilderSimulateMediaQuery={ignore:function(e){t.ignore(e)},reparse:function(e){t.reparse(e)},update:function(e,i){t.update(e,i)}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",refreshPreview:function(){var t;e(".fl-responsive-preview").length&&"default"!=this._mode&&("responsive"==this._mode?(t=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,FLBuilderSimulateMediaQuery.update(t)):"medium"==this._mode&&(t=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,FLBuilderSimulateMediaQuery.update(t)),FLBuilder._resizeLayout())},_init:function(){this._bind(),this._initMediaQueries()},_bind:function(){FLBuilder.addHook("responsive-editing-switched",this._previewSpacingFields),FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_initMediaQueries:function(){FLBuilderSimulateMediaQuery.ignore([FLBuilderConfig.pluginUrl,"fl-theme-builder","/wp-includes/","/wp-admin/","admin-bar-inline-css","ace-tm","ace_editor.css"]),FLBuilderSimulateMediaQuery.reparse([FLBuilderConfig.postId+"-layout-draft.css?",FLBuilderConfig.postId+"-layout-draft-partial.css?",FLBuilderConfig.postId+"-layout-preview.css?",FLBuilderConfig.postId+"-layout-preview-partial.css?","fl-builder-global-css","fl-builder-layout-css"])},_switchTo:function(t,i){var l=e("html"),s=e("body"),o=e(FLBuilder._contentClass),n=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),a=e(".fl-content-placeholder"),d=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===a.length)return;l.removeClass("fl-responsive-preview-enabled"),a.after(o),a.remove(),n.remove(),r.remove()}else 0===n.length?(l.addClass("fl-responsive-preview-enabled"),o.after('<div class="fl-content-placeholder"></div>'),s.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(o)):(n.removeClass("fl-preview-responsive fl-preview-medium"),n.addClass("fl-preview-"+t));"responsive"==t?(d=FLBuilderConfig.global.responsive_breakpoint>=360?360:FLBuilderConfig.global.responsive_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):"medium"==t?(d=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):(o.width(""),FLBuilderSimulateMediaQuery.update(null,i)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),i=e(".fl-responsive-preview"),l=e(".fl-content-placeholder"),s=l.parents(),o="#fff",n=0;if(0===i.length)t.css("background-color","");else{for(;n<s.length&&(o=s.eq(n).css("background-color"),"rgba(0, 0, 0, 0)"==o);n++);t.css("background-color",o)}},_switchToAndScroll:function(t){var i=e(".fl-builder-settings").data("node"),l=void 0===i?void 0:e(".fl-node-"+i);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==l&&l&&setTimeout(function(){var t=e(window),i=e(".fl-responsive-preview-content");!i.length||t.height()<i.height()?e("html, body").animate({scrollTop:l.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),i=t.data("mode");i="default"==i?"medium":"medium"==i?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(i),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var i="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(i),e(".fl-field-responsive-setting").hide(),i="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(i).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(e._initFields("dimension","input","keyup",e._spacingFieldKeyup,["margin","padding"]),e._initFields("dimension","input","keyup",e._textFieldKeyup),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,i,l,s,o){for(var n=e(".fl-builder-settings"),r=n.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0;u<r.length;u++)a=r.eq(u),d=a.attr("id").replace("fl-field-",""),"object"==typeof o&&e.inArray(d,o)<0||t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")&&(a.find(".fl-field-responsive-setting-default "+i).on(l,s),a.find(".fl-field-responsive-setting-medium "+i).on(l,s),a.find(".fl-field-responsive-setting-responsive "+i).on(l,s),a.find(".fl-field-responsive-setting-default "+i).trigger(l),a.attr("data-responsive-init",1))},_getFields:function(t,i){var l=e(t).closest(".fl-field");return{"default":l.find(".fl-field-responsive-setting-default "+i),medium:l.find(".fl-field-responsive-setting-medium "+i),responsive:l.find(".fl-field-responsive-setting-responsive "+i)}},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this,"input");e["default"].each(function(t){var i=e["default"].eq(t).attr("placeholder"),l=e["default"].eq(t).val(),s=e.medium.eq(t).val();""==l?e.medium.eq(t).attr("placeholder",void 0===i?"":i):e.medium.eq(t).attr("placeholder",l),""==s?e.responsive.eq(t).attr("placeholder",e.medium.eq(t).attr("placeholder")):e.responsive.eq(t).attr("placeholder",s)})},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),i="row",l=e(this).closest(".fl-field").attr("id").replace("fl-field-",""),s=FLBuilderResponsiveEditing._getFields(this,"input"),o=FLBuilderConfig.global,n=null,r=null,a=null,d=null;t.hasClass("fl-builder-row-settings")?i="row":t.hasClass("fl-builder-col-settings")?i="col":t.hasClass("fl-builder-module-settings")&&(i="module"),e.extend(o,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),n=i+"_"+l+("margin"===l?"s":""),r=o[n],a=o[n+"_medium"],d=o[n+"_responsive"],s["default"].each(function(e){var t=s["default"].eq(e).attr("name").split("_").pop(),n=s["default"].eq(e).val(),u=s.medium.eq(e).val(),c=(s.responsive.eq(e).val(),null),h=null;""===a&&(""!==n?s.medium.eq(e).attr("placeholder",n):""!==r&&s.medium.eq(e).attr("placeholder",r)),""===d&&("module"===i&&Number(o.auto_spacing)?(c=""===a?Number(r):a,h=""===u?Number(n):u,""!==h&&(h>c||h<0)?s.responsive.eq(e).attr("placeholder",c):""!==h?s.responsive.eq(e).attr("placeholder",h):s.responsive.eq(e).attr("placeholder",c)):(!Number(o.auto_spacing)||"padding"===l&&"top|bottom".indexOf(t)>-1)&&(""!==u?s.responsive.eq(e).attr("placeholder",u):""!==a?s.responsive.eq(e).attr("placeholder",a):""!==n?s.responsive.eq(e).attr("placeholder",n):""!==r&&s.responsive.eq(e).attr("placeholder",r)))})},_previewSpacingFields:function(){var t=FLBuilderResponsiveEditing._mode,i=e(".fl-builder-settings");0!==i.length&&void 0!==i.attr("data-node")&&i.find(".fl-field").has(".fl-field-responsive-setting").each(function(){var e=FLBuilderResponsiveEditing._getFields(this,"input"),i=e.responsive.closest(".fl-field").data("preview");"refresh"!=i.type&&e[t].trigger("keyup")})}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){FLBuilderResponsivePreview={enter:function(){this.render()},exit:function(){this.destroy()},switchTo:function(t){var i=FLBuilderConfig.global,l=e("#fl-builder-preview-frame"),s="100%";"responsive"==t?(s=i.responsive_breakpoint>=360?360:i.responsive_breakpoint,
7
- l.width(s)):"medium"==t&&(s=i.medium_breakpoint>=769?769:i.medium_breakpoint,l.width(s)),l.width(s)},render:function(){var t=e("body"),i=FLBuilderConfig.previewUrl,l=e("#fl-builder-preview-mask, #fl-builder-preview-frame"),s=e('<div id="fl-builder-preview-mask"></div>'),o=e('<iframe id="fl-builder-preview-frame" src="'+i+'" frameborder="0"></iframe>');l.remove(),t.append(s),t.append(o)},destroy:function(){e("#fl-builder-preview-mask, #fl-builder-preview-frame").remove()}}}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var i=e(".fl-builder-settings"),l=t.closest(".fl-builder-service-settings"),s=e(".fl-builder-service-error");i.append('<div class="fl-builder-loading"></div>'),l.addClass("fl-builder-service-settings-loading"),s.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),i=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),i.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this),s=l.closest("tr"),o=l.val();s.siblings("tr.fl-builder-service-account-row").remove(),s.siblings("tr.fl-builder-service-connect-row").remove(),s.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==o&&(t._startSettingsLoading(l),FLBuilder.ajax({action:"render_service_settings",node_id:i,service:o},t._serviceChangeComplete))},_serviceChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row");o.after(l.html),t._addAccountDelete(s),t._finishSettingsLoading()},_connectClicked:function(){for(var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-connect-row"),n=l.find(".fl-builder-service-connect-input"),r=null,a=null,d=0,u={action:"connect_service",node_id:i,service:s.val(),fields:{}};d<n.length;d++)r=n.eq(d),a=r.attr("name"),u.fields[a]=r.val();o.hide(),t._startSettingsLoading(s),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row"),n=s.find(".fl-builder-service-select"),r=s.find(".fl-builder-service-account-row"),a=s.find(".fl-builder-service-account-select"),d=s.find(".fl-builder-service-connect-row");l.error?(d.show(),0===a.length?n.after('<div class="fl-builder-service-error">'+l.error+"</div>"):a.after('<div class="fl-builder-service-error">'+l.error+"</div>")):(d.remove(),r.remove(),o.after(l.html)),t._addAccountDelete(s),t._finishSettingsLoading()},_accountChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-connect-row"),r=l.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=o.val(),u=null;n.remove(),r.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:i,service:s.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:i,service:s.val(),account:d}),u&&(t._startSettingsLoading(s),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(l)},_accountChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-account-row");o.after(l.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var i=e(this).closest(".fl-builder-service-settings"),l=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:l.val(),account:s.val()},t._accountDeleteComplete),t._startSettingsLoading(s))},_accountDeleteComplete:function(){var i=e(".fl-builder-service-settings-loading"),l=i.find(".fl-builder-service-select");t._finishSettingsLoading(),l.trigger("change")},_campaignMonitorClientChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=e(this),r=l.find(".fl-builder-service-list-select"),a=n.val();0!==r.length&&r.closest("tr").remove(),""!==a&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-campaign-monitor-client-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==n.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_id:n.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-list-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");list_type=l.find('select[name="list_type"]'),0!==n.length&&n.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-field-row");o.after(l.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilder._triggerSettingsSave(!1,!0)&&FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fa fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShow:function(){FLBuilder.ContentPanel.show("templates")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilder.ContentPanel.show("rows")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilder.ContentPanel.show("modules")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-content-panel-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fa fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.scrollTop(0),t.append('<div class="fl-builder-tour-mask"></div>'),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')}}}(jQuery),function(e,t){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),e.fn.textWidth=function(t,i){return e.fn.textWidth.fakeEl||(e.fn.textWidth.fakeEl=e("<span>").hide().appendTo(document.body)),e.fn.textWidth.fakeEl.text(t||this.val()||this.text()).css("font",i||this.css("font")),e.fn.textWidth.fakeEl.width()},FLExtendableObject={create:function(t){var i=Object.create(this);return i=e.extend(i,t),e(this).trigger("onCreate"),i}},e.fn.switchClass=function(t,i){return this.each(function(){return e(this).removeClass(function(e,i){var l=[],s=i.split(" ");for(var e in s)s[e].startsWith(t)&&l.push(s[e]);return l.join(" ")}),e(this).addClass(t+i)})};var i={init:function(){t.addHook("cancelTask",this.onCancelTask.bind(this)),t.addHook("showSavedMessage",this.onSaveShortcut.bind(this)),t.addHook("goToNextTab",this.onNextPrevTabShortcut.bind(this,"next")),t.addHook("goToPrevTab",this.onNextPrevTabShortcut.bind(this,"prev")),t.addHook("endEditingSession",this.onEndEditingSession.bind(this)),t.addHook("restartEditingSession",this.onRestartEditingSession.bind(this)),this.setDefaultKeyboardShortcuts()},addShortcut:function(t,i,l){var s=e.proxy(this,"onTriggerKey",t);l?Mousetrap.bindGlobal(i,s):Mousetrap.bind(i,s)},reset:function(){Mousetrap.reset()},setDefaultKeyboardShortcuts:function(){this.reset();for(var e in FLBuilderConfig.keyboardShortcuts){var t=FLBuilderConfig.keyboardShortcuts[e].keyCode,i=FLBuilderConfig.keyboardShortcuts[e].isGlobal;this.addShortcut(e,t,i)}},onTriggerKey:function(e,i){t.triggerHook(e),i.preventDefault?i.preventDefault():i.returnValue=!1},onCancelTask:function(){return o.isPreviewing?void o.endPreview():s.isShowing?void s.hide():t.ContentPanel.isShowing?void t.ContentPanel.hide():void 0},pause:function(){Mousetrap.pause()},unpause:function(){Mousetrap.unpause()},onEndEditingSession:function(){this.reset(),this.addShortcut("restartEditingSession","mod+e")},onRestartEditingSession:function(){this.reset(),this.setDefaultKeyboardShortcuts()},onSaveShortcut:function(){if(t.SaveManager.layoutNeedsPublish()){var e=FLBuilderStrings.savedStatus.hasAlreadySaved;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}else{var e=FLBuilderStrings.savedStatus.nothingToSave;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}},onNextPrevTabShortcut:function(i,l){var s,o,n=e(".fl-lightbox:visible"),r=n.find(".fl-builder-settings-tabs a");n.length>0&&(s=r.filter("a.fl-active"),o="next"==i?s.is(r.last())?r.first():s.next("a"):s.is(r.first())?r.last():s.prev("a"),o.trigger("click")),t._calculateSettingsTabsOverflow(),l.preventDefault()}},l={isShowing:!1,init:function(){this.render(),t.addHook("showKeyboardShortcuts",this.show.bind(this))},render:function(){var t=wp.template("fl-keyboard-shortcuts"),i=FLBuilderConfig.keyboardShortcuts;this.$el=e(t(i)),e("body").append(this.$el),this.$el.find(".dismiss-shortcut-ui").on("click",this.hide.bind(this)),this.$el.on("click",this.hide.bind(this))},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.isShowing=!0)},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.isShowing=!1)},toggle:function(){this.isShowing?this.hide():this.show()}},s=FLExtendableObject.create({isShowing:!1,init:function(){this.$el=e(".fl-builder-publish-actions"),this.$defaultBarButtons=e(".fl-builder-bar-actions"),this.$clickAwayMask=e(".fl-builder-publish-actions-click-away-mask"),this.$doneBtn=this.$defaultBarButtons.find(".fl-builder-done-button"),this.$doneBtn.on("click",this.onDoneTriggered.bind(this)),this.$actions=this.$el.find(".fl-builder-button"),this.$actions.on("click",this.onActionClicked.bind(this)),t.addHook("triggerDone",this.onDoneTriggered.bind(this));var i=this.hide.bind(this);t.addHook("cancelPublishActions",i),t.addHook("endEditingSession",i),this.$clickAwayMask.on("click",i)},onDoneTriggered:function(){t.SaveManager.layoutNeedsPublish()?this.show():FLBuilderConfig.shouldRefreshOnPublish?t._exit():t._exitWithoutRefresh()},show:function(){this.isShowing||t._triggerSettingsSave(!1,!0)&&(this.$el.removeClass("is-hidden"),this.$defaultBarButtons.css("opacity","0"),this.$clickAwayMask.show(),this.isShowing=!0,t.triggerHook("didShowPublishActions"))},hide:function(){this.isShowing&&(this.$el.addClass("is-hidden"),this.$defaultBarButtons.css("opacity","1"),this.$clickAwayMask.hide(),this.isShowing=!1)},onActionClicked:function(i){var l=e(i.currentTarget).data("action");switch(l){case"dismiss":this.hide();break;case"discard":this.hide(),o.muteToolbar(),t._discardButtonClicked();break;case"publish":this.hide(),o.muteToolbar(),t._publishButtonClicked(),t._destroyOverlayEvents();break;case"draft":this.hide(),o.muteToolbar(),t._draftButtonClicked();break;default:this.hide(),o.muteToolbar(),t._draftButtonClicked()}t.triggerHook(l+"ButtonClicked")}}),o={isPreviewing:!1,init:function(){this.$el=e("body"),this.$mainToolbar=e(".fl-builder-bar"),this.$mainToolbarContent=this.$mainToolbar.find(".fl-builder-bar-content"),this.$wpAdminBar=e("#wpadminbar"),this.$endPreviewBtn=e(".fl-builder--preview-actions .end-preview-btn"),t.addHook("endEditingSession",this.endEditingSession.bind(this)),t.addHook("previewLayout",this.togglePreview.bind(this)),this.$endPreviewBtn.on("click",this.endPreview.bind(this)),this.$deviceIcons=e(".fl-builder--preview-actions i"),this.$deviceIcons.on("click",this.onDeviceIconClick.bind(this));var i=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a, #wp-admin-bar-fl-theme-builder-frontend-edit-link > a");i.on("click",this.onClickPageBuilderToolbarLink.bind(this)),e("#wpadminbar a").attr("tabindex","-1");var l=this.restartEditingSession.bind(this);t.addHook("restartEditingSession",l),t.addHook("didHideAllLightboxes",this.unmuteToolbar.bind(this)),t.addHook("didCancelDiscard",this.unmuteToolbar.bind(this)),t.addHook("didEnterRevisionPreview",this.hide.bind(this)),t.addHook("didExitRevisionPreview",this.show.bind(this)),t.addHook("didPublishLayout",this.onPublish.bind(this))},endEditingSession:function(){t._destroyOverlayEvents(),t._removeAllOverlays(),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t._unbindEvents(),e("html").removeClass("fl-builder-edit").addClass("fl-builder-show-admin-bar"),e("body").removeClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex",null),e(t._contentClass).removeClass("fl-builder-content-editing"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init()},restartEditingSession:function(i){t._initTemplateSelector(),t._bindOverlayEvents(),t._highlightEmptyCols(),e("html").addClass("fl-builder-edit").removeClass("fl-builder-show-admin-bar"),e("body").addClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex","-1"),e(t._contentClass).addClass("fl-builder-content-editing"),this.showMainToolbar(),i.preventDefault()},onClickPageBuilderToolbarLink:function(e){t.triggerHook("restartEditingSession"),e.preventDefault()},onPublish:function(){var e=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a span");e.css("color","#6bc373")},hide:function(){e("html").hasClass("fl-builder-edit")&&(t._unbindEvents(),t._destroyOverlayEvents(),t._removeAllOverlays(),e("html").removeClass("fl-builder-edit"),e("body").removeClass("admin-bar"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init(),t.triggerHook("didHideEditingUI"))},show:function(){e("html").hasClass("fl-builder-edit")||(t._bindOverlayEvents(),this.showMainToolbar(),FLBuilderResponsiveEditing._switchTo("default"),e("html").addClass("fl-builder-edit"),e("body").addClass("admin-bar"),t.triggerHook("didShowEditingUI"))},beginPreview:function(){t._triggerSettingsSave(!1,!0)&&(this.isPreviewing=!0,this.hide(),e("html").addClass("fl-builder-preview"),e("html, body").removeClass("fl-builder-edit"),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t.triggerHook("didBeginPreview"),FLBuilderResponsivePreview.enter())},endPreview:function(){this.isPreviewing=!1,this.show(),t._highlightEmptyCols(),FLBuilderResponsivePreview.exit(),e("html").removeClass("fl-builder-preview"),e("html, body").addClass("fl-builder-edit")},togglePreview:function(){this.isPreviewing?this.endPreview():this.beginPreview()},hideMainToolbar:function(){this.$mainToolbar.addClass("is-hidden"),e("html").removeClass("fl-builder-is-showing-toolbar")},showMainToolbar:function(){this.unmuteToolbar(),this.$mainToolbar.removeClass("is-hidden"),e("html").addClass("fl-builder-is-showing-toolbar")},onDeviceIconClick:function(t){var i=e(t.target).data("mode");FLBuilderResponsivePreview.switchTo(i)},muteToolbar:function(){this.$mainToolbarContent.addClass("is-muted"),t._hideTipTips()},unmuteToolbar:function(){this.$mainToolbarContent.removeClass("is-muted")}},n={isEditing:!0,init:function(){history.pushState&&(t.addHook("endEditingSession",this.onLeaveBuilder.bind(this)),t.addHook("restartEditingSession",this.onEnterBuilder.bind(this)))},onEnterBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.editUrl),this.isEditing=!0},onLeaveBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.url),this.isEditing=!1}},r={$row:null,$rowContent:null,row:null,drag:{},init:function(){if(this.userCanResize()){var i=e(t._contentClass);i.delegate(".fl-block-row-resize","mouseenter",this.onDragHandleHover.bind(this)),i.delegate(".fl-block-row-resize","mousedown",this.onDragHandleDown.bind(this))}},userCanResize:function(){return FLBuilderConfig.rowResize.userCanResizeRows},onDragHandleHover:function(t){if(!this.drag.isDragging){var i=e(t.target);this.$row=i.closest(".fl-row"),this.$rowContent=this.$row.find(".fl-row-content"),this.row={node:this.$row.data("node"),isFixedWidth:this.$row.hasClass("fl-row-fixed-width"),settings:e(".fl-builder-row-settings[data-node="+this.$row.data("node")+"]")},this.drag={edge:null,isDragging:!1,originalPosition:null,originalWidth:null,calculatedWidth:null,operation:null},this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),this.dragInit()}},onDragHandleDown:function(){e("body").addClass("fl-builder-row-resizing")},dragInit:function(e){this.$row.find(".fl-block-row-resize").draggable({axis:"x",start:this.dragStart.bind(this),drag:this.dragging.bind(this),stop:this.dragStop.bind(this)})},dragStart:function(i,l){var s=e("body"),o=e(l.helper);this.drag.isDragging=!0,this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),o.hasClass("fl-block-col-resize-e")&&(this.drag.edge="e",this.$feedback=o.find(".fl-block-col-resize-feedback-left")),o.hasClass("fl-block-col-resize-w")&&(this.drag.edge="w",this.$feedback=o.find(".fl-block-col-resize-feedback-right")),s.addClass("fl-builder-row-resizing"),t._colResizing=!0,t._destroyOverlayEvents(),t._closePanel()},dragging:function(e,t){var i=t.position.left,l=t.originalPosition.left,s=this.drag.originalWidth,o=0,n=this.drag.edge,r=FLBuilderConfig.rowResize.minAllowedWidth,a=FLBuilderConfig.rowResize.maxAllowedWidth;l!==i&&(FLBuilderConfig.isRtl&&(n="w"==n?"e":"w"),l>i?"w"===n?this.drag.operation="+":this.drag.operation="-":"e"===n?this.drag.operation="+":this.drag.operation="-",o=Math.abs(l-i),"+"===this.drag.operation?this.drag.calculatedWidth=s+2*o:this.drag.calculatedWidth=s-2*o,!1!==r&&this.drag.calculatedWidth<r&&(this.drag.calculatedWidth=r),!1!==a&&this.drag.calculatedWidth>a&&(this.drag.calculatedWidth=a),this.row.isFixedWidth&&this.$row.css("max-width",this.drag.calculatedWidth+"px"),this.$rowContent.css("max-width",this.drag.calculatedWidth+"px"),_.isUndefined(this.$feedback)||this.$feedback.html(this.drag.calculatedWidth+"px").show(),this.row.settings.length&&this.row.settings.find("[name=max_content_width]").val(this.drag.calculatedWidth))},dragStop:function(i,l){this.drag.isDragging=!1,_.isUndefined(this.$feedback)||this.$feedback.hide();var s={action:"resize_row_content",node:this.row.node,width:this.drag.calculatedWidth},o=e("body");t.ajax(s),t._bindOverlayEvents(),o.removeClass("fl-builder-row-resizing"),e(".fl-block-overlay").each(function(){t._buildOverlayOverflowMenu(e(this))}),e("body").removeClass("fl-builder-row-resizing"),setTimeout(function(){t._colResizing=!1},50),t.triggerHook("didResizeRow",{rowId:this.row.node,rowWidth:this.drag.calculatedWidth})}},a={templateName:"fl-toolbar",init:function(){this.template=wp.template(this.templateName),this.render(),this.initTipTips();var e=this.$el.find(".fl-builder-content-panel-button");e.on("click",t._togglePanel),this.$el.find(".fl-builder-buy-button").on("click",t._upgradeClicked),this.$el.find(".fl-builder-upgrade-button").on("click",t._upgradeClicked)},render:function(t){var i=e(this.template(t));this.$el=i,this.el=i.get(0),o.$mainToolbar=this.$el,e("body").prepend(i),e("html").addClass("fl-builder-is-showing-toolbar")},initTipTips:function(){e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}),e(".fl-builder-publish-actions .fl-builder-button-group .fl-builder-button").tipTip({defaultPosition:"bottom",edgeOffset:6})}};e(function(){t.ContentPanel.init(),FLBuilderConfig.simpleUi||t.MainMenu.init(),FLBuilderConfig.showToolbar?(a.init(),t.ContentPanel.alignPanelArrow()):e("html").addClass("fl-builder-no-toolbar"),i.init(),l.init(),o.init(),n.init(),r.init(),s.init(),t.triggerHook("didInitUI")})}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({templateName:"fl-main-menu-panel-view",name:"Untitled View",isShowing:!1,isRootView:!1,items:{},init:function(){this.template=wp.template(this.templateName)},render:function(){return this.template(this)},bindEvents:function(){this.$items=this.$el.find(".fl-builder--menu-item")},show:function(){this.$el.addClass("is-showing")},hide:function(){this.$el.removeClass("is-showing")},transitionIn:function(e){requestAnimationFrame(this.show.bind(this))},transitionOut:function(e){this.hide()}}),l=FLExtendableObject.create({templateName:"fl-main-menu-panel",template:null,menu:null,views:{},viewNavigationStack:[],isShowing:!1,shouldShowTabs:!1,init:function(){this.template=wp.template(this.templateName),e("body").prepend(this.template(this)),this.$el=e(".fl-builder--main-menu-panel"),this.$el.find(".fl-builder--main-menu-panel-views").html("");for(var i in FLBuilderConfig.mainMenu){this.renderPanel(i);var l="render"+i.charAt(0).toUpperCase()+i.slice(1)+"Panel";t.addHook(l,e.proxy(function(){this.renderPanel(i)},this))}e("body").on("click",".fl-builder--main-menu-panel .pop-view",this.goToPreviousView.bind(this)),this.$tabs=this.$el.find(".fl-builder--tabs > span"),this.$tabs.on("click",this.onItemClick.bind(this)),this.$barTitle=e(".fl-builder-bar-title"),e("body").on("click",".fl-builder-bar-title",this.toggle.bind(this));var n=this.hide.bind(this);t.addHook("didShowPublishActions",n),t.addHook("didBeginSearch",n),t.addHook("didBeginPreview",n),t.addHook("didShowContentPanel",n),t.addHook("endEditingSession",n),t.addHook("didFocusSearchBox",n),t.addHook("didEnterRevisionPreview",n),t.addHook("didFailSettingsSave",n),t.addHook("showKeyboardShortcuts",n),this.$mask=e(".fl-builder--main-menu-panel-mask"),this.$mask.on("click",n),s.init(),o.init()},renderPanel:function(t){var l,s,o;e('fl-builder--main-menu-panel-view[data-name="'+t+'"]').remove(),l=FLBuilderConfig.mainMenu[t],l.handle=t,s=i.create(l),s.init(),o=e(s.render()),s.$el=o,e(".fl-builder--main-menu-panel-views").append(o),s.bindEvents(),s.$el.find(".fl-builder--menu-item").on("click",this.onItemClick.bind(this)),s.isRootView&&(this.rootView=s,this.currentView=s),this.views[t]=s},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.$barTitle.addClass("is-showing-menu"),this.currentView.transitionIn(),this.isShowing=!0,this.$mask.show(),t.triggerHook("didOpenMainMenu"))},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.$barTitle.removeClass("is-showing-menu"),this.isShowing=!1,this.resetViews(),this.$mask.hide())},toggle:function(){this.isShowing?this.hide():this.show()},onItemClick:function(i){var l=e(i.currentTarget),s=l.data("type");switch(s){case"view":var o=l.data("view");this.goToView(o);break;case"event":var n=l.data("event");t.triggerHook(n,l);break;case"link":}},goToView:function(e){var t=this.currentView,i=this.views[e];t.transitionOut(),i.transitionIn(),this.currentView=i,this.viewNavigationStack.push(t)},goToPreviousView:function(){var t=this.currentView,i=this.viewNavigationStack.pop();t.transitionOut(!0),i.transitionIn(!0),this.currentView=i,e(".fl-builder-bar-title-caret").focus()},resetViews:function(){this.currentView!=this.rootView&&(this.currentView.hide(),this.rootView.show(),this.currentView=this.rootView,this.viewNavigationStack=[])}});t.MainMenu=l;var s={init:function(){t.addHook("saveTemplate",this.saveTemplate.bind(this)),t.addHook("saveCoreTemplate",this.saveCoreTemplate.bind(this)),t.addHook("duplicateLayout",this.duplicateLayout.bind(this)),t.addHook("showLayoutSettings",this.showLayoutSettings.bind(this)),t.addHook("showGlobalSettings",this.showGlobalSettings.bind(this)),t.addHook("toggleUISkin",this.toggleUISkin.bind(this)),t.addHook("clearLayoutCache",this.clearLayoutCache.bind(this))},saveTemplate:function(){t._saveUserTemplateClicked(),l.hide()},saveCoreTemplate:function(){FLBuilderCoreTemplatesAdmin._saveClicked(),l.hide()},duplicateLayout:function(){t._duplicateLayoutClicked(),l.hide()},showGlobalSettings:function(){t._globalSettingsClicked(),l.hide()},showLayoutSettings:function(){t._layoutSettingsClicked(),l.hide()},clearLayoutCache:function(){t.ajax({action:"clear_cache"},function(){location.href=FLBuilderConfig.editUrl}),t.showAjaxLoader(),l.hide()},toggleUISkin:function(i){e('a[data-event="toggleUISkin"]');if(e("body").hasClass("fl-builder-ui-skin--light"))var l="light",s="dark";if(e("body").hasClass("fl-builder-ui-skin--dark"))var l="dark",s="light";e("body").removeClass("fl-builder-ui-skin--"+l).addClass("fl-builder-ui-skin--"+s),t.ajax({action:"save_ui_skin",skin_name:s})}},o={init:function(){t.addHook("beginTour",this.onStartTourClicked.bind(this))},onStartTourClicked:function(){FLBuilderTour.start(),l.hide()}}}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({handle:"",name:"",panel:null,shouldShowTabItem:!0,isShowing:!1,views:{},activeView:null,defaultView:null,categorySelector:null,init:function(i){this.categorySelector=a.create({handle:"selector-"+this.handle,tab:this,items:[]}),this.categorySelector.init(),e(this.categorySelector).on("categorySelected",this.onViewSelected.bind(this));i.views;if(this.initViews(i.views),0===Object.keys(this.views).length){var l={handle:"noViews",name:"No Views",templateName:"fl-content-panel-no-view"};this.addView(l)}if(!this.activeView){var s=Object.keys(this.views)[0],l=this.views[s];
8
- this.activeView=l}this.defaultView=this.activeView,e(this.panel).on("afterRender",this.renderView.bind(this,this.activeView)),e(this.panel).on("onShow onShowTab",this.initScroller.bind(this)),t.addHook("contentItemsChanged",this.onLibraryDataChanged.bind(this))},initViews:function(e){for(var t in e){var i=e[t];this.categorySelector.addItem(i),"separator"!==i.type&&this.addView(i)}},addView:function(e){var t=l;switch(this.handle){case"modules":t=s;break;case"rows":t=o;break;case"templates":t=n;break;case"saved":t=r;break;default:t=l}_.isNull(this.viewController)||_.isUndefined(this.viewController)||(t=window[this.viewController]);var i=t.create(e),a=i.handle;i.init(),this.views[a]=i,i.isShowing&&(this.activeView=i)},renderView:function(e){if(this.$el=this.panel.$el.find('.fl-builder--panel-view[data-tab="'+this.handle+'"]'),_.isObject(e))var i=e;else var i=this.views[e];if(_.isObject(i)&&_.isFunction(i.render)){var l=i.render();this.$el.find(".fl-nanoscroller-content").html(l),this.activeView=i,t._initSortables(),this===this.panel.activeTab&&this.renderGroupSelector(),this.initScroller(),this.$el.find(".fl-nanoscroller-content").scrollTop(0)}},initScroller:function(){this.$el.nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},show:function(){e(this.activeView).trigger("onBeforeShow"),this.renderGroupSelector(),this.isShowing=!0,this.$el.addClass("is-showing"),this.$el.find(".fl-nanoscroller-content").scrollTop(0)},hide:function(){this.isShowing=!1,this.$el.removeClass("is-showing"),this.activeView!==this.defaultView&&this.renderView(this.defaultView),_.isObject(this.categorySelector)&&this.categorySelector.close()},renderGroupSelector:function(){var e=this.panel.$groupSelect,t=this.panel.$el.find(".fl-builder-panel-search");if(this.isSearchEnabled?t.show():t.hide(),Object.keys(this.views).length>1&&!_.isUndefined(this.categorySelector)){var i=this.categorySelector.render();this.panel.$el.find(".fl-builder-content-group-select");e.html(i),e.show(),this.panel.$el.removeClass("single-view")}else e.hide(),t.hide(),this.panel.$el.addClass("single-view")},onViewSelected:function(e,t){this.renderView(t),this.categorySelector.close()},onLibraryDataChanged:function(){this.renderView(this.activeView)}}),l=FLExtendableObject.create({templateName:"",name:"",handle:"",query:null,init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this).trigger("afterInit")},filterTemplateData:function(e){return _.isNull(this.query)||_.isUndefined(this.query)||(e.queryResults=t.Search.byQuery(this.query)),e},render:function(){e(this).trigger("beforeRender");var t=this;t=this.filterTemplateData(t);var i=e(this.template(t));return this.$el=i,e(this).trigger("afterRender"),i},bindEvents:function(){},transitionIn:function(){},transitionOut:function(){}}),s=l.create({templateName:"fl-content-panel-modules-view",bindEvents:function(){this.$sections=this.$el,this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),o=l.create({templateName:"fl-content-panel-row-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),n=l.create({templateName:"fl-content-panel-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder--template-collection-item"),this.$items.on("click",this.onTemplateClick.bind(this)),this.$userTemplateSections=e(".fl-user-templates"),this.$userTemplates=this.$el.find(".fl-user-template, .fl-builder--save-new-user-template"),this.$saveNewTemplateInput=this.$el.find('.fl-save-control input[name="template-name"]'),this.$saveNewTemplateCat=this.$el.find('.fl-save-control input[name="template-category"]'),this.$saveNewTemplateBtn=this.$el.find(".fl-save-control button"),this.$saveNewMask=this.$el.find(".fl-save-control-mask"),this.$saveNewTemplateInput.on("focus",this.onSaveInputFocus.bind(this)),this.$saveNewTemplateInput.on("keyup",this.onSaveInputKeyup.bind(this)),this.$saveNewTemplateBtn.on("click",this.onSaveButtonClick.bind(this)),this.$saveNewMask.on("click",this.resetSaveInput.bind(this))},onSaveInputFocus:function(){this.resetSaveInput(),this.$saveNewMask.show()},resetSaveInput:function(){this.$saveNewTemplateInput.val(""),this.$saveNewTemplateBtn.hide(),this.$saveNewMask.hide()},onSaveInputKeyup:function(t){var i=e(t.currentTarget),l=i.val(),s=i.siblings("button");""!==l?s.show():s.hide()},onSaveButtonClick:function(i){var l=e(i.currentTarget),s=l.siblings('input[name="template-name"]').val(),o=l.siblings('input[name="template-category"]').val(),n={name:s,category:o};""!==s&&t.ajax({action:"save_user_template",settings:n},t._saveUserTemplateSettingsComplete)},onTemplateClick:function(i){var l=e(i.currentTarget),s=l.data("id"),o=l.data("type");t._requestTemplateInsert(s,o)}}),r=l.create({templateName:"fl-content-panel-saved-view",filterTemplateData:function(e){return e.queryResults=t.Search.byQuery({kind:"template",type:"user",content:["module","row"]}),e}}),a=FLExtendableObject.create({templateName:"fl-content-panel-category-selector",template:null,tab:null,isOpen:!1,items:{},init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this.tab.panel).on("didShowSearchControls",this.close.bind(this))},render:function(){this.close();var t=e(this.template(this));return this.$el=t,e(this).trigger("afterRender"),t},bindEvents:function(){this.$selectorTitle=this.$el.find(".fl-builder--selector-display"),this.$selectorTitle.on("click",this.toggleOpenClose.bind(this)),this.$categories=this.$el.find(".fl-builder--selector-menu .fl-builder--menu-item"),this.$categories.on("click",this.onCategoryClick.bind(this))},addItem:function(e){var t;t=_.isUndefined(e.handle)?_.uniqueId("sep_"):e.handle,this.items[t]=e},open:function(){this.isOpen||(this.$el.addClass("is-showing"),this.isOpen=!0)},close:function(){this.isOpen&&(this.$el.removeClass("is-showing"),this.isOpen=!1,this.$selectorTitle.find("button").focus())},toggleOpenClose:function(){this.isOpen?this.close():this.open()},onCategoryClick:function(t){var i=e(t.target).data("view");e(this).trigger("categorySelected",i)}});t.ContentPanel=FLExtendableObject.create({templateName:"fl-content-panel-base",template:null,tabs:{},activeTab:null,isShowing:!1,init:function(){if(FLBuilderConfig.panelData){var e=FLBuilderConfig.panelData.tabs;for(var l in e){var s=e[l];if(n=i.create(s),n.panel=this,n.views={},n.init(s),this.tabs[l]=n,n.isShowing&&(this.activeTab=n),!this.activeTab){var o=Object.keys(this.tabs)[0],n=this.tabs[o];n.isShowing=!0,this.activeTab=n}}this.template=wp.template(this.templateName),this.render(),this.renderSearchResults=wp.template("fl-search-results-panel"),this.renderNoResults=wp.template("fl-search-no-results"),t.triggerHook("contentPanelDidInit")}},render:function(){e("body").prepend(this.template(this)),this.$el=e(".fl-builder--content-library-panel"),this.bindEvents(),this.$groupSelect=this.$el.find(".fl-builder-content-group-select"),e(this).trigger("afterRender")},bindEvents:function(){this.$tabs=this.$el.find(".fl-builder--tabs [data-tab]"),this.$tabs.on("mouseup",this.onTabItemMouseUp.bind(this)),this.$tabs.on("click",this.onTabItemClick.bind(this)),this.$search=this.$el.find(".fl-builder-panel-search"),this.$searchBtn=this.$search.find(".fl-builder-toggle-panel-search"),this.$searchInput=this.$search.find('input[name="search-term"]'),this.$searchBtn.on("click",this.onSearchButtonClicked.bind(this)),this.$search.find(".fl-builder-dismiss-panel-search").on("click",this.onDismissButtonClicked.bind(this)),this.$searchInput.on("keyup",this.onSearchTermChanged.bind(this)),this.$searchPanel=this.$el.find(".fl-builder--search-results-panel"),t.addHook("showContentPanel",this.show.bind(this)),t.addHook("showModules",this.show.bind(this,"modules")),t.addHook("showRows",this.show.bind(this,"rows")),t.addHook("showTemplates",this.show.bind(this,"templates")),t.addHook("showSaved",this.show.bind(this,"saved")),t.addHook("showSearch",this.goToSearch.bind(this));var e=this.hide.bind(this);t.addHook("hideContentPanel",e),t.addHook("didShowLightbox",e),t.addHook("didShowPublishActions",e),t.addHook("didBeginSearch",e),t.addHook("didInitDrag",e),t.addHook("didOpenMainMenu",e),t.addHook("didApplyTemplate",e);var i=this.toggleShowHide.bind(this);t.addHook("toggleContentPanel",i),t.addHook("didStopDrag",this.hideSearchControls.bind(this))},alignPanelArrow:function(){var t,i,l=this.$el,s=null,o=this.$el.find(".fl-builder--panel-arrow"),n=e(".fl-builder-content-panel-button"),r=this.$el.css("animation-duration");if(0!=n.length){this.$el.css("animation-duration","0s"),this.show(),s=l[0].getBoundingClientRect(),t=o[0].getBoundingClientRect(),this.hide(),this.$el.css("animation-duration",r),buttonOffset=n[0].getBoundingClientRect();var a=buttonOffset.x+buttonOffset.width/2;i=a<s.x?20:a-s.x-t.width/2,o.css({right:"auto",left:i+"px"})}},show:function(i){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(t.triggerHook("willShowContentPanel"),"undefined"!=typeof i&&this.showTab(i),this.isShowing||t._triggerSettingsSave(!1,!0)&&(e("body").addClass("fl-builder-content-panel-is-showing"),this.isShowing=!0,e(this).trigger("onShow"),t.triggerHook("didShowContentPanel")))},hide:function(){this.isShowing&&(this.$el.hasClass("fl-builder-ui-pinned")||(e("body").removeClass("fl-builder-content-panel-is-showing"),this.isShowing=!1,e(this).trigger("onHide"),t.triggerHook("didHideContentPanel")))},toggleShowHide:function(){this.isShowing?this.hide():this.show()},showTab:function(t){var i=this.tabs[t];_.isObject(i)&&(_.isObject(this.activeTab)&&(this.activeTab.hide(),this.$tabs.filter(".is-showing").removeClass("is-showing")),this.hideSearchControls(),i.show(),this.$tabs.filter('[data-tab="'+i.handle+'"]').addClass("is-showing"),this.activeTab=i,e(this).trigger("onShowTab"))},goToSearch:function(){this.show("modules"),this.$el.find(".fl-builder-toggle-panel-search").trigger("click")},onTabItemMouseUp:function(t){e(t.currentTarget).blur()},onTabItemClick:function(t){var i=e(t.target),l=i.data("tab");this.showTab(l)},onSearchButtonClicked:function(){this.showSearchControls()},onDismissButtonClicked:function(){this.hideSearchControls(),this.$searchBtn.focus()},showSearchControls:function(){this.$search.addClass("is-showing-input"),this.$search.find('input[name="search-term"]').focus(),e(".fl-builder--selector-display-label").attr("tabindex",-1),this.$searchBtn.attr("tabindex",-1),e(this).trigger("didShowSearchControls")},hideSearchControls:function(){this.$search.removeClass("is-showing-input"),this.clearSearchInput(),this.hideSearchResults(),e(".fl-builder--selector-display-label").attr("tabindex",null),this.$searchBtn.attr("tabindex",null)},onSearchTermChanged:function(e){var i=this.$searchInput.val();if(""!==i){var l=t.Search.byTerm(i);""!=l.term?this.showSearchResults(l):this.hideSearchResults()}else this.hideSearchResults()},clearSearchInput:function(){this.$searchInput.val(""),this.hideSearchResults()},showSearchResults:function(i){if(i.total>0){var l=e(this.renderSearchResults(i));this.$searchPanel.html(l),t._initSortables()}else{var l=e(this.renderNoResults(i));this.$searchPanel.html(l)}e("body").addClass("fl-builder-search-results-panel-is-showing")},hideSearchResults:function(){e("body").removeClass("fl-builder-search-results-panel-is-showing")}})}(jQuery,FLBuilder),function(e){FLBuilderSettingsForms={config:null,settings:null,legacyXhr:null,init:function(){this.bind()},bind:function(){FLBuilder.addHook("didDeleteRow",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteColumn",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteModule",this.closeOnDeleteNode)},render:function(t,i){var l=FLBuilderSettingsConfig.forms,s=FLBuilderSettingsConfig.modules,o={type:"general",id:null,nodeId:null,className:"",attrs:"",title:"",badges:[],tabs:[],buttons:[],settings:{},legacy:null,rules:null,preview:null,helper:null};if(t.nodeId&&!t.settings)return void this.loadNodeSettings(t,i);if(t=e.extend(o,t),i=void 0===i?function(){}:i,t.id){if("general"===t.type&&void 0!==l[t.id])t=e.extend(!0,t,l[t.id]);else{if("module"!==t.type||void 0===s[t.id])return;t=e.extend(!0,t,s[t.id])}this.config=t,this.renderLightbox(t)&&(t.legacy||!this.renderLegacySettings(t,i)?this.renderComplete(t,i):this.showLightboxLoader())}},loadNodeSettings:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"get_node_settings",node_id:e.nodeId},function(i){e.settings=JSON.parse(i),FLBuilderSettingsConfig.nodes[e.nodeId]=e.settings,FLBuilderSettingsForms.render(e,t),FLBuilder.hideAjaxLoader()})},renderLightbox:function(t){var i=wp.template("fl-builder-settings"),l=FLBuilder._lightbox._node.find("form.fl-builder-settings");e(".fl-lightbox-wrap[data-parent]");if(t.nodeId&&t.nodeId===l.data("node")&&!t.lightbox)return FLBuilder._focusFirstSettingsControl(),!1;if(t.lightbox)t.lightbox.setContent(i(t));else{if(!FLBuilder._triggerSettingsSave(!0,!0))return!1;FLBuilder.preview&&FLBuilder.preview.cancel(),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder._setLightboxContent(i(t))}return!0},renderComplete:function(t,i){var l=e(".fl-builder-settings:visible");setTimeout(function(){t.legacy&&this.renderLegacySettingsComplete(t.legacy),i(),FLBuilder._initSettingsForms(),t.rules&&FLBuilder._initSettingsValidation(t.rules),t.preview&&(FLBuilder.preview=new FLBuilderPreview(t.preview)),t.helper&&t.helper.init(),l.closest(".fl-lightbox-wrap[data-parent]").length||(this.settings=FLBuilder._getSettings(l))}.bind(this),1)},renderFields:function(t,i){var l=wp.template("fl-builder-settings-row"),s="",o=null,n=null,r=null,a=!1,d=null,u=["dimension","unit"],i=i?i:this.config.settings,c=FLBuilderConfig.global;for(n in t)o=t[n],a=!!o.multiple,supportsResponsive=e.inArray(o.type,u)>-1,r=_.isUndefined(i[n])?"":i[n],_.isUndefined(i[n])&&o["default"]&&(r=o["default"]),d=o.responsive&&c.responsive_enabled&&!a&&supportsResponsive?o.responsive:null,s+=l({field:o,name:n,rootName:n,value:r,preview:JSON.stringify(o.preview?o.preview:{type:"refresh"}),responsive:d,rowClass:o.row_class?" "+o.row_class:"",isMultiple:a,supportsMultiple:"editor"!==o.type&&"photo"!==o.type&&"service"!==o.type,settings:i,globalSettings:c,template:e("#tmpl-fl-builder-field-"+o.type)});return s},renderField:function(e){var t=wp.template("fl-builder-field");return t(e)},renderSectionTemplate:function(e,t){var i=wp.template(e.template.id);return i({section:e,settings:t})},renderTabTemplate:function(e,t){var i=wp.template(e.template.id);return i({tab:e,settings:t})},renderLegacySettings:function(t,i){var l=e(".fl-builder-settings:visible"),s=null,o=!1,n={tabs:[],sections:[],fields:[],settings:null,node_id:null};return l.find(".fl-legacy-field").each(function(){s=e(this),n.fields.push(s.attr("data-field")),FLBuilderSettingsForms.showFieldLoader(s),o=!0}),l.find(".fl-legacy-settings-section").each(function(){s=e(this),n.sections.push({tab:s.attr("data-tab"),section:s.attr("data-section")}),o=!0}),l.find(".fl-legacy-settings-tab").each(function(){s=e(this),n.tabs.push(s.attr("data-tab")),o=!0}),l.attr("data-node")?n.node_id=l.attr("data-node"):n.settings=FLBuilder._getOriginalSettings(l,!0),this.legacyXhr&&(this.legacyXhr.abort(),this.legacyXhr=null),this.legacyXhr=FLBuilder.ajax(e.extend(this.getLegacyVars(),{action:"render_legacy_settings",data:n,form:l.attr("data-form-id"),group:l.attr("data-form-group"),lightbox:l.closest(".fl-builder-lightbox").attr("data-instance-id")}),function(e){FLBuilderSettingsForms.renderLegacySettingsComplete(e),o&&FLBuilderSettingsForms.renderComplete(t,i),FLBuilderSettingsForms.hideLightboxLoader()}),o},renderLegacySettingsComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=null,s=null,o="",n=null,r=null,a=null;if(i.lightbox?(l=e(".fl-builder-lightbox[data-instance-id="+i.lightbox+"]"),s=l.length?l.find(".fl-builder-settings"):null):(s=e(".fl-builder-settings:visible"),l=s.closest(".fl-builder-lightbox")),s&&s.length){for(o in i.fields)n=e("#fl-field-"+o).attr("id",""),n.after(i.fields[o]).remove();for(o in i.extras)n=e("#fl-field-"+o).find(".fl-field-control-wrapper"),n.prepend(i.extras[o].before),n.append(i.extras[o].after);for(a in i.sections)for(o in i.sections[a])r=e("#fl-builder-settings-section-"+o),r.html(i.sections[a][o]);for(o in i.tabs)a=e("#fl-builder-settings-tab-"+o),a.html(i.tabs[o]);l.data("parent")||(this.settings=FLBuilder._getSettings(s),FLBuilder.preview&&(FLBuilder.preview._savedSettings=this.settings)),_.isUndefined(window.FLThemeBuilderFieldConnections)||FLThemeBuilderFieldConnections._initSettingsForms(),this.legacyXhr=null}},getLegacyVars:function(){var t=e(".fl-builder-settings:visible"),i=t.closest(".fl-builder-lightbox"),l=i.attr("data-parent"),s=null,o=null,n={};return l&&(l=e(".fl-builder-lightbox[data-instance-id="+l+"]"),t=l.find("form.fl-builder-settings"),s=FLBuilder._getSettings(t),o=t.attr("data-node"),o&&(n.node_id=o,n.node_settings=s)),n},settingsHaveChanged:function(){var e=FLBuilder._lightbox._node.find("form.fl-builder-settings"),t=FLBuilder._getSettings(e),i=!!this.settings&&JSON.stringify(this.settings)!=JSON.stringify(t);return i},closeOnDeleteNode:function(t,i){var l=e(".fl-builder-settings[data-node]"),s=FLBuilder._contentClass+" .fl-node-"+l.data("node");l.length&&!e(s).length&&FLLightbox.closeAll()},showLightboxLoader:function(){e(".fl-builder-settings:visible").append('<div class="fl-builder-loading"></div>')},hideLightboxLoader:function(t){e(".fl-builder-settings:visible .fl-builder-loading").remove()},showFieldLoader:function(e){var t=e.closest(".fl-field-control").find(".fl-field-control-wrapper");t.hide().after('<div class="fl-field-loader">'+FLBuilderStrings.fieldLoading+"</div>")},hideFieldLoader:function(e){var t=e.closest(".fl-field"),i=e.closest(".fl-field-control").find(".fl-field-control-wrapper");i.show(),t.find(".fl-field-loader").remove()}},FLBuilderSettingsConfig="undefined"==typeof FLBuilderSettingsConfig?{}:FLBuilderSettingsConfig,e.extend(FLBuilderSettingsConfig,{init:function(){FLBuilder.addHook("didSaveNodeSettings",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveNodeSettingsComplete",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveGlobalSettingsComplete",this.updateOnSaveGlobalSettings.bind(this)),FLBuilder.addHook("didSaveLayoutSettingsComplete",this.updateOnSaveLayoutSettings.bind(this)),FLBuilder.addHook("didAddRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumnGroup",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didResizeRow",this.updateOnRowResize.bind(this)),FLBuilder.addHook("didResizeColumn",this.updateOnColumnResize.bind(this)),FLBuilder.addHook("didResetRowWidth",this.updateOnResetRowWidth.bind(this)),FLBuilder.addHook("didResetColumnWidths",this.updateOnResetColumnWidths.bind(this)),FLBuilder.addHook("didApplyTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didApplyRowTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didSaveGlobalNodeTemplate",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didRestoreRevisionComplete",this.updateOnApplyTemplate.bind(this))},updateOnSaveGlobalSettings:function(e,t){this.settings.global=t},updateOnSaveLayoutSettings:function(e,t){this.settings.layout=t},updateOnNodeEvent:function(){var e=arguments[0];e.namespace.indexOf("didAdd")>-1?this.addNode(arguments[1]):e.namespace.indexOf("didSaveNodeSettings")>-1?this.updateNode(arguments[1].nodeId,arguments[1].settings):e.namespace.indexOf("didDelete")>-1?this.deleteNodes():e.namespace.indexOf("didDuplicate")>-1&&this.duplicateNode(arguments[1].oldNodeId,arguments[1].newNodeId)},updateOnRowResize:function(e,t){this.nodes[t.rowId].max_content_width=t.rowWidth},updateOnResetRowWidth:function(e,t){this.nodes[t].max_content_width=""},updateOnColumnResize:function(e,t){this.nodes[t.colId].size=t.colWidth,this.nodes[t.siblingId].size=t.siblingWidth},updateOnResetColumnWidths:function(t,i){var l=this;i.cols.each(function(){var t=e(this),i=t.attr("data-node");l.nodes[i]&&(l.nodes[i].size=parseFloat(t[0].style.width))})},updateOnApplyTemplate:function(e,t){this.nodes=t.nodes,this.attachments=t.attachments},addNode:function(t,i){var l=e(".fl-node-"+t),s=l.hasClass("fl-row"),o=l.hasClass("fl-col"),n=l.hasClass("fl-col-group"),r=l.hasClass("fl-module"),a=this;this.nodes[t]||(i||(s?i=e.extend({},this.defaults.row):o?i=e.extend({},this.defaults.column):r&&(i=e.extend({},this.defaults.modules[l.attr("data-type")])),s||n?l.find(".fl-col").each(function(){var t=e(this),i=e.extend({},a.defaults.column);i.size=parseFloat(t[0].style.width),a.addNode(t.attr("data-node"),i)}):r&&(a.addNode(l.closest(".fl-row").attr("data-node")),a.addNode(l.closest(".fl-col").attr("data-node")),a.updateOnResetColumnWidths(null,{cols:l.closest(".fl-col-group").find("> .fl-col")}))),i&&(this.nodes[t]=i))},updateNode:function(t,i){var l=e(".fl-node-"+t),s=this;l.hasClass("fl-col")&&l.closest(".fl-col-group").find("> .fl-col").each(function(){var t=e(this),l=t.attr("data-node");s.nodes[l].size=parseFloat(t[0].style.width),s.nodes[l].equal_height=i.equal_height,s.nodes[l].content_alignment=i.content_alignment,s.nodes[l].responsive_order=i.responsive_order}),this.nodes[t]=i},duplicateNode:function(t,i){var l=e(".fl-node-"+i),s=l.find("[data-node]"),o=e(".fl-node-"+t),n=o.find("[data-node]"),r=this;this.nodes[i]=this.nodes[t],s.each(function(l){t=n.eq(l).attr("data-node"),i=e(this).attr("data-node"),r.nodes[t]&&(r.nodes[i]=r.nodes[t])})},deleteNodes:function(){var t="",i=e(FLBuilder._contentClass).html();for(t in this.nodes)i.indexOf(t)===-1&&(this.nodes[t]=null,delete this.nodes[t])}}),e(function(){FLBuilderSettingsConfig.init(),FLBuilderSettingsForms.init()})}(jQuery),function(e){var t={init:function(){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(this.initPanel(),this.pinOrUnpin(),this.bind())},bind:function(){var t=e(window),i=e("body");t.on("resize",_.throttle(this.windowResize.bind(this),250)),i.delegate(".fl-builder-ui-pinned-collapse","click",this.collapse),i.delegate(".fl-builder--content-library-panel .fl-builder--tabs","click",this.closeLightboxOnPanelClick),FLBuilder.addHook("didShowLightbox",this.pinLightboxOnOpen.bind(this)),FLBuilder.addHook("didHideAllLightboxes",this.pinnedLightboxClosed.bind(this)),FLBuilder.addHook("endEditingSession",this.hide.bind(this)),FLBuilder.addHook("didHideEditingUI",this.hide.bind(this)),FLBuilder.addHook("publishButtonClicked",this.hide.bind(this)),FLBuilder.addHook("restartEditingSession",this.show.bind(this)),FLBuilder.addHook("didShowEditingUI",this.show.bind(this)),FLBuilder.addHook("didShowLightbox",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.closeLightboxOnPanelClick.bind(this))},isPinned:function(){return e(".fl-builder--content-library-panel").hasClass("fl-builder-ui-pinned")},pin:function(e,t){this.pinPanel(e),this.pinLightboxes(),t&&this.savePosition(),FLBuilder._resizeLayout()},unpin:function(e){this.unpinLightboxes(),this.unpinPanel(),e&&this.savePosition(),FLBuilder._resizeLayout()},pinOrUnpin:function(){var t=e(".fl-builder--content-library-panel"),i=this.isPinned();t.hasClass("fl-builder-ui-pinned-hidden")||(window.innerWidth<=500?(i&&this.unpin(!1),this.disableDragAndResize()):(i||this.restorePosition(),this.enableDragAndResize()))},show:function(){var t=e(".fl-builder--content-library-panel");t.hasClass("fl-builder-ui-pinned-hidden")&&(t.removeClass("fl-builder-ui-pinned-hidden"),t.show(),this.restorePosition())},hide:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");this.isPinned()&&(this.uncollapse(),i.addClass("fl-builder-ui-pinned-hidden"),i.hide(),t.css("margin",""),FLBuilder._resizeLayout())},collapse:function(){var t=e(this).find("i:visible"),i=e("body"),l=t.data("toggle"),s=t.data("position"),o=e(".fl-builder--content-library-panel"),n=o.outerWidth();"hide"===l?(o.css(s,"-"+n+"px"),i.css("margin-"+s,""),i.addClass("fl-builder-ui-pinned-is-collapsed")):(o.css(s,"0px"),i.css("margin-"+s,n+"px"),i.removeClass("fl-builder-ui-pinned-is-collapsed"))},uncollapse:function(){this.isCollapsed()&&e(".fl-builder-ui-pinned-collapse:visible").trigger("click")},isCollapsed:function(){return e("body").hasClass("fl-builder-ui-pinned-is-collapsed")},initPanel:function(){var t=e(".fl-builder--content-library-panel");t.draggable({cursor:"move",handle:".fl-builder--tabs",cancel:".fl-builder--tabs button",scroll:!1,drag:this.drag.bind(this),stop:this.dragStop.bind(this),start:this.dragStart.bind(this)}).resizable({handles:"e, w",minHeight:400,minWidth:380,maxWidth:500,start:this.resizeStart.bind(this),stop:this.resizeStop.bind(this)}),t.addClass("fl-builder-ui-pinned-container"),t.find(".ui-resizable-e, .ui-resizable-w").hide()},pinPanel:function(t){var i=e(".fl-builder--content-library-panel"),l=i.width(),s=e("body"),o=e(".fl-responsive-preview, .fl-responsive-preview-mask"),n=e(FLBuilder._contentClass).parentsUntil("body").last();s.addClass("fl-builder-ui-is-pinned fl-builder-ui-is-pinned-"+t),s.addClass("fl-builder-content-panel-is-showing"),s.css("margin-"+t,l+"px"),o.css("margin-"+t,l+"px"),n.addClass("fl-builder-ui-pinned-content-transform"),i.addClass("fl-builder-ui-pinned fl-builder-ui-pinned-"+t),i.find(".ui-resizable-"+("left"===t?"e":"w")).show(),i.on("resize",_.throttle(this.resize.bind(this),250)),i.attr("style",""),FLBuilder.ContentPanel.isShowing=!0},unpinPanel:function(){var t=e(".fl-builder--content-library-panel"),i=t.find(".fl-builder--panel-content .is-showing").data("tab"),l=e("body"),s=e(".fl-responsive-preview, .fl-responsive-preview-mask"),o=e(FLBuilder._contentClass).parentsUntil("body").last();l.css("margin-left",""),l.css("margin-right",""),l.removeClass("fl-builder-ui-is-pinned"),l.removeClass("fl-builder-ui-is-pinned-left"),l.removeClass("fl-builder-ui-is-pinned-right"),s.css("margin-left",""),s.css("margin-right",""),o.removeClass("fl-lightbox-content-transform"),t.removeClass("fl-builder-ui-pinned"),t.removeClass("fl-builder-ui-pinned-left"),t.removeClass("fl-builder-ui-pinned-right"),t.find(".ui-resizable-handle").hide(),t.off("resize"),t.attr("style",""),t.find(".fl-builder--tabs [data-tab="+i+"]").addClass("is-showing")},pinLightboxes:function(){var t=this;e(".fl-lightbox-resizable").each(function(){t.pinLightbox(e(this))}),FLBuilder._reinitEditorFields()},pinLightbox:function(t){var i=e(".fl-builder--content-library-panel"),l=t.closest(".fl-lightbox-wrap");l.closest(".fl-builder-ui-pinned").length||(i.append(l),t.attr("style",""),t.draggable("disable"),t.resizable("disable")),t.is(":visible")&&i.find(".fl-builder--tabs .is-showing").removeClass("is-showing")},pinLightboxOnOpen:function(e,t){var i=t._node.find(".fl-lightbox-resizable");i.length&&(i.hasClass("fl-builder-ui-pinning-initialized")||(i.draggable("option","start",this.dragStart.bind(this)),i.draggable("option","drag",this.drag.bind(this)),i.draggable("option","stop",this.dragStop.bind(this)),i.addClass("fl-builder-ui-pinning-initialized")),this.isPinned()&&this.pinLightbox(i),FLBuilder.addHook("responsive-editing-switched",this.resize))},pinnedLightboxClosed:function(){var t=e(".fl-builder--content-library-panel");tab=null,this.isPinned()&&(tab=t.find(".fl-builder--panel-content .is-showing").data("tab"),t.find(".fl-builder--tabs [data-tab="+tab+"]").addClass("is-showing")),e(".fl-lightbox").removeClass("fl-lightbox-prevent-animation")},unpinLightboxes:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");i.find(".fl-lightbox-wrap").each(function(){var l=e(this),s=l.find(".fl-lightbox"),o=0,n=0,r=0;s.draggable("enable"),s.resizable("enable"),s.find(".ui-resizable-handle").show(),t.append(l),s.is(":visible")?(o=parseInt(i.css("top"))-parseInt(l.css("top"))-parseInt(l.css("padding-top")),n=parseInt(i.css("left"))-parseInt(l.css("padding-left")),r=parseInt(i.css("right"))-parseInt(l.css("padding-right")),s.css("top",(o<0?0:o)+"px"),s.css(FLBuilderConfig.isRtl?"right":"left",(FLBuilderConfig.isRtl?r:n)+"px"),s.addClass("fl-lightbox-prevent-animation"),t.removeClass("fl-builder-content-panel-is-showing"),FLBuilder.ContentPanel.isShowing=!1):s.css({top:"25px",left:"25px"})}),FLBuilder._reinitEditorFields()},closeLightboxOnPanelClick:function(){FLBuilder._triggerSettingsSave(!1,!0)},windowResize:function(){this.pinOrUnpin()},resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},resize:function(){var t=e("body"),i=e(".fl-responsive-preview, .fl-responsive-preview-mask"),l=e(".fl-builder--content-library-panel"),s=l.outerWidth();l.hasClass("fl-builder-ui-pinned-left")?(t.css("margin-left",s+"px"),i.css("margin-left",s+"px")):l.hasClass("fl-builder-ui-pinned-right")&&(t.css("margin-right",s+"px"),i.css("margin-right",s+"px"))},resizeStop:function(){e("body").removeClass("fl-builder-resizable-is-resizing"),FLBuilder._bindOverlayEvents(),FLBuilder._resizeLayout(),this.savePosition()},dragStart:function(t,i){var l=e("body"),s=(e(t.target),e(".fl-builder-bar-actions"));e(".fl-lightbox-resizable:visible").length||s.addClass("fl-builder-content-panel-pin-zone"),l.addClass("fl-builder-draggable-is-dragging"),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-left"></div>'),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-right"></div>'),FLBuilder._destroyOverlayEvents()},drag:function(t,i){var l=e("body"),s=e(".fl-responsive-preview"),o=e(window),n=s.length?s.width():o.width(),r=o.scrollTop(),a=e(".fl-builder--content-library-panel"),d=a.offset().top,u=e(".fl-builder-bar-actions"),c=e(t.target);c.hasClass("fl-builder--content-library-panel")&&(t.clientX<n-75&&d-r<46?u.addClass("fl-builder-content-panel-pin-zone-hover"):u.removeClass("fl-builder-content-panel-pin-zone-hover")),c.hasClass("fl-builder-ui-pinned")?this.unpinPanel():t.clientX<75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-left"):t.clientX>n-75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-right"):(l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right"))},dragStop:function(t,i){var l=(e(window),e("body")),s=e(".fl-builder-bar-actions"),o=e(".fl-builder-ui-pin-zone"),n=e(".fl-builder--content-library-panel"),r=e(".fl-lightbox-resizable:visible");e(t.target);l.removeClass("fl-builder-draggable-is-dragging"),s.removeClass("fl-builder-content-panel-pin-zone"),s.removeClass("fl-builder-content-panel-pin-zone-hover"),o.remove(),r.length&&parseInt(r.css("top"))<0&&r.css("top","0"),l.hasClass("fl-builder-ui-show-pin-zone")?(l.hasClass("fl-builder-ui-show-pin-zone-left")?this.pin("left",!0):this.pin("right",!0),l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right")):n.find(".fl-lightbox").length?this.unpin(!0):(n.attr("style",""),this.savePosition()),FLBuilder._bindOverlayEvents()},disableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable");t.draggable("disable"),
9
- t.resizable("disable"),i.draggable("disable"),i.resizable("disable")},enableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:not(.fl-lightbox-width-full)");t.draggable("enable"),t.resizable("enable"),this.isPinned()||(i.draggable("enable"),i.resizable("enable"))},savePosition:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:visible"),l={pinned:{width:t.width(),position:null}};t.hasClass("fl-builder-ui-pinned-left")?l.pinned.position="left":t.hasClass("fl-builder-ui-pinned-right")?l.pinned.position="right":i.length&&(l.lightbox={width:i.width(),height:i.height(),top:parseInt(i.css("top"))<0?"0px":i.css("top"),left:i.css("left")}),FLBuilderConfig.userSettings.pinned=l.pinned,l.lightbox&&(FLBuilderConfig.userSettings.lightbox=l.lightbox),FLBuilder.ajax({action:"save_pinned_ui_position",data:l})},restorePosition:function(){var t=e(".fl-builder--content-library-panel"),i=FLBuilderConfig.userSettings.pinned;i&&i.position&&(t.width(i.width),this.pin(i.position,!1),t.width(i.width))}};e(function(){t.init()})}(jQuery),function(e){var t={init:function(){this.setupMainMenuData(),e(".fl-builder--revision-actions select").on("change",this.selectChanged),e(".fl-cancel-revision-preview").on("click",this.exitPreview.bind(this)),e(".fl-apply-revision-preview").on("click",this.applyClicked.bind(this)),FLBuilder.addHook("revisionItemClicked",this.itemClicked.bind(this)),FLBuilder.addHook("didPublishLayout",this.refreshItems.bind(this))},setupMainMenuData:function(){var t=FLBuilderConfig.revisions.posts,i=FLBuilderConfig.revisions.authors,l=wp.template("fl-revision-list-item"),s=e(".fl-builder--revision-actions select"),o="",n="",r=0;if(FLBuilderConfig.mainMenu.revisions.items=[],s.html(""),0===t.length)FLBuilderConfig.mainMenu.revisions.items.push({eventName:"noRevisionsMessage",type:"event",label:wp.template("fl-no-revisions-message")()});else for(;r<t.length;r++)o=FLBuilderStrings.revisionDate.replace("%s",t[r].date.diff),o+=" ("+t[r].date.published+")",n=FLBuilderStrings.revisionAuthor.replace("%s",i[t[r].author].name),FLBuilderConfig.mainMenu.revisions.items.push({eventName:"revisionItemClicked",type:"event",label:l({id:t[r].id,date:o,author:n,avatar:i[t[r].author].avatar})}),s.append('<option value="'+t[r].id+'">'+o+"</option>");FLBuilder.triggerHook("renderRevisionsPanel")},refreshItems:function(){FLBuilder.ajax({action:"refresh_revision_items"},this.refreshItemsComplete.bind(this))},refreshItemsComplete:function(e){FLBuilderConfig.revisions=JSON.parse(e),this.setupMainMenuData()},itemClicked:function(t,i){var l=e(i).find(".fl-revision-list-item").attr("data-revision-id");FLBuilder._triggerSettingsSave(!1,!0)&&(e(".fl-builder--revision-actions select").val(l),this.preview(l))},selectChanged:function(i){t.preview(e(this).val())},applyClicked:function(i){var l=e(".fl-builder--revision-actions select").val();t.restore(l)},preview:function(t){e(".fl-builder--revision-actions").css("display","flex"),FLBuilder.triggerHook("didEnterRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_revision_preview",revision_id:t},this.previewRenderComplete.bind(this))},previewRenderComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()})},exitPreview:function(){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder._bindOverlayEvents(),FLBuilder._updateLayout()},restore:function(i){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder._bindOverlayEvents(),FLBuilder.ajax({action:"restore_revision",revision_id:i},t.restoreComplete)},restoreComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didRestoreRevisionComplete",t.config)}};e(function(){t.init()})}(jQuery),function(e){var t={query:function(e){var t={},i=null,l={library:{}},s=null;if(e=this.normalizeQuery(e),_.isNull(e.kind))t=FLBuilderConfig.contentItems;else for(var o in e.kind)i=e.kind[o],t[i]=FLBuilderConfig.contentItems[i];return s=this.findMatches(e,t),l.library=this.formatResults(s,e),l},normalizeQuery:function(e){var t={kind:null,type:null,category:null,group:null,enabled:!0,global:null,searchTerm:null,categorized:!1};return e=_.extend(t,e),_.isString(e.kind)&&(e.kind=[e.kind]),e},findMatches:function(e,t){var i={},l=null,s=null,o=null,n=null,r=null,a=null;for(l in t){s=t[l],i[l]={items:[]};for(a in s)if(o=s[a],_.isUndefined(e.category)||_.isNull(e.category)||this.matchesCategory(o.category,e.category)){switch(l){case"template":if(!(_.isUndefined(e.content)||_.isNull(e.content)||(n=_.contains(e.content,o.content),r=e.content===o.content,n||r)))continue;if(!_.isUndefined(e.type)&&!_.isNull(e.type)&&e.type!==o.type)continue;if(!_.isNull(e.group)){var d=e.group,u=o.group;if(_.isString(d)&&(d=[d]),_.isString(u)&&(u=[u]),_.isEmpty(d)||_.isEmpty(u))continue;var c=!1;for(a in d){var h=d[a];_.contains(u,h)&&(c=!0)}if(!c)continue}break;case"module":if(!_.isNull(e.group)){if(e.group===!1&&o.group.length>0)continue;if(e.group!==!1&&!_.contains(o.group,e.group))continue}}(_.isUndefined(e.searchTerm)||_.isNull(e.searchTerm)||this.matchesSearchTerm(o,e.searchTerm))&&i[l].items.push(o)}}return i},matchesCategory:function(e,t){var i,l,s,o,n,r;if(e===t)return!0;_.isString(t)&&(t=[t]);for(l in t){if(i=t[l],_.isString(e)&&e===i)return!0;if(_.isArray(e))for(s in e)if(o=e[s],o===i)return!0;if(_.isObject(e))for(n in e)if(r=e[n],r===i||n===i)return!0}return!1},matchesSearchTerm:function(e,t){var i,l,s=t.toLowerCase();return!(_.isUndefined(e.slug)||!e.slug.toLowerCase().includes(s))||(!(_.isUndefined(e.name)||!e.name.toLowerCase().includes(s))||(!(!_.isString(e.category)||!e.category.toLowerCase().includes(s))||(!(_.isUndefined(e.description)||!e.description.toLowerCase().includes(s))||(!(_.isUndefined(e.id_base)||!e.id_base.includes(t))||(!(!e.isWidget||(i="widget",!i.includes(s)))||!(_.isUndefined(e.editor_export)||(l="module",!l.includes(s))))))))},formatResults:function(e,t){if(t.categorized)for(type in e){var i=e[type].items;e[type].categorized=this.groupBy(i,"category")}return e},groupBy:function(e,t){var i,l,s={};return _.forEach(e,function(e,o,n){i=e[t],_.isNull(i)||_.isUndefined(i)||_.isString(i)&&""===e[i]||(_.isString(i)&&(s[i]=s[i]||[],s[i].push(e)),_.isArray(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})),_.isObject(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})))}),s},search:function(e){var t={searchTerm:e},i=this.query(t),l={total:0,term:e,sections:{}};if(!_.isUndefined(i.library.module.items)){var s={};for(var o in i.library.module.items){var n=i.library.module.items[o],r=n.group[0],a=n.category;n.name;_.isUndefined(s[r])&&(s[r]={}),_.isUndefined(s[r][a])&&(s[r][a]=[]),s[r][a].push(n)}l.grouped=s}for(var o in i.library){var d=i.library[o];!_.isUndefined(d.items)&&d.items.length>0&&(l.sections[o]={name:FLBuilderStrings.typeLabels[o],handle:o,type:"",items:d.items},l.total+=d.items.length)}return l}};FLBuilder.Search={byQuery:function(e){return t.query(e)},byTerm:function(e){var i=t.search(e);return i}}}(jQuery),function(e,t){var i={layoutNeedsPublish:!1,defaultIndicatorMessage:"",defaultTooltipMessage:"",messages:null,init:function(){this.messages=FLBuilderStrings.savedStatus,this.$savingIndicator=e(".fl-builder--saving-indicator"),t.addHook("didBeginAJAX",this.onLayoutSaving.bind(this)),t.addHook("didCompleteAJAX",this.onLayoutSaved.bind(this)),t.addHook("didPublishLayout",this.onLayoutPublished.bind(this)),t.addHook("publishAndRemain",this.onPublishAndRemain.bind(this)),t.addHook("didShowLightbox",this.setLayoutNeedsPublish.bind(this)),!FLBuilderConfig.layoutHasDraftedChanges&&FLBuilderConfig.builderEnabledd||(this.setLayoutNeedsPublish(),this.resetStatusMessage())},setLayoutNeedsPublish:function(){this.layoutNeedsPublish||(this.layoutNeedsPublish=!0,e("body").addClass("fl-builder--layout-has-drafted-changes"))},onLayoutSaving:function(e,t){this.isPublishingLayout(t.action)?this.showStatusMessage(this.messages.publishing,this.messages.publishingTooltip):this.isUpdatingLayout(t.action)&&(this.setLayoutNeedsPublish(),this.showStatusMessage(this.messages.saving,this.messages.savingTooltip))},isPublishingLayout:function(e){return"save_layout"==e},isUpdatingLayout:function(e){return!this.isPublishingLayout()&&(e.startsWith("render")?!!e.startsWith("render_new"):!e.startsWith("duplicate")&&(!e.startsWith("refresh")&&("save_ui_skin"!=e&&("save_lightbox_position"!=e&&"save_pinned_ui_position"!=e))))},onLayoutSaved:function(e,t){if(this.isUpdatingLayout(t.fl_builder_data.action)){this.showStatusMessage(this.messages.saved,this.messages.savedTooltip);var i=this;setTimeout(function(){i.resetStatusMessage()},2e3)}},onLayoutPublished:function(){this.layoutNeedsPublish=!1,e("body").removeClass("fl-builder--layout-has-drafted-changes"),this.resetStatusMessage()},showStatusMessage:function(t,i){this.$savingIndicator.html(t),_.isUndefined(i)||(this.$savingIndicator.attr("title",i),e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}))},resetStatusMessage:function(){this.layoutNeedsPublish?(this.defaultIndicatorMessage=this.messages.edited+'<i class="fa fa-question-circle"></i>',this.defaultTooltipMessage=this.messages.editedTooltip):(this.defaultIndicatorMessage="",this.defaultTooltipMessage=""),this.showStatusMessage(this.defaultIndicatorMessage,this.defaultTooltipMessage)},onPublishAndRemain:function(){if(this.layoutNeedsPublish)t._publishLayout(!1);else{this.showStatusMessage(this.messages.noChanges);var e=this;setTimeout(function(){e.resetStatusMessage()},2e3)}}};t.SaveManager={layoutNeedsPublish:function(){return i.layoutNeedsPublish},showStatusMessage:function(e,t){i.showStatusMessage(e,t)},resetStatusMessage:function(){i.resetStatusMessage()}},e(function(){i.init()})}(jQuery,FLBuilder);
1
  var FLBuilderColorPicker;!function(e,t){function i(){var t,i,l="backgroundImage";h?f="filter":(t=e('<div id="iris-gradtest" />'),i="linear-gradient(top,#fff,#000)",e.each(g,function(e,s){if(t.css(l,s+i),t.css(l).match("gradient"))return f=e,!1}),f===!1&&(t.css("background","-webkit-gradient(linear,0% 0%,0% 100%,from(#fff),to(#000))"),t.css(this.bgImageString).match("gradient")&&(f="webkit")),t.remove())}function l(t,i){return t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),"webkit"===f?o(t,i):g[f]+"linear-gradient("+t+", "+i.join(", ")+")"}function s(t,i){var l,s,o,r,a,d,u,c,h;t="top"===t?"top":"left",i=e.isArray(i)?i:Array.prototype.slice.call(arguments,1),l="top"===t?0:1,s=e(this),o=i.length-1,r="filter",a=1===l?"left":"top",d=1===l?"right":"bottom",u=1===l?"height":"width",c='<div class="iris-ie-gradient-shim" style="position:absolute;'+u+":100%;"+a+":%start%;"+d+":%end%;"+r+':%filter%;" data-color:"%color%"></div>',h="","static"===s.css("position")&&s.css({position:"relative"}),i=n(i),e.each(i,function(e,t){var s,n,r;return e!==o&&(s=i[e+1],void(t.stop!==s.stop&&(n=100-parseFloat(s.stop)+"%",t.octoHex=new Color(t.color).toIEOctoHex(),s.octoHex=new Color(s.color).toIEOctoHex(),r="progid:DXImageTransform.Microsoft.Gradient(GradientType="+l+", StartColorStr='"+t.octoHex+"', EndColorStr='"+s.octoHex+"')",h+=c.replace("%start%",t.stop).replace("%end%",n).replace("%filter%",r))))}),s.find(".iris-ie-gradient-shim").remove(),e(h).prependTo(s)}function o(t,i){var l=[];return t="top"===t?"0% 0%,0% 100%,":"0% 100%,100% 100%,",i=n(i),e.each(i,function(e,t){l.push("color-stop("+parseFloat(t.stop)/100+", "+t.color+")")}),"-webkit-gradient(linear,"+t+l.join(",")+")"}function n(t){var i=[],l=[],s=[],o=t.length-1;return e.each(t,function(e,t){var s=t,o=!1,n=t.match(/1?[0-9]{1,2}%$/);n&&(s=t.replace(/\s?1?[0-9]{1,2}%$/,""),o=n.shift()),i.push(s),l.push(o)}),l[0]===!1&&(l[0]="0%"),l[o]===!1&&(l[o]="100%"),l=r(l),e.each(l,function(e){s[e]={color:i[e],stop:l[e]}}),s}function r(t){var i,l,s,o,n=0,a=t.length-1,d=0,u=!1;if(t.length<=2||e.inArray(!1,t)<0)return t;for(;d<t.length-1;)u||t[d]!==!1?u&&t[d]!==!1&&(a=d,d=t.length):(n=d-1,u=!0),d++;for(l=a-n,o=parseInt(t[n].replace("%"),10),i=(parseFloat(t[a].replace("%"))-o)/l,d=n+1,s=1;d<a;)t[d]=o+s*i+"%",s++,d++;return r(t)}var a=[],d=navigator.userAgent.toLowerCase(),u="Microsoft Internet Explorer"===navigator.appName,c=u?parseFloat(d.match(/msie ([0-9]{1,}[\.0-9]{0,})/)[1]):0,h=u&&c<10,f=!1,g=["-moz-","-webkit-","-o-","-ms-"];flBuilderParseColorValue=function(e){var t=e.replace(/\s+/g,""),i=t.indexOf("rgba")!==-1?parseFloat(100*t.replace(/^.*,(.+)\)/,"$1")):100,l=i<100;return{value:t,alpha:i,rgba:l}},e.fn.flBuilderColorPickerGradient=function(){var t=arguments;return this.each(function(){h?s.apply(this,t):e(this).css("backgroundImage",l.apply(this,t))})},e.fn.flBuilderColorPickerRaninbowGradient=function(t,i){var l,s,o,n;for(t=t||"top",l=e.extend({},{s:100,l:50},i),s="hsl(%h%,"+l.s+"%,"+l.l+"%)",o=0,n=[];o<=360;)n.push(s.replace("%h%",o)),o+=30;return this.each(function(){e(this).flBuilderColorPickerGradient(t,n)})},FLBuilderColorPicker=function(t){this._html='<div class="fl-color-picker-ui"><div class="iris-picker"><div class="iris-picker-inner"><div class="iris-square"><a class="iris-square-value" href="javascript:void(0);"><span class="iris-square-handle ui-slider-handle"></span></a><div class="iris-square-inner iris-square-horiz"></div><div class="iris-square-inner iris-square-vert"></div></div><div class="iris-slider iris-strip"><div class="iris-slider-offset"></div></div></div></div></div>';var i={elements:null,color:"",mode:"hsl",controls:{horiz:"s",vert:"l",strip:"h"},target:!1,width:200,presets:[],labels:{colorPresets:"Color Presets",colorPicker:"Color Picker",placeholder:"Paste color here...",removePresetConfirm:"Are you sure?",noneColorSelected:"None color selected.",alreadySaved:"%s is already a saved preset.",noPresets:"Add a color preset first.",presetAdded:"%s added to presets!"}};this.options=e.extend({},i,t),(h===!1||h===!0&&c>7)&&this._init()},FLBuilderColorPicker.prototype={_html:"",_color:"",_currentElement:"",_inited:!1,_defaultHSLControls:{horiz:"s",vert:"l",strip:"h"},_defaultHSVControls:{horiz:"h",vert:"v",strip:"s"},_scale:{h:360,s:100,l:100,v:100},_init:function(){var t=this;e(t.options.elements);this._color=new Color("#ff0000").setHSpace(t.options.mode),a=this.options.presets,f===!1&&i(),e("html").hasClass("fl-color-picker-init")?t.picker=e(".fl-color-picker-ui"):t.picker=e(this._html).appendTo("body"),u?9===c?t.picker.addClass("iris-ie-9"):c<=8&&t.picker.addClass("iris-ie-lt9"):d.indexOf("compatible")<0&&d.indexOf("khtml")<0&&d.match(/mozilla/)&&t.picker.addClass("iris-mozilla"),t.controls={square:t.picker.find(".iris-square"),squareDrag:t.picker.find(".iris-square-value"),horiz:t.picker.find(".iris-square-horiz"),vert:t.picker.find(".iris-square-vert"),strip:t.picker.find(".iris-strip"),stripSlider:t.picker.find(".iris-strip .iris-slider-offset")},"hsv"===t.options.mode&&t._has("l",t.options.controls)?t.options.controls=t._defaultHSVControls:"hsl"===t.options.mode&&t._has("v",t.options.controls)&&(t.options.controls=t._defaultHSLControls),t.hue=t._color.h(),this._setTemplates(),this._ui=e(".fl-color-picker-ui"),this._iris=e(".iris-picker"),this._wrapper=e("body"),e("html").hasClass("fl-color-picker-init")||this._ui.prepend(this._hexHtml).append(this._presetsHtml),t.element=this._ui.find(".fl-color-picker-input"),t._initControls(),t.active="external",t._change(),t._addInputListeners(t.element),this._buildUI(),this._prepareColorFields(),this._pickerControls(),this._presetsControls(),this._buildAlphaUI(),e("html").addClass("fl-color-picker-init")},_prepareColorFields:function(){var t=this;e(".fl-color-picker-value").each(function(){var i=e(this),l=i.val(),s=i.parent().find(".fl-color-picker-color"),o=flBuilderParseColorValue(l),n="";if(l){if(s.hasClass("fl-color-picker-alpha-enabled")&&o.rgba)n=i.val().toString();else if(!s.hasClass("fl-color-picker-alpha-enabled")&&o.rgba){var r=l.replace("rgba","rgb");r=r.substr(0,r.lastIndexOf(","))+")",t._color._alpha=1,n=r,i.val(r)}else n="#"+i.val().toString();s.css({backgroundColor:n})}})},_setTemplates:function(){this._alphaHtml='<div class="fl-alpha-wrap"><div class="fl-alpha-slider"></div><div class="fl-alpha-slider-offset"></div><div class="fl-alpha-text"></div></div>',this._presetsHtml='<div class="fl-color-picker-presets"><div class="fl-color-picker-presets-toggle"><div class="fl-color-picker-presets-open-label fl-color-picker-active">'+this.options.labels.colorPresets+' <span class="fl-color-picker-icon-arrow-up"></span></div><div class="fl-color-picker-presets-close-label">'+this.options.labels.colorPicker+' <span class="fl-color-picker-icon-arrow-down"></span></div></div><ul class="fl-color-picker-presets-list"></ul></div>',this._hexHtml='<input type="text" class="fl-color-picker-input" maxlength="7" placeholder="'+this.options.labels.placeholder+'"><div class="fl-color-picker-preset-add"></div>',this._presetsTpl='<li class="fl-color-picker-preset"><span class="fl-color-picker-preset-color"></span> <span class="fl-color-picker-preset-label"></span> <span class="fl-color-picker-preset-remove fl-color-picker-icon-remove"></span></li>',this._noPresetsTpl='<li class="fl-color-picker-no-preset"><span class="fl-color-picker-preset-label">'+this.options.labels.noPresets+"</span></li>"},_has:function(t,i){var l=!1;return e.each(i,function(e,i){if(t===i)return l=!0,!1}),l},_buildUI:function(){var t=this;t._presetsList=this._ui.find(".fl-color-picker-presets-list"),t._presetsList.html(""),this.options.presets.length>0?e.each(this.options.presets,function(e,i){t._addPresetView(i)}):t._presetsList.append(this._noPresetsTpl)},_addPresetView:function(t){var i=this._presetsList.find(".fl-color-picker-no-preset");i.length>0&&i.remove();var l=e(this._presetsTpl),s=Color(t);l.attr("data-color",t).find(".fl-color-picker-preset-color").css({backgroundColor:s.toString()}).end().find(".fl-color-picker-preset-label").html(s.toString()),this._presetsList.append(l)},_addPresetFeedback:function(){this._ui.append('<div class="fl-color-picker-added"><div class="fl-color-picker-added-text"><div class="fl-color-picker-icon-check"></div> "'+this.options.labels.presetAdded.replace("%s",this._color.toString())+'"</div></div>'),this._ui.find(".fl-color-picker-added").hide().fadeIn(200).delay(2e3).fadeOut(200,function(){e(this).remove()})},_pickerControls:function(){var t=this;this._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),t._ui.position({my:"left top",at:"left bottom",of:i,collision:"flipfit",using:function(e,i){t._togglePicker(e)}})}).on("click",".fl-color-picker-clear",function(){var i=e(this);t._currentElement=i.parent().find(".fl-color-picker-value"),i.prev(".fl-color-picker-color").css({backgroundColor:"transparent"}).addClass("fl-color-picker-empty"),t._setColor(""),t.element.val(""),t._currentElement.val("").trigger("change")}),e(document).on("mousedown",function(t){0===e(t.target).closest(".fl-color-picker-ui").length&&e(".fl-color-picker-ui.fl-color-picker-active").removeClass("fl-color-picker-active")})},_presetsControls:function(){var t=this,i=t._ui.find(".fl-color-picker-preset-add"),l=t._ui.find(".fl-color-picker-presets"),s=l.find(".fl-color-picker-presets-open-label"),o=l.find(".fl-color-picker-presets-close-label"),n=l.find(".fl-color-picker-presets-list");i.off("click").on("click",function(){t._addPreset(t.element.val())}),n.css({height:t.element.innerHeight()+t._iris.innerHeight()+14+"px"}).hide(),l.off("click").on("click",".fl-color-picker-presets-toggle",function(){s.toggleClass("fl-color-picker-active"),o.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset",function(i){var l=new Color(e(this).data("color").toString());t._setColor(l),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:l.toString()}).removeClass("fl-color-picker-empty"),s.toggleClass("fl-color-picker-active"),o.toggleClass("fl-color-picker-active"),n.slideToggle(500)}).on("click",".fl-color-picker-preset-remove",function(i){i.stopPropagation(),t._removePreset(e(this).parent().data("color"))})},_removePreset:function(t){if(confirm(this.options.labels.removePresetConfirm)){var i=t.toString(),l=a.indexOf(i);l>-1&&(a.splice(l,1),this.options.presets=a,this._presetsList.find('.fl-color-picker-preset[data-color="'+i+'"]').slideUp(function(){e(this).remove()})),a.length<1&&this._presetsList.append(this._noPresetsTpl),e(this).trigger("presetRemoved",{presets:a})}},_addPreset:function(t){var i=t.toString().replace(/^#/,"");""===i?alert(this.options.labels.noneColorSelected):a.indexOf(i)>-1?alert(this.options.labels.alreadySaved.replace("%s","#"+i)):(this._addPresetView(i),this._addPresetFeedback(),a.push(i),this.options.presets=a,e(this).trigger("presetAdded",{presets:a}))},_togglePicker:function(e){var t=this;this._ui.hasClass("fl-color-picker-active")?(this._ui.removeClass("fl-color-picker-active"),e&&setTimeout(function(){t._ui.css(e),t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200)):(e&&t._ui.css(e),setTimeout(function(){t._ui.addClass("fl-color-picker-active"),t._setColor(t._currentElement.val())},200))},_paint:function(){var e=this;e._paintDimension("right","strip"),e._paintDimension("top","vert"),e._paintDimension("left","horiz")},_paintDimension:function(e,t){var i,l=this,s=l._color,o=l.options.mode,n=l._getHSpaceColor(),r=l.controls[t],a=l.options.controls;if(t!==l.active&&("square"!==l.active||"strip"===t))switch(a[t]){case"h":if("hsv"===o){switch(n=s.clone(),t){case"horiz":n[a.vert](100);break;case"vert":n[a.horiz](100);break;case"strip":n.setHSpace("hsl")}i=n.toHsl()}else i="strip"===t?{s:n.s,l:n.l}:{s:100,l:n.l};r.flBuilderColorPickerRaninbowGradient(e,i);break;case"s":"hsv"===o?"vert"===t?i=[s.clone().a(0).s(0).toCSS("rgba"),s.clone().a(1).s(0).toCSS("rgba")]:"strip"===t?i=[s.clone().s(100).toCSS("hsl"),s.clone().s(0).toCSS("hsl")]:"horiz"===t&&(i=["#fff","hsl("+n.h+",100%,50%)"]):i="vert"===t&&"h"===l.options.controls.horiz?["hsla(0, 0%, "+n.l+"%, 0)","hsla(0, 0%, "+n.l+"%, 1)"]:["hsl("+n.h+",0%,50%)","hsl("+n.h+",100%,50%)"],r.flBuilderColorPickerGradient(e,i);break;case"l":i="strip"===t?["hsl("+n.h+",100%,100%)","hsl("+n.h+", "+n.s+"%,50%)","hsl("+n.h+",100%,0%)"]:["#fff","rgba(255,255,255,0) 50%","rgba(0,0,0,0) 50%","rgba(0,0,0,1)"],r.flBuilderColorPickerGradient(e,i);break;case"v":i="strip"===t?[s.clone().v(100).toCSS(),s.clone().v(0).toCSS()]:["rgba(0,0,0,0)","#000"],r.flBuilderColorPickerGradient(e,i)}},_getHSpaceColor:function(){return"hsv"===this.options.mode?this._color.toHsv():this._color.toHsl()},_dimensions:function(e){var t,i=this,l=i.options,s=i.controls,o=s.square,n=i.picker.find(".iris-strip"),r="77.5%",a="12%",d=20,u=l.border?l.width-d:l.width;if(e&&(o.css("width",""),n.css("width",""),i.picker.css({width:"",height:""})),r=u*(parseFloat(r)/100),a=u*(parseFloat(a)/100),t=l.border?r+d:r,o.width(r).height(r),n.height(r).width(a),i.picker.css({width:l.width,height:t}),!l.palettes)return i.picker.css("paddingBottom","")},_addInputListeners:function(e){var t=this,i=100,l=function(i){var l=new Color(e.val()),s=e.val().replace(/^#/,""),o=t._currentElement.hasClass("fl-color-picker-empty");if(e.removeClass("iris-error"),l.error)""!==s&&e.addClass("iris-error");else if(l.toString()!==t._color.toString()||""!==t._color.toString()&&o)if("keyup"===i.type){if(s.match(/^[0-9a-fA-F]{3}$/))return;t._setColor(s),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:Color(s).toString()}).removeClass("fl-color-picker-empty"),t._currentElement.val(s).trigger("change")}else if("paste"===i.type)return s=i.originalEvent.clipboardData.getData("text").replace(/^#/,""),hex=Color(s).toString(),t._setColor(s),e.val(hex),t._currentElement.parent().find(".fl-color-picker-color").css({backgroundColor:hex}).removeClass("fl-color-picker-empty"),t._currentElement.val(s).trigger("change"),!1};e.on("change",l).on("keyup",t._debounce(l,i))},_initControls:function(){var t=this,i=t.controls,l=i.square,s=t.options.controls,o=t._scale[s.strip];i.stripSlider.slider({orientation:"horizontal",max:o,slide:function(e,i){t.active="strip","h"===s.strip&&(i.value=o-i.value),t._color[s.strip](i.value),t._change.apply(t,arguments)}}),i.squareDrag.draggable({containment:i.square.find(".iris-square-inner"),zIndex:1e3,cursor:"move",drag:function(e,i){t._squareDrag(e,i)},start:function(){l.addClass("iris-dragging"),e(this).addClass("ui-state-focus")},stop:function(){l.removeClass("iris-dragging"),e(this).removeClass("ui-state-focus")}}).on("mousedown mouseup",function(i){var l="ui-state-focus";i.preventDefault(),"mousedown"===i.type?(t.picker.find("."+l).removeClass(l).blur(),e(this).addClass(l).focus()):e(this).removeClass(l)}).on("keydown",function(e){var l=i.square,s=i.squareDrag,o=s.position(),n=2;switch(e.altKey&&(n*=10),e.keyCode){case 37:o.left-=n;break;case 38:o.top-=n;break;case 39:o.left+=n;break;case 40:o.top+=n;break;default:return!0}o.left=Math.max(0,Math.min(o.left,l.width())),o.top=Math.max(0,Math.min(o.top,l.height())),s.css(o),t._squareDrag(e,{position:o}),e.preventDefault()}),l.mousedown(function(i){var l,s;1===i.which&&e(i.target).is("div")&&(l=t.controls.square.offset(),s={top:i.pageY-l.top,left:i.pageX-l.left},i.preventDefault(),t._squareDrag(i,{position:s}),i.target=t.controls.squareDrag.get(0),t.controls.squareDrag.css(s).trigger(i))})},_squareDrag:function(e,t){var i=this,l=i.options.controls,s=i._squareDimensions(),o=Math.round((s.h-t.position.top)/s.h*i._scale[l.vert]),n=i._scale[l.horiz]-Math.round((s.w-t.position.left)/s.w*i._scale[l.horiz]);i._color[l.horiz](n)[l.vert](o),i.active="square",i._change.apply(i,arguments)},_setColor:function(e){var t,i,l=this,s=l.options.color;l.options.color=e,e=""+e,t=e.replace(/^#/,""),i=new Color(e).setHSpace(l.options.mode),i.error?l.options.color=s:(l._color=i,l.options.color=l._color.toString(),l.active="external",l._change())},_squareDimensions:function(e){var i,l,s=this.controls.square;return e!==t&&s.data("dimensions")?s.data("dimensions"):(l=this.controls.squareDrag,i={w:s.width(),h:s.height()},s.data("dimensions",i),i)},_isNonHueControl:function(e,t){return"square"===e&&"h"===this.options.controls.strip||"external"!==t&&("h"!==t||"strip"!==e)},_change:function(){var t=this,i=t.controls,l=t._getHSpaceColor(),s=["square","strip"],o=t.options.controls,n=o[t.active]||"external",r=t.hue;"strip"===t.active?s=[]:"external"!==t.active&&s.pop(),e.each(s,function(e,s){var n,r,a;if(s!==t.active)switch(s){case"strip":n="h"===o.strip?t._scale[o.strip]-l[o.strip]:l[o.strip],i.stripSlider.slider("value",n);break;case"square":r=t._squareDimensions(),a={left:l[o.horiz]/t._scale[o.horiz]*r.w,top:r.h-l[o.vert]/t._scale[o.vert]*r.h},t.controls.squareDrag.css(a)}}),l.h!==r&&t._isNonHueControl(t.active,n)&&t._color.h(r),t.hue=t._color.h(),t.options.color=t._color.toString(),t.element.is(":input")&&!t._color.error&&(t.element.removeClass("iris-error"),t.element.val()!==t._color.toString()&&(t.element.val(t._color.toString()),this._currentElement&&(this._currentElement.val(t._color.toString().replace(/^#/,"")).parent().find(".fl-color-picker-color").css({backgroundColor:t._color.toString()}).removeClass("fl-color-picker-empty"),t._wrapper.find(".fl-alpha-slider-offset").css("background-color",t._color.toString()),this._currentElement.trigger("change")))),t._paint(),t._inited=!0,t.active=!1},_debounce:function(e,t,i){var l,s;return function(){var o,n,r=this,a=arguments;return o=function(){l=null,i||(s=e.apply(r,a))},n=i&&!l,clearTimeout(l),l=setTimeout(o,t),n&&(s=e.apply(r,a)),s}},_buildAlphaUI:function(){var t=this;t._wrapper.on("click",".fl-color-picker-color",function(){var i=e(this);t._currentElement.val();i.hasClass("fl-color-picker-alpha-enabled")?(t._ui.find(".fl-alpha-wrap").length<=0&&e(t._alphaHtml).insertAfter(t._iris),t.picker.addClass("fl-color-alpha-enabled"),t._pickerAlphaControls()):t._ui.find(".fl-alpha-wrap").remove()})},_pickerAlphaControls:function(){var e=this,t=e._currentElement,i=flBuilderParseColorValue(t.val()),l=parseFloat(i.alpha/100),s=e._wrapper,o=e._ui,n=o.find(".fl-alpha-wrap"),r=n.find(".fl-alpha-slider"),a=n.find(".fl-alpha-text"),d=n.find(".fl-alpha-slider-offset");alphaHandle=n.find(".ui-slider-handle"),a.text(l<1?l:""),r.slider({orientation:"vertical",slide:function(t,i){var l=parseFloat(i.value/100);e._color._alpha=l,a.text(l<1?l:""),e._change.apply(e,arguments)},create:function(){d.css({backgroundColor:i.value}),s.on("click",".fl-color-picker-clear",function(){e._color._alpha=1,a.text(""),r.slider("value",100).trigger("slide")})},value:i.alpha,step:1,min:1,max:100})}}}(jQuery),function(e,t){var i=function(e,t){return this instanceof i?this._init(e,t):new i(e,t)};i.fn=i.prototype={_color:0,_alpha:1,error:!1,_hsl:{h:0,s:0,l:0},_hsv:{h:0,s:0,v:0},_hSpace:"hsl",_init:function(e){var i="noop";switch(typeof e){case"object":return e.a!==t&&this.a(e.a),i=e.r!==t?"fromRgb":e.l!==t?"fromHsl":e.v!==t?"fromHsv":i,this[i](e);case"string":return this.fromCSS(e);case"number":return this.fromInt(parseInt(e,10))}return this},_error:function(){return this.error=!0,this},clone:function(){for(var e=new i(this.toInt()),t=["_alpha","_hSpace","_hsl","_hsv","error"],l=t.length-1;l>=0;l--)e[t[l]]=this[t[l]];return e},setHSpace:function(e){return this._hSpace="hsv"===e?e:"hsl",this},noop:function(){return this},fromCSS:function(e){var t,i=/^(rgb|hs(l|v))a?\(/;if(this.error=!1,e=e.replace(/^\s+/,"").replace(/\s+$/,"").replace(/;$/,""),e.match(i)&&e.match(/\)$/)){if(t=e.replace(/(\s|%)/g,"").replace(i,"").replace(/,?\);?$/,"").split(","),t.length<3)return this._error();if(4===t.length&&(this.a(parseFloat(t.pop())),this.error))return this;for(var l=t.length-1;l>=0;l--)if(t[l]=parseInt(t[l],10),isNaN(t[l]))return this._error();return e.match(/^rgb/)?this.fromRgb({r:t[0],g:t[1],b:t[2]}):e.match(/^hsv/)?this.fromHsv({h:t[0],s:t[1],v:t[2]}):this.fromHsl({h:t[0],s:t[1],l:t[2]})}return this.fromHex(e)},fromRgb:function(e,i){return"object"!=typeof e||e.r===t||e.g===t||e.b===t?this._error():(this.error=!1,this.fromInt(parseInt((e.r<<16)+(e.g<<8)+e.b,10),i))},fromHex:function(e){return e=e.replace(/^#/,"").replace(/^0x/,""),3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),this.error=!/^[0-9A-F]{6}$/i.test(e),this.fromInt(parseInt(e,16))},fromHsl:function(e){var i,l,s,o,n,r,a,d;return"object"!=typeof e||e.h===t||e.s===t||e.l===t?this._error():(this._hsl=e,this._hSpace="hsl",r=e.h/360,a=e.s/100,d=e.l/100,0===a?i=l=s=d:(o=d<.5?d*(1+a):d+a-d*a,n=2*d-o,i=this.hue2rgb(n,o,r+1/3),l=this.hue2rgb(n,o,r),s=this.hue2rgb(n,o,r-1/3)),this.fromRgb({r:255*i,g:255*l,b:255*s},!0))},fromHsv:function(e){var i,l,s,o,n,r,a,d,u,c,h;if("object"!=typeof e||e.h===t||e.s===t||e.v===t)return this._error();switch(this._hsv=e,this._hSpace="hsv",i=e.h/360,l=e.s/100,s=e.v/100,a=Math.floor(6*i),d=6*i-a,u=s*(1-l),c=s*(1-d*l),h=s*(1-(1-d)*l),a%6){case 0:o=s,n=h,r=u;break;case 1:o=c,n=s,r=u;break;case 2:o=u,n=s,r=h;break;case 3:o=u,n=c,r=s;break;case 4:o=h,n=u,r=s;break;case 5:o=s,n=u,r=c}return this.fromRgb({r:255*o,g:255*n,b:255*r},!0)},fromInt:function(e,i){return this._color=parseInt(e,10),isNaN(this._color)&&(this._color=0),this._color>16777215?this._color=16777215:this._color<0&&(this._color=0),i===t&&(this._hsv.h=this._hsv.s=this._hsl.h=this._hsl.s=0),this},hue2rgb:function(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+6*(t-e)*i:i<.5?t:i<2/3?e+(t-e)*(2/3-i)*6:e},toString:function(){if(this._alpha<1)return this.toCSS("rgba",this._alpha).replace(/\s+/g,"");var e=parseInt(this._color,10).toString(16);if(this.error)return"";if(e.length<6)for(var t=6-e.length-1;t>=0;t--)e="0"+e;return"#"+e},toCSS:function(e,t){switch(e=e||"hex",t=parseFloat(t||this._alpha),e){case"rgb":case"rgba":var i=this.toRgb();return t<1?"rgba( "+i.r+", "+i.g+", "+i.b+", "+t+" )":"rgb( "+i.r+", "+i.g+", "+i.b+" )";case"hsl":case"hsla":var l=this.toHsl();return t<1?"hsla( "+l.h+", "+l.s+"%, "+l.l+"%, "+t+" )":"hsl( "+l.h+", "+l.s+"%, "+l.l+"% )";default:return this.toString()}},toRgb:function(){return{r:255&this._color>>16,g:255&this._color>>8,b:255&this._color}},toHsl:function(){var e,t,i=this.toRgb(),l=i.r/255,s=i.g/255,o=i.b/255,n=Math.max(l,s,o),r=Math.min(l,s,o),a=(n+r)/2;if(n===r)e=t=0;else{var d=n-r;switch(t=a>.5?d/(2-n-r):d/(n+r),n){case l:e=(s-o)/d+(s<o?6:0);break;case s:e=(o-l)/d+2;break;case o:e=(l-s)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsl.h!==e&&(e=this._hsl.h),t=Math.round(100*t),0===t&&this._hsl.s&&(t=this._hsl.s),{h:e,s:t,l:Math.round(100*a)}},toHsv:function(){var e,t,i=this.toRgb(),l=i.r/255,s=i.g/255,o=i.b/255,n=Math.max(l,s,o),r=Math.min(l,s,o),a=n,d=n-r;if(t=0===n?0:d/n,n===r)e=t=0;else{switch(n){case l:e=(s-o)/d+(s<o?6:0);break;case s:e=(o-l)/d+2;break;case o:e=(l-s)/d+4}e/=6}return e=Math.round(360*e),0===e&&this._hsv.h!==e&&(e=this._hsv.h),t=Math.round(100*t),0===t&&this._hsv.s&&(t=this._hsv.s),{h:e,s:t,v:Math.round(100*a)}},toInt:function(){return this._color},toIEOctoHex:function(){var e=this.toString(),t=parseInt(255*this._alpha,10).toString(16);return 1===t.length&&(t="0"+t),"#"+t+e.replace(/^#/,"")},toLuminosity:function(){var e=this.toRgb();return.2126*Math.pow(e.r/255,2.2)+.7152*Math.pow(e.g/255,2.2)+.0722*Math.pow(e.b/255,2.2)},getDistanceLuminosityFrom:function(e){if(!(e instanceof i))throw"getDistanceLuminosityFrom requires a Color object";var t=this.toLuminosity(),l=e.toLuminosity();return t>l?(t+.05)/(l+.05):(l+.05)/(t+.05)},getMaxContrastColor:function(){var e=this.toLuminosity(),t=e>=.5?"000000":"ffffff";return new i(t)},getReadableContrastingColor:function(e,l){if(!(e instanceof i))return this;var s=l===t?5:l,o=e.getDistanceLuminosityFrom(this),n=e.getMaxContrastColor(),r=n.getDistanceLuminosityFrom(e);if(r<=s)return n;if(o>=s)return this;for(var a=0===n.toInt()?-1:1;o<s&&(this.l(a,!0),o=this.getDistanceLuminosityFrom(e),0!==this._color&&16777215!==this._color););return this},a:function(e){if(e===t)return this._alpha;var i=parseFloat(e);return isNaN(i)?this._error():(this._alpha=i,this)},darken:function(e){return e=e||5,this.l(-e,!0)},lighten:function(e){return e=e||5,this.l(e,!0)},saturate:function(e){return e=e||15,this.s(e,!0)},desaturate:function(e){return e=e||15,this.s(-e,!0)},toGrayscale:function(){return this.setHSpace("hsl").s(0)},getComplement:function(){return this.h(180,!0)},getSplitComplement:function(e){e=e||1;var t=180+30*e;return this.h(t,!0)},getAnalog:function(e){e=e||1;var t=30*e;return this.h(t,!0)},getTetrad:function(e){e=e||1;var t=60*e;return this.h(t,!0)},getTriad:function(e){e=e||1;var t=120*e;return this.h(t,!0)},_partial:function(e){var i=l[e];return function(l,s){var o=this._spaceFunc("to",i.space);return l===t?o[e]:(s===!0&&(l=o[e]+l),i.mod&&(l%=i.mod),i.range&&(l=l<i.range[0]?i.range[0]:l>i.range[1]?i.range[1]:l),o[e]=l,this._spaceFunc("from",i.space,o))}},_spaceFunc:function(e,t,i){var l=t||this._hSpace,s=e+l.charAt(0).toUpperCase()+l.substr(1);return this[s](i)}};var l={h:{mod:360},s:{range:[0,100]},l:{space:"hsl",range:[0,100]},v:{space:"hsv",range:[0,100]},r:{space:"rgb",range:[0,255]},g:{space:"rgb",range:[0,255]},b:{space:"rgb",range:[0,255]}};for(var s in l)l.hasOwnProperty(s)&&(i.fn[s]=i.fn._partial(s));"object"==typeof exports?module.exports=i:e.Color=i}(this),function(e){FLLightbox=function(e){this._init(e)},FLLightbox.closeParent=function(t){var i=e(t).closest(".fl-lightbox-wrap").attr("data-instance-id");_.isUndefined(i)||FLLightbox._instances[i].close()},FLLightbox.getResizableControlClass=function(){var t=e(".fl-lightbox-resizable").eq(0),i="fa fa-window-maximize";return t.length&&t.hasClass("fl-lightbox-width-full")&&(i="fa fa-window-minimize"),i},FLLightbox.unbindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._unbind()},FLLightbox.bindAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e]._bind()},FLLightbox.closeAll=function(){var e;for(e in FLLightbox._instances)FLLightbox._instances[e].close()},FLLightbox._instances={},FLLightbox.prototype={_id:null,_node:null,_visible:!1,_allowClosing:!0,_resizeTimer:null,_defaults:{className:"",destroyOnClose:!1,resizable:!1},open:function(e){this._bind(),this._node.show(),this._visible=!0,"undefined"!=typeof e?this.setContent(e):this._resize(),this.trigger("open"),FLBuilder.triggerHook("didShowLightbox",this)},close:function(){var e=this._node.data("parent");this._allowClosing&&(this.trigger("beforeCloseLightbox"),this._unbind(),this._node.hide(),this._visible=!1,this.trigger("close"),FLBuilder.triggerHook("didHideLightbox"),this._defaults.resizable&&_.isUndefined(e)&&FLBuilder.triggerHook("didHideAllLightboxes"),this._defaults.destroyOnClose&&this.destroy())},disableClose:function(){this._allowClosing=!1},enableClose:function(){this._allowClosing=!0},setContent:function(e){this._node.find(".fl-lightbox-content").html(e),this._resize()},empty:function(){this._node.find(".fl-lightbox-content").empty()},on:function(e,t){this._node.on(e,t)},off:function(e,t){this._node.off(e,t)},trigger:function(e,t){this._node.trigger(e,t)},destroy:function(){this._node.empty(),this._node.remove(),FLLightbox._instances[this._id]="undefined";try{delete FLLightbox._instances[this._id]}catch(e){}},_init:function(t){var i=0,l=null;for(l in FLLightbox._instances)i++;this._defaults=e.extend({},this._defaults,t),this._id=(new Date).getTime()+i,FLLightbox._instances[this._id]=this,this._render(),this._resizable()},_render:function(){this._node=e('<div class="fl-lightbox-wrap" data-instance-id="'+this._id+'"><div class="fl-lightbox-mask"></div><div class="fl-lightbox"><div class="fl-lightbox-content-wrap"><div class="fl-lightbox-content"></div></div></div></div>'),this._node.addClass(this._defaults.className),e("body").append(this._node)},_bind:function(){e(window).on("resize.fl-lightbox-"+this._id,this._delayedResize.bind(this))},_unbind:function(){e(window).off("resize.fl-lightbox-"+this._id)},_resizable:function(){var t=(e("body"),this._node.find(".fl-lightbox-mask")),i=this._node.find(".fl-lightbox"),l=e(".fl-lightbox-resizable").eq(0);this._defaults.resizable?(t.hide(),i.addClass("fl-lightbox-resizable"),i.delegate(".fl-lightbox-resize-toggle","click",this._resizeClicked.bind(this)),i.draggable({cursor:"move",handle:".fl-lightbox-header"}).resizable({handles:"all",minHeight:500,minWidth:380,start:this._resizeStart.bind(this),stop:this._resizeStop.bind(this)}),l.length&&l.hasClass("fl-lightbox-width-full")?(i.addClass("fl-lightbox-width-full"),i.draggable("disable")):this._restorePosition()):t.show(),this._resize()},_delayedResize:function(){clearTimeout(this._resizeTimer),this._resizeTimer=setTimeout(this._resize.bind(this),250)},_resize:function(){var t=this._node.find(".fl-lightbox"),i=parseInt(this._node.css("padding-top")),l=parseInt(this._node.css("padding-bottom")),s=parseInt(this._node.css("padding-left")),o=parseInt(this._node.css("padding-right")),n=t.height(),r=t.width(),a=e(window),d=a.height()-i-l,u=(a.width()-s-o,"0px");this._defaults.resizable?(r<600?t.addClass("fl-lightbox-width-slim"):t.removeClass("fl-lightbox-width-slim"),this._resizeEditors()):(d>n&&(u=(d-n-46)/2+"px"),t.attr("style","").css("margin",u+" auto 0")),this.trigger("resized")},_resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),e(".fl-builder-lightbox:visible").append('<div class="fl-builder-resizable-iframe-fix"></div>'),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},_resizeStop:function(t,i){var l=e(".fl-lightbox-resizable:visible");parseInt(l.css("top"))<0&&l.css("top","0"),this._savePosition(),e("body").removeClass("fl-builder-resizable-is-resizing"),e(".fl-builder-resizable-iframe-fix").remove(),FLBuilder._bindOverlayEvents()},_resizeClicked:function(){var t=e(".fl-lightbox-resizable"),i=(t.find(".fl-lightbox-resize-toggle"),this._node.find(".fl-lightbox"));i.hasClass("fl-lightbox-width-full")?this._resizeExitFull():this._resizeEnterFull(),this._resize()},_resizeEnterFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-maximize").addClass("fa-window-minimize"),t.addClass("fl-lightbox-width-full"),t.draggable("disable"),t.resizable("disable")},_resizeExitFull:function(){var t=e(".fl-lightbox-resizable"),i=t.find(".fl-lightbox-resize-toggle");this._node.find(".fl-lightbox");i.removeClass("fa-window-minimize").addClass("fa-window-maximize"),t.removeClass("fl-lightbox-width-full"),t.draggable("enable"),t.resizable("enable")},_resizeEditors:function(){e(".fl-lightbox-resizable").each(function(){var t=e(this),i=t.find(".fl-builder-settings-fields").height(),l=t.find(".mce-edit-area > iframe, textarea.wp-editor-area, .ace_editor"),s=null;i<350&&(i=350),l.each(function(){s=e(this),s.hasClass("ace_editor")?(s.height(i-60),s.closest(".fl-field").data("editor").resize()):s.closest(".mce-container-body").find(".mce-toolbar-grp .mce-toolbar.mce-last").is(":visible")?s.height(i-175):s.height(i-150)})})},_savePosition:function(){var e=this._node.find(".fl-lightbox"),t={width:e.width(),height:e.height(),top:parseInt(e.css("top"))<0?"0px":e.css("top"),left:e.css("left")};e.closest(".fl-builder-ui-pinned").length||(FLBuilderConfig.userSettings.lightbox=t,FLBuilder.ajax({action:"save_lightbox_position",data:t}))},_restorePosition:function(){var e=this._node.find(".fl-lightbox"),t=FLBuilderConfig.userSettings.lightbox;t?e.css(t):e.css({top:25,left:FLBuilderConfig.isRtl?"-25":25})}}}(jQuery),function(e){FLIconSelector={_content:null,_lightbox:null,_rendered:!1,_filterText:"",open:function(e){FLIconSelector._rendered||FLIconSelector._render(),null===FLIconSelector._content?(FLIconSelector._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder.ajax({
2
  action:"render_icon_selector"},FLIconSelector._getContentComplete)):FLIconSelector._lightbox.open(),FLIconSelector._lightbox.on("icon-selected",function(t,i){FLIconSelector._lightbox.off("icon-selected"),FLIconSelector._lightbox.close(),e(i)})},_render:function(){FLIconSelector._lightbox=new FLLightbox({className:"fl-icon-selector"}),FLIconSelector._rendered=!0,FLBuilder.addHook("endEditingSession",function(){FLIconSelector._lightbox.close()})},_getContentComplete:function(t){var i=JSON.parse(t);FLIconSelector._content=i.html,FLIconSelector._lightbox.setContent(i.html),e(".fl-icons-filter-select").on("change",FLIconSelector._filter),e(".fl-icons-filter-text").on("keyup",FLIconSelector._filter),e(".fl-icons-list i").on("click",FLIconSelector._select),e(".fl-icon-selector-cancel").on("click",e.proxy(FLIconSelector._lightbox.close,FLIconSelector._lightbox))},_filter:function(){var t=e(".fl-icons-filter-select").val(),i=e(".fl-icons-filter-text").val();"all"==t?e(".fl-icons-section").show():(e(".fl-icons-section").hide(),e(".fl-"+t).show()),FLIconSelector._filterText=i,""!==i?e(".fl-icons-list i").each(FLIconSelector._filterIcon):e(".fl-icons-list i").show()},_filterIcon:function(){var t=e(this);-1==t.attr("class").indexOf(FLIconSelector._filterText)?t.hide():t.show()},_select:function(){var t=e(this).attr("class");FLIconSelector._lightbox.trigger("icon-selected",t)}}}(jQuery),function(e){FLStyleSheet=function(t){"object"==typeof t&&e.extend(this,t),this._createSheet()},FLStyleSheet.prototype={id:null,_sheet:null,_sheetElement:null,updateRule:function(e,t,i){for(var l=this._sheet.cssRules?this._sheet.cssRules:this._sheet.rules,s=null,o=0;o<l.length;o++)l[o].selectorText.toLowerCase()==e.toLowerCase()&&(s=l[o]);if(s)if("object"==typeof t)for(o in t)s.style[this._toCamelCase(o)]=t[o];else s.style[this._toCamelCase(t)]=i;else this.addRule(e,t,i)},addRule:function(e,t,i){var l="",s="";if("object"==typeof t)for(s in t)l+=s+":"+t[s]+";";else l=t+":"+i+";";this._sheet.insertRule?this._sheet.insertRule(e+" { "+l+" }",this._sheet.cssRules.length):this._sheet.addRule(e,l)},destroy:function(){this._sheetElement&&(this._sheetElement.remove(),this._sheetElement=null),this._sheet&&(this._sheet=null)},disable:function(){this._sheet.disabled=!0},enable:function(){this._sheet.disabled=!1},_createSheet:function(){var t=this.id?' id="'+this.id+'"':"",i=this.className?' class="'+this.className+'"':"";this._sheet||(this._sheetElement=e('<style type="text/css"'+t+i+"></style>"),e("body").append(this._sheetElement),this._sheet=this._sheetElement[0].sheet)},_toCamelCase:function(e){return e.toLowerCase().replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}}(jQuery),function(e){FLBuilder={preview:null,_actionsLightbox:null,_addModuleAfterNodeRender:null,_colResizeData:null,_colResizing:!1,_contentClass:!1,_dragEnabled:!1,_dragging:!1,_dragInitialScrollTop:0,_exitUrl:null,_layout:null,_layoutSettingsCSSCache:null,_layoutSettingsCSSTimeout:null,_lightbox:null,_lightboxScrollbarTimeout:null,_loadedModuleAssets:[],_moduleHelpers:{},_multiplePhotoSelector:null,_newColParent:null,_newColPosition:0,_newColGroupParent:null,_newColGroupPosition:0,_newModuleParent:null,_newModulePosition:0,_newRowPosition:0,_selectedTemplateId:null,_selectedTemplateType:null,_singlePhotoSelector:null,_singleVideoSelector:null,_multipleAudiosSelector:null,_init:function(){FLBuilder._initJQueryReadyFix(),FLBuilder._initGlobalErrorHandling(),FLBuilder._initPostLock(),FLBuilder._initClassNames(),FLBuilder._initMediaUploader(),FLBuilder._initOverflowFix(),FLBuilder._initScrollbars(),FLBuilder._initLightboxes(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._initStrings(),FLBuilder._initTipTips(),FLBuilder._initTinyMCE(),FLBuilder._bindEvents(),FLBuilder._bindOverlayEvents(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder.addHook("didInitUI",FLBuilder._showTourOrTemplates.bind(FLBuilder)),FLBuilder.triggerHook("init")},_initJQueryReadyFix:function(){FLBuilderConfig.debug||(jQuery.fn.oldReady=jQuery.fn.ready,jQuery.fn.ready=function(t){return jQuery.fn.oldReady(function(){try{"function"==typeof t&&t(e)}catch(i){FLBuilder.logError(i)}})})},_initGlobalErrorHandling:function(){FLBuilderConfig.debug||(window.onerror=function(e,t,i,l,s){return FLBuilder.logGlobalError(e,t,i,l,s),!0})},_initPostLock:function(){"undefined"!=typeof wp.heartbeat&&(wp.heartbeat.interval(30),wp.heartbeat.enqueue("fl_builder_post_lock",{post_id:FLBuilderConfig.postId}))},_initClassNames:function(){e("html").addClass("fl-builder-edit"),e("body").addClass("fl-builder"),FLBuilderConfig.simpleUi&&e("body").addClass("fl-builder-simple"),FLBuilder._contentClass=".fl-builder-content-"+FLBuilderConfig.postId,e(FLBuilder._contentClass).addClass("fl-builder-content-editing")},_initMediaUploader:function(){wp.media.model.settings.post.id=FLBuilderConfig.postId},_initOverflowFix:function(){e(FLBuilder._contentClass).parents().css("overflow","visible")},_initScrollbars:function(){e(".fl-nanoscroller").nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},_initSortables:function(){var t={appendTo:"body",cursor:"move",cursorAt:{left:85,top:20},distance:1,helper:FLBuilder._blockDragHelper,start:FLBuilder._blockDragStart,sort:FLBuilder._blockDragSort,change:FLBuilder._blockDragChange,stop:FLBuilder._blockDragStop,placeholder:"fl-builder-drop-zone",tolerance:"intersect"},i="",l="";l="row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-col-content":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target, "+FLBuilder._contentClass+" .fl-row:not(.fl-node-global) .fl-col-content",i=FLBuilderConfig.nestedColumns?l:"row"==FLBuilderConfig.userTemplateType?FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target":FLBuilder._contentClass+" .fl-row-drop-target, "+FLBuilder._contentClass+" .fl-col-group-drop-target, "+FLBuilder._contentClass+" .fl-col-drop-target",e(".fl-builder-rows").sortable(e.extend({},t,{connectWith:i,items:".fl-builder-block-row",stop:FLBuilder._rowDragStop})),e(".fl-builder-row-templates").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-row-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-rows").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:FLBuilder._contentClass+" .fl-row-drop-target",items:".fl-builder-block-saved-row",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-modules, .fl-builder-widgets").sortable(e.extend({},t,{connectWith:l,items:".fl-builder-block-module",stop:FLBuilder._moduleDragStop})),e(".fl-builder-module-templates").sortable(e.extend({},t,{connectWith:l,items:".fl-builder-block-module-template",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-builder-saved-modules").sortable(e.extend({},t,{cancel:".fl-builder-node-template-actions, .fl-builder-node-template-edit, .fl-builder-node-template-delete",connectWith:l,items:".fl-builder-block-saved-module",stop:FLBuilder._nodeTemplateDragStop})),e(".fl-row-sortable-proxy").sortable(e.extend({},t,{connectWith:FLBuilder._contentClass+" .fl-row-drop-target",helper:FLBuilder._rowDragHelper,start:FLBuilder._rowDragStart,stop:FLBuilder._rowDragStop})),e(".fl-col-sortable-proxy").sortable(e.extend({},t,{connectWith:l,helper:FLBuilder._colDragHelper,start:FLBuilder._colDragStart,stop:FLBuilder._colDragStop})),e(FLBuilder._contentClass+" .fl-col-content").sortable(e.extend({},t,{connectWith:l,handle:".fl-module-overlay .fl-block-overlay-actions .fl-block-move",helper:FLBuilder._moduleDragHelper,items:".fl-module, .fl-col-group",start:FLBuilder._moduleDragStart,stop:FLBuilder._moduleDragStop})),e(FLBuilder._contentClass+" .fl-row-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-group-drop-target").sortable(t),e(FLBuilder._contentClass+" .fl-col-drop-target").sortable(t)},_initStrings:function(){e.validator.messages.required=FLBuilderStrings.validateRequiredMessage},_bindEvents:function(){$excludedLinks=e(".fl-builder-bar a, .fl-builder--content-library-panel a, .fl-page-nav .nav a"),e("a").not($excludedLinks).on("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").on("click",FLBuilder._headerLinkClicked),e("body").delegate("button.fl-builder-button","mouseup",this._buttonMouseUp.bind(this)),e(document).on("heartbeat-tick",FLBuilder._initPostLock),e(window).on("beforeunload",FLBuilder._warnBeforeUnload),e("body").delegate(".fl-builder-has-submenu","click",FLBuilder._submenuParentClicked),e("body").delegate(".fl-builder-has-submenu a","click",FLBuilder._submenuChildClicked),e("body").delegate(".fl-builder-submenu","mouseenter",FLBuilder._submenuMouseenter),e("body").delegate(".fl-builder-submenu","mouseleave",FLBuilder._submenuMouseleave),e("body").delegate(".fl-builder-submenu .fl-builder-has-submenu","mouseenter",FLBuilder._submenuNestedParentMouseenter),e(".fl-builder-panel-actions .fl-builder-panel-close").on("click",FLBuilder._closePanel),e(".fl-builder-blocks-section-title").on("click",FLBuilder._blockSectionTitleClicked),e("body").delegate(".fl-builder-node-template-actions","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-delete","mousedown",FLBuilder._stopPropagation),e("body").delegate(".fl-builder-node-template-edit","click",FLBuilder._editNodeTemplateClicked),e("body").delegate(".fl-builder-node-template-delete","click",FLBuilder._deleteNodeTemplateClicked),e("body").delegate(".fl-builder-block","mousedown",FLBuilder._blockDragInit),e("body").on("mouseup",FLBuilder._blockDragCancel),e("body").delegate(".fl-builder-actions .fl-builder-cancel-button","click",FLBuilder._cancelButtonClicked),e("body").delegate(".fl-builder-save-user-template-button","click",FLBuilder._saveUserTemplateClicked),e("body").delegate(".fl-builder-duplicate-layout-button","click",FLBuilder._duplicateLayoutClicked),e("body").delegate(".fl-builder-layout-settings-button","click",FLBuilder._layoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-save","click",FLBuilder._saveLayoutSettingsClicked),e("body").delegate(".fl-builder-layout-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-builder-global-settings-button","click",FLBuilder._globalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-save","click",FLBuilder._saveGlobalSettingsClicked),e("body").delegate(".fl-builder-global-settings .fl-builder-settings-cancel","click",FLBuilder._cancelLayoutSettingsClicked),e("body").delegate(".fl-user-template","click",FLBuilder._userTemplateClicked),e("body").delegate(".fl-user-template-edit","click",FLBuilder._editUserTemplateClicked),e("body").delegate(".fl-user-template-delete","click",FLBuilder._deleteUserTemplateClicked),e("body").delegate(".fl-builder-template-replace-button","click",FLBuilder._templateReplaceClicked),e("body").delegate(".fl-builder-template-append-button","click",FLBuilder._templateAppendClicked),e("body").delegate(".fl-builder-template-actions .fl-builder-cancel-button","click",FLBuilder._templateCancelClicked),e("body").delegate(".fl-builder-user-template-settings .fl-builder-settings-save","click",FLBuilder._saveUserTemplateSettings),e("body").delegate(".fl-builder-help-tour-button","click",FLBuilder._startHelpTour),e("body").delegate(".fl-builder-knowledge-base-button","click",FLBuilder._viewKnowledgeBaseClicked),e("body").delegate(".fl-builder-forums-button","click",FLBuilder._visitForumsClicked),e("body").delegate(".fl-builder-no-tour-button","click",FLBuilder._noTourButtonClicked),e("body").delegate(".fl-builder-yes-tour-button","click",FLBuilder._yesTourButtonClicked),e("body").delegate(".fl-builder-alert-close","click",FLBuilder._alertClose),e("body").delegate(".fl-block-overlay","contextmenu",FLBuilder._removeAllOverlays),e("body").delegate(".fl-row-overlay .fl-block-remove","click",FLBuilder._deleteRowClicked),e("body").delegate(".fl-row-overlay .fl-block-copy","click",FLBuilder._rowCopyClicked),e("body").delegate(".fl-row-overlay .fl-block-move","mousedown",FLBuilder._rowDragInit),e("body").delegate(".fl-row-overlay .fl-block-settings","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-row-overlay","click",FLBuilder._rowSettingsClicked),e("body").delegate(".fl-builder-row-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-row-reset","click",FLBuilder._resetRowWidthClicked),e("body").delegate(".fl-col-overlay .fl-block-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-copy","click",FLBuilder._copyColClicked),e("body").delegate(".fl-col-overlay .fl-block-remove","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-col-overlay","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-builder-col-settings .fl-builder-settings-save","click",FLBuilder._saveSettings),e("body").delegate(".fl-block-col-submenu .fl-block-col-move","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-delete","click",FLBuilder._deleteColClicked),e("body").delegate(".fl-block-col-submenu .fl-block-col-reset","click",FLBuilder._resetColumnWidthsClicked),e("body").delegate(".fl-block-col-submenu li","mouseenter",FLBuilder._showColHighlightGuide),e("body").delegate(".fl-block-col-submenu li","mouseleave",FLBuilder._removeColHighlightGuides),e("body").delegate(".fl-block-col-submenu .fl-block-col-move-parent","mousedown",FLBuilder._colDragInit),e("body").delegate(".fl-block-col-submenu .fl-block-col-edit-parent","click",FLBuilder._colSettingsClicked),e("body").delegate(".fl-module-overlay .fl-block-remove","click",FLBuilder._deleteModuleClicked),e("body").delegate(".fl-module-overlay .fl-block-copy","click",FLBuilder._moduleCopyClicked),e("body").delegate(".fl-module-overlay .fl-block-move","mousedown",FLBuilder._blockDragInit),e("body").delegate(".fl-module-overlay .fl-block-settings","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-module-overlay","click",FLBuilder._moduleSettingsClicked),e("body").delegate(".fl-builder-module-settings .fl-builder-settings-save","click",FLBuilder._saveModuleClicked),e("body").delegate(".fl-builder-settings-save-as","click",FLBuilder._showNodeTemplateSettings),e("body").delegate(".fl-builder-node-template-settings .fl-builder-settings-save","click",FLBuilder._saveNodeTemplate),e("body").delegate(".fl-builder-settings-tabs a","click",FLBuilder._settingsTabClicked),e("body").delegate(".fl-builder-settings-tabs a","show",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-tabs a","hide",FLBuilder._calculateSettingsTabsOverflow),e("body").delegate(".fl-builder-settings-cancel","click",FLBuilder._settingsCancelClicked),e("body").delegate(".fl-builder-settings-tabs-overflow-menu > a","click",FLBuilder._settingsTabsToOverflowMenuItemClicked.bind(this)),e("body").delegate(".fl-builder-settings-tabs-more","click",FLBuilder._toggleTabsOverflowMenu.bind(this)),e("body").delegate(".fl-builder-settings-tabs-overflow-click-mask","click",FLBuilder._hideTabsOverflowMenu.bind(this)),e("body").delegate(".fl-help-tooltip-icon","mouseover",FLBuilder._showHelpTooltip),e("body").delegate(".fl-help-tooltip-icon","mouseout",FLBuilder._hideHelpTooltip),e("body").delegate(".fl-builder-field-add","click",FLBuilder._addFieldClicked),e("body").delegate(".fl-builder-field-copy","click",FLBuilder._copyFieldClicked),e("body").delegate(".fl-builder-field-delete","click",FLBuilder._deleteFieldClicked),e("body").delegate(".fl-builder-settings-fields select","change",FLBuilder._settingsSelectChanged),e("body").delegate(".fl-photo-field .fl-photo-select","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-edit","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-replace","click",FLBuilder._selectSinglePhoto),e("body").delegate(".fl-photo-field .fl-photo-remove","click",FLBuilder._singlePhotoRemoved),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-select","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-edit","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-multiple-photos-field .fl-multiple-photos-add","click",FLBuilder._selectMultiplePhotos),e("body").delegate(".fl-video-field .fl-video-select","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-video-field .fl-video-replace","click",FLBuilder._selectSingleVideo),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-select","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-edit","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-multiple-audios-field .fl-multiple-audios-add","click",FLBuilder._selectMultipleAudios),e("body").delegate(".fl-icon-field .fl-icon-select","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-replace","click",FLBuilder._selectIcon),e("body").delegate(".fl-icon-field .fl-icon-remove","click",FLBuilder._removeIcon),e("body").delegate(".fl-form-field .fl-form-field-edit","click",FLBuilder._formFieldClicked),e("body").delegate(".fl-form-field-settings .fl-builder-settings-save","click",FLBuilder._saveFormFieldClicked),e("body").delegate(".fl-layout-field-option","click",FLBuilder._layoutFieldClicked),e("body").delegate(".fl-link-field-select","click",FLBuilder._linkFieldSelectClicked),e("body").delegate(".fl-link-field-search-cancel","click",FLBuilder._linkFieldSelectCancelClicked),e("body").delegate(".fl-loop-data-source-select select[name=data_source]","change",FLBuilder._loopDataSourceChange),e("body").delegate(".fl-custom-query select[name=post_type]","change",FLBuilder._customQueryPostTypeChange),e("body").delegate(".fl-field input[type=number]","focus",FLBuilder._onNumberFieldFocus),e("body").delegate(".fl-field input[type=number]","blur",FLBuilder._onNumberFieldBlur),FLBuilder.addHook("didCompleteAJAX",FLBuilder._refreshSettingsPreviewReference),FLBuilder.addHook("didRenderLayoutComplete",FLBuilder._refreshSettingsPreviewReference)},_unbindEvents:function(){e("a").off("click",FLBuilder._preventDefault),e(".fl-page-nav .nav a").off("click",FLBuilder._headerLinkClicked)},_bindOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.delegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.delegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.delegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.delegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.delegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.delegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_destroyOverlayEvents:function(){var t=e(FLBuilder._contentClass);t.undelegate(".fl-row","mouseenter",FLBuilder._rowMouseenter),t.undelegate(".fl-row","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-row-overlay","mouseleave",FLBuilder._rowMouseleave),t.undelegate(".fl-col","mouseenter",FLBuilder._colMouseenter),t.undelegate(".fl-col","mouseleave",FLBuilder._colMouseleave),t.undelegate(".fl-module","mouseenter",FLBuilder._moduleMouseenter),t.undelegate(".fl-module","mouseleave",FLBuilder._moduleMouseleave)},_preventDefault:function(e){e.preventDefault()},_stopPropagation:function(e){e.stopPropagation()},_headerLinkClicked:function(t){var i=e(this),l=i.attr("href");this.hash||(t.preventDefault(),FLBuilderConfig.isUserTemplate||(FLBuilder._exitUrl=l.indexOf("?")>-1?l:l+"?fl_builder",FLBuilder.triggerHook("triggerDone")))},_warnBeforeUnload:function(){var t=e(".fl-builder-row-settings").length>0,i=e(".fl-builder-col-settings").length>0,l=e(".fl-builder-module-settings").length>0;if(t||i||l)return FLBuilderStrings.unloadWarning},_initTipTips:function(){e(".fl-tip:not(.fl-has-tip)").each(function(){var t=e(this);t.addClass("fl-has-tip"),void 0==t.attr("data-title")&&t.attr("data-title",t.attr("title"))}).tipTip({defaultPosition:"top",delay:1e3})},_hideTipTips:function(){e("#tiptip_holder").stop().hide()},_submenuParentClicked:function(t){var i=e("body"),l=e(this),s=l.find(".fl-builder-submenu");l.hasClass("fl-builder-submenu-open")?(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-right")):(l.offset().left+s.width()>e(window).width()&&l.addClass("fl-builder-submenu-right"),i.addClass("fl-builder-submenu-open"),l.addClass("fl-builder-submenu-open")),s.closest(".fl-row-overlay").addClass("fl-row-menu-active"),FLBuilder._hideTipTips(),t.preventDefault(),t.stopPropagation()},_submenuChildClicked:function(t){var i=e("body"),l=e(this).parents(".fl-builder-has-submenu");l.parents(".fl-builder-has-submenu").length||(i.removeClass("fl-builder-submenu-open"),l.removeClass("fl-builder-submenu-open"))},_submenuMouseenter:function(t){var i=e(this),l=i.data("timeout");"undefined"!=typeof l&&clearTimeout(l)},_submenuMouseleave:function(t){var i=e("body"),l=e(this),s=setTimeout(function(){i.removeClass("fl-builder-submenu-open"),l.closest(".fl-builder-has-submenu").removeClass("fl-builder-submenu-open")},500);l.closest(".fl-row-overlay").removeClass("fl-row-menu-active"),l.data("timeout",s)},_submenuNestedParentMouseenter:function(t){var i=e(this),l=i.find(".fl-builder-submenu");i.width()+i.offset().left+l.width()>e(window).width()&&i.addClass("fl-builder-submenu-right")},_closeAllSubmenus:function(){e(".fl-builder-submenu-open").removeClass("fl-builder-submenu-open")},_upgradeClicked:function(){window.open(FLBuilderConfig.upgradeUrl)},_buttonMouseUp:function(t){e(t.currentTarget).blur()},_closePanel:function(){FLBuilder.triggerHook("hideContentPanel")},_showPanel:function(){FLBuilder.triggerHook("showContentPanel")},_togglePanel:function(){FLBuilder.triggerHook("toggleContentPanel")},_blockSectionTitleClicked:function(){var t=e(this),i=t.parent();i.hasClass("fl-active")?i.removeClass("fl-active"):(e(".fl-builder-blocks-section").removeClass("fl-active"),i.addClass("fl-active")),FLBuilder._initScrollbars()},_publishLayout:function(e){if(FLBuilder._triggerSettingsSave(!1,!0)){if(_.isUndefined(e))var e=!0;FLBuilder.ajax({action:"save_layout"},this._onPublishComplete.bind(this,e))}},_publishButtonClicked:function(e){FLBuilder._publishLayout(e)},_onPublishComplete:function(t){t&&(FLBuilderConfig.shouldRefreshOnPublish?FLBuilder._exit():FLBuilder._exitWithoutRefresh()),e("#wp-admin-bar-fl-builder-frontend-edit-link .fl-builder-admin-bar-status-dot").css("color","#6bc373"),FLBuilder.triggerHook("didPublishLayout")},_draftButtonClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"save_draft"},FLBuilder._exit)},_discardButtonClicked:function(){var e=confirm(FLBuilderStrings.discardMessage);e?(FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"clear_draft_layout"},FLBuilder._exit)):FLBuilder.triggerHook("didCancelDiscard")},_cancelButtonClicked:function(){FLBuilder._exitUrl=null,FLBuilder._actionsLightbox.close()},_exit:function(){var e=window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):(FLBuilder._exitUrl?e=FLBuilder._exitUrl:(e=e.replace("?fl_builder&","?"),e=e.replace("?fl_builder",""),e=e.replace("&fl_builder","")),window.location.href=e)},_exitWithoutRefresh:function(){window.location.href;FLBuilderConfig.isUserTemplate&&"undefined"!=typeof window.opener&&window.opener?("undefined"!=typeof window.opener.FLBuilder&&("undefined"==typeof FLBuilderGlobalNodeId?window.opener.FLBuilder._updateLayout():window.opener.FLBuilder._updateNode(FLBuilderGlobalNodeId)),window.close()):FLBuilder.triggerHook("endEditingSession")},_duplicateLayoutClicked:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"duplicate_post"},FLBuilder._duplicateLayoutComplete)},_duplicateLayoutComplete:function(e){var t=FLBuilderConfig.adminUrl;window.location.href=t+"post.php?post="+e+"&action=edit"},_layoutSettingsClicked:function(){FLBuilderSettingsForms.render({id:"layout",className:"fl-builder-layout-settings",settings:FLBuilderSettingsConfig.settings.layout},function(){FLBuilder._layoutSettingsInitCSS()})},_layoutSettingsInitCSS:function(){var t=e(".fl-builder-settings #fl-field-css textarea:not(.ace_text-input)");t.on("change",FLBuilder._layoutSettingsCSSChanged),FLBuilder._layoutSettingsCSSCache=t.val()},_layoutSettingsCSSChanged:function(){FLBuilder._layoutSettingsCSSTimeout&&clearTimeout(FLBuilder._layoutSettingsCSSTimeout),FLBuilder._layoutSettingsCSSTimeout=setTimeout(e.proxy(FLBuilder._layoutSettingsCSSDoChange,this),600)},_layoutSettingsCSSDoChange:function(){var t=e(".fl-builder-settings"),i=e(this),l=i.parents("#fl-field-css");l.find(".ace_error").length>0||(t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(i.val()):e("#fl-builder-global-css").html(i.val()),FLBuilder._layoutSettingsCSSTimeout=null)},_saveLayoutSettingsClicked:function(){for(var t=e(this).closest(".fl-builder-settings"),i=t.serializeArray(),l={},s=0;s<i.length;s++)l[i[s].name]=i[s].value;FLBuilder.showAjaxLoader(),FLBuilder._lightbox.close(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_layout_settings",settings:l},function(){FLBuilder.triggerHook("didSaveLayoutSettingsComplete",l),FLBuilder._updateLayout()})},_cancelLayoutSettingsClicked:function(){var t=e(".fl-builder-settings");t.hasClass("fl-builder-layout-settings")?e("#fl-builder-layout-css").html(FLBuilder._layoutSettingsCSSCache):e("#fl-builder-global-css").html(FLBuilder._layoutSettingsCSSCache),FLBuilder._layoutSettingsCSSCache=null},_globalSettingsClicked:function(){FLBuilderSettingsForms.render({id:"global",className:"fl-builder-global-settings",settings:FLBuilderSettingsConfig.settings.global},function(){FLBuilder._layoutSettingsInitCSS()})},_saveGlobalSettingsClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.showAjaxLoader(),FLBuilder._layoutSettingsCSSCache=null,FLBuilder.ajax({action:"save_global_settings",settings:l},FLBuilder._saveGlobalSettingsComplete),FLBuilder._lightbox.close())},_saveGlobalSettingsComplete:function(e){FLBuilderConfig.global=JSON.parse(e),FLBuilder.triggerHook("didSaveGlobalSettingsComplete",FLBuilderConfig.global),FLBuilder._updateLayout()},_initTemplateSelector:function(){var t=e(FLBuilder._contentClass).find(".fl-row"),i=t.length>0;i||FLBuilder.ContentPanel.show("modules")},_requestTemplateInsert:function(e,t){FLBuilder.layoutHasContent()?0==e?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate(0,!1,t)):(FLBuilder._selectedTemplateId=e,FLBuilder._selectedTemplateType=t,FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(e,!1,t)},_showTemplateActions:function(){var e=[];e[10]={key:"template-replace",label:FLBuilderStrings.templateReplace},e[20]={key:"template-append",label:FLBuilderStrings.templateAppend},FLBuilder._showActionsLightbox({className:"fl-builder-template-actions",title:FLBuilderStrings.actionsLightboxTitle,buttons:e})},_templateReplaceClicked:function(){confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!1,FLBuilder._selectedTemplateType))},_templateAppendClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._applyTemplate(FLBuilder._selectedTemplateId,!0,FLBuilder._selectedTemplateType)},_templateCancelClicked:function(){FLBuilder.triggerHook("showContentPanel")},_applyTemplate:function(e,t,i){t="undefined"!=typeof t&&t?"1":"0",i="undefined"==typeof i?"core":i,FLBuilder._lightbox.close(),FLBuilder.showAjaxLoader(),"core"==i?FLBuilder.ajax({action:"apply_template",template_id:e,append:t},FLBuilder._applyTemplateComplete):FLBuilder.ajax({action:"apply_user_template",template_id:e,append:t},FLBuilder._applyUserTemplateComplete),FLBuilder.triggerHook("didApplyTemplate")},_applyTemplateComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didApplyTemplateComplete",t.config)},_applyUserTemplateComplete:function(t){var i=JSON.parse(t);null!==i.layout_css&&e("#fl-builder-layout-css").html(i.layout_css),FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didApplyTemplateComplete",i.config)},_saveUserTemplateClicked:function(){FLBuilderSettingsForms.render({id:"user_template",className:"fl-builder-user-template-settings",rules:{name:{required:!0}}})},_saveUserTemplateSettings:function(){var t=e(this).closest(".fl-builder-settings"),i=t.validate().form(),l=FLBuilder._getSettings(t);i&&(FLBuilder.ajax({action:"save_user_template",settings:l},FLBuilder._saveUserTemplateSettingsComplete),FLBuilder._lightbox.close())},_saveUserTemplateSettingsComplete:function(e){if(e){var e=JSON.parse(e);FLBuilderConfig.contentItems.template.push(e),FLBuilder.triggerHook("contentItemsChanged")}},_userTemplateClicked:function(){var t=e(this).attr("data-id");e(FLBuilder._contentClass).children(".fl-row").length>0?"blank"==t?confirm(FLBuilderStrings.changeTemplateMessage)&&(FLBuilder._lightbox._node.hide(),FLBuilder._applyTemplate("blank",!1,"user")):(FLBuilder._selectedTemplateId=t,FLBuilder._selectedTemplateType="user",FLBuilder._showTemplateActions(),FLBuilder._lightbox._node.hide()):FLBuilder._applyTemplate(t,!1,"user")},_editUserTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteUserTemplateClicked:function(t){var i=e(this).closest(".fl-user-template"),l=i.attr("data-id"),s=(e(".fl-user-template[data-id="+l+"]"),null),o=null,n=null;if(confirm(FLBuilderStrings.deleteTemplate)){FLBuilder.ajax({action:"delete_user_template",template_id:l});for(o in FLBuilderConfig.contentItems.template)n=FLBuilderConfig.contentItems.template[o],n.postId==l&&(s=o);_.isNull(s)||(FLBuilderConfig.contentItems.template.splice(s,1),FLBuilder.triggerHook("contentItemsChanged"))}t.stopPropagation()},_viewKnowledgeBaseClicked:function(){window.open(FLBuilderConfig.help.knowledge_base_url)},_visitForumsClicked:function(){window.open(FLBuilderConfig.help.forums_url)},_showTourOrTemplates:function(){FLBuilderConfig.simpleUi||FLBuilderConfig.isUserTemplate||(FLBuilderConfig.help.tour&&FLBuilderConfig.newUser?FLBuilder._showTourLightbox():FLBuilder._initTemplateSelector())},_showTourLightbox:function(){var e=wp.template("fl-tour-lightbox");FLBuilder._actionsLightbox.open(e())},_noTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilder._initTemplateSelector()},_yesTourButtonClicked:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_startHelpTour:function(){FLBuilder._actionsLightbox.close(),FLBuilderTour.start()},_setupEmptyLayout:function(){var t=e(FLBuilder._contentClass);FLBuilderConfig.isUserTemplate&&"module"==FLBuilderConfig.userTemplateType||(t.removeClass("fl-builder-empty"),t.find(".fl-builder-empty-message").remove(),t.find(".fl-row, .fl-builder-block").length||(t.addClass("fl-builder-empty"),t.append('<span class="fl-builder-empty-message">'+FLBuilderStrings.emptyMessage+"</span>"),
3
  FLBuilder._initSortables()))},_updateNode:function(t,i){e(".fl-node-"+t).length&&(FLBuilder._showNodeLoading(t),FLBuilder.ajax({action:"render_node",node_id:t},function(e){FLBuilder._renderLayout(JSON.parse(e),i)}.bind(this)))},_updateLayout:function(){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_layout"},FLBuilder._renderLayout)},_renderLayout:function(e,t){FLBuilder._layout=new FLBuilderAJAXLayout(e,t)},_renderLayoutComplete:function(){FLBuilder._layout&&(FLBuilder._layout._complete(),FLBuilder._layout=null)},_resizeLayout:function(){e(window).trigger("resize"),"undefined"!=typeof YUI&&YUI().use("node-event-simulate",function(e){e.one(window).simulate("resize")})},layoutHasContent:function(){return e(FLBuilder._contentClass).children(".fl-row").length>0},_initMediaElements:function(){var t={};"undefined"!=typeof e.fn.mediaelementplayer&&("undefined"!=typeof _wpmejsSettings&&(t.pluginPath=_wpmejsSettings.pluginPath),e(".wp-audio-shortcode, .wp-video-shortcode").not(".mejs-container").mediaelementplayer(t))},_initDropTargets:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=e(FLBuilder._contentClass+" .fl-row"),l=null,s=e(FLBuilder._contentClass+" .fl-row"+t).find(".fl-col-group"),o=null,n=null,r=0;for(e(".fl-col-drop-target").remove(),e(".fl-col-group-drop-target").remove(),e(".fl-row-drop-target").remove(),e(FLBuilder._contentClass).append('<div class="fl-drop-target fl-row-drop-target"></div>'),i.prepend('<div class="fl-drop-target fl-row-drop-target"></div>'),i.append('<div class="fl-drop-target fl-drop-target-last fl-row-drop-target fl-row-drop-target-last"></div>');r<i.length;r++)l=i.eq(r),0===l.find(".fl-col-group").length&&l.find(".fl-row-content").prepend('<div class="fl-drop-target fl-col-group-drop-target"></div>');for(r=0;r<s.length;r++)o=s.eq(r),n=o.find("> .fl-col"),o.hasClass("fl-col-group-nested")||(o.append('<div class="fl-drop-target fl-col-group-drop-target"></div>'),o.append('<div class="fl-drop-target fl-drop-target-last fl-col-group-drop-target fl-col-group-drop-target-last"></div>')),n.append('<div class="fl-drop-target fl-col-drop-target"></div>'),n.append('<div class="fl-drop-target fl-drop-target-last fl-col-drop-target fl-col-drop-target-last"></div>')},_blockDragHelper:function(e,t){var i=t.clone();return t.clone().insertAfter(t),i.addClass("fl-builder-block-drag-helper"),i},_blockDragInit:function(t){var i=e(t.currentTarget),l=null,s=e(window).scrollTop(),o=0;FLBuilder._dragEnabled=!0,FLBuilder._dragInitialScrollTop=s,i.closest("[data-node]").length>0?(l=i.closest("[data-node]"),l.addClass("fl-node-drag-init")):i.hasClass("fl-builder-block")&&e(".fl-row").each(function(){null===l&&e(this).offset().top-s>0&&(l=e(this))}),null!==l&&(o=l.offset().top-s),FLBuilder._highlightRowsAndColsForDrag(i),FLBuilder._adjustColHeightsForDrag(),FLBuilder._disableGlobalRows(),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays(),FLBuilder._initSortables(),e("body").addClass("fl-builder-dragging"),e(".fl-builder-empty-message").hide(),e(".fl-sortable-disabled").removeClass("fl-sortable-disabled"),o>0&&scrollTo(0,l.offset().top-o),FLBuilder.triggerHook("didInitDrag")},_blockDragStart:function(t,i){FLBuilder._dragging=!0,e(".fl-node-drag-init").removeClass("fl-node-drag-init"),FLBuilder.triggerHook("didStartDrag")},_blockDragSort:function(t,i){var l=i.placeholder.parent(),s=FLBuilderStrings.insert;FLBuilder._blockPreventSort(i.item,l)||(l.hasClass("fl-col-content")?s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-col-sortable-proxy-item")?FLBuilderStrings.column:i.item.hasClass("fl-builder-block-module")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-module")||i.item.hasClass("fl-builder-block-module-template")?i.item.find(".fl-builder-block-title").text():i.item.attr("data-name"):l.hasClass("fl-col-drop-target")?s="":l.hasClass("fl-col-group-drop-target")?s="":l.hasClass("fl-row-drop-target")&&(s=i.item.hasClass("fl-builder-block-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-builder-block-saved-row")?i.item.find(".fl-builder-block-title").text():i.item.hasClass("fl-row-sortable-proxy-item")?FLBuilderStrings.row:FLBuilderStrings.newRow),i.placeholder.html(s),i.item.hasClass("fl-node-global")||i.item.hasClass("fl-builder-block-global")||e(".fl-node-dragging").hasClass("fl-node-global")?i.placeholder.addClass("fl-builder-drop-zone-global"):i.placeholder.removeClass("fl-builder-drop-zone-global"))},_blockDragChange:function(e,t){t.placeholder.css("opacity","0"),t.placeholder.animate({opacity:"1"},100)},_blockPreventSort:function(t,i){var l=!1,s=t.hasClass("fl-builder-block-row"),o=t.hasClass("fl-col-sortable-proxy-item"),n=i.hasClass("fl-col-content"),r=i.hasClass("fl-col-drop-target"),a=i.parents(".fl-col-group:not(.fl-col-group-nested)"),d=i.parents(".fl-col-group-nested");return(s||o)&&n&&d.length>0&&(l=!0),n&&!i.find(".fl-module, .fl-col").length&&(s&&"1-col"==t.data("cols")?l=!0:o&&(l=!0)),s&&n&&e.inArray(t.data("cols"),["5-cols","6-cols"])>-1&&(l=!0),o&&e(".fl-node-dragging").find(".fl-col-group-nested").length>0&&(n||r&&d.length>0)&&(l=!0),r&&a.length>0&&0===d.length&&a.find("> .fl-col:visible").length>11&&(l=!0),r&&d.length>0&&d.find(".fl-col:visible").length>3&&(l=!0),l&&i.addClass("fl-sortable-disabled"),l},_blockDragStop:function(t,i){var l=e(window).scrollTop(),s=i.item.parent(),o=null;s.hasClass("fl-drop-target")&&s.closest("[data-node]").length?(s=s.closest("[data-node]"),o=s.offset().top-l):o=s.offset().top-l,s.hasClass("fl-builder-blocks-section-content")&&FLBuilder._showPanel(),FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),scrollTo(0,s.offset().top-o),FLBuilder.triggerHook("didStopDrag")},_blockDragCancel:function(){FLBuilder._dragEnabled&&!FLBuilder._dragging&&(FLBuilder._dragEnabled=!1,FLBuilder._dragging=!1,FLBuilder._bindOverlayEvents(),FLBuilder._highlightEmptyCols(),FLBuilder._enableGlobalRows(),FLBuilder._setupEmptyLayout(),e("body").removeClass("fl-builder-dragging"),e(".fl-node-drag-init").removeClass("fl-node-drag-init"),e(".fl-node-dragging").removeClass("fl-node-dragging"),scrollTo(0,FLBuilder._dragInitialScrollTop))},_reorderNode:function(e,t){FLBuilder.ajax({action:"reorder_node",node_id:e,position:t})},_moveNode:function(e,t,i){FLBuilder.ajax({action:"move_node",new_parent:e,node_id:t,position:i})},_removeAllOverlays:function(){FLBuilder._removeRowOverlays(),FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._removeModuleOverlays(),FLBuilder._hideTipTips(),FLBuilder._closeAllSubmenus()},_appendOverlay:function(e,t){var i=0,l=null,s=e.hasClass("fl-row"),o=s?e.find("> .fl-row-content-wrap"):e.find("> .fl-node-content"),n={top:parseInt(o.css("margin-top"),10),bottom:parseInt(o.css("margin-bottom"),10)};return e.append(t),e.addClass("fl-block-overlay-active"),FLBuilder._initTipTips(),l=e.find("> .fl-block-overlay"),n.top<0&&(i=parseInt(l.css("top"),10),i=isNaN(i)?0:i,l.css("top",n.top+i+"px")),n.bottom<0&&(i=parseInt(l.css("bottom"),10),i=isNaN(i)?0:i,l.css("bottom",n.bottom+i+"px")),l},_buildOverlayOverflowMenu:function(e){var t=e.find(".fl-block-overlay-actions"),i=t.data("original"),l=0,s=null,o=0,n=null,r=0,a=[],d=[],u=[],c=wp.template("fl-overlay-overflow-menu");for(void 0!=i&&(t.after(i),t.remove(),t=i),t.data("original",t.clone()),l=Math.floor(t[0].getBoundingClientRect().width)-8,s=t.find(" > i, > span.fl-builder-has-submenu");r<s.length;r++)n=s.eq(r),o+=Math.floor(n[0].getBoundingClientRect().width),o>l?(d.push(n),n.remove()):a.push(n);if(d.length>0){for(d.unshift(a.pop().remove()),r=0;r<d.length;r++)d[r].is(".fl-builder-has-submenu")?u.push({type:"submenu",label:d[r].find(".fa").data("title"),submenu:d[r].find(".fl-builder-submenu")[0].outerHTML}):u.push({type:"action",label:d[r].data("title"),className:d[r].removeClass(function(e,t){return t.replace(/fl-block-([^\s]+)/,"")}).attr("class")});t.append(c(u)),FLBuilder._initTipTips()}},_removeRowOverlays:function(){e(".fl-row").removeClass("fl-block-overlay-active"),e(".fl-row-overlay").remove(),e(".fl-module").removeClass("fl-module-adjust-height"),e("body").removeClass("fl-builder-row-resizing"),FLBuilder._closeAllSubmenus()},_disableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-row.fl-node-global").addClass("fl-node-disabled")},_enableGlobalRows:function(){"row"!=FLBuilderConfig.userTemplateType&&e(".fl-node-disabled").removeClass("fl-node-disabled")},_rowMouseenter:function(){var t=e(this),i=t.offset().top,l=null,s=null,o=wp.template("fl-row-overlay");t.closest(".fl-builder-node-loading").length||t.hasClass("fl-block-overlay-active")||(s=FLBuilder._appendOverlay(t,o({global:t.hasClass("fl-node-global"),node:t.attr("data-node")})),t.find(".fl-node-content:visible").each(function(){var t=e(this).offset().top;l=null===l||l>t?t:l}),null!==l&&l<i&&s.css("top",l-i-30+"px"),s.offset().top<43&&s.addClass("fl-row-overlay-header-bottom"),t.find(".fl-module").each(function(){var t=e(this);t.outerHeight(!0)<20&&t.addClass("fl-module-adjust-height")}),FLBuilder._buildOverlayOverflowMenu(s))},_rowMouseleave:function(t){var i=e(t.toElement)||e(t.relatedTarget),l=i.hasClass("fl-row-overlay"),s=i.closest(".fl-row-overlay").length>0,o=i.is("#tiptip_holder"),n=i.closest("#tiptip_holder").length>0;l||s||o||n||FLBuilder._removeRowOverlays()},_rowDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.row+"</div>")},_rowDragInit:function(t){var i=e(t.target),l=e(".fl-row-sortable-proxy-item"),s=i.closest(".fl-row");s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),t.target=l[0],l.trigger(t)},_rowDragStart:function(t,i){var l=e(FLBuilder._contentClass+" .fl-row"),s=e(".fl-node-dragging");1===l.length&&e(FLBuilder._contentClass).addClass("fl-builder-empty"),s.hide(),FLBuilder._blockDragStart(t,i)},_rowDragStop:function(t,i){var l=i.item,s=l.parent(),o=null,n=null,r=0;if(FLBuilder._blockDragStop(t,i),s.hasClass("fl-builder-rows"))return void l.remove();if(s.hasClass("fl-row-sortable-proxy"))return void e(".fl-node-dragging").removeClass("fl-node-dragging").show();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-col-content")?FLBuilder._addColGroup(l.closest(".fl-col").attr("data-node"),l.attr("data-cols"),s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l)):s.hasClass("fl-col-drop-target")?FLBuilder._addCols(s.closest(".fl-col"),s.hasClass("fl-col-drop-target-last")?"after":"before",l.attr("data-cols"),s.closest(".fl-col-group-nested").length>0):s.hasClass("fl-col-group-drop-target")?(n=l.closest(".fl-col-group"),r=l.closest(".fl-row").find(".fl-row-content > .fl-col-group").index(n),FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)):(o=l.closest(".fl-row"),r=o.length?e(FLBuilder._contentClass+" .fl-row").index(o):0,FLBuilder._addRow(l.attr("data-cols"),s.hasClass("fl-drop-target-last")?r+1:r)),l.remove(),FLBuilder._showPanel(),e(".fl-builder-modules").siblings(".fl-builder-blocks-section-title").eq(0).trigger("click")}else o=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s.parent().hasClass("fl-builder-content")||(s.hasClass("fl-drop-target-last")?s.parent().after(o):s.parent().before(o),FLBuilder._reorderNode(o.attr("data-node"),o.index())),e(".fl-row-sortable-proxy").append(i.item)},_addRow:function(t,i){FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),i),FLBuilder._newRowPosition=i,FLBuilder.ajax({action:"render_new_row",cols:t,position:i},FLBuilder._addRowComplete)},_addRowComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=e(FLBuilder._contentClass),s=e(i.html).data("node"),o=FLBuilder._addModuleAfterNodeRender;i.nodeParent=l,i.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(i,function(){null!==o&&(e(".fl-node-"+s+" .fl-col-content").append(o),FLBuilder._reorderModule(o),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddRow",s)})},_deleteRowClicked:function(t){var i=e(this).closest(".fl-row"),l=null;i.find(".fl-module").length?(l=confirm(FLBuilderStrings.deleteRowMessage),l&&FLBuilder._deleteRow(i)):FLBuilder._deleteRow(i),FLBuilder._removeAllOverlays(),t.stopPropagation()},_deleteRow:function(e){var t=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:t}),e.empty(),e.remove(),FLBuilder._setupEmptyLayout(),FLBuilder._removeRowOverlays(),FLBuilder.triggerHook("didDeleteRow",t)},_rowCopyClicked:function(t){var i=e(this).closest(".fl-row"),l=i.attr("data-node"),s=e(FLBuilder._contentClass+" .fl-row").index(i)+1,o=i.clone(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newRowPosition=s,FLBuilder.ajax({action:"copy_row",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedRow=l,FLBuilder._rowCopyComplete(t)}),t.stopPropagation()},_rowCopyComplete:function(t){t.nodeParent=e(FLBuilder._contentClass),t.nodePosition=FLBuilder._newRowPosition,FLBuilder._renderLayout(t,function(){FLBuilder.triggerHook("didDuplicateRow",{newNodeId:t.nodeId,oldNodeId:t.duplicatedRow}),t.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_rowSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-row").attr("data-node"),s=i.closest(".fl-block-overlay-global").length>0,o=null;s&&"row"!=FLBuilderConfig.userTemplateType?FLBuilderConfig.userCanEditGlobalTemplates&&(o=window.open(e('.fl-row[data-node="'+l+'"]').attr("data-template-url")),o.FLBuilderGlobalNodeId=l):i.hasClass("fl-block-settings")&&FLBuilderSettingsForms.render({id:"row",nodeId:l,className:"fl-builder-row-settings",attrs:'data-node="'+l+'"',buttons:s||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:s?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[l],preview:{type:"row"}},function(){e("#fl-field-width select").on("change",FLBuilder._rowWidthChanged),e("#fl-field-content_width select").on("change",FLBuilder._rowWidthChanged)}),t.stopPropagation()},_rowWidthChanged:function(){var t=e("#fl-field-width select").val(),i=e("#fl-field-content_width select").val(),l=e("#fl-field-max_content_width");"fixed"==t||"full"==t&&"fixed"==i?l.show():l.hide()},_resetRowWidthClicked:function(t){var i=e(this),l=i.closest(".fl-row"),s=l.attr("data-node"),o=l.find(".fl-row-content"),n=FLBuilderConfig.global.row_width+"px",r=e(".fl-builder-row-settings");l.hasClass("fl-row-fixed-width")&&l.css("max-width",n),o.css("max-width",n),r.length&&r.find("[name=max_content_width]").val(""),FLBuilder.ajax({action:"resize_row_content",node:s,width:""}),FLBuilder._closeAllSubmenus(),FLBuilder.triggerHook("didResetRowWidth",s),t.stopPropagation()},_highlightEmptyCols:function(){var t="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)",i=(e(FLBuilder._contentClass+" .fl-row"+t),e(FLBuilder._contentClass+" .fl-col"+t));e(".fl-row-highlight").removeClass("fl-row-highlight"),i.removeClass("fl-col-highlight").find(".fl-col-content").css("height",""),i.each(function(){var t=e(this);0===t.find(".fl-module, .fl-col").length&&t.addClass("fl-col-highlight")})},_removeEmptyColHighlights:function(){e(".fl-row-highlight").removeClass("fl-row-highlight"),e(".fl-col-highlight").removeClass("fl-col-highlight")},_highlightRowsAndColsForDrag:function(t){var i="row"==FLBuilderConfig.userTemplateType?"":":not(.fl-node-global)";e(FLBuilder._contentClass+" .fl-row").addClass("fl-row-highlight"),t.closest(".fl-row-overlay").length||e(FLBuilder._contentClass+" .fl-col"+i).addClass("fl-col-highlight")},_adjustColHeightsForDrag:function(){var t="row"==FLBuilderConfig.userTemplateType?"":".fl-row:not(.fl-node-global) ",i=e(FLBuilder._contentClass),l=i.find(t+".fl-col-group:not(.fl-col-group-nested) > .fl-col > .fl-col-content"),s=i.find(t+".fl-col-group-nested .fl-col-content"),o=0;for(e(".fl-node-drag-init").hide();o<s.length;o++)FLBuilder._adjustColHeightForDrag(s.eq(o));for(o=0;o<l.length;o++)FLBuilder._adjustColHeightForDrag(l.eq(o));e(".fl-node-drag-init").show()},_adjustColHeightForDrag:function(e){e.find(".fl-module:visible, .fl-col:visible").length&&e.height(e.height()+45)},_showColHighlightGuide:function(){var t=e(this),i=t.find("a"),l=t.closest(".fl-col"),s=l.parents(".fl-col"),o=e('<div class="fl-col-highlight-guide"></div>'),n=null,r=t.closest(".fl-block-overlay").offset().top;(i.hasClass("fl-block-col-move-parent")||i.hasClass("fl-block-col-edit-parent"))&&(l=s),l.hasClass("fl-col-highlight")||(l.find("> .fl-col-content").append(o),l.addClass("fl-col-has-highlight-guide"),n=o.offset().top,n>r&&o.css("top",r-n+4+"px"))},_removeColHighlightGuides:function(){e(".fl-col-has-highlight-guide").removeClass("fl-col-has-highlight-guide"),e(".fl-col-highlight-guide").remove()},_colMouseenter:function(){var t=e(this),i=t.closest(".fl-col-group"),l=i.hasClass("fl-col-group-has-child-loading"),s=t.hasClass("fl-node-global"),o=t.parents(".fl-node-global").length>0,n=t.closest(".fl-col-group").find("> .fl-col").length,r=i.find("> .fl-col").index(t),a=0===r,d=n===r+1,u=t.find(".fl-col").length>0,c=t.parents(".fl-col"),h=c.closest(".fl-col-group"),f=c.length>0,g=f?h.find("> .fl-col").length:0,p=h.find("> .fl-col").index(c),b=!!f&&0===p,m=!!f&&g===p+1,v=t.find("> .fl-col-content").width(),_=t.closest(".fl-row"),L=!!_.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,w=FLBuilderConfig.rowResize.userCanResizeRows,C=wp.template("fl-col-overlay"),F=null;FLBuilderConfig.simpleUi||s&&o&&"row"!=FLBuilderConfig.userTemplateType||t.find(".fl-module, .fl-builder-node-loading-placeholder").length>0||t.find(".fl-col").length>0||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),F=FLBuilder._appendOverlay(t,C({global:s,groupLoading:l,numCols:n,first:a,last:d,hasChildCols:u,hasParentCol:f,parentFirst:b,parentLast:m,numParentCols:g,contentWidth:v,rowIsFixedWidth:L,userCanResizeRows:w})),FLBuilder._buildOverlayOverflowMenu(F),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_colMouseleave:function(t){var i=e(this),l=e(t.toElement)||e(t.relatedTarget),s=i.find(".fl-module").length>0,o=l.is("#tiptip_holder"),n=l.closest("#tiptip_holder").length>0;o||n||s||(FLBuilder._removeColOverlays(),FLBuilder._removeColHighlightGuides(),FLBuilder._closeAllSubmenus())},_removeColOverlays:function(){var t=e(".fl-col");t.removeClass("fl-block-overlay-active"),t.find(".fl-col-overlay").remove(),e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_colDragHelper:function(){return e('<div class="fl-builder-block-drag-helper">'+FLBuilderStrings.column+"</div>")},_colDragInit:function(t){var i=e(t.target),l=e(".fl-col-sortable-proxy-item"),s=i.closest(".fl-col");i.hasClass("fl-block-col-move-parent")&&(s=s.parents(".fl-col")),s.addClass("fl-node-dragging"),FLBuilder._blockDragInit(t),FLBuilder._removeColHighlightGuides(),t.target=l[0],l.trigger(t)},_colDragStart:function(t,i){var l=e(".fl-node-dragging");l.hide(),FLBuilder._resetColumnWidths(l.parent()),FLBuilder._blockDragStart(t,i)},_colDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=e(".fl-node-dragging").removeClass("fl-node-dragging").show(),s=l.attr("data-node"),o=i.item.parent(),n=l.parent(),r=n.attr("data-node");newGroup=o.closest(".fl-col-group"),newGroupId=newGroup.attr("data-node"),newRow=o.closest(".fl-row"),position=0,o.hasClass("fl-sortable-disabled")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-sortable-proxy")?FLBuilder._resetColumnWidths(n):o.hasClass("fl-col-content")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=o.find("> .fl-module, .fl-col-group, .fl-col-sortable-proxy-item").index(i.item),FLBuilder._addColGroup(o.closest(".fl-col").attr("data-node"),s,position)):o.hasClass("fl-col-drop-target")?(o.hasClass("fl-col-drop-target-last")?o.parent().after(l):o.parent().before(l),FLBuilder._resetColumnWidths(newGroup),r==newGroupId?FLBuilder.ajax({action:"reorder_col",node_id:s,position:l.index()}):FLBuilder.ajax({action:"move_col",node_id:s,new_parent:newGroupId,position:l.index(),resize:[r,newGroupId]}),FLBuilder._resizeLayout()):o.hasClass("fl-col-group-drop-target")?(l.remove(),0===n.find(".fl-col").length&&n.remove(),position=newRow.find(".fl-row-content > .fl-col-group").index(newGroup),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addColGroup(newRow.attr("data-node"),s,position)):o.hasClass("fl-row-drop-target")&&(l.remove(),position=o.closest(".fl-builder-content").find(".fl-row").index(newRow),position=o.hasClass("fl-drop-target-last")?position+1:position,FLBuilder._addRow(s,position)),0===n.find(".fl-col").length&&n.remove(),e(".fl-col-sortable-proxy").append(i.item),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._closeAllSubmenus()},_colSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.find("> .fl-col-content"),o=i.closest(".fl-block-overlay-global").length>0,n=null;FLBuilder._colResizing||(i.hasClass("fl-block-col-edit-parent")&&(l=l.parents(".fl-col")),n=l.attr("data-node"),FLBuilderSettingsForms.render({id:"col",nodeId:n,className:"fl-builder-col-settings",attrs:'data-node="'+n+'"',badges:o?[FLBuilderStrings.global]:[],settings:FLBuilderSettingsConfig.nodes[n],preview:{type:"col"}},function(){0===l.siblings(".fl-col").length?e("#fl-builder-settings-section-general").hide():s.width()<=40&&e("#fl-field-size").hide()}),t.stopPropagation())},_copyColClicked:function(t){var i=e(this).closest(".fl-col"),l=i.attr("data-node"),s=i.clone(),o=i.parent(),n=e(".fl-builder-settings[data-node]"),r=n.attr("data-node"),a=r===l?i:i.find('[data-node="'+r+'"]'),d=null;n.length&&a.length&&(d=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[r]=d),s.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),s.find(".fl-block-overlay").remove(),i.after(s),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newColParent=o,FLBuilder._newColPosition=i.index()+1,FLBuilder._resetColumnWidths(o),FLBuilder.ajax({action:"copy_col",node_id:l,settings:d,settings_id:r},function(e){var t=JSON.parse(e);t.duplicatedColumn=l,FLBuilder._copyColComplete(t)}),t.stopPropagation()},_copyColComplete:function(e){e.nodeParent=FLBuilder._newColParent,e.nodePosition=FLBuilder._newColPosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateColumn",{newNodeId:e.nodeId,oldNodeId:e.duplicatedColumn}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_deleteColClicked:function(t){var i=e(this),l=i.closest(".fl-col"),s=l.closest(".fl-col-group"),o=l.parents(".fl-col"),n=o.length>0,r=o.find("> .fl-col-content > .fl-module, > .fl-col-content > .fl-col-group"),a=l.siblings(".fl-col"),d=!0;l.find(".fl-module").length>0&&(d=confirm(FLBuilderStrings.deleteColumnMessage)),n&&1===r.length&&(0===a.length?l=o:1!==a.length||a.find(".fl-module").length||(l=s)),d&&(FLBuilder._deleteCol(l),FLBuilder._removeAllOverlays(),FLBuilder._highlightEmptyCols()),t.stopPropagation()},_deleteCol:function(e){var t=e.attr("data-node"),i=e.closest(".fl-row"),l=e.closest(".fl-col-group"),s=0;e.remove(),rowCols=i.find(".fl-row-content > .fl-col-group > .fl-col"),groupCols=l.find(" > .fl-col"),0===rowCols.length&&"row"!=FLBuilderConfig.userTemplateType?FLBuilder._deleteRow(i):(0===groupCols.length?l.remove():(s=6===groupCols.length?16.65:7===groupCols.length?14.28:Math.round(100/groupCols.length*100)/100,groupCols.css("width",s+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:groupCols})),FLBuilder.ajax({action:"delete_col",node_id:t,new_width:s}),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder.triggerHook("didDeleteColumn",t))},_addCols:function(e,t,i,l){var s=e.closest(".fl-col-group"),o=s.find(".fl-col").index(e);i="undefined"==typeof i?"1-col":i,l="undefined"!=typeof l&&l,"after"==t&&o++,FLBuilder._showNodeLoadingPlaceholder(s,o),FLBuilder._removeAllOverlays(),FLBuilder.ajax({action:"render_new_columns",node_id:e.attr("data-node"),insert:t,type:i,nested:l?1:0},FLBuilder._addColsComplete)},_addColsComplete:function(t){var i=JSON.parse(t),l=null,s=FLBuilder._addModuleAfterNodeRender;FLBuilder._renderLayout(i,function(){null!==s&&(e('.fl-module[data-node="'+s.module.data("node")+'"]').remove(),l=e('.fl-col[data-node="'+s.colId+'"]'),"after"==s.position?l.next().find(".fl-col-content").append(s.module):l.prev().find(".fl-col-content").append(s.module),FLBuilder._reorderModule(s.module),FLBuilder._addModuleAfterNodeRender=null),FLBuilder.triggerHook("didAddColumn",i.nodeId),FLBuilder.triggerHook("didResetColumnWidths",{cols:e(".fl-node-"+i.nodeId).find("> .fl-col")})})},_addColGroup:function(t,i,l){var s=e(".fl-node-"+t);FLBuilder._newColGroupPosition=l,s.hasClass("fl-col")?FLBuilder._newColGroupParent=s.find(" > .fl-col-content"):FLBuilder._newColGroupParent=s.find(".fl-row-content"),FLBuilder._showNodeLoadingPlaceholder(FLBuilder._newColGroupParent,l),FLBuilder.ajax({action:"render_new_column_group",cols:i,node_id:t,position:l},FLBuilder._addColGroupComplete)},_addColGroupComplete:function(t){var i=JSON.parse(t),l=e(i.html),s=l.data("node"),o=l.find(".fl-col").data("node"),n=FLBuilder._addModuleAfterNodeRender;i.nodeParent=FLBuilder._newColGroupParent,i.nodePosition=FLBuilder._newColGroupPosition,FLBuilder._renderLayout(i,function(){i.nodeParent.hasClass("fl-col-content")&&i.nodeParent.parents(".fl-col").addClass("fl-col-has-cols"),null!==n&&(e(".fl-node-"+o+" .fl-col-content").append(n),FLBuilder._reorderModule(n),FLBuilder._addModuleAfterNodeRender=null),FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+s)),FLBuilder.triggerHook("didAddColumnGroup",s)})},_initColDragResizing:function(){e(".fl-block-col-resize").not(".fl-block-row-resize").draggable({axis:"x",start:FLBuilder._colDragResizeStart,drag:FLBuilder._colDragResize,stop:FLBuilder._colDragResizeStop})},_colDragResizeStart:function(t,i){var l=e(i.helper),s="",o=l.hasClass("fl-block-col-resize-parent"),n=o?l.closest(".fl-col").parents(".fl-col"):null,r=o?n.parents(".fl-col-group"):l.closest(".fl-col-group"),a=r.find("> .fl-col"),d=o?n:l.closest(".fl-col"),u=d.attr("data-node"),c=e("[data-node="+u+"] #fl-field-size input"),h=null,f=null,g=null,p=100,b=0,m=null,v=null;for(l.hasClass("fl-block-col-resize-e")?(s="e",h=d.nextAll(".fl-col").first()):(s="w",h=d.prevAll(".fl-col").first()),f=h.attr("data-node"),g=e("[data-node="+f+"] #fl-field-size input");b<a.length;b++)a.eq(b).data("node")!=d.data("node")&&a.eq(b).data("node")!=h.data("node")&&(p-=parseFloat(a.eq(b)[0].style.width));c.length?(m=c,v="col"):g.length&&(m=g,v="sibling"),FLBuilder._colResizeData={handle:l,feedbackLeft:l.find(".fl-block-col-resize-feedback-left"),feedbackRight:l.find(".fl-block-col-resize-feedback-right"),direction:s,groupWidth:r.outerWidth(),col:d,colWidth:parseFloat(d[0].style.width)/100,sibling:h,offset:i.position.left,availWidth:p,setting:m,settingType:v},FLBuilder._colResizing=!0,e("body").addClass("fl-builder-col-resizing"),FLBuilder._closePanel(),FLBuilder._destroyOverlayEvents(),FLBuilder.triggerHook("col-resize-start")},_colDragResize:function(e,t){var i=FLBuilder._colResizeData,l=FLBuilderConfig.isRtl?"w":"e",s=i.handle.closest(".fl-block-overlay"),o=(i.offset-t.position.left)/i.groupWidth,n=l==i.direction?100*(i.colWidth-o):100*(i.colWidth+o),r=Math.round(100*n)/100,a=i.availWidth-n,d=Math.round(100*a)/100,u=8,c=Math.round(100*(i.availWidth-u))/100;r<u?(r=u,d=c):d<u&&(r=c,d=u),l==i.direction?(i.feedbackLeft.html(r.toFixed(1)+"%").show(),i.feedbackRight.html(d.toFixed(1)+"%").show()):(i.feedbackLeft.html(d.toFixed(1)+"%").show(),i.feedbackRight.html(r.toFixed(1)+"%").show()),i.col.css("width",r+"%"),i.sibling.css("width",d+"%"),i.setting&&("col"===i.settingType?i.setting.val(parseFloat(i.col[0].style.width)):"sibling"===i.settingType&&i.setting.val(parseFloat(i.sibling[0].style.width))),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder.triggerHook("col-resize-drag")},_colDragResizeStop:function(t,i){var l=FLBuilder._colResizeData,s=FLBuilder._colResizeData.handle.closest(".fl-block-overlay"),o=l.col.data("node"),n=parseFloat(l.col[0].style.width),r=l.sibling.data("node"),a=parseFloat(l.sibling[0].style.width);FLBuilder._colResizeData.feedbackLeft.hide(),FLBuilder._colResizeData.feedbackRight.hide(),FLBuilder.ajax({action:"resize_cols",col_id:o,col_width:n,sibling_id:r,sibling_width:a}),FLBuilder._buildOverlayOverflowMenu(s),FLBuilder._colResizeData=null,e("body").removeClass("fl-builder-col-resizing"),FLBuilder._bindOverlayEvents(),setTimeout(function(){FLBuilder._colResizing=!1},50),FLBuilder.triggerHook("col-resize-stop"),FLBuilder.triggerHook("didResizeColumn",{colId:o,colWidth:n,siblingId:r,siblingWidth:a})},_resetColumnWidthsClicked:function(t){var i=e(this),l=!!i.closest(".fl-row-overlay").length,s=null,o=null,n=[],r=null,a=0,d=e(".fl-builder-col-settings"),u=null;o=l?i.closest(".fl-row").find(".fl-row-content > .fl-col-group"):i.parents(".fl-col-group").last(),o.each(function(){for(s=e(this),r=s.find(".fl-col-group"),n.push(s.data("node")),FLBuilder._resetColumnWidths(s),a=0;a<r.length;a++)FLBuilder._resetColumnWidths(r.eq(a)),n.push(r.eq(a).data("node"))}),d.length&&(u=e(".fl-node-"+d.attr("data-node")),d.find("#fl-field-size input").val(parseFloat(u[0].style.width))),FLBuilder.ajax({action:"reset_col_widths",group_id:n}),FLBuilder.triggerHook("col-reset-widths"),FLBuilder._closeAllSubmenus(),t.stopPropagation()},_resetColumnWidths:function(e){var t=e.find(" > .fl-col:visible"),i=0;i=6===t.length?16.65:7===t.length?14.28:Math.round(100/t.length*100)/100,t.css("width",i+"%"),FLBuilder.triggerHook("didResetColumnWidths",{cols:t})},_moduleMouseenter:function(){var t=e(this),i=t.attr("data-name"),l=t.hasClass("fl-node-global"),s=t.parents(".fl-node-global").length>0,o=t.parents(".fl-col-group").last(),n=o.hasClass("fl-col-group-has-child-loading"),r=t.closest(".fl-col-group").find("> .fl-col").length,a=t.closest(".fl-col"),d=0===a.index(),u=r===a.index()+1,c=a.parents(".fl-col"),h=c.length>0,f=h?c.closest(".fl-col-group").find("> .fl-col").length:0,g=!!h&&0===c.index(),p=!!h&&f===c.index()+1,b=a.find("> .fl-col-content").width(),m=t.closest(".fl-row"),v=!!m.find(".fl-row-fixed-width").addBack(".fl-row-fixed-width").length,_=FLBuilderConfig.rowResize.userCanResizeRows,L=wp.template("fl-module-overlay"),w=null;FLBuilder._removeColOverlays(),FLBuilder._removeModuleOverlays(),l&&s&&"row"!=FLBuilderConfig.userTemplateType||t.closest(".fl-builder-node-loading").length||(t.hasClass("fl-block-overlay-active")||(w=FLBuilder._appendOverlay(t,L({global:l,moduleName:i,groupLoading:n,numCols:r,colFirst:d,colLast:u,hasParentCol:h,numParentCols:f,parentFirst:g,parentLast:p,contentWidth:b,rowIsFixedWidth:v,userCanResizeRows:_})),FLBuilder._buildOverlayOverflowMenu(w),FLBuilder._initColDragResizing()),e("body").addClass("fl-block-overlay-muted"))},_moduleMouseleave:function(t){var i=(e(this),e(t.toElement)||e(t.relatedTarget)),l=i.is("#tiptip_holder"),s=i.closest("#tiptip_holder").length>0;l||s||(FLBuilder._removeModuleOverlays(),FLBuilder._removeColHighlightGuides())},_removeModuleOverlays:function(){var t=e(".fl-module");t.removeClass("fl-block-overlay-active"),t.find(".fl-module-overlay").remove(),
4
+ e("body").removeClass("fl-block-overlay-muted"),FLBuilder._closeAllSubmenus()},_moduleDragHelper:function(t,i){return e('<div class="fl-builder-block-drag-helper">'+i.attr("data-name")+"</div>")},_moduleDragStart:function(t,i){e(i.item).data("original-position",i.item.index()),FLBuilder._blockDragStart(t,i)},_moduleDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=0;if(s.hasClass("fl-builder-modules")||s.hasClass("fl-builder-widgets"))return void l.remove();if(l.hasClass("fl-builder-block")){if(s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),r=0,o=l.closest(".fl-row"),n=s.find(".fl-row").index(o)):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),r=s.closest(".fl-row").attr("data-node"),o=l.closest(".fl-col-group"),n=s.find(" > .fl-col-group").index(o)):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),r=s.attr("data-node"),o=l.closest(".fl-col"),n=s.find(" > .fl-col").index(o)):(n=s.find("> .fl-module, .fl-col-group, .fl-builder-block").index(l),r=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),FLBuilder._addModule(s,r,l.attr("data-type"),n,l.attr("data-widget"),l.attr("data-alias")),l.remove()}else{if(s.hasClass("fl-sortable-disabled"))return e(t.target).append(i.item),e(t.target).children().eq(i.item.data("original-position")).before(i.item),void FLBuilder._highlightEmptyCols();s.hasClass("fl-row-drop-target")?(o=l.closest(".fl-row"),n=l.closest(".fl-builder-content").children(".fl-row").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addRow("1-col",n),l.remove()):s.hasClass("fl-col-group-drop-target")?(o=l.closest(".fl-col-group"),n=l.closest(".fl-row-content ").find(" > .fl-col-group").index(o),n=l.closest(".fl-drop-target-last").length?n+1:n,FLBuilder._addModuleAfterNodeRender=l,FLBuilder._addColGroup(l.closest(".fl-row").attr("data-node"),"1-col",n),l.remove()):s.hasClass("fl-col-drop-target")?(o=l.closest(".fl-col"),n=l.closest(".fl-col-drop-target-last").length?"after":"before",FLBuilder._addModuleAfterNodeRender={module:l,colId:o.data("node"),position:n},FLBuilder._addCols(o,n,"1-col",l.closest(".fl-col-group-nested").length>0),l.remove()):FLBuilder._reorderModule(l)}FLBuilder._resizeLayout()},_reorderModule:function(e){var t=e.closest(".fl-col").attr("data-node"),i=e.attr("data-parent"),l=e.attr("data-node"),s=e.index();t==i?FLBuilder._reorderNode(l,s):(e.attr("data-parent",t),FLBuilder._moveNode(t,l,s))},_deleteModuleClicked:function(t){var i=e(this).closest(".fl-module"),l=confirm(FLBuilderStrings.deleteModuleMessage);l&&(FLBuilder._deleteModule(i),FLBuilder._removeAllOverlays()),t.stopPropagation()},_deleteModule:function(e){var t=e.closest(".fl-row"),i=e.attr("data-node");FLBuilder.ajax({action:"delete_node",node_id:i}),e.empty(),e.remove(),t.removeClass("fl-block-overlay-muted"),FLBuilder._highlightEmptyCols(),FLBuilder._removeAllOverlays(),FLBuilder.triggerHook("didDeleteModule",i)},_moduleCopyClicked:function(t){var i=e(this).closest(".fl-module"),l=i.attr("data-node"),s=i.index()+1,o=i.clone(),n=e(".fl-builder-module-settings[data-node="+l+"]"),r=null;n.length&&(r=FLBuilder._getSettings(n),FLBuilderSettingsConfig.nodes[l]=r),o.addClass("fl-node-"+l+"-clone fl-builder-node-clone"),o.find(".fl-block-overlay").remove(),i.after(o),e("html, body").animate({scrollTop:o.offset().top-75},500),FLBuilder._showNodeLoading(l+"-clone"),FLBuilder._newModuleParent=i.parent(),FLBuilder._newModulePosition=s,FLBuilder.ajax({action:"copy_module",node_id:l,settings:r},function(e){var t=JSON.parse(e);t.duplicatedModule=l,FLBuilder._moduleCopyComplete(t)}),t.stopPropagation()},_moduleCopyComplete:function(e){e.nodeParent=FLBuilder._newModuleParent,e.nodePosition=FLBuilder._newModulePosition,FLBuilder._renderLayout(e,function(){FLBuilder.triggerHook("didDuplicateModule",{newNodeId:e.nodeId,oldNodeId:e.duplicatedModule}),e.nodeParent.find(".fl-builder-node-loading").eq(0).remove()})},_moduleSettingsClicked:function(t){var i=e(this),l=i.closest(".fl-module").attr("data-type"),s=i.closest(".fl-module").attr("data-node"),o=i.closest(".fl-col").attr("data-node"),n=i.closest(".fl-block-overlay-global").length>0;t.stopPropagation(),FLBuilder._colResizing||n&&!FLBuilderConfig.userCanEditGlobalTemplates||FLBuilder._showModuleSettings({type:l,nodeId:s,parentId:o,global:n})},_showModuleSettings:function(t,i){var l=FLBuilderSettingsConfig.modules[t.type],s=t.settings?t.settings:FLBuilderSettingsConfig.nodes[t.nodeId],o=e("head");-1===e.inArray(t.type,FLBuilder._loadedModuleAssets)&&(""!==l.assets.css&&o.append(l.assets.css),""!==l.assets.js&&o.append(l.assets.js),FLBuilder._loadedModuleAssets.push(t.type)),FLBuilderSettingsForms.render({type:"module",id:t.type,nodeId:t.nodeId,className:"fl-builder-module-settings fl-builder-"+t.type+"-settings",attrs:'data-node="'+t.nodeId+'" data-parent="'+t.parentId+'" data-type="'+t.type+'"',buttons:t.global||FLBuilderConfig.lite||FLBuilderConfig.simpleUi?[]:["save-as"],badges:t.global?[FLBuilderStrings.global]:[],settings:s,legacy:t.legacy,helper:FLBuilder._moduleHelpers[t.type],rules:FLBuilder._moduleHelpers[t.type]?FLBuilder._moduleHelpers[t.type].rules:null,preview:{type:"module",layout:t.layout,callback:function(){FLBuilder.triggerHook("didAddModule",t.nodeId)}}},i)},_saveModuleClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=t.attr("data-type"),l=(t.attr("data-node"),FLBuilder._moduleHelpers[i]),s=!0;"undefined"!=typeof l&&(t.find("label.error").remove(),t.validate().hideErrors(),s=t.validate().form(),s&&(s=l.submit())),s?FLBuilder._saveSettings():FLBuilder._toggleSettingsTabErrors()},_addModule:function(e,t,i,l,s,o){FLBuilder._showNodeLoadingPlaceholder(e,l),e.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=e,FLBuilder._newModulePosition=l),FLBuilder.ajax({action:"render_new_module",parent_id:t,type:i,position:l,node_preview:1,widget:"undefined"==typeof s?"":s,alias:"undefined"==typeof o?"":o},FLBuilder._addModuleComplete)},_addModuleComplete:function(t){var i=JSON.parse(t);i.layout&&(i.layout.nodeParent=FLBuilder._newModuleParent,i.layout.nodePosition=FLBuilder._newModulePosition),i.settings||(i.settings=FLBuilderSettingsConfig.defaults.modules[i.type]),e("form.fl-builder-settings").length?i.layout&&FLBuilder._renderLayout(i.layout):FLBuilder._showModuleSettings(i,function(){e(".fl-builder-module-settings").data("new-module","1")})},registerModuleHelper:function(t,i){var l={rules:{},init:function(){},submit:function(){return!0},preview:function(){}};FLBuilder._moduleHelpers[t]=e.extend({},l,i)},_registerModuleHelper:function(e,t){FLBuilder.registerModuleHelper(e,t)},_showNodeTemplateSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.attr("data-node"),s=FLBuilderStrings.saveModule;return i.hasClass("fl-builder-row-settings")&&(s=FLBuilderStrings.saveRow),!!FLBuilder._triggerSettingsSave(!1,!1,!1)&&void FLBuilderSettingsForms.render({id:"node_template",nodeId:l,title:s,attrs:'data-node="'+l+'"',className:"fl-builder-node-template-settings",rules:{name:{required:!0}}},function(){FLBuilderConfig.userCanEditGlobalTemplates||e("#fl-field-global").hide()})},_saveNodeTemplate:function(){var t=e(".fl-builder-node-template-settings"),i=t.attr("data-node"),l=t.validate().form();l&&(FLBuilder._showNodeLoading(i),FLBuilder.ajax({action:"save_node_template",node_id:i,settings:FLBuilder._getSettings(t)},function(e){FLBuilder._saveNodeTemplateComplete(e),FLBuilder._hideNodeLoading(i)}),FLBuilder._lightbox.close())},_saveNodeTemplateComplete:function(t){var i=JSON.parse(t),l=e(".fl-builder-saved-"+i.type+"s"),s=l.find(".fl-builder-block"),o=null,n="",r=i.name.toLowerCase(),a=0,d=wp.template("fl-node-template-block"),u={name:i.name,isGlobal:i.global,content:i.type,id:i.id,postID:i.postID,kind:"template",type:"user",link:i.link,category:{uncategorized:FLBuilderStrings.uncategorized}};if(FLBuilderConfig.contentItems.template.push(u),FLBuilder.triggerHook("contentItemsChanged"),i.layout&&(FLBuilder._renderLayout(i.layout),FLBuilder.triggerHook("didSaveGlobalNodeTemplate",i.config)),0===s.length)l.append(d(i));else for(;a<s.length;a++){if(o=s.eq(a),n=o.text().toLowerCase().trim(),0===a&&r<n){l.prepend(d(i));break}if(r<n){o.before(d(i));break}if(s.length-1===a){l.append(d(i));break}}l.find(".fl-builder-block-no-node-templates").remove()},_nodeTemplateDragStop:function(t,i){FLBuilder._blockDragStop(t,i);var l=i.item,s=l.parent(),o=null,n=0,r=null,a="",d=null;if(s.hasClass("fl-builder-blocks-section-content"))return void l.remove();if(l.hasClass("fl-builder-block-saved-row")||l.hasClass("fl-builder-block-row-template"))r=l.closest(".fl-row"),n=r.length?e(FLBuilder._contentClass+" .fl-row").index(r):0,n=s.hasClass("fl-drop-target-last")?n+1:n,o=null,a="render_new_row",d=FLBuilder._addRowComplete,FLBuilder._newRowPosition=n,FLBuilder._showNodeLoadingPlaceholder(e(FLBuilder._contentClass),n);else if(l.hasClass("fl-builder-block-saved-module")||l.hasClass("fl-builder-block-module-template")){if(a="render_new_module",d=FLBuilder._addModuleComplete,s.hasClass("fl-sortable-disabled"))return l.remove(),void FLBuilder._showPanel();s.hasClass("fl-row-drop-target")?(s=l.closest(".fl-builder-content"),o=0,n=s.find(".fl-row").index(l.closest(".fl-row"))):s.hasClass("fl-col-group-drop-target")?(s=l.closest(".fl-row-content"),o=s.closest(".fl-row").attr("data-node"),n=s.find(" > .fl-col-group").index(l.closest(".fl-col-group"))):s.hasClass("fl-col-drop-target")?(s=l.closest(".fl-col-group"),n=s.children(".fl-col").index(l.closest(".fl-col")),o=s.attr("data-node")):(n=s.children(".fl-module, .fl-builder-block").index(l),o=l.closest(".fl-col").attr("data-node")),l.closest(".fl-drop-target-last").length&&(n+=1),s.hasClass("fl-col-group")?(FLBuilder._newModuleParent=null,FLBuilder._newModulePosition=0):(FLBuilder._newModuleParent=s,FLBuilder._newModulePosition=n),FLBuilder._showNodeLoadingPlaceholder(s,n)}FLBuilder.ajax({action:a,template_id:l.attr("data-id"),template_type:l.attr("data-type"),parent_id:o,position:n},function(e){if(a.indexOf("row")>-1){var t=JSON.parse(e);FLBuilder.triggerHook("didApplyRowTemplateComplete",t.config),d(t.layout)}else d(e)}),l.remove()},_editNodeTemplateClicked:function(t){t.preventDefault(),t.stopPropagation(),window.open(e(this).attr("href"))},_deleteNodeTemplateClicked:function(t){var i=e(t.target),l=i.closest(".fl-builder-blocks-section"),s=l.find(".fl-builder-blocks-section-content"),o=s.find(".fl-builder-block"),n=i.closest(".fl-builder-block"),r=n.hasClass("fl-builder-block-global"),a=r?FLBuilder._updateLayout:void 0,d=r?FLBuilderStrings.deleteGlobalTemplate:FLBuilderStrings.deleteTemplate,u=null;confirm(d)&&(n.remove(),1===o.length&&(n.hasClass("fl-builder-block-saved-row")?s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedRows+"</span>"):s.append('<span class="fl-builder-block-no-node-templates">'+FLBuilderStrings.noSavedModules+"</span>")),n.hasClass("fl-builder-block-global")&&FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"delete_node_template",template_id:n.attr("data-id")},a),u=_.findIndex(FLBuilderConfig.contentItems.template,{id:n.attr("data-id"),type:"user"}),FLBuilderConfig.contentItems.template.splice(u,1),FLBuilder.triggerHook("contentItemsChanged"))},_initSettingsForms:function(){FLBuilder._initCodeFields(),FLBuilder._initColorPickers(),FLBuilder._initSelectFields(),FLBuilder._initEditorFields(),FLBuilder._initMultipleFields(),FLBuilder._initAutoSuggestFields(),FLBuilder._initLinkFields(),FLBuilder._initFontFields(),FLBuilder._initOrderingFields(),FLBuilder._initTimezoneFields(),FLBuilder._focusFirstSettingsControl(),FLBuilder._lightbox._resizeEditors(),e(".fl-builder-settings-fields").css("visibility","visible"),FLBuilder.triggerHook("settings-form-init")},_destroySettingsForms:function(){FLBuilder._destroyEditorFields()},_setSettingsFormContent:function(t){e(".fl-legacy-settings").remove(),e("body").append(t)},_settingsTabClicked:function(t){var i=e(this),l=i.closest(".fl-builder-settings"),s=i.attr("href").split("#").pop();FLBuilder._resetSettingsTabsState(),l.find(".fl-builder-settings-tab").removeClass("fl-active"),l.find("#"+s).addClass("fl-active"),l.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),l.find("a[href*="+s+"]").addClass("fl-active"),FLBuilder._focusFirstSettingsControl(),t.preventDefault()},_resetSettingsTabsState:function(){var t=e(".fl-lightbox:visible");FLBuilder._hideTabsOverflowMenu(),t.find(".fl-builder-settings-tabs .fl-active").removeClass("fl-active"),t.find(".fl-builder-settings-tabs-overflow-menu .fl-active").removeClass("fl-active"),t.find(".fl-contains-active").removeClass("fl-contains-active")},_calculateSettingsTabsOverflow:function(){var t=e(".fl-lightbox:visible"),i=t.outerWidth(),l=t.hasClass("fl-lightbox-width-slim"),s=t.find(".fl-builder-settings-tabs"),o=t.find(".fl-builder-settings-tabs-overflow-menu"),n=t.find(".fl-builder-settings-tabs-more"),r=s.find("a"),a=!1,d=i-60,u=0,c=l?16:30;o.html(""),FLBuilder._hideTabsOverflowMenu(),r.removeClass("fl-overflowed"),r.each(function(){if(!e(this).is(":visible"))return!0;if(!a){var t=e(this).textWidth()+c+12;u+=t,u>=d&&(a=!0)}if(a){var i=e(this).html(),l=e(this).attr("href"),s="";e(this).hasClass("fl-active")&&(s="fl-active"),e(this).hasClass("error")&&(s+=" error"),""!==s&&(s='class="'+s+'"');var n=e('<a href="'+l+'" '+s+">"+i+"</a>");o.append(n),e(this).addClass("fl-overflowed")}else e(this).removeClass("fl-overflowed")}),a?t.addClass("fl-lightbox-has-tab-overflow"):t.removeClass("fl-lightbox-has-tab-overflow"),o.find(".fl-active").length>0?n.addClass("fl-contains-active"):n.removeClass("fl-contains-active"),o.find(".error").length>0?n.addClass("fl-contains-errors"):n.removeClass("fl-contains-errors")},_settingsTabsToOverflowMenuItemClicked:function(t){var i=e(t.currentTarget),l=i.attr("href"),s=i.closest(".fl-lightbox-header-wrap").find(".fl-builder-settings-tabs"),o=s.find('a[href="'+l+'"]'),n=s.find(".fl-builder-settings-tabs-more");FLBuilder._resetSettingsTabsState(),o.trigger("click"),i.addClass("fl-active"),n.addClass("fl-contains-active"),FLBuilder._hideTabsOverflowMenu(),t.preventDefault()},_hasOverflowTabs:function(){var t=e(".fl-lightbox:visible"),i=t.find(".fl-builder-settings-tabs-overflow-menu a");return i.length>0},_showTabsOverflowMenu:function(){if(FLBuilder._hasOverflowTabs()){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","flex"),t.find(".fl-builder-settings-tabs-overflow-click-mask").show(),this.isShowingSettingsTabsOverflowMenu=!0}},_hideTabsOverflowMenu:function(){var t=e(".fl-lightbox:visible");t.find(".fl-builder-settings-tabs-overflow-menu").css("display","none"),t.find(".fl-builder-settings-tabs-overflow-click-mask").hide(),this.isShowingSettingsTabsOverflowMenu=!1},_toggleTabsOverflowMenu:function(e){FLBuilder.isShowingSettingsTabsOverflowMenu?FLBuilder._hideTabsOverflowMenu():FLBuilder._showTabsOverflowMenu(),e.stopPropagation()},_settingsCancelClicked:function(t){var i=e(".fl-builder-lightbox[data-parent]"),l=e(".fl-builder-module-settings"),s=null,o=null,n=null,r=null;return i.length>0?void FLBuilder._closeNestedSettings():(l.length>0&&"undefined"!=typeof l.data("new-module")?(s=e(FLBuilder.preview.state.html),o=e(".fl-node-"+l.data("node")),n=o.closest(".fl-col"),r=s.find(".fl-node-"+n.data("node")),r.length>0?FLBuilder._deleteModule(o):FLBuilder._deleteCol(n)):FLBuilder.preview&&FLBuilder.preview.revert(),FLBuilder.preview=null,void FLLightbox.closeParent(this))},_focusFirstSettingsControl:function(){var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab.fl-active"),l=i.find(".fl-field").first(),s=l.find('input:not([type="hidden"]), textarea, select, button, a, .fl-editor-field').first();if("undefined"!=typeof tinyMCE&&s.hasClass("fl-editor-field")){var o=s.find("textarea.wp-editor-area").attr("id");tinyMCE.get(o).focus()}else setTimeout(function(){s.focus().css("animation-name","fl-grab-attention")},300);l.css("animation-name","fl-grab-attention"),l.on("animationend",function(){l.css("animation-name","")})},_initSettingsValidation:function(t,i){var l=e(".fl-builder-settings").last();l.validate({ignore:".fl-ignore-validation",rules:t,messages:i,errorPlacement:FLBuilder._settingsErrorPlacement})},_settingsErrorPlacement:function(e,t){e.appendTo(t.parent())},_toggleSettingsTabErrors:function(){for(var t=e(".fl-builder-settings:visible"),i=t.find(".fl-builder-settings-tab"),l=null,s=null,o=0;o<i.length;o++)l=i.eq(o),s=l.find("label.error"),tabLink=t.find(".fl-builder-settings-tabs a[href*="+l.attr("id")+"]"),tabLink.find(".fl-error-icon").remove(),tabLink.removeClass("error"),s.length>0&&(tabLink.append('<span class="fl-error-icon"></span>'),tabLink.addClass("error"));FLBuilder._calculateSettingsTabsOverflow()},_getSettings:function(t){FLBuilder._updateEditorFields();var i=t.serializeArray(),l=0,s=0,o="",n="",r="",a=[],d=[],u={};for(l=0;l<i.length;l++)if(o=i[l].value.replace(/\r/gm,""),!(i[l].name.indexOf("flrich")>-1))if(i[l].name.indexOf("[")>-1){for(n=i[l].name.replace(/\[(.*)\]/,""),r=i[l].name.replace(n,""),a=[],d=r.match(/\[[^\]]*\]/g),s=0;s<d.length;s++)"[]"!=d[s]&&a.push(d[s].replace(/\[|\]/g,""));r.match(/\[\]\[[^\]]*\]\[[^\]]+\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]={}),"undefined"==typeof u[n][a[0]][a[1]]&&(u[n][a[0]][a[1]]={}),u[n][a[0]][a[1]]=o):r.match(/\[\]\[[^\]]*\]\[\]/)?("undefined"==typeof u[n]&&(u[n]={}),"undefined"==typeof u[n][a[0]]&&(u[n][a[0]]=[]),u[n][a[0]].push(o)):r.match(/\[\]\[[^\]]*\]/)?("undefined"==typeof u[n]&&(u[n]={}),u[n][a[0]]=o):r.match(/\[\]/)&&("undefined"==typeof u[n]&&(u[n]=[]),u[n].push(o))}else u[i[l].name]=o;for(r in u)if("undefined"!=typeof u["as_values_"+r]){u[r]=e.grep(u["as_values_"+r].split(","),function(e){return""!==e}).join(",");try{delete u["as_values_"+r]}catch(c){}}return e.each(t.find("[name]"),function(t,i){var l=e(i).attr("name").replace(/\[(.*)\]/,"");l in u||(u[l]="")}),u=e.extend({},FLBuilder._getOriginalSettings(t),u)},_getSettingsJSONForHTML:function(e){return JSON.stringify(e).replace(/\'/g,"&#39;").replace("<wbr />","<wbr>")},_getOriginalSettings:function(t,i){var l=t.find(".fl-builder-settings-json"),s=t.data("node"),o=FLBuilderSettingsConfig.nodes,n=null,r={};if(s&&o[s]?n=o[s]:l.length&&(n=JSON.parse(l.val().replace(/&#39;/g,"'"))),n)for(key in n)(e("#fl-field-"+key).length||i)&&(r[key]=n[key]);return r},_saveSettings:function(t){var i=e(".fl-builder-settings-lightbox .fl-builder-settings"),l=i.data("new-module"),s=i.attr("data-node"),o=FLBuilder._getSettings(i),n=FLBuilder.preview;return!_.isUndefined(t)&&_.isBoolean(t)||(t=!0),n&&!n._settingsHaveChanged()&&_.isUndefined(l)?void FLBuilder._lightbox.close():(FLBuilder._showNodeLoading(s),FLBuilderSettingsConfig.nodes[s]=o,FLBuilder.ajax({action:"save_settings",node_id:s,settings:o},FLBuilder._saveSettingsComplete.bind(this,t,n)),FLBuilder.triggerHook("didSaveNodeSettings",{nodeId:s,settings:o}),void FLBuilder._lightbox.close())},_saveSettingsComplete:function(e,t,i){var l=JSON.parse(i),s=function(){t&&l.layout.partial&&l.layout.nodeId===t.nodeId&&(t.clear(),t=null)};!0===e?FLBuilder._renderLayout(l.layout,s):s(),FLBuilder.triggerHook("didSaveNodeSettingsComplete",{nodeId:l.node_id,settings:l.settings})},_triggerSettingsSave:function(t,i,l){var s=FLBuilder._lightbox._node.find("form.fl-builder-settings"),o=FLBuilder._lightbox._node.data("instance-id"),n=FLLightbox._instances[o],r=e(".fl-lightbox-wrap[data-parent]:visible"),a=!1,d=!0;return t=!_.isUndefined(t)&&t,i=!_.isUndefined(i)&&i,l=!!_.isUndefined(l)||l,s.length&&(r.length&&(r.find(".fl-builder-settings-save").trigger("click"),(r.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),d&&!s.validate().form()&&(d=!1),a=FLBuilderSettingsForms.settingsHaveChanged(),d&&a&&(t&&n.disableClose(),s.find(".fl-builder-settings-save").trigger("click"),t&&n.enableClose(),(s.find("label.error").length||e(".fl-builder-alert-lightbox:visible").length)&&(d=!1)),l&&(FLBuilder._destroySettingsForms(),!a&&FLBuilder.preview&&(FLBuilder.preview.clear(),FLBuilder.preview=null)),a||t||n.close()),d||(FLBuilder.triggerHook("didFailSettingsSave"),FLBuilder._toggleSettingsTabErrors(),i&&!e(".fl-builder-alert-lightbox:visible").length&&FLBuilder.alert(FLBuilderStrings.settingsHaveErrors)),d},_refreshSettingsPreviewReference:function(){FLBuilder.preview&&FLBuilder.preview._initElementsAndClasses()},_openNestedSettings:function(t){t.className&&-1===t.className.indexOf("fl-builder-settings-lightbox")&&(t.className+=" fl-builder-settings-lightbox"),t=e.extend({className:"fl-builder-lightbox fl-builder-settings-lightbox",destroyOnClose:!0,resizable:!0},t);var i=e(".fl-lightbox-wrap:visible"),l=i.find(".fl-lightbox"),s=new FLLightbox(t),o=s._node,n=o.find(".fl-lightbox");return i.hide(),o.attr("data-parent",i.attr("data-instance-id")),n.attr("style",l.attr("style")),s.on("resized",FLBuilder._calculateSettingsTabsOverflow),s.open('<div class="fl-builder-lightbox-loading"></div>'),s},_closeNestedSettings:function(){var t=e(".fl-builder-lightbox[data-parent]:visible"),i=t.find(".fl-lightbox"),l=t.attr("data-instance-id"),s=FLLightbox._instances[l],o=t.attr("data-parent"),n=e('[data-instance-id="'+o+'"]'),r=n.find(".fl-lightbox"),a=n.find("form"),d=FLLightbox._instances[o];s.on("close",function(){r.attr("style",i.attr("style")),n.show(),d._resize(),n.find("label.error").remove(),a.validate().hideErrors(),FLBuilder._toggleSettingsTabErrors()}),s.close()},_showHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeIn()},_hideHelpTooltip:function(){e(this).siblings(".fl-help-tooltip-text").fadeOut()},_initAutoSuggestFields:function(){var t=e(".fl-builder-settings:visible .fl-suggest-field"),i=null,l=null,s=null,o=[];t.each(function(){i=e(this),""!==i.attr("data-value")&&(FLBuilderSettingsForms.showFieldLoader(i),o.push({name:i.attr("name"),value:i.attr("data-value"),action:i.attr("data-action"),data:i.attr("data-action-data")}))}),o.length?FLBuilder.ajax({action:"get_autosuggest_values",fields:o},function(i){l=JSON.parse(i);for(s in l)e('.fl-suggest-field[name="'+s+'"]').attr("data-value",l[s]);t.each(FLBuilder._initAutoSuggestField)}):t.each(FLBuilder._initAutoSuggestField)},_initAutoSuggestField:function(){var t=e(this);t.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:t.data("action"),fl_as_action_data:t.data("action-data"),_wpnonce:FLBuilderConfig.ajaxNonce}),e.extend({},{asHtmlID:t.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,preFill:t.data("value"),queryParam:"fl_as_query",afterSelectionAdd:FLBuilder._updateAutoSuggestField,afterSelectionRemove:FLBuilder._updateAutoSuggestField,selectionLimit:t.data("limit")},t.data("args"))),FLBuilderSettingsForms.hideFieldLoader(t)},_updateAutoSuggestField:function(t,i,l){e(this).siblings(".as-values").val(l.join(",")).trigger("change")},_initCodeFields:function(){e(".fl-builder-settings:visible").find(".fl-code-field").each(FLBuilder._initCodeField)},_initCodeField:function(){var t=e(this),i=t.find("textarea"),l=(i.attr("id"),i.data("editor")),s=i.data("wrap"),o=e("<div>",{position:"absolute",height:20*parseInt(i.attr("rows"),10)}),n=null;o.insertBefore(i),i.css("display","none"),ace.require("ace/ext/language_tools"),n=ace.edit(o[0]),n.$blockScrolling=1/0,n.getSession().setValue(i.val()),n.getSession().setMode("ace/mode/"+l),s&&n.getSession().setUseWrapMode(!0),n.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!1,showLineNumbers:!1,showFoldWidgets:!1}),n.getSession().on("change",function(e){i.val(n.getSession().getValue()).trigger("change")}),i.closest(".fl-field").data("editor",n)},_initMultipleFields:function(){for(var t=e(".fl-builder-settings:visible .fl-builder-field-multiples"),i=null,l=null,s=0,o=FLBuilderConfig.isRtl?{left:10}:{right:10};s<t.length;s++)i=t.eq(s),l=i.find(".fl-builder-field-multiple"),1===l.length?l.eq(0).find(".fl-builder-field-actions").addClass("fl-builder-field-actions-single"):l.find(".fl-builder-field-actions").removeClass("fl-builder-field-actions-single");e(".fl-builder-field-multiples").sortable({items:".fl-builder-field-multiple",cursor:"move",cursorAt:o,distance:5,opacity:.5,placeholder:"fl-builder-field-dd-zone",stop:FLBuilder._fieldDragStop,tolerance:"pointer",axis:"y"})},_addFieldClicked:function(){var t=e(this),i=t.attr("data-field"),l=t.closest("tr").siblings("tr[data-field="+i+"]").last(),s=l.clone(),o=s.find(".fl-form-field"),n=null,r=parseInt(l.find("label span.fl-builder-field-index").html(),10)+1;s.find("th label span.fl-builder-field-index").html(r),s.find(".fl-form-field-preview-text").html(""),s.find("input, textarea, select").val(""),l.after(s),FLBuilder._initMultipleFields(),o.length&&(n=o.find(".fl-form-field-edit").data("type"),o.find("input").val(JSON.stringify(FLBuilderSettingsConfig.defaults.forms[n])))},_copyFieldClicked:function(){var t=e(this),i=t.closest("tr"),l=i.clone(),s=parseInt(i.find("label span.fl-builder-field-index").html(),10)+1;l.find("th label span.fl-builder-field-index").html(s),i.after(l),FLBuilder._renumberFields(i.parent()),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview()},_deleteFieldClicked:function(){var t=e(this).closest("tr"),i=t.parent(),l=confirm(FLBuilderStrings.deleteFieldMessage);l&&(t.remove(),FLBuilder._renumberFields(i),FLBuilder._initMultipleFields(),FLBuilder.preview.delayPreview())},_renumberFields:function(e){for(var t=e.find(".fl-builder-field-multiple"),i=0;i<t.length;i++)t.eq(i).find("th label span.fl-builder-field-index").html(i+1)},_fieldDragHelper:function(){return e('<div class="fl-builder-field-dd-helper"></div>')},_fieldDragStop:function(e,t){FLBuilder._renumberFields(t.item.parent()),FLBuilder.preview.delayPreview()},_initSelectFields:function(){e(".fl-builder-settings:visible").find(".fl-builder-settings-fields select").trigger("change")},_settingsSelectChanged:function(){var t=e(this),i=t.attr("data-toggle"),l=t.attr("data-hide"),s=t.attr("data-trigger"),o=t.val(),n=0;if("undefined"!=typeof i){i=JSON.parse(i);for(n in i)FLBuilder._settingsSelectToggle(i[n].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(i[n].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[n].tabs,"hide","a[href*=fl-builder-settings-tab-","]");"undefined"!=typeof i[o]&&(FLBuilder._settingsSelectToggle(i[o].fields,"show","#fl-field-"),FLBuilder._settingsSelectToggle(i[o].sections,"show","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(i[o].tabs,"show","a[href*=fl-builder-settings-tab-","]"))}if("undefined"!=typeof l&&(l=JSON.parse(l),"undefined"!=typeof l[o]&&(FLBuilder._settingsSelectToggle(l[o].fields,"hide","#fl-field-"),FLBuilder._settingsSelectToggle(l[o].sections,"hide","#fl-builder-settings-section-"),FLBuilder._settingsSelectToggle(l[o].tabs,"hide","a[href*=fl-builder-settings-tab-","]"))),"undefined"!=typeof s&&(s=JSON.parse(s),"undefined"!=typeof s[o]&&"undefined"!=typeof s[o].fields))for(n=0;n<s[o].fields.length;n++)e("#fl-field-"+s[o].fields[n]).find("select").trigger("change");FLBuilder._calculateSettingsTabsOverflow()},_settingsSelectToggle:function(t,i,l,s){var o=0;if(s="undefined"==typeof s?"":s,"undefined"!=typeof t)for(;o<t.length;o++)e(".fl-builder-settings:visible").find(l+t[o]+s)[i](),e(l+t[o]+s).parent().find('.fl-field[data-type="code"]').each(function(){e(this).data("editor").resize()})},_initColorPickers:function(){var t=FLBuilderConfig.colorPresets?FLBuilderConfig.colorPresets:[];FLBuilder.colorPicker=new FLBuilderColorPicker({mode:"hsv",elements:".fl-color-picker .fl-color-picker-value",presets:t,labels:{colorPresets:FLBuilderStrings.colorPresets,colorPicker:FLBuilderStrings.colorPicker,placeholder:FLBuilderStrings.placeholder,removePresetConfirm:FLBuilderStrings.removePresetConfirm,noneColorSelected:FLBuilderStrings.noneColorSelected,alreadySaved:FLBuilderStrings.alreadySaved,noPresets:FLBuilderStrings.noPresets,presetAdded:FLBuilderStrings.presetAdded}}),e(FLBuilder.colorPicker).on("presetRemoved presetAdded",function(e,t){FLBuilder.ajax({action:"save_color_presets",presets:t.presets})})},_initSinglePhotoSelector:function(){null===FLBuilder._singlePhotoSelector&&(FLBuilder._singlePhotoSelector=wp.media({title:FLBuilderStrings.selectPhoto,button:{text:FLBuilderStrings.selectPhoto},library:{type:"image"},multiple:!1}),FLBuilder._singlePhotoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="photo")},_selectSinglePhoto:function(){FLBuilder._initSinglePhotoSelector(),FLBuilder._singlePhotoSelector.once("open",e.proxy(FLBuilder._singlePhotoOpened,this)),FLBuilder._singlePhotoSelector.once("select",e.proxy(FLBuilder._singlePhotoSelected,this)),FLBuilder._singlePhotoSelector.open()},_singlePhotoOpened:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection"),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=l.val(),o=null;e(this).hasClass("fl-photo-replace")?(t.reset(),i.addClass("fl-photo-empty"),l.val("")):""!==s?(o=wp.media.attachment(s),o.fetch(),t.add(o?[o]:[])):t.reset()},_singlePhotoSelected:function(){var t=FLBuilder._singlePhotoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-photo-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-photo-preview img"),o=i.find("select");l.val(t.id),s.attr("src",FLBuilder._getPhotoSrc(t)),i.removeClass("fl-photo-empty").removeClass("fl-photo-no-attachment"),i.find("label.error").remove(),o.show(),o.html(FLBuilder._getPhotoSizeOptions(t)),o.trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_singlePhotoRemoved:function(){FLBuilder._initSinglePhotoSelector();var t=FLBuilder._singlePhotoSelector.state(),i="undefined"!=typeof t?t.get("selection"):null,l=e(this).closest(".fl-photo-field"),s=l.find("input[type=hidden]"),o=l.find("select");i&&i.reset(),l.addClass("fl-photo-empty"),s.val(""),o.html('<option value="" selected></option>'),o.trigger("change")},_getPhotoSrc:function(e){return"undefined"==typeof e.sizes?e.url:"undefined"!=typeof e.sizes.thumbnail?e.sizes.thumbnail.url:e.sizes.full.url},_getPhotoSizeOptions:function(e,t){var i="",l=null,s=null,o="",n={full:FLBuilderStrings.fullSize,large:FLBuilderStrings.large,medium:FLBuilderStrings.medium,thumbnail:FLBuilderStrings.thumbnail};if("undefined"==typeof e.sizes||0===e.sizes.length)i+='<option value="'+e.url+'">'+FLBuilderStrings.fullSize+"</option>";else{t&&(t=t.replace(/https?/,""));for(l in e.sizes)o="undefined"!=typeof n[l]?n[l]+" - ":"undefined"!=typeof FLBuilderConfig.customImageSizeTitles[l]?FLBuilderConfig.customImageSizeTitles[l]+" - ":"",s="",t?t===e.sizes[l].url.replace(/https?/,"")&&(s=' selected="selected"'):s="full"==l?' selected="selected"':"",i+='<option value="'+e.sizes[l].url+'"'+s+">"+o+e.sizes[l].width+" x "+e.sizes[l].height+"</option>"}return i},_selectMultiplePhotos:function(){var t=e(this).closest(".fl-multiple-photos-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""===l?"":JSON.parse(l),o=wp.media.gallery.defaults.id,n='[gallery ids="-1"]',r=null,a=null,d=null,u=null,c=[];if("object"==typeof s){for(u in s)c.push(s[u]);n='[gallery ids="'+c.join()+'"]'}r=wp.shortcode.next("gallery",n).shortcode,_.isUndefined(r.get("id"))&&!_.isUndefined(o)&&r.set("id",o),a=wp.media.gallery.attachments(r),d=new wp.media.model.Selection(a.models,{props:a.props.toJSON(),multiple:!0}),d.gallery=a.gallery,d.more().done(function(){d.length||FLBuilder._multiplePhotoSelector.setState("gallery-library"),
5
+ d.props.set({query:!1}),d.unmirror(),d.props.unset("orderby")}),FLBuilder._multiplePhotoSelector&&FLBuilder._multiplePhotoSelector.dispose(),FLBuilder._multiplePhotoSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-photos-edit")?"gallery-edit":"gallery-library",title:wp.media.view.l10n.editGalleryTitle,editing:!0,multiple:!0,selection:d}).open(),e(FLBuilder._multiplePhotoSelector.views.view.el).addClass("fl-multiple-photos-lightbox"),FLBuilder._multiplePhotoSelector.once("update",e.proxy(FLBuilder._multiplePhotosSelected,this))},_multiplePhotosSelected:function(t){for(var i=e(this).closest(".fl-multiple-photos-field"),l=i.find("input[type=hidden]"),s=i.find(".fl-multiple-photos-count"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?s.html("1 "+FLBuilderStrings.photoSelected):s.html(o.length+" "+FLBuilderStrings.photosSelected),i.removeClass("fl-multiple-photos-empty"),i.find("label.error").remove(),l.val(JSON.stringify(o)).trigger("change")},_selectSingleVideo:function(){null===FLBuilder._singleVideoSelector&&(FLBuilder._singleVideoSelector=wp.media({title:FLBuilderStrings.selectVideo,button:{text:FLBuilderStrings.selectVideo},library:{type:"video"},multiple:!1}),FLBuilder._singleVideoSelector.on("open",FLBuilder._wpmedia_reset_errors),_wpPluploadSettings.defaults.multipart_params.fl_upload_type="video"),FLBuilder._singleVideoSelector.once("select",e.proxy(FLBuilder._singleVideoSelected,this)),FLBuilder._singleVideoSelector.open()},_singleVideoSelected:function(){var t=FLBuilder._singleVideoSelector.state().get("selection").first().toJSON(),i=e(this).closest(".fl-video-field"),l=i.find(".fl-video-preview-img"),s=i.find(".fl-video-preview-filename"),o=i.find("input[type=hidden]");l.html('<span class="dashicons dashicons-media-video"></span>'),s.html(t.filename),i.removeClass("fl-video-empty"),i.find("label.error").remove(),o.val(t.id).trigger("change"),FLBuilderSettingsConfig.attachments[t.id]=t},_selectMultipleAudios:function(){var t=e(this).closest(".fl-multiple-audios-field"),i=t.find("input[type=hidden]"),l=i.val(),s=""==l?'[playlist ids="-1"]':'[playlist ids="'+JSON.parse(l).join()+'"]',o=wp.shortcode.next("playlist",s).shortcode,n=wp.media.playlist.defaults.id,r=null,a=null;_.isUndefined(o.get("id"))&&!_.isUndefined(n)&&o.set("id",n),r=wp.media.playlist.attachments(o),a=new wp.media.model.Selection(r.models,{props:r.props.toJSON(),multiple:!0}),a.playlist=r.playlist,a.more().done(function(){a.props.set({query:!1}),a.unmirror(),a.props.unset("orderby")}),FLBuilder._multipleAudiosSelector&&FLBuilder._multipleAudiosSelector.dispose(),FLBuilder._multipleAudiosSelector=wp.media({frame:"post",state:e(this).hasClass("fl-multiple-audios-edit")?"playlist-edit":"playlist-library",title:wp.media.view.l10n.editPlaylistTitle,editing:!0,multiple:!0,selection:a}).open(),FLBuilder._multipleAudiosSelector.content.get("view").sidebar.unset("playlist"),FLBuilder._multipleAudiosSelector.on("content:render:browse",function(e){e&&e.sidebar.on("ready",function(){e.sidebar.unset("playlist")})}),FLBuilder._multipleAudiosSelector.once("update",e.proxy(FLBuilder._multipleAudiosSelected,this))},_multipleAudiosSelected:function(t){for(var i=e(this).closest(".fl-multiple-audios-field"),l=i.find(".fl-multiple-audios-count"),s=i.find("input[type=hidden]"),o=[],n=0;n<t.models.length;n++)o.push(t.models[n].id);1==o.length?l.html("1 "+FLBuilderStrings.audioSelected):l.html(o.length+" "+FLBuilderStrings.audiosSelected),s.val(JSON.stringify(o)).trigger("change"),i.removeClass("fl-multiple-audios-empty"),i.find("label.error").remove()},_selectIcon:function(){var e=this;FLIconSelector.open(function(t){FLBuilder._iconSelected.apply(e,[t])})},_iconSelected:function(t){var i=e(this).closest(".fl-icon-field"),l=i.find("input[type=hidden]"),s=i.find("i"),o=s.attr("data-icon");l.val(t).trigger("change"),s.removeClass(o),s.addClass(t),s.attr("data-icon",t),i.removeClass("fl-icon-empty"),i.find("label.error").remove()},_removeIcon:function(){var t=e(this).closest(".fl-icon-field"),i=t.find("input[type=hidden]"),l=t.find("i");i.val("").trigger("change"),l.removeClass(),l.attr("data-icon",""),t.addClass("fl-icon-empty")},_formFieldClicked:function(){var t=e(this),i=t.closest(".fl-builder-settings"),l=t.attr("data-type"),s=t.siblings("input").val(),o=FLBuilder._moduleHelpers[l],n=(FLBuilderSettingsConfig.forms[l],FLBuilder._openNestedSettings({className:"fl-builder-lightbox fl-form-field-settings"}));""===s&&(s=JSON.stringify(FLBuilderSettingsConfig.forms[l])),FLBuilderSettingsForms.render({id:l,nodeId:i.attr("data-node"),nodeSettings:FLBuilder._getSettings(i),settings:JSON.parse(s.replace(/&#39;/g,"'")),lightbox:n,helper:o,rules:o?o.rules:null},function(){t.attr("id","fl-"+n._node.attr("data-instance-id")),n._node.find("form.fl-builder-settings").attr("data-type",l)})},_saveFormFieldClicked:function(){var t=e(this).closest(".fl-builder-settings"),i=e(this).closest(".fl-lightbox-wrap").attr("data-instance-id"),l=t.attr("data-type"),s=FLBuilder._getSettings(t),o={},n=FLBuilder._moduleHelpers[l],r=e(".fl-builder-settings #fl-"+i),a=r.parent().attr("data-preview-text"),d=t.find("#fl-field-"+a),u=s[a],c=e('select[name="'+a+'"]'),h=document.createElement("div"),f=!0;return c.length>0&&(u=c.find('option[value="'+s[a]+'"]').text()),"undefined"!=typeof n&&(t.find("label.error").remove(),t.validate().hideErrors(),f=t.validate().form(),f&&(f=n.submit())),f?("undefined"!=typeof a&&"undefined"!=typeof u&&("icon"===d.data("type")?u='<i class="'+u+'"></i>':u.length>35&&(h.innerHTML=u,u=(h.textContent||h.innerText||"").replace(/^(.{35}[^\s]*).*/,"$1")+"..."),r.siblings(".fl-form-field-preview-text").html(u)),o=r.siblings("input").val().replace(/&#39;/g,"'"),""!=o&&(s=e.extend(JSON.parse(o),s)),r.siblings("input").val(JSON.stringify(s)).trigger("change"),FLBuilder._closeNestedSettings(),!0):(FLBuilder._toggleSettingsTabErrors(),!1)},_layoutFieldClicked:function(){var t=e(this);t.siblings().removeClass("fl-layout-field-option-selected"),t.addClass("fl-layout-field-option-selected"),t.siblings("input").val(t.attr("data-value"))},_initLinkFields:function(){e(".fl-builder-settings:visible .fl-link-field").each(FLBuilder._initLinkField)},_initLinkField:function(){var t=e(this),i=t.find(".fl-link-field-search-input");i.autoSuggest(FLBuilder._ajaxUrl({fl_action:"fl_builder_autosuggest",fl_as_action:"fl_as_links",_wpnonce:FLBuilderConfig.ajaxNonce}),{asHtmlID:i.attr("name"),selectedItemProp:"name",searchObjProps:"name",minChars:3,keyDelay:1e3,fadeOut:!1,usePlaceholder:!0,emptyText:FLBuilderStrings.noResultsFound,showResultListWhenNoMatch:!0,queryParam:"fl_as_query",selectionLimit:1,afterSelectionAdd:FLBuilder._updateLinkField})},_updateLinkField:function(e,t,i){var l=e.closest(".fl-link-field"),s=l.find(".fl-link-field-search"),o=l.find(".fl-link-field-search-input"),n=l.find(".fl-link-field-input");n.val(t.value).trigger("keyup"),o.autoSuggest("remove",t.value),s.hide()},_linkFieldSelectClicked:function(){var t=e(this).closest(".fl-link-field").find(".fl-link-field-search");t.show(),t.find("input").focus()},_linkFieldSelectCancelClicked:function(){var t=e(this);t.parent().hide(),t.closest(".fl-link-field").find("input.fl-link-field-input").focus()},_initFontFields:function(){e(".fl-builder-settings:visible .fl-font-field").each(FLBuilder._initFontField)},_initFontField:function(){var t=e(this),i=t.attr("data-value"),l=t.find(".fl-font-field-font"),s=t.find(".fl-font-field-weight");l.on("change",function(){FLBuilder._getFontWeights(l)}),i.indexOf("family")>-1&&(i=JSON.parse(i),l.val(i.family),l.trigger("change"),s.find("option[value="+i.weight+"]").length&&s.val(i.weight))},_getFontWeights:function(t){var i=t.next(".fl-font-field-weight"),l=t.val(),s={"default":"Default",regular:"Regular",100:"Thin 100",200:"Extra-Light 200",300:"Light 300",400:"Normal 400",500:"Medium 500",600:"Semi-Bold 600",700:"Bold 700",800:"Extra-Bold 800",900:"Ultra-Bold 900"},o={};i.html(""),o="undefined"!=typeof FLBuilderFontFamilies.system[l]?FLBuilderFontFamilies.system[l].weights:"undefined"!=typeof FLBuilderFontFamilies.google[l]?FLBuilderFontFamilies.google[l]:FLBuilderFontFamilies["default"][l],e.each(o,function(e,t){i.append('<option value="'+t+'">'+s[t]+"</option>")})},_initTinyMCE:function(){tinymce.ui.FloatPanel.zIndex=100100,e(".fl-builder-hidden-editor").each(FLBuilder._initEditorField)},_initEditorFields:function(){e(".fl-builder-settings:visible .fl-editor-field").each(FLBuilder._initEditorField)},_initEditorField:function(){var t=e(this),i=t.find("textarea"),l=t.attr("data-name"),s="flrich"+(new Date).getTime()+"_"+l,o=FLBuilderConfig.wp_editor,n=tinyMCEPreInit,r=Number(t.attr("data-buttons")),a=t.attr("data-rows"),d=null,u=null;o=o.replace(/flbuildereditor/g,s),n=JSON.parse(JSON.stringify(n).replace(/flbuildereditor/g,s)),i.after(o).remove(),e("textarea#"+s).val(i.val()),void 0!==typeof tinymce&&void 0!==n.mceInit[s]&&(d=n.mceInit[s],u=tinymce.$("#wp-"+s+"-wrap"),u.find("textarea").attr("rows",a),r||u.find(".wp-media-buttons").remove(),!u.hasClass("tmce-active")&&n.qtInit.hasOwnProperty(s)||d.wp_skip_init||tinymce.init(d)),void 0!==typeof quicktags&&quicktags(n.qtInit[s]),window.wpActiveEditor=s},_reinitEditorFields:function(){e(".fl-lightbox-resizable:visible").length&&setTimeout(function(){var t,i;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)i=tinymce.editors[t].id,tinyMCE.execCommand("mceRemoveEditor",!0,i),tinyMCE.execCommand("mceAddEditor",!0,i);FLBuilder.preview&&FLBuilder.preview._initDefaultFieldPreviews(e('.fl-field[data-type="editor"]'))}},1)},_destroyEditorFields:function(){var t;if("undefined"!=typeof tinymce){for(t=tinymce.editors.length-1;t>-1;t--)tinyMCE.execCommand("mceRemoveEditor",!0,tinymce.editors[t].id);e(".wplink-autocomplete").remove(),e(".ui-helper-hidden-accessible").remove()}},_updateEditorFields:function(){var t=e(".fl-builder-settings:visible textarea.wp-editor-area");t.each(FLBuilder._updateEditorField)},_updateEditorField:function(){var t=e(this),i=t.closest(".fl-editor-field"),l=(t.closest(".fl-builder-settings"),t.closest(".wp-editor-wrap")),s=t.attr("id"),o=i.attr("data-name"),n="undefined"!=typeof tinyMCE&&tinyMCE.get(s),r=t.siblings('textarea[name="'+o+'"]'),a=i.data("wpautop");0===r.length&&(r=e('<textarea name="'+o+'"></textarea>').hide(),t.after(r)),a?n&&l.hasClass("tmce-active")?r.val(n.getContent()):"undefined"!=typeof switchEditors?r.val(switchEditors.wpautop(t.val())):r.val(t.val()):(n&&l.hasClass("tmce-active")&&n.save(),r.val(t.val()))},_loopDataSourceChange:function(){var t=e(this).val();e(".fl-loop-data-source").hide(),e('.fl-loop-data-source[data-source="'+t+'"]').show()},_customQueryPostTypeChange:function(){var t=e(this).val();e(".fl-custom-query-filter").hide(),e(".fl-custom-query-"+t+"-filter").show()},_initOrderingFields:function(){e(".fl-builder-settings:visible .fl-ordering-field-options").each(FLBuilder._initOrderingField)},_initOrderingField:function(){e(this).sortable({items:".fl-ordering-field-option",containment:"parent",tolerance:"pointer",stop:FLBuilder._updateOrderingField})},_updateOrderingField:function(t){var i=e(t.target),l=i.siblings("input[type=hidden]"),s=[];i.find(".fl-ordering-field-option").each(function(){s.push(e(this).attr("data-key"))}),l.val(JSON.stringify(s)).trigger("change")},_onNumberFieldFocus:function(t){var i=e(t.currentTarget);i.addClass("mousetrap"),Mousetrap.bind("up",function(){i.attr("step",1)}),Mousetrap.bind("down",function(){i.attr("step",1)}),Mousetrap.bind("shift+up",function(){i.attr("step",10)}),Mousetrap.bind("shift+down",function(){i.attr("step",10)})},_onNumberFieldBlur:function(t){var i=e(t.currentTarget);i.attr("step",1).removeClass("mousetrap")},_initTimezoneFields:function(){e(".fl-builder-settings:visible .fl-field[data-type=timezone]").each(FLBuilder._initTimezoneField)},_initTimezoneField:function(){var t=e(this).find("select"),i=t.attr("data-value");t.find('option[value="'+i+'"]').attr("selected","selected")},ajax:function(t,i){var l;FLBuilder.triggerHook("didBeginAJAX",t);for(l in t)"undefined"==typeof t[l]&&(t[l]=null);return t._wpnonce=FLBuilderConfig.ajaxNonce,t.post_id=FLBuilderConfig.postId,t.fl_builder=1,t.fl_action=t.action,"undefined"!=typeof t.settings&&(t.settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.settings))),"undefined"!=typeof t.node_settings&&(t.node_settings=FLBuilder._ajaxModSecFix(e.extend(!0,{},t.node_settings))),t={fl_builder_data:t},e.post(FLBuilder._ajaxUrl(),t,function(e){FLBuilder._ajaxComplete(),"undefined"!=typeof i&&i.call(this,e),FLBuilder.triggerHook("didCompleteAJAX",t)})},_ajaxComplete:function(){FLBuilder.hideAjaxLoader()},_ajaxUrl:function(e){var t=window.location.href.split("#").shift(),i=null;if("undefined"!=typeof e)for(i in e)t+=t.indexOf("?")>-1?"&":"?",t+=i+"="+e[i];return t},showAjaxLoader:function(){0===e(".fl-builder-lightbox-loading").length&&e(".fl-builder-loading").show()},hideAjaxLoader:function(){e(".fl-builder-loading").hide()},_showNodeLoading:function(t){var i=e(".fl-node-"+t);i.addClass("fl-builder-node-loading")},_hideNodeLoading:function(t){var i=e(".fl-node-"+t);i.removeClass("fl-builder-node-loading")},_showNodeLoadingPlaceholder:function(t,i){var l=e('<div class="fl-builder-node-loading-placeholder"></div>');t.hasClass("fl-builder-content")?siblings=t.find(".fl-row"):t.hasClass("fl-row-content")?siblings=t.find(" > .fl-col-group"):t.hasClass("fl-col-group")?(t.addClass("fl-col-group-has-child-loading"),siblings=t.find(" > .fl-col")):siblings=t.find(" > .fl-col-group, > .fl-module"),0===siblings.length||siblings.length==i?t.append(l):siblings.eq(i).before(l)},_removeNodeLoadingPlaceholder:function(e){var t=e.prev(".fl-builder-node-loading-placeholder"),i=e.next(".fl-builder-node-loading-placeholder");t.length?t.remove():i.remove()},_ajaxModSecFix:function(e){var t;if(FLBuilderConfig.modSecFix&&"undefined"!=typeof btoa)if("string"==typeof e)e=FLBuilder._btoa(e);else for(t in e)"string"==typeof e[t]?e[t]=FLBuilder._btoa(e[t]):"object"==typeof e[t]&&(e[t]=FLBuilder._ajaxModSecFix(e[t]));return e},_btoa:function(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))},_wpmedia_reset_errors:function(){e(".upload-error").remove(),e(".media-uploader-status").removeClass("errors").hide()},_initLightboxes:function(){FLBuilder._lightbox=new FLLightbox({className:"fl-builder-lightbox fl-builder-settings-lightbox",resizable:!0}),FLBuilder._lightbox.on("resized",FLBuilder._calculateSettingsTabsOverflow),FLBuilder._lightbox.on("close",FLBuilder._lightboxClosed),FLBuilder._lightbox.on("beforeCloseLightbox",FLBuilder._destroyEditorFields),FLBuilder._actionsLightbox=new FLLightbox({className:"fl-builder-actions-lightbox"})},_showLightbox:function(){FLBuilder._lightbox.open('<div class="fl-builder-lightbox-loading"></div>'),FLBuilder._removeAllOverlays(),FLBuilder._initLightboxScrollbars()},_setLightboxContent:function(e){FLBuilder._lightbox.setContent(e)},_initLightboxScrollbars:function(){FLBuilder._initScrollbars(),FLBuilder._lightboxScrollbarTimeout=setTimeout(FLBuilder._initLightboxScrollbars,500)},_lightboxClosed:function(){FLBuilder.triggerHook("settings-lightbox-closed"),FLBuilder._lightbox.empty(),clearTimeout(FLBuilder._lightboxScrollbarTimeout)},_showActionsLightbox:function(e){var t=wp.template("fl-actions-lightbox");FLBuilder.triggerHook("actions-lightbox-settings",e),FLBuilder._actionsLightbox.open(t(e))},alert:function(e){var t=new FLLightbox({className:"fl-builder-alert-lightbox",destroyOnClose:!0}),i=wp.template("fl-alert-lightbox");t.open(i({message:e}))},_alertClose:function(){FLLightbox.closeParent(this)},confirm:function(t){var i={message:"",ok:function(){},cancel:function(){},strings:{ok:FLBuilderStrings.ok,cancel:FLBuilderStrings.cancel}},l=e.extend({},i,"undefined"==typeof t?{}:t);lightbox=new FLLightbox({className:"fl-builder-confirm-lightbox fl-builder-alert-lightbox",destroyOnClose:!0}),template=wp.template("fl-confirm-lightbox"),lightbox.open(template(l)),lightbox._node.find(".fl-builder-confirm-ok").on("click",l.ok),lightbox._node.find(".fl-builder-confirm-cancel").on("click",l.cancel)},triggerHook:function(t,i){e("body").trigger("fl-builder."+t,i)},addHook:function(t,i){e("body").on("fl-builder."+t,i)},removeHook:function(t,i){e("body").off("fl-builder."+t,i)},log:function(e){"undefined"!=typeof window.console&&"undefined"!=typeof window.console.log&&console.log(e)},logError:function(e){var t=null;"undefined"!=typeof e&&("undefined"!=typeof e.stack?t=e.stack:"undefined"!=typeof e.message&&(t=e.message),t&&(FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(t),FLBuilder.log("************************************************************************")))},logGlobalError:function(e,t,i,l,s){FLBuilder.log("************************************************************************"),FLBuilder.log(FLBuilderStrings.errorMessage),FLBuilder.log(FLBuilderStrings.globalErrorMessage.replace("{message}",e).replace("{line}",i).replace("{file}",t)),"undefined"!=typeof s&&"undefined"!=typeof s.stack&&(FLBuilder.log(s.stack),FLBuilder.log("************************************************************************"))}},e(function(){FLBuilder._init()})}(jQuery),function(e){FLBuilderAJAXLayout=function(t,i){this._data=e.extend({},this._defaults,"string"==typeof t?JSON.parse(t):t),this._callback=i,this._post=FLBuilderConfig.postId,this._head=e("head").eq(0),this._body=e("body").eq(0),this._data.css&&(this._loader=e('<img src="'+this._data.css+'" />'),this._oldCss=e('link[href*="/cache/'+this._post+'"]'),this._newCss=e('<link rel="stylesheet" id="fl-builder-layout-'+this._post+'-css" href="'+this._data.css+'" />')),this._data.partial?(this._data.js&&(this._oldJs=e("#fl-builder-partial-refresh-js"),this._newJs=e('<script type="text/javascript" id="fl-builder-partial-refresh-js">'+this._data.js+"</script>")),this._data.nodeId&&(this._data.oldNodeId?(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.oldNodeId+'"]'),this._content=e(".fl-node-"+this._data.oldNodeId)):(this._oldScriptsStyles=e('.fl-builder-node-scripts-styles[data-node="'+this._data.nodeId+'"]'),this._content=e(".fl-node-"+this._data.nodeId).eq(0)))):(this._oldJs=e('script[src*="/cache/'+this._post+'"]'),this._newJs=e('<script src="'+this._data.js+'"></script>'),this._oldScriptsStyles=e(".fl-builder-layout-scripts-styles"),this._content=e(FLBuilder._contentClass)),this._init()},FLBuilderAJAXLayout.prototype={_defaults:{partial:!1,nodeId:null,nodeType:null,nodeParent:null,nodePosition:null,oldNodeId:null,html:null,scriptsStyles:null,css:null,js:null},_data:null,_callback:function(){},_post:null,_head:null,_body:null,_loader:null,_oldCss:null,_newCss:null,_oldJs:null,_newJs:null,_oldScriptsStyles:null,_content:null,_init:function(){this._body.height(this._body.height()),this._loader?(this._loader.on("error",e.proxy(this._loadNewCSSComplete,this)),this._body.append(this._loader)):this._finish()},_loadNewCSSComplete:function(){this._loader.remove(),this._oldCss.length>0?this._oldCss.after(this._newCss):this._head.append(this._newCss),setTimeout(e.proxy(this._finish,this),250)},_finish:function(){this._removeOldContentAndAssets(),this._cleanNewHTML(),this._cleanNewAssets(),this._addNewHTML(),this._addNewScriptsStyles(),this._addNewJS(),e(FLBuilder._contentClass).trigger("fl-builder.layout-rendered"),FLBuilder.hideAjaxLoader(),"undefined"!=typeof this._callback&&this._callback(),FLBuilder.triggerHook("didRenderLayoutComplete")},_removeOldContentAndAssets:function(){this._content&&this._content.empty(),this._oldCss&&this._oldCss.remove(),this._oldJs&&this._oldJs.remove(),this._oldScriptsStyles&&this._oldScriptsStyles.remove()},_cleanNewHTML:function(){if(this._data.scriptsStyles){var t=e("<div>"+this._data.html+"</div>"),i="fl-row",l=this._data.scriptsStyles,s="";this._data.partial&&(i="column-group"==this._data.nodeType?"fl-col-group":"column"==this._data.nodeType?"fl-col":"fl-"+this._data.nodeType),t.find("> *, script").each(function(){e(this).hasClass(i)||(s=e(this).remove(),l+=s[0].outerHTML)}),""!==l&&(l=this._data.partial?'<div class="fl-builder-node-scripts-styles" data-node="'+this._data.nodeId+'">'+l+"<div>":'<div class="fl-builder-node-scripts-styles">'+l+"<div>"),this._data.html=t.html(),this._data.scriptsStyles=l}},_addNewHTML:function(){var t;this._data.partial?this._data.nodeParent?(t=this._data.nodeParent.hasClass("fl-builder-content")?this._data.nodeParent.find(".fl-row"):this._data.nodeParent.hasClass("fl-row-content")?this._data.nodeParent.find(" > .fl-col-group"):this._data.nodeParent.hasClass("fl-col-group")?this._data.nodeParent.find(" > .fl-col"):this._data.nodeParent.find(" > .fl-col-group, > .fl-module"),t=t.filter(":not(.fl-builder-node-clone)"),0===t.length||t.length==this._data.nodePosition?this._data.nodeParent.append(this._data.html):t.eq(this._data.nodePosition).before(this._data.html),this._data.nodeId&&FLBuilder._removeNodeLoadingPlaceholder(e(".fl-node-"+this._data.nodeId))):(this._content.after(this._data.html),this._content.remove()):this._content.append(this._data.html),FLBuilder.preview&&this._data.nodeId&&this._data.nodeId!=FLBuilder.preview.nodeId&&e(FLBuilder.preview.classes.node).length&&e(FLBuilder.preview.classes.node).html(FLBuilder.preview.elements.node.html())},_cleanNewAssets:function(){var t=this;this._data.html=this._removeDuplicateAssets(this._data.html),this._data.scriptsStyles&&""!==this._data.scriptsStyles&&(this._data.scriptsStyles=this._removeDuplicateAssets(this._data.scriptsStyles)),this._data.partial?e(".fl-builder-node-scripts-styles").each(function(){t._data.html.indexOf("fl-node-"+e(this).data("node"))>-1&&e(this).remove()}):(e("#fl-builder-partial-refresh-js").remove(),e(".fl-builder-node-scripts-styles").remove())},_removeDuplicateAssets:function(t){var i=e("<div>"+t+"</div>"),l="",s=null,o="",n=null,r=window.location,a=r.protocol+"//"+r.hostname+(r.port?":"+r.port:"");return i.find("script").each(function(){l=e(this).attr("src"),"undefined"!=typeof l&&(l=l.replace(a,""),s=e('script[src*="'+l+'"]'),s.length>0&&e(this).remove())}),i.find("link").each(function(){o=e(this).attr("href"),"undefined"!=typeof o&&(o=o.replace(a,""),n=e('link[href*="'+o+'"]'),n.length>0&&e(this).remove())}),i.html()},_addNewScriptsStyles:function(){this._data.scriptsStyles&&""!==this._data.scriptsStyles&&this._body.append(this._data.scriptsStyles)},_addNewJS:function(){setTimeout(e.proxy(function(){this._newJs&&this._head.append(this._newJs)},this),50)},_complete:function(){FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._initDropTargets(),FLBuilder._initSortables(),FLBuilder._resizeLayout(),FLBuilder._initMediaElements(),FLBuilderLayout.init(),FLBuilderResponsiveEditing.refreshPreview(),this._body.height("auto")}}}(jQuery),function(e){FLBuilderPreview=function(e){this.type=e.type,this._saveState(),e.layout?FLBuilder._renderLayout(e.layout,function(){this._init(),e.callback&&e.callback()}.bind(this)):this._init()},FLBuilderPreview._fontsList={},FLBuilderPreview.prototype={type:"",nodeId:null,classes:{},elements:{},state:null,_savedSettings:null,_styleSheet:null,_styleSheetMedium:null,_styleSheetResponsive:null,_timeout:null,_loaderTimeout:null,_lastClassName:null,_xhr:null,_init:function(){switch(this.nodeId=e(".fl-builder-settings").data("node"),this._saveSettings(),this._initElementsAndClasses(),this._createSheets(),this._initResponsivePreviews(),this._initDefaultFieldPreviews(),this.type){case"row":this._initRow();break;case"col":this._initColumn();break;case"module":this._initModule()}},_saveSettings:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings");this._savedSettings=FLBuilder._getSettings(t)},_settingsHaveChanged:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=FLBuilder._getSettings(t);return JSON.stringify(this._savedSettings)!=JSON.stringify(i)},_initElementsAndClasses:function(){var t;t="row"==this.type?".fl-row-content-wrap":".fl-"+this.type+"-content",e.extend(this.classes,{settings:".fl-builder-"+this.type+"-settings",settingsHeader:".fl-builder-"+this.type+"-settings .fl-lightbox-header",node:FLBuilder._contentClass+" .fl-node-"+this.nodeId,content:FLBuilder._contentClass+" .fl-node-"+this.nodeId+" > "+t}),e.extend(this.elements,{settings:e(this.classes.settings),settingsHeader:e(this.classes.settingsHeader),node:e(this.classes.node),content:e(this.classes.content)})},_createSheets:function(){this._destroySheets(),this._styleSheet||(this._styleSheet=new FLStyleSheet({id:"fl-builder-preview",className:"fl-builder-preview-style"})),this._styleSheetMedium||(this._styleSheetMedium=new FLStyleSheet({id:"fl-builder-preview-medium",className:"fl-builder-preview-style"})),this._styleSheetResponsive||(this._styleSheetResponsive=new FLStyleSheet({id:"fl-builder-preview-responsive",className:"fl-builder-preview-style"}))},_destroySheets:function(){this._styleSheet&&(this._styleSheet.destroy(),this._styleSheet=null),this._styleSheetMedium&&(this._styleSheetMedium.destroy(),this._styleSheetMedium=null),this._styleSheetResponsive&&(this._styleSheetResponsive.destroy(),this._styleSheetResponsive=null)},updateCSSRule:function(e,t,i){this._styleSheet.updateRule(e,t,i)},delay:function(e,t){this._cancelDelay(),this._timeout=setTimeout(t,e)},_cancelDelay:function(){null!==this._timeout&&clearTimeout(this._timeout)},hexToRgb:function(e){var t=parseInt(e,16),i=t>>16&255,l=t>>8&255,s=255&t;return[i,l,s]},parseFloat:function(e){return isNaN(parseFloat(e))?0:parseFloat(e)},_initResponsivePreviews:function(){FLBuilder.addHook("responsive-editing-switched",e.proxy(this._responsiveEditingSwitched,this))},_destroyResponsivePreviews:function(){FLBuilder.removeHook("responsive-editing-switched")},_responsiveEditingSwitched:function(e,t){"default"==t?(this._styleSheetMedium.disable(),this._styleSheetResponsive.disable()):"medium"==t?(this._styleSheetMedium.enable(),this._styleSheetResponsive.disable()):"responsive"==t&&(this._styleSheetMedium.disable(),this._styleSheetResponsive.enable())},updateResponsiveCSSRule:function(e,t,i){var l=FLBuilderResponsiveEditing._mode,s="default"==l?"":l.charAt(0).toUpperCase()+l.slice(1);this["_styleSheet"+s].updateRule(e,t,i)},_saveState:function(){var t=FLBuilderConfig.postId,i=e('link[href*="/cache/'+t+'"]').attr("href"),l=e('script[src*="/cache/'+t+'"]').attr("src"),s=e(FLBuilder._contentClass).html();this.state={css:i,js:l,html:s}},preview:function(){var t=e(".fl-builder-settings-lightbox .fl-builder-settings"),i=t.attr("data-node"),l=FLBuilder._getSettings(t);FLBuilder._showNodeLoading(i),this._cancelPreview(),this._xhr=FLBuilder.ajax({action:"render_layout",node_id:i,node_preview:l},e.proxy(this._renderPreview,this))},delayPreview:function(t){var i="undefined"==typeof t?[]:e(t.target).closest("tr").find("th"),l=e(".fl-builder-widget-settings .fl-builder-settings-title"),s=e(".fl-builder-settings .fl-lightbox-header"),o=FLBuilderLayoutConfig.paths.pluginUrl+"img/ajax-loader-small.svg",n=e('<img class="fl-builder-preview-loader" src="'+o+'" />');this.delay(1e3,e.proxy(this.preview,this)),this._loaderTimeout=setTimeout(function(){e(".fl-builder-preview-loader").remove(),i.length>0?i.append(n):l.length>0?l.append(n):s.length>0&&s.append(n)},1500)},_cancelPreview:function(){this._xhr&&(this._xhr.abort(),this._xhr=null)},_renderPreview:function(t){this._xhr=null,FLBuilder._renderLayout(t,e.proxy(this._renderPreviewComplete,this))},_renderPreviewComplete:function(){this._createSheets(),this._initElementsAndClasses(),null!==this._loaderTimeout&&clearTimeout(this._loaderTimeout),e(".fl-builder-preview-loader").remove(),e(FLBuilder._contentClass).trigger("fl-builder.preview-rendered")},revert:function(){return this._settingsHaveChanged()?void FLBuilder._updateNode(this.nodeId,function(){this.clear()}.bind(this)):void this.clear()},cancel:function(){this._cancelDelay(),this._cancelPreview()},clear:function(){this.cancel(),this._destroySheets(),this._destroyResponsivePreviews()},_initNodeTextColor:function(){e.extend(this.elements,{textColor:e(this.classes.settings+" input[name=text_color]"),linkColor:e(this.classes.settings+" input[name=link_color]"),hoverColor:e(this.classes.settings+" input[name=hover_color]"),headingColor:e(this.classes.settings+" input[name=heading_color]")}),this.elements.textColor.on("change",e.proxy(this._textColorChange,this)),this.elements.linkColor.on("change",e.proxy(this._textColorChange,this)),this.elements.hoverColor.on("change",e.proxy(this._textColorChange,this)),this.elements.headingColor.on("change",e.proxy(this._textColorChange,this))},_textColorChange:function(t){var i=this.elements.textColor.val(),l=this.elements.linkColor.val(),s=this.elements.hoverColor.val(),o=this.elements.headingColor.val();l=""===l?i:l,s=""===s?i:s,o=""===o?i:o,this.delay(100,e.proxy(function(){""===i?this.updateCSSRule(this.classes.node,"color","inherit"):this.updateCSSRule(this.classes.node,"color","#"+i),""===l?this.updateCSSRule(this.classes.node+" a","color","inherit"):this.updateCSSRule(this.classes.node+" a","color","#"+l),""===s?this.updateCSSRule(this.classes.node+" a:hover","color","inherit"):this.updateCSSRule(this.classes.node+" a:hover","color","#"+s),""===o?(this.updateCSSRule(this.classes.node+" h1","color","inherit"),this.updateCSSRule(this.classes.node+" h2","color","inherit"),this.updateCSSRule(this.classes.node+" h3","color","inherit"),this.updateCSSRule(this.classes.node+" h4","color","inherit"),this.updateCSSRule(this.classes.node+" h5","color","inherit"),this.updateCSSRule(this.classes.node+" h6","color","inherit"),this.updateCSSRule(this.classes.node+" h1 a","color","inherit"),this.updateCSSRule(this.classes.node+" h2 a","color","inherit"),this.updateCSSRule(this.classes.node+" h3 a","color","inherit"),this.updateCSSRule(this.classes.node+" h4 a","color","inherit"),this.updateCSSRule(this.classes.node+" h5 a","color","inherit"),this.updateCSSRule(this.classes.node+" h6 a","color","inherit")):(this.updateCSSRule(this.classes.node+" h1","color","#"+o),this.updateCSSRule(this.classes.node+" h2","color","#"+o),this.updateCSSRule(this.classes.node+" h3","color","#"+o),this.updateCSSRule(this.classes.node+" h4","color","#"+o),this.updateCSSRule(this.classes.node+" h5","color","#"+o),this.updateCSSRule(this.classes.node+" h6","color","#"+o),this.updateCSSRule(this.classes.node+" h1 a","color","#"+o),this.updateCSSRule(this.classes.node+" h2 a","color","#"+o),this.updateCSSRule(this.classes.node+" h3 a","color","#"+o),this.updateCSSRule(this.classes.node+" h4 a","color","#"+o),this.updateCSSRule(this.classes.node+" h5 a","color","#"+o),this.updateCSSRule(this.classes.node+" h6 a","color","#"+o))},this))},_initNodeBg:function(){e.extend(this.elements,{bgType:e(this.classes.settings+" select[name=bg_type]"),bgColor:e(this.classes.settings+" input[name=bg_color]"),bgColorPicker:e(this.classes.settings+" .fl-picker-bg_color"),bgOpacity:e(this.classes.settings+" input[name=bg_opacity]"),bgImageSrc:e(this.classes.settings+" select[name=bg_image_src]"),bgRepeat:e(this.classes.settings+" select[name=bg_repeat]"),bgPosition:e(this.classes.settings+" select[name=bg_position]"),bgAttachment:e(this.classes.settings+" select[name=bg_attachment]"),bgSize:e(this.classes.settings+" select[name=bg_size]"),bgVideoSource:e(this.classes.settings+" select[name=bg_video_source]"),bgVideo:e(this.classes.settings+" input[name=bg_video]"),bgVideoServiceUrl:e(this.classes.settings+" input[name=bg_video_service_url]"),bgVideoFallbackSrc:e(this.classes.settings+" select[name=bg_video_fallback_src]"),bgSlideshowSource:e(this.classes.settings+" select[name=ss_source]"),bgSlideshowPhotos:e(this.classes.settings+" input[name=ss_photos]"),bgSlideshowFeedUrl:e(this.classes.settings+" input[name=ss_feed_url]"),
6
+ bgSlideshowSpeed:e(this.classes.settings+" input[name=ss_speed]"),bgSlideshowTrans:e(this.classes.settings+" select[name=ss_transition]"),bgSlideshowTransSpeed:e(this.classes.settings+" input[name=ss_transitionDuration]"),bgParallaxImageSrc:e(this.classes.settings+" select[name=bg_parallax_image_src]"),bgOverlayColor:e(this.classes.settings+" input[name=bg_overlay_color]"),bgOverlayOpacity:e(this.classes.settings+" input[name=bg_overlay_opacity]")}),this.elements.bgType.on("change",e.proxy(this._bgTypeChange,this)),this.elements.bgColor.on("change",e.proxy(this._bgColorChange,this)),this.elements.bgOpacity.on("keyup",e.proxy(this._bgOpacityChange,this)),this.elements.bgImageSrc.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgRepeat.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgPosition.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgAttachment.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgSize.on("change",e.proxy(this._bgPhotoChange,this)),this.elements.bgVideoServiceUrl.on("change",e.proxy(this._bgVideoChange,this)),this.elements.bgSlideshowSource.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowPhotos.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowFeedUrl.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTrans.on("change",e.proxy(this._bgSlideshowChange,this)),this.elements.bgSlideshowTransSpeed.on("keyup",e.proxy(this._bgSlideshowChange,this)),this.elements.bgParallaxImageSrc.on("change",e.proxy(this._bgParallaxChange,this)),this.elements.bgOverlayColor.on("change",e.proxy(this._bgOverlayChange,this)),this.elements.bgOverlayOpacity.on("keyup",e.proxy(this._bgOverlayChange,this))},_bgTypeChange:function(e){var t=this.elements.bgType.val();this.elements.node.removeClass("fl-row-bg-video"),this.elements.node.removeClass("fl-row-bg-slideshow"),this.elements.node.removeClass("fl-row-bg-parallax"),this.elements.node.find(".fl-bg-video").remove(),this.elements.node.find(".fl-bg-slideshow").remove(),this.elements.content.css("background-image",""),this.updateCSSRule(this.classes.content,{"background-color":"transparent","background-image":"none"}),"none"==t?this._bgOverlayClear():"color"==t?(this.elements.bgColor.trigger("change"),this._bgOverlayClear()):"photo"==t?(this.elements.bgColor.trigger("change"),this.elements.bgImageSrc.trigger("change")):"video"==t?(this.elements.bgColor.trigger("change"),this._bgVideoChange()):"slideshow"==t?(this.elements.bgColor.trigger("change"),this._bgSlideshowChange()):"parallax"==t&&(this.elements.bgColor.trigger("change"),this.elements.bgParallaxImageSrc.trigger("change"))},_bgColorChange:function(t){var i,l,s;""===this.elements.bgColor.val()||isNaN(this.elements.bgOpacity.val())?this.updateCSSRule(this.classes.content,"background-color","transparent"):(i=this.hexToRgb(this.elements.bgColor.val()),l=this.parseFloat(this.elements.bgOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"background-color",s)},this)))},_bgOpacityChange:function(e){this.elements.bgColor.trigger("change")},_bgPhotoChange:function(e){this.elements.bgImageSrc.val()?this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgImageSrc.val()+")","background-repeat":this.elements.bgRepeat.val(),"background-position":this.elements.bgPosition.val(),"background-attachment":this.elements.bgAttachment.val(),"background-size":this.elements.bgSize.val()}):this.updateCSSRule(this.classes.content,{"background-image":"none"})},_bgVideoChange:function(t){var i=this.elements,l=i.bgVideoSource.val(),s=i.bgVideo.val(),o=i.bgVideoServiceUrl.val(),n="https://www.youtube.com/iframe_api",r="https://player.vimeo.com/api/player.js",a=e("<script>");"video_service"==l&&""!=o?(/^(?:(?:(?:https?:)?\/\/)?(?:www.)?(?:youtu(?:be.com|.be))\/(?:watch\?v\=|v\/|embed\/)?([\w\-]+))/i.test(o)&&e('script[src*="youtube.com"').length<1?a.attr("src",n):/^(http\:\/\/|https\:\/\/)?(www\.)?(vimeo\.com\/)([0-9]+)$/.test(o)&&e('script[src*="vimeo.com"').length<1&&a.attr("src",r),a.attr("type","text/javascript").appendTo("head"),this.delay(500,e.proxy(this.preview,this))):""!=s&&this.preview()},_bgSlideshowChange:function(t){var i=this.elements,l=i.bgSlideshowSource.val(),s=i.bgSlideshowPhotos.val(),o=i.bgSlideshowFeedUrl.val(),n=i.bgSlideshowSpeed.val(),r=i.bgSlideshowTransSpeed.val();"wordpress"==l&&""===s||"smugmug"==l&&""===o||isNaN(parseInt(n))||isNaN(parseInt(r))||this.delay(500,e.proxy(this.preview,this))},_bgParallaxChange:function(e){this.elements.bgParallaxImageSrc.val()&&this.updateCSSRule(this.classes.content,{"background-image":"url("+this.elements.bgParallaxImageSrc.val()+")","background-repeat":"no-repeat","background-position":"center center","background-attachment":"fixed","background-size":"cover"})},_bgOverlayChange:function(t){var i,l,s;""===this.elements.bgOverlayColor.val()||isNaN(this.elements.bgOverlayOpacity.val())?(this.elements.node.removeClass("fl-row-bg-overlay"),this.elements.node.removeClass("fl-col-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color","transparent")):(i=this.hexToRgb(this.elements.bgOverlayColor.val()),l=this.parseFloat(this.elements.bgOverlayOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.elements.node.hasClass("fl-col")?this.elements.node.addClass("fl-col-bg-overlay"):this.elements.node.addClass("fl-row-bg-overlay"),this.updateCSSRule(this.classes.content+":after","background-color",s)},this)))},_bgOverlayClear:function(e){this.elements.bgOverlayColor.prev(".fl-color-picker-clear").trigger("click")},_initNodeBorder:function(){e.extend(this.elements,{borderType:e(this.classes.settings+" select[name=border_type]"),borderColor:e(this.classes.settings+" input[name=border_color]"),borderColorPicker:e(this.classes.settings+" .fl-picker-border_color"),borderOpacity:e(this.classes.settings+" input[name=border_opacity]")}),this.elements.borderType.on("change",e.proxy(this._borderTypeChange,this)),this.elements.borderColor.on("change",e.proxy(this._borderColorChange,this)),this.elements.borderOpacity.on("keyup",e.proxy(this._borderOpacityChange,this))},_borderTypeChange:function(e){var t=this.elements.borderType.val();this.updateCSSRule(this.classes.content,{"border-style":""===t?"none":t}),this.elements.borderColor.trigger("change"),this.elements.borderTop.trigger("keyup")},_borderColorChange:function(t){var i,l,s;""===this.elements.borderColor.val()||isNaN(this.elements.borderOpacity.val())?this.updateCSSRule(this.classes.content,"border-color","transparent"):(i=this.hexToRgb(this.elements.borderColor.val()),l=parseInt(this.elements.borderOpacity.val())/100,s="rgba("+i.join()+", "+l+")",this.delay(100,e.proxy(function(){this.updateCSSRule(this.classes.content,"border-color",s)},this)))},_borderOpacityChange:function(e){this.elements.borderColor.trigger("change")},_initNodeClassName:function(){e.extend(this.elements,{className:e(this.classes.settings+" input[name=class]")}),this.elements.className.on("keyup",e.proxy(this._classNameChange,this)),this._lastClassName=this.elements.className.val()},_classNameChange:function(e){var t=this.elements.className.val();null!==this._lastClassName&&this.elements.node.removeClass(this._lastClassName),this.elements.node.addClass(t),this._lastClassName=t},_initResponsiveDimensions:function(t){var i={},l=["Top","Bottom","Left","Right"],s=["","Medium","Responsive"],o=this.classes.settings,n="",r="",a=null,d=null;for(a=0;a<l.length;a++)for(d=0;d<s.length;d++)n=t+l[a]+s[d],r=t+"_"+l[a].toLowerCase(),""!=s[d]&&(r+="_"+s[d].toLowerCase()),i[n]=e(o+" input[name="+r+"]"),i[n].on("keyup",e.proxy(this._responsiveDimensionChange,this,t));e.extend(this.elements,i)},_getDimensions:function(e){for(var t=FLBuilderResponsiveEditing._mode,i=["Top","Bottom","Left","Right"],l="default"==t?"":t.charAt(0).toUpperCase()+t.slice(1),s={},o=0;o<i.length;o++)s[i[o].toLowerCase()]=this.elements[e+i[o]+l].val();return this._normalizeDimensionValues(s,e)},_responsiveDimensionChange:function(t){var i=this._getDimensions(t),l={},s="border"==t;e.each(i,function(e,i){l[t+"-"+e+(s?"-width":"")]=i}),this.updateResponsiveCSSRule(this.classes.content,l),this._positionAbsoluteBgs()},_normalizeDimensionValues:function(t,i){var l=this,s=FLBuilderResponsiveEditing._mode,o="default"==s?"":s.charAt(0).toUpperCase()+s.slice(1),i=i.split("-");return"undefined"==typeof i[1]?i[1]="":i[1]=i[1].charAt(0).toUpperCase()+i[1].slice(1),e.map(t,function(e,s){if(e=e.toLowerCase().replace(/[^a-z0-9%.\-]/g,""),""===e){var n=i[0]+s.charAt(0).toUpperCase()+s.slice(1)+i[1]+o,r=l.elements[n].attr("placeholder");r&&(e=r)}null===e||""===e||isNaN(e)||(e=parseFloat(e)+"px"),t[s]=e}),t},_positionAbsoluteBgs:function(){var t=this.elements.node.find(".fl-bg-slideshow"),i=this.elements.node.find(".fl-bg-video"),l=null,s=null,o={top:0,bottom:0,left:0,right:0};(t.length>0||i.length>0)&&(l=this._getDimensions("margin"),s=this._getDimensions("border"),e.map(o,function(e,t){l[t]&&s[t]?o[t]="calc("+l[t]+"+"+s[t]+")":l[t]?o[t]=l[t]:s[t]&&(o[t]=s[t])}),t.length>0&&(this.updateCSSRule(this.classes.node+" .fl-bg-slideshow",o),FLBuilder._resizeLayout()),i.length>0&&this.updateCSSRule(this.classes.node+" .fl-bg-video",o))},_initRow:function(){e.extend(this.elements,{width:e(this.classes.settings+" select[name=width]"),contentWidth:e(this.classes.settings+" select[name=content_width]"),maxContentWidth:e(this.classes.settings+" input[name=max_content_width]"),height:e(this.classes.settings+" select[name=full_height]"),align:e(this.classes.settings+" select[name=content_alignment]")}),this.elements.width.on("change",e.proxy(this._rowWidthChange,this)),this.elements.contentWidth.on("change",e.proxy(this._rowContentWidthChange,this)),this.elements.maxContentWidth.on("keyup",e.proxy(this._rowMaxContentWidthChange,this)),this.elements.height.on("change",e.proxy(this._rowHeightChange,this)),this.elements.align.on("change",e.proxy(this._rowHeightChange,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_rowWidthChange:function(e){var t=this.elements.node,i=this.elements.maxContentWidth.val();"full"==this.elements.width.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowHeightChange:function(e){var t=this.elements.node;t.removeClass("fl-row-align-top"),t.removeClass("fl-row-align-center"),t.removeClass("fl-row-align-bottom"),"full"==this.elements.height.val()?(t.addClass("fl-row-full-height"),t.addClass("fl-row-align-"+this.elements.align.val())):t.removeClass("fl-row-full-height")},_rowContentWidthChange:function(e){var t=this.elements.content.find(".fl-row-content"),i=this.elements.maxContentWidth.val();"full"==this.elements.contentWidth.val()?(t.css("max-width","none"),t.removeClass("fl-row-fixed-width"),t.addClass("fl-row-full-width")):(t.removeClass("fl-row-full-width"),t.addClass("fl-row-fixed-width"),""!==i?t.css("max-width",i+"px"):t.css("max-width",FLBuilderConfig.global.row_width+"px"))},_rowMaxContentWidthChange:function(e){var t=this.elements.node,i=this.elements.content.find(".fl-row-content"),l=this.elements.maxContentWidth.val();""==l?l=FLBuilderConfig.global.row_width+"px":l+="px","fixed"==this.elements.width.val()&&t.css("max-width",l),"fixed"==this.elements.contentWidth.val()&&i.css("max-width",l)},_initColumn:function(){e.extend(this.elements,{size:e(this.classes.settings+" input[name=size]"),columnHeight:e(this.classes.settings+" select[name=equal_height]"),columnAlign:e(this.classes.settings+" select[name=content_alignment]"),responsiveOrder:e(this.classes.settings+" select[name=responsive_order]")}),this.elements.size.on("keyup",e.proxy(this._colSizeChange,this)),this.elements.columnHeight.on("change",e.proxy(this._colHeightChange,this)),this.elements.columnAlign.on("change",e.proxy(this._colHeightChange,this)),this.elements.responsiveOrder.on("change",e.proxy(this._colResponsiveOrder,this)),this._initNodeTextColor(),this._initNodeBg(),this._initNodeClassName(),this._initNodeBorder(),this._initResponsiveDimensions("border"),this._initResponsiveDimensions("margin"),this._initResponsiveDimensions("padding")},_colSizeChange:function(){var t=8,i=100-t,l=parseFloat(this.elements.size.val()),s=this.elements.node.prev(".fl-col"),o=this.elements.node.next(".fl-col"),n=0===o.length?s:o,r=this.elements.node.siblings(".fl-col"),a=0;0===r.length||isNaN(l)||(r.each(function(){e(this).data("node")!=n.data("node")&&(i-=parseFloat(e(this)[0].style.width),a+=parseFloat(e(this)[0].style.width))}),l<t&&(l=t),l>i&&(l=i),n.css("width",100-a-l+"%"),this.elements.node.css("width",l+"%"))},_colHeightChange:function(){var e=this.elements.node.parent(".fl-col-group");e.removeClass("fl-col-group-align-top"),e.removeClass("fl-col-group-align-center"),e.removeClass("fl-col-group-align-bottom"),"yes"==this.elements.columnHeight.val()?(e.addClass("fl-col-group-equal-height"),e.addClass("fl-col-group-align-"+this.elements.columnAlign.val())):e.removeClass("fl-col-group-equal-height")},_colResponsiveOrder:function(){var e=this.elements.node.parent(".fl-col-group");"reversed"==this.elements.responsiveOrder.val()?e.addClass("fl-col-group-responsive-reversed"):e.removeClass("fl-col-group-responsive-reversed")},_initModule:function(){this._initNodeClassName(),this._initResponsiveDimensions("margin")},_initDefaultFieldPreviews:function(e){for(var e=_.isUndefined(e)?this.elements.settings.find(".fl-field"):e,t=null,i=null,l=0;l<e.length;l++)t=e.eq(l),i=t.data("preview"),"refresh"==i.type&&this._initFieldRefreshPreview(t),"text"==i.type&&this._initFieldTextPreview(t),"css"==i.type&&this._initFieldCSSPreview(t),"widget"==i.type&&this._initFieldWidgetPreview(t),"font"==i.type&&this._initFieldFontPreview(t)},_initFieldRefreshPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this.delayPreview,this);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"select":t.find("select").on("change",s);break;case"color":t.find(".fl-color-picker-value").on("change",s);break;case"photo":t.find("select").on("change",s);break;case"multiple-photos":t.find("input").on("change",s);break;case"photo-sizes":t.find("select").on("change",s);break;case"video":t.find("input").on("change",s);break;case"multiple-audios":t.find("input").on("change",s);break;case"icon":t.find("input").on("change",s);break;case"form":t.delegate("input","change",s);break;case"editor":this._addTextEditorCallback(t,l);break;case"code":t.find("textarea").on("change",s);break;case"post-type":t.find("select").on("change",s);break;case"suggest":t.find(".as-values").on("change",s),t.find("select").on("change",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"ordering":t.find("input[type=hidden]").on("change",s)}},_initFieldTextPreview:function(t){var i=t.data("type"),l=t.data("preview"),s=e.proxy(this._previewText,this,l);switch(i){case"text":t.find("input[type=text]").on("keyup",s);break;case"unit":t.find("input[type=number]").on("keyup",s);break;case"textarea":t.find("textarea").on("keyup",s);break;case"code":t.find("textarea").on("change",s);break;case"editor":this._addTextEditorCallback(t,l)}},_previewText:function(t,i){var l=this.elements.node.find(t.selector),s=e("<div>"+e(i.target).val()+"</div>");l.length>0&&(s.find("script").remove(),l.html(s.html()))},_previewTextEditor:function(t,i,l){var s=this.elements.node.find(t.selector),o="undefined"!=typeof tinyMCE?tinyMCE.get(i):null,n=e("#"+i),r="";s.length>0&&(r=e(o&&"none"==n.css("display")?"<div>"+o.getContent()+"</div>":"undefined"==typeof switchEditors||"undefined"==typeof switchEditors.wpautop?"<div>"+n.val()+"</div>":"<div>"+switchEditors.wpautop(n.val())+"</div>"),r.find("script").remove(),s.html(r.html()))},_addTextEditorCallback:function(t,i){var l=t.find("textarea.wp-editor-area").attr("id"),s=null;if("refresh"==i.type)s=e.proxy(this.delayPreview,this);else{if("text"!=i.type)return;s=e.proxy(this._previewTextEditor,this,i,l)}e("#"+l).on("keyup",s),"undefined"!=typeof tinyMCE&&(editor=tinyMCE.get(l),editor.on("change",s),editor.on("keyup",s))},_initFieldFontPreview:function(t){var i=t.data("type"),l=t.data("preview");l.id=t.attr("id");var s=e.proxy(this._previewFont,this,l);"font"==i&&t.find(".fl-font-field").on("change","select",s)},_previewFont:function(t,i){var l=e(i.delegateTarget),s=l.find(".fl-font-field-font"),o=e(s).find(":selected"),n=o.parent().attr("label"),r=l.find(".fl-font-field-weight"),a=t.id+"-"+this.nodeId,d=this._getPreviewSelector(this.classes.node,t.selector);"Google"==n&&this._buildFontStylesheet(a,s.val(),r.val()),"Default"==s.val()?(this.updateCSSRule(d,"font-family",""),this.updateCSSRule(d,"font-weight","")):(this.updateCSSRule(d,"font-family",s.val()),this.updateCSSRule(d,"font-weight",r.val()))},_buildFontStylesheet:function(t,i,l){var s=FLBuilderConfig.googleFontsUrl,o="",n={},r={};n[i]=[l],FLBuilderPreview._fontsList[t]=n,Object.keys(FLBuilderPreview._fontsList).forEach(function(e){var t=FLBuilderPreview._fontsList[e];Object.keys(t).forEach(function(e){var i=t[e];r[e]=r[e]||[],i=i.filter(function(t){return r[e].indexOf(t)<0}),r[e]=r[e].concat(i)})}),e.each(r,function(e,t){o+=e+":"+t.join()+"|"}),o=s+o.slice(0,-1).replace(" ","+"),e("#fl-builder-google-fonts-preview").length<1?e("<link>").attr("id","fl-builder-google-fonts-preview").attr("type","text/css").attr("rel","stylesheet").attr("href",o).appendTo("head"):e("#fl-builder-google-fonts-preview").attr("href",o)},_initFieldCSSPreview:function(e){var t=e.data("preview"),i=null;if("undefined"!=typeof t.rules)for(i in t.rules)this._initFieldCSSPreviewCallback(e,t.rules[i]);else this._initFieldCSSPreviewCallback(e,t)},_initFieldCSSPreviewCallback:function(t,i){switch(t.data("type")){case"text":t.find("input[type=text]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"unit":t.find("input[type=number]").on("keyup",e.proxy(this._previewCSS,this,i));break;case"select":t.find("select").on("change",e.proxy(this._previewCSS,this,i));break;case"color":t.find(".fl-color-picker-value").on("change",e.proxy(this._previewColor,this,i))}},_previewCSS:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=t.property,o="undefined"==typeof t.unit?"":t.unit,n=e(i.target),r=n.val();"%"==o?r=parseInt(r)/100:""!==r&&(r+=o),n.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,s,r):this.updateCSSRule(l,s,r)},_previewColor:function(t,i){var l=this._getPreviewSelector(this.classes.node,t.selector),s=e(i.target),o=s.val(),n=""===o?"inherit":"#"+o;/^rgb/.test(o.replace(/\s+/g,""))&&(n=o),s.closest(".fl-field-responsive-setting").length?this.updateResponsiveCSSRule(l,t.property,n):this.updateCSSRule(l,t.property,n)},_initFieldWidgetPreview:function(t){var i=e.proxy(this.delayPreview,this);t.find("input").on("keyup",i),t.find("input[type=checkbox]").on("click",i),t.find("textarea").on("keyup",i),t.find("select").on("change",i)},_getPreviewSelector:function(e,t){for(var i="",l=t.split(","),s=0;s<l.length;s++)l[s].indexOf("{node}")>-1?i=l[s].replace("{node}",e):i+=e+" "+l[s],s!=l.length-1&&(i+=", ");return i}}}(jQuery),function(e){var t={ignored:[],reparsed:[],width:null,callback:null,sheets:{},styles:[],queue:[],emPxValue:null,regex:{media:/@media[^{]*{([\s\S]+?})\s*}/gi,empty:/@media[^{]*{([^{}]*?)}/gi,keyframes:/@(?:\-(?:o|moz|webkit)\-)?keyframes[^\{]+\{(?:[^\{\}]*\{[^\}\{]*\})+[^\}]*\}/gi,comments:/\/\*[^*]*\*+([^\/][^*]*\*+)*\//gi,urls:/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,findStyles:/@media *([^\{]+)\{([\S\s]+?)\}$/,only:/(only\s+)?([a-zA-Z]+)\s?/,minw:/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,maxw:/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/,minmaxwh:/\(\s*m(in|ax)\-(height|width)\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/gi,other:/\([^\)]*\)/g},ignore:function(e){Array.prototype.push.apply(this.ignored,e)},reparse:function(e){Array.prototype.push.apply(this.reparsed,e)},update:function(e,t){this.width=void 0===e?null:e,this.callback=void 0===t?null:t,i.update(),this.queueSheets()?this.runQueue():this.applyStyles()},queueSheets:function(){for(var t=e("link, style"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=!1,u=0,c=0;u<t.length;u++)if(element=t[u],i=element.href,l=element.id,s=element.tagName.toLowerCase(),o=element.rel,n=element.media,r=i?i:l?l:"style-"+u,a=!0,d=!1,"style"===s||i&&o&&"stylesheet"===o.toLowerCase()){for(c=0;c<this.ignored.length;c++)if(r.indexOf(this.ignored[c])>-1){d=!0;break}if(d)continue;for(c=0;c<this.reparsed.length;c++)if(r.indexOf(this.reparsed[c])>-1){this.sheets[r]=null;break}void 0!==this.sheets[r]&&this.sheets[r]||this.queue.push({element:t.eq(u),key:r,tagName:s,href:i,id:l,media:n})}return this.queue.length},runQueue:function(){var t;this.queue.length?(t=this.queue.shift(),"style"===t.tagName?(this.parse(t.element.html(),t),this.runQueue()):e.get(t.href,e.proxy(function(e){this.parse(e,t),this.runQueue()},this))):this.applyStyles()},parse:function(e,t){var i=this.regex,l=this.cleanStyles(e),s=l.match(i.media),o=s&&s.length||0,n=!o&&t.media,r=null,a=null,d=null,u="",c=0,h=0;for(s?u=l.replace(i.media,""):n&&"all"!=t.media?o=1:u=l,this.sheets[t.key]={element:t.element,key:t.key,tagName:t.tagName,href:t.href,id:t.id,all:u,queries:[]},c=0;c<o;c++)for(n?(r=t.media,l=this.convertURLs(l,t.href)):(r=s[c].match(i.findStyles)&&RegExp.$1,l=RegExp.$2&&this.convertURLs(RegExp.$2,t.href)),a=r.split(","),h=0;h<a.length;h++)r=a[h],d=r.split("(")[0].match(i.only)&&RegExp.$2,"print"!=d&&(r.replace(i.minmaxwh,"").match(i.other)||this.sheets[t.key].queries.push({minw:r.match(i.minw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:r.match(i.maxw)&&parseFloat(RegExp.$1)+(RegExp.$2||""),styles:l}))},applyStyles:function(){var t=e("head"),i=null,l=null,s=null,o=null,n=null,r=null,a=null,d=null,u=!1;this.clearStyles();for(o in this.sheets)if(i="",l=e("<style></style>"),s=this.sheets[o],s.queries.length&&this.width){for(i+=s.all,r=0;r<s.queries.length;r++)n=s.queries[r],a=n.minw,d=n.maxw,u=!1,a&&(a=parseFloat(a)*(a.indexOf("em")>-1?this.getEmPxValue():1),this.width>=a&&(i+=n.styles,u=!0)),d&&!u&&(d=parseFloat(d)*(d.indexOf("em")>-1?this.getEmPxValue():1),this.width<=d&&(i+=n.styles));this.styles.push(l),t.append(l),l.html(i),s.element.remove()}},clearStyles:function(){var t=e("head"),i=null,l=this.styles.slice(0);this.styles=[];for(i in this.sheets)this.sheets[i].element.parent().length||t.append(this.sheets[i].element);setTimeout(function(){for(var e=0;e<l.length;e++)l[e].empty(),l[e].remove()},50)},cleanStyles:function(e){var t=this.regex;return e.replace(t.comments,"").replace(t.keyframes,"").replace(t.empty,"")},convertURLs:function(e,t){return t?(t=t.substring(0,t.lastIndexOf("/")),t.length&&(t+="/"),e.replace(this.regex.urls,"$1"+t+"$2$3")):e},getEmPxValue:function(){if(this.emPxValue)return this.emPxValue;var e=null,t=window.document,i=t.documentElement,l=t.body,s=t.createElement("div"),o=i.style.fontSize,n=l&&l.style.fontSize,r=!1;return s.style.cssText="position:absolute;font-size:1em;width:1em",l||(l=r=t.createElement("body"),l.style.background="none"),i.style.fontSize="100%",l.style.fontSize="100%",l.appendChild(s),r&&i.insertBefore(l,i.firstChild),e=parseFloat(s.offsetWidth),r?i.removeChild(l):l.removeChild(s),i.style.fontSize=o,n?l.style.fontSize=n:l.style.fontSize="",this.emPxValue=e,e}},i={_functions:null,update:function(){var e;if(!this._functions){this._functions={};for(e in l)this._functions[e]=jQuery.fn[e]}if(t.width)for(e in l)jQuery.fn[e]=l[e];else for(e in this._functions)jQuery.fn[e]=this._functions[e]}},l={width:function(l){return void 0!=l?i._functions.width.call(this,l):e.isWindow(this[0])?t.width:i._functions.width.call(this)}};FLBuilderSimulateMediaQuery={ignore:function(e){t.ignore(e)},reparse:function(e){t.reparse(e)},update:function(e,i){t.update(e,i)}}}(jQuery),function(e){FLBuilderResponsiveEditing={_mode:"default",refreshPreview:function(){var t;e(".fl-responsive-preview").length&&"default"!=this._mode&&("responsive"==this._mode?(t=FLBuilderConfig.global.responsive_breakpoint>=320?320:FLBuilderConfig.global.responsive_breakpoint,FLBuilderSimulateMediaQuery.update(t)):"medium"==this._mode&&(t=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,FLBuilderSimulateMediaQuery.update(t)),FLBuilder._resizeLayout())},_init:function(){this._bind(),this._initMediaQueries()},_bind:function(){FLBuilder.addHook("responsive-editing-switched",this._previewSpacingFields),FLBuilder.addHook("settings-form-init",this._initSettingsForms),FLBuilder.addHook("settings-lightbox-closed",this._clearPreview),e("body").delegate(".fl-field-responsive-toggle","click",this._settingToggleClicked)},_initMediaQueries:function(){FLBuilderSimulateMediaQuery.ignore([FLBuilderConfig.pluginUrl,"fl-theme-builder","/wp-includes/","/wp-admin/","admin-bar-inline-css","ace-tm","ace_editor.css"]),FLBuilderSimulateMediaQuery.reparse([FLBuilderConfig.postId+"-layout-draft.css?",FLBuilderConfig.postId+"-layout-draft-partial.css?",FLBuilderConfig.postId+"-layout-preview.css?",FLBuilderConfig.postId+"-layout-preview-partial.css?","fl-builder-global-css","fl-builder-layout-css"])},_switchTo:function(t,i){var l=e("html"),s=e("body"),o=e(FLBuilder._contentClass),n=e(".fl-responsive-preview"),r=e(".fl-responsive-preview-mask"),a=e(".fl-content-placeholder"),d=null;if(FLBuilderResponsiveEditing._mode=t,"default"==t){if(0===a.length)return;l.removeClass("fl-responsive-preview-enabled"),a.after(o),a.remove(),n.remove(),r.remove()}else 0===n.length?(l.addClass("fl-responsive-preview-enabled"),o.after('<div class="fl-content-placeholder"></div>'),s.prepend(wp.template("fl-responsive-preview")()),e(".fl-responsive-preview").addClass("fl-preview-"+t),e(".fl-responsive-preview-content").append(o)):(n.removeClass("fl-preview-responsive fl-preview-medium"),n.addClass("fl-preview-"+t));"responsive"==t?(d=FLBuilderConfig.global.responsive_breakpoint>=360?360:FLBuilderConfig.global.responsive_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):"medium"==t?(d=FLBuilderConfig.global.medium_breakpoint>=769?769:FLBuilderConfig.global.medium_breakpoint,o.width(d),FLBuilderSimulateMediaQuery.update(d,i)):(o.width(""),FLBuilderSimulateMediaQuery.update(null,i)),this._setContentBackgroundColor(),FLBuilder._resizeLayout(),FLBuilder.triggerHook("responsive-editing-switched",t)},_setContentBackgroundColor:function(){var t=e(FLBuilder._contentClass),i=e(".fl-responsive-preview"),l=e(".fl-content-placeholder"),s=l.parents(),o="#fff",n=0;if(0===i.length)t.css("background-color","");else{for(;n<s.length&&(o=s.eq(n).css("background-color"),"rgba(0, 0, 0, 0)"==o);n++);t.css("background-color",o)}},_switchToAndScroll:function(t){var i=e(".fl-builder-settings").data("node"),l=void 0===i?void 0:e(".fl-node-"+i);FLBuilderResponsiveEditing._switchTo(t,function(){void 0!==l&&l&&setTimeout(function(){var t=e(window),i=e(".fl-responsive-preview-content");!i.length||t.height()<i.height()?e("html, body").animate({scrollTop:l.offset().top-100},250):scrollTo(0,0)},250)})},_clearPreview:function(){FLBuilderResponsiveEditing._switchToAndScroll("default")},_settingToggleClicked:function(){var t=e(this),i=t.data("mode");i="default"==i?"medium":"medium"==i?"responsive":"default",FLBuilderResponsiveEditing._switchAllSettingsTo(i),t.siblings(".fl-field-responsive-setting:visible").find("input").focus()},_switchAllSettingsTo:function(t){var i="dashicons-desktop dashicons-tablet dashicons-smartphone";e(".fl-field-responsive-toggle").removeClass(i),e(".fl-field-responsive-setting").hide(),i="default"==t?"dashicons-desktop":"medium"==t?"dashicons-tablet":"dashicons-smartphone",e(".fl-field-responsive-toggle").addClass(i).data("mode",t),e(".fl-field-responsive-setting-"+t).css("display","inline-block"),FLBuilderResponsiveEditing._switchToAndScroll(t)},_initSettingsForms:function(){var e=FLBuilderResponsiveEditing;Number(FLBuilderConfig.global.responsive_enabled)&&(e._initFields("dimension","input","keyup",e._spacingFieldKeyup,["margin","padding"]),e._initFields("dimension","input","keyup",e._textFieldKeyup),e._initFields("unit","input","keyup",e._textFieldKeyup)),e._switchAllSettingsTo(e._mode)},_initFields:function(t,i,l,s,o){for(var n=e(".fl-builder-settings"),r=n.find(".fl-field").has(".fl-field-responsive-setting"),a=null,d=null,u=0;u<r.length;u++)a=r.eq(u),d=a.attr("id").replace("fl-field-",""),"object"==typeof o&&e.inArray(d,o)<0||t==a.attr("data-type")&&void 0===a.attr("data-responsive-init")&&(a.find(".fl-field-responsive-setting-default "+i).on(l,s),a.find(".fl-field-responsive-setting-medium "+i).on(l,s),a.find(".fl-field-responsive-setting-responsive "+i).on(l,s),a.find(".fl-field-responsive-setting-default "+i).trigger(l),a.attr("data-responsive-init",1))},_getFields:function(t,i){var l=e(t).closest(".fl-field");return{"default":l.find(".fl-field-responsive-setting-default "+i),medium:l.find(".fl-field-responsive-setting-medium "+i),responsive:l.find(".fl-field-responsive-setting-responsive "+i)}},_textFieldKeyup:function(){var e=FLBuilderResponsiveEditing._getFields(this,"input");e["default"].each(function(t){var i=e["default"].eq(t).attr("placeholder"),l=e["default"].eq(t).val(),s=e.medium.eq(t).val();""==l?e.medium.eq(t).attr("placeholder",void 0===i?"":i):e.medium.eq(t).attr("placeholder",l),""==s?e.responsive.eq(t).attr("placeholder",e.medium.eq(t).attr("placeholder")):e.responsive.eq(t).attr("placeholder",s)})},_spacingFieldKeyup:function(){var t=e(".fl-builder-settings"),i="row",l=e(this).closest(".fl-field").attr("id").replace("fl-field-",""),s=FLBuilderResponsiveEditing._getFields(this,"input"),o=FLBuilderConfig.global,n=null,r=null,a=null,d=null;t.hasClass("fl-builder-row-settings")?i="row":t.hasClass("fl-builder-col-settings")?i="col":t.hasClass("fl-builder-module-settings")&&(i="module"),e.extend(o,{col_margins:0,col_margins_medium:"",col_margins_responsive:"",col_padding:0,col_padding_medium:"",col_padding_responsive:""}),n=i+"_"+l+("margin"===l?"s":""),r=o[n],a=o[n+"_medium"],d=o[n+"_responsive"],s["default"].each(function(e){var t=s["default"].eq(e).attr("name").split("_").pop(),n=s["default"].eq(e).val(),u=s.medium.eq(e).val(),c=(s.responsive.eq(e).val(),null),h=null;""===a&&(""!==n?s.medium.eq(e).attr("placeholder",n):""!==r&&s.medium.eq(e).attr("placeholder",r)),""===d&&("module"===i&&Number(o.auto_spacing)?(c=""===a?Number(r):a,h=""===u?Number(n):u,""!==h&&(h>c||h<0)?s.responsive.eq(e).attr("placeholder",c):""!==h?s.responsive.eq(e).attr("placeholder",h):s.responsive.eq(e).attr("placeholder",c)):(!Number(o.auto_spacing)||"padding"===l&&"top|bottom".indexOf(t)>-1)&&(""!==u?s.responsive.eq(e).attr("placeholder",u):""!==a?s.responsive.eq(e).attr("placeholder",a):""!==n?s.responsive.eq(e).attr("placeholder",n):""!==r&&s.responsive.eq(e).attr("placeholder",r)))})},_previewSpacingFields:function(){var t=FLBuilderResponsiveEditing._mode,i=e(".fl-builder-settings");0!==i.length&&void 0!==i.attr("data-node")&&i.find(".fl-field").has(".fl-field-responsive-setting").each(function(){var e=FLBuilderResponsiveEditing._getFields(this,"input"),i=e.responsive.closest(".fl-field").data("preview");"refresh"!=i.type&&e[t].trigger("keyup")})}},e(function(){FLBuilderResponsiveEditing._init()})}(jQuery),function(e){FLBuilderResponsivePreview={enter:function(){this.render()},exit:function(){this.destroy()},switchTo:function(t){var i=FLBuilderConfig.global,l=e("#fl-builder-preview-frame"),s="100%";
7
+ "responsive"==t?(s=i.responsive_breakpoint>=360?360:i.responsive_breakpoint,l.width(s)):"medium"==t&&(s=i.medium_breakpoint>=769?769:i.medium_breakpoint,l.width(s)),l.width(s)},render:function(){var t=e("body"),i=FLBuilderConfig.previewUrl,l=e("#fl-builder-preview-mask, #fl-builder-preview-frame"),s=e('<div id="fl-builder-preview-mask"></div>'),o=e('<iframe id="fl-builder-preview-frame" src="'+i+'" frameborder="0"></iframe>');l.remove(),t.append(s),t.append(o)},destroy:function(){e("#fl-builder-preview-mask, #fl-builder-preview-frame").remove()}}}(jQuery),function(e){var t={init:function(){var t=e("body");t.delegate(".fl-builder-service-select","change",this._serviceChange),t.delegate(".fl-builder-service-connect-button","click",this._connectClicked),t.delegate(".fl-builder-service-account-select","change",this._accountChange),t.delegate(".fl-builder-service-account-delete","click",this._accountDeleteClicked),t.delegate(".fl-builder-campaign-monitor-client-select","change",this._campaignMonitorClientChange),t.delegate(".fl-builder-mailchimp-list-select","change",this._mailChimpListChange),t.delegate(".fl-builder-activecampaign-list_type-select","change",this._activeCampaignChange)},_startSettingsLoading:function(t){var i=e(".fl-builder-settings"),l=t.closest(".fl-builder-service-settings"),s=e(".fl-builder-service-error");i.append('<div class="fl-builder-loading"></div>'),l.addClass("fl-builder-service-settings-loading"),s.remove()},_finishSettingsLoading:function(){var t=e(".fl-builder-settings"),i=e(".fl-builder-service-settings-loading");t.find(".fl-builder-loading").remove(),i.removeClass("fl-builder-service-settings-loading")},_serviceChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this),s=l.closest("tr"),o=l.val();s.siblings("tr.fl-builder-service-account-row").remove(),s.siblings("tr.fl-builder-service-connect-row").remove(),s.siblings("tr.fl-builder-service-field-row").remove(),e(".fl-builder-service-error").remove(),""!==o&&(t._startSettingsLoading(l),FLBuilder.ajax({action:"render_service_settings",node_id:i,service:o},t._serviceChangeComplete))},_serviceChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row");o.after(l.html),t._addAccountDelete(s),t._finishSettingsLoading()},_connectClicked:function(){for(var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-connect-row"),n=l.find(".fl-builder-service-connect-input"),r=null,a=null,d=0,u={action:"connect_service",node_id:i,service:s.val(),fields:{}};d<n.length;d++)r=n.eq(d),a=r.attr("name"),u.fields[a]=r.val();o.hide(),t._startSettingsLoading(s),FLBuilder.ajax(u,t._connectComplete)},_connectComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-select-row"),n=s.find(".fl-builder-service-select"),r=s.find(".fl-builder-service-account-row"),a=s.find(".fl-builder-service-account-select"),d=s.find(".fl-builder-service-connect-row");l.error?(d.show(),0===a.length?n.after('<div class="fl-builder-service-error">'+l.error+"</div>"):a.after('<div class="fl-builder-service-error">'+l.error+"</div>")):(d.remove(),r.remove(),o.after(l.html)),t._addAccountDelete(s),t._finishSettingsLoading()},_accountChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-connect-row"),r=l.find("tr.fl-builder-service-field-row"),a=e(".fl-builder-service-error"),d=o.val(),u=null;n.remove(),r.remove(),a.remove(),"add_new_account"==d?u={action:"render_service_settings",node_id:i,service:s.val(),add_new:!0}:""!==d&&(u={action:"render_service_fields",node_id:i,service:s.val(),account:d}),u&&(t._startSettingsLoading(s),FLBuilder.ajax(u,t._accountChangeComplete)),t._addAccountDelete(l)},_accountChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-account-row");o.after(l.html),t._finishSettingsLoading()},_addAccountDelete:function(e){var t=e.find(".fl-builder-service-account-select");t.length>0&&(e.find(".fl-builder-service-account-delete").remove(),""!==t.val()&&"add_new_account"!=t.val()&&t.after('<a href="javascript:void(0);" class="fl-builder-service-account-delete">'+FLBuilderStrings.deleteAccount+"</a>"))},_accountDeleteClicked:function(){var i=e(this).closest(".fl-builder-service-settings"),l=i.find(".fl-builder-service-select"),s=i.find(".fl-builder-service-account-select");confirm(FLBuilderStrings.deleteAccountWarning)&&(FLBuilder.ajax({action:"delete_service_account",service:l.val(),account:s.val()},t._accountDeleteComplete),t._startSettingsLoading(s))},_accountDeleteComplete:function(){var i=e(".fl-builder-service-settings-loading"),l=i.find(".fl-builder-service-select");t._finishSettingsLoading(),l.trigger("change")},_campaignMonitorClientChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=e(this),r=l.find(".fl-builder-service-list-select"),a=n.val();0!==r.length&&r.closest("tr").remove(),""!==a&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),client:a},t._campaignMonitorClientChangeComplete))},_campaignMonitorClientChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-campaign-monitor-client-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_mailChimpListChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");e(".fl-builder-mailchimp-group-select").closest("tr").remove(),""!==n.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_id:n.val()},t._mailChimpListChangeComplete))},_mailChimpListChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-list-select");o.closest("tr").after(l.html),t._finishSettingsLoading()},_activeCampaignChange:function(){var i=e(".fl-builder-settings").data("node"),l=e(this).closest(".fl-builder-service-settings"),s=l.find(".fl-builder-service-select"),o=l.find(".fl-builder-service-account-select"),n=l.find(".fl-builder-service-list-select");list_type=l.find('select[name="list_type"]'),0!==n.length&&n.closest("tr").remove(),""!==list_type.val()&&(t._startSettingsLoading(s),FLBuilder.ajax({action:"render_service_fields",node_id:i,service:s.val(),account:o.val(),list_type:list_type.val()},t._activeCampaignTypeChangeComplete))},_activeCampaignTypeChangeComplete:function(i){var l=JSON.parse(i),s=e(".fl-builder-service-settings-loading"),o=s.find(".fl-builder-service-field-row");o.after(l.html),t._finishSettingsLoading()}};e(function(){t.init()})}(jQuery),function(e){FLBuilderTour={_tour:null,start:function(){FLBuilderTour._tour?FLBuilderTour._tour.restart():(FLBuilderTour._tour=new Tour(FLBuilderTour._config()),FLBuilderTour._tour.init()),FLBuilder._triggerSettingsSave(!1,!0)&&FLBuilderTour._tour.start()},_config:function(){var t={storage:!1,onStart:FLBuilderTour._onStart,onPrev:FLBuilderTour._onPrev,onNext:FLBuilderTour._onNext,onEnd:FLBuilderTour._onEnd,template:'<div class="popover" role="tooltip"> <i class="fa fa-times" data-role="end"></i> <div class="arrow"></div> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="next">'+FLBuilderStrings.tourNext+"</button> </div> </div>",steps:[{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourTemplatesTitle,content:FLBuilderStrings.tourTemplates,onShow:function(){FLBuilder.ContentPanel.show("templates")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddRowsTitle,content:FLBuilderStrings.tourAddRows,onShow:function(){FLBuilder.ContentPanel.show("rows")}},{animation:!1,element:".fl-builder--content-library-panel",placement:"left",title:FLBuilderStrings.tourAddContentTitle,content:FLBuilderStrings.tourAddContent,onShow:function(){FLBuilder.ContentPanel.show("modules")}},{animation:!1,element:".fl-row:first-of-type",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-row:first-of-type .fl-module-overlay .fl-block-overlay-actions",placement:"top",title:FLBuilderStrings.tourEditContentTitle,content:FLBuilderStrings.tourEditContent2,onShow:function(){FLBuilderTour._dimSection(".fl-builder-bar"),FLBuilder._closePanel(),e(".fl-row").eq(0).trigger("mouseenter"),e(".fl-module").eq(0).trigger("mouseenter")}},{animation:!1,element:".fl-builder-content-panel-button",placement:"bottom",title:FLBuilderStrings.tourAddContentButtonTitle,content:FLBuilderStrings.tourAddContentButton,onShow:function(){FLBuilderTour._dimSection("body"),e(".fl-row").eq(0).trigger("mouseleave"),e(".fl-module").eq(0).trigger("mouseleave")}},{animation:!1,element:".fl-builder-templates-button",placement:"bottom",title:FLBuilderStrings.tourTemplatesButtonTitle,content:FLBuilderStrings.tourTemplatesButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-tools-button",placement:"bottom",title:FLBuilderStrings.tourToolsButtonTitle,content:FLBuilderStrings.tourToolsButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,element:".fl-builder-done-button",placement:"bottom",title:FLBuilderStrings.tourDoneButtonTitle,content:FLBuilderStrings.tourDoneButton,onShow:function(){FLBuilderTour._dimSection("body")}},{animation:!1,orphan:!0,backdrop:!0,title:FLBuilderStrings.tourFinishedTitle,content:FLBuilderStrings.tourFinished,template:'<div class="popover" role="tooltip"> <div class="arrow"></div> <i class="fa fa-times" data-role="end"></i> <h3 class="popover-title"></h3> <div class="popover-content"></div> <div class="popover-navigation clearfix"> <button class="fl-builder-button fl-builder-button-primary fl-builder-tour-next" data-role="end">'+FLBuilderStrings.tourEnd+"</button> </div> </div>"}]};return FLBuilderConfig.lite?t.steps.shift():"disabled"==FLBuilderConfig.enabledTemplates?t.steps.shift():"fl-builder-template"==FLBuilderConfig.postType&&t.steps.shift(),t},_onStart:function(){var t=e("body");t.scrollTop(0),t.append('<div class="fl-builder-tour-mask"></div>'),0===e(".fl-row").length&&"module"!=FLBuilderConfig.userTemplateType&&(e(".fl-builder-content").append('<div class="fl-builder-tour-demo-content fl-row fl-row-fixed-width fl-row-bg-none"> <div class="fl-row-content-wrap"> <div class="fl-row-content fl-row-fixed-width fl-node-content"> <div class="fl-col-group"> <div class="fl-col" style="width:100%"> <div class="fl-col-content fl-node-content"> <div class="fl-module fl-module-rich-text" data-type="rich-text" data-name="Text Editor"> <div class="fl-module-content fl-node-content"> <div class="fl-rich-text"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pellentesque ut lorem non cursus. Sed mauris nunc, porttitor iaculis lorem a, sollicitudin lacinia sapien. Proin euismod orci lacus, et sollicitudin leo posuere ac. In hac habitasse platea dictumst. Maecenas elit magna, consequat in turpis suscipit, ultrices rhoncus arcu. Phasellus finibus sapien nec elit tempus venenatis. Maecenas tincidunt sapien non libero maximus, in aliquam felis tincidunt. Mauris mollis ultricies facilisis. Duis condimentum dignissim tortor sit amet facilisis. Aenean gravida lacus eu risus molestie egestas. Donec ut dolor dictum, fringilla metus malesuada, viverra nunc. Maecenas ut purus ac justo aliquet lacinia. Cras vestibulum elementum tincidunt. Maecenas mattis tortor neque, consectetur dignissim neque tempor nec.</p></div> </div> </div> </div> </div> </div> </div> </div> </div>'),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols())},_onPrev:function(){e(".fl-builder-tour-dimmed").remove()},_onNext:function(){e(".fl-builder-tour-dimmed").remove()},_onEnd:function(){e("body").off("fl-builder.template-selector-loaded"),e(".fl-builder-tour-mask").remove(),e(".fl-builder-tour-dimmed").remove(),e(".fl-builder-tour-demo-content").remove(),FLBuilder._setupEmptyLayout(),FLBuilder._highlightEmptyCols(),FLBuilder._showPanel(),FLBuilder._initTemplateSelector()},_dimSection:function(t){e(t).find(".fl-builder-tour-dimmed").remove(),e(t).append('<div class="fl-builder-tour-dimmed"></div>')}}}(jQuery),function(e,t){String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),e.fn.textWidth=function(t,i){return e.fn.textWidth.fakeEl||(e.fn.textWidth.fakeEl=e("<span>").hide().appendTo(document.body)),e.fn.textWidth.fakeEl.text(t||this.val()||this.text()).css("font",i||this.css("font")),e.fn.textWidth.fakeEl.width()},FLExtendableObject={create:function(t){var i=Object.create(this);return i=e.extend(i,t),e(this).trigger("onCreate"),i}},e.fn.switchClass=function(t,i){return this.each(function(){return e(this).removeClass(function(e,i){var l=[],s=i.split(" ");for(var e in s)s[e].startsWith(t)&&l.push(s[e]);return l.join(" ")}),e(this).addClass(t+i)})};var i={init:function(){t.addHook("cancelTask",this.onCancelTask.bind(this)),t.addHook("showSavedMessage",this.onSaveShortcut.bind(this)),t.addHook("goToNextTab",this.onNextPrevTabShortcut.bind(this,"next")),t.addHook("goToPrevTab",this.onNextPrevTabShortcut.bind(this,"prev")),t.addHook("endEditingSession",this.onEndEditingSession.bind(this)),t.addHook("restartEditingSession",this.onRestartEditingSession.bind(this)),this.setDefaultKeyboardShortcuts()},addShortcut:function(t,i,l){var s=e.proxy(this,"onTriggerKey",t);l?Mousetrap.bindGlobal(i,s):Mousetrap.bind(i,s)},reset:function(){Mousetrap.reset()},setDefaultKeyboardShortcuts:function(){this.reset();for(var e in FLBuilderConfig.keyboardShortcuts){var t=FLBuilderConfig.keyboardShortcuts[e].keyCode,i=FLBuilderConfig.keyboardShortcuts[e].isGlobal;this.addShortcut(e,t,i)}},onTriggerKey:function(e,i){t.triggerHook(e),i.preventDefault?i.preventDefault():i.returnValue=!1},onCancelTask:function(){return o.isPreviewing?void o.endPreview():s.isShowing?void s.hide():t.ContentPanel.isShowing?void t.ContentPanel.hide():void 0},pause:function(){Mousetrap.pause()},unpause:function(){Mousetrap.unpause()},onEndEditingSession:function(){this.reset(),this.addShortcut("restartEditingSession","mod+e")},onRestartEditingSession:function(){this.reset(),this.setDefaultKeyboardShortcuts()},onSaveShortcut:function(){if(t.SaveManager.layoutNeedsPublish()){var e=FLBuilderStrings.savedStatus.hasAlreadySaved;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}else{var e=FLBuilderStrings.savedStatus.nothingToSave;t.SaveManager.showStatusMessage(e),setTimeout(function(){t.SaveManager.resetStatusMessage()},2e3)}},onNextPrevTabShortcut:function(i,l){var s,o,n=e(".fl-lightbox:visible"),r=n.find(".fl-builder-settings-tabs a");n.length>0&&(s=r.filter("a.fl-active"),o="next"==i?s.is(r.last())?r.first():s.next("a"):s.is(r.first())?r.last():s.prev("a"),o.trigger("click")),t._calculateSettingsTabsOverflow(),l.preventDefault()}},l={isShowing:!1,init:function(){this.render(),t.addHook("showKeyboardShortcuts",this.show.bind(this))},render:function(){var t=wp.template("fl-keyboard-shortcuts"),i=FLBuilderConfig.keyboardShortcuts;this.$el=e(t(i)),e("body").append(this.$el),this.$el.find(".dismiss-shortcut-ui").on("click",this.hide.bind(this)),this.$el.on("click",this.hide.bind(this))},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.isShowing=!0)},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.isShowing=!1)},toggle:function(){this.isShowing?this.hide():this.show()}},s=FLExtendableObject.create({isShowing:!1,init:function(){this.$el=e(".fl-builder-publish-actions"),this.$defaultBarButtons=e(".fl-builder-bar-actions"),this.$clickAwayMask=e(".fl-builder-publish-actions-click-away-mask"),this.$doneBtn=this.$defaultBarButtons.find(".fl-builder-done-button"),this.$doneBtn.on("click",this.onDoneTriggered.bind(this)),this.$actions=this.$el.find(".fl-builder-button"),this.$actions.on("click",this.onActionClicked.bind(this)),t.addHook("triggerDone",this.onDoneTriggered.bind(this));var i=this.hide.bind(this);t.addHook("cancelPublishActions",i),t.addHook("endEditingSession",i),this.$clickAwayMask.on("click",i)},onDoneTriggered:function(){t.SaveManager.layoutNeedsPublish()?this.show():FLBuilderConfig.shouldRefreshOnPublish?t._exit():t._exitWithoutRefresh()},show:function(){this.isShowing||t._triggerSettingsSave(!1,!0)&&(this.$el.removeClass("is-hidden"),this.$defaultBarButtons.css("opacity","0"),this.$clickAwayMask.show(),this.isShowing=!0,t.triggerHook("didShowPublishActions"))},hide:function(){this.isShowing&&(this.$el.addClass("is-hidden"),this.$defaultBarButtons.css("opacity","1"),this.$clickAwayMask.hide(),this.isShowing=!1)},onActionClicked:function(i){var l=e(i.currentTarget).data("action");switch(l){case"dismiss":this.hide();break;case"discard":this.hide(),o.muteToolbar(),t._discardButtonClicked();break;case"publish":this.hide(),o.muteToolbar(),t._publishButtonClicked(),t._destroyOverlayEvents();break;case"draft":this.hide(),o.muteToolbar(),t._draftButtonClicked();break;default:this.hide(),o.muteToolbar(),t._draftButtonClicked()}t.triggerHook(l+"ButtonClicked")}}),o={isPreviewing:!1,init:function(){this.$el=e("body"),this.$mainToolbar=e(".fl-builder-bar"),this.$mainToolbarContent=this.$mainToolbar.find(".fl-builder-bar-content"),this.$wpAdminBar=e("#wpadminbar"),this.$endPreviewBtn=e(".fl-builder--preview-actions .end-preview-btn"),t.addHook("endEditingSession",this.endEditingSession.bind(this)),t.addHook("previewLayout",this.togglePreview.bind(this)),this.$endPreviewBtn.on("click",this.endPreview.bind(this)),this.$deviceIcons=e(".fl-builder--preview-actions i"),this.$deviceIcons.on("click",this.onDeviceIconClick.bind(this));var i=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a, #wp-admin-bar-fl-theme-builder-frontend-edit-link > a");i.on("click",this.onClickPageBuilderToolbarLink.bind(this)),e("#wpadminbar a").attr("tabindex","-1");var l=this.restartEditingSession.bind(this);t.addHook("restartEditingSession",l),t.addHook("didHideAllLightboxes",this.unmuteToolbar.bind(this)),t.addHook("didCancelDiscard",this.unmuteToolbar.bind(this)),t.addHook("didEnterRevisionPreview",this.hide.bind(this)),t.addHook("didExitRevisionPreview",this.show.bind(this)),t.addHook("didPublishLayout",this.onPublish.bind(this))},endEditingSession:function(){t._destroyOverlayEvents(),t._removeAllOverlays(),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t._unbindEvents(),e("html").removeClass("fl-builder-edit").addClass("fl-builder-show-admin-bar"),e("body").removeClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex",null),e(t._contentClass).removeClass("fl-builder-content-editing"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init()},restartEditingSession:function(i){t._initTemplateSelector(),t._bindOverlayEvents(),t._highlightEmptyCols(),e("html").addClass("fl-builder-edit").removeClass("fl-builder-show-admin-bar"),e("body").addClass("fl-builder-edit"),e("#wpadminbar a").attr("tabindex","-1"),e(t._contentClass).addClass("fl-builder-content-editing"),this.showMainToolbar(),i.preventDefault()},onClickPageBuilderToolbarLink:function(e){t.triggerHook("restartEditingSession"),e.preventDefault()},onPublish:function(){var e=this.$wpAdminBar.find("#wp-admin-bar-fl-builder-frontend-edit-link > a span");e.css("color","#6bc373")},hide:function(){e("html").hasClass("fl-builder-edit")&&(t._unbindEvents(),t._destroyOverlayEvents(),t._removeAllOverlays(),e("html").removeClass("fl-builder-edit"),e("body").removeClass("admin-bar"),this.hideMainToolbar(),t.ContentPanel.hide(),FLBuilderLayout.init(),t.triggerHook("didHideEditingUI"))},show:function(){e("html").hasClass("fl-builder-edit")||(t._bindOverlayEvents(),this.showMainToolbar(),FLBuilderResponsiveEditing._switchTo("default"),e("html").addClass("fl-builder-edit"),e("body").addClass("admin-bar"),t.triggerHook("didShowEditingUI"))},beginPreview:function(){t._triggerSettingsSave(!1,!0)&&(this.isPreviewing=!0,this.hide(),e("html").addClass("fl-builder-preview"),e("html, body").removeClass("fl-builder-edit"),t._removeEmptyColHighlights(),t._removeColHighlightGuides(),t.triggerHook("didBeginPreview"),FLBuilderResponsivePreview.enter())},endPreview:function(){this.isPreviewing=!1,this.show(),t._highlightEmptyCols(),FLBuilderResponsivePreview.exit(),e("html").removeClass("fl-builder-preview"),e("html, body").addClass("fl-builder-edit")},togglePreview:function(){this.isPreviewing?this.endPreview():this.beginPreview()},hideMainToolbar:function(){this.$mainToolbar.addClass("is-hidden"),e("html").removeClass("fl-builder-is-showing-toolbar")},showMainToolbar:function(){this.unmuteToolbar(),this.$mainToolbar.removeClass("is-hidden"),e("html").addClass("fl-builder-is-showing-toolbar")},onDeviceIconClick:function(t){var i=e(t.target).data("mode");FLBuilderResponsivePreview.switchTo(i)},muteToolbar:function(){this.$mainToolbarContent.addClass("is-muted"),t._hideTipTips()},unmuteToolbar:function(){this.$mainToolbarContent.removeClass("is-muted")}},n={isEditing:!0,init:function(){history.pushState&&(t.addHook("endEditingSession",this.onLeaveBuilder.bind(this)),t.addHook("restartEditingSession",this.onEnterBuilder.bind(this)))},onEnterBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.editUrl),this.isEditing=!0},onLeaveBuilder:function(){history.replaceState({},document.title,FLBuilderConfig.url),this.isEditing=!1}},r={$row:null,$rowContent:null,row:null,drag:{},init:function(){if(this.userCanResize()){var i=e(t._contentClass);i.delegate(".fl-block-row-resize","mouseenter",this.onDragHandleHover.bind(this)),i.delegate(".fl-block-row-resize","mousedown",this.onDragHandleDown.bind(this))}},userCanResize:function(){return FLBuilderConfig.rowResize.userCanResizeRows},onDragHandleHover:function(t){if(!this.drag.isDragging){var i=e(t.target);this.$row=i.closest(".fl-row"),this.$rowContent=this.$row.find(".fl-row-content"),this.row={node:this.$row.data("node"),isFixedWidth:this.$row.hasClass("fl-row-fixed-width"),settings:e(".fl-builder-row-settings[data-node="+this.$row.data("node")+"]")},this.drag={edge:null,isDragging:!1,originalPosition:null,originalWidth:null,calculatedWidth:null,operation:null},this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),this.dragInit()}},onDragHandleDown:function(){e("body").addClass("fl-builder-row-resizing")},dragInit:function(e){this.$row.find(".fl-block-row-resize").draggable({axis:"x",start:this.dragStart.bind(this),drag:this.dragging.bind(this),stop:this.dragStop.bind(this)})},dragStart:function(i,l){var s=e("body"),o=e(l.helper);this.drag.isDragging=!0,this.row.isFixedWidth?this.drag.originalWidth=this.$row.width():this.drag.originalWidth=this.$rowContent.width(),o.hasClass("fl-block-col-resize-e")&&(this.drag.edge="e",this.$feedback=o.find(".fl-block-col-resize-feedback-left")),o.hasClass("fl-block-col-resize-w")&&(this.drag.edge="w",this.$feedback=o.find(".fl-block-col-resize-feedback-right")),s.addClass("fl-builder-row-resizing"),t._colResizing=!0,t._destroyOverlayEvents(),t._closePanel()},dragging:function(e,t){var i=t.position.left,l=t.originalPosition.left,s=this.drag.originalWidth,o=0,n=this.drag.edge,r=FLBuilderConfig.rowResize.minAllowedWidth,a=FLBuilderConfig.rowResize.maxAllowedWidth;l!==i&&(FLBuilderConfig.isRtl&&(n="w"==n?"e":"w"),l>i?"w"===n?this.drag.operation="+":this.drag.operation="-":"e"===n?this.drag.operation="+":this.drag.operation="-",o=Math.abs(l-i),"+"===this.drag.operation?this.drag.calculatedWidth=s+2*o:this.drag.calculatedWidth=s-2*o,!1!==r&&this.drag.calculatedWidth<r&&(this.drag.calculatedWidth=r),!1!==a&&this.drag.calculatedWidth>a&&(this.drag.calculatedWidth=a),this.row.isFixedWidth&&this.$row.css("max-width",this.drag.calculatedWidth+"px"),this.$rowContent.css("max-width",this.drag.calculatedWidth+"px"),_.isUndefined(this.$feedback)||this.$feedback.html(this.drag.calculatedWidth+"px").show(),this.row.settings.length&&this.row.settings.find("[name=max_content_width]").val(this.drag.calculatedWidth))},dragStop:function(i,l){this.drag.isDragging=!1,_.isUndefined(this.$feedback)||this.$feedback.hide();var s={action:"resize_row_content",node:this.row.node,width:this.drag.calculatedWidth},o=e("body");t.ajax(s),t._bindOverlayEvents(),o.removeClass("fl-builder-row-resizing"),e(".fl-block-overlay").each(function(){t._buildOverlayOverflowMenu(e(this))}),e("body").removeClass("fl-builder-row-resizing"),setTimeout(function(){t._colResizing=!1},50),t.triggerHook("didResizeRow",{rowId:this.row.node,rowWidth:this.drag.calculatedWidth})}},a={templateName:"fl-toolbar",init:function(){this.template=wp.template(this.templateName),this.render(),this.initTipTips();var e=this.$el.find(".fl-builder-content-panel-button");e.on("click",t._togglePanel),this.$el.find(".fl-builder-buy-button").on("click",t._upgradeClicked),this.$el.find(".fl-builder-upgrade-button").on("click",t._upgradeClicked)},render:function(t){var i=e(this.template(t));this.$el=i,this.el=i.get(0),o.$mainToolbar=this.$el,e("body").prepend(i),e("html").addClass("fl-builder-is-showing-toolbar")},initTipTips:function(){e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}),e(".fl-builder-publish-actions .fl-builder-button-group .fl-builder-button").tipTip({defaultPosition:"bottom",edgeOffset:6})}};e(function(){t.ContentPanel.init(),FLBuilderConfig.simpleUi||t.MainMenu.init(),FLBuilderConfig.showToolbar?(a.init(),t.ContentPanel.alignPanelArrow()):e("html").addClass("fl-builder-no-toolbar"),i.init(),l.init(),o.init(),n.init(),r.init(),s.init(),t.triggerHook("didInitUI")})}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({templateName:"fl-main-menu-panel-view",name:"Untitled View",isShowing:!1,isRootView:!1,items:{},init:function(){this.template=wp.template(this.templateName)},render:function(){return this.template(this)},bindEvents:function(){this.$items=this.$el.find(".fl-builder--menu-item")},show:function(){this.$el.addClass("is-showing")},hide:function(){this.$el.removeClass("is-showing")},transitionIn:function(e){requestAnimationFrame(this.show.bind(this))},transitionOut:function(e){this.hide()}}),l=FLExtendableObject.create({templateName:"fl-main-menu-panel",template:null,menu:null,views:{},viewNavigationStack:[],isShowing:!1,shouldShowTabs:!1,init:function(){this.template=wp.template(this.templateName),e("body").prepend(this.template(this)),this.$el=e(".fl-builder--main-menu-panel"),this.$el.find(".fl-builder--main-menu-panel-views").html("");for(var i in FLBuilderConfig.mainMenu){this.renderPanel(i);var l="render"+i.charAt(0).toUpperCase()+i.slice(1)+"Panel";t.addHook(l,e.proxy(function(){this.renderPanel(i)},this))}e("body").on("click",".fl-builder--main-menu-panel .pop-view",this.goToPreviousView.bind(this)),this.$tabs=this.$el.find(".fl-builder--tabs > span"),this.$tabs.on("click",this.onItemClick.bind(this)),this.$barTitle=e(".fl-builder-bar-title"),e("body").on("click",".fl-builder-bar-title",this.toggle.bind(this));var n=this.hide.bind(this);t.addHook("didShowPublishActions",n),t.addHook("didBeginSearch",n),t.addHook("didBeginPreview",n),t.addHook("didShowContentPanel",n),t.addHook("endEditingSession",n),t.addHook("didFocusSearchBox",n),t.addHook("didEnterRevisionPreview",n),t.addHook("didFailSettingsSave",n),t.addHook("showKeyboardShortcuts",n),this.$mask=e(".fl-builder--main-menu-panel-mask"),this.$mask.on("click",n),s.init(),o.init()},renderPanel:function(t){var l,s,o;e('fl-builder--main-menu-panel-view[data-name="'+t+'"]').remove(),l=FLBuilderConfig.mainMenu[t],l.handle=t,s=i.create(l),s.init(),o=e(s.render()),s.$el=o,e(".fl-builder--main-menu-panel-views").append(o),s.bindEvents(),s.$el.find(".fl-builder--menu-item").on("click",this.onItemClick.bind(this)),s.isRootView&&(this.rootView=s,this.currentView=s),this.views[t]=s},show:function(){this.isShowing||(this.$el.addClass("is-showing"),this.$barTitle.addClass("is-showing-menu"),this.currentView.transitionIn(),this.isShowing=!0,this.$mask.show(),t.triggerHook("didOpenMainMenu"))},hide:function(){this.isShowing&&(this.$el.removeClass("is-showing"),this.$barTitle.removeClass("is-showing-menu"),this.isShowing=!1,this.resetViews(),this.$mask.hide())},toggle:function(){this.isShowing?this.hide():this.show()},onItemClick:function(i){var l=e(i.currentTarget),s=l.data("type");switch(s){case"view":var o=l.data("view");this.goToView(o);break;case"event":var n=l.data("event");t.triggerHook(n,l);break;case"link":}},goToView:function(e){var t=this.currentView,i=this.views[e];t.transitionOut(),i.transitionIn(),this.currentView=i,this.viewNavigationStack.push(t)},goToPreviousView:function(){var t=this.currentView,i=this.viewNavigationStack.pop();t.transitionOut(!0),i.transitionIn(!0),this.currentView=i,e(".fl-builder-bar-title-caret").focus()},resetViews:function(){this.currentView!=this.rootView&&(this.currentView.hide(),this.rootView.show(),this.currentView=this.rootView,this.viewNavigationStack=[])}});t.MainMenu=l;var s={init:function(){t.addHook("saveTemplate",this.saveTemplate.bind(this)),t.addHook("saveCoreTemplate",this.saveCoreTemplate.bind(this)),t.addHook("duplicateLayout",this.duplicateLayout.bind(this)),t.addHook("showLayoutSettings",this.showLayoutSettings.bind(this)),t.addHook("showGlobalSettings",this.showGlobalSettings.bind(this)),t.addHook("toggleUISkin",this.toggleUISkin.bind(this)),t.addHook("clearLayoutCache",this.clearLayoutCache.bind(this))},saveTemplate:function(){t._saveUserTemplateClicked(),l.hide()},saveCoreTemplate:function(){FLBuilderCoreTemplatesAdmin._saveClicked(),l.hide()},duplicateLayout:function(){t._duplicateLayoutClicked(),l.hide()},showGlobalSettings:function(){t._globalSettingsClicked(),l.hide()},showLayoutSettings:function(){t._layoutSettingsClicked(),l.hide()},clearLayoutCache:function(){t.ajax({action:"clear_cache"},function(){location.href=FLBuilderConfig.editUrl}),t.showAjaxLoader(),l.hide()},toggleUISkin:function(i){e('a[data-event="toggleUISkin"]');if(e("body").hasClass("fl-builder-ui-skin--light"))var l="light",s="dark";if(e("body").hasClass("fl-builder-ui-skin--dark"))var l="dark",s="light";e("body").removeClass("fl-builder-ui-skin--"+l).addClass("fl-builder-ui-skin--"+s),t.ajax({action:"save_ui_skin",skin_name:s})}},o={init:function(){t.addHook("beginTour",this.onStartTourClicked.bind(this))},onStartTourClicked:function(){FLBuilderTour.start(),l.hide()}}}(jQuery,FLBuilder),function(e,t){var i=FLExtendableObject.create({handle:"",name:"",panel:null,shouldShowTabItem:!0,isShowing:!1,views:{},activeView:null,defaultView:null,categorySelector:null,init:function(i){this.categorySelector=a.create({handle:"selector-"+this.handle,tab:this,items:[]}),this.categorySelector.init(),e(this.categorySelector).on("categorySelected",this.onViewSelected.bind(this));i.views;if(this.initViews(i.views),0===Object.keys(this.views).length){var l={handle:"noViews",name:"No Views",templateName:"fl-content-panel-no-view"};this.addView(l);
8
+ }if(!this.activeView){var s=Object.keys(this.views)[0],l=this.views[s];this.activeView=l}this.defaultView=this.activeView,e(this.panel).on("afterRender",this.renderView.bind(this,this.activeView)),e(this.panel).on("onShow onShowTab",this.initScroller.bind(this)),t.addHook("contentItemsChanged",this.onLibraryDataChanged.bind(this))},initViews:function(e){for(var t in e){var i=e[t];this.categorySelector.addItem(i),"separator"!==i.type&&this.addView(i)}},addView:function(e){var t=l;switch(this.handle){case"modules":t=s;break;case"rows":t=o;break;case"templates":t=n;break;case"saved":t=r;break;default:t=l}_.isNull(this.viewController)||_.isUndefined(this.viewController)||(t=window[this.viewController]);var i=t.create(e),a=i.handle;i.init(),this.views[a]=i,i.isShowing&&(this.activeView=i)},renderView:function(e){if(this.$el=this.panel.$el.find('.fl-builder--panel-view[data-tab="'+this.handle+'"]'),_.isObject(e))var i=e;else var i=this.views[e];if(_.isObject(i)&&_.isFunction(i.render)){var l=i.render();this.$el.find(".fl-nanoscroller-content").html(l),this.activeView=i,t._initSortables(),this===this.panel.activeTab&&this.renderGroupSelector(),this.initScroller(),this.$el.find(".fl-nanoscroller-content").scrollTop(0)}},initScroller:function(){this.$el.nanoScroller({alwaysVisible:!0,preventPageScrolling:!0,paneClass:"fl-nanoscroller-pane",sliderClass:"fl-nanoscroller-slider",contentClass:"fl-nanoscroller-content"})},show:function(){e(this.activeView).trigger("onBeforeShow"),this.renderGroupSelector(),this.isShowing=!0,this.$el.addClass("is-showing"),this.$el.find(".fl-nanoscroller-content").scrollTop(0)},hide:function(){this.isShowing=!1,this.$el.removeClass("is-showing"),this.activeView!==this.defaultView&&this.renderView(this.defaultView),_.isObject(this.categorySelector)&&this.categorySelector.close()},renderGroupSelector:function(){var e=this.panel.$groupSelect,t=this.panel.$el.find(".fl-builder-panel-search");if(this.isSearchEnabled?t.show():t.hide(),Object.keys(this.views).length>1&&!_.isUndefined(this.categorySelector)){var i=this.categorySelector.render();this.panel.$el.find(".fl-builder-content-group-select");e.html(i),e.show(),this.panel.$el.removeClass("single-view")}else e.hide(),t.hide(),this.panel.$el.addClass("single-view")},onViewSelected:function(e,t){this.renderView(t),this.categorySelector.close()},onLibraryDataChanged:function(){this.renderView(this.activeView)}}),l=FLExtendableObject.create({templateName:"",name:"",handle:"",query:null,init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this).trigger("afterInit")},filterTemplateData:function(e){return _.isNull(this.query)||_.isUndefined(this.query)||(e.queryResults=t.Search.byQuery(this.query)),e},render:function(){e(this).trigger("beforeRender");var t=this;t=this.filterTemplateData(t);var i=e(this.template(t));return this.$el=i,e(this).trigger("afterRender"),i},bindEvents:function(){},transitionIn:function(){},transitionOut:function(){}}),s=l.create({templateName:"fl-content-panel-modules-view",bindEvents:function(){this.$sections=this.$el,this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),o=l.create({templateName:"fl-content-panel-row-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder-block, .fl-builder-blocks-section-title")}}),n=l.create({templateName:"fl-content-panel-templates-view",bindEvents:function(){this.$items=this.$el.find(".fl-builder--template-collection-item"),this.$items.on("click",this.onTemplateClick.bind(this)),this.$userTemplateSections=e(".fl-user-templates"),this.$userTemplates=this.$el.find(".fl-user-template, .fl-builder--save-new-user-template"),this.$saveNewTemplateInput=this.$el.find('.fl-save-control input[name="template-name"]'),this.$saveNewTemplateCat=this.$el.find('.fl-save-control input[name="template-category"]'),this.$saveNewTemplateBtn=this.$el.find(".fl-save-control button"),this.$saveNewMask=this.$el.find(".fl-save-control-mask"),this.$saveNewTemplateInput.on("focus",this.onSaveInputFocus.bind(this)),this.$saveNewTemplateInput.on("keyup",this.onSaveInputKeyup.bind(this)),this.$saveNewTemplateBtn.on("click",this.onSaveButtonClick.bind(this)),this.$saveNewMask.on("click",this.resetSaveInput.bind(this))},onSaveInputFocus:function(){this.resetSaveInput(),this.$saveNewMask.show()},resetSaveInput:function(){this.$saveNewTemplateInput.val(""),this.$saveNewTemplateBtn.hide(),this.$saveNewMask.hide()},onSaveInputKeyup:function(t){var i=e(t.currentTarget),l=i.val(),s=i.siblings("button");""!==l?s.show():s.hide()},onSaveButtonClick:function(i){var l=e(i.currentTarget),s=l.siblings('input[name="template-name"]').val(),o=l.siblings('input[name="template-category"]').val(),n={name:s,category:o};""!==s&&t.ajax({action:"save_user_template",settings:n},t._saveUserTemplateSettingsComplete)},onTemplateClick:function(i){var l=e(i.currentTarget),s=l.data("id"),o=l.data("type");t._requestTemplateInsert(s,o)}}),r=l.create({templateName:"fl-content-panel-saved-view",filterTemplateData:function(e){return e.queryResults=t.Search.byQuery({kind:"template",type:"user",content:["module","row"]}),e}}),a=FLExtendableObject.create({templateName:"fl-content-panel-category-selector",template:null,tab:null,isOpen:!1,items:{},init:function(){this.template=wp.template(this.templateName),e(this).on("afterRender",this.bindEvents.bind(this)),e(this.tab.panel).on("didShowSearchControls",this.close.bind(this))},render:function(){this.close();var t=e(this.template(this));return this.$el=t,e(this).trigger("afterRender"),t},bindEvents:function(){this.$selectorTitle=this.$el.find(".fl-builder--selector-display"),this.$selectorTitle.on("click",this.toggleOpenClose.bind(this)),this.$categories=this.$el.find(".fl-builder--selector-menu .fl-builder--menu-item"),this.$categories.on("click",this.onCategoryClick.bind(this))},addItem:function(e){var t;t=_.isUndefined(e.handle)?_.uniqueId("sep_"):e.handle,this.items[t]=e},open:function(){this.isOpen||(this.$el.addClass("is-showing"),this.isOpen=!0)},close:function(){this.isOpen&&(this.$el.removeClass("is-showing"),this.isOpen=!1,this.$selectorTitle.find("button").focus())},toggleOpenClose:function(){this.isOpen?this.close():this.open()},onCategoryClick:function(t){var i=e(t.target).data("view");e(this).trigger("categorySelected",i)}});t.ContentPanel=FLExtendableObject.create({templateName:"fl-content-panel-base",template:null,tabs:{},activeTab:null,isShowing:!1,init:function(){if(FLBuilderConfig.panelData){var e=FLBuilderConfig.panelData.tabs;for(var l in e){var s=e[l];if(n=i.create(s),n.panel=this,n.views={},n.init(s),this.tabs[l]=n,n.isShowing&&(this.activeTab=n),!this.activeTab){var o=Object.keys(this.tabs)[0],n=this.tabs[o];n.isShowing=!0,this.activeTab=n}}this.template=wp.template(this.templateName),this.render(),this.renderSearchResults=wp.template("fl-search-results-panel"),this.renderNoResults=wp.template("fl-search-no-results"),t.triggerHook("contentPanelDidInit")}},render:function(){e("body").prepend(this.template(this)),this.$el=e(".fl-builder--content-library-panel"),this.bindEvents(),this.$groupSelect=this.$el.find(".fl-builder-content-group-select"),e(this).trigger("afterRender")},bindEvents:function(){this.$tabs=this.$el.find(".fl-builder--tabs [data-tab]"),this.$tabs.on("mouseup",this.onTabItemMouseUp.bind(this)),this.$tabs.on("click",this.onTabItemClick.bind(this)),this.$search=this.$el.find(".fl-builder-panel-search"),this.$searchBtn=this.$search.find(".fl-builder-toggle-panel-search"),this.$searchInput=this.$search.find('input[name="search-term"]'),this.$searchBtn.on("click",this.onSearchButtonClicked.bind(this)),this.$search.find(".fl-builder-dismiss-panel-search").on("click",this.onDismissButtonClicked.bind(this)),this.$searchInput.on("keyup",this.onSearchTermChanged.bind(this)),this.$searchPanel=this.$el.find(".fl-builder--search-results-panel"),t.addHook("showContentPanel",this.show.bind(this)),t.addHook("showModules",this.show.bind(this,"modules")),t.addHook("showRows",this.show.bind(this,"rows")),t.addHook("showTemplates",this.show.bind(this,"templates")),t.addHook("showSaved",this.show.bind(this,"saved")),t.addHook("showSearch",this.goToSearch.bind(this));var e=this.hide.bind(this);t.addHook("hideContentPanel",e),t.addHook("didShowLightbox",e),t.addHook("didShowPublishActions",e),t.addHook("didBeginSearch",e),t.addHook("didInitDrag",e),t.addHook("didOpenMainMenu",e),t.addHook("didApplyTemplate",e);var i=this.toggleShowHide.bind(this);t.addHook("toggleContentPanel",i),t.addHook("didStopDrag",this.hideSearchControls.bind(this))},alignPanelArrow:function(){var t,i,l=this.$el,s=null,o=this.$el.find(".fl-builder--panel-arrow"),n=e(".fl-builder-content-panel-button"),r=this.$el.css("animation-duration");if(0!=n.length){this.$el.css("animation-duration","0s"),this.show(),s=l[0].getBoundingClientRect(),t=o[0].getBoundingClientRect(),this.hide(),this.$el.css("animation-duration",r),buttonOffset=n[0].getBoundingClientRect();var a=buttonOffset.x+buttonOffset.width/2;i=a<s.x?20:a-s.x-t.width/2,o.css({right:"auto",left:i+"px"})}},show:function(i){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(t.triggerHook("willShowContentPanel"),"undefined"!=typeof i&&this.showTab(i),this.isShowing||t._triggerSettingsSave(!1,!0)&&(e("body").addClass("fl-builder-content-panel-is-showing"),this.isShowing=!0,e(this).trigger("onShow"),t.triggerHook("didShowContentPanel")))},hide:function(){this.isShowing&&(this.$el.hasClass("fl-builder-ui-pinned")||(e("body").removeClass("fl-builder-content-panel-is-showing"),this.isShowing=!1,e(this).trigger("onHide"),t.triggerHook("didHideContentPanel")))},toggleShowHide:function(){this.isShowing?this.hide():this.show()},showTab:function(t){var i=this.tabs[t];_.isObject(i)&&(_.isObject(this.activeTab)&&(this.activeTab.hide(),this.$tabs.filter(".is-showing").removeClass("is-showing")),this.hideSearchControls(),i.show(),this.$tabs.filter('[data-tab="'+i.handle+'"]').addClass("is-showing"),this.activeTab=i,e(this).trigger("onShowTab"))},goToSearch:function(){this.show("modules"),this.$el.find(".fl-builder-toggle-panel-search").trigger("click")},onTabItemMouseUp:function(t){e(t.currentTarget).blur()},onTabItemClick:function(t){var i=e(t.target),l=i.data("tab");this.showTab(l)},onSearchButtonClicked:function(){this.showSearchControls()},onDismissButtonClicked:function(){this.hideSearchControls(),this.$searchBtn.focus()},showSearchControls:function(){this.$search.addClass("is-showing-input"),this.$search.find('input[name="search-term"]').focus(),e(".fl-builder--selector-display-label").attr("tabindex",-1),this.$searchBtn.attr("tabindex",-1),e(this).trigger("didShowSearchControls")},hideSearchControls:function(){this.$search.removeClass("is-showing-input"),this.clearSearchInput(),this.hideSearchResults(),e(".fl-builder--selector-display-label").attr("tabindex",null),this.$searchBtn.attr("tabindex",null)},onSearchTermChanged:function(e){var i=this.$searchInput.val();if(""!==i){var l=t.Search.byTerm(i);""!=l.term?this.showSearchResults(l):this.hideSearchResults()}else this.hideSearchResults()},clearSearchInput:function(){this.$searchInput.val(""),this.hideSearchResults()},showSearchResults:function(i){if(i.total>0){var l=e(this.renderSearchResults(i));this.$searchPanel.html(l),t._initSortables()}else{var l=e(this.renderNoResults(i));this.$searchPanel.html(l)}e("body").addClass("fl-builder-search-results-panel-is-showing")},hideSearchResults:function(){e("body").removeClass("fl-builder-search-results-panel-is-showing")}})}(jQuery,FLBuilder),function(e){FLBuilderSettingsForms={config:null,settings:null,legacyXhr:null,init:function(){this.bind()},bind:function(){FLBuilder.addHook("didDeleteRow",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteColumn",this.closeOnDeleteNode),FLBuilder.addHook("didDeleteModule",this.closeOnDeleteNode)},render:function(t,i){var l=FLBuilderSettingsConfig.forms,s=FLBuilderSettingsConfig.modules,o={type:"general",id:null,nodeId:null,className:"",attrs:"",title:"",badges:[],tabs:[],buttons:[],settings:{},legacy:null,rules:null,preview:null,helper:null};if(t.nodeId&&!t.settings)return void this.loadNodeSettings(t,i);if(t=e.extend(o,t),i=void 0===i?function(){}:i,t.id){if("general"===t.type&&void 0!==l[t.id])t=e.extend(!0,t,l[t.id]);else{if("module"!==t.type||void 0===s[t.id])return;t=e.extend(!0,t,s[t.id])}this.config=t,this.renderLightbox(t)&&(t.legacy||!this.renderLegacySettings(t,i)?this.renderComplete(t,i):this.showLightboxLoader())}},loadNodeSettings:function(e,t){FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"get_node_settings",node_id:e.nodeId},function(i){e.settings=JSON.parse(i),FLBuilderSettingsConfig.nodes[e.nodeId]=e.settings,FLBuilderSettingsForms.render(e,t),FLBuilder.hideAjaxLoader()})},renderLightbox:function(t){var i=wp.template("fl-builder-settings"),l=FLBuilder._lightbox._node.find("form.fl-builder-settings");e(".fl-lightbox-wrap[data-parent]");if(t.nodeId&&t.nodeId===l.data("node")&&!t.lightbox)return FLBuilder._focusFirstSettingsControl(),!1;if(t.lightbox)t.lightbox.setContent(i(t));else{if(!FLBuilder._triggerSettingsSave(!0,!0))return!1;FLBuilder.preview&&FLBuilder.preview.cancel(),FLBuilder._closePanel(),FLBuilder._showLightbox(),FLBuilder._setLightboxContent(i(t))}return!0},renderComplete:function(t,i){var l=e(".fl-builder-settings:visible");setTimeout(function(){t.legacy&&this.renderLegacySettingsComplete(t.legacy),i(),FLBuilder._initSettingsForms(),t.rules&&FLBuilder._initSettingsValidation(t.rules),t.preview&&(FLBuilder.preview=new FLBuilderPreview(t.preview)),t.helper&&t.helper.init(),l.closest(".fl-lightbox-wrap[data-parent]").length||(this.settings=FLBuilder._getSettings(l))}.bind(this),1)},renderFields:function(t,i){var l=wp.template("fl-builder-settings-row"),s="",o=null,n=null,r=null,a=!1,d=null,u=["dimension","unit"],i=i?i:this.config.settings,c=FLBuilderConfig.global;for(n in t)o=t[n],a=!!o.multiple,supportsResponsive=e.inArray(o.type,u)>-1,r=_.isUndefined(i[n])?"":i[n],_.isUndefined(i[n])&&o["default"]&&(r=o["default"]),d=o.responsive&&c.responsive_enabled&&!a&&supportsResponsive?o.responsive:null,s+=l({field:o,name:n,rootName:n,value:r,preview:JSON.stringify(o.preview?o.preview:{type:"refresh"}),responsive:d,rowClass:o.row_class?" "+o.row_class:"",isMultiple:a,supportsMultiple:"editor"!==o.type&&"photo"!==o.type&&"service"!==o.type,settings:i,globalSettings:c,template:e("#tmpl-fl-builder-field-"+o.type)});return s},renderField:function(e){var t=wp.template("fl-builder-field");return t(e)},renderSectionTemplate:function(e,t){var i=wp.template(e.template.id);return i({section:e,settings:t})},renderTabTemplate:function(e,t){var i=wp.template(e.template.id);return i({tab:e,settings:t})},renderLegacySettings:function(t,i){var l=e(".fl-builder-settings:visible"),s=null,o=!1,n={tabs:[],sections:[],fields:[],settings:null,node_id:null};return l.find(".fl-legacy-field").each(function(){s=e(this),n.fields.push(s.attr("data-field")),FLBuilderSettingsForms.showFieldLoader(s),o=!0}),l.find(".fl-legacy-settings-section").each(function(){s=e(this),n.sections.push({tab:s.attr("data-tab"),section:s.attr("data-section")}),o=!0}),l.find(".fl-legacy-settings-tab").each(function(){s=e(this),n.tabs.push(s.attr("data-tab")),o=!0}),l.attr("data-node")?n.node_id=l.attr("data-node"):n.settings=FLBuilder._getOriginalSettings(l,!0),this.legacyXhr&&(this.legacyXhr.abort(),this.legacyXhr=null),this.legacyXhr=FLBuilder.ajax(e.extend(this.getLegacyVars(),{action:"render_legacy_settings",data:n,form:l.attr("data-form-id"),group:l.attr("data-form-group"),lightbox:l.closest(".fl-builder-lightbox").attr("data-instance-id")}),function(e){FLBuilderSettingsForms.renderLegacySettingsComplete(e),o&&FLBuilderSettingsForms.renderComplete(t,i),FLBuilderSettingsForms.hideLightboxLoader()}),o},renderLegacySettingsComplete:function(t){var i="object"==typeof t?t:JSON.parse(t),l=null,s=null,o="",n=null,r=null,a=null;if(i.lightbox?(l=e(".fl-builder-lightbox[data-instance-id="+i.lightbox+"]"),s=l.length?l.find(".fl-builder-settings"):null):(s=e(".fl-builder-settings:visible"),l=s.closest(".fl-builder-lightbox")),s&&s.length){for(o in i.fields)n=e("#fl-field-"+o).attr("id",""),n.after(i.fields[o]).remove();for(o in i.extras)n=e("#fl-field-"+o).find(".fl-field-control-wrapper"),n.prepend(i.extras[o].before),n.append(i.extras[o].after);for(a in i.sections)for(o in i.sections[a])r=e("#fl-builder-settings-section-"+o),r.html(i.sections[a][o]);for(o in i.tabs)a=e("#fl-builder-settings-tab-"+o),a.html(i.tabs[o]);l.data("parent")||(this.settings=FLBuilder._getSettings(s),FLBuilder.preview&&(FLBuilder.preview._savedSettings=this.settings)),_.isUndefined(window.FLThemeBuilderFieldConnections)||FLThemeBuilderFieldConnections._initSettingsForms(),this.legacyXhr=null}},getLegacyVars:function(){var t=e(".fl-builder-settings:visible"),i=t.closest(".fl-builder-lightbox"),l=i.attr("data-parent"),s=null,o=null,n={};return l&&(l=e(".fl-builder-lightbox[data-instance-id="+l+"]"),t=l.find("form.fl-builder-settings"),s=FLBuilder._getSettings(t),o=t.attr("data-node"),o&&(n.node_id=o,n.node_settings=s)),n},settingsHaveChanged:function(){var e=FLBuilder._lightbox._node.find("form.fl-builder-settings"),t=FLBuilder._getSettings(e),i=!!this.settings&&JSON.stringify(this.settings)!=JSON.stringify(t);return i},closeOnDeleteNode:function(t,i){var l=e(".fl-builder-settings[data-node]"),s=FLBuilder._contentClass+" .fl-node-"+l.data("node");l.length&&!e(s).length&&FLLightbox.closeAll()},showLightboxLoader:function(){e(".fl-builder-settings:visible").append('<div class="fl-builder-loading"></div>')},hideLightboxLoader:function(t){e(".fl-builder-settings:visible .fl-builder-loading").remove()},showFieldLoader:function(e){var t=e.closest(".fl-field-control").find(".fl-field-control-wrapper");t.hide().after('<div class="fl-field-loader">'+FLBuilderStrings.fieldLoading+"</div>")},hideFieldLoader:function(e){var t=e.closest(".fl-field"),i=e.closest(".fl-field-control").find(".fl-field-control-wrapper");i.show(),t.find(".fl-field-loader").remove()}},FLBuilderSettingsConfig="undefined"==typeof FLBuilderSettingsConfig?{}:FLBuilderSettingsConfig,e.extend(FLBuilderSettingsConfig,{init:function(){FLBuilder.addHook("didSaveNodeSettings",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveNodeSettingsComplete",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didSaveGlobalSettingsComplete",this.updateOnSaveGlobalSettings.bind(this)),FLBuilder.addHook("didSaveLayoutSettingsComplete",this.updateOnSaveLayoutSettings.bind(this)),FLBuilder.addHook("didAddRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumnGroup",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didAddModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDeleteModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateRow",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateColumn",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didDuplicateModule",this.updateOnNodeEvent.bind(this)),FLBuilder.addHook("didResizeRow",this.updateOnRowResize.bind(this)),FLBuilder.addHook("didResizeColumn",this.updateOnColumnResize.bind(this)),FLBuilder.addHook("didResetRowWidth",this.updateOnResetRowWidth.bind(this)),FLBuilder.addHook("didResetColumnWidths",this.updateOnResetColumnWidths.bind(this)),FLBuilder.addHook("didApplyTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didApplyRowTemplateComplete",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didSaveGlobalNodeTemplate",this.updateOnApplyTemplate.bind(this)),FLBuilder.addHook("didRestoreRevisionComplete",this.updateOnApplyTemplate.bind(this))},updateOnSaveGlobalSettings:function(e,t){this.settings.global=t},updateOnSaveLayoutSettings:function(e,t){this.settings.layout=t},updateOnNodeEvent:function(){var e=arguments[0];e.namespace.indexOf("didAdd")>-1?this.addNode(arguments[1]):e.namespace.indexOf("didSaveNodeSettings")>-1?this.updateNode(arguments[1].nodeId,arguments[1].settings):e.namespace.indexOf("didDelete")>-1?this.deleteNodes():e.namespace.indexOf("didDuplicate")>-1&&this.duplicateNode(arguments[1].oldNodeId,arguments[1].newNodeId)},updateOnRowResize:function(e,t){this.nodes[t.rowId].max_content_width=t.rowWidth},updateOnResetRowWidth:function(e,t){this.nodes[t].max_content_width=""},updateOnColumnResize:function(e,t){this.nodes[t.colId].size=t.colWidth,this.nodes[t.siblingId].size=t.siblingWidth},updateOnResetColumnWidths:function(t,i){var l=this;i.cols.each(function(){var t=e(this),i=t.attr("data-node");l.nodes[i]&&(l.nodes[i].size=parseFloat(t[0].style.width))})},updateOnApplyTemplate:function(e,t){this.nodes=t.nodes,this.attachments=t.attachments},addNode:function(t,i){var l=e(".fl-node-"+t),s=l.hasClass("fl-row"),o=l.hasClass("fl-col"),n=l.hasClass("fl-col-group"),r=l.hasClass("fl-module"),a=this;this.nodes[t]||(i||(s?i=e.extend({},this.defaults.row):o?i=e.extend({},this.defaults.column):r&&(i=e.extend({},this.defaults.modules[l.attr("data-type")])),s||n?l.find(".fl-col").each(function(){var t=e(this),i=e.extend({},a.defaults.column);i.size=parseFloat(t[0].style.width),a.addNode(t.attr("data-node"),i)}):r&&(a.addNode(l.closest(".fl-row").attr("data-node")),a.addNode(l.closest(".fl-col").attr("data-node")),a.updateOnResetColumnWidths(null,{cols:l.closest(".fl-col-group").find("> .fl-col")}))),i&&(this.nodes[t]=i))},updateNode:function(t,i){var l=e(".fl-node-"+t),s=this;l.hasClass("fl-col")&&l.closest(".fl-col-group").find("> .fl-col").each(function(){var t=e(this),l=t.attr("data-node");s.nodes[l].size=parseFloat(t[0].style.width),s.nodes[l].equal_height=i.equal_height,s.nodes[l].content_alignment=i.content_alignment,s.nodes[l].responsive_order=i.responsive_order}),this.nodes[t]=i},duplicateNode:function(t,i){var l=e(".fl-node-"+i),s=l.find("[data-node]"),o=e(".fl-node-"+t),n=o.find("[data-node]"),r=this;this.nodes[i]=this.nodes[t],s.each(function(l){t=n.eq(l).attr("data-node"),i=e(this).attr("data-node"),r.nodes[t]&&(r.nodes[i]=r.nodes[t])})},deleteNodes:function(){var t="",i=e(FLBuilder._contentClass).html();for(t in this.nodes)i.indexOf(t)===-1&&(this.nodes[t]=null,delete this.nodes[t])}}),e(function(){FLBuilderSettingsConfig.init(),FLBuilderSettingsForms.init()})}(jQuery),function(e){var t={init:function(){"module"===FLBuilderConfig.userTemplateType||FLBuilderConfig.simpleUi||(this.initPanel(),this.pinOrUnpin(),this.bind())},bind:function(){var t=e(window),i=e("body");t.on("resize",_.throttle(this.windowResize.bind(this),250)),i.delegate(".fl-builder-ui-pinned-collapse","click",this.collapse),i.delegate(".fl-builder--content-library-panel .fl-builder--tabs","click",this.closeLightboxOnPanelClick),FLBuilder.addHook("didShowLightbox",this.pinLightboxOnOpen.bind(this)),FLBuilder.addHook("didHideAllLightboxes",this.pinnedLightboxClosed.bind(this)),FLBuilder.addHook("endEditingSession",this.hide.bind(this)),FLBuilder.addHook("didHideEditingUI",this.hide.bind(this)),FLBuilder.addHook("publishButtonClicked",this.hide.bind(this)),FLBuilder.addHook("restartEditingSession",this.show.bind(this)),FLBuilder.addHook("didShowEditingUI",this.show.bind(this)),FLBuilder.addHook("didShowLightbox",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.uncollapse.bind(this)),FLBuilder.addHook("willShowContentPanel",this.closeLightboxOnPanelClick.bind(this))},isPinned:function(){return e(".fl-builder--content-library-panel").hasClass("fl-builder-ui-pinned")},pin:function(e,t){this.pinPanel(e),this.pinLightboxes(),t&&this.savePosition(),FLBuilder._resizeLayout()},unpin:function(e){this.unpinLightboxes(),this.unpinPanel(),e&&this.savePosition(),FLBuilder._resizeLayout()},pinOrUnpin:function(){var t=e(".fl-builder--content-library-panel"),i=this.isPinned();t.hasClass("fl-builder-ui-pinned-hidden")||(window.innerWidth<=500?(i&&this.unpin(!1),this.disableDragAndResize()):(i||this.restorePosition(),this.enableDragAndResize()))},show:function(){var t=e(".fl-builder--content-library-panel");t.hasClass("fl-builder-ui-pinned-hidden")&&(t.removeClass("fl-builder-ui-pinned-hidden"),t.show(),this.restorePosition())},hide:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");this.isPinned()&&(this.uncollapse(),i.addClass("fl-builder-ui-pinned-hidden"),i.hide(),t.css("margin",""),FLBuilder._resizeLayout())},collapse:function(){var t=e(this).find("i:visible"),i=e("body"),l=t.data("toggle"),s=t.data("position"),o=e(".fl-builder--content-library-panel"),n=o.outerWidth();"hide"===l?(o.css(s,"-"+n+"px"),i.css("margin-"+s,""),i.addClass("fl-builder-ui-pinned-is-collapsed")):(o.css(s,"0px"),i.css("margin-"+s,n+"px"),i.removeClass("fl-builder-ui-pinned-is-collapsed"))},uncollapse:function(){this.isCollapsed()&&e(".fl-builder-ui-pinned-collapse:visible").trigger("click")},isCollapsed:function(){return e("body").hasClass("fl-builder-ui-pinned-is-collapsed")},initPanel:function(){var t=e(".fl-builder--content-library-panel");t.draggable({cursor:"move",handle:".fl-builder--tabs",cancel:".fl-builder--tabs button",scroll:!1,drag:this.drag.bind(this),stop:this.dragStop.bind(this),start:this.dragStart.bind(this)}).resizable({handles:"e, w",minHeight:400,minWidth:380,maxWidth:500,start:this.resizeStart.bind(this),stop:this.resizeStop.bind(this)}),t.addClass("fl-builder-ui-pinned-container"),t.find(".ui-resizable-e, .ui-resizable-w").hide()},pinPanel:function(t){var i=e(".fl-builder--content-library-panel"),l=i.width(),s=e("body"),o=e(".fl-responsive-preview, .fl-responsive-preview-mask"),n=e(FLBuilder._contentClass).parentsUntil("body").last();s.addClass("fl-builder-ui-is-pinned fl-builder-ui-is-pinned-"+t),s.addClass("fl-builder-content-panel-is-showing"),s.css("margin-"+t,l+"px"),o.css("margin-"+t,l+"px"),n.addClass("fl-builder-ui-pinned-content-transform"),i.addClass("fl-builder-ui-pinned fl-builder-ui-pinned-"+t),i.find(".ui-resizable-"+("left"===t?"e":"w")).show(),i.on("resize",_.throttle(this.resize.bind(this),250)),i.attr("style",""),FLBuilder.ContentPanel.isShowing=!0},unpinPanel:function(){var t=e(".fl-builder--content-library-panel"),i=t.find(".fl-builder--panel-content .is-showing").data("tab"),l=e("body"),s=e(".fl-responsive-preview, .fl-responsive-preview-mask"),o=e(FLBuilder._contentClass).parentsUntil("body").last();l.css("margin-left",""),l.css("margin-right",""),l.removeClass("fl-builder-ui-is-pinned"),l.removeClass("fl-builder-ui-is-pinned-left"),l.removeClass("fl-builder-ui-is-pinned-right"),s.css("margin-left",""),s.css("margin-right",""),o.removeClass("fl-lightbox-content-transform"),t.removeClass("fl-builder-ui-pinned"),t.removeClass("fl-builder-ui-pinned-left"),t.removeClass("fl-builder-ui-pinned-right"),t.find(".ui-resizable-handle").hide(),t.off("resize"),t.attr("style",""),t.find(".fl-builder--tabs [data-tab="+i+"]").addClass("is-showing")},pinLightboxes:function(){var t=this;e(".fl-lightbox-resizable").each(function(){t.pinLightbox(e(this))}),FLBuilder._reinitEditorFields()},pinLightbox:function(t){var i=e(".fl-builder--content-library-panel"),l=t.closest(".fl-lightbox-wrap");l.closest(".fl-builder-ui-pinned").length||(i.append(l),t.attr("style",""),t.draggable("disable"),t.resizable("disable")),t.is(":visible")&&i.find(".fl-builder--tabs .is-showing").removeClass("is-showing")},pinLightboxOnOpen:function(e,t){var i=t._node.find(".fl-lightbox-resizable");i.length&&(i.hasClass("fl-builder-ui-pinning-initialized")||(i.draggable("option","start",this.dragStart.bind(this)),i.draggable("option","drag",this.drag.bind(this)),i.draggable("option","stop",this.dragStop.bind(this)),i.addClass("fl-builder-ui-pinning-initialized")),this.isPinned()&&this.pinLightbox(i),FLBuilder.addHook("responsive-editing-switched",this.resize))},pinnedLightboxClosed:function(){var t=e(".fl-builder--content-library-panel");tab=null,this.isPinned()&&(tab=t.find(".fl-builder--panel-content .is-showing").data("tab"),t.find(".fl-builder--tabs [data-tab="+tab+"]").addClass("is-showing")),e(".fl-lightbox").removeClass("fl-lightbox-prevent-animation")},unpinLightboxes:function(){var t=e("body"),i=e(".fl-builder--content-library-panel");i.find(".fl-lightbox-wrap").each(function(){var l=e(this),s=l.find(".fl-lightbox"),o=0,n=0,r=0;s.draggable("enable"),s.resizable("enable"),s.find(".ui-resizable-handle").show(),t.append(l),s.is(":visible")?(o=parseInt(i.css("top"))-parseInt(l.css("top"))-parseInt(l.css("padding-top")),n=parseInt(i.css("left"))-parseInt(l.css("padding-left")),r=parseInt(i.css("right"))-parseInt(l.css("padding-right")),s.css("top",(o<0?0:o)+"px"),s.css(FLBuilderConfig.isRtl?"right":"left",(FLBuilderConfig.isRtl?r:n)+"px"),s.addClass("fl-lightbox-prevent-animation"),t.removeClass("fl-builder-content-panel-is-showing"),FLBuilder.ContentPanel.isShowing=!1):s.css({top:"25px",left:"25px"})}),FLBuilder._reinitEditorFields()},closeLightboxOnPanelClick:function(){FLBuilder._triggerSettingsSave(!1,!0)},windowResize:function(){this.pinOrUnpin()},resizeStart:function(){e("body").addClass("fl-builder-resizable-is-resizing"),FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()},resize:function(){var t=e("body"),i=e(".fl-responsive-preview, .fl-responsive-preview-mask"),l=e(".fl-builder--content-library-panel"),s=l.outerWidth();l.hasClass("fl-builder-ui-pinned-left")?(t.css("margin-left",s+"px"),i.css("margin-left",s+"px")):l.hasClass("fl-builder-ui-pinned-right")&&(t.css("margin-right",s+"px"),i.css("margin-right",s+"px"))},resizeStop:function(){e("body").removeClass("fl-builder-resizable-is-resizing"),FLBuilder._bindOverlayEvents(),FLBuilder._resizeLayout(),this.savePosition()},dragStart:function(t,i){var l=e("body"),s=(e(t.target),e(".fl-builder-bar-actions"));e(".fl-lightbox-resizable:visible").length||s.addClass("fl-builder-content-panel-pin-zone"),l.addClass("fl-builder-draggable-is-dragging"),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-left"></div>'),l.append('<div class="fl-builder-ui-pin-zone fl-builder-ui-pin-zone-right"></div>'),FLBuilder._destroyOverlayEvents()},drag:function(t,i){var l=e("body"),s=e(".fl-responsive-preview"),o=e(window),n=s.length?s.width():o.width(),r=o.scrollTop(),a=e(".fl-builder--content-library-panel"),d=a.offset().top,u=e(".fl-builder-bar-actions"),c=e(t.target);c.hasClass("fl-builder--content-library-panel")&&(t.clientX<n-75&&d-r<46?u.addClass("fl-builder-content-panel-pin-zone-hover"):u.removeClass("fl-builder-content-panel-pin-zone-hover")),c.hasClass("fl-builder-ui-pinned")?this.unpinPanel():t.clientX<75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-left"):t.clientX>n-75?l.addClass("fl-builder-ui-show-pin-zone fl-builder-ui-show-pin-zone-right"):(l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right"))},dragStop:function(t,i){var l=(e(window),e("body")),s=e(".fl-builder-bar-actions"),o=e(".fl-builder-ui-pin-zone"),n=e(".fl-builder--content-library-panel"),r=e(".fl-lightbox-resizable:visible");e(t.target);l.removeClass("fl-builder-draggable-is-dragging"),s.removeClass("fl-builder-content-panel-pin-zone"),s.removeClass("fl-builder-content-panel-pin-zone-hover"),o.remove(),r.length&&parseInt(r.css("top"))<0&&r.css("top","0"),l.hasClass("fl-builder-ui-show-pin-zone")?(l.hasClass("fl-builder-ui-show-pin-zone-left")?this.pin("left",!0):this.pin("right",!0),l.removeClass("fl-builder-ui-show-pin-zone"),l.removeClass("fl-builder-ui-show-pin-zone-left"),l.removeClass("fl-builder-ui-show-pin-zone-right")):n.find(".fl-lightbox").length?this.unpin(!0):(n.attr("style",""),this.savePosition()),FLBuilder._bindOverlayEvents()},disableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable");
9
+ t.draggable("disable"),t.resizable("disable"),i.draggable("disable"),i.resizable("disable")},enableDragAndResize:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:not(.fl-lightbox-width-full)");t.draggable("enable"),t.resizable("enable"),this.isPinned()||(i.draggable("enable"),i.resizable("enable"))},savePosition:function(){var t=e(".fl-builder--content-library-panel"),i=e(".fl-lightbox-resizable:visible"),l={pinned:{width:t.width(),position:null}};t.hasClass("fl-builder-ui-pinned-left")?l.pinned.position="left":t.hasClass("fl-builder-ui-pinned-right")?l.pinned.position="right":i.length&&(l.lightbox={width:i.width(),height:i.height(),top:parseInt(i.css("top"))<0?"0px":i.css("top"),left:i.css("left")}),FLBuilderConfig.userSettings.pinned=l.pinned,l.lightbox&&(FLBuilderConfig.userSettings.lightbox=l.lightbox),FLBuilder.ajax({action:"save_pinned_ui_position",data:l})},restorePosition:function(){var t=e(".fl-builder--content-library-panel"),i=FLBuilderConfig.userSettings.pinned;i&&i.position&&(t.width(i.width),this.pin(i.position,!1),t.width(i.width))}};e(function(){t.init()})}(jQuery),function(e){var t={init:function(){this.setupMainMenuData(),e(".fl-builder--revision-actions select").on("change",this.selectChanged),e(".fl-cancel-revision-preview").on("click",this.exitPreview.bind(this)),e(".fl-apply-revision-preview").on("click",this.applyClicked.bind(this)),FLBuilder.addHook("revisionItemClicked",this.itemClicked.bind(this)),FLBuilder.addHook("didPublishLayout",this.refreshItems.bind(this))},setupMainMenuData:function(){var t=FLBuilderConfig.revisions.posts,i=FLBuilderConfig.revisions.authors,l=wp.template("fl-revision-list-item"),s=e(".fl-builder--revision-actions select"),o="",n="",r=0;if(FLBuilderConfig.mainMenu.revisions.items=[],s.html(""),0===t.length)FLBuilderConfig.mainMenu.revisions.items.push({eventName:"noRevisionsMessage",type:"event",label:wp.template("fl-no-revisions-message")()});else for(;r<t.length;r++)o=FLBuilderStrings.revisionDate.replace("%s",t[r].date.diff),o+=" ("+t[r].date.published+")",n=FLBuilderStrings.revisionAuthor.replace("%s",i[t[r].author].name),FLBuilderConfig.mainMenu.revisions.items.push({eventName:"revisionItemClicked",type:"event",label:l({id:t[r].id,date:o,author:n,avatar:i[t[r].author].avatar})}),s.append('<option value="'+t[r].id+'">'+o+"</option>");FLBuilder.triggerHook("renderRevisionsPanel")},refreshItems:function(){FLBuilder.ajax({action:"refresh_revision_items"},this.refreshItemsComplete.bind(this))},refreshItemsComplete:function(e){FLBuilderConfig.revisions=JSON.parse(e),this.setupMainMenuData()},itemClicked:function(t,i){var l=e(i).find(".fl-revision-list-item").attr("data-revision-id");FLBuilder._triggerSettingsSave(!1,!0)&&(e(".fl-builder--revision-actions select").val(l),this.preview(l))},selectChanged:function(i){t.preview(e(this).val())},applyClicked:function(i){var l=e(".fl-builder--revision-actions select").val();t.restore(l)},preview:function(t){e(".fl-builder--revision-actions").css("display","flex"),FLBuilder.triggerHook("didEnterRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder.ajax({action:"render_revision_preview",revision_id:t},this.previewRenderComplete.bind(this))},previewRenderComplete:function(e){FLBuilder._renderLayout(e,function(){FLBuilder._destroyOverlayEvents(),FLBuilder._removeAllOverlays()})},exitPreview:function(){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder._bindOverlayEvents(),FLBuilder._updateLayout()},restore:function(i){e(".fl-builder--revision-actions").hide(),FLBuilder.triggerHook("didExitRevisionPreview"),FLBuilder.showAjaxLoader(),FLBuilder._bindOverlayEvents(),FLBuilder.ajax({action:"restore_revision",revision_id:i},t.restoreComplete)},restoreComplete:function(e){var t=JSON.parse(e);FLBuilder._renderLayout(t.layout),FLBuilder.triggerHook("didRestoreRevisionComplete",t.config)}};e(function(){t.init()})}(jQuery),function(e){var t={query:function(e){var t={},i=null,l={library:{}},s=null;if(e=this.normalizeQuery(e),_.isNull(e.kind))t=FLBuilderConfig.contentItems;else for(var o in e.kind)i=e.kind[o],t[i]=FLBuilderConfig.contentItems[i];return s=this.findMatches(e,t),l.library=this.formatResults(s,e),l},normalizeQuery:function(e){var t={kind:null,type:null,category:null,group:null,enabled:!0,global:null,searchTerm:null,categorized:!1};return e=_.extend(t,e),_.isString(e.kind)&&(e.kind=[e.kind]),e},findMatches:function(e,t){var i={},l=null,s=null,o=null,n=null,r=null,a=null;for(l in t){s=t[l],i[l]={items:[]};for(a in s)if(o=s[a],_.isUndefined(e.category)||_.isNull(e.category)||this.matchesCategory(o.category,e.category)){switch(l){case"template":if(!(_.isUndefined(e.content)||_.isNull(e.content)||(n=_.contains(e.content,o.content),r=e.content===o.content,n||r)))continue;if(!_.isUndefined(e.type)&&!_.isNull(e.type)&&e.type!==o.type)continue;if(!_.isNull(e.group)){var d=e.group,u=o.group;if(_.isString(d)&&(d=[d]),_.isString(u)&&(u=[u]),_.isEmpty(d)||_.isEmpty(u))continue;var c=!1;for(a in d){var h=d[a];_.contains(u,h)&&(c=!0)}if(!c)continue}break;case"module":if(!_.isNull(e.group)){if(e.group===!1&&o.group.length>0)continue;if(e.group!==!1&&!_.contains(o.group,e.group))continue}}(_.isUndefined(e.searchTerm)||_.isNull(e.searchTerm)||this.matchesSearchTerm(o,e.searchTerm))&&i[l].items.push(o)}}return i},matchesCategory:function(e,t){var i,l,s,o,n,r;if(e===t)return!0;_.isString(t)&&(t=[t]);for(l in t){if(i=t[l],_.isString(e)&&e===i)return!0;if(_.isArray(e))for(s in e)if(o=e[s],o===i)return!0;if(_.isObject(e))for(n in e)if(r=e[n],r===i||n===i)return!0}return!1},matchesSearchTerm:function(e,t){var i,l,s=t.toLowerCase();return!(_.isUndefined(e.slug)||!e.slug.toLowerCase().includes(s))||(!(_.isUndefined(e.name)||!e.name.toLowerCase().includes(s))||(!(!_.isString(e.category)||!e.category.toLowerCase().includes(s))||(!(_.isUndefined(e.description)||!e.description.toLowerCase().includes(s))||(!(_.isUndefined(e.id_base)||!e.id_base.includes(t))||(!(!e.isWidget||(i="widget",!i.includes(s)))||!(_.isUndefined(e.editor_export)||(l="module",!l.includes(s))))))))},formatResults:function(e,t){if(t.categorized)for(type in e){var i=e[type].items;e[type].categorized=this.groupBy(i,"category")}return e},groupBy:function(e,t){var i,l,s={};return _.forEach(e,function(e,o,n){i=e[t],_.isNull(i)||_.isUndefined(i)||_.isString(i)&&""===e[i]||(_.isString(i)&&(s[i]=s[i]||[],s[i].push(e)),_.isArray(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})),_.isObject(i)&&(l=i,_.forEach(l,function(t,i,l){s[t]=s[t]||[],s[t].push(e)})))}),s},search:function(e){var t={searchTerm:e},i=this.query(t),l={total:0,term:e,sections:{}};if(!_.isUndefined(i.library.module.items)){var s={};for(var o in i.library.module.items){var n=i.library.module.items[o],r=n.group[0],a=n.category;n.name;_.isUndefined(s[r])&&(s[r]={}),_.isUndefined(s[r][a])&&(s[r][a]=[]),s[r][a].push(n)}l.grouped=s}for(var o in i.library){var d=i.library[o];!_.isUndefined(d.items)&&d.items.length>0&&(l.sections[o]={name:FLBuilderStrings.typeLabels[o],handle:o,type:"",items:d.items},l.total+=d.items.length)}return l}};FLBuilder.Search={byQuery:function(e){return t.query(e)},byTerm:function(e){var i=t.search(e);return i}}}(jQuery),function(e,t){var i={layoutNeedsPublish:!1,defaultIndicatorMessage:"",defaultTooltipMessage:"",messages:null,init:function(){this.messages=FLBuilderStrings.savedStatus,this.$savingIndicator=e(".fl-builder--saving-indicator"),t.addHook("didBeginAJAX",this.onLayoutSaving.bind(this)),t.addHook("didCompleteAJAX",this.onLayoutSaved.bind(this)),t.addHook("didPublishLayout",this.onLayoutPublished.bind(this)),t.addHook("publishAndRemain",this.onPublishAndRemain.bind(this)),t.addHook("didShowLightbox",this.setLayoutNeedsPublish.bind(this)),!FLBuilderConfig.layoutHasDraftedChanges&&FLBuilderConfig.builderEnabledd||(this.setLayoutNeedsPublish(),this.resetStatusMessage())},setLayoutNeedsPublish:function(){this.layoutNeedsPublish||(this.layoutNeedsPublish=!0,e("body").addClass("fl-builder--layout-has-drafted-changes"))},onLayoutSaving:function(e,t){this.isPublishingLayout(t.action)?this.showStatusMessage(this.messages.publishing,this.messages.publishingTooltip):this.isUpdatingLayout(t.action)&&(this.setLayoutNeedsPublish(),this.showStatusMessage(this.messages.saving,this.messages.savingTooltip))},isPublishingLayout:function(e){return"save_layout"==e},isUpdatingLayout:function(e){return!this.isPublishingLayout()&&(e.startsWith("render")?!!e.startsWith("render_new"):!e.startsWith("duplicate")&&(!e.startsWith("refresh")&&("save_ui_skin"!=e&&("save_lightbox_position"!=e&&"save_pinned_ui_position"!=e))))},onLayoutSaved:function(e,t){if(this.isUpdatingLayout(t.fl_builder_data.action)){this.showStatusMessage(this.messages.saved,this.messages.savedTooltip);var i=this;setTimeout(function(){i.resetStatusMessage()},2e3)}},onLayoutPublished:function(){this.layoutNeedsPublish=!1,e("body").removeClass("fl-builder--layout-has-drafted-changes"),this.resetStatusMessage()},showStatusMessage:function(t,i){this.$savingIndicator.html(t),_.isUndefined(i)||(this.$savingIndicator.attr("title",i),e(".fl-builder--saving-indicator").tipTip({defaultPosition:"bottom",edgeOffset:14}))},resetStatusMessage:function(){this.layoutNeedsPublish?(this.defaultIndicatorMessage=this.messages.edited+'<i class="fa fa-question-circle"></i>',this.defaultTooltipMessage=this.messages.editedTooltip):(this.defaultIndicatorMessage="",this.defaultTooltipMessage=""),this.showStatusMessage(this.defaultIndicatorMessage,this.defaultTooltipMessage)},onPublishAndRemain:function(){if(this.layoutNeedsPublish)t._publishLayout(!1);else{this.showStatusMessage(this.messages.noChanges);var e=this;setTimeout(function(){e.resetStatusMessage()},2e3)}}};t.SaveManager={layoutNeedsPublish:function(){return i.layoutNeedsPublish},showStatusMessage:function(e,t){i.showStatusMessage(e,t)},resetStatusMessage:function(){i.resetStatusMessage()}},e(function(){i.init()})}(jQuery,FLBuilder);
languages/nb_NO.mo CHANGED
Binary file
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: justinbusa, RobbyMcCullough, billyyoung, hinampaksh, diegoliv, webmandesign, eugenealegiojo, helgatheviking, ozancanakli, brentjettgmailcom, jproffitt71, brainstormforce, ideaboxcreations, laubsterboy, nikolayyordanov, codente, pross, pedromendonca
3
  Tags: page builder, beaver builder, landing page, front-end builder, drag and drop editor
4
  Requires at least: 4.5
5
- Tested up to: 4.9.5
6
  Stable tag: trunk
7
  License: GPL2+
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
2
  Contributors: justinbusa, RobbyMcCullough, billyyoung, hinampaksh, diegoliv, webmandesign, eugenealegiojo, helgatheviking, ozancanakli, brentjettgmailcom, jproffitt71, brainstormforce, ideaboxcreations, laubsterboy, nikolayyordanov, codente, pross, pedromendonca
3
  Tags: page builder, beaver builder, landing page, front-end builder, drag and drop editor
4
  Requires at least: 4.5
5
+ Tested up to: 4.9.4
6
  Stable tag: trunk
7
  License: GPL2+
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html