Server IP : 85.214.239.14 / Your IP : 3.144.242.20 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/3/task/3/cwd/var/www/wordpress/wp-content/themes/Divi/includes/builder/scripts/ |
Upload File : |
/*! This minified app bundle contains open source software from several third party developers. Please review CREDITS.md in the root directory or LICENSE.md in the current directory for complete licensing, copyright and patent information. This file and the included code may not be redistributed without the attributions listed in LICENSE.md, including associate copyright notices and licensing information. */!function(e){var t={};function i(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=485)}({38:function(e,t,i){"use strict";(function(e){t.a=function(t,i){var o=e(window),n=e("#wpadminbar"),a=o.height(),s=t.outerHeight(),l=n.outerHeight(),_=0-s/2+l/2;s>a-l?t.css({top:l+15,bottom:15,marginTop:0,minHeight:0}):t.css({top:"50%",marginTop:_}),t.addClass("et_pb_auto_centerize_modal")}}).call(this,i(5))},485:function(e,t,i){"use strict";i.r(t),function(e,t){var o=i(38),n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=a||{};window.ET_PageBuilder=a,window.wp=window.wp||{},window.et_builder_version="4.9.0",window.et_builder_product_name="Divi";var s=window.et_error_modal_shown,l=!1,d=!1,r=0,p=0,c=0,b="et_pb_templates_",u={},g={},h=[],f={s:!1,r:!1,c:!1};function m(e,t){if(_.isUndefined(t))return e;return e.replace(/<!-- (\d+) -->/g,function(e,i){return t[i]})}function v(){return new Promise(function(t,i){e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_builder_library_get_layouts_data",postId:et_pb_options.postId,nonce:et_pb_options.library_get_layouts_data_nonce}}).then(function(e){t(C(e,"data",""))})})}var w=v();function y(){var e=et_pb_options.product_version,t=void 0;(t=localStorage.getItem("et_forced_localstorage_clear"))||(t=wpCookies.get("et_forced_localstorage_clear")),t!==e&&(localStorage.clear(),wpCookies.set("et_forced_localstorage_clear",e),localStorage.setItem("et_forced_localstorage_clear",e),setTimeout(function(){window.location.reload()},100))}function k(t){var i=0,o=new Date,n=o.getYear()+"_"+o.getMonth()+"_"+o.getDate(),a=(et_pb_options.et_builder_module_parent_shortcodes+"|"+et_pb_options.et_builder_module_child_shortcodes).split("|"),r=et_pb_options.product_version,u=et_pb_options.active_plugins.join("|"),g="",h=0,f={missing_modules_array:[]},v=void 0;if((t=!_.isUndefined(t)&&t)||(e('script[src="'+et_pb_options.builder_js_src+'"]').length||e(".et-pb-cache-update").show(),e("body").on("click",".et_builder_increase_memory",function(){var t=e(this);return e.ajax({type:"POST",dataType:"json",url:et_pb_options.ajaxurl,data:{action:"et_pb_increase_memory_limit",et_admin_load_nonce:et_pb_options.et_admin_load_nonce},success:function(e){_.isUndefined(e.success)?t.addClass("et_builder_modal_action_button_fail").prop("disabled",!0).text(et_pb_options.memory_limit_not_increased):t.addClass("et_builder_modal_action_button_success").text(et_pb_options.memory_limit_increased)}}),!1}),e("body").on("click",".et_pb_reload_builder",function(){return location.reload(),!1})),function(){if(!$())return!1;if(!_.isUndefined(et_pb_options.force_cache_purge)&&"true"===et_pb_options.force_cache_purge)return!1;var e=localStorage.getItem(b+"settings_date"),t=localStorage.getItem(b+"settings_product_version"),i=localStorage.getItem(b+"settings_active_plugins");if(_.isUndefined(e)||_.isNull(e))return!1;if(_.isUndefined(t)||_.isNull(t))return!1;if(i!==u)return!1;if(n!=e||r!=t)return function(){if(!$())return!1;_.forEach(_.keys(localStorage),function(e){x(e,"et_pb_templates_")&&localStorage.removeItem(e)})}(),!1;return!0}()){if(d)return;for(var w in a){var C=a[w],S=b+C,j=LZString.decompressFromUTF16(localStorage.getItem(S));h++,_.isUndefined(j)||_.isNull(j)||""===j?f.missing_modules_array.push(C):g+=LZString.decompressFromUTF16(localStorage.getItem(S)),!l&&(f.missing_modules_array.length===parseInt(et_pb_options.et_builder_templates_amount)||f.missing_modules_array.length&&a.length===h)&&(l=!0,e.ajax({type:"POST",dataType:"json",url:et_pb_options.ajaxurl,data:{action:"et_pb_get_backbone_template",et_post_type:et_pb_options.post_type,et_modules_slugs:JSON.stringify(f),et_admin_load_nonce:et_pb_options.et_admin_load_nonce},success:function(t){l=!1;var i=void 0;!_.isUndefined(t.templates)&&t.templates.length&&_.each(t.templates,function(o){i=m(o.template,t.unique);try{localStorage.setItem(b+o.slug,LZString.compressToUTF16(i))}catch(e){y()}e("body").append(i)})}}),f.missing_modules_array=[])}e("body").append(g)}else v=setInterval(function(){if(i===Math.ceil(et_pb_options.et_builder_modules_count/et_pb_options.et_builder_templates_amount))return clearInterval(v),!1;var t;d=!0,p++,t=i*et_pb_options.et_builder_templates_amount,e.ajax({type:"POST",dataType:"json",url:et_pb_options.ajaxurl,data:{action:"et_pb_get_backbone_templates",et_post_type:et_pb_options.post_type,et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_templates_start_from:t},error:function(){var t=e("#et-builder-failure-notice-template");s||t.length&&(e(".et_pb_failure_notification_modal").length||($()&&(localStorage.removeItem(b+"settings_date"),localStorage.removeItem(b+"settings_product_version"),localStorage.removeItem(b+"settings_active_plugins")),e("body").addClass("et_pb_stop_scroll").append(t.html())))},success:function(t){var i=void 0;for(var o in t.templates){if(i=m(t.templates[o],t.unique),$())try{localStorage.setItem("et_pb_templates_"+o,LZString.compressToUTF16(i))}catch(e){y()}e("body").append(i)}c++,p>0&&p===c&&(d=!1,k())}}),i++},800),function(){if(!$())return!1;try{localStorage.setItem(b+"settings_date",n),localStorage.setItem(b+"settings_product_version",r),localStorage.setItem(b+"settings_active_plugins",u)}catch(e){}}();function $(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}}function C(e,t,i){if(!_.isObject(e))return i;var o=_.reduce(t.split("."),function(e,t){return e?e[t]:void 0},e);return _.isUndefined(o)?i:o}function S(e,t){if(!t)return!0;var i=t.split("."),o=_.first(i);return _.has(e,o)&&S(e[o],_.rest(i).join("."))}function x(e,t){return e.substr(0,t.length)===t}k(),a.isDynamicContent=function(e){if("string"!=typeof e)return!1;var t=new RegExp(/^<p>(.*)<\/p>$/,"i"),i=/^\s+|\s+$/,o=e.replace(i,"");o=(o=o.replace(t,"$1")).replace(i,"");try{if(/^@ET-DC@(.*?)@$/.test(o))return!0;var n=JSON.parse(o);if(void 0!==n.dynamic&&!0===n.dynamic)return!0}catch(e){}return!1},document.addEventListener("DOMContentLoaded",function(){function i(){e("#et-builder-right-click-controls").remove(),e("#et_pb_layout_right_click_overlay").remove()}function s(t){t.click(function(t){var i=e(this);t.preventDefault(),(O=wp.media.frames.et_pb_file_frame=new wp.media.view.MediaFrame.ETSelect({title:i.data("choose"),library:{type:i.data("type")},button:{text:i.data("update")},multiple:!1})).on("select",function(){var e=O.state().props.get("url"),t=i.siblings(".et-pb-upload-field");t.val(e),t.trigger("change"),c(i)}),O.on("insert",function(){var e=O.state().get("selection").models[0];if(!_.isUndefined(e)){var t=i.siblings(".et-pb-upload-field");t.val(e.get("url")),t.trigger("change"),c(i)}}),O.open()}),t.siblings(".et-pb-upload-field").on("input",function(){c(e(this).siblings(".et-pb-upload-button"))}),t.siblings(".et-pb-upload-field").each(function(){c(e(this).siblings(".et-pb-upload-button"))})}function l(t){t.click(function(i){e(this);var o=t.next(".et-pb-gallery"),n=t.closest(".et-pb-options-tab").find("#et_pb_gallery_orderby");if(i.preventDefault(),"undefined"!=typeof wp&&wp.media&&wp.media.gallery){var a=o.val().length?' ids="'+o.val()+'"':"",s="[gallery"+a+(n.val().length?' orderby="'+n.val()+'"':"")+"]";O=wp.media.frames.et_pb_file_frame=wp.media.gallery.edit(s),a||O.setState("gallery-library"),l(O.$el),O.on("content:render:browse",function(e){l(e.$el)}),O.state("gallery-edit").on("update",function(e){var t=wp.media.gallery.shortcode(e).attrs.named;t.ids&&o.val(t.ids),t.orderby?n.val(t.orderby):n.val("")})}function l(t){setTimeout(function(){t.find(".gallery-settings").find("label.setting").each(function(){e(this).find(".link-to, .columns, .size").length?e(this).remove():e(this).has("input[type=checkbox]").length&&e(this).children("input[type=checkbox]").css("margin","11px 5px")})},10)}})}function d(e){return e.siblings("input").attr("id").replace("et_pb_","").replace("_list","")}function p(t){t.click(function(t){var i=e(this),o=e("#et_pb_src.et-pb-upload-field").val().trim();t.preventDefault(),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_video_get_oembed_thumbnail",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_video_url:o},success:function(t){t.length?e("#et_pb_image_src").val(t).trigger("input"):(i.after('<div class="et-pb-error">'+et_pb_options.video_module_image_error+"</div>"),i.siblings(".et-pb-error").delay(5e3).fadeOut(800))}})})}function c(t){if(!(t.length<1)){var i=t.siblings(".et-pb-upload-field"),o=i.siblings(".et-pb-upload-preview"),n=i.closest(".et-pb-option").find(".et-pb-option-preview"),a=n.length,s=i.val().trim(),l=t.data("type"),d=t.closest(".et_pb_module_settings").attr("data-module_type"),r=t.closest(".et-pb-options-tabs").find("#et_pb_featured_image").val(),p=t.closest(".et-pb-options-tabs").find("#et_pb_featured_placement").val(),c=e("#postimagediv img").attr("src"),b=_.contains(et_pb_options.et_builder_modules_featured_image_background,d)&&"on"===r&&"background"===p,u=i.closest(".et-pb-option-container-inner").attr("data-base_name"),g="background"===u?"":u+"_";if(b?(s=c,n.addClass("et-pb-featured-image-background")):n.removeClass("et-pb-featured-image-background"),"image"===l||"video"===l&&a){if(""===s)return a?void n.addClass("et-pb-option-preview--empty").find(".et-pb-preview-content").remove():void(o.length&&o.remove());if(a){n.find(".et-pb-preview-content").remove();var h=t.closest(".et-pb-option-container--background"),f=h.find("input, select"),m=h.attr("data-column-index"),v=["url("+s+")"],w=ke(h.find(".et_pb_background-tab--gradient"),u),y={},k="",C=!1,S=!1;if(w&&(C=!0,v.push(w)),f.each(function(){if(void 0!==e(this).attr("id")){var t=e(this).attr("id").replace("et_pb_",""),i=e(this).val(),o=void 0!==e(this).attr("data-default")?e(this).attr("data-default"):"",n=""!==i&&void 0!==i;void 0!==m&&(t=t.replace("_"+m,"")),y[t]=n?i:o}}),"image"===l){var x={position:"absolute",top:0,right:0,bottom:0,left:0};"on"===y[g+"parallax"]?(x.backgroundImage="url("+s+")",x.backgroundRepeat="no-repeat",x.backgroundSize="cover",x.backgroundPosition="center"):(void 0===y[u+"_position"]&&(y[u+"_position"]=""),"on"===y[u+"_color_gradient_overlays_image"]&&v.reverse(),S=!0,x.backgroundImage=v.join(", "),x.backgroundSize=y[u+"_size"],x.backgroundPosition=y[u+"_position"].replace("_"," "),x.backgroundRepeat=y[u+"_repeat"],x.backgroundBlendMode=y[u+"_blend"],x.backgroundColor=C&&S?"initial":y[u+"_color"]),k=e("<div />",{class:"et-pb-preview-content"}).css(x)}else"video"===l&&(k=e("<video />",{class:"et-pb-preview-content",src:s,loop:!0,controls:!0,height:190}));n.removeClass("et-pb-option-preview--empty").prepend(k)}else o.length||(t.siblings(".description").before('<div class="et-pb-upload-preview"><strong class="et-pb-upload-preview-title">'+et_pb_options.preview_image+'</strong><img src="" width="408" /></div>'),o=i.siblings(".et-pb-upload-preview"));o.find("img").attr("src",s)}}}function b(e){var t=e.closest(".et-pb-option-container"),i=parseInt(t.find(".iris-square-value.ui-draggable").width()),o=parseInt(t.find(".iris-square-value.ui-draggable").css("left"))+i/2,n=parseInt(t.width());""!==e&&o>n-50?t.addClass("on-right-corner"):t.removeClass("on-right-corner")}_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},a.Helpers={},a.Helpers.getSettingValue=function(t){var i=void 0,o=[],n=void 0,a=t.is("#et_pb_content_main")?"et_pb_content":t.attr("id");if(t.is(":checkbox"))a=t.attr("name"),t.closest(".et-pb-option-container").find('[name="'+a+'"]:checked').each(function(){o.push(e(this).val())}),i=o.join(",");else if(t.is("#et_pb_content_main"))i=(i=t.html()).replace(/\^\^/g,"%22");else if(t.closest(".et-pb-custom-css-option").length)i=""!==(n=t.val())?n.replace(/(?:\r\n|\r|\n)/g,"||").replace(/\\/g,"%92"):"";else if(t.hasClass("et-pb-range-input"))i=fe(t),t.hasClass("et-pb-validate-unit")&&(i=Se(i.toString(),!1,"no_default_unit"));else if(t.hasClass("et-pb-range")){var s=t.siblings(".et-pb-range-input");i=fe(s),s.hasClass("et-pb-validate-unit")&&(i=Se(i.toString(),!1,"no_default_unit"))}else t.hasClass("et-pb-validate-unit")?i=Se(t.val(),!1,""):t.hasClass("et-pb-text-align-select")?t.closest(".et-pb-option-container").find(".et_text_align_active").length&&(i=t.val()):t.is(":checkbox")||(i=t.is("textarea.wp-editor-area")?ee(a):t.val(),t.hasClass("et-pb-range-input")&&"px"===i&&(i=""));return _.isNull(i)&&(i=""),i},a.Helpers.hasValue=function(e){return!_.isUndefined(e)&&""!==e},a.Helpers.isOn=function(e){return!_.isUndefined(e)&&"on"===e},a.Helpers.moduleHasBackground=function(e,t){var i=this,o=_.isUndefined(t)?["color","gradient","image","video"]:t,n=!1;return _.forEach(o,function(t){var o=!1;switch(t){case"color":o=i.hasValue(e.et_pb_background_color);break;case"gradient":o=i.isOn(e.et_pb_use_background_color_gradient);break;case"image":o=i.hasValue(e.et_pb_background_image);break;case"video":var a=i.hasValue(e.et_pb_background_video_mp4),s=i.hasValue(e.et_pb_background_video_webm);o=a||s}o&&(n=!0)}),n},a.Module=Backbone.Model.extend({defaults:{type:"element",_builder_version:et_pb_options.product_version}}),a.SavedTemplate=Backbone.Model.extend({defaults:{title:"template",ID:0,shortcode:"",is_global:"false",layout_type:"",module_type:"",categories:[],unsynced_options:[]}}),a.History=Backbone.Model.extend({defaults:{timestamp:_.now(),shortcode:"",current_active_history:!1,verb:"did",noun:"something"},max_history_limit:100,validate:function(e,t){t.collection.length;var i=t.collection.findWhere({current_active_history:!0}),o=e.shortcode,n=_.isUndefined(i)?t.collection.at(t.collection.length-1):i;if(o===(!_.isUndefined(n)&&n.get("shortcode")))return"duplicate";V.enable_history=!1;var a=t.collection.models.length-(this.max_history_limit-1);if(a>0)for(var s=1;s<=a;s++)t.collection.shift()}}),a.Layout=Backbone.Model.extend({defaults:{moduleNumber:0,forceRemove:!1,modules:e.parseJSON(et_pb_options.et_builder_modules),views:[]},initialize:function(){_.each(this.get("modules"),function(e){e.title=e.title.replace(/%%/g,'"'),e.title=e.title.replace(/\|\|/g,"'")})},addView:function(e,t){var i=this.get("views");i[e]=t,this.set({views:i})},getView:function(e){return this.get("views")[e]},getChildViews:function(e){var t=this.get("views"),i={};return _.each(t,function(t,o){void 0!==t&&t.model.attributes.parent===e&&(i[o]=t)}),i},getChildrenViews:function(e){var t=this,i=t.get("views"),o={},n=void 0;return _.each(i,function(i,a){void 0!==i&&i.model.attributes.parent===e&&(n=t.getChildrenViews(i.model.attributes.cid),_.isEmpty(n)||_.extend(o,n),o[a]=i)}),o},getParentViews:function(e){for(var t=this.getView(e),i={};!_.isUndefined(t);)i[t.model.attributes.cid]=t,t=this.getView(t.model.attributes.parent);return i},getSectionView:function(e){var t,i=this.getParentViews(e);return t=_.filter(i,function(e){return"section"===e.model.attributes.type}),!_.isUndefined(t[0])&&t[0]},setNewParentID:function(e,t){var i=this.get("views");i[e].model.attributes.parent=t,this.set({views:i})},removeView:function(e){var t=this.get("views"),i={};_.each(t,function(t,o){o!=e&&(i[o]=t)}),this.set({views:i})},generateNewId:function(){var e=this.get("moduleNumber")+1;return this.set({moduleNumber:e}),e},generateTemplateName:function(t){return-1!==e.inArray(t,["row","row_inner","section","column","column_inner"])&&(t="et_pb_"+t),"#et-builder-"+t+"-module-template"},getModuleOptionsNames:function(e){var t=this.get("modules");return this.addAdminLabel(_.findWhere(t,{label:e}).options)},getNumberOf:function(e,t){var i=this.get("views"),o=0;return _.each(i,function(i){if(void 0!==i){var n=i.model.attributes.type;i.model.attributes.parent!==t||n!==e&&n!==e+"_inner"||o++}}),o},getNumberOfModules:function(e){var t=this.get("views"),i=0;return _.each(t,function(t){void 0!==t&&t.model.attributes.type===e&&i++}),i},getTitleByShortcodeTag:function(e){var t=this.get("modules"),i=_.findWhere(t,{label:e});return _.isUndefined(i)?e:i.title},getDefaultAdminLabel:function(t){return e.inArray(t,["section","row","column","row_inner","column_inner"])>-1?void 0!==et_pb_options.noun[t]?et_pb_options.noun[t]:t:this.getTitleByShortcodeTag(t)},isModuleFullwidth:function(e){var t=this.get("modules");return"on"===_.findWhere(t,{label:e}).fullwidth_only},isChildrenLocked:function(e){var t=this.getChildrenViews(e),i=!1;return _.each(t,function(e){"on"!==e.model.get("et_pb_locked")&&"on"!==e.model.get("et_pb_parent_locked")||(i=!0)}),i},addAdminLabel:function(e){return _.union(e,["admin_label"])},removeGlobalAttributes:function(e,t){var i=this,o=(t=!_.isUndefined(t)&&t,_.isUndefined(e.model.attributes.global_parent_cid)?e.model.attributes.cid:e.model.attributes.global_parent_cid),n=this.getView(o),a=this.getChildrenViews(o);this.is_global(n.model)&&(t&&n.model.set("et_pb_temp_global_module",n.model.get("et_pb_global_module")),n.model.unset("et_pb_global_module")),_.each(a,function(e){i.is_global_children(e.model)&&(t&&e.model.set("et_pb_temp_global_parent",e.model.get("et_pb_global_parent")),e.model.unset("et_pb_global_parent")),i.has_global_parent_cid(e.model)&&(t&&e.model.set("et_pb_temp_global_parent_cid",e.model.get("global_parent_cid")),e.model.unset("global_parent_cid"))})},removeTemporaryGlobalAttributes:function(e,t){var i=this,o=(t=!_.isUndefined(t)&&t,(_.isUndefined(e.model.attributes.et_pb_temp_global_module)?j.findWhere({et_pb_temp_global_module:e.model.attributes.et_pb_temp_global_parent}):e.model).attributes.cid),n=y.getView(o),a=y.getChildrenViews(o);this.is_temp_global(n.model)&&(t&&n.model.set("et_pb_global_module",n.model.get("et_pb_temp_global_module")),n.model.unset("et_pb_temp_global_module")),_.each(a,function(e){i.is_temp_global_children(e.model)&&(t&&e.model.set("et_pb_global_parent",e.model.get("et_pb_temp_global_parent")),e.model.unset("et_pb_temp_global_parent")),i.has_temp_global_parent_cid(e.model)&&(t&&e.model.set("global_parent_cid",e.model.get("et_pb_temp_global_parent_cid")),e.model.unset("et_pb_temp_global_parent_cid"))}),t&&Ie(o)},is_app:function(e){return"app"===e.attributes.type},is_global:function(e){return!this.is_app(e)&&!(!e.has("et_pb_global_module")||""===e.get("et_pb_global_module"))},is_global_children:function(e){return!this.is_app(e)&&!(!e.has("et_pb_global_parent")||""===e.get("et_pb_global_parent"))},has_global_parent_cid:function(e){return!(!e.has("global_parent_cid")||""===e.get("global_parent_cid"))},is_temp_global:function(e){return!(!e.has("et_pb_temp_global_module")||""===e.get("et_pb_temp_global_module"))},is_temp_global_children:function(e){return!(!e.has("et_pb_temp_global_parent")||""===e.get("et_pb_temp_global_parent"))},has_temp_global_parent_cid:function(e){return!(!e.has("et_pb_temp_global_parent_cid")||""===e.get("et_pb_temp_global_parent_cid"))},changeColumnStructure:function(t,i,o,n){var a=i.layout.split(","),s=i.specialty_columns,l=i.layout_specialty,d=_.size(a),r=t.options.view,p=Pe(t);if(i.is_structure_change){var c=y.getChildViews(t.model.get("cid")),b=[],u=0;_.each(c,function(e){b[u]=e.model.get("cid"),u+=1})}if(_.each(a,function(e,i){var o=d==i+1?"true":"false",n={type:"column",cid:y.generateNewId(),parent:t.model.get("cid"),layout:e,view:r};void 0!==t.model.get("et_pb_global_parent")&&""!==t.model.get("et_pb_global_parent")&&(n.et_pb_global_parent=t.model.get("et_pb_global_parent"),n.global_parent_cid=t.model.get("global_parent_cid")),void 0!==l[i]&&"1"===l[i]&&(n.layout_specialty=l[i],n.specialty_columns=parseInt(s)),void 0!==t.model.get("specialty_row")&&(t.model.set("module_type","row_inner",{silent:!0}),t.model.set("type","row_inner",{silent:!0})),t.collection.add([n],{update_shortcodes:o})}),i.is_structure_change){var g=[];c=y.getChildViews(t.model.get("cid")),u=0,_.each(c,function(e){g[u]=e.model.get("cid"),u+=1}),g.splice(0,b.length);for(var h=0;h<b.length;h++){var f,v=!!(b.length>g.length&&h>g.length-1),w=b[h],k=v?g[g.length-1]:g[h],C=y.getView(w).$el.html(),S=y.getChildViews(w),x="";y.getView(w).model.destroy(),y.getView(w).remove(),y.removeView(w),f=e('.et-pb-column[data-cid="'+k+'"]'),v?(f.find(".et-pb-insert-module").remove(),x=f.html(),f.html(x+C)):f.html(C),_.each(S,function(e){e.model.set("parent",k,{silent:!0})})}V.allowHistorySaving("edited","column")}(void 0!==t.model.get("template_type")&&"section"===t.model.get("template_type")&&"on"===t.model.get("et_pb_specialty")||!o)&&Ue(),void 0!==t.model.get("et_pb_template_type")&&"row"===t.model.get("et_pb_template_type")&&De("_et_pb_row_layout",i.layout),void 0!==p&&""!==p&&Ie(p),n||V.allowHistorySaving("added","column"),m.trigger("et-add:columns")}}),a.Modules=Backbone.Collection.extend({model:a.Module}),a.SavedTemplates=Backbone.Collection.extend({model:a.SavedTemplate}),a.Histories=Backbone.Collection.extend({model:a.History}),a.TemplatesView=window.wp.Backbone.View.extend({className:"et_pb_saved_layouts_list",tagName:"ul",render:function(){var t="",i=void 0===this.options.category?"all":this.options.category;return this.collection.each(function(o){if("all"===i||-1!==e.inArray(i,o.get("categories"))){var n=new a.SingleTemplateView({model:o});this.$el.append(n.el),t=void 0!==n.model.get("is_global")&&"global"===n.model.get("is_global")?"global":""}},this),"global"===t&&this.$el.addClass("et_pb_global"),this}}),a.SingleTemplateView=window.wp.Backbone.View.extend({tagName:"li",template:_.template(e("#et-builder-saved-entry").html()),events:{click:"insertSection"},initialize:function(){this.render()},render:function(){this.$el.html(this.template(this.model.toJSON())),void 0!==this.model.get("module_type")&&""!==this.model.get("module_type")&&"module"===this.model.get("layout_type")&&this.$el.addClass(this.model.get("module_type"))},insertSection:function(t){var i=e(t.target),o=void 0!==i.closest(".et_pb_modal_settings").data("parent_cid")?i.closest(".et_pb_modal_settings").data("parent_cid"):"",n=void 0!==e(".et-pb-settings-heading").data("current_row")?e(".et-pb-settings-heading").data("current_row"):"",a="global"===this.model.get("is_global")?this.model.get("ID"):"",s=void 0!==e(".et-pb-saved-modules-switcher").data("specialty_columns")?"on":"off",l=this.model.get("shortcode"),_=this.model.get("unsynced_options"),d=!1,r="row"===this.model.get("layout_type")?n:o,p=y.getView(r),c="row_inner"===this.options.model.get("layout_type")?"saved_row":"saved_"+this.options.model.get("layout_type"),b=i.closest(".et_pb_modal_settings_container"),u=Pe(p);"on"===s&&(r=p.model.get("parent"),p=y.getView(r)),"section"!==this.model.get("layout_type")&&""!==u&&(d=!0,a=""),V.allowHistorySaving("added",c),t.preventDefault(),l=V.codeModuleContentPrep(l),void 0!==window.switchEditors&&(l=qe(window.switchEditors.wpautop(l))),l=V.codeModuleContentUnPrep(l),V.createLayoutFromContent(l,o,"",{ignore_template_tag:"ignore_template",current_row_cid:n,global_id:a,after_section:o,is_reinit:"reinit",unsynced_options:_}),Ue(),!0===d&&Ie(u),b.length&&b.find(".et-pb-modal-close").click()}}),a.TemplatesModal=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-load_layout-template").html()),events:{"click .et-pb-options-tabs-links li a":"switchTab"},render:function(){return this.$el.html(this.template({display_switcher:"off"})),this.$el.addClass("et_pb_modal_no_tabs"),this},switchTab:function(t){var i=e(t.currentTarget).parent();t.preventDefault(),Ee(i,"section","")}}),a.SectionView=window.wp.Backbone.View.extend({className:"et_pb_section",template:_.template(e("#et-builder-section-template").html()),events:{"click .et-pb-settings-section":"showSettings","click .et-pb-clone-section":"cloneSection","click .et-pb-remove-section":"removeSection","click .et-pb-section-add-main":"addSection","click .et-pb-section-add-fullwidth":"addFullwidthSection","click .et-pb-section-add-specialty":"addSpecialtySection","click .et-pb-section-add-saved":"addSavedSection","click .et-pb-expand":"expandSection","click .et-pb-insert-row":"addFirstRow","contextmenu .et-pb-section-add":"showRightClickOptions","click.et_pb_section > .et-pb-controls .et-pb-unlock":"unlockSection","contextmenu.et_pb_section > .et-pb-controls":"showRightClickOptions","contextmenu.et_pb_row > .et-pb-right-click-trigger-overlay":"showRightClickOptions","click.et_pb_section > .et-pb-controls":"hideRightClickOptions","click.et_pb_row > .et-pb-right-click-trigger-overlay":"hideRightClickOptions","click > .et-pb-locked-overlay":"showRightClickOptions","contextmenu > .et-pb-locked-overlay":"showRightClickOptions",click:"setABTesting"},initialize:function(){this.child_views=[],this.listenTo(this.model,"change:admin_label",this.renameModule),this.listenTo(this.model,"change:et_pb_disabled",this.toggleDisabledClass)},render:function(){return this.$el.html(this.template(this.model.toJSON())),"on"===this.model.get("et_pb_specialty")&&(this.$el.addClass("et_pb_section_specialty"),"true"===this.model.get("et_pb_specialty_placeholder")&&this.$el.addClass("et_pb_section_placeholder")),"on"!==this.model.get("et_pb_specialty")&&"on"!==this.model.get("et_pb_fullwidth")||this.$el.find(".et-pb-insert-row").remove(),(void 0!==this.model.get("et_pb_global_module")||void 0!==this.model.get("et_pb_template_type")&&"section"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&this.$el.addClass("et_pb_global"),void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")&&this.$el.addClass("et_pb_disabled"),void 0!==this.model.get("et_pb_locked")&&"on"===this.model.get("et_pb_locked")&&this.$el.addClass("et_pb_locked"),void 0!==this.model.get("et_pb_collapsed")&&"on"===this.model.get("et_pb_collapsed")&&this.$el.addClass("et_pb_collapsed"),void 0!==this.model.get("pasted_module")&&this.model.get("pasted_module")&&Y(this.$el),_.isUndefined(this.model.get("et_pb_temp_global_module"))||this.$el.addClass("et_pb_global_temp"),J.is_active()&&(J.is_subject(this.model)&&(this.$el.addClass("et_pb_ab_subject"),J.set_subject_rank_coloring(this)),J.is_goal(this.model)&&this.$el.addClass("et_pb_ab_goal"),J.is_user_has_permission(this.model.get("cid"),"section")||this.$el.addClass("et_pb_ab_no_permission")),this.makeRowsSortable(),this},showSettings:function(t){var i,o=this,n=void 0!==t?e(t.currentTarget):"",s=void 0,l={model:this.model,collection:this.collection,attributes:{"data-open_view":"module_settings"},triggered_by_right_click:this.triggered_by_right_click,do_preview:this.do_preview};if(void 0!==t&&t.preventDefault(),!this.isSectionLocked()&&!V.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"section")){if(""!==n&&n.closest(".et_pb_section_specialty").length){var _=n.closest(".et_pb_section_specialty").find(".et-pb-section-content > .et-pb-column"),d="";_.length&&_.each(function(){d+=""===d?"1_1":",1_1"}),l.model.attributes.columns_layout=d}if(!1===(i=(s=new a.ModalView(l)).render()))return k(!0),setTimeout(function(){o.showSettings()},500),void m.trigger("et-pb-loading:started");m.trigger("et-pb-loading:ended"),e("body").append(i.el),(void 0!==s.model.get("et_pb_global_module")&&""!==s.model.get("et_pb_global_module")||void 0!==this.model.get("et_pb_template_type")&&"section"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal"),void 0!==this.model.get("et_pb_specialty")&&"on"===this.model.get("et_pb_specialty")&&e(".et_pb_modal_settings_container").addClass("et_pb_specialty_section_settings"),Re()}else J.alert("has_no_permission")},addSection:function(e){var t=y.generateNewId();e.preventDefault(),i(),V.isLoading||J.is_selecting()||(V.allowHistorySaving("added","section"),this.collection.add([{type:"section",module_type:"section",et_pb_fullwidth:"off",et_pb_specialty:"off",cid:t,view:this,created:"auto",admin_label:et_pb_options.noun.section}]))},addFullwidthSection:function(e){var t=y.generateNewId();e.preventDefault(),i(),V.isLoading||J.is_selecting()||(V.allowHistorySaving("added","fullwidth_section"),this.collection.add([{type:"section",module_type:"section",et_pb_fullwidth:"on",et_pb_specialty:"off",cid:t,view:this,created:"auto",admin_label:et_pb_options.noun.section}]))},addSpecialtySection:function(t){var o=y.generateNewId(),n=e(t.target),a=void 0!==n&&void 0!==n.data("is_template")?"section":"";t.preventDefault(),i(),V.isLoading||J.is_selecting()||(V.allowHistorySaving("added","specialty_section"),this.collection.add([{type:"section",module_type:"section",et_pb_fullwidth:"off",et_pb_specialty:"on",cid:o,template_type:a,view:this,created:"auto",admin_label:et_pb_options.noun.section}]))},addSavedSection:function(t){var o={attributes:{"data-open_view":"saved_templates","data-parent_cid":this.model.get("cid")},view:this},n=new a.ModalView(o);i(),V.isLoading||J.is_selecting()||(e("body").append(n.render().el),Ae("include_global","","section",e(".et-pb-saved-modules-tab"),"regular",0,"all"),t.preventDefault())},expandSection:function(e){e.preventDefault(),this.$el.closest(".et_pb_section").removeClass("et_pb_collapsed"),this.options.model.attributes.et_pb_collapsed="off",J.is_active()&&"on"===this.model.get("et_pb_ab_subject")&&J.subject_carousel(this.model.get("cid")),V.allowHistorySaving("expanded","section"),V.saveAsShortcode()},unlockSection:function(e){if(e.preventDefault(),!V.isLoading&&!J.is_selecting()){var t=this,i=t.$el.closest(".et_pb_section"),o=Ne(),n=void 0;o.done(function(e){!0===e?(i.removeClass("et_pb_locked"),t.options.model.attributes.et_pb_locked="off",n=y.getChildrenViews(t.model.get("cid")),_.each(n,function(e,t){e.$el.removeClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","off",{silent:!0})}),V.allowHistorySaving("unlocked","section"),V.saveAsShortcode()):alert(et_pb_options.locked_section_permission_alert)})}},addFirstRow:function(){if(!V.isLoading){var e=y.generateNewId(),t=void 0!==this.model.get("et_pb_global_module")&&""!==this.model.get("et_pb_global_module")?this.model.get("et_pb_global_module"):"",i=""!==t?this.model.get("cid"):"";this.collection.add([{type:"row",module_type:"row",cid:e,parent:this.model.get("cid"),view:this,et_pb_global_parent:t,global_parent_cid:i,admin_label:et_pb_options.noun.row}]),y.getView(e).displayColumnsOptions()}},addRow:function(e){if(!V.isLoading){var t=y.generateNewId(),i=void 0!==this.model.get("et_pb_global_module")&&""!==this.model.get("et_pb_global_module")?this.model.get("et_pb_global_module"):"",o=""!==i?this.model.get("cid"):"";this.collection.add([{type:"row",module_type:"row",cid:t,parent:this.model.get("cid"),view:this,appendAfter:e,et_pb_global_parent:i,global_parent_cid:o,admin_label:et_pb_options.noun.row}]),y.getView(t).displayColumnsOptions()}},cloneSection:function(e){if(e.preventDefault(),!this.isSectionLocked()&&!V.isLoading&&!J.is_selecting()){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid"),"section"))return void J.alert("has_no_permission");if(J.has_goal(this.model)&&!J.is_subject(this.model))return void J.alert("cannot_clone_section_has_goal")}this.$el.clone();var t=void 0,i={model:this.model,view:this.$el,view_event:e};t=new a.RightClickOptionsView(i,!0),V.allowHistorySaving("cloned","section"),t.copy(e),t.pasteAfter(e)}},makeRowsSortable:function(){var t=this,o="on"!==t.model.get("et_pb_fullwidth")?".et-pb-section-content":".et_pb_fullwidth_sortable_area",n=":not(.et_pb_locked) > "+o;"on"!==t.model.get("et_pb_specialty")&&(J.is_active()&&!J.is_user_has_permission(this.model.get("cid"),"section")||t.$el.find(o).sortable({connectWith:n,delay:100,cancel:".et-pb-settings, .et-pb-clone, .et-pb-remove, .et-pb-row-add, .et-pb-insert-module, .et-pb-insert-column, .et-pb-insert-row, .et_pb_locked, .et-pb-disable-sort",update:function(i,n){var a=t.$el.find(o);if(V.isLoading)a.sortable("cancel");else{if(J.is_active()){if(!J.is_user_has_permission(e(n.item).children(".et-pb-row-content").attr("data-cid"),"row"))return J.alert("has_no_permission"),a.sortable("cancel"),void Ue();var s=e(n.item),l=_.isEmpty(e(n.sender))?e(i.target).parents(".et_pb_section"):e(n.sender).parents(".et_pb_section"),d=_.isEmpty(e(n.sender))?e(i.toElement).parents(".et_pb_section"):e(i.target).parents(".et_pb_section"),r=s.hasClass("et_pb_ab_subject"),p=s.hasClass("et_pb_ab_goal"),c=s.find(".et_pb_ab_subject").length,b=s.find(".et_pb_ab_goal").length,u=l.closest(".et_pb_ab_subject").length,g=d.closest(".et_pb_ab_subject").length,h=d.closest(".et_pb_ab_goal").length;if(p&&!r&&g)return J.alert("cannot_move_goal_into_subject"),a.sortable("cancel"),void Ue();if(b&&g)return J.alert("cannot_move_goal_into_subject"),a.sortable("cancel"),void Ue();if(r&&!p&&h)return J.alert("cannot_move_subject_into_goal"),a.sortable("cancel"),void Ue();if(c&&h)return J.alert("cannot_move_subject_into_goal"),a.sortable("cancel"),void Ue();p&&u&&(J.alert("cannot_move_row_goal_out_from_subject"),a.sortable("cancel"),Ue())}if(!e(n.item).closest(i.target).length)return e(i.target).find(".et_pb_row").length||(e(this).sortable("cancel"),alert(et_pb_options.section_only_row_dragged_away)),void(e(n.item).closest(".et-pb-disable-sort").length&&e(i.target).sortable("cancel"));var f=e(n.item).find(".et-pb-row-content").data("cid"),v=t.collection.find(function(e){return e.get("cid")==f});if(e(n.item).closest(".et_pb_section.et_pb_global").length&&e(n.item).hasClass("et_pb_global"))e(n.sender).sortable("cancel"),alert(et_pb_options.global_row_alert);else if((e(n.item).closest(".et_pb_section.et_pb_global").length||e(n.sender).closest(".et_pb_section.et_pb_global").length)&&""===et_pb_options.template_post_id){var w,k,C=void 0;if((w=e(n.sender).closest(".et_pb_section.et_pb_global"))===(k=e(n.item).closest(".et_pb_section.et_pb_global")))Ie(C=v.get("global_parent_cid")),Ue();else{var S=w;0!==k.length||(_.isUndefined(v.get("et_pb_global_parent"))||""===v.get("et_pb_global_parent"))&&_.isUndefined(v.get("global_parent_cid"))||(v.unset("et_pb_global_parent"),v.unset("global_parent_cid"),y.removeGlobalAttributes(y.getView(v.get("cid"))));for(var x=1;x<=2;x++)void 0!==(C=S.find(".et-pb-section-content").data("cid"))&&""!==C&&(Ie(C),Ue()),S=k}}y.setNewParentID(n.item.find(".et-pb-row-content").data("cid"),t.model.attributes.cid),V.allowHistorySaving("moved","row"),m.trigger("et-sortable:update");var $=parseInt(e(this).attr("data-cid")),T=0;e(this).find(".et-pb-row-content").each(function(){T++;var t=parseInt(e(this).data("cid")),i=$+T;j.findWhere({cid:t}).set({layout_index:i})}),j.comparator="layout_index",j.sort()}},start:function(t,o){if(i(),t.altKey){var n=y.getView(e(o.item).children(".et-pb-row-content").data("cid")),s={model:n.model,view:n.$el,view_event:t},l=new a.RightClickOptionsView(s,!0);l.copy(t,!0),l.pasteAfter(t,void 0,void 0,void 0,!0,!0),V.allowHistorySaving("cloned","row")}}}))},addChildView:function(e){this.child_views.push(e)},removeChildViews:function(){var e=y.getChildViews(this.model.attributes.cid);_.each(e,function(e){void 0!==e.model&&e.model.destroy(),e.remove()})},removeSection:function(e,t){var i=void 0,o=!1;if(e&&e.preventDefault(),!this.isSectionLocked()&&!y.isChildrenLocked(this.model.get("cid"))&&(!V.isLoading||!_.isUndefined(t)||y.get("forceRemove"))&&(!J.is_selecting()||!_.isUndefined(t)||y.get("forceRemove"))){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid"),"section"))return void J.alert("has_no_permission");if(J.is_unremovable_subject(this.model)&&_.isUndefined(t)&&!y.get("forceRemove"))return;if(J.has_goal(this.model)&&!J.is_subject(this.model)&&_.isUndefined(t)&&!y.get("forceRemove"))return void J.alert("cannot_remove_section_has_goal");if(J.has_unremovable_subject(this.model)&&_.isUndefined(t)&&!y.get("forceRemove"))return void J.alert("cannot_remove_section_has_unremovable_subject")}"on"===this.model.get("et_pb_fullwidth")?this.removeChildViews():(i=y.getChildViews(this.model.get("cid")),_.each(i,function(e){"column"===e.model.get("type")?e.removeColumn():e.removeRow(!1,!0)})),y.get("forceRemove")||"on"!==this.model.get("et_pb_specialty")&&"on"!==this.model.get("et_pb_fullwidth")||1!==y.getNumberOfModules("section")||(o=!0),(y.get("forceRemove")||o||y.getNumberOfModules("section")>1)&&(this.model.destroy(),y.removeView(this.model.get("cid")),this.remove()),o?V.removeAllSections(!0):(_.isUndefined(t)?V.allowHistorySaving("removed","section"):V.allowHistorySaving("cleared","layout"),e&&m.trigger("et-module:removed"),J.update())}},isSectionLocked:function(){return"on"===this.model.get("et_pb_locked")},showRightClickOptions:function(e){e.preventDefault();var t={model:this.model,view:this.$el,view_event:e};new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()},renameModule:function(){this.$(".et-pb-section-title").html(this.model.get("admin_label"))},toggleDisabledClass:function(){void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")?this.$el.addClass("et_pb_disabled"):this.$el.removeClass("et_pb_disabled")},setABTesting:function(e){e.preventDefault(),e.stopPropagation(),J.set(this,e)}}),a.RowView=window.wp.Backbone.View.extend({className:"et_pb_row",template:_.template(e("#et-builder-row-template").html()),events:{"click .et-pb-settings-row":"showSettings","click .et-pb-insert-column":"displayColumnsOptions","click .et-pb-clone-row":"cloneRow","click .et-pb-row-add":"addNewRow","click .et-pb-remove-row":"removeRow","click .et-pb-change-structure":"changeStructure","click .et-pb-expand":"expandRow","contextmenu .et-pb-row-add":"showRightClickOptions","click.et_pb_row > .et-pb-controls .et-pb-unlock":"unlockRow","contextmenu.et_pb_row > .et-pb-controls":"showRightClickOptions","contextmenu.et_pb_row > .et-pb-right-click-trigger-overlay":"showRightClickOptions","contextmenu .et-pb-column":"showRightClickOptions","click.et_pb_row > .et-pb-controls":"hideRightClickOptions","click.et_pb_row > .et-pb-right-click-trigger-overlay":"hideRightClickOptions","click > .et-pb-locked-overlay":"showRightClickOptions","contextmenu > .et-pb-locked-overlay":"showRightClickOptions",click:"setABTesting"},initialize:function(){this.listenTo(m,"et-add:columns",this.toggleInsertColumnButton),this.listenTo(this.model,"change:admin_label",this.renameModule),this.listenTo(this.model,"change:et_pb_disabled",this.toggleDisabledClass)},render:function(){var e=y.getParentViews(this.model.get("parent"));return void 0!==this.model.get("view")&&void 0!==this.model.get("view").model.get("layout_specialty")&&this.model.set("specialty_row","1",{silent:!0}),this.$el.html(this.template(this.model.toJSON())),(void 0!==this.model.get("et_pb_global_module")||void 0!==this.model.get("et_pb_template_type")&&"row"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&this.$el.addClass("et_pb_global"),void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")&&this.$el.addClass("et_pb_disabled"),void 0!==this.model.get("et_pb_locked")&&"on"===this.model.get("et_pb_locked")&&(this.$el.addClass("et_pb_locked"),_.each(e,function(e){e.$el.addClass("et_pb_children_locked")})),void 0!==this.model.get("et_pb_parent_locked")&&"on"===this.model.get("et_pb_parent_locked")&&this.$el.addClass("et_pb_parent_locked"),void 0!==this.model.get("et_pb_collapsed")&&"on"===this.model.get("et_pb_collapsed")&&this.$el.addClass("et_pb_collapsed"),void 0!==this.model.get("pasted_module")&&this.model.get("pasted_module")&&Y(this.$el),y.is_temp_global(this.model)&&this.$el.addClass("et_pb_global_temp"),J.is_active()&&(J.is_subject(this.model)&&(this.$el.addClass("et_pb_ab_subject"),J.set_subject_rank_coloring(this)),J.is_goal(this.model)&&this.$el.addClass("et_pb_ab_goal"),J.is_user_has_permission(this.model.get("cid"),"row")||this.$el.addClass("et_pb_ab_no_permission")),this},showSettings:function(t){var i,o=this,n=void 0,s={model:this.model,collection:this.collection,attributes:{"data-open_view":"module_settings"},triggered_by_right_click:this.triggered_by_right_click,do_preview:this.do_preview};if(void 0!==t&&t.preventDefault(),!this.isRowLocked()&&!V.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"row")){if(!1===(i=(n=new a.ModalView(s)).render()))return k(!0),setTimeout(function(){o.showSettings()},500),void m.trigger("et-pb-loading:started");m.trigger("et-pb-loading:ended"),e("body").append(i.el),(void 0!==n.model.get("et_pb_global_module")&&""!==n.model.get("et_pb_global_module")||y.getView(n.model.get("cid")).$el.closest(".et_pb_global").length||void 0!==this.model.get("et_pb_template_type")&&"row"===this.model.get("et_pb_template_type")&&"global"===et_pb_options.is_global_template)&&e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal")}else J.alert("has_no_permission")},displayColumnsOptions:function(t){if(t&&t.preventDefault(),!this.isRowLocked()&&!V.isLoading&&!J.is_selecting()){var i=void 0;this.model.set("open_view","column_settings",{silent:!0}),i=new a.ModalView({model:this.model,collection:this.collection,attributes:{"data-open_view":"column_settings"},view:this}),e("body").append(i.render().el),this.toggleInsertColumnButton()}},changeStructure:function(t){t.preventDefault();var i=void 0;this.isRowLocked()||V.isLoading||J.is_selecting()||(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"row")?(this.model.set("change_structure","true",{silent:!0}),this.model.set("open_view","column_settings",{silent:!0}),a.Events=m,i=new a.ModalView({model:this.model,collection:this.collection,attributes:{"data-open_view":"column_settings"},view:this}),e("body").append(i.render().el)):J.alert("has_no_permission"))},expandRow:function(e){e.preventDefault(),this.$el.closest(".et_pb_row").removeClass("et_pb_collapsed"),this.options.model.attributes.et_pb_collapsed="off",J.is_active()&&"on"===this.model.get("et_pb_ab_subject")&&J.subject_carousel(this.model.get("cid")),V.allowHistorySaving("expanded","row"),V.saveAsShortcode()},unlockRow:function(e){if(e.preventDefault(),!V.isLoading&&!J.is_selecting()){var t=this,i=t.$el.closest(".et_pb_row"),o=Ne(),n=void 0,a=void 0;o.done(function(e){!0===e?(i.removeClass("et_pb_locked"),t.options.model.attributes.et_pb_locked="off",n=y.getChildrenViews(t.model.get("cid")),_.each(n,function(e,t){e.$el.removeClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","off",{silent:!0})}),a=y.getParentViews(t.model.get("parent")),_.each(a,function(e,t){y.isChildrenLocked(e.model.get("cid"))||e.$el.removeClass("et_pb_children_locked")}),V.allowHistorySaving("unlocked","row"),V.saveAsShortcode()):alert(et_pb_options.locked_row_permission_alert)})}},toggleInsertColumnButton:function(){if(void 0!==this.model){var e,t=this.model.get("cid");e=this.collection.find(function(e){return("column"===e.get("type")||"column_inner"===e.get("type"))&&e.get("parent")===t}),_.isUndefined(e)||(this.$(".et-pb-insert-column").hide(),this.$(".et-pb-change-structure").show())}},addNewRow:function(t){var o=this.$el.closest(".et-pb-section-content"),n=e(t.currentTarget),a=n.closest(".et-pb-column-specialty").length?n.closest(".et-pb-column-specialty").data("cid"):o.data("cid"),s=y.getView(a),l="";t.preventDefault(),V.isLoading||(i(),"on"!==this.model.get("et_pb_parent_locked")&&(this.$el.closest(".et_pb_section.et_pb_global").length&&void 0===s.model.get("et_pb_template_type")&&(l=Pe(this)),!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"add_row")?(V.allowHistorySaving("added","row"),s.addRow(this.$el),""!==l&&Ie(l)):J.alert("has_no_permission")))},cloneRow:function(e){var t="",i=y.getView(this.model.get("parent")),o=void 0,n={model:this.model,view:this.$el,view_event:e};if(e.preventDefault(),!this.isRowLocked()&&!V.isLoading&&!J.is_selecting()){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid")))return void J.alert("has_no_permission");if(J.has_goal(this.model)&&!J.is_subject(this.model))return void J.alert("cannot_clone_row_has_goal")}this.$el.closest(".et_pb_section.et_pb_global").length&&void 0===i.model.get("et_pb_template_type")&&(t=Pe(this)),o=new a.RightClickOptionsView(n,!0),V.allowHistorySaving("cloned","row"),o.copy(e),o.pasteAfter(e),""!==t&&Ie(t)}},removeRow:function(e,t){var i,o="",n=y.getView(this.model.get("parent"));if(!this.isRowLocked()&&!y.isChildrenLocked(this.model.get("cid"))&&!V.isLoading&&(!J.is_selecting()||!_.isUndefined(t)||y.get("forceRemove"))){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid")))return void J.alert("has_no_permission");if(J.is_unremovable_subject(this.model)&&_.isUndefined(t)&&!y.get("forceRemove"))return;if(J.has_goal(this.model)&&!J.is_subject(this.model)&&_.isUndefined(t)&&!y.get("forceRemove"))return void J.alert("cannot_remove_row_has_goal");if(J.has_unremovable_subject(this.model)&&_.isUndefined(t)&&!y.get("forceRemove"))return void J.alert("cannot_remove_row_has_unremovable_subject")}e&&(e.preventDefault(),this.$el.closest(".et-pb-column-specialty").length&&e.stopPropagation(),this.$el.closest(".et_pb_section.et_pb_global").length&&void 0===n.model.get("et_pb_template_type")&&(o=Pe(this))),i=y.getChildViews(this.model.get("cid")),_.each(i,function(e){e.removeColumn()}),y.get("forceRemove")||y.getNumberOf("row",this.model.get("parent"))>1?(this.model.destroy(),y.removeView(this.model.get("cid")),this.remove()):(this.$(".et-pb-insert-column").show(),this.$(".et-pb-change-structure").hide(),Ue()),V.allowHistorySaving("removed","row"),e&&m.trigger("et-module:removed"),""!==o&&Ie(o),J.update()}},isRowLocked:function(){return"on"===this.model.get("et_pb_locked")||"on"===this.model.get("et_pb_parent_locked")},showRightClickOptions:function(t){t.preventDefault();var i,o=e(t.target);o.closest(".et-pb-insert-module").length||o.closest(".et-pb-insert-row").length||o.hasClass("et_pb_module_block")||o.closest(".et_pb_module_block").length||(i={model:this.model,view:this.$el,view_event:t},new a.RightClickOptionsView(i))},hideRightClickOptions:function(e){e.preventDefault(),i()},renameModule:function(){this.$(".et-pb-row-title").html(this.model.get("admin_label"))},toggleDisabledClass:function(){void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")?this.$el.addClass("et_pb_disabled"):this.$el.removeClass("et_pb_disabled")},setABTesting:function(e){e.preventDefault(),e.stopPropagation(),J.set(this,e)}}),a.ModalView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings_container",template:_.template(e("#et-builder-modal-template").html()),events:{"click .et-pb-modal-save":"saveSettings","click .et-pb-modal-preview-template":"preview","click .et-pb-preview-mobile":"resizePreviewScreen","click .et-pb-preview-tablet":"resizePreviewScreen","click .et-pb-preview-desktop":"resizePreviewScreen","click .et-pb-modal-close":"closeModal","click .et-pb-modal-save-template":"saveTemplate","change #et_pb_select_category":"applyFilter"},initialize:function(e){this.listenTo(m,"et-add:columns",this.removeView),this.listenTo(m,"et-new_module:show_settings",this.removeView),this.listenTo(m,"et-saved_layout:loaded",this.removeView),this.options=e},render:function(){var t=void 0,i={model:this.model,collection:this.collection,view:this.options.view},o=!1;if(this.$el.attr("tabindex",0),void 0===this.model||void 0===this.model.get("view")||"row_inner"!==this.model.get("module_type")&&"row"!==this.model.get("module_type")||this.model.get("parent")===this.model.get("view").$el.data("cid")||this.model.set("view",y.getView(this.model.get("parent")),{silent:!0}),"all_modules"===this.attributes["data-open_view"]&&"section"===this.model.get("module_type")&&"on"===this.model.get("et_pb_fullwidth")&&(this.model.set("type","column",{silent:!0}),o=!0),void 0!==this.model){var s=y.getView(this.model.get("parent"));"column_specialty_settings"===this.attributes["data-open_view"]&&this.model.set("open_view","column_specialty_settings",{silent:!0}),this.$el.html(this.template(this.model.toJSON())),"column_specialty_settings"===this.attributes["data-open_view"]&&this.model.unset("open_view","column_specialty_settings",{silent:!0})}else this.$el.html(this.template());if(o&&this.model.set("type","section",{silent:!0}),this.container=this.$(".et-pb-modal-container"),"column_settings"===this.attributes["data-open_view"])t=new a.ColumnSettingsView(i);else if("all_modules"===this.attributes["data-open_view"])i.attributes={"data-parent_cid":this.model.get("cid")},t=new a.ModulesView(i);else if("module_settings"===this.attributes["data-open_view"]){var l=this.model.get("module_type");"row"!==l||_.isUndefined(s)||"column"!==s.model.get("type")||(l="row_inner"),i.attributes={"data-module_type":l},i.view=this,t=new a.ModuleSettingsView(i)}else"save_layout"===this.attributes["data-open_view"]?t=new a.SaveLayoutSettingsView(i):"column_specialty_settings"===this.attributes["data-open_view"]?t=new a.ColumnSettingsView(i):"saved_templates"===this.attributes["data-open_view"]?t=new a.TemplatesModal({attributes:{"data-parent_cid":this.attributes["data-parent_cid"]}}):"help"===this.attributes["data-open_view"]&&(t=new a.HelpView);if(void 0!==t.attributes&&"no_template"===t.attributes["data-no_template"])return!1;if(this.container.append(t.render().el),"column_settings"===this.attributes["data-open_view"]&&this.model.unset("open_view",{silent:!0}),"all_modules"===this.attributes["data-open_view"]){var d=e(t.render().el);d.find("li.et_pb_post_content, li.et_pb_fullwidth_post_content").remove(),"section"===this.model.get("module_type")&&n("undefined"!==this.model.get("et_pb_fullwidth"))&&"on"===this.model.get("et_pb_fullwidth")?d.find(".et-pb-all-modules li:not(.et_pb_fullwidth_only_module)").remove():d.find("li.et_pb_fullwidth_only_module").remove()}if(e(".et_pb_modal_overlay").length&&(e(".et_pb_modal_overlay").remove(),e("body").removeClass("et_pb_stop_scroll")),e("body").hasClass("et_pb_modal_fade_in")?e("body").append('<div class="et_pb_modal_overlay et_pb_no_animation"></div>'):e("body").append('<div class="et_pb_modal_overlay"></div>'),e("body").addClass("et_pb_stop_scroll"),this.isABTestingModule()){var r=e(t.render().el).closest(".et_pb_modal_settings_container");r.addClass("has_ab_testing_module"),r.find(".et-pb-modal-save-template").remove()}return this},closeModal:function(t){t.preventDefault(),e(".et_modal_on_top").length?e(".et_modal_on_top").remove():(void 0!==this.model&&"module"===this.model.get("type")&&this.$(".wp-editor-area").length&&(se("et_pb_content"),se("et_pb_description"),se("et_pb_footer_content")),Ve(this),X(this,"trigger_event"))},removeView:function(){if(void 0===this.model||"row"===this.model.get("type")||"column"===this.model.get("type")||"row_inner"===this.model.get("type")||"column_inner"===this.model.get("type")||"section"===this.model.get("type")&&("on"===this.model.get("et_pb_fullwidth")||"on"===this.model.get("et_pb_specialty")))if(void 0!==this.model&&void 0!==this.model.get("type")&&("column"===this.model.get("type")||"column_inner"===this.model.get("type")||"section"===this.model.get("type")&&"on"===this.model.get("et_pb_fullwidth"))){e(this.el).find(".et-pb-main-settings.active-container").hasClass("et-pb-saved-modules-tab")?X(this):(this.remove(),e("body").addClass("et_pb_modal_fade_in"),e(".et_pb_modal_overlay").addClass("et_pb_no_animation"),setTimeout(function(){e(".et_pb_modal_settings_container").addClass("et_pb_no_animation"),e("body").removeClass("et_pb_modal_fade_in")},500))}else X(this);else this.removeOverlay()},saveSettings:function(t,i){var o="",n=y.getView(this.model.get("cid")),a=(_.isUndefined(this.model.get("parent"))||y.getView(this.model.get("parent")),n),s=(i=!!_.isUndefined(i)||i,"not-allowed"===e(t.target).css("cursor"));if(_.isUndefined(a.model.get("et_pb_global_module")))for(;!_.isUndefined(a.model.get("parent"))&&""===o;)a=y.getView(a.model.get("parent")),o=""!==o||_.isUndefined(a.model.get("et_pb_global_module"))?o:a.model.get("cid");else o=a.model.get("cid");t.preventDefault(),s||(e("#publish").addClass("disabled"),V.disable_publish=!0,(void 0!==a.model.get("global_parent_cid")&&""!==a.model.get("global_parent_cid")||void 0!==a.model.get("et_pb_global_module")&&""!==a.model.get("et_pb_global_module"))&&(o=void 0!==a.model.get("global_parent_cid")?a.model.get("global_parent_cid"):a.model.get("cid")),this.performSaving(),""!==o&&Ie(o),V.allowHistorySaving("edited",this.model.get("type"),this.model.get("admin_label")),i&&(se("et_pb_content"),se("et_pb_description"),se("et_pb_footer_content"),Ve(this),X(this,"trigger_event"),J.is_active()&&J.set_subject_rank_coloring(n)))},preview:function(t){var i,o=this.model.get("cid"),n=e(t.target).is("a")?e(t.target):e(t.target).parent("a"),a=e(t.target).parents(".et-pb-modal-container"),s=void 0,l=void 0,d=document.documentMode;if(t.preventDefault(),_.isUndefined(this.options.triggered_by_right_click)?this.saveSettings(t,!1):delete this.options.triggered_by_right_click,_.isUndefined(this.options.do_preview)||delete this.options.do_preview,"1"===et_pb_options.is_divi_library&&e.inArray(et_pb_options.layout_type,["row","module"])>-1?o=void 0:"section"!==this.model.get("type")&&(l=y.getSectionView(this.model.get("parent")),_.isUndefined(l)||(o=l.model.attributes.cid)),i=V.generateCompleteShortcode(o),s={et_pb_preview_nonce:et_pb_options.et_pb_preview_nonce,shortcode:i,post_title:e("#title").val(),post_id:et_pb_options.postId},n.toggleClass("active"),a.toggleClass("et-pb-item-previewing"),n.hasClass("active")){var r=e("<iframe />",{id:"et-pb-preview-screen",src:et_pb_options.preview_url+"&et_pb_preview_nonce="+et_pb_options.et_pb_preview_nonce}),p=!1;e(".et-pb-preview-tab").html(r),e("#et-pb-preview-screen").load(function(){if(!p){var e=document.getElementById("et-pb-preview-screen");!_.isUndefined(d)&&d<10&&(s=JSON.stringify(s)),e.contentWindow.postMessage(s,et_pb_options.preview_url),p=!0}})}else e(".et-pb-preview-tab").empty(),e(".et-pb-preview-screensize-switcher a").removeClass("active"),e(".et-pb-preview-desktop").addClass("active")},resizePreviewScreen:function(t){t.preventDefault();var i=e(t.target),o=_.isUndefined(i.data("width"))?"100%":i.data("width");e(".et-pb-preview-screensize-switcher a").removeClass("active"),i.addClass("active"),e("#et-pb-preview-screen").animate({width:o})},getAttr:function(e,t){return _.isUndefined(e[t])?"":e[t]},performSaving:function(t){var i={},o=[],s={},l=void 0!==t&&""!==t?t:"input, select, textarea, #et_pb_content_main",d=this.model.get("module_type"),r=this.model.get("_address"),p=void 0;if(d=-1===d.indexOf("et_pb_")?"et_pb_"+d:d,(p=e(this)[0].$el.find("form.validate")).length){var c=p.validate();if(!c.form())return Te("failed form validation"),Te("failed elements: "),Te(c.errorList),void c.focusInvalid();Te("passed form validation")}var b="global"===et_pb_options.is_global_template?et_pb_options.template_post_id:this.model.get("et_pb_global_module");if(e(".et_pb_global_sync_switcher").length>0&&void 0!==b&&""!==b){var u=[];e(".et_pb_global_unsynced").length>0&&e(".et_pb_global_unsynced").each(function(){var t=e(this),i=t.data("option_name");i=_.includes(["content","raw_content"],i)?"et_pb_content_field":i,u.push(i),_.isUndefined(t.data("additional_options"))||"mobile"!==t.data("additional_options")||(u.push(i+"_tablet"),u.push(i+"_phone"))}),g[b]=u,"global"===et_pb_options.is_global_template&&0!==e("#et_pb_unsynced_global_attrs").length&&e("#et_pb_unsynced_global_attrs").val(JSON.stringify(u))}a.Events.trigger("et-modal-settings:save",this);var h=!_.isUndefined(et_pb_options.et_pb_module_settings_migrations)&&et_pb_options.et_pb_module_settings_migrations,f=!_.isUndefined(h.name_changes)&&h.name_changes;f&&!_.isUndefined(f[r])&&(_.forEach(f[r],function(e,t){o.push("et_pb_"+t)}),delete et_pb_options.et_pb_module_settings_migrations.name_changes[r]),this.$(l).each(function(){var t=e(this),n=ve(t)||"",l=t.is("#et_pb_content_main")?"et_pb_content":t.attr("id");if(t.is(":checkbox")&&(l=t.attr("name")),void 0===l||-1!==l.indexOf("qt_")&&"button"===t.attr("type"))return!0;if(t.hasClass("et-pb-helper-field"))return!0;if(t.is(":checkbox")&&void 0!==i[l])return!0;var d=l.indexOf("divider_color")>-1;t.hasClass("et-pb-color-picker-hex")&&new Color(t.val()).error&&!t.hasClass("et-pb-is-cleared")&&!d&&t.val(t.data("selected-value")),""!==(n=""+n)&&(s[l]=n);var r,p,c=a.Helpers.getSettingValue(t);r=c,p=n,(t.hasClass("et-pb-range-input")?_.isEqual(parseFloat(r),parseFloat(p)):_.isEqual(r,p))?o.push(l):i[l]=c}),i.module_defaults=s;var m=this.model.attributes,v=this.model._previousAttributes,w=m.type,y=_.isUndefined(i.et_pb_custom_padding_last_edited)?[]:i.et_pb_custom_padding_last_edited.split("|"),k="object"===(void 0===y?"undefined":n(y))&&"on"===y[0],C=this.getAttr(i,"et_pb_custom_padding")!==this.getAttr(v,"et_pb_custom_padding"),S=k&&this.getAttr(i,"et_pb_custom_padding_tablet")!==this.getAttr(v,"et_pb_custom_padding_tablet"),x=k&&this.getAttr(i,"et_pb_custom_padding_phone")!==this.getAttr(v,"et_pb_custom_padding_phone"),j=C||S||x;if("section"===w&&(k||j)&&(i.et_pb_padding_mobile=""),"row"===w||"row_inner"===w){(k||j)&&(i.et_pb_padding_mobile="");for(var $=void 0===m.columns_layout?0:m.columns_layout.split(",").length,V=1;V<=$;V++){var T=i["et_pb_padding_"+V+"_last_edited"],U=void 0===T?[]:T.split("|"),O="object"===(void 0===U?"undefined":n(U))&&"on"===U[0],A=this.getAttr(i,"et_pb_padding_top_"+V)!==this.getAttr(v,"et_pb_padding_top_"+V),M=this.getAttr(i,"et_pb_padding_right_"+V)!==this.getAttr(v,"et_pb_padding_right_"+V),L=this.getAttr(i,"et_pb_padding_bottom_"+V)!==this.getAttr(v,"et_pb_padding_bottom_"+V),E=this.getAttr(i,"et_pb_padding_left_"+V)!==this.getAttr(v,"et_pb_padding_left_"+V),D=A||M||L||E,I=O&&this.getAttr(i,"et_pb_padding_"+V+"_tablet")!==this.getAttr(v,"et_pb_padding_"+V+"_tablet"),P=O&&this.getAttr(i,"et_pb_padding_"+V+"_phone")!==this.getAttr(v,"et_pb_padding_"+V+"_phone");if(O||(D||I||P)){i.et_pb_column_padding_mobile="";break}}}this.model.set(i),o.map(this.model.unset.bind(this.model))},isABTestingModule:function(){var e=this.model;return J.is_active()&&(J.is_subject(e)||J.has_subject(e)||J.is_goal(e)||J.has_goal(e))},saveTemplate:function(t){var i=-1!==this.model.get("module_type").indexOf("fullwidth")?"fullwidth":"regular",o=void 0!==this.model.get("columns_layout")?this.model.get("columns_layout"):"0",n="not-allowed"===e(t.target).css("cursor")||this.isABTestingModule();t.preventDefault(),n||G("save_template",this,i,o)},removeOverlay:function(){var t=e(".et_pb_modal_overlay");if(t.length&&(t.addClass("et_pb_overlay_closing"),setTimeout(function(){t.remove(),e("body").removeClass("et_pb_stop_scroll")},600)),!_.isUndefined(V.disable_publish))setTimeout(function(){_.isUndefined(V.disable_publish)||(e("#publish").removeClass("disabled"),delete V.disable_publish)},3e3)},applyFilter:function(t){var i=e(t.target),o=i.data("attr"),n=i.val();o.append_to.html(""),Ae(o.include_global,"",o.layout_type,o.append_to,o.module_width,o.specialty_cols,n)}}),a.ColumnView=window.wp.Backbone.View.extend({template:_.template(e("#et-builder-column-template").html()),templateAddRow:_.template(e("#et-builder-specialty-column-template").html()),events:{"click .et-pb-insert-module":"addModule","click .et-pb-insert-row":"addModule","contextmenu > .et-pb-insert-module":"showRightClickOptions",click:"hideRightClickOptions"},initialize:function(){this.$el.attr("data-cid",this.model.get("cid"))},render:function(){var t=this,o="section"===this.model.get("module_type")&&"on"===this.model.get("et_pb_fullwidth"),n=o?".et_pb_fullwidth_sortable_area":".et-pb-column:not(.et-pb-column-specialty, .et_pb_parent_locked)";return this.$el.html(this.template(this.model.toJSON())),void 0!==this.model.attributes.specialty_columns&&this.$el.html(this.templateAddRow(this.model.toJSON())),o&&this.$el.addClass("et_pb_fullwidth_sortable_area"),"1"===this.model.get("layout_specialty")&&(n=".et-pb-column-specialty:not(.et_pb_parent_locked)"),"manually"!==this.model.get("created")||_.isUndefined(this.model.get("et_pb_specialty_columns"))||this.$el.addClass("et-pb-column-specialty"),this.isColumnParentLocked(this.model.get("parent"))&&(this.$el.addClass("et_pb_parent_locked"),this.model.set("et_pb_parent_locked","on",{silent:!0})),J.is_active()&&!J.is_user_has_permission(this.model.get("cid"),"column")?this:(this.$el.sortable({cancel:".et-pb-settings, .et-pb-clone, .et-pb-remove, .et-pb-insert-module, .et-pb-insert-column, .et-pb-insert-row, .et_pb_locked, .et-pb-disable-sort",connectWith:n,delay:100,items:"1"!==this.model.get("layout_specialty")?".et_pb_module_block":".et_pb_row",receive:function(t,i){var o=e(this),n=void 0,a=!1,s=void 0;o.hasClass("et-pb-column-specialty")&&(!e(i.sender).find(".et_pb_row").length||e(i.item).is(".et_pb_module_block")?(alert(et_pb_options.section_only_row_dragged_away),a=!0):(n=e(i.item).find(".et-pb-row-container > .et-pb-column").length,((s="2_3"===y.getView(o.data("cid")).model.get("layout"))&&3===n||!s&&4===n)&&(alert(et_pb_options.stop_dropping_3_col_row),a=!0))),e(i.item).closest(".et-pb-disable-sort").length&&(a=!0),(e(i.item).closest(".et_pb_section.et_pb_global").length||e(i.item).closest(".et_pb_row.et_pb_global").length)&&e(i.item).hasClass("et_pb_global")&&(alert(et_pb_options.global_module_alert),a=!0),a&&(e(i.sender).sortable("cancel"),Ue()),o.is(".et-pb-column-specialty")&&o.find(".et_pb_row").length<=1&&o.find(".et-pb-insert-row").length&&o.find(".et-pb-insert-row").remove()},update:function(i,o){if(V.isLoading)t.$el.sortable("cancel");else{if(J.is_active()){var n=e(o.item).hasClass("et_pb_row")?e(o.item).children(".et-pb-row-content").attr("data-cid"):e(o.item).attr("data-cid");if(!J.is_user_has_permission(n))return J.alert("has_no_permission"),t.$el.sortable("cancel"),void Ue();var a=e(o.item),s=_.isEmpty(e(o.sender))?e(i.target):e(o.sender),l=_.isEmpty(e(o.sender))?e(i.toElement).parent():e(i.target),d=a.hasClass("et_pb_ab_subject"),r=a.hasClass("et_pb_ab_goal"),p=s.closest(".et_pb_ab_subject").length,c=l.closest(".et_pb_ab_subject").length,b=l.closest(".et_pb_ab_goal").length;if(r&&!d&&p)return J.alert("cannot_move_module_goal_out_from_subject"),e(t.$el).sortable("cancel"),void Ue();if(r&&!d&&!p&&c)return J.alert("cannot_move_goal_into_subject"),e(t.$el).sortable("cancel"),void Ue();if(d&&!r&&b)return J.alert("cannot_move_subject_into_goal"),e(t.$el).sortable("cancel"),void Ue()}var u=void 0,g=void 0,h=o.item.data("cid");g=e(o.item),void 0===h&&e(i.target).is(".et-pb-column-specialty")&&(g=e(o.item).closest(".et_pb_row").find(".et-pb-row-content"),h=g.data("cid")),!e(i.target).is(".et-pb-column-specialty")&&e(o.item).closest(i.target).length&&1===e(i.target).find(".et_pb_module_block").length&&(e(i.target).find(".et-pb-insert-module").length?g.insertBefore(e(i.target).find(".et-pb-insert-module")):e(i.target).append(g)),u=t.collection.find(function(e){return e.get("cid")==h}),V.allowHistorySaving("moved","module",u.get("admin_label")),u.get("parent")===t.model.attributes.cid&&e(o.item).closest(i.target).length?m.trigger("et-model-changed-position-within-column"):u.set("parent",t.model.attributes.cid);var f=parseInt(e(this).attr("data-cid")),v=0;if(e(this).find(".et_pb_module_block").each(function(){v++;var t=parseInt(e(this).data("cid")),i=f+v;j.findWhere({cid:t}).set({layout_index:i})}),j.comparator="layout_index",j.sort(),(e(o.item).closest(".et_pb_section.et_pb_global").length||e(o.item).closest(".et_pb_row.et_pb_global").length||e(o.sender).closest(".et_pb_row.et_pb_global").length||e(o.sender).closest(".et_pb_section.et_pb_global").length)&&""===et_pb_options.template_post_id){h=o.item.data("cid");var w,k,C=e(o.sender).closest(".et_pb_row.et_pb_global"),S=e(o.item).closest(".et_pb_row.et_pb_global");if((w=C.length>0?C:e(o.sender).closest(".et_pb_section.et_pb_global"))===(k=S.length>0?S:e(o.item).closest(".et_pb_section.et_pb_global"))){var x;Ie(x=C.length>0?e(o.sender).closest(".et-pb-row-content").data("cid"):e(o.sender).closest(".et-pb-section-content").data("cid")),Ue()}else{var $=w;0!==k.length||(_.isUndefined(u.get("et_pb_global_parent"))||""===u.get("et_pb_global_parent"))&&_.isUndefined(u.get("global_parent_cid"))||(u.unset("et_pb_global_parent"),u.unset("global_parent_cid"),y.removeGlobalAttributes(y.getView(u.get("cid"))));for(var T=1;T<=2;T++)void 0!==(x=void 0!==$.find(".et-pb-section-content").data("cid")?$.find(".et-pb-section-content").data("cid"):$.find(".et-pb-row-content").data("cid"))&&""!==x&&(Ie(x),Ue()),$=k}}}},start:function(t,o){if(i(),t.altKey){var n=e(o.item).hasClass("et_pb_row")?e(o.item).children(".et-pb-row-content").attr("data-cid"):e(o.item).attr("data-cid"),s=y.getView(n),l={model:s.model,view:s.$el,view_event:t},_=new a.RightClickOptionsView(l,!0);_.copy(t,!0),_.pasteAfter(t,void 0,void 0,void 0,!0,!0),V.allowHistorySaving("cloned","module",s.model.get("admin_label"))}}}),this)},addModule:function(t){var o=e(t.target),n=o.is("span")?o.parent(".et-pb-insert-module"):o;if(t.preventDefault(),t.stopPropagation(),!this.isColumnLocked()&&!V.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"add_module")){if(n.parent().is(t.delegateTarget))if(i(),e(t.target).is(".et-pb-insert-row"))this.addRow();else{var s=void 0;s=new a.ModalView({model:this.model,collection:this.collection,attributes:{"data-open_view":"all_modules"},view:this}),e("body").append(s.render().el)}}else J.alert("has_no_permission")},addRow:function(e){var t=y.generateNewId(),i=void 0!==this.model.get("et_pb_global_parent")&&""!==this.model.get("et_pb_global_parent")?this.model.get("et_pb_global_parent"):"",o=""!==i?this.model.get("global_parent_cid"):"";V.isLoading||this.isColumnLocked()||(this.collection.add([{type:"row",module_type:"row",cid:t,parent:this.model.get("cid"),view:this,appendAfter:e,et_pb_global_parent:i,global_parent_cid:o,admin_label:et_pb_options.noun.row}]),y.getView(t).displayColumnsOptions())},removeColumn:function(){var e;e=y.getChildViews(this.model.get("cid")),_.each(e,function(e){"row"===e.model.get("type")||"row_inner"===e.model.get("type")?e.removeRow():e.removeModule()}),y.removeView(this.model.get("cid")),this.model.destroy(),this.remove()},isColumnLocked:function(){return"on"===this.model.get("et_pb_locked")||"on"===this.model.get("et_pb_parent_locked")},isColumnParentLocked:function(e){var t=y.getView(e);return!(_.isUndefined(t)||"on"!==t.model.get("et_pb_locked")&&"on"!==t.model.get("et_pb_parent_locked"))},showRightClickOptions:function(e){e.preventDefault();var t={model:this.model,view:this.$el,view_event:e};t.model.attributes.is_insert_module=!0,new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()}}),a.ColumnSettingsView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-column-settings-template").html()),events:{"click .et-pb-column-layouts li":"addColumns","click .et-pb-options-tabs-links li a":"switchTab"},initialize:function(e){this.listenTo(m,"et-add:columns",this.removeView),this.listenTo(m,"et-modal-view-removed",this.removeViewAndEmptySection),this.options=e},render:function(){return this.$el.html(this.template(this.model.toJSON())),y.getView(this.model.get("cid")).$el.closest(".et_pb_global").length&&this.$el.addClass("et_pb_no_global"),(void 0!==this.model.get("et_pb_specialty")&&"on"===this.model.get("et_pb_specialty")||void 0!==this.model.get("change_structure")&&"true"===this.model.get("change_structure"))&&this.$el.addClass("et_pb_modal_no_tabs"),this},addColumns:function(t){t.preventDefault();var i=e(t.target).is("li")?e(t.target):e(t.target).closest("li"),o={layout:i.data("layout"),layout_specialty:"section"===this.model.get("type")&&"on"===this.model.get("et_pb_specialty")?i.data("specialty").split(","):"",is_structure_change:void 0!==this.model.get("change_structure")&&"true"===this.model.get("change_structure"),specialty_columns:i.data("specialty_columns")};y.changeColumnStructure(this,o)},removeView:function(){var e=this;setTimeout(function(){e.remove()},300)},switchTab:function(t){var i=e(t.currentTarget).parent();t.preventDefault(),Ee(i,"row","")},removeViewAndEmptySection:function(){"on"===this.model.get("et_pb_specialty")&&(this.options.view.model.destroy(),y.removeView(this.options.view.model.get("cid")),this.options.view.remove()),this.remove()}}),a.SaveLayoutSettingsView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-load_layout-template").html()),events:{"click .et_pb_layout_button_load":"legacyLoadLayout","click .et_pb_layout_button_delete":"deleteLayout","click .et-pb-options-tabs-links li a":"switchTab"},initialize:function(t){this.options=t,this.layoutIsLoading=!1,this.library_url=et_pb_options.divi_library_url,this.back_button_template=_.template(e("#et-builder-library-back-button-template").html()),this.current_page={},this.account_status_error=!1,this.account_status_error_template=_.template(e("#et-builder-library-account-status-error-template").html()),this.listenTo(m,"et-modal-view-removed",this.remove),this.listenTo(m,"et-pb-loading:ended",this.onLoadingEnded),this.listenTo(this,"after-render",this.afterRender)},render:function(){this.$el.html(this.template({display_switcher:"on"}));var t=e("#post_type").val();return"layout"===t&&(this.isCategoryBuilder=!0,Le("predefined","et-pb-all-modules-tab",this.$el,t),Le("not_predefined","et-pb-saved-modules-tab",this.$el,t)),setTimeout(_.bind(function(){this.trigger("after-render")},this),150),this},remove:function(){this.library&&this.library.destroy(),e(document).off("scroll.et_fb_library",this.onScrollWindow),window.wp.Backbone.View.prototype.remove.apply(this)},afterRender:function(){this.$modal=this.$el.parents(".et_pb_modal_settings_container"),this.isCategoryBuilder||(this.$modal.addClass("et_pb_library_modal"),this.emitLoadingStarted(),Promise.all([this.loadLibrary(),w]).then(_.bind(function(t){this.library=t[0],this.$library=e(this.library.frame),this.local_layouts=t[1].layouts_data,this.custom_layouts=t[1].custom_layouts_data,this.setIFrameSize(),e(window).on("resize",this.setIFrameSize.bind(this)),this.$library.on("mouseenter",this.onMouseEnterIFrame),this.$library.on("mouseleave",this.onMouseLeaveIFrame),e(document).on("scroll.et_fb_library",this.onScrollWindow),this.library.on("current_page_changed",this.onPageChanged.bind(this)),this.library.on("use_layout",this.onUseLayout.bind(this)),this.library.on("download_progress",this.onDownloadProgress.bind(this)),this.library.on("account_status_error",this.onAccountStatusError.bind(this)),this.library.on("authentication_complete",this.onAuthenticationComplete.bind(this)),this.library.call("setAccount",{username:et_pb_options.et_account.et_username,api_key:et_pb_options.et_account.et_api_key}),this.library.call("setShowLoadOptions",!this.isCurrentLayoutEmpty()),this.emitLoadingEnded()},this)),this.$modal.find(".et_pb_modal_settings").on("click",".et-pb-library-back-button",this.onClickBackButton.bind(this)),e("<ul><li><span>").addClass("et-pb-load-layouts").hide(0).find("span").addClass("et_pb_layout_button_load").on("click",_.bind(function(t){this.onUseLayout(e(t.target).parent().data("layout_id"))},this)).parents("ul").appendTo(this.$modal.find(".et-pb-all-modules-tab")))},emitLoadingStarted:function(){this.layoutIsLoading=!0,m.trigger("et-pb-loading:started")},emitLoadingEnded:function(){this.layoutIsLoading=!1,m.trigger("et-pb-loading:ended")},deleteLayout:function(t){t.preventDefault();var i=e(t.currentTarget).closest("li");i.hasClass("et_pb_deleting_layout")||(i.addClass("et_pb_deleting_layout"),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_delete_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_id:i.data("layout_id")},beforeSend:function(){m.trigger("et-pb-loading:started"),i.css("opacity","0.5")},complete:function(){m.trigger("et-pb-loading:ended")},success:function(e){1==i.closest("ul").find("> li").length&&i.closest("ul").prev("h3").hide(),i.remove()}}))},getLibraryURL:function(){var e=[];return _.forEach({iframe:1,animation:!0,is_bb:1},function(t,i){e.push("et_"+i+"="+t)}),e=e.join("&"),this.library_url+"?"+e},getLayout:function(t){return new Promise(function(i,o){e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_builder_library_get_layout",nonce:et_pb_options.library_get_layout_nonce,id:t,is_BB:!0}}).then(function(e){i({content:C(e,"data.savedShortcode",""),migrations:C(e,"data.migrations","")})})})},importLayout:function(t){var i=window.etCore.portability,o=i.importFB.bind(i),n=e(window);return new Promise(function(i,a){(t=new Blob([t],{type:"application/json"})).lastModified=Date.now(),t.name="layout.json",n.on("et_fb_layout_import_finished.et_bb",function(){i({content:C(window.et_fb_import_layout_response,"data.postContent",""),migrations:C(window.et_fb_import_layout_response,"data.migrations","")}),n.off("et_fb_layout_import_finished.et_bb")}),o(t,e("#post_ID").val())})},isCurrentLayoutEmpty:function(){return _.isEmpty(V.collection.findWhere({type:"module"}))},legacyLoadLayout:function(t){if(t.preventDefault(),!this.layoutIsLoading){this.layoutIsLoading=!0,this.$el.find(".et-pb-main-settings").css({opacity:"0.5"});var i=e(t.currentTarget).closest("li"),o=i.closest(".et-pb-main-settings").find("#et_pb_load_layout_replace").is(":checked"),n=ee("content");e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_load_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_id:i.data("layout_id"),et_replace_content:o?"on":"off"},beforeSend:function(){m.trigger("et-pb-loading:started")},complete:function(){m.trigger("et-pb-loading:ended"),m.trigger("et-saved_layout:loaded")},success:function(e){n=o?e:e+n,V.removeAllSections(),""!==n&&V.allowHistorySaving("loaded","layout"),V.createNewLayout(n,"load_layout")}})}},loadLibrary:function(){return Postmate.debug=!1,new Postmate({container:this.$(".active-container")[0],url:this.getLibraryURL()})},onAccountStatusError:function(t){this.account_status_error=!0;var i={expired:"expired"===t};this.$library.hide(),e(this.account_status_error_template(i)).insertBefore(this.$library).on("click",".button",this.onClickAccountSubmitButton.bind(this))},onAuthenticationComplete:function(t){this.account_status_error&&(this.emitLoadingEnded(),t.authenticated?(this.account_status_error=!1,this.onClickBackButton(),this.library.call("retryUseLayout"),et_pb_options.et_account.et_username=this.account.et_username,et_pb_options.et_account.et_api_key=this.account.et_api_key,e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_builder_library_update_account",nonce:et_pb_options.library_update_account_nonce,et_username:this.account.et_username,et_api_key:this.account.et_api_key,status:t.status}})):this.$el.find("et-pb-library-account-status-error").addClass("et-pb-library-account-status-error--auth-failed"))},onClickAccountSubmitButton:function(e){this.account={et_username:this.$el.find("#et_username").val(),et_api_key:this.$el.find("#et_api_key").val()},this.emitLoadingStarted(),this.library.call("authenticate",this.account)},onClickBackButton:function(){if(this.account_status_error)this.account_status_error=!1,this.$el.find(".et-pb-library-account-status-error").remove(),this.$library.fadeIn();else{if(_.isUndefined(this.current_page.previous_url))return;this.library.call("goTo",this.current_page.previous_url)}},onDownloadProgress:function(e,t){this.layoutIsLoading||(this.layoutIsLoading=!0,this.$el.find(".et-pb-main-settings").css({opacity:"0.5"}),this.emitLoadingStarted())},onLoadingEnded:function(){!this.isCategoryBuilder&&this.layoutIsLoading&&m.trigger("et-pb-loading:started")},onMouseEnterIFrame:function(e){this.inside_iframe=!0,this.windowX=window.scrollX,this.windowY=window.scrollY},onMouseLeaveIFrame:function(e){this.inside_iframe=!1},onPageChanged:function(e){var t=this.current_page.previous_url;this.current_page=e,this.current_page.previous_url||(this.current_page.previous_url=t),this.current_page.is_layout?this.showBackButton():this.removeBackButton()},onScrollWindow:function(e){this.inside_iframe&&window.scrollTo(this.windowX,this.windowY)},onUseLayout:function(e){var t=void 0,i=!0;_.isObject(e)?(t=e.layout,i="on"===e.replace_content):t=e;var o=_.isString(t)?this.importLayout:this.getLayout,n=this;this.emitLoadingStarted(),o(t).then(_.bind(function(e){var t=e.content;i||(t=ee("content")+t),_.isUndefined(e.migrations)||(et_pb_options.et_pb_module_settings_migrations=e.migrations),V.removeAllSections(),t&&V.allowHistorySaving("loaded","layout"),V.createNewLayout(t,"load_layout"),this.emitLoadingEnded(),m.trigger("et-saved_layout:loaded"),n.layoutIsLoading=!1},this)).catch(_.bind(function(e){this.emitLoadingEnded(),m.trigger("et-saved_layout:loaded"),console.error(e),n.layoutIsLoading=!1},this))},removeBackButton:function(){this.$modal.find(".et_pb_modal_settings").find(".et-pb-library-back-button").remove(),this.isBackButtonShown=!1},setIFrameSize:function(){var e=this.$modal.width(),t=this.$modal.height();e>1200&&(e=1200),this.$modal.css("left","calc((100vw - "+e+"px) / 2)"),this.$library.height(t).width(e)},showBackButton:function(){this.isBackButtonShown||(this.isBackButtonShown=!0,this.$modal.find(".et_pb_modal_settings").prepend(this.back_button_template()))},switchTab:function(t){t.preventDefault();var i=e(t.currentTarget).parent(),o=i.data("open_tab"),n={},a=this.$modal.find(".active-container");if(this.isCategoryBuilder)Ee(i,"layout","");else if(o!==this.current_tab){if(this.account_status_error&&(this.account_status_error=!1,this.$el.find(".et-pb-library-account-status-error").remove(),this.$library.fadeIn()),this.removeBackButton(),x(o,"et-pb-")){if(!this.library)return;if(i.addClass("et-pb-options-tabs-links-active").siblings().removeClass("et-pb-options-tabs-links-active"),"et-pb-all-modules-tab"!==o){var s=i.data("custom_tab_id"),l=_.isUndefined(s)||""===s?this.local_layouts:this.custom_layouts[s];n=e.extend(l,{filters:{type:"layout"},load_options:{show:!this.isCurrentLayoutEmpty()}})}a.hasClass("et-pb-all-modules-tab")||(a.removeClass("active-container").fadeOut(),a.siblings(".et-pb-all-modules-tab").addClass("active-container").css("opacity","").fadeIn()),o!==this.current_tab&&this.library.call("toggleLocalLayouts",n)}else Ee(i,"layout","");this.current_tab=o}}}),a.ModulesView=window.wp.Backbone.View.extend({className:"et_pb_modal_settings",template:_.template(e("#et-builder-modules-template").html()),events:{"click .et-pb-all-modules li":"addModule","click .et-pb-options-tabs-links li a":"switchTab"},initialize:function(e){this.options=e,this.listenTo(m,"et-modal-view-removed",this.remove)},render:function(){var e=void 0!==y.getView(this.model.get("parent"))?y.getView(this.model.get("parent")):this;return this.$el.html(this.template(y.toJSON())),(y.getView(this.model.get("cid")).$el.closest(".et_pb_global").length||void 0!==e.model.get("et_pb_template_type")&&"module"===e.model.get("et_pb_template_type"))&&this.$el.addClass("et_pb_no_global"),this},addModule:function(t){var i=e(t.currentTarget),o=i.find(".et_module_title").text(),n=i.attr("class").replace(" et_pb_fullwidth_only_module",""),a="",s=y.getView(this.model.get("parent")),l=void 0!==s?s:this;t.preventDefault(),void 0!==this.model.get("et_pb_global_parent")&&""!==this.model.get("et_pb_global_parent")&&(a=this.model.get("global_parent_cid")),V.allowHistorySaving("added","module",o),this.collection.add([{type:"module",cid:y.generateNewId(),module_type:n,admin_label:o,parent:this.attributes["data-parent_cid"],view:this.options.view,global_parent_cid:a}]),this.remove(),""!==a&&Ie(a),void 0!==l.model.get("et_pb_template_type")&&"module"===l.model.get("et_pb_template_type")&&De("_et_pb_module_type",n),Re()},switchTab:function(t){var i=e(t.currentTarget).parent(),o=n(this.model.get("et_pb_fullwidth"))&&"on"===this.model.get("et_pb_fullwidth")?"fullwidth":"regular";t.preventDefault(),Ee(i,"module",o)}}),a.ModuleSettingsView=window.wp.Backbone.View.extend({className:"et_pb_module_settings",initialize:function(){var t=C(e.parseJSON(et_pb_options.et_builder_modules_with_children),this.attributes["data-module_type"],!1),i=!!t&&"#et-builder-advanced-setting-"+t+"-title",o=y.generateTemplateName(this.attributes["data-module_type"]);e(o).length<1||i&&e(i).length<1?this.attributes["data-no_template"]="no_template":(this.template=_.template(e(y.generateTemplateName(this.attributes["data-module_type"])).html()),this.listenTo(m,"et-modal-view-removed",this.removeModule),this.listenTo(m,"et-advanced-module:saved",this.renderMap))},events:{},render:function(){var t,i,o,n,r,c,u,g=this,h=this.$el,f=[],v=this.model.attributes.cid,w=void 0,k=void 0,C=void 0,S=!1,x=void 0,j=void 0,$=void 0,V=void 0,T=void 0,O=void 0,A=void 0,M=void 0,L=["et_pb_font_icon","et_pb_button_one_icon","et_pb_button_two_icon","et_pb_button_icon"],E=void 0,D=void 0,I=void 0,P=void 0;if(g.model.set("et_pb__builder_version",et_pb_options.product_version),_.each(this.model.attributes,function(t,i,o){if("string"==typeof t&&"et_pb_content"!==i&&-1===e.inArray(i,L)&&!/^\%\%\d+\%\%$/.test(e.trim(t)))return o[i]=t.replace(/%22/g,'"')}),this.$el.html(this.template(this.model.attributes)),w=this.$el.find("#et_pb_content, .et_pb_tiny_mce_field"),j=this.$el.find(".et-pb-color-picker-hex"),$=this.$el.find(".et-builder-color-picker-alpha"),t=this.$el.find(".et-pb-upload-button"),E=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview"),D=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--add"),I=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--edit"),P=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--delete"),i=this.$el.find(".et-pb-video-image-button"),o=this.$el.find(".et-pb-gallery-button"),V=this.$el.find(".et-pb-date-time-picker"),T=this.$el.find(".et_font_icon"),O=h.find(".et-validate-number"),M=h.find("form.validate"),A=h.find(".et-pb-option--warning"),n=h.find(".et_pb_email_add_account"),M.length&&(Te("validation enabled"),M.validate({debug:!0})),j.length){var R=void 0,N=void 0;j.each(function(){var t=e(this),i=function(){setTimeout(function(){t.attr("data-color-type",t.attr("value").match(/^rgba?/i)?"rgb":"hex")},1)};i(),t.on("keypress",i),t.wpColorPicker({defaultColor:t.data("default-color"),palettes:""!==et_pb_options.page_color_palette?et_pb_options.page_color_palette.split("|"):et_pb_options.default_color_palette.split("|"),change:function(t,o){var n,a=e(this),s=a.closest(".et-pb-option-container"),l=s.find(".et-pb-reset-setting"),d=a.closest(".et-pb-custom-color-container"),r=s.find(".et-pb-option-preview"),p=a.hasClass("et-pb-color-picker-hex-has-preview"),c=a.closest(".et_pb_background-tab--gradient").length>0,u=o.color.toString().toLowerCase();d.length&&(d.find(".et-pb-custom-color-picker").val(o.color.toString()),s.hasClass("et-pb-option-container--font")&&d.find(".et-pb-custom-color-picker").trigger("change")),n=ve(a).toLowerCase(),s.hasClass("et-pb-option-container--font")||(u!==n?l.length&&l.addClass("et-pb-reset-icon-visible"):(l.length&&l.removeClass("et-pb-reset-icon-visible"),p&&r.addClass("et-pb-option-preview--empty")),p&&""!==u&&r.removeClass("et-pb-option-preview--empty")),p&&r.css({backgroundColor:u}),c&&ye(a),_.has(t,"originalEvent")&&_.has(t.originalEvent,"type")&&"square"===t.originalEvent.type&&(s.find(".button-confirm").css("backgroundColor",u+" !important"),s.hasClass("is-dragging")||s.addClass("is-dragging"),clearTimeout(R),R=setTimeout(function(){b(a),s.find(".button-confirm").css("backgroundColor",""),s.removeClass("is-dragging")},300)),clearTimeout(N),N=setTimeout(function(){a.focus()},300),a.hasClass("et-pb-is-cleared")&&a.removeClass("et-pb-is-cleared"),a.trigger("et_pb_setting:color_picker:change",[u]),i()},clear:function(){e(this).val(et_pb_options.invalid_color),e(this).closest(".et-pb-option-container").find(".et-pb-main-setting").val(""),e(this).siblings(".et-pb-color-picker-hex").trigger("et_pb_setting:color_picker:change",[""])},width:t.closest(".et-pb-option--background").length?660:300,height:190,diviColorpicker:!!t.closest(".et-pb-option--background").length});var o=t.data("default-color")||"",n=t.closest(".et-pb-option-container").find(".et-pb-reset-setting");if(t.hasClass("et-pb-color-picker-hex-has-preview")){var a=t.closest(".et-pb-option-container");a.find(".et-pb-option-preview-button--add, .et-pb-option-preview-button--edit, .et-pb-option-preview").click(function(e){e.stopPropagation(),t.wpColorPicker("open")}),a.find(".et-pb-option-preview-button--delete").click(function(e){e.stopPropagation();var i=ve(t).toLowerCase();t.wpColorPicker("color",i).val(i).addClass("et-pb-is-cleared"),""===i&&a.find(".et-pb-option-preview").removeAttr("style").addClass("et-pb-option-preview--empty")})}if(!n.length)return!0;var s=""+t.val();o.toLowerCase()!==s.toLowerCase()&&n.addClass("et-pb-reset-icon-visible")})}if($.length&&$.each(function(){var t=e(this),i=t.data("value").split("|"),o=i[0]||"#444444",n=i[2]||1;t.attr("data-opacity",n),t.val(o),t.minicolors({control:"hue",defaultValue:e(this).data("default-color")||"",opacity:!0,changeDelay:200,show:function(){t.minicolors("opacity",t.data("opacity"))},change:function(i,o){if(i){var n,a=t.minicolors("rgbObject"),s=e(t.data("field")),l=[];l.push(i),l.push(a.r+", "+a.g+", "+a.b),l.push(o),n=l.join("|"),s.length&&s.val(n)}},theme:"bootstrap"})}),t.length&&s(t),D.length||I.length||E){var H=function(t){t.preventDefault(),t.stopPropagation(),e(this).hasClass("et-pb-option-preview")&&!e(this).hasClass("et-pb-option-preview--empty")&&"video"===e(this).siblings(".button").attr("data-type")||Ge(e(this))||e(this).closest(".et-pb-option").find(".et-pb-upload-button").trigger("click")};E.click(H),D.click(H),I.click(H)}if(P.length&&P.click(function(t){if(t.preventDefault(),t.stopPropagation(),!Ge(e(this))){var i=e(this).closest(".et-pb-option"),o=i.find(".et-pb-upload-field"),n=i.find(".et-pb-option-preview");o.val(""),n.addClass("et-pb-option-preview--empty").find(".et-pb-preview-content").remove()}}),i.length&&p(i),o.length&&l(o),n.length&&(r=n,c=this,u=window.et_pb_module_field_dependencies.et_pb_signup,r.each(function(){var t=e(this),i=t.siblings("select"),o=t.siblings(".et_pb_email_force_fetch_lists"),n=t.siblings(".et_pb_email_remove_account"),a=e(this).siblings("input"),s=a.closest(".et-pb-option").data("option_name"),l=_.keys(u[s].affects);l=_.map(l,function(e){return"#et_pb_"+e}).join(", "),e(this).closest(".et-pb-options-tab").find(l).one("et-pb-option-field-shown",function(){var t=e(this).siblings("button");!function(t,i,o){t.on("click",function(){e(this).hasClass("et_pb_email_submit")?(m.trigger("et-pb-loading:started"),function(t,i){var o=d(t),n=t.closest(".et-pb-option--select_with_option_groups").parent().find('[class*="et_pb_email_'+o+'"]:visible'),a={};function s(e){t.val(t.data("previous_value")).trigger("change"),n.val(""),m.trigger("et-pb-loading:ended"),"error"in e&&e.error&&alert(e.message)}n.each(function(){var t,i,o=e(this).attr("id").replace("pb_","");i="_list",(t=o).substr(t.length-i.length,t.length)!==i&&(a[o]=e(this).val())}),a.action="et_builder_email_add_account",a.et_builder_email_add_account_nonce=et_pb_options.et_builder_email_add_account_nonce,a.et_bb=!0,a.et_provider=o,e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:a}).done(function(e,o,n){e=JSON.parse(e),t.html(_.template(e.accounts_list).bind(i)(i.model.attributes)),s(e)}).fail(s)}(i,o)):i.val(i.data("previous_value")).trigger("change")}),t.appendTo(t.parent())}(t,i,c)}),o.data("original_text",o.text()),n.data("original_text",n.text()),i.on("change",function(){var a=e(this).val();if("add_new_account"!==a||i.parent().hasClass("new_account_in_progress"))if("fetch_lists"!==a||i.parent().hasClass("fetch_lists_in_progress"))if("remove_account"!==a||i.parent().hasClass("remove_account_in_progress")){i.parent().removeClass("new_account_in_progress remove_account_in_progress fetch_lists_in_progress");var s=c.$el.prev().find(".et-pb-modal-save, .et-pb-modal-save-template");s.css("cursor",""),"none"===a?i.parent().addClass("no_account_selected"):i.parent().removeClass("no_account_selected"),t.show(),n.text(n.data("original_text")),o.text(o.data("original_text")),a&&"none"!==a?(n.show(),o.show()):(n.hide(),o.hide()),t.siblings("span").remove(),t.siblings("p").show(),i.show()}else{i.parent().addClass("remove_account_in_progress"),t.hide().siblings("p").hide(),n.text(n.data("confirm_text")),o.text(o.data("cancel_text"));var l=i.data("confirm_remove_text")+" "+i.data("selected_account");e("<span>").text(l).insertAfter(i).addClass("et_pb_email_account_message"),i.hide()}else i.parent().addClass("fetch_lists_in_progress"),m.trigger("et-pb-loading:started"),function(t,i,o){var n=d(t),a=t.data("selected_account");function s(e){t.val(t.data("previous_value")).trigger("change"),i.removeClass("fetch_lists_in_progress"),m.trigger("et-pb-loading:ended"),"error"in e&&e.error&&alert(e.message)}e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_builder_email_get_lists",et_builder_email_fetch_lists_nonce:et_pb_options.et_builder_email_fetch_lists_nonce,et_provider:n,et_account:a,et_bb:!0}}).done(function(e,i,n){e=JSON.parse(e),t.html(_.template(e.accounts_list).bind(o)(o.model.attributes)),s(e)}).fail(s)}(i,t,c);else i.parent().addClass("new_account_in_progress"),e("<span>").text(i.data("adding_new_account_text")).insertAfter(i).addClass("et_pb_email_account_message"),t.hide().siblings().not("span").hide(),i.siblings("#et_pb_aweber_list").length>0&&window.open("https://auth.aweber.com/1.0/oauth/authorize_app/b17f3351")}),t.click(function(){var e=c.$el.prev().find(".et-pb-modal-save, .et-pb-modal-save-template");e.css("cursor","not-allowed"),i.data("previous_value",i.val()).val("add_new_account").trigger("change")}),o.click(function(){if(i.parent().hasClass("remove_account_in_progress"))i.val(i.data("previous_value")).trigger("change");else{var e=i.find(":selected").parent().attr("label");i.data("selected_account",e),i.data("previous_value",i.val()).val("fetch_lists").trigger("change")}}),n.click(function(){if(i.parent().hasClass("remove_account_in_progress"))return m.trigger("et-pb-loading:started"),void function(t,i){var o=d(t),n=t.data("selected_account");function a(e){t.val("none").trigger("change"),m.trigger("et-pb-loading:ended"),"error"in e&&e.error&&alert(e.message)}e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_builder_email_remove_account",et_builder_email_remove_account_nonce:et_pb_options.et_builder_email_remove_account_nonce,et_provider:o,et_account:n,et_bb:!0}}).done(function(e,o,n){e=JSON.parse(e),t.html(_.template(e.accounts_list).bind(i)(i.model.attributes)),a(e)}).fail(a)}(i,c);var t=i.find(":selected").parent().attr("label");t&&(i.data("selected_account",t),i.data("previous_value",i.val()).val("remove_account").trigger("change"))}),setTimeout(function(){i.trigger("change")},200)})),V.length&&V.datetimepicker({dateFormat:"yy-mm-dd",beforeShow:function(){var t=e("#ui-datepicker-div");t.closest(".et-fb-option--date-picker").length<1&&t.wrap('<span class="et-fb-option--date-picker"></span>')}}),O.length&&O.keyup(function(){var t=e(this);(t.val()<0||!e.isNumeric(t.val())&&""!==t.val())&&t.val(0),t.val()>100&&t.val(100),""!==t.val()&&t.val(Math.round(t.val()))}),T.length){var B=this;T.each(function(){var t=e(this),i=t.siblings(".et-pb-font-icon"),o=e.trim(i.val()),n=t.find("li"),a="et_active",s=void 0,l=void 0,_=void 0;function d(){""!==o&&(-1!==(o=(o=o.replace("[","%91")).replace("]","%93")).search(/^%%/)?(_=parseInt(o.replace(/%/g,"")),s=t.find("li").eq(_)):s='"'===o?t.find("li").eq(0):t.find('li[data-icon="'+o+'"]'),s.addClass(a),t.is(":visible")&&setTimeout(function(){(l=s.offset().top-t.offset().top)>0&&t.animate({scrollTop:l},0)},110))}d(),B.$el.find(".et-pb-options-tabs-links").on("et_pb_main_tab:changed",d),n.click(function(){var t=e(this),o=t.index();if(t.hasClass(a))return!1;t.siblings("."+a).removeClass(a).end().addClass(a),o="%%"+o+"%%",i.val(o)})})}return w.length&&w.each(function(){var t=e(this),i=t.attr("id");if((C=t.closest(".et-pb-option")).hasClass("et-pb-option-advanced-module")&&(S=!0),S){var o=y.generateNewId();g.view_cid=o,C.hide(),t.attr("id","et_pb_content_main"),x=new a.AdvancedModuleSettingsView({model:g,el:g.$el.find(".et-pb-option-advanced-module-settings"),attributes:{cid:o,value_changes:g.model.get("value_changes")}}),y.addView(o,x),C.before(x.render()),""!==t.html()&&(x.generateAdvancedSortableItems(t.html(),g.$el.find(".et-pb-option-advanced-module-settings").data("module_type")),m.trigger("et-advanced-module:updated_order",g.$el))}else k=t.closest(".et-pb-option-container"),f[i]=t.html(),t.remove(),k.prepend(U.find("#"+i+"_editor").html()),setTimeout(function(){void 0!==window.switchEditors&&window.switchEditors.go(i,ie());var e="et_pb_content"!==i?"load_secondary_editor":"";ae(i,f[i],e),window.wpActiveEditor=i},100)}),A.length&&A.each(function(){var t=e(this),i=t.find(".et-pb-option-warning"),o=i.attr("data-display_if"),n=i.attr("data-name");et_pb_options[n]===o&&t.addClass("et-pb-option--warning-active")}),this.renderMap(),ce(this.$el,v),S||setTimeout(function(){h.find("select, input, textarea, radio").filter(":eq(0)").focus()},1),this},removeModule:function(){this.remove()},is_latlng:function(e){var t=e.split(","),i=!_.isUndefined(t[0])&&parseFloat(t[0]),o=!_.isUndefined(t[1])&&parseFloat(t[1]);return!("undefined"==typeof google||!i||_.isNaN(i)||!o||_.isNaN(o))&&new google.maps.LatLng(i,o)},renderMap:function(){var e=this,t=this.$el.find(".et-pb-map");if("undefined"!=typeof google&&t.length){var i=this.view_cid,o=this.$el.find(".et_pb_address"),n=this.$el.find(".et_pb_address_lat"),a=this.$el.find(".et_pb_address_lng"),s=this.$el.find(".et_pb_find_address"),l=this.$el.find(".et_pb_zoom_level"),d=new google.maps.Geocoder,r={},p=isNaN(parseInt(l.val()))?18:parseInt(l.val()),c=function(e){t.map.setCenter(e)},b=function(){t.map.setZoom(p)};o.on("blur",function(){var t=o.val();t.length<=0||d.geocode({address:t},function(i,s){if(s==google.maps.GeocoderStatus.OK){var l=i[0],_=l.geometry.location,d=e.is_latlng(t);d&&(_=d),isNaN(_.lat())||isNaN(_.lng())?alert(et_pb_options.map_pin_address_invalid):(o.val(l.formatted_address),n.val(_.lat()),a.val(_.lng()),c(_))}else alert(et_pb_options.geocode_error+": "+s)})}),s.on("click",function(e){e.preventDefault()}),l.on("blur",b),setTimeout(function(){t.map=new google.maps.Map(t[0],{zoom:p,mapTypeId:google.maps.MapTypeId.ROADMAP}),""!==n.val()&&""!==a.val()&&c(new google.maps.LatLng(n.val(),a.val())),""!==l&&b(),setTimeout(function(){var e=y.getChildViews(i);_.size(e)&&_.each(e,function(e,i){_.isUndefined(e.model.get("et_pb_pin_address_lat"))||_.isUndefined(e.model.get("et_pb_pin_address_lng"))||(r[i]=new google.maps.Marker({map:t.map,position:new google.maps.LatLng(parseFloat(e.model.get("et_pb_pin_address_lat")),parseFloat(e.model.get("et_pb_pin_address_lng"))),title:e.model.get("et_pb_title"),icon:{url:et_pb_options.images_uri+"/marker.png",size:new google.maps.Size(46,43),anchor:new google.maps.Point(16,43)},shape:{coord:[1,1,46,43],type:"rect"}}))})},500),google.maps.event.addListener(t.map,"center_changed",function(){var e=t.map.getCenter();n.val(e.lat()),a.val(e.lng())}),google.maps.event.addListener(t.map,"zoom_changed",function(){var e=t.map.getZoom();l.val(e)})},200)}}}),a.AdvancedModuleSettingsView=window.wp.Backbone.View.extend({initialize:function(){this.listenTo(m,"et-advanced-module:updated",this.generateContent),this.listenTo(m,"et-modal-view-removed",this.removeModule),this.module_type=this.$el.data("module_type"),a.Events=m,this.child_views=[],this.$el.attr("data-cid",this.attributes.cid),this.$sortable_options=this.$el.find(".et-pb-sortable-options"),this.$content_textarea=this.$el.siblings(".et-pb-option-main-content").find("#et_pb_content_main"),_.includes(["et_pb_column","et_pb_column_inner"],this.module_type)?this.$sortable_options.addClass("et-pb-sortable-options--disabled"):this.$sortable_options.sortable({axis:"y",cancel:".et-pb-advanced-setting-remove, .et-pb-advanced-setting-options",update:function(e,t){m.trigger("et-advanced-module:updated"),m.trigger("et-advanced-module:updated_order")}}),this.$add_sortable_item=this.$el.find(".et-pb-add-sortable-option").addClass("et-pb-add-sortable-initial")},events:{"click .et-pb-add-sortable-option":"addModule","click .et-pb-advanced-setting-clone":"cloneModule"},render:function(){return this},addModule:function(e){e.preventDefault(),this.model.collection.add([{type:"module",module_type:this.module_type,cid:y.generateNewId(),view:this,created:"manually",mode:"advanced",parent:this.attributes.cid,parent_cid:this.model.model.attributes.cid}],{update_shortcodes:"false"}),this.$add_sortable_item.removeClass("et-pb-add-sortable-initial"),m.trigger("et-advanced-module:updated_order")},cloneModule:function(t){t.preventDefault();var i=e(t.target).closest("li").data("cid"),o=V.collection.find(function(e){return e.get("cid")==i}),n=_.clone(o.attributes);n.created="manually",n.cloned_cid=i,n.cid=y.generateNewId(),this.model.collection.add(n),m.trigger("et-advanced-module:updated"),m.trigger("et-advanced-module:saved"),m.trigger("et-advanced-module:updated_order")},generateContent:function(){var t="";this.$sortable_options.find("li").each(function(){var i=e(this);t+=V.generateModuleShortcode(i,!1)}),t=t.replace(/%22/g,"^^"),this.$content_textarea.html(t),this.$sortable_options.find("li").length?this.$add_sortable_item.removeClass("et-pb-add-sortable-initial"):this.$add_sortable_item.addClass("et-pb-add-sortable-initial")},generateAdvancedSortableItems:function(t,i){var o=this,n=V.getShortCodeChildTags(),a=window.wp.shortcode.regexp(n),s=V.wp_regexp_not_global(n),l=t.match(a);""!==t&&this.$add_sortable_item.removeClass("et-pb-add-sortable-initial"),_.each(l,function(t,n){var l=t.match(s),d=l[2],r=""!==l[3]?window.wp.shortcode.attrs(l[3]+" "+n):"",p=l[5],c=y.generateNewId(),b={},u=void 0!==p&&""!==p&&p.match(a),g=et_pb_options.et_pb_module_settings_migrations.name_changes,h=_.includes(["et_pb_column","et_pb_column_inner"],d),f=void 0;f={type:"module",module_type:i,cid:c,view:o,created:"auto",mode:"advanced",parent:o.attributes.cid,parent_cid:o.model.model.attributes.cid};var m=y.getView(o.model.model.attributes.cid);if(h){var v=e(m.$el).find(".et-pb-column");_.isUndefined(v[n])||(f.column_cid=e(v[n]).data("cid"))}if(_.isObject(r.named)){for(var w in r.named){var k,C="admin_label"!==w?"et_pb_"+w:w;h&&"et_pb_type"===C&&(C="layout"),k=(k=r.named[w]).replace(/\^\^/g,'"'),b[C]=k}f.et_pb_content=p,f=_.extend(f,b)}u||(f.et_pb_content=p),_.isEmpty(g)||_.isEmpty(g[o.module_type])||_.forEach(g[o.module_type],function(e,t){_.isUndefined(f["et_pb_"+t])||(f["et_pb_"+e]=f["et_pb_"+t],delete f["et_pb_"+t])}),_.isUndefined(o.attributes.value_changes)||_.isUndefined(o.attributes.value_changes[n])||_.forEach(o.attributes.value_changes[n],function(e,t){f["et_pb_"+t]=e}),o.model.collection.add([f],{update_shortcodes:"false"})})},removeModule:function(){_.each(this.child_views,function(e){e.removeView()}),this.remove()}}),a.AdvancedModuleSettingView=window.wp.Backbone.View.extend({tagName:"li",initialize:function(){this.template=_.template(e("#et-builder-advanced-setting").html())},events:{"click .et-pb-advanced-setting-options":"showSettings","click .et-pb-advanced-setting-remove":"removeView"},render:function(){var e=void 0;return this.$el.html(this.template(this.model.attributes)),e=new a.AdvancedModuleSettingTitleView({model:this.model,view:this}),this.$el.prepend(e.render().el),this.child_view=e,void 0!==this.model.get("cloned_cid")&&""!==this.model.get("cloned_cid")||this.showSettings(),this},showSettings:function(t){var i=void 0;t&&t.preventDefault(),i=new a.AdvancedModuleSettingEditViewContainer({view:this,attributes:{show_settings_clicked:!!t,"data-module_type":this.model.get("module_type")}}),e(".et_pb_modal_settings_container").after(i.render().el),Re()},removeView:function(e){e&&e.preventDefault(),_.isUndefined(this.child_view)||this.child_view.remove(),this.remove(),this.model.destroy(),m.trigger("et-advanced-module:updated"),m.trigger("et-advanced-module:updated_order")}}),a.AdvancedModuleSettingTitleView=window.wp.Backbone.View.extend({tagName:"span",className:"et-sortable-title",initialize:function(){var t="#et-builder-advanced-setting-"+("et_pb_column_inner"===this.model.get("module_type")?"et_pb_column":this.model.get("module_type"))+"-title";this.template=_.template(e(t).html()),this.listenTo(m,"et-advanced-module:updated",this.render)},render:function(){return _.isUndefined(this.model.attributes.et_pb_admin_title)||""!==this.model.attributes.et_pb_admin_title||delete this.model.attributes.et_pb_admin_title,this.$el.html(this.template(this.model.attributes)),this}}),a.AdvancedModuleSettingEditViewContainer=window.wp.Backbone.View.extend({className:"et_pb_modal_settings_container",initialize:function(){this.template=_.template(e("#et-builder-advanced-setting-edit").html()),this.model=this.options.view.model,this.listenTo(m,"et-modal-view-removed",this.removeView)},events:{"click .et-pb-modal-save":"saveSettings","click .et-pb-modal-close":"removeView"},is_latlng:function(e){var t=e.split(","),i=!_.isUndefined(t[0])&&parseFloat(t[0]),o=!_.isUndefined(t[1])&&parseFloat(t[1]);return!(!i||_.isNaN(i)||!o||_.isNaN(o))&&new google.maps.LatLng(i,o)},render:function(){var t,i,o,n,d=this.model.attributes.cid,r=void 0,c=void 0,u=void 0,g=void 0,h=this,f=void 0,m=void 0,v=void 0,w=void 0,y=void 0;if(this.$el.html(this.template()),this.$el.addClass("et_pb_modal_settings_container_step2"),this.$el.attr("data-parent-cid",d),("auto"!==this.model.get("created")||this.attributes.show_settings_clicked)&&(r=new a.AdvancedModuleSettingEditView({view:this}),this.$el.append(r.render().el),this.child_view=r),this.model.set("et_pb__builder_version",et_pb_options.product_version),a.Events.trigger("et-advanced-module-settings:render",this),c=this.$el.find(".et-pb-color-picker-hex"),m=this.$el.find(".et-builder-color-picker-alpha"),c.length){var k=void 0,S=void 0;c.each(function(){var t=e(this);if(t.wpColorPicker({defaultColor:t.data("default-color"),palettes:""!==et_pb_options.page_color_palette?et_pb_options.page_color_palette.split("|"):et_pb_options.default_color_palette.split("|"),change:function(t,i){var o=e(this),n=o.closest(".et-pb-option-container"),a=n.find(".et-pb-reset-setting"),s=o.closest(".et-pb-custom-color-container"),l=n.find(".et-pb-option-preview"),d=o.hasClass("et-pb-color-picker-hex-has-preview"),r=o.closest(".et_pb_background-tab--gradient").length>0,p=i.color.toString().toLowerCase();s.length&&s.find(".et-pb-custom-color-picker").val(i.color.toString()),(a.length||d||r)&&(p!==ve(o).toLowerCase()?a.addClass("et-pb-reset-icon-visible"):(a.removeClass("et-pb-reset-icon-visible"),d&&l.addClass("et-pb-option-preview--empty")),d&&""!==p&&l.removeClass("et-pb-option-preview--empty"),d&&l.css({backgroundColor:p}),r&&ye(o),(d||r)&&(_.has(t,"originalEvent")&&_.has(t.originalEvent,"type")&&"square"===t.originalEvent.type&&(n.find(".button-confirm").css("backgroundColor",p+" !important"),n.hasClass("is-dragging")||n.addClass("is-dragging"),clearTimeout(k),k=setTimeout(function(){b(o),n.find(".button-confirm").css("backgroundColor",""),n.removeClass("is-dragging")},300)),clearTimeout(S),S=setTimeout(function(){o.focus()},300)),o.hasClass("et-pb-is-cleared")&&o.removeClass("et-pb-is-cleared"),o.trigger("et_pb_setting:color_picker:change",[p]))},width:t.closest(".et-pb-option--background").length?660:300,height:190,diviColorpicker:!!t.closest(".et-pb-option--background").length}),t.hasClass("et-pb-color-picker-hex-has-preview")){var i=t.closest(".et-pb-option-container");i.find(".et-pb-option-preview-button--add, .et-pb-option-preview-button--edit, .et-pb-option-preview").click(function(e){e.stopPropagation(),t.wpColorPicker("open")}),i.find(".et-pb-option-preview-button--delete").click(function(e){e.stopPropagation();var o=ve(t).toLowerCase();t.wpColorPicker("color",o).val(o).addClass("et-pb-is-cleared"),""===o&&i.find(".et-pb-option-preview").removeAttr("style").addClass("et-pb-option-preview--empty")})}})}if(m.length&&m.each(function(){var t=e(this),i=t.data("value").split("|"),o=i[0]||"#444444",n=i[2]||1;t.attr("data-opacity",n),t.val(o),t.minicolors({control:"hue",defaultValue:e(this).data("default-color")||"",opacity:!0,changeDelay:200,show:function(){t.minicolors("opacity",t.data("opacity"))},change:function(i,o){if(i){var n,a=t.minicolors("rgbObject"),s=e(t.data("field")),l=[];l.push(i),l.push(a.r+", "+a.g+", "+a.b),l.push(o),n=l.join("|"),s.length&&s.val(n)}},theme:"bootstrap"})}),t=this.$el.find(".et-pb-upload-button"),f=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview"),v=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--add"),w=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--edit"),y=this.$el.find(".et-pb-option-container--upload .et-pb-option-preview-button--delete"),t.length&&s(t),v.length||w.length||f.length){var x=function(t){t.preventDefault(),t.stopPropagation(),e(this).hasClass("et-pb-option-preview")&&!e(this).hasClass("et-pb-option-preview--empty")||e(this).closest(".et-pb-option").find(".et-pb-upload-button").trigger("click")};f.click(x),v.click(x),w.click(x)}if(y.length&&y.click(function(t){t.preventDefault(),t.stopPropagation();var i=e(this).closest(".et-pb-option"),o=i.find(".et-pb-upload-field"),n=i.find(".et-pb-option-preview");o.val(""),n.addClass("et-pb-option-preview--empty").find(".et-pb-preview-content").remove()}),(i=this.$el.find(".et-pb-video-image-button")).length&&p(i),o=this.$el.find(".et-pb-map"),"undefined"!=typeof google&&o.length){var $=void 0,V=void 0,T=this.$el.find(".et_pb_pin_address"),U=this.$el.find(".et_pb_pin_address_lat"),O=this.$el.find(".et_pb_pin_address_lng"),A=this.$el.find(".et_pb_find_address"),M=this.$el.find(".et_pb_zoom_level"),L=new google.maps.Geocoder,E=function(e){V.setPosition(e),$.setCenter(e)};T.on("change",function(){var e=T.val().trim();e.length<=0||L.geocode({address:e},function(t,i){if(i==google.maps.GeocoderStatus.OK){var o=t[0],n=o.geometry.location,a=h.is_latlng(e);a&&(n=a),isNaN(n.lat())||isNaN(n.lng())?alert(et_pb_options.map_pin_address_invalid):(T.val(o.formatted_address),U.val(n.lat()),O.val(n.lng()),E(n))}else alert(et_pb_options.geocode_error+": "+i)})}),A.on("click",function(e){e.preventDefault()}),setTimeout(function(){$=new google.maps.Map(o[0],{zoom:parseInt(M.val()),mapTypeId:google.maps.MapTypeId.ROADMAP}),V=new google.maps.Marker({map:$,draggable:!0,icon:{url:et_pb_options.images_uri+"/marker.png",size:new google.maps.Size(46,43),anchor:new google.maps.Point(16,43)},shape:{coord:[1,1,46,43],type:"rect"}}),google.maps.event.addListener(V,"dragend",function(){var e=V.getPosition();U.val(e.lat()),O.val(e.lng()),E(e);var t=new google.maps.LatLng(e.lat(),e.lng());L.geocode({latLng:t},function(e,t){t==google.maps.GeocoderStatus.OK?e[0]?T.val(e[0].formatted_address):alert(et_pb_options.no_results):alert(et_pb_options.geocode_error_2+": "+t)})}),""!=U.val()&&""!=O.val()&&E(new google.maps.LatLng(U.val(),O.val()))},200)}if((n=this.$el.find(".et-pb-gallery-button")).length&&l(n),(u=this.$el.find(".et-pb-social-network")).length){var D=this.$el.find(".reset-default-color"),I=this.$el.find("#et_pb_background_color");D.length&&D.click(function(){var e=D.parents(".et-pb-main-settings");u=e.find(".et-pb-social-network"),(I=e.find("#et_pb_background_color")).length&&(I.wpColorPicker("color",u.find("option:selected").data("color")),D.css("display","none"))}),u.change(function(){var e=u.parents(".et-pb-main-settings");if(!u.data("is_rendering_setting_view")&&u.val().length){var t=e.find("#et_pb_content"),i=e.find("#et_pb_background_color");if(t.length&&t.val(u.find("option:selected").text()),i.length){var o=u.find("option:selected").data("color");i.val(o).wpColorPicker("color",o),i.closest(".et-pb-option-container").find(".et-pb-option-preview").css({backgroundColor:o})}}}),I.val()!==u.find("option:selected").data("color")&&D.css("display","inline")}if((g=this.$el.find(".et_font_icon")).length){var P=this;g.each(function(){var t=e(this),i=t.siblings(".et-pb-font-icon"),o=e.trim(i.val()),n=t.find("li"),a="et_active",s=void 0,l=void 0,_=void 0;function d(){""!==o&&(-1!==o.search(/^%%/)?(_=parseInt(o.replace(/%/g,"")),s=t.find("li").eq(_)):s=t.find('li[data-icon="'+o+'"]'),s.addClass(a),t.is(":visible")&&setTimeout(function(){(l=s.offset().top-t.offset().top)>0&&t.animate({scrollTop:l},0)},110))}d(),P.$el.find(".et-pb-options-tabs-links").on("et_pb_main_tab:changed",d),n.click(function(){var t=e(this),o=t.index();if(t.hasClass(a))return!1;t.siblings("."+a).removeClass(a).end().addClass(a),o="%%"+o+"%%",i.val(o)})})}return function(t,i){var o=t.find(".et-pb-options-tab-advanced"),n=o.find(".et-pb-main-setting"),a=(e(".et_pb_modal_settings_container:not(.et_pb_modal_settings_container_step2)").find(".et-pb-options-tab-advanced"),j.findWhere({cid:i})),s=_.includes(["et_pb_column","et_pb_column_inner"],C(a,"attributes.module_type",""));if(s)return;o.length&&n.each(function(){var t=e(this),i=t.attr("id"),o="",n="";if(t.hasClass("et-pb-range")){var s=t.siblings(".et-pb-range-input");n=s.data(o)||"",s.each(function(){var t,i,s,l=e(this),d=l.attr("id"),r=void 0!==l.data("device")?l.data("device"):"all",p=e("#"+d);if(p.length&&(i=me(e(t=l)),s=e(t).data(i),!_.isArray(s)||!_.isObject(s[1]))){if(a.attributes.module_defaults=a.attributes.module_defaults||[],a.attributes.module_defaults[d]=p.val(),"all"!==r){var c=l.siblings(".et-pb-main-setting.et_pb_setting_mobile_"+r);c.data("default_inherited",p.val()),c.data("default",p.val())}o=me(p),n=p.data(o)||"",l.data("default_inherited",n),l.data("default",p.val())}})}else if(t.closest(".et-presets").length);else{var l=e("#"+i);if(l.length){var d=l.val();a.attributes.module_defaults=a.attributes.module_defaults||[],a.attributes.module_defaults[i]=d,o=me(l),n=l.data(o)||"",t.data("default_inherited",n),t.data(o,d)}}})}(this.$el,d),ce(this.$el,d),this},removeView:function(e){e&&e.preventDefault(),this.$el.find("#et_pb_content")&&e&&se("et_pb_content"),Ve(this),this.child_view&&this.child_view.remove(),this.remove()},saveSettings:function(t){var i=this,o={},n=this.model.get("module_defaults")||"";if(t.preventDefault(),this.$("input, select, textarea").each(function(){var t=e(this),a=t.attr("id"),s=void 0,l=[];if(t.is(":checkbox")&&(a=t.attr("name")),void 0===a||-1!==a.indexOf("qt_")&&"button"===t.attr("type"))return!0;if(t.is(":checkbox")||(a=t.attr("id").replace("data.","")),t.is(":checkbox")&&void 0!==o[a])return!0;if(s=t.is("#et_pb_content")?ee("et_pb_content"):t.val(),t.is(".et-pb-text-align-select")&&!t.parent().find(".et_text_align_active").length)return!0;if(_.isEmpty(t.data("check_attr_default"))||"yes"!==t.data("check_attr_default")){if(""!==n&&void 0!==n[a]&&n[a]===s){if(!t.hasClass("yes_no_button"))return i.model.unset(a),!0;delete n[a],i.model.set("module_defaults",n)}}else if(we(t))return i.model.unset(a),!0;t.is(":checkbox")&&void 0===o[a]&&(t.closest(".et-pb-option-container").find('[name="'+a+'"]:checked').each(function(){l.push(e(this).val())}),s=l.join(",")),t.closest(".et-pb-custom-css-option").length&&(s=""!==s?s.replace(/(?:\r\n|\r|\n)/g,"||"):""),o[a]=s}),_.isUndefined(o.et_pb_pin_address)||_.isUndefined(o.et_pb_pin_address_lat)||_.isUndefined(o.et_pb_pin_address_lng)||""!==o.et_pb_pin_address&&""!==o.et_pb_pin_address_lat&&""!==o.et_pb_pin_address_lng){var a=y.getView(i.model.attributes.view.model.model.attributes.cid);if(_.isUndefined(a.model.get("value_changes"))||a.model.unset("value_changes"),!_.isUndefined(i.model.attributes.column_cid))y.getView(i.model.attributes.column_cid).model.set(o,{silent:!0});this.model.set(o,{silent:!0}),m.trigger("et-advanced-module:updated"),m.trigger("et-advanced-module:saved"),se("et_pb_content"),this.removeView()}else alert(et_pb_options.map_pin_address_error)}}),a.AdvancedModuleSettingEditView=window.wp.Backbone.View.extend({className:"et_pb_module_settings",initialize:function(){this.model=this.options.view.options.view.model;var t="et_pb_column_inner"===this.model.get("module_type")?"et_pb_column":this.model.get("module_type");this.template=_.template(e("#et-builder-advanced-setting-"+t).html())},events:{},render:function(){var e=this.$el,t=void 0,i=void 0;if(this.$el.html(this.template({data:this.model.toJSON()})),this.$el.find(".et-pb-main-settings").addClass("et-pb-main-settings-advanced"),(t=this.$el.find("div#et_pb_content")).length){i=t.closest(".et-pb-option-container");var o=t.html();t.remove(),i.prepend(U.find("#et_pb_content_editor").html()),setTimeout(function(){void 0!==window.switchEditors&&window.switchEditors.go("et_pb_content",ie()),ae("et_pb_content",o),window.wpActiveEditor="et_pb_content"},300)}return setTimeout(function(){e.find("select, input, textarea, radio").filter(":eq(0)").focus()},1),this}}),a.BlockModuleView=window.wp.Backbone.View.extend({className:function(){var e="et_pb_module_block";return void 0!==this.model.attributes.className&&(e+=this.model.attributes.className),e},template:_.template(e("#et-builder-block-module-template").html()),initialize:function(){this.listenTo(this.model,"change:admin_label",this.renameModule),this.listenTo(this.model,"change:et_pb_disabled",this.toggleDisabledClass),this.listenTo(this.model,"change:et_pb_global_module",this.removeGlobal)},events:{"click .et-pb-settings":"showSettings","click .et-pb-clone-module":"cloneModule","click .et-pb-remove-module":"removeModule","click .et-pb-unlock":"unlockModule",contextmenu:"showRightClickOptions","click.et-pb-right-click":"hideRightClickOptions","click.et-ab-testing":"setABTesting"},render:function(){var e=y.getParentViews(this.model.get("parent"));return this.$el.html(this.template(this.model.attributes)),(void 0!==this.model.attributes.et_pb_global_module||void 0!==this.model.attributes.et_pb_template_type&&"module"===this.model.attributes.et_pb_template_type&&"global"===et_pb_options.is_global_template)&&this.$el.addClass("et_pb_global"),void 0!==this.model.get("et_pb_locked")&&"on"===this.model.get("et_pb_locked")&&_.each(e,function(e){e.$el.addClass("et_pb_children_locked")}),void 0!==this.model.get("et_pb_parent_locked")&&"on"===this.model.get("et_pb_parent_locked")&&this.$el.addClass("et_pb_parent_locked"),J.is_active()&&(J.is_subject(this.model)&&(this.$el.addClass("et_pb_ab_subject"),J.set_subject_rank_coloring(this)),J.is_goal(this.model)&&this.$el.addClass("et_pb_ab_goal"),J.is_user_has_permission(this.model.get("cid"),"module",this.model)||this.$el.addClass("et_pb_ab_no_permission")),"removed"===this.model.get("component_status")?this:(y.isModuleFullwidth(this.model.get("module_type"))&&this.$el.addClass("et_pb_fullwidth_module"),void 0!==this.model.get("pasted_module")&&this.model.get("pasted_module")&&Y(this.$el),this)},cloneModule:function(e){var t="",i=void 0,o={model:this.model,view:this.$el,view_event:e};e.preventDefault(),V.isLoading||J.is_selecting()||this.isModuleLocked()||(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"module")?((this.$el.closest(".et_pb_section.et_pb_global").length||this.$el.closest(".et_pb_row.et_pb_global").length)&&""===et_pb_options.template_post_id&&(t=Pe(this)),i=new a.RightClickOptionsView(o,!0),V.allowHistorySaving("cloned","module",this.model.get("admin_label")),i.copy(e),i.pasteAfter(e),""!==t&&Ie(t)):J.alert("has_no_permission"))},renameModule:function(){this.$(".et-pb-module-title").html(this.model.get("admin_label"))},removeGlobal:function(){this.isModuleLocked()||void 0===this.model.get("et_pb_global_module")&&this.$el.removeClass("et_pb_global")},toggleDisabledClass:function(){void 0!==this.model.get("et_pb_disabled")&&"on"===this.model.get("et_pb_disabled")?this.$el.addClass("et_pb_disabled"):this.$el.removeClass("et_pb_disabled")},showSettings:function(t){var o=this,n={model:this.model,collection:this.collection,attributes:{"data-open_view":"module_settings"},triggered_by_right_click:this.triggered_by_right_click,do_preview:this.do_preview};if(void 0!==t&&t.preventDefault(),i(),!this.isModuleLocked()&&!V.isLoading&&!J.is_selecting())if(!J.is_active()||J.is_user_has_permission(this.model.get("cid"),"module")){if(void 0!==this.model.get("et_pb_global_module")&&""!==this.model.get("et_pb_global_module"))!function(t){var i=void 0,o=t.model.get("et_pb_global_module"),n="html"===ie()?"skip":"apply";e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_get_global_module",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_global_id:o,et_global_autop:n},beforeSend:function(){m.trigger("et-pb-loading:started")},complete:function(){m.trigger("et-pb-loading:ended")},success:function(n){if(!n||n.error)y.removeGlobalAttributes(t);else{var s=V.getShortCodeParentTags(),l=window.wp.shortcode.regexp(s),d=V.wp_regexp_not_global(s),r=qe(n.shortcode).match(l),p=n.sync_status,c="updated"===p?JSON.parse(n.excluded_options):[];"updated"===p?g[o]=0<c.length?c:[]:h[o]=[],_.each(r,function(i,n){var a=i.match(d),s=a[2],r=""!==a[3]?window.wp.shortcode.attrs(a[3]):"",c=a[5],b=(void 0!==c&&""!==c&&c.match(l),r.named.saved_tabs||t.model.get("et_pb_saved_tabs")),u="updated"!==p&&"all"!==b&&-1===b.indexOf("general"),f="updated"===p?-1===g[o].indexOf("et_pb_content_field"):""!==b&&(-1!==b.indexOf("general")||"all"===b);if("all"===b&&"updated"!==p&&(g[o]=[],p="updated"),_.isObject(r.named))for(var m in r.named)if("template_type"!==m&&("admin_label"!==m||"admin_label"===m&&!u)){if("updated"===p&&-1!==g[o].indexOf(m))continue;var v="admin_label"!==m?"et_pb_"+m:m;""!==m&&t.model.set(v,r.named[m],{silent:!0}),"updated"!==p&&h[o].push(m)}if(f){var w="et_pb_content",y=V.getShortCodeRawContentTags();e.inArray(s,y)>-1&&(w="et_pb_raw_content",c=(c=c).replace(/<!-- \[et_pb_line_break_holder\] -->/g,"\n")),t.model.set(w,c,{silent:!0}),"updated"!==p&&h[o].push("et_pb_content_field")}"updated"!==p&&t.model.set("legacy_synced_options",h[o],{silent:!0})})}i=new a.ModalView(t),e("body").append(i.render().el),!0===t.triggered_by_right_click&&!0===t.do_preview&&e(".et-pb-modal-preview-template").trigger("click"),n&&!n.error&&(e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal et_pb_modal_selective_sync"),Je(e(".et_pb_modal_settings_container"),o))}})}(n),this.triggered_by_right_click=void 0,this.do_preview=void 0;else{var s=new a.ModalView(n).render();if(!1===s)return k(!0),setTimeout(function(){o.showSettings()},500),void m.trigger("et-pb-loading:started");m.trigger("et-pb-loading:ended"),e("body").append(s.el)}Re(),(void 0!==this.model.get("et_pb_global_parent")&&""!==this.model.get("et_pb_global_parent")||y.getView(this.model.get("cid")).$el.closest(".et_pb_global").length)&&(e(".et_pb_modal_settings_container").addClass("et_pb_saved_global_modal"),"module"===et_pb_options.global_module_type&&(Je(e(".et_pb_modal_settings_container"),et_pb_options.template_post_id),e(".et_pb_modal_settings_container").addClass("et_pb_modal_selective_sync")))}else J.alert("has_no_permission")},removeModule:function(e){var t="";if(!this.isModuleLocked()&&!V.isLoading&&(!J.is_selecting()||y.get("forceRemove"))){if(J.is_active()){if(!J.is_user_has_permission(this.model.get("cid"),"module"))return void J.alert("has_no_permission");if(J.is_unremovable_subject(this.model)&&!y.get("forceRemove"))return}e&&(e.preventDefault(),(this.$el.closest(".et_pb_section.et_pb_global").length||this.$el.closest(".et_pb_row.et_pb_global").length)&&""===et_pb_options.template_post_id&&(t=Pe(this))),this.model.destroy(),V.allowHistorySaving("removed","module",this.model.get("admin_label")),y.removeView(this.model.get("cid")),this.remove(),e&&m.trigger("et-module:removed"),""!==t&&Ie(t),J.update()}},unlockModule:function(e){if(e.preventDefault(),!V.isLoading&&!J.is_selecting()){var t=this,i=t.$el.closest(".et_pb_module_block"),o=Ne(),n=void 0;o.done(function(e){!0===e?(i.removeClass("et_pb_locked"),t.options.model.attributes.et_pb_locked="off",n=y.getParentViews(t.model.get("parent")),_.each(n,function(e,t){y.isChildrenLocked(e.model.get("cid"))||e.$el.removeClass("et_pb_children_locked")}),V.allowHistorySaving("unlocked","module",t.options.model.get("admin_label")),V.saveAsShortcode()):alert(et_pb_options.locked_module_permission_alert)})}},isModuleLocked:function(){return"on"===this.model.get("et_pb_locked")||"on"===this.model.get("et_pb_parent_locked")},showRightClickOptions:function(e){e.preventDefault();var t={model:this.model,view:this.$el,view_event:e};new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()},setABTesting:function(e){e.preventDefault(),e.stopPropagation(),J.set(this,e)}}),a.HelpView=window.wp.Backbone.View.extend({tagName:"div",id:"et-builder-help",className:"et_pb_modal_settings",template:_.template(e("#et-builder-help-template").html()),isOSX:-1!=navigator.userAgent.indexOf("Mac OS X"),renderKbd:function(t){var i=t;return"super"===i&&(i=this.isOSX?"cmd":"ctrl"),e("<kbd />",{class:"key-"+i}).html(i)},render:function(){var t=this,o=this.$el;i(),o.html(this.template());var n=o.find(".et-pb-shortcuts-tab");return _.each(et_pb_help_options.shortcuts,function(i){_.each(i,function(i){if(_.isUndefined(i.title)){var o=e("<p />",{class:"et-pb-shortcut-item"}),a=e("<span />",{class:"et-pb-shortcut-keys"});_.each(i.kbd,function(i,o){o>0&&a.append(" + "),_.isArray(i)?_.each(i,function(t,i){i>0&&a.append(" / "),a.append(e("<kbd />").html(t))}):a.append(t.renderKbd(i))}),o.append(a),o.append(e("<span />",{class:"et-pb-shortcut-desc"}).html(i.desc)),n.append(o)}else n.append(e("<h2 />",{class:"et-pb-shortcut-subtitle"}).html(i.title))})}),this}}),a.RightClickOptionsView=window.wp.Backbone.View.extend({tagName:"div",id:"et-builder-right-click-controls",template:_.template(e("#et-builder-right-click-controls-template").html()),events:{"click .et-pb-right-click-rename":"rename","click .et-pb-right-click-start-ab-testing":"startABTesting","click .et-pb-right-click-end-ab-testing":"endABTesting","click .et-pb-right-click-save-to-library":"saveToLibrary","click .et-pb-right-click-undo":"undo","click .et-pb-right-click-redo":"redo","click .et-pb-right-click-disable":"disable","click .et_pb_disable_on_option":"disable_device","click .et-pb-right-click-lock":"lock","click .et-pb-right-click-collapse":"collapse","click .et-pb-right-click-copy":"copy","click .et-pb-right-click-paste-after":"pasteAfter","click .et-pb-right-click-paste-app":"pasteApp","click .et-pb-right-click-paste-column":"pasteColumn","click .et-pb-right-click-preview":"preview","click .et-pb-right-click-disable-global":"disableGlobal"},initialize:function(t,i){i=!_.isUndefined(i)&&i;var o=void 0;if(this.type=this.options.model.attributes.type,this.et_pb_has_storage_support=He(),this.has_compatible_clipboard_content=Ye.get(this.getClipboardType()),this.history_noun="row_inner"===this.type?"row":this.type,!V.isLoading&&!J.is_selecting()){if("1"===et_pb_options.is_divi_library&&!1!==this.has_compatible_clipboard_content){switch(et_pb_options.layout_type){case"module":o=[];break;case"row":o=["module"];break;case"section":o=["module","row"];break;default:o=["module","row","section"]}-1==e.inArray(this.type,o)&&(this.has_compatible_clipboard_content=!1)}!1===i&&this.render()}},render:function(){var t=e(this.options.view),i=this.$el.html(this.template()),o=this.options.view.offset(),n=this.options.view_event.pageX-o.left-100,a=this.options.view_event.pageY-o.top;this.closeAllRightClickOptions(),e(this.options.view_event.toElement).is("#et-builder-right-click-controls a")||i.find("li").length<1||(t.append(i),i.find(".options").css({top:a,left:n,"margin-top":0-i.find(".options").height()-40}).animate({"margin-top":0-i.find(".options").height()-10,opacity:1},300),e("#et_pb_layout").prepend('<div id="et_pb_layout_right_click_overlay" />'))},closeAllRightClickOptions:function(){return i(),!1},rename:function(e){e.preventDefault();this.$el.parent();G("rename_admin_label",this.options.model.attributes.cid),this.closeAllRightClickOptions()},startABTesting:function(t){this.closeAllRightClickOptions(),J.toggle_status(!0),V.disable_publish=!0,e("#publish").addClass("disabled"),J.check_create_db(),V.is_selecting_ab_testing_subject=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_subject")},endABTesting:function(e){this.closeAllRightClickOptions(),J.toggle_status(!1),V.is_selecting_ab_testing_subject=!1,J.count_subjects()>0&&G("turn_off_ab_testing")},disableGlobal:function(e){e.preventDefault(),this.closeAllRightClickOptions(),y.removeGlobalAttributes(this),Ue()},saveToLibrary:function(t){t.preventDefault();var i=this.options.model,o=i.attributes.type,n={model:i,collection:j,attributes:{"data-open_view":"module_settings"}};if(this.closeAllRightClickOptions(),!J.is_active()||!J.is_ab_testing_item(i)&&"app"!==o)if("app"===this.type)G("save_layout");else{var s=new a.ModalView(n);e("body").append(s.render().el),Re(),s.saveTemplate(t)}else J.alert("cannot_save_"+o+"_layout_has_ab_testing")},undo:function(e){e.preventDefault(),V.undo(e),this.closeAllRightClickOptions()},redo:function(e){e.preventDefault(),V.redo(e),this.closeAllRightClickOptions()},disable:function(t){t.preventDefault();var i=e(t.target).hasClass("et-pb-right-click-disable")?e(t.target):e(t.target).closest("a"),o=i.closest("li").find("span.et_pb_disable_on_options"),n=o.find("span.et_pb_disable_on_option"),a=!(void 0===this.options.model.attributes.et_pb_disabled||"on"!==this.options.model.attributes.et_pb_disabled),s=void 0!==this.options.model.attributes.et_pb_disabled_on?this.options.model.attributes.et_pb_disabled_on:"",l=void 0,_=void 0,d=void 0;return i.addClass("et_pb_right_click_hidden"),o.addClass("et_pb_right_click_visible"),a?n.addClass("et_pb_disable_on_active"):""!==s&&(l=s.split("|"),_=0,d="phone",n.each(function(){var t=e(this);t.hasClass("et_pb_disable_on_"+d)&&"on"===l[_]&&t.addClass("et_pb_disable_on_active"),d=1===++_?"tablet":"desktop"})),!1},disable_device:function(t){var i=e(t.target),o=(e(this),i.hasClass("et_pb_disable_on_active")?"off":"on"),n=void 0!==this.options.model.attributes.et_pb_disabled_on?this.options.model.attributes.et_pb_disabled_on:"",a=this.$el.parent(),s=void 0,l=void 0,_=void 0,d=void 0;return i.hasClass("et_pb_disable_on_phone")?(_=0,d="phone"):i.hasClass("et_pb_disable_on_tablet")?(_=1,d="tablet"):(_=2,d="desktop"),(l=""!==n?n.split("|"):["","",""])[_]=o,this.options.model.attributes.et_pb_disabled_on=l[0]+"|"+l[1]+"|"+l[2],"on"===l[0]&&"on"===l[1]&&"on"===l[2]?(a.addClass("et_pb_disabled"),this.options.model.attributes.et_pb_disabled="on",s="disabled"):(a.removeClass("et_pb_disabled"),this.options.model.attributes.et_pb_disabled="off",s="off"===o?"enabled":"disabled"),i.toggleClass("et_pb_disable_on_active"),this.updateGlobalModule(),V.allowHistorySaving(s,this.history_noun,void 0,d),V.saveAsShortcode(),!1},lock:function(e){e.preventDefault(),this.$el.parent().hasClass("et_pb_locked")?(this.unlockItem(),V.allowHistorySaving("unlocked",this.history_noun)):(this.lockItem(),V.allowHistorySaving("locked",this.history_noun)),this.closeAllRightClickOptions(),V.saveAsShortcode()},unlockItem:function(){var e=this,t=e.$el.parent(),i=Ne(),o=void 0,n=void 0;i.done(function(i){!0===i?(t.removeClass("et_pb_locked"),e.options.model.attributes.et_pb_locked="off","module"!==e.options.model.get("type")&&(o=y.getChildrenViews(e.model.get("cid")),_.each(o,function(e,t){e.$el.removeClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","off",{silent:!0})})),"section"!==e.options.model.get("type")&&(n=y.getParentViews(e.model.get("parent")),_.each(n,function(e,t){y.isChildrenLocked(e.model.get("cid"))||e.$el.removeClass("et_pb_children_locked")})),V.allowHistorySaving("unlocked",e.history_noun),V.saveAsShortcode(),e.updateGlobalModule()):alert(et_pb_options.locked_item_permission_alert)})},lockItem:function(){var e=this,t=e.$el.parent(),i=Ne(),o=void 0,n=void 0;i.done(function(i){!0===i?(t.addClass("et_pb_locked"),e.options.model.attributes.et_pb_locked="on","module"!==e.options.model.get("type")&&(o=y.getChildrenViews(e.model.get("cid")),_.each(o,function(e,t){e.$el.addClass("et_pb_parent_locked"),e.model.set("et_pb_parent_locked","on",{silent:!0})})),"section"!==e.options.model.get("type")&&(n=y.getParentViews(e.model.get("parent")),_.each(n,function(e,t){e.$el.addClass("et_pb_children_locked")})),V.allowHistorySaving("locked",e.history_noun),V.saveAsShortcode(),e.updateGlobalModule()):alert(et_pb_options.locked_item_permission_alert)})},collapse:function(e){e.preventDefault();var t=this.$el.parent(),i=this.options.model.attributes.cid,o=void 0;t.toggleClass("et_pb_collapsed"),t.hasClass("et_pb_collapsed")?(this.options.model.attributes.et_pb_collapsed="on",o="collapsed"):(this.options.model.attributes.et_pb_collapsed="off",o="expanded"),J.is_active()&&"on"===this.model.get("et_pb_ab_subject")&&J.subject_carousel(i),this.updateGlobalModule(),this.closeAllRightClickOptions(),V.allowHistorySaving(o,this.history_noun),V.saveAsShortcode()},copy:function(e,t){t||e.preventDefault();var i,o=_.clone(this.model.attributes),n=o.type;"row_inner"===n&&(n="row"),_.isUndefined(o.view)||delete o.view,_.isUndefined(o.appendAfter)||delete o.appendAfter,"row"!==n&&"section"!==n||(o.childviews=this.getChildViews(o.cid)),delete o.className,delete o.et_pb_locked,i=JSON.stringify(o),Ye.set(this.getClipboardType(),i),this.closeAllRightClickOptions()},pasteAfter:function(e,t,i,o,n,a){if(n||e.preventDefault(),Fe(this.model)){t=_.isUndefined(t)?this.model.get("parent"):t,i=_.isUndefined(i)?this.getClipboardType():i,o=!!_.isUndefined(o)||o;var s=y.getView(t),l=void 0;l=Ye.get(i),l=JSON.parse(l),_.isUndefined(l.et_pb_ab_subject)&&"on"!==l.et_pb_ab_subject||(l.et_pb_ab_subject_id=J.get_subject_id()),o&&(l.cloned_cid=this.model.get("cid")),this.setPasteViews(l,t,"main_parent"),!J.is_active()||"row"!==l.type&&"row_inner"!==l.type&&"section"!==l.type||"on"!==l.et_pb_ab_subject||J.subject_carousel(l.cid),m.trigger("et-advanced-module:updated"),m.trigger("et-advanced-module:saved"),_.isUndefined(s)||!y.is_global(s.model)&&!y.is_global_children(s.model)||this.updateGlobalModule(),this.closeAllRightClickOptions(),"did"!==T.verb||a||V.allowHistorySaving("copied",this.history_noun),n||V.saveAsShortcode()}},pasteApp:function(e){e.preventDefault();var t=j.where({type:"section"}),i=_.last(t);this.model=i,this.options.model=i,this.pasteAfter(e,void 0,"et_pb_clipboard_section",!1)},pasteColumn:function(e){e.preventDefault();var t=this.model.get("cid"),i="section"===this.model.get("type")?"et_pb_clipboard_module_fullwidth":"et_pb_clipboard_module";this.pasteAfter(e,t,i,!1)},getClipboardType:function(){var e="et_pb_clipboard_"+this.model.attributes.type;return"et_pb_fullwidth"===(_.isUndefined(this.model.attributes.module_type)?this.model.attributes.type:this.model.attributes.module_type).substr(0,"et_pb_fullwidth".length)&&(e+="_fullwidth"),e},getChildViews:function(e){var t=this,i=j.models,o=void 0,n=[];return _.each(i,function(i,a){i.attributes.parent===e&&(o=i.attributes,_.isUndefined(o.view)||delete o.view,_.isUndefined(o.appendAfter)||delete o.appendAfter,o.created="manually",o.childviews=t.getChildViews(i.attributes.cid),n.push(o))}),n},setPasteViews:function(e,t,i){var o=this,n=y.generateNewId(),a=this.model.collection.indexOf(this.model),s=!(_.isUndefined(e.childviews)||!_.isArray(e.childviews))&&e.childviews;e.cid=n,e.parent=t,e.created="manually",e.pasted_module=void 0!==i&&"main_parent"===i,_.isUndefined(e.et_pb_global_parent)||""===e.et_pb_global_parent||(e.et_pb_global_parent=Pe(y.getView(t))),!_.isUndefined(e.et_pb_global_module)&&_.isUndefined(e.global_parent_cid)&&_.isUndefined(this.set_global_parent_cid)&&(this.global_parent_cid=n,this.set_global_parent_cid=!0),_.isUndefined(e.global_parent_cid)||(e.global_parent_cid=this.global_parent_cid),_.each(["et_pb_global_parent","global_parent_cid"],function(t){!_.isUndefined(o.options.model.get(t))&&_.isUndefined(e[t])&&(e[t]=o.options.model.get(t))}),_.isUndefined(e.et_pb_template_type)||delete e.et_pb_template_type,_.isUndefined(e.et_pb_ab_subject)&&"on"!==e.et_pb_ab_subject||(e.et_pb_ab_subject_id=J.get_subject_id()),delete e.childviews,_.isUndefined(e.admin_label)&&(e.admin_label=_.isUndefined(e.module_type)?"":y.getDefaultAdminLabel(e.module_type)),this.model.collection.add(e,{at:a}),s&&_.each(s,function(e){o.setPasteViews(e,n)})},updateGlobalModule:function(){var e=void 0;y.is_global(this.model)?e=this.options.model.get("cid"):y.is_global_children(this.model)&&(e=this.options.model.get("global_parent_cid")),_.isUndefined(e)||Ie(e)},hasOption:function(e){var t="function"==typeof this.model.get&&this.model.get("cid"),i=!1,o=this.options.model.attributes.type,n=J.is_active(),a=!!n&&J.is_goal(this.model),s=!!n&&J.is_goal_children(this.model),l=!!n&&J.has_goal(this.model),d=!!n&&J.is_subject(this.model),r=!!n&&J.is_subject_children(this.model),p=!n||J.is_user_has_permission(t,"right_click_change"),c=!n||J.is_user_has_permission(t,"copy"),b=!n||J.is_user_has_permission(t,"paste");switch(e){case"rename":this.hasOptionSupport(["module","section","row_inner","row"])&&"on"!==this.options.model.attributes.et_pb_locked&&p&&(i=!0);break;case"save-to-library":!this.hasOptionSupport(["app","section","row_inner","row","module"])||y.is_global(this.options.model)||y.is_global_children(this.options.model)||"on"===this.options.model.attributes.et_pb_locked||J.is_active()&&(J.is_ab_testing_item(this.options.model)||"app"===o)||"1"===et_pb_options.is_divi_library||(i=!0);break;case"start-ab-testing":this.hasOptionSupport(["section","row_inner","row","module"])&&!n&&(i=!0);break;case"end-ab-testing":this.hasOptionSupport(["section","row_inner","row","module"])&&(d||a||r||s)&&n&&(i=!0);break;case"disable-global":this.hasOptionSupport(["section","row_inner","row","module"])&&(y.is_global(this.options.model)||y.is_global_children(this.options.model))&&(i=!0);break;case"undo":this.hasOptionSupport(["app","section","row_inner","row","column","column_inner","module"])&&this.hasUndo()&&(i=!0);break;case"redo":this.hasOptionSupport(["app","section","row_inner","row","column","column_inner","module"])&&this.hasRedo()&&(i=!0);break;case"disable":this.hasOptionSupport(["section","row_inner","row","module"])&&"on"!==this.options.model.attributes.et_pb_locked&&!1===this.hasDisabledParent()&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&p&&(i=!0);break;case"lock":this.hasOptionSupport(["section","row_inner","row","module"])&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&p&&(i=!0);break;case"collapse":this.hasOptionSupport(["section","row_inner","row"])&&"on"!==this.options.model.attributes.et_pb_locked&&(!J.is_active()||"on"!==this.options.model.get("et_pb_ab_subject")||"off"!==this.options.model.get("et_pb_collapsed")&&!_.isUndefined(this.options.model.get("et_pb_collapsed")))&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&(i=!0);break;case"copy":this.hasOptionSupport(["section","row_inner","row","module"])&&this.et_pb_has_storage_support&&_.isUndefined(this.model.attributes.et_pb_skip_module)&&c&&!a&&!l&&(i=!0);break;case"paste-after":this.hasOptionSupport(["section","row_inner","row","module"])&&this.et_pb_has_storage_support&&this.has_compatible_clipboard_content&&b&&Fe(this.options.model)&&(i=!0);break;case"paste-app":this.hasOptionSupport(["app"])&&this.et_pb_has_storage_support&&Ye.get("et_pb_clipboard_section")&&(i=!0);break;case"paste-column":!_.isUndefined(this.model.attributes.is_insert_module)&&(("column"===this.type||"column_inner"==this.type)&&Ye.get("et_pb_clipboard_module")||"section"===this.type&&Ye.get("et_pb_clipboard_module_fullwidth"))&&this.et_pb_has_storage_support&&(i=!0);break;case"preview":this.hasOptionSupport(["section","row_inner","row","module"])&&"on"!==this.options.model.attributes.et_pb_locked&&(i=!0)}return i},hasOptionSupport:function(e){return!_.isUndefined(_.findWhere(e,this.type))},hasUndo:function(){return V.hasUndo()},hasRedo:function(){return V.hasRedo()},hasDisabledParent:function(){for(var e=y.getView(this.model.attributes.parent),t={},i=!1;!_.isUndefined(e);)_.isUndefined(e.model.attributes.et_pb_disabled)||"on"!==e.model.attributes.et_pb_disabled||(i=!0),t[e.model.attributes.cid]=e,e=y.getView(e.model.attributes.parent);return i},preview:function(t){t.preventDefault();var i=y.getView(this.model.get("cid"));this.closeAllRightClickOptions(),i.triggered_by_right_click=!0,i.do_preview=!0,i.showSettings(t),e(".et-pb-modal-preview-template").trigger("click")}}),a.visualizeHistoriesView=window.wp.Backbone.View.extend({el:"#et-pb-histories-visualizer",template:_.template(e("#et-builder-histories-visualizer-item-template").html()),events:{"click li":"rollback"},verb:"did",noun:"module",noun_alias:void 0,addition:"",getItemID:function(e){return"#et-pb-history-"+e.get("timestamp")},getVerb:function(){var e=this.verb;return _.isUndefined(et_pb_options.verb[e])||(e=et_pb_options.verb[e]),e},getNoun:function(){var e=this.noun;return _.isUndefined(this.noun_alias)?_.isUndefined(et_pb_options.noun[e])||(e=et_pb_options.noun[e]):e=this.noun_alias,e},getAddition:function(){var e=this.addition;return _.isUndefined(et_pb_options.addition[e])||(e=et_pb_options.addition[e]),e},addItem:function(e){this.options=e,this.$el.prepend(this.template()),this.setHistoriesHeight()},changeItem:function(t){var i=this.getItemID(t),o=e(i),n=t.collection.findWhere({current_active_history:!0}),a=t.collection.indexOf(n),s=t.collection.indexOf(t);this.options=t,this.$el.find("li").removeClass("undo redo active"),a===s?(o.addClass("active"),this.$el.find("li:lt("+o.index()+")").addClass("redo"),this.$el.find("li:gt("+o.index()+")").addClass("undo")):this.$el.find("li:not( .active, .redo )").addClass("undo"),this.setHistoriesHeight()},removeItem:function(e){var t=this.getItemID(e);this.$el.find(t).remove(),this.setHistoriesHeight()},setHistoryMeta:function(e,t,i,o){_.isUndefined(e)||(this.verb=e),_.isUndefined(t)||(this.noun=t),_.isUndefined(i)?this.noun_alias=void 0:this.noun_alias=i,_.isUndefined(o)||(this.addition=o)},setHistoriesHeight:function(){var t=this;setTimeout(function(){var i=e("#et_pb_layout"),o=i.find(".hndle"),n=e("#et_pb_layout_controls"),a=i.outerHeight()-o.outerHeight()-n.outerHeight();t.$el.css({"max-height":a})},200)},rollback:function(t){t.preventDefault();var i=e(t.target),o=(i.is("li")?i:i.parent("li")).data("timestamp"),n=this.options.collection.findWhere({timestamp:o}),a=n.get("shortcode");V.resetCurrentActiveHistoryMarker(),n.set({current_active_history:!0}),m.trigger("et-pb-loading:started"),ae("content",a,"saving_to_content"),setTimeout(function(){var t=e("#et_pb_layout"),i=t.innerHeight();t.css({height:i}),V.removeAllSections(),V.$el.find(".et_pb_section").remove(),V.enable_history=!1,V.createLayoutFromContent(Oe(a),"","",{is_reinit:"reinit"}),J.is_active_based_on_models()?(J.toggle_status(!0),Ue()):J.toggle_status(!1),t.css({height:"auto"}),m.trigger("et-pb-loading:ended"),V.updateHistoriesButtonState()},600)}}),a.AppView=window.wp.Backbone.View.extend({el:e("#et_pb_main_container"),template:_.template(e("#et-builder-app-template").html()),template_button:_.template(e("#et-builder-add-specialty-section-button").html()),events:{"click .et-pb-layout-buttons-save":"saveLayout","click .et-pb-layout-buttons-load":"loadLayout","click .et-pb-layout-buttons-clear":"clearLayout","click .et-pb-layout-buttons-history":"toggleHistory","click #et-pb-histories-visualizer-overlay":"closeHistory","contextmenu #et-pb-histories-visualizer-overlay":"closeHistory","click .et-pb-layout-buttons-redo":"redo","click .et-pb-layout-buttons-undo":"undo","click .et-pb-layout-buttons-view-ab-stats":"viewABStats","click .et-pb-layout-buttons-settings":"settings","contextmenu .et-pb-layout-buttons-save":"showRightClickOptions","contextmenu .et-pb-layout-buttons-load":"showRightClickOptions","contextmenu .et-pb-layout-buttons-clear":"showRightClickOptions","contextmenu .et-pb-layout-buttons-redo":"showRightClickOptions","contextmenu .et-pb-layout-buttons-undo":"showRightClickOptions","contextmenu #et_pb_main_container_right_click_overlay":"showRightClickOptions","click #et_pb_main_container_right_click_overlay":"hideRightClickOptions"},initialize:function(){this.listenTo(this.collection,"add",this.addModule),this.listenTo($,"add",this.addVisualizeHistoryItem),this.listenTo($,"change",this.changeVisualizeHistoryItem),this.listenTo($,"remove",this.removeVisualizeHistoryItem),this.listenTo(m,"et-sortable:update",_.debounce(this.saveAsShortcode,128)),this.listenTo(m,"et-model-changed-position-within-column",_.debounce(this.saveAsShortcode,128)),this.listenTo(m,"et-module:removed",_.debounce(this.saveAsShortcode,128)),this.listenTo(m,"et-pb-loading:started",this.startLoadingAnimation),this.listenTo(m,"et-pb-loading:ended",this.endLoadingAnimation),this.listenTo(m,"et-pb-content-updated",this.recalculateModulesOrder),this.listenTo(m,"et-advanced-module:updated_order",this.updateAdvancedModulesOrder),this.listenTo(m,"et-pb-content-updated",_.debounce(this.updateYoastContent,500)),this.$builder_toggle_button=e("body").find("#et_pb_toggle_builder"),this.$builder_toggle_button_wrapper=e("body").find(".et_pb_toggle_builder_wrapper"),this.render(),this.maybeGenerateInitialLayout(),e("#et_builder_version").val("BB|"+window.et_builder_product_name+"|"+window.et_builder_version)},render:function(){return this.$el.html(this.template()),this.makeSectionsSortable(),this.addLoadingAnimation(),e("#et_pb_main_container_right_click_overlay").remove(),this.$el.prepend('<div id="et_pb_main_container_right_click_overlay" />'),this.updateHistoriesButtonState(),this},addLoadingAnimation:function(){e("body").append('<div id="et_pb_loading_animation"></div>'),this.$loading_animation=e("#et_pb_loading_animation").hide()},startLoadingAnimation:function(){this.pageBuilderIsActive()&&(this.$loading_animation.next().length&&(e("body").append(this.$loading_animation),this.$loading_animation=e("#et_pb_loading_animation")),this.$loading_animation.show(),this.isLoading=!0)},endLoadingAnimation:function(){this.$loading_animation.hide(),this.isLoading=!1;try{var e=window.localStorage.getItem("et_page_loading");e&&(console.log("Builder load : %c%f","color: red",parseInt((Date.now()-parseInt(e,10))/10,10)/100),window.localStorage.removeItem("et_page_loading"))}catch(e){}},pageBuilderIsActive:function(){return this.$builder_toggle_button.hasClass("et_pb_builder_is_used")||this.$builder_toggle_button_wrapper.hasClass("et_pb_builder_is_used")},saveLayout:function(e){e.preventDefault(),J.is_active()?J.alert("cannot_save_app_layout_has_ab_testing"):(i(),G("save_layout"))},loadLayout:function(t){t.preventDefault();var o=void 0;i(),J.is_active()?J.alert("cannot_load_layout_has_ab_testing"):(o=new a.ModalView({attributes:{"data-open_view":"save_layout"},view:this}),e("body").append(o.render().el))},clearLayout:function(e){e.preventDefault(),i(),J.is_active()?J.alert("cannot_clear_layout_has_ab_testing"):G("clear_layout")},getHistoriesCount:function(){return this.options.history.length},getHistoriesIndex:function(){var e=this.options.history.findWhere({current_active_history:!0});return _.isUndefined(e)?this.options.history.models.length-1:this.options.history.indexOf(e)},isDoingCombination:function(){return!_.isUndefined(this.is_doing_combination)&&this.is_doing_combination},enableHistory:function(){return!_.isUndefined(this.enable_history)&&this.enable_history},allowHistorySaving:function(e,t,i,o){this.enable_history=!0,T.setHistoryMeta(e,t,i,o)},codeModuleContentPrepCB:function(e,t){var i=t;return i=(i=(i=(i=i.replace(/<br[\s]?[\/]?>/g,"<!\u2013- [et_pb_br_holder] -\u2013>")).replace(/<p /g,"<pee ")).replace(/<p>/g,"<pee>")).replace(/<\/p>/g,"</pee>"),e.replace(t,i)},codeModuleContentPrep:function(e){return e=(e=e.replace(/\[et_pb_code.*?\]([^]*)\[\/et_pb_code\]/g,this.codeModuleContentPrepCB)).replace(/\[et_pb_fullwidth_code.*?\]([^]*)\[\/et_pb_fullwidth_code\]/g,this.codeModuleContentPrepCB)},codeModuleContentUnPrepCB:function(e,t){var i=t;return i=(i=(i=(i=(i=(i=i.replace(/\n/g,"")).replace(/<p>/g,"")).replace(/<\/p>/g,"")).replace(/<!\u2013- \[et_pb_br_holder\] -\u2013>/g,"<br />")).replace(/<pee/g,"<p")).replace(/<\/pee>/g,"</p>"),e.replace(t,i)},codeModuleContentUnPrep:function(e){return e=(e=e.replace(/\[et_pb_code.*?\]([^]*)\[\/et_pb_code\]/g,this.codeModuleContentUnPrepCB)).replace(/\[et_pb_fullwidth_code.*?\]([^]*)\[\/et_pb_fullwidth_code\]/g,this.codeModuleContentUnPrepCB)},reviseHistories:function(){var e=void 0,t=this;if(this.hasRedo()){var i=_.range(this.getHistoriesIndex()+1,this.getHistoriesCount()).reverse();_.each(i,function(i){e=t.options.history.at(i),t.options.history.remove(e)})}this.updateHistoriesButtonState()},resetCurrentActiveHistoryMarker:function(){var e=this.options.history.where({current_active_history:!0});_.isEmpty(e)||_.each(e,function(e){e.set({current_active_history:!1})})},hasUndo:function(){return this.getHistoriesIndex()>0},hasRedo:function(){return this.getHistoriesCount()-this.getHistoriesIndex()>1},hasOverlayRendered:function(){return!!e(".et_pb_modal_overlay").length},updateHistoriesButtonState:function(){this.hasUndo()?e(".et-pb-layout-buttons-undo").removeClass("disabled"):e(".et-pb-layout-buttons-undo").addClass("disabled"),this.hasRedo()?e(".et-pb-layout-buttons-redo").removeClass("disabled"):e(".et-pb-layout-buttons-redo").addClass("disabled"),this.hasUndo()||this.hasRedo()?e(".et-pb-layout-buttons-history").removeClass("disabled"):e(".et-pb-layout-buttons-history").addClass("disabled")},getUndoModel:function(){var e=this.options.history.at(this.getHistoriesIndex()-1);return!_.isUndefined(e)&&e},undo:function(t){t.preventDefault();var i,o=this,n=this.getUndoModel();this.hasUndo()&&(_.isUndefined(n)||this.hasOverlayRendered()||(i=n.get("shortcode"),this.resetCurrentActiveHistoryMarker(),n.set({current_active_history:!0}),m.trigger("et-pb-loading:started"),ae("content",i,"saving_to_content"),setTimeout(function(){var t=e("#et_pb_layout"),n=t.innerHeight();t.css({height:n}),V.removeAllSections(),V.$el.find(".et_pb_section").remove(),o.enable_history=!1,V.createLayoutFromContent(Oe(i),"","",{is_reinit:"reinit"}),t.css({height:"auto"}),m.trigger("et-pb-loading:ended"),o.updateHistoriesButtonState()},600)))},viewABStats:function(e){e.preventDefault(),"1"!==et_pb_options.is_divi_library&&G("view_ab_stats")},settings:function(e){e.preventDefault(),"1"!==et_pb_options.is_divi_library&&G("open_settings")},getRedoModel:function(){var e=this.options.history.at(this.getHistoriesIndex()+1);return!_.isUndefined(e)&&e},toggleHistory:function(t){t.preventDefault();var i=e("#et-pb-histories-visualizer");i.hasClass("active")&&(i.addClass("fadeout"),setTimeout(function(){i.removeClass("fadeout")},500)),e(".et-pb-layout-buttons-history, #et-pb-histories-visualizer, #et-pb-histories-visualizer-overlay").toggleClass("active")},closeHistory:function(e){e.preventDefault(),this.toggleHistory(e)},redo:function(t){t.preventDefault();var i,o=this,n=this.getRedoModel();this.hasRedo()&&!_.isUndefined(n)&&n&&(this.hasOverlayRendered()||(this.options.history.indexOf(n),i=n.get("shortcode"),this.resetCurrentActiveHistoryMarker(),n.set({current_active_history:!0}),m.trigger("et-pb-loading:started"),ae("content",i,"saving_to_content"),setTimeout(function(){var t=e("#et_pb_layout"),n=t.innerHeight();t.css({height:n}),V.removeAllSections(),V.$el.find(".et_pb_section").remove(),o.enable_history=!1,V.createLayoutFromContent(Oe(i),"","",{is_reinit:"reinit"}),t.css({height:"auto"}),m.trigger("et-pb-loading:ended"),o.updateHistoriesButtonState()},600)))},addHistory:function(e){if(this.enableHistory()&&!this.isDoingCombination()){var t=new Date,i=t.getHours()>12?t.getHours()-12:t.getHours(),o=t.getMinutes(),n=t.getHours()>12?"PM":"AM";this.hasRedo()&&this.reviseHistories(),this.resetCurrentActiveHistoryMarker(),this.options.history.add({timestamp:_.now(),datetime:("0"+i).slice(-2)+":"+("0"+o).slice(-2)+" "+n,shortcode:e,current_active_history:!0,verb:T.verb,noun:T.noun},{validate:!0}),T.setHistoryMeta("did","something")}this.updateHistoriesButtonState()},addVisualizeHistoryItem:function(e){T.addItem(e)},changeVisualizeHistoryItem:function(e){T.changeItem(e)},removeVisualizeHistoryItem:function(e){T.removeItem(e)},maybeGenerateInitialLayout:function(){y.generateNewId();var t=this;m.trigger("et-pb-loading:started"),setTimeout(function(){var i="";if(void 0===window.tinyMCE||!window.tinyMCE.get("content")||window.tinyMCE.get("content").isHidden()||e("iframe#content_ifr").length)""!==(i=ee("content",!0))&&t.allowHistorySaving("loaded","page"),t.addHistory(i),t.pageBuilderIsActive()?-1!==i.indexOf("[et_pb_")||"1"===et_pb_options.is_divi_library&&"module"===et_pb_options.layout_type?-1!==i.indexOf("specialty_placeholder")?(t.createLayoutFromContent(Oe(i)),e(".et_pb_section_specialty").append(t.template_button())):t.createLayoutFromContent(Oe(i)):V.reInitialize():t.createLayoutFromContent(i),function(t,i){if(void 0===window.switchEditors)return;var o=tinyMCEPreInit.mceInit.et_pb_content.tadv_noautop;if(void 0!==o&&!0===o)return;_.each(V.collection.models,function(o){var n=e.parseJSON(et_pb_options.et_builder_modules_with_children);if(!_.includes(_.keys(n),o.get("module_type"))){var a=o.get("et_pb_content");if(void 0!==a){if("tinymce"===t)a=window.switchEditors.wpautop(a.replace(/<p>\xa0<\/p>/g,"<p> </p>"));else{if(!_.isUndefined(i)&&"initial_load"===i)return;a=window.switchEditors.pre_wpautop(a)}o.set("et_pb_content",a,{silent:!0})}}})}(ie(),"initial_load"),m.trigger("et-pb-content-updated"),m.trigger("et-pb-loading:ended"),e("#et_pb_main_container").addClass("et_pb_loading_animation"),setTimeout(function(){e("#et_pb_main_container").removeClass("et_pb_loading_animation")},500),t.listenTo(t.collection,"change reset add",_.debounce(t.saveAsShortcode,128)),J.update();else{if(30<++r){var o=e("#et-builder-failure-notice-template");return m.trigger("et-pb-loading:ended"),e("#et_pb_main_container").removeClass("et_pb_loading_animation"),void e("body").addClass("et_pb_stop_scroll").append(o.html())}t.maybeGenerateInitialLayout()}},500)},wp_regexp_not_global:_.memoize(function(e){return new RegExp("\\[(\\[?)("+e+")(?![\\w-])([^\\]\\/]*(?:\\/(?!\\])[^\\]\\/]*)*?)(?:(\\/)\\]|\\](?:([^\\[]*(?:\\[(?!\\/\\2\\])[^\\[]*)*)(\\[\\/\\2\\]))?)(\\]?)")}),getShortCodeParentTags:function(e){var t="et_pb_section|et_pb_row|et_pb_column|et_pb_column_inner|et_pb_row_inner".split("|");if(t=t.concat(et_pb_options.et_builder_module_parent_shortcodes.split("|")),!_.isUndefined(e)&&""!==e){var i=e.split("|"),o=_.difference(i,t);_.isEmpty(o)||(t=_.union(t,o))}return t=t.join("|")},getShortCodeChildTags:function(){return et_pb_options.et_builder_module_child_shortcodes},getShortCodeRawContentTags:function(){return et_pb_options.et_builder_module_raw_content_shortcodes.split("|")},createLayoutFromContent:function(t,i,o,n,a){var s=this,l=_.isUndefined(t)||""===t?"":t.match(/\[([^\W\/\[\]\x00-\x20=]+)/g),d=l&&_.isArray(l)?l.join("|").replace(/\[/g,""):"",r=this.getShortCodeParentTags().split("|"),p=void 0===o||""===o?this.getShortCodeParentTags(d):this.getShortCodeChildTags(),c=window.wp.shortcode.regexp(p),b=this.wp_regexp_not_global(p),u=t.match(c),f=this.getShortCodeRawContentTags(),m=void 0===n?{}:n;_.each(u,function(t,o){var n=t.match(b),l=n[2],d=n[2],p=""!==n[3]?window.wp.shortcode.attrs(n[3]):"",u=n[5],v=y.generateNewId(),w=void 0,k={},C=e.inArray(d,["et_pb_section","et_pb_row","et_pb_column","et_pb_row_inner","et_pb_column_inner"])>-1,S=C&&void 0!==u&&""!==u&&u.match(c),x="",j=!C&&-1===_.indexOf(r,d);if(C&&(d=d.replace("et_pb_","")),w={type:d,cid:v,created:"manually",module_type:d,component_status:""},void 0!==m.current_row_cid&&""!==m.current_row_cid&&(w.current_row=m.current_row_cid),void 0!==m.global_parent&&""!==m.global_parent&&(w.et_pb_global_parent=m.global_parent,w.global_parent_cid=m.global_parent_cid),"section"===d&&void 0!==m.after_section&&""!==m.after_section&&(w.after_section=m.after_section),"section"!==d&&(w.parent=i),-1!==d.indexOf("et_pb_")&&(w.type="module"),l===w.type&&(w.type="module"),w.admin_label=j?d:y.getDefaultAdminLabel(d),w._address=_.isUndefined(m.predefined_address)?o.toString():m.predefined_address,_.isUndefined(a)||(w._address=a+"."+w._address),_.isObject(p.named)){var $=!1;for(var T in"global"!==et_pb_options.is_global_template||C||void 0===p.named.template_type||"module"!==p.named.template_type||("updated"===et_pb_options.selective_sync_status?g[et_pb_options.template_post_id]=et_pb_options.excluded_global_options:($=!0,h[et_pb_options.template_post_id]=[])),x=void 0!==p.named.global_module&&""===x?p.named.global_module:x,"reinit"===m.is_reinit&&("migrate"!==m.migrate_global_modules||""===x&&""===m.global_parent)||(p=function(e,t,i,o){var n=!_.isUndefined(et_pb_options.et_pb_module_settings_migrations)&&et_pb_options.et_pb_module_settings_migrations,a=!_.isUndefined(n.name_changes)&&n.name_changes,s=!_.isUndefined(n.value_changes)&&n.value_changes;a&&!_.isUndefined(a[i])&&_.forEach(a[i],function(t,i){!_.isUndefined(e.named[i])&&_.isUndefined(e.named[t])&&(e.named[t]=e.named[i])});s&&!_.isUndefined(s[t])&&_.forEach(s[t],function(t,i){e.named[i]=t});if(_.includes(["module","row"],o)){var l={},d=t.length;_.forEach(s,function(e,i){t+"."===String(i).substr(0,d+1)&&(l[i.substr(t.length+1)]=e)}),_.isEmpty(l)||(e.named.value_changes=l)}return e}(p,w._address,w.type,d)),p.named)if(void 0===m.ignore_template_tag||""===m.ignore_template_tag||"ignore_template"===m.ignore_template_tag&&"template_type"!==T){var U="admin_label"!==T&&"specialty_columns"!==T&&"value_changes"!==T?"et_pb_"+T:T,O=!1;"et_pb_signup"===d&&-1!==e.inArray(T,["description","footer_content"])&&(p.named[T]=p.named[T].replace(/%91/g,"[").replace(/%93/g,"]"),p.named[T]=p.named[T].replace(/%22/g,'"')),$&&h[et_pb_options.template_post_id].push(T),"column"!==d&&"column_inner"!==d||"et_pb_type"!==U||(U="layout"),_.isEmpty(m.unsynced_options)||-1===_.indexOf(m.unsynced_options,T)||(O=!0),O||(k[U]=p.named[T],"value_changes"===T&&delete p.named[T])}w=_.extend(w,k)}if("section"===d&&"on"===w.et_pb_specialty&&(u=u.replace(/(\[et_pb_(row |row_inner) [\s\S]*?\][\s\S]*\[\/et_pb_(row |row_inner)\])/im,te)),void 0!==w.specialty_columns&&(w.layout_specialty="1",w.specialty_columns=parseInt(w.specialty_columns)),S||!_.isUndefined(m.unsynced_options)&&!_.isEmpty(m.unsynced_options)&&-1!==_.indexOf(m.unsynced_options,"et_pb_content_field")||(e.inArray(d,f)>-1?(w.et_pb_raw_content=w.et_pb_raw_content||u||"",w.et_pb_raw_content=w.et_pb_raw_content.replace(/<!-- \[et_pb_line_break_holder\] -->/g,"\n")):w.et_pb_content=u),_.includes(["row","row_inner"],d)&&(w.et_pb_content=u),"et_pb_contact_form"===d&&void 0!==w.et_pb_custom_message&&(w.et_pb_custom_message=_.unescape(w.et_pb_custom_message.replace(/\|\|et_pb_line_break_holder\|\|/g,"\r\n"))),"undefined"!==!w.et_pb_disabled&&"on"===w.et_pb_disabled&&(w.className=" et_pb_disabled"),"undefined"!==!w.et_pb_locked&&"on"===w.et_pb_locked&&(w.className=" et_pb_locked"),void 0!==m.global_id&&""!==m.global_id&&(w.et_pb_global_module=m.global_id),!C&&-1===_.indexOf(r,d))return w.title=d,w.component_status="removed",void s.collection.add([w]);if(s.collection.add([w]),"reinit"===m.is_reinit||""===x||""!==x&&"row"!==d&&"row_inner"!==d&&"section"!==d){if(S){var A=void 0===m.global_parent||""===m.global_parent?x:m.global_parent,M=void 0===m.global_parent_cid||""===m.global_parent_cid?void 0!==x&&""!==x?v:"":m.global_parent_cid,L=C?"":S;s.createLayoutFromContent(u,v,L,{is_reinit:m.is_reinit,global_parent:A,global_parent_cid:M,migrate_global_modules:m.migrate_global_modules},w._address)}}else B++,function(t,i,o,n){e("body").find(".et_pb_global_loading_overlay").length||e("body").append('<div class="et_pb_global_loading_overlay"></div>');var a="html"===ie()?"skip":"apply";e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_get_global_module",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_global_id:t,et_global_autop:a},success:function(a){var s=!1;if(!a||a.error){var l=y.getView(i);if(!l)return void e("body").find(".et_pb_global_loading_overlay").remove();var d=l.$el.find("[data-cid]");l.model.unset("et_pb_global_module"),d.length&&d.each(function(){var t=e(this),i=t.data("cid");if(void 0!==i&&""!==i){var o=y.getView(i);void 0!==o&&o.model.unset("et_pb_global_parent")}})}else{var r=o.replace(/ global_parent="\S+"/g,""),p=qe(a.shortcode.replace(/template_type="\S+"/,'global_module="'+t+'"'));p=(p=p.replace(/]\s?\n\s?\n\s?/g,"] ").replace(/\s?\n\s?\n\s?\[/g," [")).replace(/]\s+/g,"]").replace(/\s+\[/g,"["),r=r.replace(/]\s+/g,"]").replace(/\s+\[/g,"["),oe("content")&&(p=p.replace(/\r?\n|\r/g,"")),_.unescape(p)!==_.unescape(r)&&(s=!0,V.createLayoutFromContent(a.shortcode,"","",{ignore_template_tag:"ignore_template",current_row_cid:i,global_id:t,is_reinit:"reinit",predefined_address:n}))}if(B===++z){var c=!_.isUndefined(et_pb_options.et_pb_module_settings_migrations)&&et_pb_options.et_pb_module_settings_migrations;(s||!1!==c)&&Ue(!0,"migrate"),setTimeout(function(){e("body").find(".et_pb_global_loading_overlay").remove()},650)}}})}(x,v,t,w._address),s.createLayoutFromContent(u,v,"",{is_reinit:"reinit"},w._address)})},addModule:function(t){var i=void 0,o=void 0,n=void 0,s={model:t,collection:j},l=void 0!==t.get("cloned_cid")&&t.get("cloned_cid");switch(t.get("type")){case"section":if(i=new a.SectionView(s),y.addView(t.get("cid"),i),_.isUndefined(t.get("view"))?void 0!==t.get("after_section")&&""!==t.get("after_section")?y.getView(t.get("after_section")).$el.after(i.render().el):void 0!==t.get("current_row")?this.replaceElement(t.get("current_row"),i):l?this.$el.find('div[data-cid="'+l+'"]').closest(".et_pb_section").after(i.render().el):this.$el.append(i.render().el):t.get("view").$el.after(i.render().el),"on"===t.get("et_pb_fullwidth")){e(i.render().el).addClass("et_pb_section_fullwidth");var d=new a.ColumnView(s);i.addChildView(d),e(i.render().el).find(".et-pb-section-content").append(d.render().el)}if("on"===t.get("et_pb_specialty")&&"auto"===t.get("created")&&!t.get("pasted_module")){e(i.render().el).addClass("et_pb_section_specialty");var r=void 0;r=new a.ModalView({model:s.model,collection:s.collection,attributes:{"data-open_view":"column_specialty_settings"},et_view:i,view:i}),e("body").append(r.render().el)}t.get("pasted_module")||"manually"===t.get("created")||"on"===t.get("et_pb_fullwidth")||"on"===t.get("et_pb_specialty")||i.addRow();break;case"row":case"row_inner":i=new a.RowView(s),""!==t.get("parent")&&y.getView(t.get("parent")).$el.find(".et-pb-insert-row").hide(),y.addView(t.get("cid"),i),_.isUndefined(t.get("current_row"))?_.isUndefined(t.get("appendAfter"))?l?y.getView(t.get("parent")).$el.find('div[data-cid="'+l+'"]').parent().after(i.render().el):y.getView(t.get("parent")).$el.find(".et-pb-section-content").length?y.getView(t.get("parent")).$el.find(".et-pb-section-content").append(i.render().el):y.getView(t.get("parent")).$el.find("> .et-pb-insert-module, > .et-pb-insert-row").hide().end().append(i.render().el):t.get("appendAfter").after(i.render().el):this.replaceElement(t.get("current_row"),i),t.unset("columns_layout"),"manually"===t.get("created")&&"row_inner"===t.get("module_type")&&t.set("view",y.getView(t.get("parent")),{silent:!0});break;case"column":case"column_inner":s.className="et-pb-column et-pb-column-"+t.get("layout"),_.isUndefined(t.get("layout_specialty"))||"1"!==t.get("layout_specialty")||(s.className+=" et-pb-column-specialty"),i=new a.ColumnView(s),y.addView(t.get("cid"),i),_.isUndefined(t.get("layout_specialty"))?(n=void 0!==(o=y.getView(t.get("parent"))).model.get("columns_layout")?o.model.get("columns_layout")+","+t.get("layout"):t.get("layout"),o.model.set("columns_layout",n),"on"!==y.getView(t.get("parent")).model.get("et_pb_specialty")?(y.getView(t.get("parent")).$el.find(".et-pb-row-container").append(i.render().el),y.getView(t.get("parent")).toggleInsertColumnButton()):y.getView(t.get("parent")).$el.find(".et-pb-section-content").append(i.render().el)):(y.getView(t.get("parent")).$el.find(".et-pb-section-content").append(i.render().el),"1"===t.get("layout_specialty")&&("manually"!==t.get("created")&&this.collection.add([{type:"row",module_type:"row",cid:y.generateNewId(),parent:t.get("cid"),view:i,admin_label:et_pb_options.noun.row}]),y.getView(t.get("parent")).model.set("specialty_columns",parseInt(t.get("specialty_columns")))));break;case"module":if(s.attributes={"data-cid":t.get("cid")},"advanced"!==t.get("mode")&&"manually"===t.get("created")&&"column_inner"===y.getView(t.get("parent")).model.get("module_type")){var p=y.getView(t.get("parent")).model.get("parent");y.getView(p).$el.find(".et-pb-insert-column").hide()}if(void 0!==t.get("mode")&&"advanced"===t.get("mode"))i=new a.AdvancedModuleSettingView(s),t.attributes.view.child_views.push(i),void 0!==t.get("cloned_cid")&&""!==t.get("cloned_cid")?y.getView(t.get("cloned_cid")).$el.after(i.render().el):y.getView(t.get("parent")).$el.find(".et-pb-sortable-options").append(i.render().el),y.addView(t.get("cid"),i);else{var c="";if(m.trigger("et-new_module:show_settings"),i=new a.BlockModuleView(s),void 0!==t.attributes.view&&"on"===t.attributes.view.model.get("et_pb_fullwidth")?(y.getView(t.get("parent")).addChildView(i),c=y.getView(t.get("parent")).model.get("et_pb_template_type")):void 0!==t.attributes.view&&(c=y.getView(y.getView(t.get("parent")).model.get("parent")).model.get("et_pb_template_type")),l)y.getView(t.get("parent")).$el.find('div[data-cid="'+l+'"]').after(i.render().el);else if(y.getView(t.get("parent")).$el.find(".et-pb-insert-module").length)y.getView(t.get("parent")).$el.find(".et-pb-insert-module").before(i.render().el);else{var b=y.getView(t.get("parent"));void 0!==b.model.get("et_pb_fullwidth")&&"on"===b.model.get("et_pb_fullwidth")?b.$el.find(".et_pb_fullwidth_sortable_area").append(i.render().el):b.$el.append(i.render().el)}y.addView(t.get("cid"),i),void 0!==c&&"module"===c&&t.set("template_type","module",{silent:!0}),"manually"!==t.get("created")&&(s.attributes={"data-open_view":"module_settings"},this.openModuleSettings(s))}}t.unset("cloned_cid")},openModuleSettings:function(t){var i=this,o=new a.ModalView(t).render();if(!1===o)return setTimeout(function(){i.openModuleSettings(t)},500),void m.trigger("et-pb-loading:started");m.trigger("et-pb-loading:ended"),e("body").append(o.el)},saveAsShortcode:function(e,t,i){var o=arguments.length>0&&"object"===n(arguments[0])&&arguments[0].et_action||"";if(ne(),!i||"false"!==i.update_shortcodes){var a=this.generateCompleteShortcode();this.addHistory(a),J.update(),ae("content",a,o||""),m.trigger("et-pb-content-updated")}},getDefaultSectionBackgroundColor:function(){var t=e("#_et_pb_section_background_color").val();return""!==t&&t||(t="#ffffff"),t},getSectionsBackgroundColor:function(){var t=this,i=[];return this.$el.find(".et_pb_section").each(function(){var o=e(this).find(".et-pb-data-cid").data("cid"),n=C(j.find(function(e){return e.get("cid")==o}),"attributes.et_pb_background_color","");""!==n&&n||(n=t.getDefaultSectionBackgroundColor()),i.push(n)}),i},generateCompleteShortcode:function(t,i,o,n,a){var s="",l=this,_=void 0===t;i=void 0===i?"":i;return this.$el.find(".et_pb_section").each(function(){var d=e(this).find(".et-pb-section-content"),r=!1,p=void 0!==d.data("skip")&&d.data("skip");(!1===_&&t===d.data("cid")||!0===_)&&!0!==p&&(s+=l.generateModuleShortcode(e(this),!0,i,o),r=!0),d.closest(".et_pb_section").hasClass("et_pb_section_fullwidth")?d.find(".et_pb_module_block").each(function(){var a=e(this).data("cid");(!1!==_||t!==a&&!0!==r)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n))}):!d.closest(".et_pb_section").hasClass("et_pb_section_specialty")||!0!==r&&!0!==_&&"module"!==i&&"row"!==i||!0===p?d.find(".et_pb_row").each(function(){var d=e(this),p=d.find(".et-pb-row-content"),c=p.data("cid"),b=!1,u=void 0!==p.data("skip")&&p.data("skip");(!1!==_||t!==c&&!0!==r)&&!0!==_||!0===u||(s+=l.generateModuleShortcode(e(this),!0,i,o),b=!0),d.find(".et-pb-column").each(function(){var d=e(this),p=d.data("cid");j.findWhere({cid:p});(!1!==_||!0!==r&&!0!==b)&&!0!==_||!0===u||(s+=l.generateModuleShortcode(e(this),!0,i,o,"column")),d.find(".et_pb_module_block").each(function(){var d=e(this).data("cid");(!1!==_||t!==d&&!0!==r&&!0!==b)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n,a))}),(!1!==_||!0!==r&&!0!==b)&&!0!==_||!0===u||(s+="[/et_pb_column]")}),(!1!==_||t!==c&&!0!==r)&&!0!==_||!0===u||(s+="[/et_pb_row]")}):d.find("> .et-pb-column").each(function(){var d=e(this),p=d.data("cid"),c=j.findWhere({cid:p}),b="1"===c.get("layout_specialty")?' specialty_columns="'+c.get("specialty_columns")+'"':"",u=c.get("layout");!0!==r&&!0!==_||(s+='[et_pb_column type="'+u+'"'+b+"]"),d.hasClass("et-pb-column-specialty")?d.find(".et_pb_row").each(function(){var a=e(this),d=a.find(".et-pb-row-content").data("cid"),p=(j.findWhere({cid:d}),!1);(!0===r||!0===_||"row"===i&&d===t)&&(p=!0,s+=l.generateModuleShortcode(e(this),!0,i,o,"row_inner")),a.find(".et-pb-column").each(function(){var a=e(this),d=a.data("cid");j.findWhere({cid:d});!0===p&&(s+=l.generateModuleShortcode(e(this),!0,i,o,"column_inner",!1,!1,u)),a.find(".et_pb_module_block").each(function(){var a=e(this).data("cid");(!1!==_||t!==a&&!0!==r&&!0!==p)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n))}),!0===p&&(s+="[/et_pb_column_inner]")}),(!0===r||!0===_||"row"===i&&d===t)&&(s+="[/et_pb_row_inner]")}):d.find(".et_pb_module_block").each(function(){var d=e(this).data("cid");(!1!==_||t!==d&&!0!==r)&&!0!==_||(s+=l.generateModuleShortcode(e(this),!1,i,o,"",n,a))}),!0!==r&&!0!==_||(s+="[/et_pb_column]")}),(!1===_&&t===d.data("cid")||!0===_)&&!0!==p&&(s+="[/et_pb_section]")}),s},generateModuleShortcode:function(t,i,o,n,s,l,d,r){var p,c="",b="",u=t,h=!(u.is(".et_pb_section")||u.is(".et_pb_row")||u.is(".et_pb_row_inner")||u.is(".et_pb_column")||u.is(".et_pb_column_inner")),f=u.is(".et_pb_section")||u.is(".et_pb_row")||u.is(".et_pb_row_inner")?"et_pb_":"",m=void 0===u.data("cid")?u.find(".et-pb-data-cid").data("cid"):u.data("cid"),v=j.find(function(e){return e.get("cid")==m}),w=void 0!==v?v.get("module_type"):"undefined",k=void 0,C=void 0,S=void 0,x=[];if(void 0!==s&&""!==s&&(w=s),void 0!==v){if("section"===(k=v.attributes).type){var $=parseInt(v.attributes._address),V=$-1,T=$+1,U=this.getSectionsBackgroundColor(),O=_.isUndefined(k.et_pb_background_color)?this.getDefaultSectionBackgroundColor():k.et_pb_background_color,A=_.isUndefined(U[V])?"":U[V],M=_.isUndefined(U[T])?"":U[T],L=a.Helpers.moduleHasBackground(k,["gradient","image","video"]);A!==O||L||(A="#000000"),k.et_pb_prev_background_color=A,M!==O||L||(M="#000000"),k.et_pb_next_background_color=M}for(var E in p="module"===et_pb_options.layout_type&&"global"===et_pb_options.is_global_template||d&&h&&!_.isUndefined(k.et_pb_global_module),d&&h&&void 0!==k.et_pb_global_module&&(x=_.isEmpty(g[k.et_pb_global_module])?[]:g[k.et_pb_global_module]),k){if(!_.isEmpty(x)){var D=-1!==e.inArray(E,["et_pb_content","et_pb_raw_content"])?"et_pb_content_field":E.replace("et_pb_","");if(-1!==e.inArray(D,x))continue}if((void 0===n||"ignore_global"!==n||void 0!==n&&"ignore_global"===n&&"et_pb_global_module"!==E&&"et_pb_global_parent"!==E)&&(void 0===l||"ignore_global_tabs"!==l||void 0!==l&&"ignore_global_tabs"===l&&"et_pb_saved_tabs"!==E)){var I,P=E;if(_.includes(["et_pb_fb_built","et_pb_bb_built","_address"],P))continue;if(-1===P.indexOf("et_pb_")&&"admin_label"!==P)continue;if(I=void 0!==v.get(P)?v.get(P):"","et_pb_content"===P||"et_pb_raw_content"===P){b=I,"et_pb_raw_content"===P&&(b=b.replace(/\r?\n|\r/g,"\x3c!-- [et_pb_line_break_holder] --\x3e")),b=e.trim(b);var R=e.parseJSON(et_pb_options.et_builder_modules_with_children);_.includes(_.keys(R),v.get("module_type"))||""===b||"et_pb_content"!==P||(b="\n\n"+b+"\n\n")}else if(""!==I||p){if(void 0!==k.module_defaults&&void 0!==k.module_defaults[P])if(k.module_defaults[P]===""+I&&!p){delete v.attributes[P];continue}P=P.replace("et_pb_",""),"string"==typeof I&&(I=(I=I.replace(/\"/g,"%22").replace(/\\/g,"%92")).replace(/\[/g,"%91").replace(/\]/g,"%93")),"et_pb_contact_form"===w&&"custom_message"===P&&(I=_.escape(I.replace(/\r?\n|\r/g,"||et_pb_line_break_holder||")));/^(http[s]?:\/\/){0,1}(www\.){0,1}[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,5}[\.]{0,1}/.test(I)&&(I=_.escape(_.unescape(I))),"admin_label"===P?I!==y.getDefaultAdminLabel(k.module_type)&&(c=" "+P+'="'+I+'"'+c):c+=" "+P+'="'+I+'"'}}}return S="section"!==w&&"row"!==w?"module":w,S="row_inner"===w?"row":S,void 0!==o&&o===S&&(c+=' template_type="'+o+'"'),void 0!==k.template_type&&(c+=' template_type="'+k.template_type+'"'),"section"===w&&(c=' bb_built="1"'+c),_.includes(["column","column_inner"],w)&&(c=' type="'+v.get("layout")+'"'+c,f="et_pb_","column_inner"===w&&(c+=' saved_specialty_column_type="'+r+'"')),C="["+f+w+c,""===b&&void 0!==k.type&&"module"===k.type?(i=!0,C+=" /]"):C+="]",i||(C+=b+"[/"+f+w+"]"),C}},makeSectionsSortable:function(){var t=this;this.$el.sortable({items:"> *:not(#et_pb_layout_controls, #et_pb_main_container_right_click_overlay, #et-pb-histories-visualizer, #et-pb-histories-visualizer-overlay)",cancel:".et-pb-settings, .et-pb-clone, .et-pb-remove, .et-pb-section-add, .et-pb-row-add, .et-pb-insert-module, .et-pb-insert-column, .et_pb_locked, .et-pb-disable-sort",delay:100,update:function(i,o){if(V.isLoading)t.$el.sortable("cancel");else{if(J.is_active()){var n=e(o.item).children(".et-pb-section-content").attr("data-cid");if(!J.is_user_has_permission(n,"section"))return J.alert("has_no_permission"),t.$el.sortable("cancel"),void Ue()}t.allowHistorySaving("moved","section"),m.trigger("et-sortable:update")}},start:function(t,o){if(i(),t.altKey){var n=y.getView(e(o.item).children(".et-pb-section-content").data("cid")),s={model:n.model,view:n.$el,view_event:t},l=new a.RightClickOptionsView(s,!0);l.copy(t,!0),l.pasteAfter(t,void 0,void 0,void 0,!0,!0),V.allowHistorySaving("cloned","section")}}})},reInitialize:function(){var e=ee("content"),t=""==e,i=et_pb_options.default_initial_column_type,o=et_pb_options.default_initial_text_module;m.trigger("et-pb-loading:started"),this.removeAllSections(),-1===e.indexOf("[et_pb_section")&&(t||(e='[et_pb_column type="'+i+'"]['+o+"]"+e+"[/"+o+"][/et_pb_column]"),e="[et_pb_section][et_pb_row]"+e+"[/et_pb_row][/et_pb_section]"),this.createNewLayout(e),m.trigger("et-pb-loading:ended")},removeAllSections:function(t){var i=void 0;y.set("forceRemove",!0),this.$el.find(".et-pb-section-content").each(function(){var t=e(this),i=y.getView(t.data("cid"));void 0!==i&&i.removeSection(!1,!0)}),y.set("forceRemove",!1),t&&(i="[et_pb_section][et_pb_row][/et_pb_row][/et_pb_section]",this.createNewLayout(i))},createNewLayout:function(e,t){t=t||"";this.stopListening(this.collection,"change reset add",this.saveAsShortcode),e=V.codeModuleContentPrep(e),"load_layout"===t&&void 0!==window.switchEditors&&(e=qe(window.switchEditors.wpautop(e))),e=V.codeModuleContentUnPrep(e),this.createLayoutFromContent(e),this.saveAsShortcode({et_action:t}),this.listenTo(this.collection,"change reset add",_.debounce(this.saveAsShortcode,128))},replaceElement:function(e,t){var i=y.getView(e);i.$el.after(t.render().el),i.model.destroy(),y.removeView(e),i.remove()},showRightClickOptions:function(e){e.preventDefault();var t={model:{attributes:{type:"app",module_type:"app"}},view:this.$el,view_event:e};new a.RightClickOptionsView(t)},hideRightClickOptions:function(e){e.preventDefault(),i()},recalculateModulesOrder:function(){this.collection;this.order_modules_array=[],this.order_modules_array.children_count=[],this.$el.find(".et_pb_section").each(function(t){var i=e(this).find(".et-pb-section-content"),o=i.data("cid");V.setModuleOrder(o),V.setModuleAddresses(o,t),i.closest(".et_pb_section").hasClass("et_pb_section_fullwidth")?i.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");V.setModuleOrder(t)}):i.closest(".et_pb_section").hasClass("et_pb_section_specialty")?i.find("> .et-pb-column").each(function(){var t=e(this),i=t.data("cid");V.setModuleOrder(i),t.hasClass("et-pb-column-specialty")?t.find(".et_pb_row").each(function(){var t=e(this),i=t.find(".et-pb-row-content").data("cid");V.setModuleOrder(i),t.find(".et-pb-column").each(function(){var t=e(this),i=t.data("cid");V.setModuleOrder(i),t.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");V.setModuleOrder(t)})})}):t.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");V.setModuleOrder(t,"specialty")})}):i.find(".et_pb_row").each(function(){var t=e(this),i=t.find(".et-pb-row-content").data("cid");V.setModuleOrder(i),t.find(".et-pb-column").each(function(){var t=e(this),i=t.data("cid");V.setModuleOrder(i),t.find(".et_pb_module_block").each(function(){var t=e(this).data("cid");V.setModuleOrder(t)})})})})},parseShortcode:function(i,o,n){var a=document.documentMode,s="et-fb-preview-"+Date.now()+"-"+Math.floor(1e3*Math.random()+1),l=et_pb_options.preview_url+"&et_pb_preview=true&et_pb_preview_nonce="+et_pb_options.et_pb_preview_nonce+"&iframe_id="+s;setTimeout(function(){var d=e('*[data-shortcode-id="'+n+'"]'),r=d.length?d.width()+"px":"100%",p=t("<iframe />",{id:s,src:l,style:"position: absolute; bottom: 0; left: 0; opacity: 0; pointer-events: none; width:"+r+"; height: 100%;"}),c=!1,b={et_pb_preview_nonce:et_pb_options.et_pb_preview_nonce,shortcode:i,post_title:e("#title").val(),post_id:et_pb_options.postId};e("body").append(p),p.load(function(){if(!c){var e=document.getElementById(s);!_.isUndefined(a)&&a<10&&(b=JSON.stringify(b)),e.contentWindow.postMessage(b,l),c=!0;var t=window.addEventListener?"addEventListener":"attachEvent";(0,window[t])("attachEvent"==t?"onmessage":"message",function(e){e.data.iframe_id===s&&_.isString(e.data.html)&&(o(e.data),p.remove())},!1)}})},0)},updateYoastContent:function(){if(Be()){var t=ee("content",!0),i=e("#yoast-readability-analysis-collapsible-metabox");e(".et-pb-yoast-loading").remove(),i.find("svg").first().after('<svg class="yoast-svg-icon et-pb-yoast-loading yoast-svg-icon-loading-spinner SvgIcon__StyledSvg-jBzRth mPAyu" aria-hidden="true" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 66 66" fill="#64a60a" style="position: absolute; background: #fff; border-radius: 5px; max-width: 18px;"><circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle></svg>'),this.parseShortcode(t,function(e){var t=_.isUndefined(e.html)?"":e.html;F=t,YoastSEO.app.pluginReloaded("ET_PB_Yoast_Content")},"yoast_preview_content")}},setModuleOrder:function(t,i){var o,n=e.parseJSON(et_pb_options.et_builder_modules_with_children),a=void 0,s=void 0,l=void 0,_=void 0,d=void 0;if(void 0!==(a=j.findWhere({cid:t}))){if("column"!==(l=void 0!==a.attributes.module_type?a.attributes.module_type:a.attributes.type)&&"column_inner"!==l&&"specialty"!==i||(s=j.findWhere({cid:a.attributes.parent}),"column"===l&&"row_inner"===s.attributes.module_type&&(l="column_inner")),o=void 0!==this.order_modules_array[l]?this.order_modules_array[l]:0,a.attributes.module_order=o,"row"!==l&&"row_inner"!==l&&"section"!==l||void 0===a.attributes.columns_order||(a.attributes.columns_order=[]),"column"!==l&&"column_inner"!==l&&"specialty"!==i||(void 0!==s.attributes.columns_order?s.attributes.columns_order.push(o):s.attributes.columns_order=[o]),void 0!==n[l]){if(d=n[l],_=void 0!==this.order_modules_array.children_count[d]?this.order_modules_array.children_count[d]:0,a.attributes.child_start_from=_,void 0!==a.attributes.et_pb_content&&""!==a.attributes.et_pb_content){var r=V.getShortCodeChildTags(),p=window.wp.shortcode.regexp(r),c=a.attributes.et_pb_content.match(p);_+=null!==c?c.length:0}this.order_modules_array.children_count[d]=_}this.order_modules_array[l]=o+1}},setModuleAddresses:function(e,t,i){var o=j.findWhere({cid:e}),n=j.where({parent:e});if(!_.isUndefined(o)){var a=_.isUndefined(o.attributes.module_type)?o.attributes.type:o.attributes.module_type,s=o.get("_address"),l="section"===a?t.toString():i+"."+t.toString(),d=!_.isUndefined(s)&&"et_pb_module_settings_migrations.value_changes."+s,r=!!d&&S(et_pb_options,d),p=S(et_pb_options,"et_pb_module_settings_migrations.name_changes")&&!_.isUndefined(et_pb_options.et_pb_module_settings_migrations.name_changes[s]);l!==s&&(r&&(et_pb_options.et_pb_module_settings_migrations.value_changes[l]=_.clone(et_pb_options.et_pb_module_settings_migrations.value_changes[s]),delete et_pb_options.et_pb_module_settings_migrations.value_changes[s]),p&&(et_pb_options.et_pb_module_settings_migrations.name_changes[l]=_.clone(et_pb_options.et_pb_module_settings_migrations.name_changes[s]),delete et_pb_options.et_pb_module_settings_migrations.name_changes[s])),o.set({_address:l}),!_.isUndefined(n)&&n.length>0&&_.forEach(n,function(e,t){V.setModuleAddresses(e.attributes.cid,t,l)})}},updateAdvancedModulesOrder:function(t){var i=void 0!==t?t.find(".et-pb-option-advanced-module-settings"):e(".et-pb-option-advanced-module-settings"),o=0,n=void 0;i.length&&(n=i.find(".et-pb-sortable-options > li")).length&&n.each(function(){var t,i,n=e(this).data("cid"),a=void 0;a=j.findWhere({cid:n}),i=void 0!==(t=j.findWhere({cid:a.attributes.parent_cid})).attributes.child_start_from?t.attributes.child_start_from:0,a.attributes.module_order=o+i,o++})}}),a.Controls={},a.Controls.BorderRadiusControl=function(e){this.initialize(e)},e.extend(a.Controls.BorderRadiusControl.prototype,{initialize:function(e){if(this._container=e,this._setting_field=e.siblings(".et-pb-main-setting"),!this._setting_field.length)return!1;this._link_button=e.find(".et-pb-border-radius-wrap-link-button > a"),this._radius_fields=e.find(".et-pb-border-radius-option-input"),this._radius_preview=e.find(".et-pb-border-radius-preview"),this._defalut_value=_.isUndefined(this._setting_field.data("default_inherited"))?this._setting_field.data("default"):this._setting_field.data("default_inherited");var t=this._setting_field.val();if(_.isEmpty(t)){t=this._defalut_value,this._setting_field.val(this._defalut_value);var i=this._setting_field;setTimeout(function(){i.trigger("et_pb_setting:change")},100)}var o=t;this._values=this._splitValue(o),this._lastValue="",this._setting_field.change(this._onSettingChange.bind(this)),this._radius_fields.change(this._onFieldChange.bind(this)),this._link_button.click(this._onClickLink.bind(this)),this._render()},_onClickLink:function(e){if(e.preventDefault(),e.stopPropagation(),this._getSettingValue("border-link")){var t=this._getValues();t["border-link"]=!1,this._onChange(this._combineValues(t))}else{""===this._lastValue&&(this._lastValue=this._getSettingValue("top-left"));var i=this._spreadValue(this._lastValue);this._onChange(this._combineValues(i))}},_onSettingChange:function(e){var t=_.isUndefined(e.target.value)||""===e.target.value?this._getDefaultValue():e.target.value;this._values=this._splitValue(t),this._render()},_onChange:function(t){var i=_.isUndefined(t)?this._getDefaultValue():t;e(this._setting_field).val(i),this._values=this._splitValue(i),e(this._setting_field).trigger("et_pb_setting:change"),this._render()},_isOn:function(e){return"on"===e},_isLinkedMode:function(){return this._getSettingValue("border-link")},_spreadValue:function(e){return{"border-link":!0,"top-left":e,"top-right":e,"bottom-right":e,"bottom-left":e}},_onFieldChange:function(e){var t=Se(e.target.value,!1);this._lastValue=t;var i=void 0;if(this._isLinkedMode())i=this._spreadValue(t);else{var o=e.target.getAttribute("data-corner");(i=this._getValues())[o]=t}this._onChange(this._combineValues(i))},_getDefaultValue:function(){return _.isUndefined(this._defalut_value)||""===this._defalut_value?"on||||":this._setting_field.val()},_getValues:function(){return this._values},_getSettingValue:function(e){return this._getValues()[e]},_splitValue:function(e){var t=e.split("|");return{"border-link":!!_.isUndefined(t[0])||this._isOn(t[0]),"top-left":_.isUndefined(t[1])||""===t[1]?"0px":t[1],"top-right":_.isUndefined(t[2])||""===t[2]?"0px":t[2],"bottom-right":_.isUndefined(t[3])||""===t[3]?"0px":t[3],"bottom-left":_.isUndefined(t[4])||""===t[4]?"0px":t[4]}},_combineValues:function(e){return(e["border-link"]?"on":"off")+"|"+e["top-left"]+"|"+e["top-right"]+"|"+e["bottom-right"]+"|"+e["bottom-left"]},_render:function(){_.each(this._radius_fields,function(t){e(t).val(this._getSettingValue(e(t).data("corner")))},this),e(this._link_button).toggleClass("active",this._getSettingValue("border-link")),e(this._radius_preview).css("border-top-left-radius",this._getSettingValue("top-left")),e(this._radius_preview).css("border-top-right-radius",this._getSettingValue("top-right")),e(this._radius_preview).css("border-bottom-right-radius",this._getSettingValue("bottom-right")),e(this._radius_preview).css("border-bottom-left-radius",this._getSettingValue("bottom-left"))}}),a.Controls.BorderRadius=function(t){var i=t.find(".et-pb-border-radius-wrap");i.length&&i.each(function(){new a.Controls.BorderRadiusControl(e(this))})},a.Controls.TabbedControl=function(e){this.initialize(e)},e.extend(a.Controls.TabbedControl.prototype,{_getByPath:function(e,t){return _.reduce(t.split("."),function(e,t){return e?e[t]:void 0},e)},initialize:function(t){var i=t.find(".et-pb-settings-tab"),o=t.find(".et-pb-settings-tab-content");if(!i.length||!o.length)return!1;var n=this;this._$container=t,this._suffix=t.data("attr-suffix"),this._tabs={},this._tab_content={},this._first_tab=null,this._active_tab=null,this._tab_settings_map=null,this._outside_preview=t.find(".et-pb-outside-preview-container"),this._reset_button=t.closest(".et-pb-composite-tabbed-wrapper").siblings(".et-pb-composite-tabbed-reset-setting"),this._is_child_settings_container=t.parents(".et_pb_modal_settings_container").hasClass("et_pb_modal_settings_container_step2"),i.each(function(){var t=e(this).find(".et-pb-settings-tab-title");n._tabs[e(t).data("tab")]=t,t.length&&t.click(n._onClickTab.bind(n))}),o.each(function(t,i){var o=e(i).data("tab");n._tab_content[o]={content:this,"preview-area":e(i).find(".et-pb-tab-preview-container")},0===t&&(n._first_tab=o,n._active_tab=o)}),setTimeout(function(){n._buildTabSettingsMap(),e(o).on("et_pb_setting:change et_pb_setting:color_picker:change",n._onChangeHandler.bind(n)),e(o).on("change","select",n._onChangeHandler.bind(n)),e(n._reset_button).on("click",n._onClickReset.bind(n)),n._render()},100)},_buildTabSettingsMap:function(){var t={};_.map(this._tab_content,function(i,o){t[o]={};var n=!1;e(i.content).find(".et-pb-main-setting").each(function(i,s){var l=ve(e(s)),_=e(s).parents(".et-pb-composite-tabbed-option").data("control-index");t[o][_]={},t[o][_].default=l,t[o][_].value=a.Helpers.getSettingValue(e(s)),n=n||!we(e(s))}),_.contains(["top_divider","bottom_divider"],o)?t[o].modified=t[o][o+"_style"].value!==t[o][o+"_style"].default:t[o].modified=n}),this._tab_settings_map=t},_isAnySettingModified:function(){var e=!1;return _.map(this._tab_settings_map,function(t){this._getByPath(t,"modified")&&(e=!0)},this),e},_onChangeHandler:function(e){setTimeout(this._onSettingChange.bind(this),100)},_onSettingChange:function(){this._buildTabSettingsMap(),this._render()},_onClickTab:function(e){e.preventDefault();var t=e.target.getAttribute("data-tab");this._makeTabActive(t),this._render()},_onClickReset:function(){var e=this;_.map(this._tab_settings_map,function(t){_.map(t,function(t,i){e._$container.find('[data-control-index="'+i+'"]').find(".et-pb-reset-setting").trigger("click")},this)}),this._active_tab=this._first_tab},_makeTabActive:function(e){this._active_tab=e},_showTab:function(t){e(this._tabs[t]).closest(".et-pb-settings-tab").addClass("active"),e(this._tab_content[t].content).show()},_hideTab:function(t){e(this._tabs[t]).closest(".et-pb-settings-tab").removeClass("active"),e(this._tab_content[t].content).hide()},_renderOutsidePreviewArea:function(e){return!1},_renderTabPreviewArea:function(e,t){return!1},_render:function(){this._renderOutsidePreviewArea(this._outside_preview),this._renderTabPreviewArea(this._active_tab,this._tab_content[this._active_tab]["preview-area"]),_.map(this._tabs,function(t,i){i===this._active_tab?this._showTab(i):this._hideTab(i),this._tab_settings_map[i].modified?e(this._tabs[i]).closest(".et-pb-settings-tab").addClass("modified"):e(this._tabs[i]).closest(".et-pb-settings-tab").removeClass("modified")},this),this._isAnySettingModified()?e(this._reset_button).addClass("et-pb-reset-icon-visible"):e(this._reset_button).removeClass("et-pb-reset-icon-visible")}}),a.Controls.Tabbed=function(t){var i=t.find(".et-pb-composite-tabbed");i.length&&i.each(function(){new a.Controls.TabbedControl(e(this))})},a.Controls.BorderStylesControl=function(e){this._setting_values=null,this._had_previously_resetted=!1,this.initialize(e)},e.extend(a.Controls.BorderStylesControl.prototype,a.Controls.TabbedControl.prototype,{_processWidth:function(e){var t=parseInt(e);return t>50&&(t=50),Se(t.toString(),!1,"px")},_setControlInitials:function(e){var t=e.parents(".et-pb-composite-tabbed-option").data("control-index");this._setting_values[t]={};var i=e.data("saved_value"),o=me(e),n="",a="",s="";if(e.hasClass("et-pb-range")){var l=e.siblings(".et-pb-range-input");a=l.data(o),s=l.data("default_inherited"),n=l.val(),l.data("check_attr_default","yes")}else n=e.val(),a=e.data(o),s=e.data("default_inherited"),e.data("check_attr_default","yes");var d=_.isUndefined(a)?"":a,r="",p=(r=_.isUndefined(i)?n:_.isEmpty(i)?n===a?a:"":i)!==d;_.isEmpty(s)||(_.isEmpty(r)||r===s)&&(p=!1),_.isEmpty(s)||a===s||p||this._updateControl(e,a,!1),this._setting_values[t].saved_value=p?r:"",this._setting_values[t].default_value=a,this._setting_values[t].default_inherited=s,this._setting_values[t].control=e;var c=t.replace(this._suffix,"").lastIndexOf("_"),b=t.substr(c).replace(this._suffix,"");this._setting_values[t].tab="border"+b;var u=this._tab_settings_map["border"+b].modified;this._tab_settings_map["border"+b].modified=u||p},_recalculateEdgeSettings:function(e){if(-1!==e.indexOf("all")){var t=e.replace(this._suffix,"").lastIndexOf("_"),i=e.substr(0,t),o=this;_.map(this._setting_values,function(t,n){if(-1!==n.indexOf(i)&&-1===n.indexOf("all")){var a=t.control,s=_.isEmpty(o._setting_values[e].saved_value)?o._setting_values[e].default_value:o._setting_values[e].saved_value;if(_.isEmpty(t.default_inherited))t.default_value=s,_.isEmpty(t.saved_value)?o._updateControl(a,s,s):o._updateControl(a,!1,s);else{s=o._setting_values[e].saved_value;var l=o._setting_values[e].default_value;if(_.isEmpty(t.saved_value))if(_.isEmpty(s))if(_.isEmpty(t.saved_default))t.default_value===t.default_inherited?(t.default_value=l,o._updateControl(a,l,l)):o._updateControl(a,t.default_value,!1);else{var d=t.saved_default;t.default_value=d,o._updateControl(a,d,d),t.saved_default=""}else _.isEmpty(t.saved_default)&&(t.saved_default=t.default_value),t.default_value=s,o._updateControl(a,s,s);else{var r=_.isEmpty(s)?l:s;t.default_value=r,o._updateControl(a,t.saved_value,r)}}}})}},_onSettingChange:function(e,t,i){var o=i?"":a.Helpers.getSettingValue(e);this._updateSetting(t,o),this._recalculateEdgeSettings(t)},_onChangeHandler:function(t,i){if(_.isUndefined(i)||"et_pb_from_all_tab"!==i){var o=e(t.target),n=o.parents(".et-pb-composite-tabbed-option").data("control-index"),a=!_.isUndefined(i)&&"et_pb_reset_setting"===i;this._had_previously_resetted?this._had_previously_resetted=!1:(a&&(this._had_previously_resetted=!0),"et_pb_setting:color_picker:change"===t.type?(this._updateSetting(n,i),this._recalculateEdgeSettings(n)):-1===n.indexOf("color")&&this._onSettingChange(o,n,a),this._render())}},_updateSetting:function(e,t){var i=this,o=this._setting_values[e],n=t!==o.default_value;o.saved_value=n?t:"";var a=o.tab,s=!1;_.map(this._tab_settings_map[a],function(e,t){if("modified"!==t){var o=i._setting_values[t].saved_value,a=i._setting_values[t].default_value;n=!_.isEmpty(o)&&o!==a,s=s||n}}),this._tab_settings_map[a].modified=s},_updateControl:function(e,t,i){var o=me(e),n=e.hasClass("et-pb-range"),a=null;n&&(a=e.siblings(".et-pb-range-input")),i&&(n?(a.data(o,i),e.data(o,parseFloat(i)||0)):e.data(o,i)),t&&(n&&(e.val(parseFloat(t)||0),e=a),e.val(t).trigger("change",["et_pb_from_all_tab"]))},_resetAllTab:function(){var e=this;_.map(this._setting_values,function(t,i){-1!==i.indexOf("all")&&(t.saved_value="",e._updateControl(t.control,t.default_value,!1),e._recalculateEdgeSettings(i))})},_resetEdgeTabs:function(){_.map(this._setting_values,function(e,t){-1===t.indexOf("all")&&(_.isEmpty(e.default_inherited)?e.default_value="":_.isEmpty(e.saved_default)||(e.default_value=e.saved_default,e.saved_default=""),e.saved_value="")})},_onClickReset:function(){this._is_child_settings_container?(this._resetAllTab(),this._resetEdgeTabs()):(this._resetEdgeTabs(),this._resetAllTab()),this._active_tab=this._first_tab,this._render()},_buildTabSettingsMap:function(){var t=this,i={};_.map(this._tab_content,function(t,o){i[o]={},e(t.content).find(".et-pb-main-setting").each(function(t,n){var a=e(n).parents(".et-pb-composite-tabbed-option").data("control-index");i[o][a]={}}),i[o].modified=!1}),this._tab_settings_map=i,null===this._setting_values&&(this._setting_values={},_.map(this._tab_content,function(i,o){"border_all"!==o&&e(i.content).find(".et-pb-main-setting").each(function(i,o){t._setControlInitials(e(o))})}),e(this._tab_content.border_all.content).find(".et-pb-main-setting").each(function(i,o){t._setControlInitials(e(o));var n=e(o).parents(".et-pb-composite-tabbed-option").data("control-index");t._recalculateEdgeSettings(n)}))},_renderTabPreviewArea:function(e,t){var i=["width","style","color"],o={};_.forEach(["top","right","bottom","left"],function(e){var t="";_.forEach(i,function(i){var o="border_"+i+"_"+e+this._suffix,n=_.isEmpty(this._setting_values[o].saved_value)?this._setting_values[o].default_value:this._setting_values[o].saved_value;"width"==i&&(n=this._processWidth(n)),t+=" "+n},this),o["border-"+e]=t},this),_.map(o,function(e,i){t.find(".et-pb-tab-preview-container-preview").css(i,e)},this)}}),a.Controls.BorderStyles=function(t){var i=t.find(".et-pb-composite-tabbed-border-style");i.length&&i.each(function(){new a.Controls.BorderStylesControl(e(this))})},e("body").on("click contextmenu","#et_pb_layout_right_click_overlay",function(e){e.preventDefault(),i()});var m=_.extend({},Backbone.Events),y=new a.Layout,j=new a.Modules,$=new a.Histories,V=new a.AppView({model:a.Module,collection:j,history:$}),T=new a.visualizeHistoriesView,U=e("#et_pb_hidden_editor"),O=(U.html(),void 0),A=e("#et_pb_toggle_builder"),M=e(".et_pb_toggle_builder_wrapper"),L=e("#et_pb_layout"),E=e("#et_pb_old_content"),D=e("#formatdiv"),I=e("#et_pb_use_builder"),P=e("#et_pb_main_editor_wrap"),R=e(".et_pb_page_setting"),N=e(".et_pb_page_layout_settings"),H=[],B=0,z=0,F=!1,W={};a.Events=m;var J={is_active:function(){return!(!e("#et_pb_use_ab_testing").length||"on"!==e("#et_pb_use_ab_testing").val())},toggle_status:function(t){var i=e("#et_pb_use_ab_testing"),o=i.val();t=!_.isUndefined(t)&&t;("on"===o&&!t||("off"===o||""===o)&&t)&&i.addClass("et_pb_value_updated"),ne(),t?(i.val("on"),this.toggle_portability(!1)):i.val("off")},toggle_portability:function(t){var i=e(".et-pb-app-portability-button"),o=i.hasClass("et-core-disabled");_.isUndefined(t)&&(t=!!o),t?i.removeClass("et-core-disabled"):i.addClass("et-core-disabled")},get_stats_refresh_interval:function(){return e("#et_pb_ab_stats_refresh_interval").length?e("#et_pb_ab_stats_refresh_interval").val():"hourly"},get_shortcode_tracking_status:function(){return e("#_et_pb_enable_shortcode_tracking").length&&""!==e("#_et_pb_enable_shortcode_tracking").val()?e("#_et_pb_enable_shortcode_tracking").val():"off"},is_active_based_on_models:function(){var e=j.where({et_pb_ab_subject:"on"}),t=j.where({et_pb_ab_goal:"on"});return e.length>1&&t.length>0},has_permission:function(){return"1"===et_pb_ab_js_options.has_permission},check_create_db:function(){return"exists"!==et_pb_options.ab_db_status&&e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_create_ab_tables",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce},success:function(e){if(!e.length||"success"!==e)return!1;et_pb_options.ab_db_status="exists"}}),!0},is_selecting_subject:function(){return!_.isUndefined(V.is_selecting_ab_testing_subject)&&!0===V.is_selecting_ab_testing_subject},is_selecting_goal:function(){return!_.isUndefined(V.is_selecting_ab_testing_goal)&&!0===V.is_selecting_ab_testing_goal},is_selecting_winner:function(){return!_.isUndefined(V.is_selecting_ab_testing_winner)&&!0===V.is_selecting_ab_testing_winner},is_selecting:function(){return!!(this.is_selecting_subject()||this.is_selecting_goal()||this.is_selecting_winner())},is_subject:function(e){return!(!this.is_active()||y.is_app(e)||!e.has("et_pb_ab_subject")||"on"!==e.get("et_pb_ab_subject"))},is_subject_children:function(e){var t=y.getParentViews(e.attributes.parent),i=!1;return _.isEmpty(t)||_.each(t,function(e){_.isUndefined(e.model.get("et_pb_ab_subject"))||"on"!==e.model.get("et_pb_ab_subject")||(i=!0)}),i},is_unremovable_subject:function(e){return!!(this.is_active()&&this.is_subject(e)&&this.subjects().length<3)},is_goal:function(e){return!(!this.is_active()||y.is_app(e)||!e.has("et_pb_ab_goal")||"on"!==e.get("et_pb_ab_goal"))},is_goal_children:function(e){var t=y.getParentViews(e.attributes.parent),i=!1;return _.isEmpty(t)||_.each(t,function(t){!y.is_app(e)&&t.model.has("et_pb_ab_goal")&&"on"===t.model.get("et_pb_ab_goal")&&(i=!0)}),i},is_user_has_permission:function(e,t,i){if(!e)return!1;var o=y.getView(e),n=(i=_.isUndefined(i)?o.model:i,J.has_permission()),a=J.is_subject(i),s=J.is_subject_children(i),l=J.has_subject(i),d=J.is_goal(i),r=J.is_goal_children(i),p=J.has_goal(i),c=void 0;return c="section"===t?a||l||d||p:"module"===t?a||s||d||r:"add_module"===t?a||s||d||r:"add_row"===t?s||r:"paste"===t?s||r:"copy"===t?a||l||d||p:a||s||l||d||r||p,!(!n&&c)},is_ab_testing_item:function(e){return!!(this.is_subject(e)||this.is_subject_children(e)||this.has_subject(e)||this.is_goal(e)||this.is_goal_children(e)||this.has_goal(e))},filter_goals:function(e){return _.filter(e,function(e){return!(!e.has("et_pb_ab_goal")||"on"!==e.get("et_pb_ab_goal"))})},filter_subjects:function(e){return _.filter(e,function(e){return!(!e.has("et_pb_ab_subject")||"on"!==e.get("et_pb_ab_subject"))})},filter_models_by_cids:function(t,i){return i=_.isUndefined(i)?j.models:i,_.filter(i,function(i){return-1!==e.inArray(i.get("parent"),t)})},pluck_cids_from_models:function(e){var t=[];return _.each(e,function(e){t.push(e.get("cid"))}),t},has_goal:function(e){var t="function"==typeof e.get&&e.get("cid"),i=!1;return this.is_active()&&!1!==t&&_.each(y.getChildrenViews(t),function(e){"on"===e.model.get("et_pb_ab_goal")&&(i=!0)}),i},has_subject:function(e){var t="function"==typeof e.get&&e.get("cid"),i=!1;return this.is_active()&&_.each(y.getChildrenViews(t),function(e){"on"===e.model.get("et_pb_ab_subject")&&(i=!0)}),i},has_unremovable_subject:function(e){var t=e.get("cid"),i=e.get("type"),o=void 0,n=void 0,a=[],s=void 0,l=void 0,d=[],r=void 0,p=void 0;if(this.is_active()){if("section"===i){if(o=j.where({parent:t}),n=this.filter_subjects(o),this.count_subjects()-n.length<2)return!0;if(a=this.pluck_cids_from_models(o),!_.isUndefined(e.get("et_pb_specialty"))&&"on"===e.get("et_pb_specialty")){s=this.filter_models_by_cids(a);var c=this.filter_subjects(s);if(this.count_subjects()-c.length<2)return!0;a=this.pluck_cids_from_models(s)}}if("row"!==i&&"row_inner"!==i||(a=[t]),("section"===i||"row_inner"===i||"row"===i)&&(l=this.filter_models_by_cids(a),d=this.pluck_cids_from_models(l),r=this.filter_models_by_cids(d),p=this.filter_subjects(r),this.count_subjects()-p.length<2))return!0}return!1},subjects:function(){var e=j.where({et_pb_ab_subject:"on"});return e},subject_ids:function(){var e=this.subjects(),t=[];return e.length>0&&_.each(e,function(e){e.has("et_pb_ab_subject_id")&&t.push(e.get("et_pb_ab_subject_id"))}),t},count_subjects:function(){return this.subjects().length},get_subject_id:function(){if(0===this.count_subjects())return 0;var e=this.subjects(),t=[];return _.each(e,function(e){e.has("et_pb_ab_subject_id")?t.push(parseInt(e.get("et_pb_ab_subject_id"))):t.push(0)}),(Math.max.apply(Math,t)+1).toString()},set_subject:function(t,i){var o=this;if("removed"!==t.model.get("component_status")){if("exists"!==et_pb_options.ab_db_status)return setTimeout(function(){o.set_subject(t,"waiting")},500),void m.trigger("et-pb-loading:started");void 0!==i&&"waiting"===i&&m.trigger("et-pb-loading:ended"),t.model.set("et_pb_ab_subject","on"),t.model.set("et_pb_ab_subject_id",o.get_subject_id()),t.$el.addClass("et_pb_ab_subject"),V.is_selecting_ab_testing_subject=!1,e("#et_pb_layout").removeClass("et_pb_select_ab_testing_subject"),J.count_subjects()<2&&(V.is_selecting_ab_testing_goal=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_goal"),J.alert("select_ab_testing_goal")),V.saveAsShortcode()}},set_subject_rank_coloring:function(t){var i=et_pb_ab_js_options.subjects_rank,o=!!t.model.has("et_pb_ab_subject_id")&&"subject_"+t.model.get("et_pb_ab_subject_id"),n=t.model.get("type"),a=".et-pb-module-title";switch(n){case"section":a=".et-pb-section-title";break;case"row_inner":case"row":a=".et-pb-row-title"}!o||_.isUndefined(i[o])||_.isUndefined(i[o].rank)||_.isUndefined(i[o].percentage)||(t.$el.addClass("rank-"+i[o].rank),t.$el.find(a).append(" ("+i[o].percentage+")")),t.model.has("et_pb_ab_subject_id")&&("module"===n?(t.$el.find(".et-pb-ab-subject-id").remove(),t.$el.find(".et-pb-remove").after(e("<span />",{class:"et-pb-ab-subject-id"}).text(t.model.get("et_pb_ab_subject_id")))):(t.$el.find(".et-pb-ab-subject-id").remove(),t.$el.find(a).append(e("<span />",{class:"et-pb-ab-subject-id"}).text(t.model.get("et_pb_ab_subject_id")))))},set:function(t,i){if(this.is_selecting_subject()){if(!_.isUndefined(t.model.get("et_pb_global_parent")))return void J.alert("cannot_select_global_children_as_subject");(y.is_global(t.model)||y.is_global_children(t.model))&&y.removeGlobalAttributes(t,!0),this.set_subject(t),setTimeout(function(){V.disable_publish=!0,e("#publish").addClass("disabled")},750)}else if(this.is_selecting_goal()){if(!_.isUndefined(t.model.get("et_pb_global_parent")))return void J.alert("cannot_select_global_children_as_goal");if("removed"===t.model.get("component_status"))return;if(this.has_subject(t.model))return void this.alert("cannot_select_subject_parent_as_goal");V.is_doing_combination=!0,(y.is_global(t.model)||y.is_global_children(t.model))&&y.removeGlobalAttributes(t,!0),t.model.set("et_pb_ab_goal","on"),t.$el.addClass("et_pb_ab_goal"),V.is_selecting_ab_testing_goal=!1,e("#et_pb_layout").removeClass("et_pb_select_ab_testing_goal"),e("#et_pb_ab_goal_module").val(t.options.model.attributes.module_type);var o=j.findWhere({et_pb_ab_subject:"on"}),n=!_.isUndefined(o.cid)&&y.getView(o.get("cid"));if(n){var s=void 0,l={model:n.model,view:n.$el,view_event:i};(s=new a.RightClickOptionsView(l,!0)).copy(i),s.pasteAfter(i),J.alert("configure_ab_testing_alternative"),this.update()}Ue(),setTimeout(function(){V.is_doing_combination=!1,V.allowHistorySaving("turnon","abtesting"),e("#et_pb_layout .et-pb-app-view-ab-stats-button").addClass("active"),delete V.disable_publish,e("#publish").removeClass("disabled")},650)}else if(this.is_selecting_winner())if(t.options.model.has("et_pb_ab_subject")&&"on"===t.options.model.get("et_pb_ab_subject")){var d=j.where({et_pb_ab_subject:"on"}),r=void 0;if(V.is_doing_combination=!0,V.is_selecting_ab_testing_winner=!1,_.each(d,function(e){t.model.attributes.cid!==e.attributes.cid&&(n=y.getView(e.attributes.cid),"section"===(r=n.model.get("type"))?n.removeSection():"row"===r||"row_inner"===r?n.removeRow():"module"===r&&n.removeModule())}),t.model.unset("et_pb_ab_subject"),t.model.unset("et_pb_ab_subject_id"),t.model.has("et_pb_collapsed")&&"on"===t.model.get("et_pb_collapsed")&&t.model.unset("et_pb_collapsed"),y.is_temp_global(t.model)||y.is_temp_global_children(t.model))return void G("set_global_subject_winner",void 0,void 0,void 0,{view:t});this.turn_off_ab_testing_sequence()}else J.alert("select_ab_testing_winner_first")},turn_off_ab_testing_sequence:function(){et_pb_ab_js_options.subjects_rank={},Ue(),setTimeout(function(){V.is_doing_combination=!1,V.allowHistorySaving("turnoff","abtesting"),delete V.disable_publish,e("#publish").removeClass("disabled")},650),e("#et_pb_layout").removeClass("et_pb_select_ab_testing_winner"),e("#et_pb_layout .et-pb-app-view-ab-stats-button").removeClass("active"),this.toggle_portability(!0),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_clear_stats",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_test_id:et_pb_ab_js_options.test_id},success:function(e){et_pb_ab_js_options.has_report=!1,V.ab_stats={}}})},update_saved_subject_ids:function(){var t=this.subject_ids().join();e("#et_pb_ab_subjects").val()!==t&&e("#et_pb_ab_subjects").val(t).addClass("et_pb_value_updated"),ne()},update_layout:function(){if(this.is_active()){setTimeout(function(){var t=e("#et_pb_layout");J.count_subjects()<3?t.addClass("et_pb_ab_disable_subject_removal"):t.removeClass("et_pb_ab_disable_subject_removal")},100),e(".et_pb_section.et_pb_ab_subject").length&&(e(".et_pb_ab_subject_first").removeClass("et_pb_ab_subject_first"),e(".et_pb_ab_subject_last").removeClass("et_pb_ab_subject_last"),e(".et_pb_section").each(function(){var t=e(this);t.find(".et_pb_section.et_pb_ab_subject:first").addClass("et_pb_ab_subject_first"),t.find(".et_pb_section.et_pb_ab_subject:last").addClass("et_pb_ab_subject_last")}),e(".et_pb_section.et_pb_ab_subject").each(function(){var t=e(this);t.prev().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_first"),t.next().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_last")})),e(".et_pb_row.et_pb_ab_subject").length&&(e(".et_pb_ab_subject_first").removeClass("et_pb_ab_subject_first"),e(".et_pb_ab_subject_last").removeClass("et_pb_ab_subject_last"),e(".et_pb_section").each(function(){var t=e(this);t.find(".et_pb_row.et_pb_ab_subject:first").addClass("et_pb_ab_subject_first"),t.find(".et_pb_row.et_pb_ab_subject:last").addClass("et_pb_ab_subject_last")}),e(".et_pb_row.et_pb_ab_subject").each(function(){var t=e(this);t.prev().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_first"),t.next().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_last")})),(e(".et_pb_row.et_pb_ab_subject.et_pb_ab_no_permission").length||e(".et_pb_row.et_pb_ab_goal.et_pb_ab_no_permission").length)&&e(".et_pb_row.et_pb_ab_subject.et_pb_ab_no_permission, .et_pb_row.et_pb_ab_goal.et_pb_ab_no_permission").each(function(){e(this).closest(".et_pb_section").addClass("et_pb_ab_no_permission_parent")}),e(".et_pb_module_block.et_pb_ab_subject").length&&(e(".et_pb_ab_subject_first").removeClass("et_pb_ab_subject_first"),e(".et_pb_ab_subject_last").removeClass("et_pb_ab_subject_last"),e(".et-pb-column").each(function(){var t=e(this);t.find(".et_pb_module_block.et_pb_ab_subject:first").addClass("et_pb_ab_subject_first"),t.find(".et_pb_module_block.et_pb_ab_subject:last").addClass("et_pb_ab_subject_last")}),e(".et_pb_module_block.et_pb_ab_subject").each(function(){var t=e(this);t.prev().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_first"),t.next().hasClass("et_pb_ab_subject")||t.addClass("et_pb_ab_subject_last")})),(e(".et_pb_module_block.et_pb_ab_subject.et_pb_ab_no_permission").length||e(".et_pb_module_block.et_pb_ab_goal.et_pb_ab_no_permission").length)&&e(".et_pb_module_block.et_pb_ab_subject.et_pb_ab_no_permission, .et_pb_module_block.et_pb_ab_goal.et_pb_ab_no_permission").each(function(){var t=e(this);t.closest(".et_pb_row").addClass("et_pb_ab_no_permission_parent"),t.closest(".et_pb_section").addClass("et_pb_ab_no_permission_parent")});var t=!0,i=void 0,o=void 0,n=void 0;_.each(this.subjects(),function(e){e.has("et_pb_collapsed")&&"off"!==e.get("et_pb_collapsed")||(t=!1)}),t&&(o=(i=e(".et_pb_ab_subject:first")).children(".et-pb-data-cid").attr("data-cid"),n=y.getView(o),i.length&&!_.isUndefined(n)&&(i.removeClass("et_pb_collapsed"),n.model.set("et_pb_collapsed","off")))}},update:function(){this.update_saved_subject_ids(),this.update_layout()},is_alert_valid:function(e){return!(!_.isUndefined(V.ab_last_visible_alert)&&V.ab_last_visible_alert===e)&&(V.ab_last_visible_alert=e,!0)},alert:function(e){this.is_alert_valid(e)&&G("ab_testing_alert",void 0,void 0,void 0,{id:e})},alert_yes_no:function(e){this.is_alert_valid(e)&&G("ab_testing_alert_yes_no",void 0,void 0,void 0,{id:e})},get_all_subjects_stats_settings:function(t){var i,o=e('.view-stats-tab[data-analysis="'+t+'"]'),n=o.find(".et-pb-ab-view-stats-subjects-filter"),a=o.find(".et-pb-ab-view-stats-time-filter"),s=(o.find(".et-pb-options-tabs-links"),["first","second","third","fourth","fifth"]),l={subject_statuses:[],subject_ids:[],table:{thead:[],tbody:{},tfoot:[]}};a.find(".active").length||a.find('a[data-duration="'+et_pb_ab_js_options.refresh_interval_duration+'"]').addClass("active"),i=V.ab_stats[a.find(".active").attr("data-duration")],n.find("a").each(function(){var t=e(this),i=!t.hasClass("inactive"),o=!t.parent("li").hasClass("et-pb-no-data"),n=t.attr("data-subject-id");o&&l.subject_statuses.push(i),i&&o&&l.subject_ids.push(parseInt(n))});for(var d=0;d<5;d++)l.table.thead[s[d]]=et_pb_ab_js_options.view_stats_thead_titles[t][d];return _.isUndefined(i)||(_.each(i.subjects_id,function(o){var n="subject_"+o,a=j.findWhere({et_pb_ab_subject_id:o}),s=!(_.isUndefined(a)||!a.has("admin_label"))&&a.get("admin_label");s&&-1!==e.inArray(parseInt(o),l.subject_ids)&&(l.table.tbody[n]={first:o,second:s,third:i.subjects_totals[n][et_pb_ab_js_options.analysis_formula[t].denominator],fourth:i.subjects_totals[n][et_pb_ab_js_options.analysis_formula[t].numerator],fifth:i.subjects_totals[n][t]+"%"})}),l.table.tfoot={first:et_pb_ab_js_options.total_title,second:null,third:i.events_totals[et_pb_ab_js_options.analysis_formula[t].denominator],fourth:i.events_totals[et_pb_ab_js_options.analysis_formula[t].numerator],fifth:i.events_totals[t]+"%"}),l},switch_view_stats_tab:function(){var t=e(".et-pb-options-tabs-links"),i=e(".et-pb-ab-view-stats-content.has-data"),o=t.find("li.et-pb-options-tabs-links-active").attr("data-analysis");i.find(".view-stats-tab").removeClass("active"),i.find('.view-stats-tab[data-analysis="'+o+'"]').addClass("active")},display_stats_tabs:function(t){var i=this,o=_.template("<tr><th><%= first %></th><th><%= second %></th><th><%= third %></th><th><%= fourth %></th><th><%= fifth %></th></tr>"),n=_.template("<tr><td><%= first %></td><td><%= second %></td><td><%= third %></td><td><%= fourth %></td><td><%= fifth %></td></tr>"),a=_.template("<tr><td colspan='2'><%= first %></td></td><td><%= third %></td><td><%= fourth %></td><td><%= fifth %></td></tr>"),s=e(".et_pb_prompt_modal.et_pb_ab_view_stats"),l=j.findWhere({et_pb_ab_goal:"on"}).get("module_type"),d=e("#et_pb_ab_subjects").val().split(",");!_.isEmpty(t.subjects_totals)||et_pb_ab_js_options.has_report?(-1===e.inArray(l,et_pb_ab_js_options.have_conversions)?(e(".et_pb_options_tab_ab_stat_conversion, .view-stats-tab.tab-conversions").remove(),e(".et_pb_options_tab_ab_stat_clicks").addClass("et-pb-options-tabs-links-active")):"et_pb_shop"===l&&e(".et_pb_options_tab_ab_stat_conversion a").text(et_pb_ab_js_options.sales_title),"on"!==J.get_shortcode_tracking_status()&&e(".et_pb_options_tab_ab_stat_shortcode_conversions").remove(),s.find(".view-stats-tab").each(function(){var s=e(this),l=s.attr("data-analysis"),r=e("#ab-testing-stats-"+l),p=e("#ab-testing-stats-pie-"+l),c=e("#view-stats-table-"+l),b=c.find("thead"),u=c.find("tbody"),g=c.find("tfoot"),h=s.find(".et-pb-ab-view-stats-subjects-filter"),f=s.find(".et-pb-ab-view-stats-time-filter"),v=s.find(".ab-testing-stats-pie-legends"),w=e(".et_pb_ab_view_stats .et-pb-options-tabs-links"),y=(t.dates,void 0),k=void 0,C=void 0,S=void 0;if(_.each(d,function(t){var i=j.findWhere({et_pb_ab_subject_id:t}),o=!(_.isUndefined(i)||!i.has("admin_label"))&&i.get("admin_label");if(o){var n=e("<li />").append(e("<a />",{href:"#","data-subject-id":t}).text(o)),a=e("<li />",{"data-subject-id":t}).append(e("<a />",{href:"#"}).text(o)).prepend(e("<span />"));h.append(n),v.append(a)}}),_.isEmpty(t)||_.isUndefined(t)||!t){f.find('a[data-duration="'+et_pb_ab_js_options.refresh_interval_duration+'"]').addClass("active"),s.addClass("no-tab-data")}else{var x=i.draw_graphs(l,t,y,C,r,p,c,b,u,g,o,n,a,!0);y=x.line_chart,C=x.pie_chart,x.line_chart_data,x.pie_chart_data,k=x.line_chart_datasets,S=x.pie_chart_segments}h.on("click","a",function(t){t.preventDefault();var s=e(this).attr("data-subject-id");e(this).toggleClass("inactive"),v.find('li[data-subject-id="'+s+'"]').toggleClass("inactive");var _=i.filter_stats_subject(l,y,C,k,S,c,b,u,g,o,n,a);y=_.line_chart,C=_.pie_chart}),v.on("click","a",function(t){t.preventDefault();var i=e(this).parent("li").attr("data-subject-id");h.find('a[data-subject-id="'+i+'"]').trigger("click")}),w.on("click","a",function(t){t.preventDefault(),e(this).hasClass("et-pb-ab-refresh-stats")||(w.find("li").removeClass("et-pb-options-tabs-links-active"),e(this).parent("li").addClass("et-pb-options-tabs-links-active"),i.switch_view_stats_tab())}),f.on("click","a",function(d){d.preventDefault();var h=e(this),v=h.attr("data-duration");e(".et_pb_prompt_modal.et_pb_ab_view_stats");if(f.find("a").removeClass("active"),h.addClass("active"),_.isUndefined(V.ab_stats[v])||!V.ab_stats[v])m.trigger("et-pb-loading:started"),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_builder_data",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_ab_test_id:et_pb_ab_js_options.test_id,et_pb_ab_duration:v},success:function(t){if(s.removeClass("no-tab-data"),m.trigger("et-pb-loading:ended"),"false"!==t){t=e.parseJSON(t),V.ab_stats[v]=t;var _=i.draw_graphs(l,t,y,C,r,p,c,b,u,g,o,n,a);y=_.line_chart,C=_.pie_chart,_.line_chart_data,_.pie_chart_data,k=_.line_chart_datasets,S=_.pie_chart_segments}else s.addClass("no-tab-data")}});else{s.removeClass("no-tab-data"),t=V.ab_stats[v];var w=i.draw_graphs(l,t,y,C,r,p,c,b,u,g,o,n,a);y=w.line_chart,C=w.pie_chart,w.line_chart_data,w.pie_chart_data,k=w.line_chart_datasets,S=w.pie_chart_segments}})}),s.on("click",".et-pb-ab-refresh-stats",function(){m.trigger("et-pb-loading:started"),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_clear_cache",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_test_id:et_pb_ab_js_options.test_id},success:function(t){V.ab_stats={},e(".et-pb-ab-view-stats-time-filter").find("a.active").click()}})}),s.addClass("et-pb-loaded").find(".et-pb-ab-view-stats-content.has-data, .et-pb-options-tabs-links").css({opacity:1}),i.switch_view_stats_tab()):(s.find(".et-pb-ab-view-stats-content.has-data, .et-pb-options-tabs-links").hide(),s.find(".et-pb-ab-view-stats-content.no-data").css({opacity:1,display:"block"}))},draw_graphs:function(t,i,o,n,a,s,l,d,r,p,c,b,u,g){var h={labels:i.dates,datasets:[]},f=[],m=a.closest(".view-stats-tab"),v=m.find(".et-pb-ab-view-stats-subjects-filter"),w=m.find(".ab-testing-stats-pie-legends");_.each(i.subjects_id,function(e){var o="subject_"+e,n=j.findWhere({et_pb_ab_subject_id:e}),a=!_.isUndefined(n)&&!_.isUndefined(n.attributes.admin_label)&&n.attributes.admin_label,s=v.find('a[data-subject-id="'+e+'"]'),l=w.find('li[data-subject-id="'+e+'"] span');a&&(_.isUndefined(s.attr("style"))&&s.css({backgroundColor:i.subjects_totals[o].color}),_.isUndefined(l.attr("style"))&&l.css({backgroundColor:i.subjects_totals[o].color}),h.datasets.push({subject_id:e,label:a,fillColor:"transparent",strokeColor:i.subjects_totals[o].color,pointColor:i.subjects_totals[o].color,pointStrokeColor:"#fff",data:_.values(i.subjects_analysis[o][t])}),f.push({value:i.subjects_totals[o][t],color:i.subjects_totals[o].color,label:"#"+e+": "+a}))}),v.find("li").removeClass("et-pb-no-data"),w.find("li").removeClass("et-pb-no-data"),_.each(e("#et_pb_ab_subjects").val().split(","),function(t){-1===e.inArray(t,i.subjects_id)&&(v.find('a[data-subject-id="'+t+'"]').parent("li").addClass("et-pb-no-data"),w.find('li[data-subject-id="'+t+'"]').addClass("et-pb-no-data"))});var y=this.get_all_subjects_stats_settings(t);if(d.empty().html(e(c(y.table.thead))),r.empty(),_.each(y.table.tbody,function(t){r.append(e(b(t)))}),p.empty().html(e(u(y.table.tfoot))),_.size(y.table.tbody)>1){l.tablesorter();var k=l.find("thead th:first");k.hasClass(".headerSortDown")||setTimeout(function(){k.trigger("click")},500)}_.isUndefined(o)||o.destroy(),a.closest(".view-stats-tab").addClass("et_pb_ab_visible_tab");var C=(o=new Chart(a.get(0).getContext("2d")).Line(h,{scaleFontSize:13,scaleFontColor:"#a1a9b1",scaleLabel:"<%=value%>%",scaleGridLineWidth:2,scaleLineWidth:2,tooltipTemplate:"<%if (label){%><%=label%>: <%}%><%= value %>%",multiTooltipTemplate:"<%= value %>%",datasetStrokeWidth:4,pointDotStrokeWidth:2,pointDotRadius:7})).datasets,S=void 0;if(_.isUndefined(n)||n.destroy(),s.is(":visible")&&(S=(n=new Chart(s.get(0).getContext("2d")).Pie(f,{animationEasing:"easeInCubic",animationSteps:50,tooltipTemplate:"<%if (label){%><%=label%><%}%>"})).segments),_.isUndefined(g)){var x=this.filter_stats_subject(t,o,n,C,S,l,d,r,p,c,b,u);o=x.line_chart,n=x.pie_chart}return a.closest(".view-stats-tab").removeClass("et_pb_ab_visible_tab"),{line_chart:o,pie_chart:n,line_chart_data:h,pie_chart_data:f,line_chart_datasets:C,pie_chart_segments:S}},filter_stats_subject:function(t,i,o,n,a,s,l,d,r,p,c,b){var u,g=this.get_all_subjects_stats_settings(t),h=_.compact(_.map(n,function(e,t){return!!g.subject_statuses[t]&&e})),f=_.compact(_.map(a,function(e,t){return!!g.subject_statuses[t]&&e}));if(i.datasets=h,i.update(),l.empty(),d.empty(),r.empty(),l.html(e(p(g.table.thead))),_.each(g.table.tbody,function(t){d.append(e(c(t)))}),(u=_.size(g.table.tbody))>1){s.tablesorter();var m=s.find("thead th:first");m.hasClass(".headerSortDown")||setTimeout(function(){m.trigger("click")},500)}if(u>0){var v=_.pluck(g.table.tbody,"third"),w=_.pluck(g.table.tbody,"fourth"),y=_.map(_.pluck(g.table.tbody,"fifth"),function(e){return parseFloat(e)}),k=_.reduce(v,function(e,t){return e+t},0),C=_.reduce(w,function(e,t){return e+t},0),S=(_.reduce(y,function(e,t){return e+t},0)/_.size(y)).toFixed(2)+"%";r.html(e(b({first:et_pb_ab_js_options.total_title,second:null,third:k,fourth:C,fifth:S})))}return o.segments=f,o.update(),{line_chart:i,pie_chart:o}},delete_post_meta:function(){this.toggle_status(!1),e("#et_pb_ab_subjects").val(""),ne()},subject_carousel:function(e){var t=y.getView(e),i=j.where({et_pb_ab_subject:"on"}),o=t.model.get("et_pb_collapsed"),n="on"===o?"off":"on";_.each(i,function(e){var i=y.getView(e.attributes.cid);i.model.get("cid")===t.model.get("cid")?"on"===o&&i.model.set("et_pb_collapsed","off"):"on"===o?i.model.set("et_pb_collapsed","on"):i.model.set("et_pb_collapsed",n),"on"===i.model.get("et_pb_collapsed")?i.$el.addClass("et_pb_collapsed"):i.$el.removeClass("et_pb_collapsed")})}};function K(){var t,i=e("body");e("#et_pb_fb_cta").removeClass("et_pb_ready"),ae("content",E.val()),window.wpActiveEditor="content","html"!==et_pb_options.wp_default_editor&&e("#content-tmce").click(),I.val("off"),L.hide(),A.text(A.data("builder")).toggleClass("et_pb_builder_is_used"),P.toggleClass("et_pb_post_body_hidden"),function(){var t=N.closest("#et_settings_meta_box").find(".et_pb_page_layout_settings");if(N.show().closest("#et_settings_meta_box").show(),N.closest("#et_settings_meta_box").find(".et_pb_side_nav_settings").hide(),N.closest("#et_settings_meta_box").find(".et_pb_single_title").hide(),D.length){D.show();var i=D.find('input[type="radio"]:checked').val();e(".et_divi_format_setting.et_divi_"+i+"_settings").show()}if(t.length>0){var o=t.find("#et_pb_page_layout").val(),n=t.find('option[value="et_full_width_page"]');n.length>0&&n.hide(),"et_full_width_page"===o&&t.find("#et_pb_page_layout").val("et_no_sidebar")}"project"===et_pb_options.post_type&&N.closest("#et_settings_meta_box").find(".et_pb_project_nav").hide()}(),t=i.scrollTop(),i.scrollTop(t+1),m.trigger("et-deactivate-builder"),J.is_active()&&J.delete_post_meta(),e("form#post").append('<input type="hidden" name="et_pb_show_page_creation" value="off" />'),e(window).trigger("resize")}function G(t,n,a,s,l){var d,r=-1!==e.inArray(t,["save_template","reset_advanced_settings"])?" et_modal_on_top":"",p=e('<div class="et_pb_modal_overlay'+r+("reset_advanced_settings"===t?" et_modal_on_top_both_actions":"")+'" data-action="'+t+'"></div>'),c=e("#et-builder-prompt-modal-"+t).length?e("#et-builder-prompt-modal-"+t).html():e("#et-builder-prompt-modal").html(),b=_.template(e("#et-builder-prompt-modal-"+t+"-text").html()),u=!0,g={};if(i(),e("body").addClass("et_pb_stop_scroll"),"save_template"===t){var h=void 0!==(S=y.getView(n.model.get("cid"))).model.get("parent")?y.getView(S.model.get("parent")):"",f=S.$el.find(".et_pb_global"),k=S.$el.is(".et_pb_global"),C=f.length?"has_global":"no_globals";g.is_global=void 0!==S.model.get("et_pb_global_module")&&""!==S.model.get("et_pb_global_module")?"global":"regular",g.is_global_child=""!==h&&(void 0!==h.model.get("et_pb_global_module")&&""!==h.model.get("et_pb_global_module")||void 0!==h.model.get("global_parent_cid")&&""!==h.model.get("global_parent_cid"))?"global":"regular",g.module_type=S.model.get("type")}if("delete_font"===t&&(g.font_name=n),_.isUndefined(l)||e.extend(g,l),p.append(c),p.find(".et_pb_prompt_modal").prepend(b(g)),"upload_font"===t&&(p.find('.et-core-portability-import-form input[type="file"]').on("change",function(t){var i=e(this).get(0).files,o="",n=et_pb_options.supported_font_formats;_.isEmpty(i)||_.each(i,function(e){var t=_.isUndefined(e.name)?"":e.name.toLowerCase();_.each(n,function(e){t.match(e+"$")&&(o+='<div class="et-fb-font-files-list-item" data-file_format="'+e+'" data-file_name="'+t+'"><span class="et-fb-font-files-list-item-remove"></span>'+t+"</div>")})}),""!==o&&(e(".et-font-uploader-selected-fonts").html(""),e(".et-font-uploader-selected-fonts").removeClass("et-font-uploader-hidden-field").append(o))}),p.find(".et-core-portability-import-form button").click(function(t){t.preventDefault(),e(this).closest(".et-core-portability-import-form").find('input[type="file"]').trigger("click")}),p.on("click",".et-fb-font-files-list-item-remove",function(t){e(t.target).closest(".et-fb-font-files-list-item").remove()}),p.find(".et-font-uploader-all-weights").on("change",function(t){var i=e(this).prop("checked"),o=p.find(".et-font-uploader-weight-values");i?o.addClass("et-font-uploader-hidden-section"):o.removeClass("et-font-uploader-hidden-section")})),"open_settings"===t&&(p.addClass("et_pb_builder_settings"),d='[et_pb_split_track id="'+et_pb_ab_js_options.test_id+'" /]',setTimeout(function(){e("#et_pb_ab_current_shortcode").val(d)},100),p.find(".et_pb_prompt_field_list").each(function(){var t=e(this),i=t.attr("data-id"),o=t.attr("data-type"),n=(t.attr("data-autoload"),{et_pb_enable_ab_testing:"et_pb_use_ab_testing"}),a=e(void 0!==n[i]?"#"+n[i]:"#_"+i).val();switch(o){case"yes_no_button":var s=t.find(".et_pb_yes_no_button_wrapper"),l=s.find(".et_pb_yes_no_button"),d=s.find("select");d.val(a),d.trigger("change"),l.click(function(){var t=e(this);t.hasClass("et_pb_off_state")?(t.removeClass("et_pb_off_state").addClass("et_pb_on_state"),d.val("on")):(t.removeClass("et_pb_on_state").addClass("et_pb_off_state"),d.val("off")),d.trigger("change")}),d.change(function(){var i=e(this).val();if("on"===i?l.removeClass("et_pb_off_state").addClass("et_pb_on_state"):l.removeClass("et_pb_on_state").addClass("et_pb_off_state"),""!==t.data("affects")){var o=t.attr("data-affects").split("|");_.each(o,function(e){var o=p.find('.et_pb_prompt_field_list[data-id="'+e+'"]'),n=o.attr("data-visibility-dependency");if(i===n&&t.hasClass("et-pb-visible"))o.addClass("et-pb-visible"),o.find("select").trigger("change");else if(o.removeClass("et-pb-visible"),""!==o.data("affects")){var a=o.data("affects").split("|");_.each(a,function(e){p.find('.et_pb_prompt_field_list[data-id="'+e+'"]').removeClass("et-pb-visible")})}})}}),d.trigger("change");break;case"color-alpha":t.find(".input-colorpicker").val(a).wpColorPicker({width:313});break;case"colorpalette":var r=e(this),c=r.find(".input-colorpalette-colorpicker"),b=0,u=a.split("|");c.each(function(){var t=e(this),i=u[b];t.val(i).wpColorPicker({hide:!1,default:e(this).data("default-color"),width:313,palettes:!1,change:function(t,i){var o=e(this),n=o.attr("data-index"),a=p.find(".colorpalette-item-"+n),s=i.color.toString();o.val(s),a.css({backgroundColor:s}),ne()}}),t.trigger("change"),t.siblings(".wp-picker-clear").on("click",function(e){e.preventDefault(),t.wpColorPicker("color",i)}),t.closest(".wp-picker-container").find(".wp-color-result").attr("title",et_pb_options.select_text),t.closest(".wp-picker-container").on("click",".wp-color-result",function(e){r.find(".colorpalette-colorpicker").removeClass("active")}),b++}),r.on("click",".colorpalette-item",function(t){t.preventDefault();var i=e(this).attr("data-index");r.find(".colorpalette-colorpicker").removeClass("active"),r.find('.colorpalette-colorpicker[data-index="'+i+'"]').addClass("active")});break;case"range":var g,h=t.find('input[type="range"]'),f=h.val(),m=h.attr("min"),v=h.attr("max"),w=h.parent("div"),y=e("<input />",{type:"number",step:1,class:"et-pb-range-input",min:m,max:v,value:f});h.val(a),w.append(y),g=w.find(".et-pb-range-input"),h.on("change input",function(){var t=e(this).val();g.val(t)}),g.on("change keydown",function(){var t=e(this).val();h.val(t)}),h.trigger("change");break;case"select":e(this).find("select").val(a);break;case"codemirror":case"textarea":e(this).find("textarea").val(a)}})),"view_ab_stats"===t){if(e(".et-pb-ab-view-stats-content").length)return;m.trigger("et-pb-loading:started"),_.isUndefined(V.ab_stats)&&(V.ab_stats={}),_.isUndefined(V.ab_stats[et_pb_ab_js_options.refresh_interval_duration])?e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_ab_builder_data",et_pb_ab_nonce:et_pb_options.ab_testing_builder_nonce,et_pb_ab_test_id:et_pb_ab_js_options.test_id,et_pb_ab_duration:et_pb_ab_js_options.refresh_interval_duration},success:function(t){m.trigger("et-pb-loading:ended"),t=e.parseJSON(t),V.ab_stats[et_pb_ab_js_options.refresh_interval_duration]=t,J.display_stats_tabs(t)}}):setTimeout(function(){m.trigger("et-pb-loading:ended"),J.display_stats_tabs(V.ab_stats[et_pb_ab_js_options.refresh_interval_duration])},500)}if("ab_testing_alert_yes_no"!==t||_.isUndefined(l.id)||p.attr({"data-action":t+"_"+l.id}),e("body").append(p),"auto"===e(".et_pb_prompt_modal").css("bottom")&&Object(o.a)(p.find(".et_pb_prompt_modal"),".et_pb_prompt_buttons"),setTimeout(function(){p.find("select, input, textarea, radio").filter(":eq(0)").focus()},1),"rename_admin_label"===t){var S,x=p.find("input#et_pb_new_admin_label"),$=(S=y.getView(n)).model.get("admin_label").trim();""!==$&&x.val($)}e(".et_pb_modal_overlay .et_pb_prompt_proceed").click(function(t){t.preventDefault();var i=e(this).closest(".et_pb_modal_overlay");switch(i.data("action").trim()){case"deactivate_builder":K();break;case"clear_layout":V.removeAllSections(!0);break;case"rename_admin_label":var o=i.find("#et_pb_new_admin_label").val().trim(),d=y.getView(n);if(""==o)return void i.find("#et_pb_new_admin_label").focus();d.model.set("admin_label",o,{silent:!0}),d.renameModule(),V.allowHistorySaving("renamed","module",o),Ue();break;case"reset_advanced_settings":n.each(function(){Ce(e(this))});break;case"save_layout":var r=i.find("#et_pb_new_layout_name").val().trim();if(""==r)return void i.find("#et_pb_new_layout_name").focus();e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_save_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_name:r,et_layout_content:ee("content"),et_layout_type:"layout",et_post_type:et_pb_options.post_type},success:function(e){"layout"!==et_pb_options.post_type?w=v():Le("not_predefined","","",et_pb_options.post_type,!0)}});break;case"save_template":var c=i.find("#et_pb_new_template_name").val().trim(),b=i.find(e("#et_pb_template_global")).is(":checked")?"global":"not_global",g=e(".et_pb_module_settings").data("module_type"),h="section"===g||"row"===g?g:"module",m=void 0!==a?a:"regular",S=n.model.get("cid"),x="",$="",T=i.find("#et_pb_new_cat_name").val(),U=k||void 0!==C&&"has_global"===C&&"global"===b?"ignore_global":"include_global",O="ignore_global"===U?"ignore_global_tabs":"",A=e(".et_pb_modal_settings_container"),M=e(".et_pb_modal_overlay");if(h="row_inner"===g?"row":h,""==c)return void i.find("#et_pb_new_template_name").focus();e(".layout_cats_container input").is(":checked")&&e(".layout_cats_container input").each(function(){var t=e(this);t.is(":checked")&&($+=""!==$?","+t.val():t.val())}),"module"===h&&n.model.set("et_pb_saved_tabs","all",{silent:!0}),n.performSaving(),x=V.generateCompleteShortcode(S,h,U,O),"row_inner"===g&&(x=(x=x.replace(/et_pb_row_inner/g,"et_pb_row")).replace(/et_pb_column_inner/g,"et_pb_column")),A.addClass("et_pb_modal_closing"),M.addClass("et_pb_overlay_closing"),setTimeout(function(){"module"===h&&se("et_pb_content"),A.remove(),M.remove(),e("body").removeClass("et_pb_stop_scroll")},600),e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_save_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_name:c,et_layout_content:x,et_layout_scope:b,et_layout_type:h,et_module_width:m,et_columns_layout:s,et_selected_tabs:"all",et_module_type:g,et_layout_cats:$,et_layout_new_cat:T,et_post_type:et_pb_options.post_type},beforeSend:function(t){"global"===b&&(e("body").find(".et_pb_global_loading_overlay").length||e("body").append('<div class="et_pb_global_loading_overlay"></div>'))},success:function(t){"global"===b&&(V.collection.find(function(e){return e.get("cid")==S}).set("et_pb_global_module",t.post_id),"ignore_global"===U&&f.length&&f.each(function(){var t=e(this).data("cid");if(void 0!==t&&""!==t){var i=V.collection.find(function(e){return e.get("cid")==t});i.unset("et_pb_global_module"),i.unset("et_pb_saved_tabs")}}),Ue(),setTimeout(function(){e("body").find(".et_pb_global_loading_overlay").remove()},650));H={}}});break;case"open_settings":var L=p.find("#et_pb_enable_ab_testing"),E=p.find("#et_pb_ab_stats_refresh_interval").val(),D="on"===L.val(),I=p.find("#et_pb_enable_shortcode_tracking").val(),P=e("#_et_pb_ab_stats_refresh_interval"),R=e("#et_pb_enable_shortcode_tracking");p.find(".et_pb_prompt_field_list").each(function(){var t=e(this),i=t.attr("data-id"),o="1"===t.attr("data-autoload"),n=e("#_"+i),a=[],s=n.val();o&&(t.hasClass("colorpalette")?(t.find(".input-colorpalette-colorpicker").each(function(){a.push(e(this).val())}),n.val(a.join("|")),s!==a.join("|")&&(n.addClass("et_pb_value_updated"),ne()),et_pb_options.page_color_palette=a.join("|")):(n.val(t.find("#"+i).val()),s!==t.find("#"+i).val()&&(n.addClass("et_pb_value_updated"),ne()),"et_pb_section_background_color"===n.attr("id")&&(et_pb_options.page_section_bg_color=t.find("#"+i).val()),"et_pb_page_gutter_width"===n.attr("id")&&(et_pb_options.page_gutter_width=t.find("#"+i).val())))}),J.toggle_status(D),P.val(E),R.val(I),et_pb_ab_js_options.refresh_interval_duration=_.isUndefined(et_pb_ab_js_options.refresh_interval_durations[E])?"day":et_pb_ab_js_options.refresh_interval_durations[E],J.is_active()?J.count_subjects()<2&&(V.disable_publish=!0,e("#publish").addClass("disabled"),J.check_create_db(),J.alert_yes_no("select_ab_testing_subject"),V.is_selecting_ab_testing_subject=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_subject")):(V.is_selecting_ab_testing_subject=!1,J.count_subjects()>0&&G("turn_off_ab_testing")),V.saveAsShortcode();break;case"turn_off_ab_testing":var N,B=j.where({et_pb_ab_goal:"on"});_.each(B,function(e){delete e.attributes.et_pb_ab_goal,_.isUndefined(e.attributes.et_pb_temp_global_module)&&_.isUndefined(e.attributes.et_pb_temp_global_parent)||(N=y.getView(e.attributes.cid),y.removeTemporaryGlobalAttributes(N,!0))}),V.disable_publish=!0,e("#publish").addClass("disabled"),V.is_selecting_ab_testing_winner=!0,e("#et_pb_layout").addClass("et_pb_select_ab_testing_winner");break;case"set_global_subject_winner":y.removeTemporaryGlobalAttributes(l.view),J.turn_off_ab_testing_sequence();break;case"ab_testing_alert":_.isUndefined(V.ab_last_visible_alert)||delete V.ab_last_visible_alert;break;case"view_ab_stats":J.toggle_status(!1),V.is_selecting_ab_testing_subject=!1,J.count_subjects()>0&&G("turn_off_ab_testing");break;case"delete_font":u=!1,e(this).hasClass("et-font-uploader-disabled")||q("remove",{font_name:n},i,e(this));break;case"upload_font":var z=p.find("#et-font-uploader-name").val(),F=p.find('.et-core-portability-import-form input[type="file"]').get(0).files,W=p.find(".et-font-uploader-all-weights").prop("checked")?"all":"",Y={},X="";if(p.find(".et-font-uploader-error").html(""),u=!1,"all"!==W){var Q=p.find(".et-font-uploader-weight-values input"),te=["100","200","300","400","500","600","700","800","900"],ie=[];e.each(Q,function(t,i){e(i).prop("checked")&&ie.push(te[t])}),W=ie.join(",")}""===z&&(X+=et_pb_options.font_name_error+"\n"),_.isUndefined(F)&&(X+=et_pb_options.font_file_error+"\n"),""===W&&(X+=et_pb_options.font_weight_error+"\n"),""!==X?p.find(".et-font-uploader-error").html(X):(Y={font_name:z,font_weight:W,generic_family:"sans-serif",font_files:F},e(this).hasClass("et-font-uploader-disabled")||q("add",Y,i,e(this),n))}u&&Z(e(this))}),e(".et_pb_modal_overlay .et_pb_prompt_proceed_alternative").click(function(t){switch(t.preventDefault(),e(this).closest(".et_pb_modal_overlay").data("action").trim()){case"set_global_subject_winner":y.removeTemporaryGlobalAttributes(l.view,!0),J.turn_off_ab_testing_sequence();break;case"ab_testing_alert_yes_no_select_ab_testing_subject":J.toggle_status(!1),J.toggle_portability(!0),V.disable_publish=!1,e("#publish").removeClass("disabled"),V.is_selecting_ab_testing_subject=!1,e("#et_pb_layout").removeClass("et_pb_select_ab_testing_subject"),delete V.ab_last_visible_alert}Z(e(this))}),e(".et_pb_modal_overlay .et_pb_prompt_dont_proceed").click(function(t){switch(t.preventDefault(),e(this).closest(".et_pb_modal_overlay").data("action").trim()){case"ab_testing_alert":_.isUndefined(V.ab_last_visible_alert)||delete V.ab_last_visible_alert;break;case"turn_off_ab_testing":J.toggle_status(!0)}Z(e(this))})}function q(t,i,o,n,a){var s={};"add"===t&&(s=JSON.stringify({font_weights:i.font_weight,generic_family:i.generic_family}));var l=new FormData,d={action:"et_pb_process_custom_font",et_pb_font_action:t,et_fb_upload_font_nonce:et_pb_options.upload_font_nonce,et_pb_font_name:i.font_name,et_pb_font_settings:s};_.each(i.font_files,function(t,i){var o=e(".et-font-uploader-selected-fonts").find("[data-file_name='"+t.name.toLowerCase()+"']");if(o.length>0){var n=o.data("file_format");d["et_pb_font_file_"+n]=t}}),_.each(d,function(e,t){l.append(t,e)}),e.ajax({type:"POST",url:et_pb_options.ajaxurl,contentType:!1,processData:!1,data:l,beforeSend:function(){o.append('<div id="et_pb_loading_animation"></div>'),n.addClass("et-font-uploader-disabled")},complete:function(){o.find("#et_pb_loading_animation").remove()},success:function(s){var l=e.parseJSON(s);if(_.isEmpty(l.error)){if("remove"===t&&!_.isUndefined(et_pb_options.user_fonts[i.font_name])){delete et_pb_options.user_fonts[i.font_name];var d=".select-option-item-"+i.font_name.replace(/ /g,"_");e(d).length>0&&e(d).each(function(){var t=e(this),o=t.hasClass("et_pb_selected_menu_item"),n=o?t.closest(".et-pb-option-container--font"):"";t.remove(),o&&($e(i.font_name,"remove"),ue(n,"default"),je(n,!1))})}if("add"===t&&!_.isEmpty(l.updated_fonts)){et_pb_options.user_fonts=l.updated_fonts;var r=l.uploaded_font;if(!_.isUndefined(r)){var p=r.replace(/ /g,"_"),c=e(".et-pb-option-subgroup-uploaded .et-pb-option-subgroup-container"),b='<li class="select-option-item select-option-item-custom-font select-option-item-'+p+'" data-value="'+r+'">'+r+'<span class="et-pb-user-font-marker"></span></li>';c.length>0&&c.append(b);var u=_.isUndefined(a)?"":e('[data-option_name="'+a+'"]').find('.select-option-item-custom-font[data-value="'+r+'"]');""!==u&&u.length>0&&u.click()}}Z(o)}else n.removeClass("et-font-uploader-disabled"),o.find(".et-font-uploader-error").html(l.error)}})}function Y(e){e.addClass("et_pb_animate_clone"),setTimeout(function(){e.length&&e.removeClass("et_pb_animate_clone")},500)}function Z(t){var i=t.closest(".et_pb_modal_overlay"),o=e("body");o.removeClass("et_pb_stop_scroll"),o.removeClass("et_pb_advanced_menu_opened"),i.addClass("et_pb_modal_closing"),setTimeout(function(){i.remove()},600)}function X(t,i){t.removeOverlay(),e(".et_pb_modal_settings_container").addClass("et_pb_modal_closing"),setTimeout(function(){t.remove(),"trigger_event"===i&&m.trigger("et-modal-view-removed")},600)}function Q(){var t=N.closest("#et_settings_meta_box").find(".et_pb_page_layout_settings");if(R.filter(":visible").length>1?(t.hide(),N.find(".et_pb_side_nav_settings").show()):("post"!==et_pb_options.post_type&&"no"===et_pb_options.is_third_party_post_type&&t.hide(),N.closest("#et_settings_meta_box").find(".et_pb_side_nav_settings").show(),N.closest("#et_settings_meta_box").find(".et_pb_single_title").show()),t.length>0){t.find("#et_pb_page_layout").val();var i=t.find('option[value="et_full_width_page"]');i.length>0&&i.show()}if(D.length){D.hide();var o=D.find('input[type="radio"]:checked').val();e(".et_divi_format_setting.et_divi_"+o+"_settings").hide()}"project"===et_pb_options.post_type&&N.closest("#et_settings_meta_box").find(".et_pb_project_nav").show()}function ee(t,i){var o=void 0;i=void 0!==i&&i;return o=void 0!==window.tinyMCE&&window.tinyMCE.get(t)&&!window.tinyMCE.get(t).isHidden()?window.tinyMCE.get(t).getContent():e("#"+t).val(),i&&void 0!==window.tinyMCE&&(o=(o=o.replace(/<p>\[/g,"[")).replace(/\]<\/p>/g,"]")),o.trim()}function te(e){var t=e.replace(/et_pb_row /g,"et_pb_row_inner ").replace(/et_pb_row\]/g,"et_pb_row_inner]");return t=t.replace(/et_pb_column /g,"et_pb_column_inner ").replace(/et_pb_column\]/g,"et_pb_column_inner]")}function ie(){var e="tinymce";return"html"===getUserSetting("editor")&&(e="html"),e}function oe(e){return!(void 0===window.tinyMCE||!window.tinyMCE.get(e)||window.tinyMCE.get(e).isHidden())}function ne(){var t=e("#post_ID").val(),i="https:"===window.location.protocol;wpCookies.set("et-editor-available-post-"+t+"-bb","bb",1800,et_pb_options.cookie_path,!1,i),wpCookies.set("et-editing-post-"+t+"-bb","bb",300,et_pb_options.cookie_path,!1,i),wpCookies.remove("et-saving-post-"+t+"-bb",et_pb_options.cookie_path,!1,i),wpCookies.remove("et-saved-post-"+t+"-bb",et_pb_options.cookie_path,!1,i)}function ae(t,i,o){o=o||"",oe("content");var n=oe(t),a=e.trim(i);if("load_secondary_editor"===o&&(a=_.unescape(a)),void 0!==window.tinyMCE&&window.tinyMCE.get(t)&&n){var s=window.tinyMCE.get(t);"load_secondary_editor"===o&&(a=window.switchEditors.wpautop(a)),s.setContent(a,{format:"html"})}e("#"+t).length&&e("#"+t).val(a),W[t]||"content"===t||(void 0!==tinyMCEPreInit.mceInit[t]?quicktags({id:t}):quicktags(tinyMCEPreInit.qtInit[t]),QTags._buttonsInit(),W[t]=!0),wp.heartbeat&&wp.heartbeat.hasConnectionError()||(e("#publish").removeClass("disabled"),delete V.disable_publish)}function se(e){void 0!==window.tinyMCE&&(window.tinyMCE.execCommand("mceRemoveEditor",!1,e),void 0!==window.tinyMCE.get(e)&&window.tinyMCE.remove("#"+e),W[e]=!1)}function le(t){t.length&&t.each(function(){e(this).trigger("change")})}function _e(t){if(0!==t.length){var i=t.closest(".et-pb-options-toggle-container");if(0!==i.length){var o=!1;i.find(".et-pb-option").length>0&&i.find(".et-pb-option").each(function(){"none"!==e(this).css("display")&&(o=!0)}),o?i.removeClass("et-pb-options-toggle-empty"):i.addClass("et-pb-options-toggle-empty")}}}function de(e,t){var i=void 0===e.data("device")?"all":e.data("device");if("all"!==i&&"phone"!==i){var o=void 0!==t?t:e.val(),n=e.hasClass("et-pb-range-input")||e.hasClass("et-pb-range"),a=e.hasClass("et_custom_margin_main"),s=n?".et-pb-range-input":".et-pb-main-setting",l=e.siblings(s+".et_pb_setting_mobile_tablet"),d=e.siblings(s+".et_pb_setting_mobile_phone"),r=void 0===l.data("default")?"":l.data("default"),p=void 0===d.data("default")?"":d.data("default"),c=_.isNaN(parseFloat(o))?0:parseFloat(o),b=!1,u=void 0,g=void 0;n?(u=e.siblings(".et-pb-range.et_pb_setting_mobile_tablet"),g=e.siblings(".et-pb-range.et_pb_setting_mobile_phone")):e.hasClass("et_custom_margin_main")||(o=Se(o,!1,"")),"desktop"===i?("no"===l.data("has_saved_value")&&l.val()===r&&(l.val(o).change(),b=!0,n&&u.val(c)),l.data("default",o),n&&u.data("default",c),a&&xe(l)):b=!0,b&&("no"===d.data("has_saved_value")&&d.val()===p&&(d.val(o).change(),n&&g.val(c),a&&xe(d)),d.data("default",o),n&&g.data("default",c))}}function re(e){var t=e.find(".et-pb-main-setting.et_pb_setting_mobile_active"),i=""+t.val(),o=t.hasClass("et-pb-range"),n=void 0===t.data("default")?"":""+t.data("default"),a=e.find(".et-pb-reset-setting");i!==(o&&""!==n?""+parseFloat(n):n)?a.addClass("et-pb-reset-icon-visible"):a.removeClass("et-pb-reset-icon-visible")}function pe(e,t){e.find(".et_pb_setting_mobile").removeClass("et_pb_setting_mobile_active"),e.find(".et_pb_setting_mobile_"+t).addClass("et_pb_setting_mobile_active"),e.find(".et_pb_mobile_settings_tab").removeClass("et_pb_mobile_settings_active_tab"),e.find('.et_pb_mobile_settings_tab[data-settings_tab="'+t+'"]').addClass("et_pb_mobile_settings_active_tab"),re(e)}function ce(t,i){j.findWhere({cid:i});var o=t.find(".et-pb-options-tabs-links"),n=t.find(".et-pb-options-tab"),s=t.find(".et-pb-affects"),l=t.find(".et-pb-responsive-affects"),d=t.find(".et_custom_margin_main"),r=t.find(".et_custom_margin"),p=t.find(".et-pb-option--font"),b=t.find(".et_builder_font_style"),u=t.find(".et_builder_font_weight, .et_pb_font_line_style_select, .et-pb-font-line-color-value"),g=t.find(".et_pb_select_placeholder"),h=t.find("select.et-pb-text-align-select"),f=t.find(".et_builder_text_align"),m=t.find(".et_pb_multiple_buttons_wrapper input"),v=t.find(".et_builder_multiple_buttons_button"),w=t.find(".et-pb-range"),y=t.find(".et-pb-range-input"),k=t.find(".et-pb-options-tab-advanced").find(".et-pb-main-setting"),C=t.find(".et-pb-custom-color-picker"),x=t.find(".et-pb-choose-custom-color-button"),$=t.find(".et-pb-option-container--select_with_option_groups select"),V=t.find(".et_pb_yes_no_button_wrapper"),T=t.find(".et_pb_yes_no_button"),U=t.find(".et_pb_yes_no_button_wrapper select"),O=t.find(".et-pb-validate-unit"),A=t.find(".et_options_list:not(.et_conditional_logic)"),M=t.find(".et_conditional_logic"),L=t.find(".et_select_animation"),E=t.find(".et-preset-container"),D=t.find(".et-pb-option--background, .et-pb-option--background-field"),I=t.find("input.regular-text.et_pb_setting_mobile"),P=t.find(".et-pb-options-tab-custom_css .et-pb-option"),R=t.find(".et-pb-mobile-settings-toggle"),N=t.find(".et_pb_mobile_settings_tabs"),H=t.find(".et_pb_checkboxes_wrapper"),B=H.find('input[type="checkbox"]'),z="section"===t.data("module_type")?t.find("#et_pb_background_color"):"",F=t.find("#et_pb_gutter_width"),W=t.find("#et_pb_google_api_key"),J=t.find(".et_pb_update_google_key"),K=t.find("#et_pb_field_id"),q=t.find(".et_pb_contains_tabbed_subtoggle");function Y(e,t,i){var o=".et_options_list_row";t&&(o=".et_options_list_row:last");var n=e.parents(o);t&&(n=e.parent().find(o));var a=n.clone();a.find(".et_options_list_checked").removeClass("et_options_list_checked"),i&&a.find("input[type=text]").val(""),a.insertAfter(n),a.find("input[type=text]").focus()}function Z(t,i){var o=[];i.val(""),t.find("input[type=text]").each(function(){var t=e(this),i=t.prev(".et_options_list_checked").length>0,n={value:t.val(),checked:0};""!==n.value&&(i&&(n.checked=1),o.push(n))}),i.val(JSON.stringify(o))}function X(t,i,o,n){var a=null;switch(t){case"checkbox":case"radio":case"select":var s;switch(t){case"checkbox":s=o.et_pb_checkbox_options;break;case"radio":s=o.et_pb_radio_options;break;case"select":s=o.et_pb_select_options}var l=function(e){""===e&&(e="[]");var t=void 0;return t=(t=(t=(t=e.replace(/%22/g,'"')).replace(/%91/g,"[")).replace(/%92/g,"\\")).replace(/%93/g,"]"),JSON.parse(t)}(s);a=e("<select></select>"),e.each(l,function(t,o){var n=e('<option value="'+o.value+'">'+o.value+"</option>");a.append(n),""!==i&&a.val(i)});break;default:a=e('<input type="text" value="'+i+'" />')}return a.addClass("et_conditional_logic_value"),a}function Q(t){var i=t.find("textarea"),o=[];t.find(".et_options_list_row").each(function(){var t=e(this),i=t.find(".et_conditional_logic_field").val(),n=t.find(".et_conditional_logic_condition").val(),a=t.find(".et_conditional_logic_value"),s=a.val(),l=t.find(".et_conditional_logic_field").find("option:selected").data("type"),d=!_.includes(["radio","select","checkbox"],l)&&s,r={field:i,condition:n,value:s};!1!==d&&t.attr("data-selected-value",d),o.push(r),a.prop("disabled",!1),_.includes(["is empty","is not empty"],n)&&a.prop("disabled",!0)}),i.val(JSON.stringify(o))}W.length&&(J.attr("href",et_pb_options.options_page_url),""===et_pb_options.google_api_key?(W.addClass("et_pb_hidden_field"),J.text(J.data("empty_text")).addClass("et_pb_no_field_visible")):W.val(et_pb_options.google_api_key)),""!==z&&""!==et_pb_options.page_section_bg_color&&(""===z.val()&&(z.val(et_pb_options.page_section_bg_color),z.change()),z.data("default",et_pb_options.page_section_bg_color)),F&&""!==et_pb_options.page_gutter_width&&(F.siblings(".et-pb-main-setting").data("default",et_pb_options.page_gutter_width),F.data("default",et_pb_options.page_gutter_width)),q.length&&q.each(function(){var t=e(this),i=t.find(".subtoggle_tabs_nav");if(!(i.length<1||i.find(".subtoggle_tabs_nav_item").length<1)){var o=100/i.find(".subtoggle_tabs_nav_item").length+"%";i.find(".subtoggle_tabs_nav_item").css({width:o}),e(i.find(".subtoggle_tabs_nav_item a")[0]).addClass("et-bb-active-sub-tab"),e(t.find(".et_pb_tabbed_subtoggle")[0]).addClass("et-bb-active-subtoggle"),i.find(".subtoggle_tabs_nav_item a").click(function(i){i.preventDefault();var o=e(this),n=o.data("tab_id");t.find(".subtoggle_tabs_nav_item a").removeClass("et-bb-active-sub-tab"),o.addClass("et-bb-active-sub-tab"),t.find(".et_pb_tabbed_subtoggle").removeClass("et-bb-active-subtoggle"),t.find("[data-tab_id='"+n+"']").addClass("et-bb-active-subtoggle")})}}),N.length&&N.each(function(){var t=e(this).closest(".et-pb-option"),i=t.find(".et_pb_mobile_last_edited_field").val(),o=t.find(".et_pb_setting_mobile");if(o.length&&o.each(function(){var t=e(this),i=t.data("device"),o="desktop"!==i&&void 0!==t.data("has_saved_value")?t.data("has_saved_value"):"no",n=t.attr("type"),a="tablet"===i?t.siblings('input[type="'+n+'"].et_pb_setting_mobile_desktop').val():t.siblings('input[type="'+n+'"].et_pb_setting_mobile_tablet').val();"desktop"!==i&&("no"===o&&t.val(a),t.data("default",a))}),void 0!==i&&""!==i){var n=i.split("|");if(void 0===n[0]||"on"!==n[0])return;t.find(".et-pb-mobile-settings-toggle").addClass("et-pb-mobile-icon-visible et-pb-mobile-settings-active"),t.toggleClass("et_pb_has_mobile_settings"),void 0!==n[1]&&""!==n[1]&&pe(t,n[1])}}),R.click(function(){var t=e(this),i=t.closest(".et-pb-option"),o=i.find(".et_pb_mobile_last_edited_field"),n=o.val(),a=""!==n?n.split("|"):[],s=void 0!==a[1]&&""!==a[1]?a[1]:"desktop",l=i.find(".et-pb-reset-setting");return t.toggleClass("et-pb-mobile-settings-active"),i.toggleClass("et_pb_has_mobile_settings"),pe(i,s),i.addClass("et_pb_animate_options"),setTimeout(function(){i.removeClass("et_pb_animate_options")},500),i.hasClass("et_pb_has_mobile_settings")?(l.data("device",s),a[0]="on"):(l.data("device","all"),a[0]="off",pe(i,"desktop")),a[1]=void 0!==a[1]?a[1]:"",o.val(a[0]+"|"+a[1]).trigger("et_pb_setting:change"),!1}),N.find("a").click(function(){var t=e(this),i=t.closest(".et-pb-option-container"),o=t.data("settings_tab"),n=i.find(".et_pb_mobile_last_edited_field");return t.closest(".et_pb_mobile_settings_tabs").find("a").removeClass("et_pb_mobile_settings_active_tab"),t.addClass("et_pb_mobile_settings_active_tab"),i.find(".et_pb_setting_mobile").removeClass("et_pb_setting_mobile_active"),i.find(".et_pb_setting_mobile_"+o).addClass("et_pb_setting_mobile_active"),i.find(".et-pb-reset-setting").data("device",o),n.val("on|"+o),re(i),!1}),H.length&&H.each(function(){var t=e(this),i=t.find("input.et-pb-main-setting").val(),o=t.find('input[type="checkbox"]'),n=void 0,a=void 0;""!==i&&(n=i.split("|"),a=0,o.each(function(){"on"===n[a]&&e(this).prop("checked",!0);a++}))}),B.click(function(){var t=e(this),i=e(this).attr("class"),o=t.closest(".et_pb_checkboxes_wrapper"),n=o.find(".et_pb_disabled_option"),a=o.find('input[type="checkbox"]'),s=o.find("input.et-pb-main-setting"),l=!0===t.prop("checked")?"on":"off",_=0,d=[],r=void 0,p=void 0;a.each(function(){e(this).hasClass(i)&&(r=_),_++,d.push("")}),(p=""!==s.val()?s.val().split("|"):d)[r]=l,s.val(p.join("|")),n.length&&("on"===p[0]&&"on"===p[1]&&"on"===p[2]?n.val("on"):n.val("off"))}),I.on("input change",function(){de(e(this))}),C.each(function(){var t=e(this),i=t.val(),o=t.closest(".et-pb-custom-color-container"),n=t.closest(".et-pb-options-tab"),a=o.siblings(".et-pb-choose-custom-color-button"),s=void 0!==t.data("old-option-ref")&&""!==t.data("old-option-ref")?t.data("old-option-ref"):"",l=""!==s?n.find(".et-pb-option-"+s):"",_=""!==l&&l.length?l.find("input"):"",d=o.find(".et-pb-color-picker-hex"),r=ve(d).toLowerCase();if(""!==_&&(""===i&&""!==_.val()&&(i=_.val()),_.val("")),""===i||i===r)return!0;o.removeClass("et_pb_hidden"),a.addClass("et_pb_hidden"),d.wpColorPicker("color",i)}),x.click(function(){var t=e(this),i=t.siblings(".et-pb-custom-color-container"),o=i.find(".et-pb-color-picker-hex"),n=i.find(".et-pb-custom-color-picker");return t.addClass("et_pb_hidden"),i.removeClass("et_pb_hidden"),i.find(".wp-color-result").click(),n.val(o.wpColorPicker("color")),!1}),$.each(function(){var t=e(this).siblings("input.et-pb-main-setting"),i=t.val().split("|"),o=i.length>1?i[0]:"",n=i.length>1?i[1]:i[0];""===o&&(o=e(this).find(":selected").parent().attr("label"),t.val(o+"|"+n).trigger("change")),e(this).val(n),e(this).change(function(){var i=e(this).find(":selected").parent().attr("label")||"";t.val(i+"|"+e(this).val()).trigger("change")})}),V.each(function(){var t=e(this),i=t.find(".et_pb_yes_no_button");"on"===t.find("select").val()?(i.removeClass("et_pb_off_state"),i.addClass("et_pb_on_state")):(i.removeClass("et_pb_on_state"),i.addClass("et_pb_off_state"))}),A.each(function(){var t=e(this),i=t.find("textarea"),o=i.val(),n=void 0;if(t.on("keydown","input[type=text]",function(e){"Enter"===e.key&&e.stopPropagation()}),t.on("keyup","input[type=text]",function(o){clearTimeout(n),"Enter"===o.key&&Y(e(this),!1,!0),n=setTimeout(function(){Z(t,i)},500)}),t.on("click",".et-pb-add-sortable-option",function(t){t.preventDefault(),Y(e(this),!0,!0)}),t.on("click",".et_options_list_copy",function(t){t.preventDefault(),Y(e(this))}),t.on("click",".et_options_list_remove",function(o){if(o.preventDefault(),1===t.find(".et_options_list_row").length)return t.find(".et_options_list_row:first input[type=text]").val(""),void Z(t,i);e(this).parents(".et_options_list_row").remove(),Z(t,i)}),t.on("click",".et_options_list_check",function(o){o.preventDefault();var n=e(this);n.parent().hasClass("et_options_list_row_radio")&&t.find(".et_options_list_check").not(n).removeClass("et_options_list_checked"),n.toggleClass("et_options_list_checked"),Z(t,i)}),!o){var a=parseInt(t.parents("[data-parent-cid]").attr("data-parent-cid")),s=j.findWhere({cid:a}),l=!_.isUndefined(s.attributes.et_pb_checkbox_checked)&&"on"===s.attributes.et_pb_checkbox_checked,d=_.isUndefined(s.attributes.et_pb_field_title)?"":s.attributes.et_pb_field_title;o=JSON.stringify([{value:d,checked:!0===l?1:0}]),i.val(o),"checkbox"===s.attributes.et_pb_field_type&&t.find(".et_options_list_row_checkbox").length>0&&setTimeout(function(){e("#et_pb_field_title").val("")},0)}!function(t,i,o){if(""===o||_.isUndefined(o))return;var n=t.find(".et_options_list_row:first"),a=e("<div>").addClass("et_options_rows");try{o=JSON.parse(o)}catch(e){o=o.replace(/\{("value":")(.*?)(",)("checked":.,?.*?)\}/gi,function(e,t,i,o,n){var a=i.replace(/(.)?(")/gi,function(e,t,i){return"\\"!==t?t+"\\"+i:e});return"{"+t+a+o+n+"}"}),o=JSON.parse(o)}for(var s=0;s<o.length;s++){var l=o[s],d=1===l.checked,r=n.clone();r.find("input[type=text]").val(l.value),r.find(".et_options_list_check").toggleClass("et_options_list_checked",d),r.appendTo(a)}a.insertAfter(n),n.remove()}(t,0,o),t.children(".et_options_rows").sortable({axis:"y",containment:"parent",update:function(){Z(t,i),setTimeout(function(){e(".et_options_rows").children().css({position:"",top:"",left:""})},700)}})}),M.each(function(){var t=e(this),i=t.find("textarea").val();i=""!==i?i:"[]",i=JSON.parse(i);var o=e(this).find(".et_options_list_row");if(1<i.length)for(var n=1;n<i.length;n++){var a=o.clone();t.find(".et_options_list_row:last").after(a)}setTimeout(function(){var o={},n=t.parents(".et_pb_modal_settings_container_step2"),a=n.data("parent-cid"),s=n.prev(".et_pb_modal_settings_container").find('ul.et-pb-sortable-options li:not([data-cid="'+a+'"])'),l=t.find(".et_conditional_logic_field");s.each(function(){var t=e(this).data("cid"),i=j.findWhere({cid:t}).attributes,n=i.et_pb_field_id;if(""!==n){n=n.toLowerCase();var a=_.isUndefined(i.et_pb_field_type)?"input":i.et_pb_field_type,s=_.isUndefined(i.et_pb_field_title)?n:i.et_pb_field_title;s=""!==s.trim()?s:n;var d=e('<option data-type="'+a+'" value="'+n+'">'+s+"</option>");l.append(d),o[n]=i}});var d="";for(var r in o)if(o.hasOwnProperty(r)){d=r;break}var p=o[d].et_pb_field_id.toLowerCase();0===i.length&&0!==o.length&&i.push({field:p,condition:"is",value:""});for(var c=0;c<i.length;c++){var b=i[c],u=t.find(".et_options_list_row").eq(c),g=(l=u.find(".et_conditional_logic_field")).next(".et_conditional_logic_condition"),h=o[p],f="input",m="",v=_.isUndefined(b.field)||_.isUndefined(o[b.field])?p:b.field,w=_.isUndefined(b.condition)?"is":b.condition;_.isUndefined(o[b.field])||(h=o[b.field],m=b.value,f=_.isUndefined(h.et_pb_field_type)?"input":h.et_pb_field_type),u.find(".et_conditional_logic_value").remove(),X(f,m,h,t).insertAfter(g),l.val(v),g.val(w)}Q(t),t.on("change",".et_conditional_logic_field",function(){var i=e(this),n=i.val(),a=i.next(".et_conditional_logic_condition"),s=i.parents(".et_options_list_row"),l=o[n],d="",r=_.isUndefined(l.et_pb_field_type)?"input":l.et_pb_field_type,p=s.attr("data-selected-value");p&&!_.includes(["radio","select","checkbox"],r)&&(d=p),s.find(".et_conditional_logic_value").remove(),X(r,d,l,t).insertAfter(a),Q(t)}),t.on("change",".et_conditional_logic_condition, .et_conditional_logic_value",function(){Q(t)}),t.on("click",".et-pb-add-sortable-option",function(t){t.preventDefault(),function(e,t){if(0===t.length)return;var i=e.parents(".et_conditional_logic"),o=i.find(".et_options_list_row:last"),n=o.clone(),a=n.find(".et_conditional_logic_condition"),s="";for(var l in t)if(t.hasOwnProperty(l)){s=l;break}var d=t[s],r=_.isUndefined(d.et_pb_field_type)?"input":d.et_pb_field_type;n.find(".et_conditional_logic_value").remove(),X(r,"",d,i).insertAfter(a),a.val("is"),n.insertAfter(o),Q(i)}(e(this),o)}),t.on("click",".et_options_list_remove",function(t){t.preventDefault(),function(e){var t=e.parent(".et_options_list_row"),i=t.parent(".et_conditional_logic");if(1===i.find(".et_options_list_row").length)return;t.remove(),Q(i)}(e(this))})},0)}),K.on("focusout",function(){var t=e(this).val().replace(/\s+/g,"_"),i=K.parents(".et_pb_modal_settings_container_step2"),o=i.prev(".et_pb_modal_settings_container"),n=i.data("parent-cid"),a=o.find('ul.et-pb-sortable-options li:not([data-cid="'+n+'"])'),s=[];if(a.each(function(){var t=e(this).data("cid"),i=j.findWhere({cid:t}).attributes;s.push(i)}),""===t){var l=j.findWhere({cid:n});t="Field_"+(parseInt(l.attributes.module_order)+1)}for(;;){for(var _=!1,d=0;d<s.length;d++){if(s[d].et_pb_field_id.toLowerCase()===t.toLowerCase()){t+="_2",_=!0;break}}if(!1===_)break}e(this).val(t)}),L.each(function(){var t=e(this),i=t.find('input[type="hidden"]'),o=i.val();t.find('.et_animation_button_title[data-value="'+o+'"]').parent().addClass("et_active_animation"),t.on("click",".et_animation_button a",function(o){o.preventDefault();var n=e(this);if(!n.hasClass("et_active_animation")){var a=n.find(".et_animation_button_title").attr("data-value");a=a.trim(),t.find(".et_animation_button a").removeClass("et_active_animation"),n.addClass("et_active_animation"),i.val(a).trigger("change")}})}),E.each(function(){var t=e(this),i=t.find('input[type="hidden"]'),o=function(e,i){var o=t.closest(".et-pb-options-toggle-container").find("#et_pb_"+e);o.val(i),o.trigger("change")},n=function(){t.find(".et-preset").removeClass("et-preset-active"),t.find('.et-preset[data-value="'+i.val()+'"]').addClass("et-preset-active")};t.on("click",".et-preset",function(n){var a=e(this),s=a.attr("data-value").trim(),l={};if(n.preventDefault(),!a.hasClass("et-preset-active")){t.find(".et-preset").removeClass("et-preset-active"),a.addClass("et-preset-active"),i.val(s).trigger("change");try{l=JSON.parse(a.attr("data-fields"))}catch(e){l=[]}e.each(l,o)}}),i.on("change",n),n()}),T.click(function(){var t=e(this),i=t.closest(".et_pb_yes_no_button_wrapper").find("select");t.hasClass("et_pb_off_state")?(t.removeClass("et_pb_off_state"),t.addClass("et_pb_on_state"),i.val("on")):(t.removeClass("et_pb_on_state"),t.addClass("et_pb_off_state"),i.val("off")),i.trigger("change")}),U.change(function(){var t=e(this),i=t.closest(".et_pb_yes_no_button_wrapper").find(".et_pb_yes_no_button");"on"===t.val()?(i.removeClass("et_pb_off_state"),i.addClass("et_pb_on_state")):(i.removeClass("et_pb_on_state"),i.addClass("et_pb_off_state"))}),D.length&&D.each(function(){var t=e(this),i=t.is(".et-pb-option--background"),o=i?".et-pb-option--background":".et-pb-option--background-field",n=t.find(".et-pb-option-container-inner").data("base_name"),a=i?"":n+"_",s=t.find(".et_pb_background-tab-navs li").size();t.find(".et_pb_background-tab:first").show(),t.find(".et_pb_background-tab-navs li:first a").addClass("active"),4!==s&&t.find(".et_pb_background-tab-navs li").css({width:100/s+"%"}),t.find(".et_pb_background-tab-navs").on("click","a",function(t){t.preventDefault();var i=e(this),n=i.attr("data-tab"),a=i.closest(o);a.find(".et_pb_background-tab-navs a").removeClass("active"),i.addClass("active"),a.find(".et_pb_background-tab:visible").hide(),a.find('.et_pb_background-tab[data-tab="'+n+'"]').fadeIn(),a.find('.et_pb_background-tab[data-tab="'+n+'"]').find(".et-pb-affects").trigger("change"),v(i.closest(o),!1)});var l=t.find(".et_pb_background-tab--gradient"),d=l.find(".et-pb-option-preview"),r=d.find(".et-pb-option-preview-button--add"),p=d.find(".et-pb-option-preview-button--swap"),b=d.find(".et-pb-option-preview-button--delete"),u=i?"use_background_color_gradient":n+"_use_color_gradient",g=l.find(".et_pb_background-option--"+u+" .et_pb_yes_no_button"),h=l.find(".et_pb_background-option--"+u+" select"),f=l.find(".et_pb_background-option--"+n+"_color_gradient_start .wp-color-picker"),m=ke(l,n);function v(t,i){t.find(".et_pb_background-tab").each(function(){var o=e(this),a=!1,s=o.attr("data-tab"),l=t.find('.et_pb_background-tab-nav[data-tab="'+s+'"]');switch(s){case"color":var d=o.find(".et_pb_background-option--use_background_color"),r=o.find(".et_pb_background-option--"+n+"_color");d.length&&r.length?a="on"===d.find("select option:selected").val()&&""!==r.find(".et-pb-color-picker-hex").val():!d.length&&r.length&&(a=""!==r.find(".et-pb-color-picker-hex").val());break;case"gradient":"on"===o.find(".et_pb_background-option--"+u+" select option:selected").val()&&(a=!0);break;case"image":var p=o.find(".et_pb_background-option--"+n+"_image .et-pb-upload-field").val()||o.find(".et_pb_background-option--background_url .et-pb-upload-field").val();_.isUndefined(p)||""===p||(a=!0);break;case"video":var c=o.find(".et_pb_background-option--"+n+"_video_mp4 .et-pb-upload-field").val(),b=o.find(".et_pb_background-option--"+n+"_video_webm .et-pb-upload-field").val();(!_.isUndefined(c)&&""!==c||!_.isUndefined(b)&&""!==b)&&(a=!0)}a?(l.addClass("et-pb-filled"),i&&(t.find(".et_pb_background-tab").removeAttr("style"),l.trigger("click"))):l.removeClass("et-pb-filled")})}m&&(d.css({backgroundImage:m}),d.removeClass("et-pb-option-preview--empty")),d.click(function(e){e.preventDefault(),e.stopPropagation(),d.hasClass("et-pb-option-preview--empty")?(g.removeClass("et_pb_off_state").addClass("et_pb_on_state"),h.val("on").trigger("change"),d.removeClass("et-pb-option-preview--empty")):f.wpColorPicker("open",!0)}),r.click(function(e){e.stopPropagation(),g.removeClass("et_pb_off_state").addClass("et_pb_on_state"),h.val("on").trigger("change"),d.removeClass("et-pb-option-preview--empty")}),b.click(function(e){e.stopPropagation(),g.removeClass("et_pb_on_state").addClass("et_pb_off_state"),h.val("off").trigger("change"),d.addClass("et-pb-option-preview--empty")}),p.click(function(t){t.preventDefault(),t.stopPropagation();var i=e(this).closest(o),a=i.find(".et_pb_background-option--"+n+"_color_gradient_start .et-pb-color-picker-hex"),s=i.find(".et_pb_background-option--"+n+"_color_gradient_end .et-pb-color-picker-hex"),l=a.val(),_=s.val();a.val(_).trigger("change"),s.val(l).trigger("change")}),l.on("change input keyup",'select, input[type="text"], input[type="range"]',function(){ye(e(this))}),v(t,!0);var w=t.find(".et-pb-option-container--background").attr("data-column-index"),y=void 0===w?"":"_"+w,k=["#et_pb_"+n+"_color"+y,"#et_pb_use_background_color","#et_pb_"+n+"_color_gradient_start"+y,"#et_pb_"+n+"_color_gradient_end"+y,"#et_pb_"+u+y,"#et_pb_"+n+"_color_gradient_type"+y,"#et_pb_"+n+"_color_gradient_direction"+y,"#et_pb_"+n+"_color_gradient_direction_radial"+y,"#et_pb_"+n+"_color_gradient_start_position"+y,"#et_pb_"+n+"_color_gradient_end_position"+y,void 0===w?"#et_pb_bg_img"+y:"#et_pb_background_image","#et_pb_background_url","#et_pb_"+a+"parallax"+y,"#et_pb_"+a+"parallax_method"+y,"#et_pb_"+n+"_size"+y,"#et_pb_"+n+"_position"+y,"#et_pb_"+n+"_repeat"+y,"#et_pb_"+n+"_blend"+y,".et-pb-range"];t.find(k.join(", ")).change(function(){c(t.find(".et_pb_background-tab--image .et-pb-upload-button"))}),setTimeout(function(){e("#et_pb_featured_placement").length&&e("#et_pb_featured_placement").change(function(){c(t.find(".et_pb_background-tab--image .et-pb-upload-button"))}),e("#et_pb_featured_image").length&&e("#et_pb_featured_image").change(function(){c(t.find(".et_pb_background-tab--image .et-pb-upload-button"))})},700)}),o.find("li a").click(function(){var t=e(this),i=t.closest("li").index(),n=t.closest("ul"),a=n.siblings(".et-pb-options-tabs"),s=n.find(".et-pb-options-tabs-links-active"),l=s.index(),_=a.find(".et-pb-options-tab").eq(l),d=a.find(".et-pb-options-tab").eq(i);return l!==i&&(d.css({display:"none",opacity:0}),_.css({display:"block",opacity:1}).stop(!0,!0).animate({opacity:0},300,function(){e(this).css("display","none"),d.css({display:"block",opacity:0}).stop(!0,!0).animate({opacity:1},300,function(){var t=e(this);t.find(".et-pb-option:visible").length||d.hasClass("et-pb-options-tab-view_stats")?e(".et-pb-all-options-hidden").remove():t.append('<p class="et-pb-all-options-hidden">'+et_pb_options.all_tab_options_hidden+"<p>"),o.trigger("et_pb_main_tab:changed")})}),s.removeClass("et-pb-options-tabs-links-active"),n.find("li").eq(i).addClass("et-pb-options-tabs-links-active"),e(".et-pb-options-tabs").animate({scrollTop:0},400,"swing")),!1}),n.each(function(){var t=e(this).find(".et-pb-options-toggle-enabled"),i="et-pb-option-toggle-content-open";t.find("h3").click(function(){var o=e(this),n=o.siblings(".et-pb-option-toggle-content"),a=o.closest(".et-pb-options-toggle-container"),l=t.filter("."+i),_=l.find(".et-pb-option-toggle-content");a.hasClass(i)||(l.removeClass(i).addClass("et-pb-option-toggle-content-closed"),_.slideToggle(300),a.removeClass("et-pb-option-toggle-content-closed").addClass(i),n.slideToggle(300,function(){le(s)}))})}),d.length&&(d.each(function(){xe(e(this))}),d.on("et_main_custom_margin:change",function(){xe(e(this))})),r.change(function(){var t=e(this),i=void 0!==t.data("device")?t.data("device"):"all",o=t.closest(".et_margin_padding"),n=o.closest(".et-pb-option-container").find(".et-pb-mobile-settings-toggle"),a="all"===i?o.find(".et_custom_margin_main"):o.find(".et_custom_margin_main.et_pb_setting_mobile_"+i),s="all"===i?".et_custom_margin":".et_custom_margin.et_pb_setting_mobile_"+i,l="",_=t.closest(".et-pb-option").data("option_name"),d={custom_padding:"padding",custom_margin:"margin"};o.find(s).each(function(){l+=e.trim(Se(e(this).val(),e(this).hasClass("auto_important"),void 0,d[_]))+"|"}),"|||"===(l=l.slice(0,-1))?l="":n.addClass("et-pb-mobile-icon-visible"),a.val(l).trigger("et_pb_setting:change"),de(a)}),b.click(function(){var t=e(this),i=t.closest(".et_builder_font_styles"),o=t.data("button_name");t.closest(".et-pb-option-container--font");return t.toggleClass("et_font_style_active"),_.forEach([["uppercase","capitalize"],["underline","line_through"]],function(e){-1!==_.indexOf(e,o)&&_.forEach(e,function(e){e!==o&&i.find(".et_builder_"+e+"_font").removeClass("et_font_style_active")})}),ue(t.closest(".et-pb-option-container--font")),je(t.closest(".et-pb-option--font")),!1}),u.change(function(){ue(e(this).closest(".et-pb-option-container--font"))}),p.on("click",".et-pb-settings-option-select li",function(t){var i=e(this),o=i.closest(".et-pb-option--font"),n=o.find(".et-pb-settings-option-select-advanced"),a=i.data("value");if(!_.isUndefined(a)){if(e(t.target).closest(".et-pb-user-font-marker").length>0)return void G("delete_font",a);ue(o,a),ge(n),"default"!==a&&$e(a),je(o,!1)}}),p.on("click",".et-pb-font-upload-button",function(t){G("upload_font",e(t.target).closest(".et-pb-option--font").data("option_name"))}),p.on("input",".et-pb-menu-filter",function(){var t=e(this).val(),i=e(this).closest(".et-pb-settings-option-select-advanced"),o=i.find(".select-option-item");""!==t?i.addClass("et_pb_menu_search_active"):i.removeClass("et_pb_menu_search_active"),o.removeClass("et_pb_hidden_item");var n=_.filter(o,function(i){return-1===e(i).text().toLowerCase().search(t.toLowerCase())});e(n).addClass("et_pb_hidden_item")}),p.each(function(){je(e(this),!1,!0)}),g.click(function(){var t=e(this),i=t.closest(".et-pb-select-font-outer"),o=i.find(".et-pb-settings-option-select-advanced"),n=o.find(".select-option-item"),a=i.find(".et-pb-menu-filter");o.addClass("et_pb_menu_active"),o.removeClass("et_pb_menu_search_active"),n.removeClass("et_pb_hidden_item"),a.val(""),o.animate({scrollTop:0},0);var s=t.offset(),l=e(window).height(),_=e(window).scrollTop(),d=500>l?l-50:500,r=s.top-_-20,p=l-r;p<d?r-=d-p+50:d=p-50,o.css({top:r,maxHeight:d}),e("body").addClass("et_pb_advanced_menu_opened")}),h.each(function(){var t=e(this),i=t.data("saved_value"),o=t.data("default"),n=""!==i?t.val():o,a=t.closest(".et-pb-option-container"),s=(a.find("select.et-pb-text-align-select"),""!==n&&a.find(".et_builder_"+n+"_text_align"));s&&s.addClass("et_text_align_active")}),h.change(function(){var t=e(this),i=t.closest(".et-pb-option-container").find(".et_builder_text_align.et_text_align_active"),o=!!i.length&&i.data("value"),n=t.attr("data-default")===o?"":o;o&&(t.data("saved_value",n),t.val(o).trigger("et_pb_setting:change"))}),f.click(function(){var t=e(this),i=t.closest(".et-pb-option-container"),o=t.hasClass("et_text_align_active"),n=i.find(".et-pb-text-align-select"),a=n.attr("data-default");return i.find(".et_builder_text_align").removeClass("et_text_align_active"),o?_.isUndefined(a)||""===a||i.find(".et_builder_"+a+"_text_align").addClass("et_text_align_active"):t.addClass("et_text_align_active"),n.trigger("change"),!1}),m.each(function(){be(e(this))}),m.on("change",function(){be(e(this))}),v.click(function(){var t=e(this),i=t.closest(".et-pb-option-container").find("input"),o=i.data("default"),n=i.val(),a=_.isUndefined(n)||""===n?[]:n.split("|"),s=t.data("value"),l=n,d="yes"===i.data("multi");return"yes"===i.data("toggleable")&&t.hasClass("et_builder_multiple_buttons_button_active")?l=d?_.without(a,s).join("|"):o:(d&&a.push(s),l=d?a.join("|"):s),i.val(l).trigger("change"),!1}),w.on("input change",function(){var t,i,o=e(this),n=void 0===o.data("device")?"all":o.data("device"),a=o.val(),s="all"===n?o.siblings(".et-pb-range-input"):o.siblings(".et-pb-range-input.et_pb_setting_mobile_"+n),l=s.data("initial_value_set")||!1,_=s.data("unit")||"no_default_unit",d=Se(e.trim(s.val()),!1,_);if(isNaN(parseFloat(d))&&!l)return o.val(0),void s.data("initial_value_set",!0);t=parseFloat(d),d+="",""!==(i=e.trim(d.replace(t,"")))&&(a+=i),s.val(a).trigger("et_pb_setting:change"),de(o,a)}),w.length&&w.each(function(){var t=e(this),i=void 0===t.data("device")?"all":t.data("device"),o=void 0!==t.data("default_inherited")?e.trim(t.data("default_inherited")):e.trim(t.data("default")),n="all"===i?t.siblings(".et-pb-range-input"):t.siblings(".et-pb-range-input.et_pb_setting_mobile_"+i),a=e.trim(n.val());if(""===a&&(""!==o&&(n.val(o),o=parseFloat(o)||0),t.val(o),a=o),"tablet"===i){var s=t.siblings(".et-pb-range-input.et_pb_setting_mobile_desktop").val();t.data("default",parseFloat(s)),n.data("default",s)}else if("phone"===i){var l=t.siblings(".et-pb-range-input.et_pb_setting_mobile_tablet").val();t.data("default",parseFloat(l)),n.data("default",l)}he(t,a,!0)}),y.on("keyup change",_.debounce(function(t){var i,o=e(this),n=void 0===o.data("device")?"all":o.data("device"),a=Se(fe(o,!0),!1,o.data("unit")||"no_default_unit"),s="all"===n?o.siblings(".et-pb-range"):o.siblings(".et-pb-range.et_pb_setting_mobile_"+n),l=!1;i=parseFloat(a)||0,_.isUndefined(t.type)||"keyup"!==t.type||(l=!0),he(s,i,l),o.val(a),s.val(i).trigger("et_pb_setting:change"),de(o)},700)),O.length&&O.each(function(){var t=e(this),i=Se(e.trim(t.val()));t.val(i)}),k.length&&(k.on("change et_pb_setting:change et_main_custom_margin:change",function(){var t=e(this),i=void 0===t.data("device")?"all":t.data("device"),o=t.closest(".et-pb-option-container"),n=o.find(".et-pb-reset-setting"),a=t.hasClass("et-pb-range"),s=t.hasClass("et-pb-font-select"),l=t.hasClass("et-presets")||t.hasClass("et_select_animation"),_=a&&"all"===i?t.siblings(".et-pb-range-input"):t;l&&(_=t.children("input"));var d=ve(_=a&&"all"!==i?t.siblings(".et-pb-range-input.et_pb_setting_mobile_"+i):_).toLowerCase(),r=""+_.val();r=r.toLowerCase();var p=o.find(".et-pb-mobile-settings-toggle");if(s){var c=r.split("|"),b=d.split("|");n.each(function(){var t=e(this),i=0;t.hasClass("et_pb_reset_weight")&&(i=1),""!==c[i]&&b[i]!==c[i]?t.addClass("et-pb-reset-icon-visible"):t.removeClass("et-pb-reset-icon-visible")})}else!_.hasClass("et_pb_setting_mobile")||_.hasClass("et_pb_setting_mobile_active")?we(_)?(n.removeClass("et-pb-reset-icon-visible"),p.hasClass("et-pb-mobile-settings-active")||p.removeClass("et-pb-mobile-icon-visible")):(setTimeout(function(){n.addClass("et-pb-reset-icon-visible")},50),p.addClass("et-pb-mobile-icon-visible")):(r!==d&&!a||a&&r!==d+"px"&&r!==d)&&p.addClass("et-pb-mobile-icon-visible")}),k.trigger("change"),t.find(".et-pb-main-settings .et_pb_options_tab_advanced a").append('<span class="et-pb-reset-settings"></span>'),t.find(".et-pb-reset-settings").on("click",function(){G("reset_advanced_settings",k)})),t.find(".et-pb-reset-setting").not(".et-pb-reset-skip").on("click",function(){Ce(e(this))});var ee=t.data("module_type"),te=e();if("section"===ee&&(ee="et_pb_section"),"row"===ee&&(ee="et_pb_row"),S(window.et_pb_module_field_dependencies,ee)){var ie=function e(i){var o=[],n=oe[i].affects,a=t.find("#et_pb_"+i),s=a.closest(".et-pb-option"),l=function(e){var t=[];return oe[e].show_if&&(t=_.keys(oe[e].show_if)),oe[e].show_if_not&&(t=_.union(t,_.keys(oe[e].show_if_not))),t}(i);_.forEach(l,function(e){var n=t.find("#et_pb_"+e).val(),a=oe[e].affects[i].show_if,s=oe[e].affects[i].show_if_not;o.push(function(e,t,i){var o=!1;return t&&i?(t=_.isArray(t)?_.includes(t,e):e===t,i=_.isArray(i)?!_.includes(i,e):e!==i,o=t&&i):t?o=_.isArray(t)?_.includes(t,e):e===t:i&&(o=_.isArray(i)?!_.includes(i,e):e!==i),o}(n,a,s))}),o=!_.includes(o,!1),s.toggle(o).addClass("et_pb_animate_affected");var d=o?"et-pb-option-field-shown":"et-pb-option-field-hidden";a.trigger(d),setTimeout(function(){s.removeClass("et_pb_animate_affected"),_e(a)},500),_.isUndefined(n)||_.forEach(n,function(t,i){e(i)})},oe=window.et_pb_module_field_dependencies[ee];_.forEach(oe,function(e,i){if(!_.isUndefined(e.affects)){var o=t.find("#et_pb_"+i);te=te.add(o),o.on("change",function(){_.forEach(e.affects,function(e,t){ie(t)})})}})}s.length&&s.change(function(){var i=e(this),o=i.closest(".et-pb-option"),n=i.val(),a=(parseInt(n),_.map(i.data("affects").split(", "),function(e){return-1!==e.indexOf("#et_pb_")?e:"#et_pb_"+e}).join(", ")),s=t.find(a),l=i.closest(".et-pb-options-tab").index(),d=[];s.each(function(){!function t(a,s){s=!0===s;var r=e(a),p=r.closest(".et-pb-option"),c=p.hasClass("et-pb-new-depends"),b="text"===i.attr("type"),u=p.data("depends_show_if")||"on",g=b?"":p.data("depends_show_if_not"),h=!s&&(u===n||void 0!==g&&!_.contains(g.split(","),n)),f=r.closest(".et-pb-options-tab").index(),m=p.find(".et-pb-affects"),v=i.closest(".et_pb_background-template--use_color_gradient").length;if(!(r.hasClass("et_pb_field_processed")||b&&!i.is(":visible")||c)){l!==f||!h||"none"!==o.css("display")||i.is('[type="hidden"]')||v||(h=!1),p.toggle(h).addClass("et_pb_animate_affected");var w=r.is(":visible")?"et-pb-option-field-shown":"et-pb-option-field-hidden";if(r.trigger(w),setTimeout(function(){p.removeClass("et_pb_animate_affected"),_e(r)},500),m.length){var y=_.map(m.data("affects").split(", "),function(e){return-1!==e.indexOf("#et_pb_")?e:"#et_pb_"+e}).join(", "),k=e(y);h?d.push(r):k.each(function(){t(this,!0),_e(e(this))}).removeClass("et_pb_field_processed")}r.addClass("et_pb_field_processed")}}(this)}).removeClass("et_pb_field_processed"),_.forEach(d,function(e){e.trigger("change")}),e(".et_options_list:not(.et_conditional_logic)").each(function(){var t=e(this);if(0===t.find(".et_options_rows").length){var i=t.find("textarea");t.find(".et_options_list_row").wrapAll('<div class="et_options_rows" />'),t.find(".et_options_rows").sortable({axis:"y",containment:"parent",update:function(){Z(t,i),setTimeout(function(){e(".et_options_rows").children().css({position:"",top:"",left:""})},700)}})}})}),setTimeout(function(){n.css({display:"block"}),(s=s.add(te)).data("is_rendering_setting_view",!0),le(s),s.data("is_rendering_setting_view",!1),n.css({display:"none"}),Re()},100),setTimeout(function(){e(".et-pb-option-toggle-content").length>0&&e(".et-pb-option-toggle-content").each(function(){""===e.trim(e(this).text())&&e(this).closest(".et-pb-options-toggle-container").addClass("et-pb-options-toggle-empty")})},100),l.length&&(l.on("et_pb_setting:change",function(){var t=e(this),i=t.parent(),o=(i.children(".et-pb-responsive-affects"),t.data("responsive-desktop-name")),n=t.data("responsive-affects").split(","),a={desktop:i.find("#"+o).val(),tablet:i.find("#"+o+"_tablet").val(),phone:i.find("#"+o+"_phone").val()},s=(t.closest(".et_pb_modal_settings_container_step2").length?i.find('input[id="data.'+o+'_last_edited"]'):i.find("#"+o+"_last_edited")).val(),l="string"==typeof s&&"on"===s.split("|")[0];_.forEach(n,function(t){var i=e("#et_pb_"+t).closest(".et-pb-option:not(.et_pb_background-option)"),o=_.isUndefined(i.data("depends_show_if_not"))?[]:i.data("depends_show_if_not").split(","),n=!0;n=l?!_.contains(o,a.desktop)||!_.contains(o,a.tablet)||!_.contains(o,a.phone):!_.contains(o,a.desktop),i.toggle(n),i.siblings().length<1&&i.closest(".et-pb-options-toggle-container").toggle(n)})}),setTimeout(function(){l.each(function(){e(this).trigger("et_pb_setting:change")})})),t.find(".et-pb-options-tabs-links").on("et_pb_main_tab:changed",function(){var t,o=e(".et-pb-options-tabs-links").find(".et_pb_options_tab_custom_css"),n=e(".et-pb-options-tab-custom_css").find(".et_pb_module_order_placeholder"),a=void 0;o.hasClass("et-pb-options-tabs-links-active")&&(a=void 0!==(t=j.findWhere({cid:i})).attributes.module_order?t.attributes.module_order:"",n.length&&n.replaceWith(a))}),P.length&&P.focusin(function(){var t=e(this).closest(".et-pb-option"),i=t.find("label > span"),o=t.siblings().find("label > span");i.length&&(i.removeClass("et_pb_hidden_css_selector"),i.css({display:"inline-block"}),i.addClass("et_pb_visible_css_selector")),o.length&&(o.removeClass("et_pb_visible_css_selector"),o.addClass("et_pb_hidden_css_selector"),setTimeout(function(){o.css({display:"none"}),o.removeClass("et_pb_hidden_css_selector")},200))}),t.on("click",".et_pb_global_sync_switcher",function(){var t=e(this);t.hasClass("et_pb_global_unsynced")?t.removeClass("et_pb_global_unsynced"):t.addClass("et_pb_global_unsynced")}),new a.Controls.BorderRadius(t),new a.Controls.BorderStyles(t),new a.Controls.TabbedControl(t.find("#et_pb_divider_settings").parent()),t.on("click",".et-pb-option-container .description a",function(e){var t=e.target.href;_.isUndefined(t)||(e.preventDefault(),window.open(t,"_blank").focus())})}function be(e){e.data("default");var t=e.val(),i=e.closest(".et-pb-option-container"),o=""===t?[]:t.split("|");i.find(".et_builder_multiple_buttons_button").removeClass("et_builder_multiple_buttons_button_active"),o.length>0&&(_.forEach(o,function(e){var t=i.find(".et_builder_"+e+"_button");t.length>0&&t.addClass("et_builder_multiple_buttons_button_active")}),e.trigger("et_pb_setting:change"))}function ue(t,i){var o=t.find("input.et-pb-font-select"),n=o.val().split("|"),a=t.find(".et_builder_font_weight").val(),s=t.find(".et_builder_font_styles"),l=t.find(".et-pb-font-line-color-value"),d=t.find(".et_pb_font_line_style_select"),r=s.find(".et_builder_italic_font"),p=s.find(".et_builder_uppercase_font"),c=s.find(".et_builder_underline_font"),b=s.find(".et_builder_capitalize_font"),u=s.find(".et_builder_line_through_font"),g=_.isUndefined(i)?n[0]:i,h="";h+="default"!==g?e.trim(g):"",h+="|","400"!==a&&(h+=a),h+="|",r.hasClass("et_font_style_active")&&(h+="on"),h+="|",p.hasClass("et_font_style_active")&&(h+="on"),h+="|",c.hasClass("et_font_style_active")&&(h+="on"),h+="|",b.hasClass("et_font_style_active")&&(h+="on"),h+="|",u.hasClass("et_font_style_active")&&(h+="on"),h+="|",""!==l.val()&&(h+=l.val()),h+="|","solid"!==d.val()&&(h+=d.val()),o.val(h).trigger("change")}function ge(t){t.closest(".et-pb-option--font").find(".et_pb_select_placeholder");t.removeClass("et_pb_menu_active"),e("body").removeClass("et_pb_advanced_menu_opened")}function he(e,t,i){var o=parseFloat(e.attr("max")),n=parseFloat(e.attr("min"));e.hasClass("et-pb-fixed-range")||((t=""!==t?parseFloat(t):0)>o&&(e.attr("max",t),e.val(t)),t<n&&(e.attr("min",t),e.val(t)),i&&"0.1"!==e.attr("step")&&t%1>0&&(e.attr("step","0.1"),e.val(t)))}function fe(e,t){var i,o=e.parent().find(".et-pb-range"),n=e.val(),a="string"==typeof n?n.trim():n,s=parseFloat(a),l=a.toString().replace(s,""),_=o.data("default");if(isNaN(s)&&(s=""),o.hasClass("et-pb-fixed-range")){var d=parseFloat(o.attr("max")),r=parseFloat(o.attr("min")),p=s<r;s>d?s=d:p&&(s=r)}return i=s.toString()+l||_,t&&i!==n&&e.val(i),i}function me(t){return e(t).hasClass("et-pb-color-picker-hex")?"default-color":"default"}function ve(e){var t=me(e),i=void 0;if(i=void 0!==e.data(t)?e.data(t):"",_.isArray(i)&&i.length>0){var o=e.closest(".et-pb-options-toggle-container").find("#et_pb_"+i[0]);i=(i[1]||{})[""+o.val()]}return i=""+i}function we(e){var t=ve(e).toLowerCase(),i=_.isUndefined(a.Helpers.getSettingValue(e))?"":a.Helpers.getSettingValue(e).toString().toLowerCase(),o=e.hasClass("et-pb-range");return void 0===i||""===String(i)||(!(!e.is("select")||""!==t||0!==e.prop("selectedIndex"))||!(!_.isNull(i)&&i!==t&&!o||o&&i!==t+"px"&&i!==t))}function ye(e){var t=e.closest(".et_pb_background-tab--gradient"),i=t.closest(".et-pb-option-container-inner").attr("data-base_name"),o=ke(t,i),n=t.find(".et-pb-option-preview");o?n.css({backgroundImage:o}):n.removeAttr("style")}function ke(e,t){var i="background"===(t=t||"background")?"use_background_color_gradient":t+"_use_color_gradient",o=e.find(".et_pb_background-option--"+i+" select"),n=e.find(".et_pb_background-option--"+t+"_color_gradient_start .et-pb-color-picker-hex"),a=e.find(".et_pb_background-option--"+t+"_color_gradient_end .et-pb-color-picker-hex"),s=e.find(".et_pb_background-option--"+t+"_color_gradient_type select"),l=e.find(".et_pb_background-option--"+t+"_color_gradient_direction .et-pb-range-input"),d=e.find(".et_pb_background-option--"+t+"_color_gradient_direction_radial select"),r=e.find(".et_pb_background-option--"+t+"_color_gradient_start_position .et-pb-range-input"),p=e.find(".et_pb_background-option--"+t+"_color_gradient_end_position .et-pb-range-input");if("on"!==o.val())return!1;var c={type:"linear",direction:"180deg",radialDirection:"center",colorStart:"#2b87da",colorEnd:"#29c4a9",startPosition:"0%",endPosition:"100%"};_.each({type:s.val(),direction:l.val(),radialDirection:d.val(),colorStart:n.val(),colorEnd:a.val(),startPosition:r.val(),endPosition:p.val()},function(e,t){""===e||_.isUndefined(e)||(c[t]=e)});var b="linear"===c.type?c.direction:"circle at "+c.radialDirection,u=Se(c.startPosition,void 0,"%"),g=Se(c.endPosition,void 0,"%");return c.type+"-gradient( "+b+", "+c.colorStart+" "+u+", "+c.colorEnd+" "+g+" )"}function Ce(e){var t=e,i=t.closest(".et-pb-option-container"),o=i.closest(".et-pb-option"),n=void 0!==t.data("device")&&o.hasClass("et_pb_has_mobile_settings")?t.data("device"):"all",a="all"===n?i.find(".et-pb-main-setting"):i.find(".et-pb-main-setting.et_pb_setting_mobile_"+n),s=ve(a);if(a.is(".et-pb-text-align-select"))return s?i.find(".et_builder_"+s+"_text_align").addClass("et_text_align_active").siblings().removeClass("et_text_align_active"):i.find(".et_text_align_active").removeClass("et_text_align_active"),a.val(s).trigger("change").trigger("et_pb_setting:change"),t.hasClass("et-pb-reset-setting")||(t=i.find(".et-pb-reset-setting")),void t.removeClass("et-pb-reset-icon-visible");if(a.is("select")&&""===s)a.prop("selectedIndex",0).trigger("change");else if(a.hasClass("et-pb-custom-color-picker"))!function(e){var t=e.closest(".et-pb-custom-color-container"),i=t.siblings(".et-pb-choose-custom-color-button"),o=t.find(".et-pb-custom-color-picker");i.removeClass("et_pb_hidden"),t.addClass("et_pb_hidden"),o.val("")}(t);else{if(a.hasClass("et-pb-color-picker-hex"))return a.wpColorPicker("color",s),""===s&&i.find(".wp-picker-clear").trigger("click"),t.hasClass("et-pb-reset-setting")||(t=i.find(".et-pb-reset-setting")),void t.removeClass("et-pb-reset-icon-visible");if(a.hasClass("et-pb-font-select"))je(i,t.hasClass("et_pb_reset_weight")?"weight":"font");else a.hasClass("et-pb-range")&&(s=ve(a="all"===n?t.siblings(".et-pb-range-input"):t.siblings(".et-pb-range-input.et_pb_setting_mobile_"+n))),a.val(s).trigger("et_pb_setting:change",["et_pb_reset_setting"]),a.data("has_saved_value","no"),a.hasClass("et_custom_margin_main")?a.trigger("et_main_custom_margin:change"):a.trigger("change"),a.hasClass("et_select_animation")&&(a.find(".et_animation_button > a.et_active_animation").removeClass("et_active_animation"),a.find(".et_animation_button:first > a").addClass("et_active_animation")),a.hasClass("et-presets")&&a.find(".et-preset").removeClass("et-preset-active").first().addClass("et-preset-active")}}function Se(t,i,o,n){var a="!important".length,s=!1,l=(t=void 0===t?"":t).length,d=(i=!_.isUndefined(i)&&i,void 0);if(""===t)return"";if("!important"===t.substr(0-a,a)&&(s=!0,l-=a,t=t.substr(0,l).trim()),!_.isUndefined(n)&&function(e,t){var i=et_pb_options.acceptable_css_string_values;return!_.isUndefined(i[e])&&_.contains(i[e],t)}(n,t))return r=t,s&&!i&&(r+=" !important"),r;if(-1!==e.inArray(t.substr(-3,3),["deg","rem"])){var r=parseFloat(t)+t.substr(-3,3);return s&&!i&&(r+=" !important"),r}if(-1!==e.inArray(t.substr(-2,2),["em","px","cm","mm","in","pt","pc","ex","vh","vw","ms"])){r=parseFloat(t)+t.substr(-2,2);return s&&!i&&(r+=" !important"),r}return-1!==e.inArray(t.substr(-1,1),["%","x"])?(r=parseFloat(t)+t.substr(-1,1),s&&!i&&(r+=" !important"),r):isNaN(parseFloat(t))?t:(d=parseFloat(t),(_.isUndefined(o)||"no_default_unit"!==o)&&(d+=o||"px"),d)}function xe(t){var i=t,o=void 0!==i.data("device")?i.data("device"):"all",n=i.val(),a=i.closest(".et_margin_padding"),s=a.closest(".et-pb-option-container").find(".et-pb-mobile-settings-toggle"),l="all"===o?a.find(".et_custom_margin"):a.find(".et_custom_margin.et_pb_setting_mobile_"+o),_=!1,d=void 0;de(t),""!==n?(d=n.split("|"),l.length>d.length&&(d.splice(1,0,""),d.push("")),l.each(function(){var t=e(this),i=l.index(t),o=t.hasClass("auto_important"),n=t.closest(".et-pb-option").data("option_name"),a=Se(d[i],o,void 0,{custom_padding:"padding",custom_margin:"margin"}[n]);t.val(a).trigger("et_pb_setting:change"),""!==a&&(_=!0)}),_&&s.addClass("et-pb-mobile-icon-visible")):l.each(function(){e(this).val("")})}function je(t,i,o){var n=t.closest(".et-pb-options-tab"),a=t.find(".et-pb-select-font-outer"),s=t.find("input.et-pb-font-select"),l=t.find(".et-pb-settings-option-select-advanced"),d=t.find(".et_builder_font_styles"),r=t.find(".et_pb_select_placeholder"),p=t.find(".et_builder_font_weight"),c=t.find(".et_pb_font_line_color"),b=t.find(".et_pb_font_line_style_select"),u=t.find(".et_pb_font_style_container"),g=d.find(".et_builder_italic_font"),h=d.find(".et_builder_uppercase_font"),f=d.find(".et_builder_underline_font"),m=d.find(".et_builder_capitalize_font"),v=d.find(".et_builder_line_through_font"),w="et_font_style_active",y=e.trim(s.val()),k=_.isUndefined(s.data("default"))?"||||||||":s.data("default"),C=void 0!==s.data("old-option-ref")&&""!==s.data("old-option-ref")?s.data("old-option-ref"):"",S=""!==C?n.find(".et-pb-option-"+C):"",x=""!==S&&S.length?S.find("input"):"",j="default",$=function(e){var t=wpCookies.get("et-pb-recent-items-font_family");if(t=_.isUndefined(t)||_.isNull(t)?[]:t.split("|"),_.isEmpty(t))return[];var i=[];return _.each(t,function(t){e.find(".select-option-item-"+t.replace(/ /g,"_")).length>0&&i.push(t)}),i}(l),V="400",T=!1,U=!1,O=void 0;if(i){var A=k.split("|");O=""===y.replace(/\|/g,"")?A:y.split("|"),"weight"===i?O[1]=A[1]:O[0]=A[0],y=O.join("|")}if(o){var M=t.find(".et_pb_font_weight_container"),L=u.find("label"),E=M.find("label"),D=a.data("group_label");""===y.replace(/\|/g,"")&&(y=k),L.html(D+" "+L.html()),E.html(D+" "+E.html());var I=t.find(".et-pb-reset-setting"),P=I.clone();a.append(I.addClass("et_pb_reset_font")),M.append(P.addClass("et_pb_reset_weight"))}if(""!==y?(j=""!==(O=y.split("|"))[0]?O[0]:"default",r.html(_.escape(j)),""!==O[1]&&(V="on"===O[1]?"700":O[1]),"on"===O[2]?g.addClass(w):g.removeClass(w),"on"===O[3]?h.addClass(w):h.removeClass(w),"on"===O[4]?(f.addClass(w),T=!0):f.removeClass(w),_.isUndefined(O[5])||"on"!==O[5]?m.removeClass(w):m.addClass(w),_.isUndefined(O[6])||"on"!==O[6]?v.removeClass(w):(v.addClass(w),U=!0),_.isUndefined(O[7])||""===O[7]||(c.find(".et-pb-custom-color-container").removeClass("et_pb_hidden"),c.find(".et-pb-custom-color-button").addClass("et_pb_hidden"),c.find(".et-pb-color-picker-hex-alpha").wpColorPicker("color",O[7])),_.isUndefined(O[8])||""===O[8]||b.val(O[8])):(r.html(_.escape(j)),g.removeClass(w),h.removeClass(w),f.removeClass(w),m.removeClass(w),v.removeClass(w)),T||U){var R=a.data("group_label");t.find(".et_pb_font_line_settings .et_pb_font_line_color > label").each(function(){var t=e(this),i=T?t.data("underline_label"):t.data("strikethrough_label");t.html(R+" "+i)}),t.find(".et_pb_font_line_settings").removeClass("et_pb_hidden"),t.find(".et-pb-option-container").addClass("et_pb_fonts_long")}else t.find(".et_pb_font_line_settings").addClass("et_pb_hidden"),t.find(".et-pb-option-container").removeClass("et_pb_fonts_long");var N=function(e){var t=et_pb_options.google_fonts,i=et_pb_options.user_fonts,o=!_.isUndefined(i[e])&&i[e],n=_.keys(et_pb_options.supported_font_weights);if("default"===e.toLowerCase())return["300","400","600","700","800"];o||(o=!_.isUndefined(t[e])&&t[e]);if(!o||_.isUndefined(o.styles))return n;return _.intersection(_.union(["400","700"],o.styles.split(",")),n)}(j);p.find("option").removeClass("et_pb_unsupported_option"),p.find("option").each(function(){var t=e(this);-1===_.indexOf(N,t.val())&&(t.addClass("et_pb_unsupported_option"),V===t.val()&&(V="400"))}),p.find('option[value="'+V+'"]').prop("selected",!0);var H=l.find(".select-option-item-"+j.replace(/ /g,"_"));l.find(".et_pb_selected_menu_item").removeClass("et_pb_selected_menu_item"),H.addClass("et_pb_selected_menu_item"),l.find(".et_pb_selected_item_container").html(_.escape(H.text())),_.isEmpty($)?l.find(".et-pb-recent-fonts").addClass("et_pb_hidden_subgroup"):(l.find(".et-pb-recent-fonts").removeClass("et_pb_hidden_subgroup"),l.find(".et-pb-recent-fonts ul").html(""),_.each($,function(e){var t='<li class="select-option-item select-option-item-recent-font select-option-item-'+e.replace(/ /g,"_")+'" data-value="'+e+'">'+e+"</li>";l.find(".et-pb-recent-fonts ul").append(t)})),x.length&&""!==x.val()&&("on"!==O[3]&&"on"===x.val()&&(h.addClass(w),O[3]="on",s.val(O.join("|")).trigger("change")),x.val("")),i&&s.val(O.join("|")).trigger("et_pb_setting:change")}function $e(e,t){if("default"!==e){var i=wpCookies.get("et-pb-recent-items-font_family");if(i=_.isUndefined(i)||_.isNull(i)?[]:i.split("|"),"remove"===t){if(-1===_.indexOf(i,e))return;delete i[e]}else{if(-1!==_.indexOf(i,e))return;i.length>=3&&(i=i.slice(0,2)),i=_.union([e],i)}var o="https:"===window.location.protocol;wpCookies.set("et-pb-recent-items-font_family",i.join("|"),31536e6,et_pb_options.cookie_path,!1,o)}}function Ve(t){t.$(".et-pb-color-picker-hex:visible").each(function(){e(this).closest(".wp-picker-container").find(".wp-color-result").trigger("click")})}function Te(){et_pb_options.debug&&window.console&&(2===arguments.length?console.log(arguments[0],arguments[1]):console.log(arguments[0]))}function Ue(t,i){V.saveAsShortcode(),setTimeout(function(){var o=e("#et_pb_layout"),n=o.innerHeight();o.css({height:n});var a=ee("content",!0);if(V.removeAllSections(),V.$el.find(".et_pb_section").remove(),V.createLayoutFromContent(Oe(a),"","",{is_reinit:"reinit",migrate_global_modules:i}),o.css({height:"auto"}),J.update(),t){var s=_.filter(j.models,function(e){return"module"!==e.attributes.type&&void 0!==e.attributes.et_pb_global_module&&""!==e.attributes.et_pb_global_module});0!==s.length&&_.each(s,function(e){Ie(e.attributes.cid)})}},600)}function Oe(e){if(-1!==e.indexOf("[et_pb_")||"1"===et_pb_options.is_divi_library&&"module"===et_pb_options.layout_type)if(-1===e.indexOf("et_pb_row")&&-1===e.indexOf("et_pb_section")){var t=-1===e.indexOf("et_pb_fullwidth")?"regular":"fullwidth";-1===e.indexOf("et_pb_fullwidth_module_placeholder")&&-1===e.indexOf("et_pb_module_placeholder")||(e=""),e="regular"===t?'[et_pb_section template_type="module" skip_module="true"][et_pb_row template_type="module" skip_module="true"][et_pb_column type="4_4"]'+e+"[/et_pb_column][/et_pb_row][/et_pb_section]":'[et_pb_section fullwidth="on" template_type="module" skip_module="true"]'+e+"[/et_pb_section]"}else-1===e.indexOf("et_pb_section")&&(e='[et_pb_section template_type="row" skip_module="true"]'+e+"[/et_pb_section]");return e}function Ae(t,i,o,n,s,l,_,d){if(void 0!==H[o+"_"+(i=""===i?"not_global":i)+"_"+s+"_"+l]){var r=new a.SavedTemplates(H[o+"_"+i+"_"+s+"_"+l]),p=new a.TemplatesView({collection:r,category:_});n.append(p.render().el),"include_global"===t&&"not_global"===i?Ae("include_global","global",o,n,s,l,_):(m.trigger("et-pb-loading:ended"),n.prepend(Me(_)),e("#et_pb_select_category").data("attr",{include_global:t,is_global:"",layout_type:o,append_to:n,module_width:s,specialty_cols:l}))}else e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_get_saved_templates",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_is_global:i,et_post_type:et_pb_options.post_type,et_layout_type:o,et_module_width:s,et_specialty_columns:l},beforeSend:function(){m.trigger("et-pb-loading:started")},complete:function(){("include_global"!==t||"include_global"===t&&"global"===i)&&(m.trigger("et-pb-loading:ended"),n.prepend(Me(_)),e("#et_pb_select_category").data("attr",{include_global:t,is_global:"",layout_type:o,append_to:n,module_width:s,specialty_cols:l}))},success:function(e){var r="";if(void 0!==e.error)("include_global"===t&&"global"===i&&"success"!==d||"include_global"!==t)&&(n.append("<ul><li>"+e.error+"</li></ul>"),r="fail");else{var p=new a.SavedTemplates(e),c=new a.TemplatesView({collection:p});H[o+"_"+i+"_"+s+"_"+l]=e,n.append(c.render().el),r="success"}"include_global"===t&&"not_global"===i&&Ae("include_global","global",o,n,s,l,_,r)}})}function Me(t){var i=e.parseJSON(et_pb_options.layout_categories),o='<select id="et_pb_select_category">',n="all"===t||""===t?" selected":"";return o+='<option value="all"'+n+">"+et_pb_options.all_cat_text+"</option>",e.isEmptyObject(i)||e.each(i,function(i,a){e.isEmptyObject(a)||(n=t===a.slug?" selected":"",o+='<option value="'+a.slug+'"'+n+">"+a.name+"</option>")}),o+="</select>"}function Le(t,i,o,n,a){void 0===H[t+"_layouts"]||a?e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_show_all_layouts",et_layouts_built_for_post_type:n,et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_load_layouts_type:t},beforeSend:function(){a||m.trigger("et-pb-loading:started")},complete:function(){a||m.trigger("et-pb-loading:ended")},success:function(e){a||o.find(".et-pb-main-settings."+i).append(e),H[t+"_layouts"]=e}}):o.find(".et-pb-main-settings."+i).append(H[t+"_layouts"])}function Ee(t,i,o){if(!t.hasClass("et-pb-options-tabs-links-active")){var n=void 0!==t.closest(".et-pb-options-tabs-links").data("specialty_columns")?t.closest(".et-pb-options-tabs-links").data("specialty_columns"):0;e(".et-pb-options-tabs-links li").removeClass("et-pb-options-tabs-links-active"),t.addClass("et-pb-options-tabs-links-active"),e(".et-pb-main-settings.active-container").css({display:"block",opacity:1}).stop(!0,!0).animate({opacity:0},300,function(){e(this).css("display","none"),e(this).removeClass("active-container"),e("."+t.data("open_tab")).addClass("active-container").css({display:"block",opacity:0}).stop(!0,!0).animate({opacity:1},300)}),void 0!==t.data("content_loaded")||t.hasClass("et-pb-new-module")||"layout"===i||(Ae("include_global","",i,e("."+t.data("open_tab")),o,n,"all"),t.data("content_loaded","true"))}}function De(t,i){var o=et_pb_options.template_post_id;e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_add_template_meta",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_meta_value:i,et_custom_field:t,et_post_id:o}})}function Ie(t){var i=y.getView(t),o=i.model.get("et_pb_global_module"),n=i.model.get("type"),a="row_inner"===n?"row":n,s=V.generateCompleteShortcode(t,a,"ignore_global",!1,!0),l=_.isEmpty(g[o])?[]:g[o];void 0!==o&&""!==o&&("row_inner"===n&&(s=(s=s.replace(/et_pb_row_inner/g,"et_pb_row")).replace(/et_pb_column_inner/g,"et_pb_column")),e.ajax({type:"POST",url:et_pb_options.ajaxurl,data:{action:"et_pb_update_layout",et_admin_load_nonce:et_pb_options.et_admin_load_nonce,et_layout_content:s,et_template_post_id:o,et_layout_type:n,et_unsynced_options:JSON.stringify(l)}}))}function Pe(e){for(var t=e,i="";!_.isUndefined(t.model.get("parent"))&&""===i;)t=y.getView(t.model.get("parent")),i=""!==i||_.isUndefined(t.model.get("et_pb_global_module"))?i:t.model.get("cid");return i}function Re(){var t=e(".et_pb_modal_settings_container");t.find(".et-pb-options-tabs .et-pb-options-tab:first-child").css({display:"block",opacity:1}),e(".et_pb_modal_settings_container").hasClass("et_pb_hide_general_tab")?(t.find(".et-pb-options-tabs-links li").removeClass("et-pb-options-tabs-links-active"),t.find(".et-pb-options-tabs .et-pb-options-tab").css({display:"none",opacity:0}),t.hasClass("et_pb_hide_advanced_tab")?(t.find(".et-pb-options-tabs-links li.et_pb_options_tab_custom_css").addClass("et-pb-options-tabs-links-active"),t.find(".et-pb-options-tabs .et-pb-options-tab.et-pb-options-tab-custom_css").css({display:"block",opacity:1})):(t.find(".et-pb-options-tabs-links li.et_pb_options_tab_advanced").addClass("et-pb-options-tabs-links-active"),t.find(".et-pb-options-tabs .et-pb-options-tab.et-pb-options-tab-advanced").css({display:"block",opacity:1}))):t.find(".et-pb-options-tabs .et-pb-options-tab.et-pb-options-tab-general").css({display:"block",opacity:1}),function(t){t.find(".et-pb-options-tab:visible").each(function(){var t=e(this);t.find(".et-pb-option:visible").length||t.append('<p class="et-pb-all-options-hidden">'+et_pb_options.all_tab_options_hidden+"<p>")})}(t)}function Ne(){return e.ajax({type:"POST",url:et_pb_options.ajaxurl,dataType:"json",data:{action:"et_pb_current_user_can_lock",et_admin_load_nonce:et_pb_options.et_admin_load_nonce},beforeSend:function(){m.trigger("et-pb-loading:started")},complete:function(){m.trigger("et-pb-loading:ended")}})}function He(){try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}}function Be(){return"object"===("undefined"==typeof YoastSEO?"undefined":n(YoastSEO))&&YoastSEO.hasOwnProperty("app")}function ze(){return 0<e(".et_pb_modal_overlay, .et-core-modal-overlay.et-core-active").length}function Fe(e){var t=!y.is_global_children(e),i=!!et_pb_options.et_builder_edit_global_library;return t||i}function We(e){if(_.isEmpty(e)||ze())return!1;var t={model:e.model,view:e.$el,view_event:event};return new a.RightClickOptionsView(t,!0)}function Je(t,i){if(0!==t.length){var o=t.find(".et-pb-option");if(t.find(".et-pb-option-advanced-module-settings").length>0){var n=Ke("et_pb_content_field",i)?" et_pb_global_unsynced":"";t.find(".et-pb-option-advanced-module-settings").append('<span class="et_pb_global_sync_switcher'+n+'" data-option_name="et_pb_content_field" data-additional_options="none"></span>')}0!==o.length&&_.each(o,function(t){var o=_.includes(["content","raw_content"],e(t).data("option_name"))?"et_pb_content_field":e(t).data("option_name"),n=Ke(o,i)?" et_pb_global_unsynced":"",a=0!==e(t).find(".et_pb_mobile_settings_tabs").length?"mobile":"none";e(t).append('<span class="et_pb_global_sync_switcher'+n+'" data-option_name="'+o+'" data-additional_options="'+a+'"></span>')})}}function Ke(e,t){return"legacy"===(_.isUndefined(g[t])?"legacy":"updated")?-1===h[t].indexOf(e):-1!==g[t].indexOf(e)}function Ge(e){var t=e.closest(".et-pb-option-container--background"),i=e.closest(".et_pb_background-option").attr("data-option_name"),o=e.closest(".et_pb_module_settings").attr("data-module_type"),n=t.closest(".et-pb-options-tabs").find("#et_pb_featured_placement").val();return _.contains(et_pb_options.et_builder_modules_featured_image_background,o)&&"background_image"===i&&"background"===n}function qe(e){return e=(e=(e=(e=e.replace(/<p>\[/g,"[")).replace(/\]<\/p>/g,"]")).replace(/\]<br \/>/g,"]")).replace(/<br \/>\n\[/g,"[")}U.remove(),M.hasClass("et_pb_builder_is_used")&&(L.show(),Q()),A.click(function(t){t.preventDefault();var i=e(this),o=i.hasClass("et_pb_builder_is_used"),n=e("#et_pb_fb_cta"),a=void 0;if(o)G("deactivate_builder");else{a=ee("content"),E.val(a);var s=getUserSetting("editor");"html"!==s&&(e("#content-html").click(),setUserSetting("editor",s)),V.reInitialize(),I.val("on"),L.show(),i.text(i.data("editor")),P.toggleClass("et_pb_post_body_hidden"),i.toggleClass("et_pb_builder_is_used"),m.trigger("et-activate-builder"),Q(),n.addClass("et_pb_ready"),e("form#post").append('<input type="hidden" name="et_pb_show_page_creation" value="on" />')}}),e("#et_pb_fb_cta").click(function(t){t.preventDefault(),e("html").fadeOut(),e("form#post").append('<input type="hidden" name="et-fb-builder-redirect" value="'+e(this).attr("href")+'" />'),A.hasClass("et_pb_builder_is_used")||(E.val(ee("content")),V.reInitialize(),I.val("on")),e(window).off("beforeunload").delay(500).queue(function(){var t=e("#save-action #save-post");0===t.length&&(t=e("#publishing-action #publish")),t.trigger("click")})}).contextmenu(function(){e.ajax({type:"POST",url:e("#post").attr("action"),data:e("#post").serializeArray()})}),function(){var t,i,o,a,s,l=e("#et_pb_last_post_modified"),d=l.val(),r=e("#post_ID").val(),p=void 0!==window.autosaveL10n&&window.autosaveL10n.blog_id,c=!1,b=void 0,u=void 0,g=void 0,h=void 0,f=void 0,v=!0,w=!1,y="https:"===window.location.protocol,k=wpCookies.get("wp-saving-post"),C=void 0,S=!1;!function(){var e=Math.random().toString(),t=!1;try{window.sessionStorage.setItem("wp-test",e),t=window.sessionStorage.getItem("wp-test")===e,window.sessionStorage.removeItem("wp-test")}catch(e){}C=t}();var x=function(e,t){var i=function(e){var t=!1;return e=e||"wp",C&&p&&(t=(t=sessionStorage.getItem(e+"-autosave-"+p))?JSON.parse(t):{}),t}(t);if(!i||!r)return!1;if(e)i["post_"+r]=e;else{if(!i.hasOwnProperty("post_"+r))return!1;delete i["post_"+r]}return function(e,t){var i=void 0;return t=t||"wp",!(!C||!p)&&(i=t+"-autosave-"+p,sessionStorage.setItem(i,JSON.stringify(e)),null!==sessionStorage.getItem(i))}(i,t)};function j(){wpCookies.get("et-saved-post-"+r+"-fb")&&(x(!1,"wp"),wpCookies.get("et-editing-post-"+r+"-fb")||wpCookies.remove("et-saved-post-"+r+"-fb",et_pb_options.cookie_path,!1,y))}k===r+"-saved"&&(wpCookies.set("et-saved-post-"+r+"-bb","bb",300,et_pb_options.cookie_path,!1,y),wpCookies.set("et-recommend-sync-post-"+r+"-bb","bb",30,et_pb_options.cookie_path,!1,y)),wpCookies.set("et-editor-available-post-"+r+"-bb","bb",1800,et_pb_options.cookie_path,!1,y),j(),t=function(){return"on"===e("#et_pb_use_builder").val()},s=function(e){e?(wpCookies.remove("et-saved-post-"+r+"-bb",et_pb_options.cookie_path,!1,y),wpCookies.set("et-saving-post-"+r+"-bb","bb",300,et_pb_options.cookie_path,!1,y)):(wpCookies.remove("et-saving-post-"+r+"-bb",et_pb_options.cookie_path,!1,y),wpCookies.set("et-saved-post-"+r+"-bb","bb",300,et_pb_options.cookie_path,!1,y))};var $=_.isUndefined(wp.autosave)?"":wp.autosave.getCompareString(),T=void 0;i=function(){if(t()&&(v=!1,wpCookies.get("et-editing-post-"+r+"-bb"))){if(!function(){if(_.isUndefined(wp.heartbeat)||_.isUndefined(wp.autosave))return!1;var e=wp.autosave.getPostData("local"),t=wp.autosave.getCompareString(e);return void 0===T&&(T=$),t!==T&&(T=t,!0)}())return!1;setTimeout(function(){S||(w=!0,s(!0),_.isUndefined(wp.heartbeat)||_.isUndefined(wp.autosave)||wp.autosave.server.triggerSave())},0)}},o=function(){if(!t())return!1;var i=e("#post_ID").val(),o="https:"===window.location.protocol;if(v=!0,!wpCookies.get("et-editing-post-"+i+"-fb"))return!1;if(_.isUndefined(wp.heartbeat)||_.isUndefined(wp.autosave))return!1;var n=0;if(!function e(){var t=wpCookies.get("et-syncing-post-"+i+"-fb"),o=wpCookies.get("et-syncing-post-"+i+"-bb");return n>=5||!t&&!o?(m.trigger("et-pb-loading:ended"),!1):(m.trigger("et-pb-loading:started"),n++,setTimeout(e,1e3),!0)}()){wpCookies.set("et-syncing-post-"+i+"-bb","bb",30,et_pb_options.cookie_path,!1,o),Te("external editor was in use!"),Te("trigger preloader"),m.trigger("et-pb-loading:started"),wp.autosave.server.tempBlockSave();var a=0;!function e(){var t=!1;if(wpCookies.get("et-saved-post-"+i+"-fb")&&(t=!0),a>30&&(t=!0),a++,!_.isUndefined(wp.heartbeat)&&!_.isUndefined(wp.autosave)){if(wp.autosave.server.tempBlockSave(),m.trigger("et-pb-loading:started"),t)return Te("calling wp.heartbeat.connectNow()"),c=!0,j(),setTimeout(function(){wp.heartbeat.connectNow()},500),wpCookies.remove("et-saving-post-"+i+"-fb",et_pb_options.cookie_path,!1,o),wpCookies.remove("et-saved-post-"+i+"-fb",et_pb_options.cookie_path,!1,o),wpCookies.remove("et-syncing-post-"+i+"-bb",et_pb_options.cookie_path,!1,o),wpCookies.remove("et-editing-post-"+i+"-fb",et_pb_options.cookie_path,!1,o),!0;setTimeout(e,500)}}()}},a=function(){v&&!document.hasFocus()?i():!v&&document.hasFocus()&&o()},void 0!==document.hidden?(u="hidden",h="visibilitychange",g="visibilityState"):void 0!==document.msHidden?(u="msHidden",h="msvisibilitychange",g="msVisibilityState"):void 0!==document.webkitHidden&&(u="webkitHidden",h="webkitvisibilitychange",g="webkitVisibilityState"),window.addEventListener("beforeunload",function(e){S=!0,wpCookies.remove("et-editing-post-"+r+"-bb",et_pb_options.cookie_path,!1,y),wpCookies.remove("et-syncing-post-"+r+"-bb",et_pb_options.cookie_path,!1,y),wpCookies.remove("et-saving-post-"+r+"-bb",et_pb_options.cookie_path,!1,y),wpCookies.remove("et-editor-available-post-"+r+"-bb",et_pb_options.cookie_path,!1,y)}),u&&e(document).on(h+".fb-heartbeat",function(e){t()&&("hidden"===document[g]?(i(),window.clearInterval(f)):(o(),document.hasFocus&&(f=window.setInterval(a,1e3))))}),document.hasFocus&&(f=window.setInterval(a,1e3)),o(),setInterval(function(){var e=wpCookies.get("et-recommend-sync-post-"+r+"-fb"),t=wpCookies.get("et-saved-post-"+r+"-fb");e&&t&&(_.isUndefined(wp.heartbeat)||wp.heartbeat.connectNow(),wpCookies.remove("et-recommend-sync-post-"+r+"-fb",et_pb_options.cookie_path,!1,y))},3e3),e(document).on("heartbeat-send.bb-heartbeat",function(i,o){t()&&(o.et={last_post_modified:d,built_by:"bb",post_id:r,force_check:c,force_autosave:!c&&w},c=!1,w&&void 0===o.wp_autosave&&(o.wp_autosave=wp.autosave.getPostData(),o.wp_autosave.content=ee("content"),o.wp_autosave._wpnonce=e("#_wpnonce").val()||""),"object"===n(o.wp_autosave)&&(o.wp_autosave.builder_settings=_.mapObject(_.indexBy(e(".et_pb_page_settings input.et_pb_value_updated").serializeArray(),"name"),function(e,t){return e.value}),o.wp_autosave.et_fb_autosave_nonce=et_pb_options.et_fb_autosave_nonce,e(".et_pb_page_settings input.et_pb_value_updated").removeClass("et_pb_value_updated")),w&&void 0!==o.wp_autosave&&(w=!1))}),e(document).on("heartbeat-tick.bb-heartbeat",function(i,o){if(t()){if(!_.isEmpty(o.et)&&!_.isEmpty(o.et.builder_settings_autosave)){var n=e(".et_pb_modal_overlay.et_pb_builder_settings").length;_.each(o.et.builder_settings_autosave,function(t,i){if(e("#_"+i).val(t),"et_pb_section_background_color"===i&&(et_pb_options.page_section_bg_color=t),"et_pb_page_gutter_width"===i&&(et_pb_options.page_gutter_width=t),"et_pb_color_palette"===i&&(et_pb_options.page_color_palette=t),n){var o=e('.et_pb_modal_overlay.et_pb_builder_settings div[data-id="'+i+'"]');switch(o.attr("data-type")){case"range":o.find(".range, .et-pb-range-input").val(t);break;case"color-alpha":o.find(".input-colorpicker").wpColorPicker("color",t);break;case"textarea":o.find("textarea").val(t);break;case"colorpalette":var a=t.split("|");o.find(".input-colorpalette-colorpicker").each(function(t,i){if(!_.isUndefined(a[t])){var n=a[t];e(i).val(n).wpColorPicker("color",n),o.find(".colorpalette-item-"+(t+1)).css({backgroundColor:n})}});break;case"yes_no_button":o.find(".et_pb_yes_no_button_wrapper");var s=o.find(".et_pb_yes_no_button");o.find("select").find('option[value="'+t+'"]').prop("selected",!0),"on"===t?s.removeClass("et_pb_off_state").addClass("et_pb_on_state"):s.removeClass("et_pb_on_state").addClass("et_pb_off_state");break;default:o.find("input").val(t)}}})}if(o.wp_autosave&&s(!1),void 0===o.et)return!1;if(void 0!==o.et.post_modified&&(d=o.et.post_modified),void 0!==o.et.post_content){Te("ext changes occured"),b=o.et.post_content;var a=e(".et_pb_modal_settings_container");a.length&&"module_settings"===a.attr("data-open_view")&&a.find(".et-pb-modal-close").trigger("click"),U()}else m.trigger("et-pb-loading:ended")}});var U=function(){if(l.val(d),t()&&""!=b){m.trigger("et-pb-loading:started");var i=b;ae("content",i,"updating_to_latest_fb_content"),setTimeout(function(){var t=e("#et_pb_layout"),o=t.innerHeight();t.css({height:o}),V.removeAllSections(),V.$el.find(".et_pb_section").remove(),V.enable_history=!1,V.createLayoutFromContent(Oe(i),"","",{is_reinit:"reinit"}),J.is_active_based_on_models()?(J.toggle_status(!0),Ue()):J.toggle_status(!1),t.css({height:"auto"}),m.trigger("et-pb-loading:ended"),setTimeout(function(){wpCookies.remove("et-editing-post-"+r+"-bb",et_pb_options.cookie_path,!1,y)},500)},500)}}}(),e(document).on("tinymce-editor-init.autosave",function(t,i){"content"===i.id&&e(document).off("tinymce-editor-init.autosave")});var Ye={key:"et_pb_clipboard_",set:function(e,t){He()?(localStorage.setItem(this.key+"type",LZString.compressToUTF16(e)),localStorage.setItem(this.key+"content",LZString.compressToUTF16(t))):alert(et_pb_options.localstorage_unavailability_alert)},get:function(e){if(He()){var t=LZString.decompressFromUTF16(localStorage.getItem(this.key+"type")),i=LZString.decompressFromUTF16(localStorage.getItem(this.key+"content"));return(void 0===e||e===t)&&i}alert(et_pb_options.localstorage_unavailability_alert)}},Ze=_.debounce(Ue,2e3);if(e(window).keydown(function(i){if("on"===e("#et_pb_use_builder").val()){if(ze()||e(".et_pb_prompt_modal").is(":visible")){var o=e(".et-pb-modal-save"),n=e(".et_pb_prompt_proceed"),s=e("#et_pb_main_container a, #et_pb_toggle_builder");switch(i.which){case 13:if(e(".et-pb-option-container textarea, #et_pb_address, #et_pb_pin_address, .et-pb-color-picker-hex-has-preview").is(":focus"))return void e(".et-pb-color-picker-hex-has-preview:focus").wpColorPicker("close");s.blur(),(o.length||n.length)&&(n.length?n.click():void 0!==o[1]?o[1].click():o.click());break;case 27:I()}}if(83===i.keyCode&&i.metaKey&&i.shiftKey&&!i.altKey||83===i.keyCode&&i.ctrlKey&&i.shiftKey&&!i.altKey)return i.preventDefault(),I(),void e("#save-post").trigger("click");if(83===i.keyCode&&i.metaKey&&!i.altKey||83===i.keyCode&&i.ctrlKey&&!i.altKey)return i.preventDefault(),I(),void t("#publish").trigger("click");var l=e(i.target);if(_.isUndefined(l)||!(l.is("input, textarea")||l.attr("contenteditable")||l.hasClass("et_disable_single_key_shortcuts"))){if(90===i.keyCode&&i.metaKey&&i.shiftKey&&!i.altKey||90===i.keyCode&&i.ctrlKey&&i.shiftKey&&!i.altKey)return i.preventDefault(),V.redo(i),!1;if(90===i.keyCode&&i.metaKey&&!i.altKey||90===i.keyCode&&i.ctrlKey&&!i.altKey)return i.preventDefault(),V.undo(i),!1;if(79===i.keyCode){if(ze())return;i.preventDefault(),e(".et_pb_builder_settings").length||e("#et_pb_layout .et-pb-app-settings-button").trigger("click")}else if(80===i.keyCode){if(i.preventDefault(),i.metaKey||i.ctrlKey)return e(".et-pb-modal-preview-template").length&&e(".et-pb-modal-preview-template").trigger("click"),!1;if(ze())return;e("div[data-et-core-portability]").hasClass("et-core-active")||e("#et_pb_layout .et-pb-app-portability-button").trigger("click")}else if(72===i.keyCode){if(ze())return;i.preventDefault(),e("#et_pb_layout .et-pb-layout-buttons-history").trigger("click")}else if(9===i.keyCode&&i.shiftKey){if(e(".et-pb-options-tabs-links").length||e(".et-pb-preview-screensize-switcher").length){var d=!(!e(".et-pb-modal-preview-template").length||!e(".et-pb-modal-preview-template").hasClass("active")),r=e(d?".et-pb-preview-screensize-switcher":".et-pb-options-tabs-links").find("li"),p=r.length,c=r[0];r.each(function(t){var i=d?e(this).find("a"):e(this),o=d?"active":"et-pb-options-tabs-links-active";i.hasClass(o)&&t!==p-1&&(c=r[t+1])}),e(c).length&&e(c).find("a").trigger("click")}}else if(67===i.keyCode&&(i.metaKey||i.ctrlKey)){if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;h.copy(i)}}else if(86===i.keyCode&&(i.metaKey||i.ctrlKey)){if(h=We(u))(E=u.$el).hasClass("et-pb-column")||E.hasClass("et_pb_section_fullwidth")&&!Ye.get("et_pb_clipboard_section")&&!E.find(".et_pb_module_block").length?h.pasteColumn(i):h.pasteAfter(i)}else if(88===i.keyCode&&(i.metaKey||i.ctrlKey)){if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;h.copy(i);var b=u.$el.hasClass("et_pb_module_block")?u.$el.find(".et-pb-remove"):u.$el.find("> .et-pb-controls .et-pb-remove");b.length&&(b.trigger("click"),u={},Ue())}}else if(68===i.keyCode){if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;var g="disabled";void 0===h.model.attributes.et_pb_disabled||"on"!==h.model.attributes.et_pb_disabled?(h.model.attributes.et_pb_disabled="on",u.$el.addClass("et_pb_disabled")):(h.model.attributes.et_pb_disabled="off",u.$el.removeClass("et_pb_disabled"),g="enabled"),h.updateGlobalModule(),V.allowHistorySaving(g,h.history_noun),V.saveAsShortcode()}}else if(76===i.keyCode){var h;if(h=We(u)){if(u.$el.hasClass("et-pb-column"))return;void 0===h.model.attributes.et_pb_locked||"on"!==h.model.attributes.et_pb_locked?h.lock(i):h.unlockItem(i),Ue()}}else if(83===i.keyCode)i.preventDefault(),_.isEmpty(u)||e(".et_pb_modal_overlay").length||(f.s=!0);else if(49!==i.keyCode&&50!==i.keyCode&&51!==i.keyCode||!f.s)if(82===i.keyCode)_.isEmpty(u)||e(".et_pb_modal_overlay").length||(f.r=!0);else if(67!==i.keyCode||i.metaKey||i.ctrlKey)if(49!==i.keyCode&&50!==i.keyCode&&51!==i.keyCode&&52!==i.keyCode&&53!==i.keyCode&&54!==i.keyCode&&55!==i.keyCode&&56!==i.keyCode&&57!==i.keyCode&&48!==i.keyCode&&189!==i.keyCode||!f.r&&!f.c){if(49===i.keyCode||50===i.keyCode||51===i.keyCode||52===i.keyCode||53===i.keyCode||54===i.keyCode||55===i.keyCode||56===i.keyCode||57===i.keyCode||48===i.keyCode||189===i.keyCode){if(!e("ul.et-pb-column-layouts").length)return;var m=e("ul.et-pb-column-layouts li");C=0;switch(i.keyCode){case 49:C=0;break;case 50:C=1;break;case 51:C=2;break;case 52:C=3;break;case 53:C=4;break;case 54:C=5;break;case 55:C=6;break;case 56:C=7;break;case 57:C=8;break;case 48:C=9;break;case 189:C=10}m.length&&m[C]&&e(m[C]).trigger("click")}else if("?"===i.key||191===i.keyCode){var v="help"===e(".et_pb_modal_settings_container").attr("data-open_view");if(e(".et-pb-modal-close").length&&e(".et-pb-modal-close").click(),v)return;I();var w=new a.ModalView({attributes:{"data-open_view":"help"},view:this});e("body").append(w.render().el)}}else{var k=(E=u.$el).closest(".et_pb_row");if(k.length){var C="4_4";switch(i.keyCode){case 49:C="4_4";break;case 50:C="1_2,1_2";break;case 51:C="1_3,1_3,1_3";break;case 52:C="1_4,1_4,1_4,1_4";break;case 53:C="2_3,1_3";break;case 54:C="1_3,2_3";break;case 55:C="1_4,3_4";break;case 56:C="3_4,1_4";break;case 57:C="1_2,1_4,1_4";break;case 48:C="1_4,1_4,1_2";break;case 189:C="1_4,1_2,1_4"}var S=y.getView(k.find(".et-pb-row-content").data("cid"));if(void 0!==S){var x=!1,j=!1,$=y.getView(S.model.attributes.parent);if(void 0!==$&&"column"===$.model.attributes.type){var T=3===$.model.attributes.specialty_columns?[49,50,51]:[49,50];if(-1===e.inArray(i.keyCode,T))return}var U={};if(f.r){if("on"===S.model.get("et_pb_parent_locked"))return;if(J.is_active()&&!J.is_user_has_permission(S.model.get("cid"),"add_row"))return void J.alert("has_no_permission");V.allowHistorySaving("added","row"),j=!0;var O=y.generateNewId(),A=void 0!==S.model.get("et_pb_global_module")&&""!==S.model.get("et_pb_global_module")?S.model.get("et_pb_global_module"):"",M=""!==A?S.model.get("cid"):"";$.collection.add([{type:"row",module_type:"row",cid:O,parent:$.model.get("cid"),view:S,appendAfter:S.$el,et_pb_global_parent:A,global_parent_cid:M,admin_label:et_pb_options.noun.row}]),U=y.getView(O)}else{if(void 0!==S.model.attributes.et_pb_global_module&&""!==S.model.attributes.et_pb_global_module||"row"===et_pb_options.layout_type&&"global"===et_pb_options.is_global_template)return;U=S,x=!0}var L={layout:C,is_structure_change:x,layout_specialty:""};y.changeColumnStructure(U,L,!0,j)}}}else _.isEmpty(u)||e(".et_pb_modal_overlay").length||(f.c=!0);else{if(e(".et_pb_modal_overlay").length)return;var E,D=(E=u.$el).closest(".et_pb_section");if(D.length)switch(i.keyCode){case 49:D.find(".et-pb-section-add-main").trigger("click");break;case 50:D.find(".et-pb-section-add-specialty").trigger("click");break;case 51:D.find(".et-pb-section-add-fullwidth").trigger("click")}}}}function I(){var t=e(".et-pb-modal-close"),i=e(".et-core-modal-close");t.length&&(void 0!==t[1]?t[1].click():t.click()),i.length&&i.click(),e("body").removeClass("et-core-nbfc")}}),e(window).keyup(function(e){83===e.keyCode?f.s=!1:82===e.keyCode?f.r=!1:67===e.keyCode&&f.c&&(f.c=!1,Ze())}),e("body").on("mouseover",".et-pb-right-click-trigger-overlay, .et-pb-controls, .et_pb_module_block, .et-pb-insert-module, .et-pb-row-add",function(t){var i=e(t.target),o=i.closest(".et_pb_module_block");if(!o.length)if(i.closest(".et-pb-insert-module").length||i.closest(".et-pb-row-add").length)o=i.closest("div"),i.closest(".et-pb-row-add").length&&(o=o.find(".et-pb-row-content"));else{var n=i.closest(".et-pb-right-click-trigger-overlay").length?i.closest(".et-pb-right-click-trigger-overlay"):i.closest(".et-pb-controls");if(!n.length)return void(u={});var a=n.closest(".et_pb_row");if(a.length)o=a.find(".et-pb-row-content");else o=n.closest(".et_pb_section").find(".et-pb-section-content")}if(o.length){var s=y.getView(o.data("cid"));u=s}}),e("body").on("dblclick",".et-pb-right-click-trigger-overlay, .et-pb-controls, .et_pb_module_block",function(t){var i=e(t.target);if(!i.closest("a").length){var o=i.closest(".et_pb_module_block");if(o.length)o.find(".et-pb-settings").trigger("click");else{i.closest(".et-pb-controls").length&&i.closest(".et-pb-controls").find(".et-pb-settings").trigger("click");var n=i.closest(".et-pb-right-click-trigger-overlay");if(n.length){var a=n.closest(".et_pb_row");if(a.length)a.find("> .et-pb-controls .et-pb-settings").trigger("click");else n.closest(".et_pb_section").find("> .et-pb-controls .et-pb-settings").trigger("click")}}}}),"0"===et_pb_options.is_divi_library){var Xe=e("#et-builder-app-settings-button-template").html();e("#et_pb_layout").prepend(Xe),e("#et_pb_layout").on("click",".et-pb-app-view-ab-stats-button",function(t){t.preventDefault(),J.is_selecting_subject()?J.alert("select_ab_testing_subject_first"):J.is_selecting_goal()?J.alert("select_ab_testing_goal_first"):J.is_selecting_winner()?J.alert("select_ab_testing_winner_first"):e("#et_pb_layout_controls .et-pb-layout-buttons-view-ab-stats").trigger("click")}),e("#et_pb_layout").on("click",".et-pb-app-portability-button.et-core-disabled",function(e){e.preventDefault(),J.is_selecting_subject()?J.alert("select_ab_testing_subject_first"):J.is_selecting_goal()?J.alert("select_ab_testing_goal_first"):J.is_selecting_winner()?J.alert("select_ab_testing_winner_first"):J.is_active()&&J.alert("cannot_import_export_layout_has_ab_testing")}),e("#et_pb_layout").on("click",".et-pb-app-settings-button",function(t){t.preventDefault(),J.is_selecting_subject()?J.alert("select_ab_testing_subject_first"):J.is_selecting_goal()?J.alert("select_ab_testing_goal_first"):J.is_selecting_winner()?J.alert("select_ab_testing_winner_first"):e("#et_pb_layout_controls .et-pb-layout-buttons-settings").trigger("click")})}else e("#toplevel_page_et_divi_options, #toplevel_page_et_divi_options > a").addClass("wp-has-current-submenu wp-menu-open").removeClass("wp-not-current-submenu");if(Be()){var Qe=function(){YoastSEO.app.registerPlugin("ET_PB_Yoast_Content",{status:"ready"}),YoastSEO.app.registerModification("content",this.et_pb_update_content,"ET_PB_Yoast_Content",5)};Qe.prototype.et_pb_update_content=function(t){var i=F||et_pb_options.yoast_content;return e(".et-pb-yoast-loading").remove(),i},new Qe}e(window).resize(function(){var t=e(".et_pb_prompt_modal.et_pb_auto_centerize_modal");t.length&&(t.removeAttr("style"),Object(o.a)(t,".et_pb_prompt_buttons"))}),e(window).on("load",function(){setTimeout(function(){var t=e("#et_pb_toggle_builder"),i=e("#et_pb_fb_cta");t.addClass("et_pb_ready"),t.hasClass("et_pb_builder_is_used")&&i.addClass("et_pb_ready")},250)}),e(window).on("mousedown",function(t){var i=e(".et-pb-settings-option-select-advanced.et_pb_menu_active");e(t.target).closest(".et-pb-settings-option-select-advanced").length<1&&i.length>0&&ge(i)})}),window.et_builder=window.et_builder||{},void 0!==window.YoastShortcodePlugin&&(window.YoastShortcodePlugin.prototype.bindElementEvents=function(){var e=document.getElementById("content")||!1,t=this;e&&(e.addEventListener("keydown",this.loadShortcodes.bind(this,this.declareReloaded.bind(this))),e.addEventListener("change",this.loadShortcodes.bind(this,this.declareReloaded.bind(this)))),"undefined"!=typeof tinyMCE&&"function"==typeof tinyMCE.on&&tinyMCE.on("addEditor",function(e){e.editor.on("change",function(){t.loadShortcodes.bind(t,t.declareReloaded.bind(t))()})})}),document.addEventListener("DOMContentLoaded",function(){var t,i={tabs:{},padding:{},yes_no_button:{},multiple_buttons:{},font_buttons:{},text_align_buttons:{},select:{},font_line_styles:{},animation_buttons:{},user_fonts:et_pb_options.user_fonts,font_weights:et_pb_options.supported_font_weights,options_icons:et_pb_options.all_svg_icons,background_tabs_nav:{},background_gradient_buttons:{},option_preview_buttons:{}};function o(){var t=e(".et_pb_modal_settings_container");t.find("div.mce-fullscreen").length&&setTimeout(function(){var e=t.innerHeight(),i=t.find(".mce-toolbar-grp").innerHeight();t.find("iframe").height(e-i)},100)}window.et_builder_template_options=i,a.Events.on("et-advanced-module-settings:render",function(t){var i=t.$el.find("#et_pb_category_id"),o=t.$el.find("#et_pb_category_name"),n=void 0;i.length&&o.length&&(n=i.find("option:selected").text().trim(),o.val(n),i.on("change",function(){n=e(this).find("option:selected").text().trim(),o.val(n)}))}),t={fonts_template:function(t){return _.template(e("#et-builder-google-fonts-options-items").html())(window.et_builder_template_options.user_fonts)},fonts_weight_template:function(t){return _.template(e("#et-builder-font-weight-items").html())(window.et_builder_template_options.font_weights)},font_icon_list_template:function(){return e("#et-builder-font-icon-list-items").html()},font_down_icon_list_template:function(){return e("#et-builder-font-down-icon-list-items").html()},preview_tabs_output:function(){return e("#et-builder-preview-icons-template").html()},settings_tabs_output:function(t){var i=_.template(e("#et-builder-options-tabs-links-template").html());return window.et_builder_template_options.tabs.options=e.extend({},t),i(window.et_builder_template_options.tabs)},mobile_tabs_output:function(){return e("#et-builder-mobile-options-tabs-template").html()},options_template_output:function(t,i,o){var n=_.template(e("#et-builder-"+t+"-option-template").html());return window.et_builder_template_options[t].options=e.extend({},i),_.isUndefined(o)||(window.et_builder_template_options[t].data=e.extend({},o)),n(window.et_builder_template_options[t])},options_text_align_buttons_output:function(t,i){var o=_.template(e("#et-builder-text-align-buttons-option-template").html());return window.et_builder_template_options.text_align_buttons.options=e.extend({},t),window.et_builder_template_options.text_align_buttons.type=i,o(window.et_builder_template_options.text_align_buttons)}},e.extend(window.et_builder,t),e("body").on("click",".et_pb_module_settings .mce-i-fullscreen",function(){o()}),e(window).resize(function(){o()}),e("body.wp-admin").on("click",'.et-pb-modal-container .mce-widget.mce-btn[aria-label="Fullscreen"] button',function(){setTimeout(function(){e(window).trigger("resize")},50)}),e(document).on("click",".et-pb-dynamic-content-fb-switch",function(t){t.preventDefault(),e("#et_pb_fb_cta").click()})})}.call(this,i(5),i(5))},5:function(e,t){e.exports=jQuery}}); //# sourceMappingURL=builder.js.map