text: !function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],b):b(a.$)}(this,function(a){"use strict";function b(a){return"number"==typeof a&&!isNaN(a)}function c(a){return"undefined"==typeof a}function d(a,c){var d=[];return b(c)&&d.push(c),d.slice.apply(a,d)}function e(a,b){for(var c=arguments.length,e=Array(c>2?c-2:0),f=2;c>f;f++)e[f-2]=arguments[f];return function(){for(var c=arguments.length,f=Array(c),g=0;c>g;g++)f[g]=arguments[g];return a.apply(b,e.concat(d(f)))}}function f(b){var c=[];return a.each(b,function(a){c.push(a)}),c}function g(a){var b=a.match(/^(https?:)\/\/([^:/?#]+):?(\d*)/i);return b&&(b[1]!==location.protocol||b[2]!==location.hostname||b[3]!==location.port)}function h(a){var b="timestamp="+(new Date).getTime();return a+(-1===a.indexOf("?")?"?":"&")+b}function i(a){return a?' crossOrigin="'+a+'"':""}function j(a,b){if(a.naturalWidth&&!z)return void b(a.naturalWidth,a.naturalHeight);var c=document.createElement("img");c.onload=function(){b(this.width,this.height)},c.src=a.src}function k(a){var c=[],d=a.translateX,e=a.translateY,f=a.rotate,g=a.scaleX,h=a.scaleY;return b(d)&&0!==d&&c.push("translateX("+d+"px)"),b(e)&&0!==e&&c.push("translateY("+e+"px)"),b(f)&&0!==f&&c.push("rotate("+f+"deg)"),b(g)&&1!==g&&c.push("scaleX("+g+")"),b(h)&&1!==h&&c.push("scaleY("+h+")"),c.length?c.join(" "):"none"}function l(a,b){var c=Math.abs(a.degree)%180,d=(c>90?180-c:c)*Math.PI/180,e=Math.sin(d),f=Math.cos(d),g=a.width,h=a.height,i=a.aspectRatio,j=void 0,k=void 0;return b?(j=g/(f+e/i),k=j/i):(j=g*f+h*e,k=g*e+h*f),{width:j,height:k}}function m(c,d){var e=a("<canvas>")[0],f=e.getContext("2d"),g=0,h=0,i=d.naturalWidth,j=d.naturalHeight,k=d.rotate,m=d.scaleX,n=d.scaleY,o=b(m)&&b(n)&&(1!==m||1!==n),p=b(k)&&0!==k,q=p||o,r=i*Math.abs(m||1),s=j*Math.abs(n||1),t=void 0,u=void 0,v=void 0;return o&&(t=r/2,u=s/2),p&&(v=l({width:r,height:s,degree:k}),r=v.width,s=v.height,t=r/2,u=s/2),e.width=r,e.height=s,q&&(g=-i/2,h=-j/2,f.save(),f.translate(t,u)),p&&f.rotate(k*Math.PI/180),o&&f.scale(m,n),f.drawImage(c,Math.floor(g),Math.floor(h),Math.floor(i),Math.floor(j)),q&&f.restore(),e}function n(a,b,c){var d="",e=void 0;for(e=b,c+=b;c>e;e++)d+=A(a.getUint8(e));return d}function o(a){var b=new DataView(a),c=b.byteLength,d=void 0,e=void 0,f=void 0,g=void 0,h=void 0,i=void 0,j=void 0,k=void 0,l=void 0,m=void 0;if(255===b.getUint8(0)&&216===b.getUint8(1))for(l=2;c>l;){if(255===b.getUint8(l)&&225===b.getUint8(l+1)){j=l;break}l++}if(j&&(e=j+4,f=j+10,"Exif"===n(b,e,4)&&(i=b.getUint16(f),h=18761===i,(h||19789===i)&&42===b.getUint16(f+2,h)&&(g=b.getUint32(f+4,h),g>=8&&(k=f+g)))),k)for(c=b.getUint16(k,h),m=0;c>m;m++)if(l=k+12*m+2,274===b.getUint16(l,h)){l+=8,d=b.getUint16(l,h),z&&b.setUint16(l,1,h);break}return d}function p(a){var b=a.replace(w,""),c=atob(b),d=c.length,e=new ArrayBuffer(d),f=new Uint8Array(e),g=void 0;for(g=0;d>g;g++)f[g]=c.charCodeAt(g);return e}function q(a){var b=new Uint8Array(a),c=b.length,d="",e=void 0;for(e=0;c>e;e++)d+=A(b[e]);return"data:image/jpeg;base64,"+btoa(d)}function r(b,c){var d=b.pageX,e=b.pageY,f={endX:d,endY:e};return c?f:a.extend({startX:d,startY:e},f)}function s(b){var c=a.extend({},b),d=[];return a.each(b,function(b,e){delete c[b],a.each(c,function(a,b){var c=Math.abs(e.startX-b.startX),f=Math.abs(e.startY-b.startY),g=Math.abs(e.endX-b.endX),h=Math.abs(e.endY-b.endY),i=Math.sqrt(c*c+f*f),j=Math.sqrt(g*g+h*h),k=(j-i)/i;d.push(k)})}),d.sort(function(a,b){return Math.abs(a)<Math.abs(b)}),d[0]}function t(b){var c=0,d=0,e=0;return a.each(b,function(a,b){var f=b.startX,g=b.startY;c+=f,d+=g,e+=1}),c/=e,d/=e,{pageX:c,pageY:d}}a="default"in a?a["default"]:a;var u={viewMode:0,dragMode:"crop",aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},v='<div class="cropper-container"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-action="e"></span><span class="cropper-line line-n" data-action="n"></span><span class="cropper-line line-w" data-action="w"></span><span class="cropper-line line-s" data-action="s"></span><span class="cropper-point point-e" data-action="e"></span><span class="cropper-point point-n" data-action="n"></span><span class="cropper-point point-w" data-action="w"></span><span class="cropper-point point-s" data-action="s"></span><span class="cropper-point point-ne" data-action="ne"></span><span class="cropper-point point-nw" data-action="nw"></span><span class="cropper-point point-sw" data-action="sw"></span><span class="cropper-point point-se" data-action="se"></span></div></div>',w=/^data:.*,/,x=/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i,y="undefined"!=typeof window?window.navigator:null,z=y&&x.test(y.userAgent),A=String.fromCharCode,B={render:function(){var a=this;a.initContainer(),a.initCanvas(),a.initCropBox(),a.renderCanvas(),a.cropped&&a.renderCropBox()},initContainer:function(){var a=this,b=a.options,c=a.$element,d=a.$container,e=a.$cropper,f="cropper-hidden";e.addClass(f),c.removeClass(f),e.css(a.container={width:Math.max(d.width(),Number(b.minContainerWidth)||200),height:Math.max(d.height(),Number(b.minContainerHeight)||100)}),c.addClass(f),e.removeClass(f)},initCanvas:function(){var b=this,c=b.options.viewMode,d=b.container,e=d.width,f=d.height,g=b.image,h=g.naturalWidth,i=g.naturalHeight,j=90===Math.abs(g.rotate),k=j?i:h,l=j?h:i,m=k/l,n=e,o=f;f*m>e?3===c?n=f*m:o=e/m:3===c?o=e/m:n=f*m;var p={naturalWidth:k,naturalHeight:l,aspectRatio:m,width:n,height:o};p.oldLeft=p.left=(e-n)/2,p.oldTop=p.top=(f-o)/2,b.canvas=p,b.limited=1===c||2===c,b.limitCanvas(!0,!0),b.initialImage=a.extend({},g),b.initialCanvas=a.extend({},p)},limitCanvas:function(a,b){var c=this,d=c.options,e=d.viewMode,f=c.container,g=f.width,h=f.height,i=c.canvas,j=i.aspectRatio,k=c.cropBox,l=c.cropped&&k;if(a){var m=Number(d.minCanvasWidth)||0,n=Number(d.minCanvasHeight)||0;e&&(e>1?(m=Math.max(m,g),n=Math.max(n,h),3===e&&(n*j>m?m=n*j:n=m/j)):m?m=Math.max(m,l?k.width:0):n?n=Math.max(n,l?k.height:0):l&&(m=k.width,n=k.height,n*j>m?m=n*j:n=m/j)),m&&n?n*j>m?n=m/j:m=n*j:m?n=m/j:n&&(m=n*j),i.minWidth=m,i.minHeight=n,i.maxWidth=1/0,i.maxHeight=1/0}if(b)if(e){var o=g-i.width,p=h-i.height;i.minLeft=Math.min(0,o),i.minTop=Math.min(0,p),i.maxLeft=Math.max(0,o),i.maxTop=Math.max(0,p),l&&c.limited&&(i.minLeft=Math.min(k.left,k.left+k.width-i.width),i.minTop=Math.min(k.top,k.top+k.height-i.height),i.maxLeft=k.left,i.maxTop=k.top,2===e&&(i.width>=g&&(i.minLeft=Math.min(0,o),i.maxLeft=Math.max(0,o)),i.height>=h&&(i.minTop=Math.min(0,p),i.maxTop=Math.max(0,p))))}else i.minLeft=-i.width,i.minTop=-i.height,i.maxLeft=g,i.maxTop=h},renderCanvas:function(a){var b=this,c=b.canvas,d=b.image,e=d.rotate,f=d.naturalWidth,g=d.naturalHeight;if(b.rotated){b.rotated=!1;var h=l({width:d.width,height:d.height,degree:e}),i=h.width/h.height,j=1===d.aspectRatio;if(j||i!==c.aspectRatio){if(c.left-=(h.width-c.width)/2,c.top-=(h.height-c.height)/2,c.width=h.width,c.height=h.height,c.aspectRatio=i,c.naturalWidth=f,c.naturalHeight=g,j&&e%90||e%180){var m=l({width:f,height:g,degree:e});c.naturalWidth=m.width,c.naturalHeight=m.height}b.limitCanvas(!0,!1)}}(c.width>c.maxWidth||c.width<c.minWidth)&&(c.left=c.oldLeft),(c.height>c.maxHeight||c.height<c.minHeight)&&(c.top=c.oldTop),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),b.limitCanvas(!1,!0),c.oldLeft=c.left=Math.min(Math.max(c.left,c.minLeft),c.maxLeft),c.oldTop=c.top=Math.min(Math.max(c.top,c.minTop),c.maxTop),b.$canvas.css({width:c.width,height:c.height,transform:k({translateX:c.left,translateY:c.top})}),b.renderImage(),b.cropped&&b.limited&&b.limitCropBox(!0,!0),a&&b.output()},renderImage:function(b){var c=this,d=c.canvas,e=c.image,f=void 0;e.rotate&&(f=l({width:d.width,height:d.height,degree:e.rotate,aspectRatio:e.aspectRatio},!0)),a.extend(e,f?{width:f.width,height:f.height,left:(d.width-f.width)/2,top:(d.height-f.height)/2}:{width:d.width,height:d.height,left:0,top:0}),c.$clone.css({width:e.width,height:e.height,transform:k(a.extend({translateX:e.left,translateY:e.top},e))}),b&&c.output()},initCropBox:function(){var b=this,c=b.options,d=b.canvas,e=c.aspectRatio,f=Number(c.autoCropArea)||.8,g={width:d.width,height:d.height};e&&(d.height*e>d.width?g.height=g.width/e:g.width=g.height*e),b.cropBox=g,b.limitCropBox(!0,!0),g.width=Math.min(Math.max(g.width,g.minWidth),g.maxWidth),g.height=Math.min(Math.max(g.height,g.minHeight),g.maxHeight),g.width=Math.max(g.minWidth,g.width*f),g.height=Math.max(g.minHeight,g.height*f),g.oldLeft=g.left=d.left+(d.width-g.width)/2,g.oldTop=g.top=d.top+(d.height-g.height)/2,b.initialCropBox=a.extend({},g)},limitCropBox:function(a,b){var c=this,d=c.options,e=d.aspectRatio,f=c.container,g=f.width,h=f.height,i=c.canvas,j=c.cropBox,k=c.limited;if(a){var l=Number(d.minCropBoxWidth)||0,m=Number(d.minCropBoxHeight)||0,n=Math.min(g,k?i.width:g),o=Math.min(h,k?i.height:h);l=Math.min(l,g),m=Math.min(m,h),e&&(l&&m?m*e>l?m=l/e:l=m*e:l?m=l/e:m&&(l=m*e),o*e>n?o=n/e:n=o*e),j.minWidth=Math.min(l,n),j.minHeight=Math.min(m,o),j.maxWidth=n,j.maxHeight=o}b&&(k?(j.minLeft=Math.max(0,i.left),j.minTop=Math.max(0,i.top),j.maxLeft=Math.min(g,i.left+i.width)-j.width,j.maxTop=Math.min(h,i.top+i.height)-j.height):(j.minLeft=0,j.minTop=0,j.maxLeft=g-j.width,j.maxTop=h-j.height))},renderCropBox:function(){var a=this,b=a.options,c=a.container,d=c.width,e=c.height,f=a.cropBox;(f.width>f.maxWidth||f.width<f.minWidth)&&(f.left=f.oldLeft),(f.height>f.maxHeight||f.height<f.minHeight)&&(f.top=f.oldTop),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),a.limitCropBox(!1,!0),f.oldLeft=f.left=Math.min(Math.max(f.left,f.minLeft),f.maxLeft),f.oldTop=f.top=Math.min(Math.max(f.top,f.minTop),f.maxTop),b.movable&&b.cropBoxMovable&&a.$face.data("action",f.width===d&&f.height===e?"move":"all"),a.$cropBox.css({width:f.width,height:f.height,transform:k({translateX:f.left,translateY:f.top})}),a.cropped&&a.limited&&a.limitCanvas(!0,!0),a.disabled||a.output()},output:function(){var a=this;a.preview(),a.completed&&a.trigger("crop",a.getData())}},C="preview",D={initPreview:function(){var b=this,c=i(b.crossOrigin),d=c?b.crossOriginUrl:b.url,e=void 0;b.$preview=a(b.options.preview),b.$clone2=e=a("<img "+c+' src="'+d+'">'),b.$viewBox.html(e),b.$preview.each(function(b,e){var f=a(e);f.data(C,{width:f.width(),height:f.height(),html:f.html()}),f.html("<img "+c+' src="'+d+'" style="display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;">')})},resetPreview:function(){this.$preview.each(function(b,c){var d=a(c),e=d.data(C);d.css({width:e.width,height:e.height}).html(e.html).removeData(C)})},preview:function(){var b=this,c=b.image,d=b.canvas,e=b.cropBox,f=e.width,g=e.height,h=c.width,i=c.height,j=e.left-d.left-c.left,l=e.top-d.top-c.top;b.cropped&&!b.disabled&&(b.$clone2.css({width:h,height:i,transform:k(a.extend({translateX:-j,translateY:-l},c))}),b.$preview.each(function(b,d){var e=a(d),m=e.data(C),n=m.width,o=m.height,p=n,q=o,r=1;f&&(r=n/f,q=g*r),g&&q>o&&(r=o/g,p=f*r,q=o),e.css({width:p,height:q}).find("img").css({width:h*r,height:i*r,transform:k(a.extend({translateX:-j*r,translateY:-l*r},c))})}))}},E="undefined"!=typeof window?window.PointerEvent:null,F=E?"pointerdown":"touchstart mousedown",G=E?"pointermove":"touchmove mousemove",H=E?" pointerup pointercancel":"touchend touchcancel mouseup",I="wheel mousewheel DOMMouseScroll",J="dblclick",K="resize",L="cropstart",M="cropmove",N="cropend",O="crop",P="zoom",Q={bind:function(){var b=this,c=b.options,d=b.$element,f=b.$cropper;a.isFunction(c.cropstart)&&d.on(L,c.cropstart),a.isFunction(c.cropmove)&&d.on(M,c.cropmove),a.isFunction(c.cropend)&&d.on(N,c.cropend),a.isFunction(c.crop)&&d.on(O,c.crop),a.isFunction(c.zoom)&&d.on(P,c.zoom),f.on(F,e(b.cropStart,this)),c.zoomable&&c.zoomOnWheel&&f.on(I,e(b.wheel,this)),c.toggleDragModeOnDblclick&&f.on(J,e(b.dblclick,this)),a(document).on(G,b.onCropMove=e(b.cropMove,this)).on(H,b.onCropEnd=e(b.cropEnd,this)),c.responsive&&a(window).on(K,b.onResize=e(b.resize,this))},unbind:function(){var b=this,c=b.options,d=b.$element,e=b.$cropper;a.isFunction(c.cropstart)&&d.off(L,c.cropstart),a.isFunction(c.cropmove)&&d.off(M,c.cropmove),a.isFunction(c.cropend)&&d.off(N,c.cropend),a.isFunction(c.crop)&&d.off(O,c.crop),a.isFunction(c.zoom)&&d.off(P,c.zoom),e.off(F,b.cropStart),c.zoomable&&c.zoomOnWheel&&e.off(I,b.wheel),c.toggleDragModeOnDblclick&&e.off(J,b.dblclick),a(document).off(G,b.onCropMove).off(H,b.onCropEnd),c.responsive&&a(window).off(K,b.onResize)}},R=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,S={resize:function(){var b=this,c=b.options,d=b.$container,e=b.container,f=Number(c.minContainerWidth)||200,g=Number(c.minContainerHeight)||100;if(!b.disabled&&e.width!==f&&e.height!==g){var h=d.width()/e.width;1===h&&d.height()===e.height||!function(){var d=void 0,e=void 0;c.restore&&(d=b.getCanvasData(),e=b.getCropBoxData()),b.render(),c.restore&&(b.setCanvasData(a.each(d,function(a,b){d[a]=b*h})),b.setCropBoxData(a.each(e,function(a,b){e[a]=b*h})))}()}},dblclick:function(){var a=this;a.disabled||"none"===a.options.dragMode||a.setDragMode(a.$dragBox.hasClass("cropper-crop")?"move":"crop")},wheel:function(a){var b=this,c=a.originalEvent||a,d=Number(b.options.wheelZoomRatio)||.1;if(!b.disabled&&(a.preventDefault(),!b.wheeling)){b.wheeling=!0,setTimeout(function(){b.wheeling=!1},50);var e=1;c.deltaY?e=c.deltaY>0?1:-1:c.wheelDelta?e=-c.wheelDelta/120:c.detail&&(e=c.detail>0?1:-1),b.zoom(-e*d,a)}},cropStart:function(b){var c=this;if(!c.disabled){var d=c.options,e=c.pointers,g=b.originalEvent,h=void 0;g&&g.changedTouches?a.each(g.changedTouches,function(a,b){e[b.identifier]=r(b)}):e[g&&g.pointerId||0]=r(g||b),h=f(e).length>1&&d.zoomable&&d.zoomOnTouch?"zoom":a(b.target).data("action"),R.test(h)&&(c.trigger("cropstart",{originalEvent:g,action:h}).isDefaultPrevented()||(b.preventDefault(),c.action=h,c.cropping=!1,"crop"===h&&(c.cropping=!0,c.$dragBox.addClass("cropper-modal"))))}},cropMove:function(b){var c=this,d=c.action;if(!c.disabled&&d){var e=c.pointers,f=b.originalEvent;b.preventDefault(),c.trigger("cropmove",{originalEvent:f,action:d}).isDefaultPrevented()||(f&&f.changedTouches?a.each(f.changedTouches,function(b,c){a.extend(e[c.identifier],r(c,!0))}):a.extend(e[f&&f.pointerId||0],r(f||b,!0)),c.change(b))}},cropEnd:function(b){var c=this;if(!c.disabled){var d=c.action,e=c.pointers,g=b.originalEvent;g&&g.changedTouches?a.each(g.changedTouches,function(a,b){delete e[b.identifier]}):delete e[g&&g.pointerId||0],d&&(b.preventDefault(),f(e).length||(c.action=""),c.cropping&&(c.cropping=!1,c.$dragBox.toggleClass("cropper-modal",c.cropped&&c.options.modal)),c.trigger("cropend",{originalEvent:g,action:d}))}}},T="e",U="w",V="s",W="n",X="se",Y="sw",Z="ne",$="nw",_={change:function(b){var c=this,d=c.options,e=c.pointers,g=e[f(e)[0]],h=c.container,i=c.canvas,j=c.cropBox,k=c.action,l=d.aspectRatio,m=j.width,n=j.height,o=j.left,p=j.top,q=o+m,r=p+n,t=0,u=0,v=h.width,w=h.height,x=!0,y=void 0;!l&&b.shiftKey&&(l=m&&n?m/n:1),c.limited&&(t=j.minLeft,u=j.minTop,v=t+Math.min(h.width,i.width,i.left+i.width),w=u+Math.min(h.height,i.height,i.top+i.height));var z={x:g.endX-g.startX,y:g.endY-g.startY};switch(l&&(z.X=z.y*l,z.Y=z.x/l),k){case"all":o+=z.x,p+=z.y;break;case T:if(z.x>=0&&(q>=v||l&&(u>=p||r>=w))){x=!1;break}m+=z.x,l&&(n=m/l,p-=z.Y/2),0>m&&(k=U,m=0);break;case W:if(z.y<=0&&(u>=p||l&&(t>=o||q>=v))){x=!1;break}n-=z.y,p+=z.y,l&&(m=n*l,o+=z.X/2),0>n&&(k=V,n=0);break;case U:if(z.x<=0&&(t>=o||l&&(u>=p||r>=w))){x=!1;break}m-=z.x,o+=z.x,l&&(n=m/l,p+=z.Y/2),0>m&&(k=T,m=0);break;case V:if(z.y>=0&&(r>=w||l&&(t>=o||q>=v))){x=!1;break}n+=z.y,l&&(m=n*l,o-=z.X/2),0>n&&(k=W,n=0);break;case Z:if(l){if(z.y<=0&&(u>=p||q>=v)){x=!1;break}n-=z.y,p+=z.y,m=n*l}else z.x>=0?v>q?m+=z.x:z.y<=0&&u>=p&&(x=!1):m+=z.x,z.y<=0?p>u&&(n-=z.y,p+=z.y):(n-=z.y,p+=z.y);0>m&&0>n?(k=Y,n=0,m=0):0>m?(k=$,m=0):0>n&&(k=X,n=0);break;case $:if(l){if(z.y<=0&&(u>=p||t>=o)){x=!1;break}n-=z.y,p+=z.y,m=n*l,o+=z.X}else z.x<=0?o>t?(m-=z.x,o+=z.x):z.y<=0&&u>=p&&(x=!1):(m-=z.x,o+=z.x),z.y<=0?p>u&&(n-=z.y,p+=z.y):(n-=z.y,p+=z.y);0>m&&0>n?(k=X,n=0,m=0):0>m?(k=Z,m=0):0>n&&(k=Y,n=0);break;case Y:if(l){if(z.x<=0&&(t>=o||r>=w)){x=!1;break}m-=z.x,o+=z.x,n=m/l}else z.x<=0?o>t?(m-=z.x,o+=z.x):z.y>=0&&r>=w&&(x=!1):(m-=z.x,o+=z.x),z.y>=0?w>r&&(n+=z.y):n+=z.y;0>m&&0>n?(k=Z,n=0,m=0):0>m?(k=X,m=0):0>n&&(k=$,n=0);break;case X:if(l){if(z.x>=0&&(q>=v||r>=w)){x=!1;break}m+=z.x,n=m/l}else z.x>=0?v>q?m+=z.x:z.y>=0&&r>=w&&(x=!1):m+=z.x,z.y>=0?w>r&&(n+=z.y):n+=z.y;0>m&&0>n?(k=$,n=0,m=0):0>m?(k=Y,m=0):0>n&&(k=Z,n=0);break;case"move":c.move(z.x,z.y),x=!1;break;case"zoom":c.zoom(s(e),b.originalEvent),x=!1;break;case"crop":if(!z.x||!z.y){x=!1;break}y=c.$cropper.offset(),o=g.startX-y.left,p=g.startY-y.top,m=j.minWidth,n=j.minHeight,z.x>0?k=z.y>0?X:Z:z.x<0&&(o-=m,k=z.y>0?Y:$),z.y<0&&(p-=n),c.cropped||(c.$cropBox.removeClass("cropper-hidden"),c.cropped=!0,c.limited&&c.limitCropBox(!0,!0))}x&&(j.width=m,j.height=n,j.left=o,j.top=p,c.action=k,c.renderCropBox()),a.each(e,function(a,b){b.startX=b.endX,b.startY=b.endY})}},aa=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},ba=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),ca=function(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)},da={crop:function(){var a=this;a.ready&&!a.disabled&&(a.cropped||(a.cropped=!0,a.limitCropBox(!0,!0),a.options.modal&&a.$dragBox.addClass("cropper-modal"),a.$cropBox.removeClass("cropper-hidden")),a.setCropBoxData(a.initialCropBox))},reset:function(){var b=this;b.ready&&!b.disabled&&(b.image=a.extend({},b.initialImage),b.canvas=a.extend({},b.initialCanvas),b.cropBox=a.extend({},b.initialCropBox),b.renderCanvas(),b.cropped&&b.renderCropBox())},clear:function(){var b=this;b.cropped&&!b.disabled&&(a.extend(b.cropBox,{left:0,top:0,width:0,height:0}),b.cropped=!1,b.renderCropBox(),b.limitCanvas(!0,!0),b.renderCanvas(),b.$dragBox.removeClass("cropper-modal"),b.$cropBox.addClass("cropper-hidden"))},replace:function(a,b){var c=this;!c.disabled&&a&&(c.isImg&&c.$element.attr("src",a),b?(c.url=a,c.$clone.attr("src",a),c.ready&&c.$preview.find("img").add(c.$clone2).attr("src",a)):(c.isImg&&(c.replaced=!0),c.options.data=null,c.load(a)))},enable:function(){var a=this;a.ready&&(a.disabled=!1,a.$cropper.removeClass("cropper-disabled"))},disable:function(){var a=this;a.ready&&(a.disabled=!0,a.$cropper.addClass("cropper-disabled"))},destroy:function(){var a=this,b=a.$element;a.loaded?(a.isImg&&a.replaced&&b.attr("src",a.originalUrl),a.unbuild(),b.removeClass("cropper-hidden")):a.isImg?b.off("load",a.start):a.$clone&&a.$clone.remove(),b.removeData("cropper")},move:function(a,b){var d=this,e=d.canvas;d.moveTo(c(a)?a:e.left+Number(a),c(b)?b:e.top+Number(b))},moveTo:function(a,d){var e=this,f=e.canvas,g=!1;c(d)&&(d=a),a=Number(a),d=Number(d),e.ready&&!e.disabled&&e.options.movable&&(b(a)&&(f.left=a,g=!0),b(d)&&(f.top=d,g=!0),g&&e.renderCanvas(!0))},zoom:function(a,b){var c=this,d=c.canvas;a=Number(a),a=0>a?1/(1-a):1+a,c.zoomTo(d.width*a/d.naturalWidth,b)},zoomTo:function(a,b){var c=this,d=c.options,e=c.pointers,g=c.canvas,h=g.width,i=g.height,j=g.naturalWidth,k=g.naturalHeight;if(a=Number(a),a>=0&&c.ready&&!c.disabled&&d.zoomable){var l=j*a,m=k*a,n=void 0;if(b&&(n=b.originalEvent),c.trigger("zoom",{originalEvent:n,oldRatio:h/j,ratio:l/j}).isDefaultPrevented())return;if(n){var o=c.$cropper.offset(),p=e&&f(e).length?t(e):{pageX:b.pageX||n.pageX||0,pageY:b.pageY||n.pageY||0};g.left-=(l-h)*((p.pageX-o.left-g.left)/h),g.top-=(m-i)*((p.pageY-o.top-g.top)/i)}else g.left-=(l-h)/2,g.top-=(m-i)/2;g.width=l,g.height=m,c.renderCanvas(!0)}},rotate:function(a){var b=this;b.rotateTo((b.image.rotate||0)+Number(a))},rotateTo:function(a){var c=this;a=Number(a),b(a)&&c.ready&&!c.disabled&&c.options.rotatable&&(c.image.rotate=a%360,c.rotated=!0,c.renderCanvas(!0))},scale:function(a,d){var e=this,f=e.image,g=!1;c(d)&&(d=a),a=Number(a),d=Number(d),e.ready&&!e.disabled&&e.options.scalable&&(b(a)&&(f.scaleX=a,g=!0),b(d)&&(f.scaleY=d,g=!0),g&&e.renderImage(!0))},scaleX:function(a){var c=this,d=c.image.scaleY;c.scale(a,b(d)?d:1)},scaleY:function(a){var c=this,d=c.image.scaleX;c.scale(b(d)?d:1,a)},getData:function(b){var c=this,d=c.options,e=c.image,f=c.canvas,g=c.cropBox,h=void 0,i=void 0;return c.ready&&c.cropped?(i={x:g.left-f.left,y:g.top-f.top,width:g.width,height:g.height},h=e.width/e.naturalWidth,a.each(i,function(a,c){c/=h,i[a]=b?Math.round(c):c})):i={x:0,y:0,width:0,height:0},d.rotatable&&(i.rotate=e.rotate||0),d.scalable&&(i.scaleX=e.scaleX||1,i.scaleY=e.scaleY||1),i},setData:function(c){var d=this,e=d.options,f=d.image,g=d.canvas,h={},i=void 0,j=void 0,k=void 0;a.isFunction(c)&&(c=c.call(d.element)),d.ready&&!d.disabled&&a.isPlainObject(c)&&(e.rotatable&&b(c.rotate)&&c.rotate!==f.rotate&&(f.rotate=c.rotate,d.rotated=i=!0),e.scalable&&(b(c.scaleX)&&c.scaleX!==f.scaleX&&(f.scaleX=c.scaleX,j=!0),b(c.scaleY)&&c.scaleY!==f.scaleY&&(f.scaleY=c.scaleY,j=!0)),i?d.renderCanvas():j&&d.renderImage(),k=f.width/f.naturalWidth,b(c.x)&&(h.left=c.x*k+g.left),b(c.y)&&(h.top=c.y*k+g.top),b(c.width)&&(h.width=c.width*k),b(c.height)&&(h.height=c.height*k),d.setCropBoxData(h))},getContainerData:function(){return this.ready?this.container:{}},getImageData:function(){return this.loaded?this.image:{}},getCanvasData:function(){var b=this,c=b.canvas,d={};return b.ready&&a.each(["left","top","width","height","naturalWidth","naturalHeight"],function(a,b){d[b]=c[b]}),d},setCanvasData:function(c){var d=this,e=d.canvas,f=e.aspectRatio;a.isFunction(c)&&(c=c.call(d.$element)),d.ready&&!d.disabled&&a.isPlainObject(c)&&(b(c.left)&&(e.left=c.left),b(c.top)&&(e.top=c.top),b(c.width)?(e.width=c.width,e.height=c.width/f):b(c.height)&&(e.height=c.height,e.width=c.height*f),d.renderCanvas(!0))},getCropBoxData:function(){var a=this,b=a.cropBox;return a.ready&&a.cropped?{left:b.left,top:b.top,width:b.width,height:b.height}:{}},setCropBoxData:function(c){var d=this,e=d.cropBox,f=d.options.aspectRatio,g=void 0,h=void 0;a.isFunction(c)&&(c=c.call(d.$element)),d.ready&&d.cropped&&!d.disabled&&a.isPlainObject(c)&&(b(c.left)&&(e.left=c.left),b(c.top)&&(e.top=c.top),b(c.width)&&c.width!==e.width&&(g=!0,e.width=c.width),b(c.height)&&c.height!==e.height&&(h=!0,e.height=c.height),f&&(g?e.height=e.width/f:h&&(e.width=e.height*f)),d.renderCropBox())},getCroppedCanvas:function(b){var c=this;if(!c.ready||!window.HTMLCanvasElement)return null;if(!c.cropped)return m(c.$clone[0],c.image);a.isPlainObject(b)||(b={});var d=c.getData(),e=d.width,f=d.height,g=e/f,h=void 0,i=void 0,j=void 0;a.isPlainObject(b)&&(h=b.width,i=b.height,h?(i=h/g,j=h/e):i&&(h=i*g,j=i/f));var k=Math.floor(h||e),l=Math.floor(i||f),n=a("<canvas>")[0],o=n.getContext("2d");n.width=k,n.height=l,b.fillColor&&(o.fillStyle=b.fillColor,o.fillRect(0,0,k,l));var p=function(){var a=m(c.$clone[0],c.image),b=a.width,g=a.height,h=c.canvas,i=[a],k=d.x+h.naturalWidth*(Math.abs(d.scaleX||1)-1)/2,l=d.y+h.naturalHeight*(Math.abs(d.scaleY||1)-1)/2,n=void 0,o=void 0,p=void 0,q=void 0,r=void 0,s=void 0;return-e>=k||k>b?k=n=p=r=0:0>=k?(p=-k,k=0,n=r=Math.min(b,e+k)):b>=k&&(p=0,n=r=Math.min(e,b-k)),0>=n||-f>=l||l>g?l=o=q=s=0:0>=l?(q=-l,l=0,o=s=Math.min(g,f+l)):g>=l&&(q=0,o=s=Math.min(f,g-l)),i.push(Math.floor(k),Math.floor(l),Math.floor(n),Math.floor(o)),j&&(p*=j,q*=j,r*=j,s*=j),r>0&&s>0&&i.push(Math.floor(p),Math.floor(q),Math.floor(r),Math.floor(s)),i}();return o.drawImage.apply(o,ca(p)),n},setAspectRatio:function(a){var b=this,d=b.options;b.disabled||c(a)||(d.aspectRatio=Math.max(0,a)||NaN,b.ready&&(b.initCropBox(),b.cropped&&b.renderCropBox()))},setDragMode:function(a){var b=this,c=b.options,d=void 0,e=void 0;b.loaded&&!b.disabled&&(d="crop"===a,e=c.movable&&"move"===a,a=d||e?a:"none",b.$dragBox.data("action",a).toggleClass("cropper-crop",d).toggleClass("cropper-move",e),c.cropBoxMovable||b.$face.data("action",a).toggleClass("cropper-crop",d).toggleClass("cropper-move",e))}},ea="cropper-hidden",fa=/^data:/,ga=/^data:image\/jpeg;base64,/,ha=function(){function b(c,d){aa(this,b);var e=this;e.$element=a(c),e.options=a.extend({},u,a.isPlainObject(d)&&d),e.loaded=!1,e.ready=!1,e.completed=!1,e.rotated=!1,e.cropped=!1,e.disabled=!1,e.replaced=!1,e.limited=!1,e.wheeling=!1,e.isImg=!1,e.originalUrl="",e.canvas=null,e.cropBox=null,e.pointers={},e.init()}return ba(b,[{key:"init",value:function(){var a=this,b=a.$element,c=void 0;if(b.is("img")){if(a.isImg=!0,a.originalUrl=c=b.attr("src"),!c)return;c=b.prop("src")}else b.is("canvas")&&window.HTMLCanvasElement&&(c=b[0].toDataURL());a.load(c)}},{key:"trigger",value:function(b,c){var d=a.Event(b,c);return this.$element.trigger(d),d}},{key:"load",value:function(b){var c=this,d=c.options,e=c.$element;if(b){if(c.url=b,c.image={},!d.checkOrientation||!ArrayBuffer)return void c.clone();if(fa.test(b))return void(ga.test(b)?c.read(p(b)):c.clone());var f=new XMLHttpRequest;f.onerror=f.onabort=a.proxy(function(){c.clone()},this),f.onload=function(){c.read(this.response)},d.checkCrossOrigin&&g(b)&&e.prop("crossOrigin")&&(b=h(b)),f.open("get",b),f.responseType="arraybuffer",f.withCredentials="use-credentials"===e.prop("crossOrigin"),f.send()}}},{key:"read",value:function(a){var b=this,c=b.options,d=o(a),e=b.image,f=0,g=1,h=1;if(d>1)switch(b.url=q(a),d){case 2:g=-1;break;case 3:f=-180;break;case 4:h=-1;break;case 5:f=90,h=-1;break;case 6:f=90;break;case 7:f=90,g=-1;break;case 8:f=-90}c.rotatable&&(e.rotate=f),c.scalable&&(e.scaleX=g,e.scaleY=h),b.clone()}},{key:"clone",value:function(){var b=this,c=b.options,d=b.$element,e=b.url,f="",j=void 0;c.checkCrossOrigin&&g(e)&&(f=d.prop("crossOrigin"),f?j=e:(f="anonymous",j=h(e))),b.crossOrigin=f,b.crossOriginUrl=j;var k=a("<img "+i(f)+' src="'+(j||e)+'">');b.$clone=k,b.isImg?d[0].complete?b.start():d.one("load",a.proxy(b.start,this)):k.one("load",a.proxy(b.start,this)).one("error",a.proxy(b.stop,this)).addClass("cropper-hide").insertAfter(d)}},{key:"start",value:function(){var b=this,c=b.$clone,d=b.$element;b.isImg||(c.off("error",b.stop),d=c),j(d[0],function(c,d){a.extend(b.image,{naturalWidth:c,naturalHeight:d,aspectRatio:c/d}),b.loaded=!0,b.build()})}},{key:"stop",value:function(){var a=this;a.$clone.remove(),a.$clone=null}},{key:"build",value:function(){var b=this,c=b.options,d=b.$element,e=b.$clone,f=void 0,g=void 0,h=void 0;b.loaded&&(b.ready&&b.unbuild(),b.$container=d.parent(),b.$cropper=f=a(v),b.$canvas=f.find(".cropper-canvas").append(e),b.$dragBox=f.find(".cropper-drag-box"),b.$cropBox=g=f.find(".cropper-crop-box"),b.$viewBox=f.find(".cropper-view-box"),b.$face=h=g.find(".cropper-face"),d.addClass(ea).after(f),b.isImg||e.removeClass("cropper-hide"),b.initPreview(),b.bind(),c.aspectRatio=Math.max(0,c.aspectRatio)||NaN,c.viewMode=Math.max(0,Math.min(3,Math.round(c.viewMode)))||0,b.cropped=c.autoCrop,c.autoCrop?c.modal&&b.$dragBox.addClass("cropper-modal"):g.addClass(ea),c.guides||g.find(".cropper-dashed").addClass(ea),c.center||g.find(".cropper-center").addClass(ea),c.cropBoxMovable&&h.addClass("cropper-move").data("action","all"),c.highlight||h.addClass("cropper-invisible"),c.background&&f.addClass("cropper-bg"),c.cropBoxResizable||g.find(".cropper-line, .cropper-point").addClass(ea),b.setDragMode(c.dragMode),b.render(),b.ready=!0,b.setData(c.data),b.completing=setTimeout(function(){a.isFunction(c.ready)&&d.one("ready",c.ready),b.trigger("ready"),b.trigger("crop",b.getData()),b.completed=!0},0))}},{key:"unbuild",value:function(){var a=this;a.ready&&(a.completed||clearTimeout(a.completing),a.ready=!1,a.completed=!1,a.initialImage=null,a.initialCanvas=null,a.initialCropBox=null,a.container=null,a.canvas=null,a.cropBox=null,a.unbind(),a.resetPreview(),a.$preview=null,a.$viewBox=null,a.$cropBox=null,a.$dragBox=null,a.$canvas=null,a.$container=null,a.$cropper.remove(),a.$cropper=null)}}],[{key:"setDefaults",value:function(b){a.extend(u,a.isPlainObject(b)&&b)}}]),b}();a.extend(ha.prototype,B),a.extend(ha.prototype,D),a.extend(ha.prototype,Q),a.extend(ha.prototype,S),a.extend(ha.prototype,_),a.extend(ha.prototype,da);var ia="cropper",ja=a.fn.cropper;a.fn.cropper=function(b){for(var c=arguments.length,d=Array(c>1?c-1:0),e=1;c>e;e++)d[e-1]=arguments[e];var f=void 0;return this.each(function(c,e){var g=a(e),h=g.data(ia);if(!h){if(/destroy/.test(b))return;var i=a.extend({},g.data(),a.isPlainObject(b)&&b);g.data(ia,h=new ha(e,i))}if("string"==typeof b){var j=h[b];a.isFunction(j)&&(f=j.apply(h,d))}}),"undefined"!=typeof f?f:this},a.fn.cropper.Constructor=ha,a.fn.cropper.setDefaults=ha.setDefaults,a.fn.cropper.noConflict=function(){return a.fn.cropper=ja,this}});