/*! Build based on gin-vue-admin Time : 1757946830000 */ !function(){function t(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var o,i,n,a,s=[],c=!0,h=!1;try{if(n=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(o=n.call(r)).done)&&(s.push(o.value),s.length!==e);c=!0);}catch(t){h=!0,i=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(h)throw i}}return s}}(t,r)||e(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){if(t){if("string"==typeof t)return r(t,e);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(t,e):void 0}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,o=Array(e);r=8&&(c=o+i)))),c)for(l=u.getUint16(c,n),p=0;p=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,c=!1;return{s:function(){o=o.call(t)},n:function(){var t=o.next();return s=t.done,t},e:function(t){c=!0,a=t},f:function(){try{s||null==o.return||o.return()}finally{if(c)throw a}}}}(o);try{for(a.s();!(i=a.n()).done;){var s=t(i.value,2),c=s[0],h=s[1];n[c]=h}}catch(p){a.e(p)}finally{a.f()}return n},v=i({data:function(){return{w:0,h:0,scale:1,x:0,y:0,loading:!0,trueWidth:0,trueHeight:0,move:!0,moveX:0,moveY:0,crop:!1,cropping:!1,cropW:0,cropH:0,cropOldW:0,cropOldH:0,canChangeX:!1,canChangeY:!1,changeCropTypeX:1,changeCropTypeY:1,cropX:0,cropY:0,cropChangeX:0,cropChangeY:0,cropOffsertX:0,cropOffsertY:0,support:"",touches:[],touchNow:!1,rotate:0,isIos:!1,orientation:0,imgs:"",coe:.2,scaling:!1,scalingSet:"",coeStatus:"",isCanShow:!0,imgIsQqualCrop:!1}},props:{img:{type:[String,Blob,null,File],default:""},outputSize:{type:Number,default:1},outputType:{type:String,default:"jpeg"},info:{type:Boolean,default:!0},canScale:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!1},autoCropWidth:{type:[Number,String],default:0},autoCropHeight:{type:[Number,String],default:0},fixed:{type:Boolean,default:!1},fixedNumber:{type:Array,default:function(){return[1,1]}},fixedBox:{type:Boolean,default:!1},full:{type:Boolean,default:!1},canMove:{type:Boolean,default:!0},canMoveBox:{type:Boolean,default:!0},original:{type:Boolean,default:!1},centerBox:{type:Boolean,default:!1},high:{type:Boolean,default:!0},infoTrue:{type:Boolean,default:!1},maxImgSize:{type:[Number,String],default:2e3},enlarge:{type:[Number,String],default:1},preW:{type:[Number,String],default:0},mode:{type:String,default:"contain"},limitMinSize:{type:[Number,Array,String],default:function(){return 10},validator:function(t){return Array.isArray(t)?Number(t[0])>=0&&Number(t[1])>=0:Number(t)>=0}},fillColor:{type:String,default:""}},computed:{cropInfo:function(){var t={};if(t.top=this.cropOffsertY>21?"-21px":"0px",t.width=this.cropW>0?this.cropW:0,t.height=this.cropH>0?this.cropH:0,this.infoTrue){var e=1;this.high&&!this.full&&(e=window.devicePixelRatio),1!==this.enlarge&!this.full&&(e=Math.abs(Number(this.enlarge))),t.width=t.width*e,t.height=t.height*e,this.full&&(t.width=t.width/this.scale,t.height=t.height/this.scale)}return t.width=t.width.toFixed(0),t.height=t.height.toFixed(0),t},isIE:function(){return!!window.ActiveXObject||"ActiveXObject"in window},passive:function(){return this.isIE?null:{passive:!1}},isRotateRightOrLeft:function(){return[1,-1,3,-3].includes(this.rotate)}},watch:{img:function(){this.checkedImg()},imgs:function(t){""!==t&&this.reload()},cropW:function(){this.showPreview()},cropH:function(){this.showPreview()},cropOffsertX:function(){this.showPreview()},cropOffsertY:function(){this.showPreview()},scale:function(t,e){this.showPreview()},x:function(){this.showPreview()},y:function(){this.showPreview()},autoCrop:function(t){t&&this.goAutoCrop()},autoCropWidth:function(){this.autoCrop&&this.goAutoCrop()},autoCropHeight:function(){this.autoCrop&&this.goAutoCrop()},mode:function(){this.checkedImg()},rotate:function(){this.showPreview(),(this.autoCrop||this.cropW>0||this.cropH>0)&&this.goAutoCrop(this.cropW,this.cropH)}},methods:{getVersion:function(t){for(var e=navigator.userAgent.split(" "),r="",o=new RegExp(t,"i"),i=0;i=81)e=-1;else if(this.getVersion("safari")[0]>=605){var n=this.getVersion("version");n[0]>13&&n[1]>1&&(e=-1)}else{var a=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(a){var s=a[1];((s=s.split("_"))[0]>13||s[0]>=13&&s[1]>=4)&&(e=-1)}}var c=document.createElement("canvas"),h=c.getContext("2d");switch(h.save(),e){case 2:c.width=r,c.height=o,h.translate(r,0),h.scale(-1,1);break;case 3:c.width=r,c.height=o,h.translate(r/2,o/2),h.rotate(180*Math.PI/180),h.translate(-r/2,-o/2);break;case 4:c.width=r,c.height=o,h.translate(0,o),h.scale(1,-1);break;case 5:c.height=r,c.width=o,h.rotate(.5*Math.PI),h.scale(1,-1);break;case 6:c.width=o,c.height=r,h.translate(o/2,r/2),h.rotate(90*Math.PI/180),h.translate(-r/2,-o/2);break;case 7:c.height=r,c.width=o,h.rotate(.5*Math.PI),h.translate(r,-o),h.scale(-1,1);break;case 8:c.height=r,c.width=o,h.translate(o/2,r/2),h.rotate(-90*Math.PI/180),h.translate(-r/2,-o/2);break;default:c.width=r,c.height=o}h.drawImage(t,0,0,r,o),h.restore(),c.toBlob(function(t){var e=URL.createObjectURL(t);URL.revokeObjectURL(i.imgs),i.imgs=e},"image/"+this.outputType,1)},checkedImg:function(){var t=this;if(null===this.img||""===this.img)return this.imgs="",void this.clearCrop();this.loading=!0,this.scale=1,this.rotate=0,this.imgIsQqualCrop=!1,this.clearCrop();var e=new Image;if(e.onload=function(){if(""===t.img)return t.$emit("img-load",new Error("图片不能为空")),!1;var r=e.width,o=e.height;d.getData(e).then(function(i){t.orientation=i.orientation||1;var n=Number(t.maxImgSize);!t.orientation&&rn&&(o=o/r*n,r=n),o>n&&(r=r/o*n,o=n),t.checkOrientationImage(e,t.orientation,r,o))}).catch(function(e){t.$emit("img-load","error"),t.$emit("img-load-error",e)})},e.onerror=function(e){t.$emit("img-load","error"),t.$emit("img-load-error",e)},"data"!==this.img.substr(0,4)&&(e.crossOrigin=""),this.isIE){var r=new XMLHttpRequest;r.onload=function(){var t=URL.createObjectURL(this.response);e.src=t},r.open("GET",this.img,!0),r.responseType="blob",r.send()}else e.src=this.img},startMove:function(t){if(t.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;this.moveX=("clientX"in t?t.clientX:t.touches[0].clientX)-this.x,this.moveY=("clientY"in t?t.clientY:t.touches[0].clientY)-this.y,t.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),2==t.touches.length&&(this.touches=t.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale))):(window.addEventListener("mousemove",this.moveImg),window.addEventListener("mouseup",this.leaveImg)),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})}else this.cropping=!0,window.addEventListener("mousemove",this.createCrop),window.addEventListener("mouseup",this.endCrop),window.addEventListener("touchmove",this.createCrop),window.addEventListener("touchend",this.endCrop),this.cropOffsertX=t.offsetX?t.offsetX:t.touches[0].pageX-this.$refs.cropper.offsetLeft,this.cropOffsertY=t.offsetY?t.offsetY:t.touches[0].pageY-this.$refs.cropper.offsetTop,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.touches[0].clientY,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.cropW=0,this.cropH=0},touchScale:function(t){var e=this;t.preventDefault();var r=this.scale,o=this.touches[0].clientX,i=this.touches[0].clientY,n=t.touches[0].clientX,a=t.touches[0].clientY,s=this.touches[1].clientX,c=this.touches[1].clientY,h=t.touches[1].clientX,p=t.touches[1].clientY,u=Math.sqrt(Math.pow(o-s,2)+Math.pow(i-c,2)),l=Math.sqrt(Math.pow(n-h,2)+Math.pow(a-p,2))-u,f=1,d=(f=(f=f/this.trueWidth>f/this.trueHeight?f/this.trueHeight:f/this.trueWidth)>.1?.1:f)*l;if(!this.touchNow){if(this.touchNow=!0,l>0?r+=Math.abs(d):l<0&&r>Math.abs(d)&&(r-=Math.abs(d)),this.touches=t.touches,setTimeout(function(){e.touchNow=!1},8),!this.checkoutImgAxis(this.x,this.y,r))return!1;this.scale=r}},cancelTouchScale:function(t){window.removeEventListener("touchmove",this.touchScale)},moveImg:function(t){var e=this;if(t.preventDefault(),t.touches&&2===t.touches.length)return this.touches=t.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;var r,o,i="clientX"in t?t.clientX:t.touches[0].clientX,n="clientY"in t?t.clientY:t.touches[0].clientY;r=i-this.moveX,o=n-this.moveY,this.$nextTick(function(){if(e.centerBox){var t,i,n,a,s=e.getImgAxis(r,o,e.scale),c=e.getCropAxis(),h=e.trueHeight*e.scale,p=e.trueWidth*e.scale;switch(e.rotate){case 1:case-1:case 3:case-3:t=e.cropOffsertX-e.trueWidth*(1-e.scale)/2+(h-p)/2,i=e.cropOffsertY-e.trueHeight*(1-e.scale)/2+(p-h)/2,n=t-h+e.cropW,a=i-p+e.cropH;break;default:t=e.cropOffsertX-e.trueWidth*(1-e.scale)/2,i=e.cropOffsertY-e.trueHeight*(1-e.scale)/2,n=t-p+e.cropW,a=i-h+e.cropH}s.x1>=c.x1&&(r=t),s.y1>=c.y1&&(o=i),s.x2<=c.x2&&(r=n),s.y2<=c.y2&&(o=a)}e.x=r,e.y=o,e.$emit("img-moving",{moving:!0,axis:e.getImgAxis()})})},leaveImg:function(t){window.removeEventListener("mousemove",this.moveImg),window.removeEventListener("touchmove",this.moveImg),window.removeEventListener("mouseup",this.leaveImg),window.removeEventListener("touchend",this.leaveImg),this.$emit("img-moving",{moving:!1,axis:this.getImgAxis()})},scaleImg:function(){this.canScale&&window.addEventListener(this.support,this.changeSize,this.passive)},cancelScale:function(){this.canScale&&window.removeEventListener(this.support,this.changeSize)},changeSize:function(t){var e=this;t.preventDefault();var r=this.scale,o=t.deltaY||t.wheelDelta;o=navigator.userAgent.indexOf("Firefox")>0?30*o:o,this.isIE&&(o=-o);var i=this.coe,n=(i=i/this.trueWidth>i/this.trueHeight?i/this.trueHeight:i/this.trueWidth)*o;n<0?r+=Math.abs(n):r>Math.abs(n)&&(r-=Math.abs(n));var a=n<0?"add":"reduce";if(a!==this.coeStatus&&(this.coeStatus=a,this.coe=.2),this.scaling||(this.scalingSet=setTimeout(function(){e.scaling=!1,e.coe=e.coe+=.01},50)),this.scaling=!0,!this.checkoutImgAxis(this.x,this.y,r))return!1;this.scale=r},changeScale:function(t){var e=this.scale;t=t||1;var r=20;if((t*=r=r/this.trueWidth>r/this.trueHeight?r/this.trueHeight:r/this.trueWidth)>0?e+=Math.abs(t):e>Math.abs(t)&&(e-=Math.abs(t)),!this.checkoutImgAxis(this.x,this.y,e))return!1;this.scale=e},createCrop:function(t){var e=this;t.preventDefault();var r="clientX"in t?t.clientX:t.touches?t.touches[0].clientX:0,o="clientY"in t?t.clientY:t.touches?t.touches[0].clientY:0;this.$nextTick(function(){var t=r-e.cropX,i=o-e.cropY;if(t>0?(e.cropW=t+e.cropChangeX>e.w?e.w-e.cropChangeX:t,e.cropOffsertX=e.cropChangeX):(e.cropW=e.w-e.cropChangeX+Math.abs(t)>e.w?e.cropChangeX:Math.abs(t),e.cropOffsertX=e.cropChangeX+t>0?e.cropChangeX+t:0),e.fixed){var n=e.cropW/e.fixedNumber[0]*e.fixedNumber[1];n+e.cropOffsertY>e.h?(e.cropH=e.h-e.cropOffsertY,e.cropW=e.cropH/e.fixedNumber[1]*e.fixedNumber[0],e.cropOffsertX=t>0?e.cropChangeX:e.cropChangeX-e.cropW):e.cropH=n,e.cropOffsertY=e.cropOffsertY}else i>0?(e.cropH=i+e.cropChangeY>e.h?e.h-e.cropChangeY:i,e.cropOffsertY=e.cropChangeY):(e.cropH=e.h-e.cropChangeY+Math.abs(i)>e.h?e.cropChangeY:Math.abs(i),e.cropOffsertY=e.cropChangeY+i>0?e.cropChangeY+i:0)})},changeCropSize:function(t,e,r,o,i){t.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=e,this.canChangeY=r,this.changeCropTypeX=o,this.changeCropTypeY=i,this.cropX="clientX"in t?t.clientX:t.touches[0].clientX,this.cropY="clientY"in t?t.clientY:t.touches[0].clientY,this.cropOldW=this.cropW,this.cropOldH=this.cropH,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.fixed&&this.canChangeX&&this.canChangeY&&(this.canChangeY=0),this.$emit("change-crop-size",{width:this.cropW,height:this.cropH})},changeCropNow:function(e){var r=this;e.preventDefault();var o="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,i="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0,n=this.w,a=this.h,s=0,c=0;if(this.centerBox){var h=this.getImgAxis(),p=h.x2,u=h.y2;s=h.x1>0?h.x1:0,c=h.y1>0?h.y1:0,n>p&&(n=p),a>u&&(a=u)}var l=t(this.checkCropLimitSize(),2),f=l[0],d=l[1];this.$nextTick(function(){var t=o-r.cropX,e=i-r.cropY;if(r.canChangeX&&(1===r.changeCropTypeX?r.cropOldW-t0?(r.cropW=n-r.cropChangeX-t<=n-s?r.cropOldW-t:r.cropOldW+r.cropChangeX-s,r.cropOffsertX=n-r.cropChangeX-t<=n-s?r.cropChangeX+t:s):(r.cropW=Math.abs(t)+r.cropChangeX<=n?Math.abs(t)-r.cropOldW:n-r.cropOldW-r.cropChangeX,r.cropOffsertX=r.cropChangeX+r.cropOldW):2===r.changeCropTypeX&&(r.cropOldW+t0?(r.cropW=r.cropOldW+t+r.cropOffsertX<=n?r.cropOldW+t:n-r.cropOffsertX,r.cropOffsertX=r.cropChangeX):(r.cropW=n-r.cropChangeX+Math.abs(t+r.cropOldW)<=n-s?Math.abs(t+r.cropOldW):r.cropChangeX-s,r.cropOffsertX=n-r.cropChangeX+Math.abs(t+r.cropOldW)<=n-s?r.cropChangeX-Math.abs(t+r.cropOldW):s))),r.canChangeY&&(1===r.changeCropTypeY?r.cropOldH-e0?(r.cropH=a-r.cropChangeY-e<=a-c?r.cropOldH-e:r.cropOldH+r.cropChangeY-c,r.cropOffsertY=a-r.cropChangeY-e<=a-c?r.cropChangeY+e:c):(r.cropH=Math.abs(e)+r.cropChangeY<=a?Math.abs(e)-r.cropOldH:a-r.cropOldH-r.cropChangeY,r.cropOffsertY=r.cropChangeY+r.cropOldH):2===r.changeCropTypeY&&(r.cropOldH+e0?(r.cropH=r.cropOldH+e+r.cropOffsertY<=a?r.cropOldH+e:a-r.cropOffsertY,r.cropOffsertY=r.cropChangeY):(r.cropH=a-r.cropChangeY+Math.abs(e+r.cropOldH)<=a-c?Math.abs(e+r.cropOldH):r.cropChangeY-c,r.cropOffsertY=a-r.cropChangeY+Math.abs(e+r.cropOldH)<=a-c?r.cropChangeY-Math.abs(e+r.cropOldH):c))),r.canChangeX&&r.fixed){var h=r.cropW/r.fixedNumber[0]*r.fixedNumber[1];ha?(r.cropH=a-r.cropOffsertY,r.cropW=r.cropH/r.fixedNumber[1]*r.fixedNumber[0],1===r.changeCropTypeX&&(r.cropOffsertX=r.cropChangeX+(r.cropOldW-r.cropW))):r.cropH=h}if(r.canChangeY&&r.fixed){var p=r.cropH/r.fixedNumber[1]*r.fixedNumber[0];pn?(r.cropW=n-r.cropOffsertX,r.cropH=r.cropW/r.fixedNumber[0]*r.fixedNumber[1]):r.cropW=p}})},checkCropLimitSize:function(){this.cropW,this.cropH;var t=this.limitMinSize,e=new Array;return e=Array.isArray(t)?t:[t,t],[parseFloat(e[0]),parseFloat(e[1])]},changeCropEnd:function(t){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},calculateSize:function(t,e,r,o,i,n){var a=t/e,s=i,c=n;return sthis.cropW&&(this.cropW=n,this.cropOffsertX+n>this.w&&(this.cropOffsertX=this.w-n)),a>this.cropH&&(this.cropH=a,this.cropOffsertY+a>this.h&&(this.cropOffsertY=this.h-a)),window.removeEventListener("mousemove",this.createCrop),window.removeEventListener("mouseup",this.endCrop),window.removeEventListener("touchmove",this.createCrop),window.removeEventListener("touchend",this.endCrop)},startCrop:function(){this.crop=!0},stopCrop:function(){this.crop=!1},clearCrop:function(){this.cropping=!1,this.cropW=0,this.cropH=0},cropMove:function(t){if(t.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(t),!1;if(t.touches&&2===t.touches.length)return this.crop=!1,this.startMove(t),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);var e,r,o="clientX"in t?t.clientX:t.touches[0].clientX,i="clientY"in t?t.clientY:t.touches[0].clientY;e=o-this.cropOffsertX,r=i-this.cropOffsertY,this.cropX=e,this.cropY=r,this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop:function(t,e){var r=this,o=0,i=0;t&&(t.preventDefault(),o="clientX"in t?t.clientX:t.touches[0].clientX,i="clientY"in t?t.clientY:t.touches[0].clientY),this.$nextTick(function(){var t,n,a=o-r.cropX,s=i-r.cropY;if(e&&(a=r.cropOffsertX,s=r.cropOffsertY),t=a<=0?0:a+r.cropW>r.w?r.w-r.cropW:a,n=s<=0?0:s+r.cropH>r.h?r.h-r.cropH:s,r.centerBox){var c=r.getImgAxis();t<=c.x1&&(t=c.x1),t+r.cropW>c.x2&&(t=c.x2-r.cropW),n<=c.y1&&(n=c.y1),n+r.cropH>c.y2&&(n=c.y2-r.cropH)}r.cropOffsertX=t,r.cropOffsertY=n,r.$emit("crop-moving",{moving:!0,axis:r.getCropAxis()})})},getImgAxis:function(t,e,r){t=t||this.x,e=e||this.y,r=r||this.scale;var o={x1:0,x2:0,y1:0,y2:0},i=this.trueWidth*r,n=this.trueHeight*r;switch(this.rotate){case 0:o.x1=t+this.trueWidth*(1-r)/2,o.x2=o.x1+this.trueWidth*r,o.y1=e+this.trueHeight*(1-r)/2,o.y2=o.y1+this.trueHeight*r;break;case 1:case-1:case 3:case-3:o.x1=t+this.trueWidth*(1-r)/2+(i-n)/2,o.x2=o.x1+this.trueHeight*r,o.y1=e+this.trueHeight*(1-r)/2+(n-i)/2,o.y2=o.y1+this.trueWidth*r;break;default:o.x1=t+this.trueWidth*(1-r)/2,o.x2=o.x1+this.trueWidth*r,o.y1=e+this.trueHeight*(1-r)/2,o.y2=o.y1+this.trueHeight*r}return o},getCropAxis:function(){var t={x1:0,x2:0,y1:0,y2:0};return t.x1=this.cropOffsertX,t.x2=t.x1+this.cropW,t.y1=this.cropOffsertY,t.y2=t.y1+this.cropH,t},leaveCrop:function(t){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.$emit("crop-moving",{moving:!1,axis:this.getCropAxis()})},getCropChecked:function(t){var e=this,r=document.createElement("canvas"),o=r.getContext("2d"),i=new Image,n=this.rotate,a=this.trueWidth,s=this.trueHeight,c=this.cropOffsertX,h=this.cropOffsertY;i.onload=function(){if(0!==e.cropW){var p=1;e.high&!e.full&&(p=window.devicePixelRatio),1!==e.enlarge&!e.full&&(p=Math.abs(Number(e.enlarge)));var l=e.cropW*p,f=e.cropH*p,d=a*e.scale*p,g=s*e.scale*p,v=(e.x-c+e.trueWidth*(1-e.scale)/2)*p,m=(e.y-h+e.trueHeight*(1-e.scale)/2)*p;switch(u(l,f),o.save(),n){case 0:e.full?(u(l/e.scale,f/e.scale),o.drawImage(i,v/e.scale,m/e.scale,d/e.scale,g/e.scale)):o.drawImage(i,v,m,d,g);break;case 1:case-3:e.full?(u(l/e.scale,f/e.scale),v=v/e.scale+(d/e.scale-g/e.scale)/2,m=m/e.scale+(g/e.scale-d/e.scale)/2,o.rotate(90*n*Math.PI/180),o.drawImage(i,m,-v-g/e.scale,d/e.scale,g/e.scale)):(v+=(d-g)/2,m+=(g-d)/2,o.rotate(90*n*Math.PI/180),o.drawImage(i,m,-v-g,d,g));break;case 2:case-2:e.full?(u(l/e.scale,f/e.scale),o.rotate(90*n*Math.PI/180),v/=e.scale,m/=e.scale,o.drawImage(i,-v-d/e.scale,-m-g/e.scale,d/e.scale,g/e.scale)):(o.rotate(90*n*Math.PI/180),o.drawImage(i,-v-d,-m-g,d,g));break;case 3:case-1:e.full?(u(l/e.scale,f/e.scale),v=v/e.scale+(d/e.scale-g/e.scale)/2,m=m/e.scale+(g/e.scale-d/e.scale)/2,o.rotate(90*n*Math.PI/180),o.drawImage(i,-m-d/e.scale,v,d/e.scale,g/e.scale)):(v+=(d-g)/2,m+=(g-d)/2,o.rotate(90*n*Math.PI/180),o.drawImage(i,-m-d,v,d,g));break;default:e.full?(u(l/e.scale,f/e.scale),o.drawImage(i,v/e.scale,m/e.scale,d/e.scale,g/e.scale)):o.drawImage(i,v,m,d,g)}o.restore()}else{var w=a*e.scale,x=s*e.scale;switch(o.save(),n){case 0:u(w,x),o.drawImage(i,0,0,w,x);break;case 1:case-3:u(x,w),o.rotate(90*n*Math.PI/180),o.drawImage(i,0,-x,w,x);break;case 2:case-2:u(w,x),o.rotate(90*n*Math.PI/180),o.drawImage(i,-w,-x,w,x);break;case 3:case-1:u(x,w),o.rotate(90*n*Math.PI/180),o.drawImage(i,-w,0,w,x);break;default:u(w,x),o.drawImage(i,0,0,w,x)}o.restore()}t(r)},"data"!==this.img.substr(0,4)&&(i.crossOrigin="Anonymous"),i.src=this.imgs;var p=this.fillColor;function u(t,e){r.width=Math.round(t),r.height=Math.round(e),p&&(o.fillStyle=p,o.fillRect(0,0,r.width,r.height))}},getCropData:function(t){var e=this;this.getCropChecked(function(r){t(r.toDataURL("image/"+e.outputType,e.outputSize))})},getCropBlob:function(t){var e=this;this.getCropChecked(function(r){r.toBlob(function(e){return t(e)},"image/"+e.outputType,e.outputSize)})},showPreview:function(){var t=this;if(!this.isCanShow)return!1;this.isCanShow=!1,setTimeout(function(){t.isCanShow=!0},16);var e=this.cropW,r=this.cropH,o=this.scale,i={};i.div={width:"".concat(e,"px"),height:"".concat(r,"px")};var n=(this.x-this.cropOffsertX)/o,a=(this.y-this.cropOffsertY)/o;i.w=e,i.h=r,i.url=this.imgs,i.img={width:"".concat(this.trueWidth,"px"),height:"".concat(this.trueHeight,"px"),transform:"scale(".concat(o,")translate3d(").concat(n,"px, ").concat(a,"px, ").concat(0,"px)rotateZ(").concat(90*this.rotate,"deg)")},i.html='\n
\n
\n \n
\n
'),this.$emit("real-time",i)},reload:function(){var t=this,e=new Image;e.onload=function(){t.w=parseFloat(window.getComputedStyle(t.$refs.cropper).width),t.h=parseFloat(window.getComputedStyle(t.$refs.cropper).height),t.trueWidth=e.width,t.trueHeight=e.height,t.original?t.scale=1:t.scale=t.checkedMode(),t.$nextTick(function(){t.x=-(t.trueWidth-t.trueWidth*t.scale)/2+(t.w-t.trueWidth*t.scale)/2,t.y=-(t.trueHeight-t.trueHeight*t.scale)/2+(t.h-t.trueHeight*t.scale)/2,t.loading=!1,t.autoCrop&&t.goAutoCrop(),t.$emit("img-load","success"),setTimeout(function(){t.showPreview()},20)})},e.onerror=function(){t.$emit("img-load","error")},e.src=this.imgs},checkedMode:function(){var t=1,e=(this.trueWidth,this.trueHeight),r=this.mode.split(" ");switch(r[0]){case"contain":this.trueWidth>this.w&&(t=this.w/this.trueWidth),this.trueHeight*t>this.h&&(t=this.h/this.trueHeight);break;case"cover":(e*=t=this.w/this.trueWidth)0,n=(i?this.trueHeight:this.trueWidth)*this.scale,a=(i?this.trueWidth:this.trueHeight)*this.scale;r=nr?r:s,c=c>o?o:c,this.fixed&&(c=s/this.fixedNumber[0]*this.fixedNumber[1]),c>this.h&&(s=(c=this.h)/this.fixedNumber[1]*this.fixedNumber[0]),this.changeCrop(s,c)}},changeCrop:function(t,e){var r=this;if(this.centerBox){var o=this.getImgAxis();t>o.x2-o.x1&&(e=(t=o.x2-o.x1)/this.fixedNumber[0]*this.fixedNumber[1]),e>o.y2-o.y1&&(t=(e=o.y2-o.y1)/this.fixedNumber[1]*this.fixedNumber[0])}this.cropW=t,this.cropH=e,this.checkCropLimitSize(),this.$nextTick(function(){r.cropOffsertX=(r.w-r.cropW)/2,r.cropOffsertY=(r.h-r.cropH)/2,r.centerBox&&r.moveCrop(null,!0)})},refresh:function(){var t=this;this.img,this.imgs="",this.scale=1,this.crop=!1,this.rotate=0,this.w=0,this.h=0,this.trueWidth=0,this.trueHeight=0,this.imgIsQqualCrop=!1,this.clearCrop(),this.$nextTick(function(){t.checkedImg()})},rotateLeft:function(){this.rotate=this.rotate<=-3?0:this.rotate-1},rotateRight:function(){this.rotate=this.rotate>=3?0:this.rotate+1},rotateClear:function(){this.rotate=0},checkoutImgAxis:function(t,e,r){t=t||this.x,e=e||this.y,r=r||this.scale;var o=!0;if(this.centerBox){var i=this.getImgAxis(t,e,r),n=this.getCropAxis();i.x1>=n.x1&&(o=!1),i.x2<=n.x2&&(o=!1),i.y1>=n.y1&&(o=!1),i.y2<=n.y2&&(o=!1),o||this.changeImgScale(i,n,r)}return o},changeImgScale:function(t,e,r){var o=this.trueWidth,i=this.trueHeight,n=o*r,a=i*r;if(n>=this.cropW&&a>=this.cropH)this.scale=r;else{var s=this.cropW/o,c=this.cropH/i,h=this.cropH<=i*s?s:c;this.scale=h,n=o*h,a=i*h}this.imgIsQqualCrop||(t.x1>=e.x1&&(this.isRotateRightOrLeft?this.x=e.x1-(o-n)/2-(n-a)/2:this.x=e.x1-(o-n)/2),t.x2<=e.x2&&(this.isRotateRightOrLeft?this.x=e.x1-(o-n)/2-(n-a)/2-a+this.cropW:this.x=e.x2-(o-n)/2-n),t.y1>=e.y1&&(this.isRotateRightOrLeft?this.y=e.y1-(i-a)/2-(a-n)/2:this.y=e.y1-(i-a)/2),t.y2<=e.y2&&(this.isRotateRightOrLeft?this.y=e.y2-(i-a)/2-(a-n)/2-n:this.y=e.y2-(i-a)/2-a)),(n