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