!function(e){"use strict";e.fn.fusionImageCompare=function(){return this.each(function(){var i=e(this),t=void 0!==e(this).data("offset")?e(this).data("offset"):.5,o=void 0!==e(this).data("orientation")?e(this).data("orientation"):"horizontal",a=void 0!==e(this).data("move-slider-on-hover")&&e(this).data("move-slider-on-hover"),n=void 0===e(this).data("move-with-handle-only")||e(this).data("move-with-handle-only"),s=void 0!==e(this).data("click-to-move")&&e(this).data("click-to-move"),f=i.find("img:first"),r=i.find("img:last"),c=i.find(".fusion-image-before-after-handle"),d=e(".before-after-label-out-image-up-down"),u=0,m=0,l=0,h=0,v="",g=function(e){var i=f.width(),t=f.height();return{w:i+"px",h:t+"px",cw:e*i+"px",ch:e*t+"px"}},p=function(e){"vertical"===o?(f.css("clip","rect(0,"+e.w+","+e.ch+",0)"),r.hasClass("fusion-image-before-after-before")||r.css("clip","rect("+e.ch+","+e.w+","+e.h+",0)")):(f.css("clip","rect(0,"+e.cw+","+e.h+",0)"),r.hasClass("fusion-image-before-after-before")||r.css("clip","rect(0,"+e.w+","+e.h+","+e.cw+")")),i.css("height",e.h),d.addClass("visible")},w=function(e){var i=g(e);c.css("vertical"===o?"top":"left","vertical"===o?i.ch:i.cw),p(i)},b=function(e,i){var t,a,n;return t="vertical"===o?(i-m)/h:(e-u)/l,a=0,n=1,Math.max(a,Math.min(n,t))},C=function(e){((e.distX>e.distY&&e.distX<-e.distY||e.distX<e.distY&&e.distX>-e.distY)&&"vertical"!==o||(e.distX<e.distY&&e.distX<-e.distY||e.distX>e.distY&&e.distX>-e.distY)&&"vertical"===o)&&e.preventDefault(),i.addClass("active"),u=i.offset().left,m=i.offset().top,l=f.width(),h=f.height()},y=function(e){i.hasClass("active")&&(t=b(e.pageX,e.pageY),w(t))},j=function(){i.removeClass("active")};e(window).on("resize.fusion-image-before-after",function(){w(t)}),(v=n?i:c).on("movestart",C),v.on("move",y),v.on("moveend",j),a&&(i.on("mouseenter",C),i.on("mousemove",y),i.on("mouseleave",j)),c.on("touchmove",function(e){e.preventDefault()}),i.find("img").on("mousedown",function(e){e.preventDefault()}),s&&i.on("click",function(e){var a;u=i.offset().left,m=i.offset().top,l=f.width(),h=f.height(),t=b(e.pageX,e.pageY),a=g(t),i.addClass("active"),"vertical"===o?c.stop(!0,!0).animate({top:a.ch},{queue:!1,duration:300,easing:"easeOutCubic",step:function(e){var i=g(e/h);p(i)},complete:function(){i.removeClass("active")}}):c.stop(!0,!0).animate({left:a.cw},{queue:!1,duration:300,easing:"easeOutCubic",step:function(e){var i=g(e/l);p(i)},complete:function(){i.removeClass("active")}})}),i.addClass("initialized"),e(window).trigger("resize.fusion-image-before-after")})}}(jQuery),jQuery(window).on("load",function(){jQuery(".fusion-image-before-after").fusionImageCompare()}),jQuery(window).on("awb-more-elements-loaded",function(e,i,t){jQuery(t).find(".fusion-image-before-after").fusionImageCompare()}),jQuery(window).on("fusion-dynamic-content-render",function(e,i){var t=jQuery(i).find(".fusion-image-before-after");0<t.length&&t.fusionImageCompare()}),jQuery(document).on("fusion-element-render-fusion_image_before_after fusion-column-resized",function(e,i){jQuery('div[data-cid="'+i+'"]').find(".fusion-image-before-after").each(function(){jQuery.cleanData(jQuery(this))}),jQuery('div[data-cid="'+i+'"]').find(".fusion-image-before-after").fusionImageCompare()});