/* Request ID: bf136b902938c2063b2ec4dfcd2513aa (05/13/2024 10:59pm) */ /* Resource ID: 21b3355ad18f2ad33618ab66d75 (private.js, minified by uglifyjs) (04/28/2024 6:37pm) */ (function(c,f){c.lib=c.lib||{};c.lib.pubSub=function(){var e=f({});return{bind:function(){e.on.apply(e,arguments)},unbind:function(){e.off.apply(e,arguments)},trigger:function(){e.trigger.apply(e,arguments)}}};c.eventHub=c.lib.pubSub();c.lib.cropDialog={jcrop_api:null,coords:null,aspect_ratio:null,init:function(){var t=this,e,i,s,a;e='
'+'
'+'
'+''+''+''+''+''+''+''+''+"
"+"
"+'
'+''+"";s="
"+''+'or cancel and close'+"
";a=f(s);i=this.$overlay=f(e).overlay({autoOpen:false,destroyOnClose:false,size:"medium",closeSelector:".lw_cancel a",title:"Crop image",footer:a,customClass:"lw_crop_overlay",zIndex:1151,close:f.proxy(this._close,this)});this.$preview=i.find("#lw_image_crop_preview_image");this.$ar_checkboxes=i.find("#lw_image_crop_ar input[type=checkbox]");a.on("click",".btn-primary",function(e){e.preventDefault();t.save();return true});i.on("click","#lw_image_crop_ar input[type=checkbox]",function(){var e=f(this);if(e.prop("checked")){e.closest("label").siblings().find("input[type=checkbox]").prop("checked",false);t.setAspectRatio(e.val())}else{t.setAspectRatio("")}return true})},setAspectRatio:function(e){var t=0;this.aspect_ratio=e;if(e==="orig"){t=this.width/this.height}else if(e.match(/^\d+:\d+$/)){t=parseInt(e.split(":")[0],10)/parseInt(e.split(":")[1],10)}this.jcrop_api.setOptions({aspectRatio:t})},setCropSelect:function(e){this.jcrop_api.setSelect(e)},setCropCoords:function(e){this.coords=e;c.eventHub.trigger("cropSelect",[e])},setPreviewImage:function(e){var t,i,s;if(this.height>=this.width){s=500;i=Math.round(s*(this.width/this.height))}else{i=500;s=Math.round(i*(this.height/this.width))}t=e.replace(/\/(?=[^\/]*$)/,"/width/"+i+"/height/"+s+"/");this.$preview.attr("src",t).width(i).height(s)},initCropper:function(e){var t=this,i=this.$preview.width(),s=this.$preview.height(),a=i/this.width,l=s/this.height,r;if(!_.isArray(e)||e.length!==4){r=[10,10,i*.8,s*.8]}else{r=[Math.round(e[0]*a),Math.round(e[1]*l),Math.round(e[2]*a),Math.round(e[3]*l)]}this.$preview.Jcrop({aspectRatio:0,keySupport:false,trueSize:[this.width,this.height],setSelect:r,onSelect:f.proxy(this.setCropCoords,this),onChange:f.proxy(this.setCropCoords,this),onRelease:function(e){}},function(){var e=t.jcrop_api=this;if(t.aspect_ratio){t.$ar_checkboxes.each(function(){if(f(this).val()===t.aspect_ratio){f(this).click()}})}})},open:function(e,t,i,s,a,l){var r=this,o=f('
');this.width=t;this.height=i;this.aspect_ratio=a;if(!this.$overlay){this.init()}this.$overlay.overlay("open");this.setPreviewImage(e);if(l){this.$overlay.find("#lw_image_crop_ar").hide()}else{this.$overlay.find("#lw_image_crop_ar").show()}this.$preview.parent().imagesLoaded(function(){r.initCropper(s)})},save:function(){var e=this.coords,t;if(_.isPlainObject(e)&&_.keys(e).length===6){t=[e.x,e.y,e.x2,e.y2]}c.eventHub.trigger("cropSave",[t,this.aspect_ratio]);this.$overlay.overlay("close")},_close:function(){this.coords=null;this.aspect_ratio=null;this.$ar_checkboxes.prop("checked",false);if(this.jcrop_api){this.jcrop_api.destroy();this.jcrop_api=null}this.$preview.removeAttr("src")}};c.lib.CropDialog=function(e){var t=this,i,s,a,l;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;i='
'+'
'+'
'+''+''+''+''+''+''+''+"
"+"
"+'
'+''+"";a="
"+''+'or cancel and close'+"
";l=f(a);s=this.$overlay=f(i).overlay({autoOpen:false,destroyOnClose:false,size:"medium",closeSelector:".lw_cancel a",title:this.options.title,footer:l,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]");l.on("click",".btn-primary",function(e){e.preventDefault();t.saveCrop();return true});s.on("click","#lw_image_crop_ar input[type=checkbox]",function(){var e=f(this);if(e.prop("checked")){e.closest("label").siblings().find("input[type=checkbox]").prop("checked",false);t.setAspectRatio(e.val())}else{t.setAspectRatio("")}return true})};_.extend(c.lib.CropDialog.prototype,c.lib.pubSub(),{setAspectRatio:function(e){var t=0;this.aspect_ratio=e;if(e==="orig"){t=this.width/this.height}else if(e.match(/^\d+:\d+$/)){t=parseInt(e.split(":")[0],10)/parseInt(e.split(":")[1],10)}this.jcrop_api.setOptions({aspectRatio:t})},setCropSelect:function(e){this.jcrop_api.setSelect(e)},setCropCoords:function(e){this.coords=e;this.trigger("set",[{coords:e}])},setPreviewImage:function(e){var t,i,s;if(this.height>=this.width){s=500;i=Math.round(s*(this.width/this.height))}else{i=500;s=Math.round(i*(this.height/this.width))}t=e.replace(/\/(?=[^\/]*$)/,"/width/"+i+"/height/"+s+"/");this.$preview.attr("src",t).width(i).height(s)},initCropper:function(e){var t=this,i=this.$preview.width(),s=this.$preview.height(),a=i/this.width,l=s/this.height,r;if(!_.isArray(e)||e.length!==4){if(i>s){r=[(i-s)/2,0,(i-s)/2+s,s]}else{r=[0,(s-i)/2,i,(s-i)/2+i]}}else{r=[Math.round(e[0]*a),Math.round(e[1]*l),Math.round(e[2]*a),Math.round(e[3]*l)]}this.$preview.Jcrop({aspectRatio:0,keySupport:false,trueSize:[this.width,this.height],setSelect:r,onSelect:f.proxy(this.setCropCoords,this),onChange:f.proxy(this.setCropCoords,this),onRelease:function(e){}},function(){var e=t.jcrop_api=this;if(t.aspect_ratio){t.$ar_checkboxes.each(function(){if(f(this).val()===t.aspect_ratio){f(this).click()}})}})},open:function(e,t,i,s){var a=this,l=f('
');this.width=t;this.height=i;this.$overlay.overlay("open");this.setPreviewImage(e);this.$preview.parent().imagesLoaded(function(){a.initCropper(s)})},saveCrop:function(){var e=this.coords,t;if(_.isPlainObject(e)&&_.keys(e).length===6){t=[e.x,e.y,e.x2,e.y2]}this.trigger("save",[{coords:t,aspect_ratio:this.aspect_ratio}]);this.$overlay.overlay("close")},_close:function(){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")}});f(function(){c.whiteout=f('