jQuery((function(e){e(document).on("change",".jpagebuilder-control-padding",(function(o){var a="",s=e(this);e(this).closest(".jpagebuilder-paddings-list").find(">div").each((function(o){a+=e(this).find(".jpagebuilder-control-padding").val()+" "})),s.closest(".jpagebuilder-paddings-list").prev().val(e.trim(a))})),e(document).on("change",".jpagebuilder-control-margin",(function(o){var a="",s=e(this);e(this).closest(".jpagebuilder-margins-list").find(">div").each((function(o){a+=e(this).find(".jpagebuilder-control-margin").val()+" "})),s.closest(".jpagebuilder-margins-list").prev().val(e.trim(a))})),e(document).on("click",".jpagebuilder-btn-clear-media",(function(o){o.preventDefault();var a=e(this);a.siblings(".jpagebuilder-media-preview").addClass("jpagebuilder-media-no-image").removeAttr("src"),a.siblings("input").val("")}));var o={};e.fn.openPopupAlt=function(){e("#page-options").addClass("jpagebuilder-modal-overlay-after-open"),e("#page-options").find(".jpagebuilder-modal-content").addClass("jpagebuilder-modal-content-after-open"),e("body").addClass("jpagebuilder-modal-open"),e(".jpagebuilder-modal-alt .form-group").find(">input,>textarea,>select").each((function(){o[e(this).attr("id")]=e(this).val()}))},e.fn.closePopupAlt=function(a){var s=e.extend({reset:!1},a);return e("#page-options").addClass("jpagebuilder-modal-overlay-before-close"),e("#page-options").find(".jpagebuilder-modal-content").addClass("jpagebuilder-modal-content-before-close"),e("#page-options").removeClass("jpagebuilder-modal-overlay-before-close jpagebuilder-modal-overlay-after-open"),e("#page-options").find(".jpagebuilder-modal-content").removeClass("jpagebuilder-modal-content-before-close jpagebuilder-modal-content-after-open"),e("body").removeClass("jpagebuilder-modal-open"),s.reset&&e(".jpagebuilder-modal-alt .form-group").find(">input,>textarea,>select").each((function(){e(this).val(o[e(this).attr("id")]),"jform_og_image"==e(this).attr("id")&&""!=o[e(this).attr("id")]&&e(this).prev(".jpb-media-preview").removeClass("no-image").attr("src",pagebuilder_base+o[e(this).attr("id")])})),this},e("#btn-page-options").on("click",(function(o){o.preventDefault(),e().openPopupAlt()})),e(document).on("click",".jpagebuilder-modal-alt .jpagebuilder-modal-content-after-open",(function(o){o.target===this&&e().closePopupAlt({reset:!0})})),e(document).on("click","#btn-cancel-page-options",(function(o){o.preventDefault(),e().closePopupAlt({reset:!0})})),e(document).on("click","#btn-apply-page-options",(function(o){e().closePopupAlt()})),e(document).on("click",".jpagebuilder-fontawesome-icon-input",(function(o){o.preventDefault(),e(this).closest(".jpagebuilder-fontawesome-icon-chooser").toggleClass("open"),e(this).closest(".jpagebuilder-fontawesome-icon-chooser").hasClass("open")&&e(this).closest(".jpagebuilder-fontawesome-icon-chooser").find('input[type="text"]').focus()})),e(document).on("click",".jpagebuilder-fa-list-icon",(function(o){o.preventDefault();var a=e(this),s=a.closest(".jpagebuilder-fontawesome-icon-chooser");e(this).closest("ul").find(">li").removeClass("active"),a.addClass("active"),s.find(".jpagebuilder-fontawesome-icon-input>span").html('<i class="fa '+a.data("fontawesome_icon")+'"></i> '+a.data("fontawesome_icon_name")),s.find(".jpagebuilder-addon-input-fa").val(a.data("fontawesome_icon_name")),s.addClass("jpagebuilder-has-fa-icon").removeClass("open")})),e(document).on("keyup",'.jpagebuilder-fontawesome-dropdown input[type="text"]',(function(){var o=e(this).val(),a=new RegExp(".*?"+o+".*?","i");e(this).next(".jpagebuilder-fontawesome-icons").children().each((function(){var o=a.test(e("span",this).text());e(this).toggle(o)}))})),e(document).on("click",".jpagebuilder-remove-fa-icon",(function(o){o.stopPropagation(),o.preventDefault();var a=e(this).closest(".jpagebuilder-fontawesome-icon-chooser");a.removeClass("jpagebuilder-has-fa-icon"),a.find(".jpagebuilder-fontawesome-icon-input>span").html("--"+Joomla.JText._("COM_JPAGEBUILDER_ADDON_ICON_SELECT")+"--"),a.find(".jpagebuilder-fontawesome-icons>li").removeClass("active"),a.find(".jpagebuilder-addon-input-fa").val("")})),e(".com_jpagebuilder #jpagebuilder-page-tools").length>0&&e(window).on("scroll",(function(){if(e(window).scrollTop()>220){var o=e(".com_jpagebuilder #jpagebuilder-page-tools > div");e(".com_jpagebuilder #jpagebuilder-page-tools").addClass("fixed-jp-page-tools"),e(".com_jpagebuilder #jpagebuilder-page-tools").css({height:o.outerHeight()})}else e(".com_jpagebuilder #jpagebuilder-page-tools").removeClass("fixed-jp-page-tools"),e(".com_jpagebuilder #jpagebuilder-page-tools").css({height:"auto"})}))}));