!function(m){varl=wp.i18n.__,h=window.imageEdit={iasapi:{},hold:{},postid:"",_view:!1,handleCropToolClick:function(i,t,e){vara=m("#image-preview-"+i),o=this.iasapi.getSelection();isNaN(o.x1)&&(this.setCropSelection(i,{x1:0,y1:0,x2:a.innerWidth(),y2:a.innerHeight(),width:a.innerWidth(),height:a.innerHeight()}),o=this.iasapi.getSelection()),0===o.x1&&0===o.y1&&0===o.x2&&0===o.y2?(this.iasapi.setSelection(0,0,a.innerWidth(),a.innerHeight(),!0),this.iasapi.setOptions({show:!0}),this.iasapi.update()):h.crop(i,t,e)},intval:function(i){return0|i},setDisabled:function(i,t){t?i.removeClass("disabled").prop("disabled",!1):i.addClass("disabled").prop("disabled",!0)},init:function(i){vart=this,e=m("#image-editor-"+t.postid),a=t.intval(m("#imgedit-x-"+i).val()),o=t.intval(m("#imgedit-y-"+i).val());t.postid!==i&&e.length&&t.close(t.postid),t.hold.w=t.hold.ow=a,t.hold.h=t.hold.oh=o,t.hold.xy_ratio=a/o,t.hold.sizer=parseFloat(m("#imgedit-sizer-"+i).val()),t.postid=i,m("#imgedit-response-"+i).empty(),m('input[type="text"]',"#imgedit-panel-"+i).keypress(function(i){vart=i.keyCode;if(36<t&&t<41&&m(this).blur(),13===t)returni.preventDefault(),i.stopPropagation(),!1}),m(document).on("image-editor-ui-ready",this.focusManager)},toggleEditor:function(i,t,e){vara=m("#imgedit-wait-"+i);t?a.fadeIn("fast"):a.fadeOut("fast",function(){e&&m(document).trigger("image-editor-ui-ready")})},toggleHelp:function(i){vart=m(i);returnt.attr("aria-expanded","false"===t.attr("aria-expanded")?"true":"false").parents(".imgedit-group-top").toggleClass("imgedit-help-toggled").find(".imgedit-help").slideToggle("fast"),!1},getTarget:function(i){returnm('input[name="imgedit-target-'+i+'"]:checked',"#imgedit-save-target-"+i).val()||"full"},scaleChanged:function(i,t,e){vara=m("#imgedit-scale-width-"+i),o=m("#imgedit-scale-height-"+i),n=m("#imgedit-scale-warn-"+i),s="",d="";!1!==this.validateNumeric(e)&&(t?(d=""!==a.val()?Math.round(a.val()/this.hold.xy_ratio):"",o.val(d)):(s=""!==o.val()?Math.round(o.val()*this.hold.xy_ratio):"",a.val(s)),d&&d>this.hold.oh||s&&s>this.hold.ow?n.css("visibility","visible"):n.css("visibility","hidden"))},getSelRatio:function(i){vart=this.hold.w,e=this.hold.h,a=this.intval(m("#imgedit-crop-width-"+i).val()),o=this.intval(m("#imgedit-crop-height-"+i).val());returna&&o?a+":"+o:t&&e?t+":"+e:"1:1"},filterHistory:function(i,t){vare,a,o,n,s=m("#imgedit-history-"+i).val(),d=[];if(""===s)return"";if(s=JSON.parse(s),0<(e=this.intval(m("#imgedit-undone-"+i).val())))for(;0<e;)s.pop(),e--;if(t){if(!s.length)returnthis.hold.w=this.hold.ow,this.hold.h=this.hold.oh,"";(o=(o=s[s.length-1]).c||o.r||o.f||!1)&&(this.hold.w=o.fw,this.hold.h=o.fh)}for(ains)(n=s[a]).hasOwnProperty("c")?d[a]={c:{x:n.c.x,y:n.c.y,w:n.c.w,h:n.c.h}}:n.hasOwnProperty("r")?d[a]={r:n.r.r}:n.hasOwnProperty("f")&&(d[a]={f:n.f.f});returnJSON.stringify(d)},refreshEditor:function(s,i,d){vart,r,e=this;e.toggleEditor(s,1),t={action:"imgedit-preview",_ajax_nonce:i,postid:s,history:e.filterHistory(s,1),rand:e.intval(1e6*Math.random())},r=m('<img id="image-preview-'+s+'" alt="" />').on("load",{history:t.history},function(i){vart,e,a,o=m("#imgedit-crop-"+s),n=h;""!==i.data.history&&(a=JSON.parse(i.data.history))[a.length-1].hasOwnProperty("c")&&(n.setDisabled(m("#image-undo-"+s),!0),m("#image-undo-"+s).focus()),o.empty().append(r),t=Math.max(n.hold.w,n.hold.h),e=Math.max(m(r).width(),m(r).height()),n.hold.sizer=e<t?e/t:1,n.initCrop(s,r,o),null!=d&&d(),m("#imgedit-history-"+s).val()&&"0"===m("#imgedit-undone-"+s).val()?m("input.imgedit-submit-btn","#imgedit-panel-"+s).removeAttr("disabled"):m("input.imgedit-submit-btn","#imgedit-panel-"+s).prop("disabled",!0),n.toggleEditor(s,0)}).on("error",function(){vari=l("Could not load the preview image. Please reload the page and try again.");m("#imgedit-crop-"+s).empty().append('<div class="notice notice-error" tabindex="-1" role="alert"><p>'+i+"</p></div>"),e.toggleEditor(s,0,!0),wp.a11y.speak(i,"assertive")}).attr("src",ajaxurl+"?"+m.param(t))},action:function(t,i,e){vara,o,n,s,d,r=this;if(r.notsaved(t))return!1;if(a={action:"image-e