/* Request ID: d62504d80dc0cbf995fba9dc73233abe (05/09/2024 4:24am) */ /* Resource ID: 432c7d58f1bfe93b59ff68adc28 (private.es6, compiled by babel, minified by uglifyjs) (04/23/2024 11:29am) */ "use strict";(function(h,f){h.lib=h.lib||{};h.lib.pubSub=function(){var t=f({});return{bind:function e(){t.on.apply(t,arguments)},unbind:function e(){t.off.apply(t,arguments)},trigger:function e(){t.trigger.apply(t,arguments)}}};h.eventHub=h.lib.pubSub();h.lib.getAjaxUrl=function(e,t,i){var s=i?i:"/livewhale/backend.php";var r=s+"?livewhale=ajax&function="+e;if(f.isPlainObject(t)&&!f.isEmptyObject(t)){r+="&"+f.param(t)}return r};function e(e){this.options=_.extend({title:"Crop image",aspect_ratio:null,hide_aspect_ratio_menu:false},e);this.jcrop_api=null;this.coords=null;this.aspect_ratio=this.options.aspect_ratio;this.init()}_.extend(e.prototype,h.lib.pubSub(),{init:function e(){var i=this;var t,s,r,a;t='
'+'
'+'
'+''+''+''+''+''+''+''+"
"+"
"+'
'+''+"";r="
"+''+'or cancel and close'+"
";a=f(r);s=this.$overlay=f(t).overlay({autoOpen:false,destroyOnClose:false,size:"medium",closeSelector:".lw_cancel a",title:this.options.title,footer:a,customClass:"lw_crop_overlay",zIndex:1151,close:f.proxy(this._close,this)});if(this.options.hide_aspect_ratio_menu){this.$overlay.find("#lw_image_crop_ar").hide()}else{this.$overlay.find("#lw_image_crop_ar").show()}this.$preview=s.find("#lw_image_crop_preview_image");this.$ar_checkboxes=s.find("#lw_image_crop_ar input[type=checkbox]");a.on("click",".btn-primary",function(e){e.preventDefault();i.saveCrop();return true});s.on("click","#lw_image_crop_ar input[type=checkbox]",function(){var e=f(this);var t=e.closest("label");if(e.prop("checked")){t.siblings().removeClass("selected").find("input[type=checkbox]").prop("checked",false);t.addClass("selected");i.setAspectRatio(e.val())}else{t.removeClass("selected");i.setAspectRatio("")}return true})},setAspectRatio:function e(t){var i=0;this.aspect_ratio=t;if(t==="orig"){i=this.width/this.height}else if(t.match(/^\d+:\d+$/)){i=parseInt(t.split(":")[0],10)/parseInt(t.split(":")[1],10)}this.jcrop_api.setOptions({aspectRatio:i})},setCropSelect:function e(t){this.jcrop_api.setSelect(t)},setCropCoords:function e(t){this.coords=t;this.trigger("set",[{coords:t}])},setPreviewImage:function e(t){var i,s,r;if(this.height>=this.width){r=500;s=Math.round(r*(this.width/this.height))}else{s=500;r=Math.round(s*(this.height/this.width))}i=t.replace(/\/(?=[^\/]*$)/,"/width/"+s+"/height/"+r+"/");this.$preview.attr("src",i).width(s).height(r)},initCropper:function e(t){var i=this,s=this.$preview.width(),r=this.$preview.height(),a=s/this.width,l=r/this.height,n;if(!_.isArray(t)||t.length!==4){if(s>r){n=[(s-r)/2,0,(s-r)/2+r,r]}else{n=[0,(r-s)/2,s,(r-s)/2+s]}}else{n=[Math.round(t[0]*a),Math.round(t[1]*l),Math.round(t[2]*a),Math.round(t[3]*l)]}this.$preview.Jcrop({aspectRatio:0,keySupport:false,trueSize:[this.width,this.height],setSelect:n,onSelect:f.proxy(this.setCropCoords,this),onChange:f.proxy(this.setCropCoords,this),onRelease:function e(t){}},function(){var e=i.jcrop_api=this;if(i.aspect_ratio){i.$ar_checkboxes.each(function(){if(f(this).val()===i.aspect_ratio){f(this).trigger("click")}})}})},open:function e(t,i,s,r){var a=this,l=f('
');this.width=i;this.height=s;this.$overlay.overlay("open");this.setPreviewImage(t);this.$preview.parent().imagesLoaded(function(){a.initCropper(r)})},saveCrop:function e(){var t=this.coords,i;if(_.isPlainObject(t)&&_.keys(t).length===6){i=[t.x,t.y,t.x2,t.y2]}this.trigger("save",[{coords:i,aspect_ratio:this.aspect_ratio}]);this.$overlay.overlay("close")},_close:function e(){this.coords=null;this.$ar_checkboxes.prop("checked",false);if(this.jcrop_api){this.jcrop_api.destroy();this.jcrop_api=null}this.$preview.removeAttr("src")}});h.lib.CropDialog=e;var t={init:function e(){var t=this.$toolbar=f("#lw-toolbar");if(!t.length){return}this.initGroupSwitcher();this.addDropdownHandlers();this.adjustToolboxColumns();this.initSearch();this.initMobile();h.eventHub.bind("toolbarOpen",function(e,t){t.find("#search_query").trigger("focus");return true});t.show()},initGroupSwitcher:function e(){var t=''+h.group_title_native+"";f(".lw-group-switcher").html(t);var i=f("body");if(i.hasClass("has_core_admin")||i.hasClass("has_core_switch")||i.hasClass("has_core_submissions")||i.hasClass("has_custom_core_switch")){this.addGroupSwitcherEventHandlers()}},initSearch:function e(){f("form#content-search").on("submit",function(e){e.preventDefault();var t=f(this);var i=t.find("#search_query").val();var s=f("body.admin-user").length||h.pages_editor&&h.pages_editor.is_admin?"&results[]=1&results[]=2&results[]=4":"&results[]=1";document.location.href="/livewhale/?search="+i+s;return true})},initMobile:function e(){var t=this.$toolbar;var i=t.find("#lw-toolbar-collapse");t.on("click",".lw-navbar-toggle",function(e){if(!i.is(":visible")){e.stopPropagation();i.show();f("body").one("click",function(){i.hide()})}})},addGroupSwitcherEventHandlers:function e(){var t=f(".lw-group-switcher").addClass("lw-switchable").attr("tabindex","0");var i=t.find(".lw-current-group");var a=f('').appendTo(t);var l=function e(){f(document).off("click",e);i.show();a.find("select").hide()};var n=function e(){f(document).on("click",l);i.hide();a.find("select").show().trigger("focus")};var s=function e(){var r=i.find("span").text();f.ajax({url:h.lib.getAjaxUrl("getGroupswitcher"),async:false,success:function e(t){var i=f(t);i.find("option").each(function(){if(r===f(this).text()){f(this).prop("selected",true);return false}});var s=false;i.on("change keypress",function(e){var t=f(this);if(t.val()){if(e.type==="change"){if(!s){window.location="/livewhale/backend.php?livewhale=groupswitch&group="+t.val()}else{s=false}}else{if(e.keyCode===13){window.location="/livewhale/backend.php?livewhale=groupswitch&group="+t.val()}else if(e.keyCode===32||e.keyCode===38||e.keyCode===40){s=false}else{s=true}}}});blur(function(){s=false;l()});a.html(i);n()}})};t.on("click","select",function(e){e.stopPropagation()});t.on("keydown",function(e){if(13===e.keyCode){e.preventDefault();if(a.is(":empty")){s()}else{n()}}});t.on("click",".lw-current-group",function(e){e.preventDefault();if(a.is(":empty")){s()}else{n()}return false})},addDropdownHandlers:function e(){var t=this.$toolbar;var s=function e(){f(document).off("click",e);t.find(".lw-dropdown-backdrop").remove();t.find(".lw-dropdown-toggle").each(function(){var e=f(this);var t=e.closest(".lw-dropdown");if(!t.hasClass("open")){return}e.attr("aria-expanded","false");t.removeClass("open")})};t.on("click",".lw-dropdown-menu",function(e){e.stopPropagation()});t.on("click",".lw-dropdown-toggle",function(e){e.preventDefault();e.stopPropagation();var t=f(this);var i=t.closest(".lw-dropdown");if(!i.hasClass("open")){s();if("ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length){f(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(f(this)).on("click",s)}f(document).on("click",s);t.trigger("focus").attr("aria-expanded","true");i.toggleClass("open");h.eventHub.trigger("toolbarOpen",[i])}else{s()}})},adjustToolboxColumns:function e(){var t=this.$toolbar.find(".lw-toolbox .lw-dropdown-menu");var i=t.find("> .row > div");i.each(function(){var e=f(this);if(e.find("> ul").is(":empty")){e.remove()}});var s=i.length;var r=600;t.css("min-width",r*(s/3)+"px");var a;switch(s){case 4:a="col-sm-3";break;case 3:a="col-sm-4";break;case 2:a="col-sm-6";break;default:a="col-sm-12";break}i.removeClass(function(e,t){return(t.match(/(^|\s)col-sm-\S+/g)||[]).join(" ")}).addClass(a)}};f(function(){h.whiteout=f('