(function(e){define([],function(){e("body").on("mouseup",function(){e(".upfront-field-select").removeClass("upfront-field-select-expanded")});var t='#page input[type="text"], #page input[type="email"], #page input[type="password"], #page textarea, #page select, #page .upfront-field-select';e("body").on("mouseover",t,function(t){try{e(t.target).closest(".ui-draggable").draggable("disable")}catch(t){}}),e("body").on("mouseout",t,function(t){try{e(t.target).closest(".ui-draggable").draggable("enable")}catch(t){}}),e(document).on("click",function(t){if(e(".sp-container").length===e(".sp-container.sp-hidden").length)return;e(".sp-container").not(".sp-hidden").each(function(){var t=e(this),n=t.data("sp-options");if(!n||!n.flat){var r=t.parent().find(".sp-replacer");r.removeClass("sp-active"),t.addClass("sp-hidden"),setTimeout(function(){r.removeClass("sp-active"),t.addClass("sp-hidden")},10)}})}),/i(Pad|Phone|Pod)/g.test(navigator.userAgent)&&e(window).on("resize",function(t){setTimeout(function(){e.magnificPopup.instance.updateSize()},500)}),e(document).one("upfront-load",function(){Upfront.Events.once("Upfront:loaded",function(){e(document).on("click","a",function(t){var n,r,i,s,o;if(t.isDefaultPrevented())return;n=e(t.currentTarget).data("bypass");if(n)return;i=t.target,s=i.pathname,r=i.getAttribute("href"),o=i.search;if(r=="#"||i.origin!=window.location.origin||s==window.location.pathname&&o==window.location.search)return;if(e(t.target).closest(".redactor_box").length||e(t.target).parents(".redactor-editor").length)return;Upfront.mainData.site.indexOf("localhost")>-1&&Upfront.mainData.site+"/"===i.origin+s&&(s="/"),window.location.search.indexOf("dev=true")>-1&&o.indexOf("dev=true")===-1&&(o===""&&(o="?"),o+="dev=true"),t.preventDefault(),(!Upfront.PreviewUpdate._is_dirty||confirm(Upfront.Settings.l10n.global.application.navigation_confirm))&&Upfront.Application.navigate(s+o,{trigger:!0})}).on("keydown",function(t){if(t.which==8){var n=t.target.tagName.toUpperCase();n!="INPUT"&&n!="TEXTAREA"&&!e(t.target).closest(".redactor_box").length&&!t.target.contentEditable&&t.preventDefault()}})})})})})(jQuery);