L&&(T.y=L-S)}};switch(s){case u:c+=T.x,p+=T.y;break;case f:if(T.x>=0&&(B>=P||l&&(p<=O||S>=L))){N=!1;break}k(f),(w+=T.x)<0&&(s=m,c-=w=-w),l&&(E=w/l,p+=(o.height-E)/2);break;case v:if(T.y<=0&&(p<=O||l&&(c<=_||B>=P))){N=!1;break}k(v),E-=T.y,p+=T.y,E<0&&(s=g,p-=E=-E),l&&(w=E*l,c+=(o.width-w)/2);break;case m:if(T.x<=0&&(c<=_||l&&(p<=O||S>=L))){N=!1;break}k(m),w-=T.x,c+=T.x,w<0&&(s=f,c-=w=-w),l&&(E=w/l,p+=(o.height-E)/2);break;case g:if(T.y>=0&&(S>=L||l&&(c<=_||B>=P))){N=!1;break}k(g),(E+=T.y)<0&&(s=v,p-=E=-E),l&&(w=E*l,c+=(o.width-w)/2);break;case C:if(l){if(T.y<=0&&(p<=O||B>=P)){N=!1;break}k(v),E-=T.y,p+=T.y,w=E*l}else k(v),k(f),T.x>=0?BO&&(E-=T.y,p+=T.y):(E-=T.y,p+=T.y);w<0&&E<0?(s=x,p-=E=-E,c-=w=-w):w<0?(s=y,c-=w=-w):E<0&&(s=b,p-=E=-E);break;case y:if(l){if(T.y<=0&&(p<=O||c<=_)){N=!1;break}k(v),E-=T.y,p+=T.y,w=E*l,c+=o.width-w}else k(v),k(m),T.x<=0?c>_?(w-=T.x,c+=T.x):T.y<=0&&p<=O&&(N=!1):(w-=T.x,c+=T.x),T.y<=0?p>O&&(E-=T.y,p+=T.y):(E-=T.y,p+=T.y);w<0&&E<0?(s=b,p-=E=-E,c-=w=-w):w<0?(s=C,c-=w=-w):E<0&&(s=x,p-=E=-E);break;case x:if(l){if(T.x<=0&&(c<=_||S>=L)){N=!1;break}k(m),w-=T.x,c+=T.x,E=w/l}else k(g),k(m),T.x<=0?c>_?(w-=T.x,c+=T.x):T.y>=0&&S>=L&&(N=!1):(w-=T.x,c+=T.x),T.y>=0?S=0&&(B>=P||S>=L)){N=!1;break}k(f),E=(w+=T.x)/l}else k(g),k(f),T.x>=0?B=0&&S>=L&&(N=!1):w+=T.x,T.y>=0?SMath.abs(i)&&(i=s)}))})),i}(d),t),N=!1;break;case h:if(!T.x||!T.y){N=!1;break}n=St(this.cropper),c=M.startX-n.left,p=M.startY-n.top,w=o.minWidth,E=o.minHeight,T.x>0?s=T.y>0?b:C:T.x<0&&(c-=w,s=T.y>0?x:y),T.y<0&&(p-=E),this.cropped||(mt(this.cropBox,I),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}N&&(o.width=w,o.height=E,o.left=c,o.top=p,this.action=s,this.renderCropBox()),ct(d,(function(t){t.startX=t.endX,t.startY=t.endY}))}},Vt={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&ft(this.dragBox,_),mt(this.cropBox,I),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=pt({},this.initialImageData),this.canvasData=pt({},this.initialCanvasData),this.cropBoxData=pt({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(pt(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),mt(this.dragBox,_),ft(this.cropBox,I)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,ct(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,mt(this.cropper,E)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,ft(this.cropper,E)),this},destroy:function(){var t=this.element;return t[p]?(t[p]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.canvasData,i=n.left,a=n.top;return this.moveTo(it(t)?t:i+Number(t),it(e)?e:a+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.canvasData,i=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(et(t)&&(n.left=t,i=!0),et(e)&&(n.top=e,i=!0),i&&this.renderCanvas(!0)),this},zoom:function(t,e){var n=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,null,e)},zoomTo:function(t,e,n){var i=this.options,a=this.canvasData,r=a.width,o=a.height,d=a.naturalWidth,s=a.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&i.zoomable){var l=d*t,c=s*t;if(!1===Bt(this.element,z,{ratio:t,oldRatio:r/d,originalEvent:n}))return this;if(n){var p=this.pointers,u=St(this.cropper),h=p&&Object.keys(p).length?function(t){var e=0,n=0,i=0;return ct(t,(function(t){var a=t.startX,r=t.startY;e+=a,n+=r,i+=1})),{pageX:e/=i,pageY:n/=i}}(p):{pageX:n.pageX,pageY:n.pageY};a.left-=(l-r)*((h.pageX-u.left-a.left)/r),a.top-=(c-o)*((h.pageY-u.top-a.top)/o)}else ot(e)&&et(e.x)&&et(e.y)?(a.left-=(l-r)*((e.x-a.left)/r),a.top-=(c-o)*((e.y-a.top)/o)):(a.left-=(l-r)/2,a.top-=(c-o)/2);a.width=l,a.height=c,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return et(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,et(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(et(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=this.imageData,i=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(et(t)&&(n.scaleX=t,i=!0),et(e)&&(n.scaleY=e,i=!0),i&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.options,i=this.imageData,a=this.canvasData,r=this.cropBoxData;if(this.ready&&this.cropped){t={x:r.left-a.left,y:r.top-a.top,width:r.width,height:r.height};var o=i.width/i.naturalWidth;if(ct(t,(function(e,n){t[n]=e/o})),e){var d=Math.round(t.y+t.height),s=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=s-t.x,t.height=d-t.y}}else t={x:0,y:0,width:0,height:0};return n.rotatable&&(t.rotate=i.rotate||0),n.scalable&&(t.scaleX=i.scaleX||1,t.scaleY=i.scaleY||1),t},setData:function(t){var e=this.options,n=this.imageData,i=this.canvasData,a={};if(this.ready&&!this.disabled&&ot(t)){var r=!1;e.rotatable&&et(t.rotate)&&t.rotate!==n.rotate&&(n.rotate=t.rotate,r=!0),e.scalable&&(et(t.scaleX)&&t.scaleX!==n.scaleX&&(n.scaleX=t.scaleX,r=!0),et(t.scaleY)&&t.scaleY!==n.scaleY&&(n.scaleY=t.scaleY,r=!0)),r&&this.renderCanvas(!0,!0);var o=n.width/n.naturalWidth;et(t.x)&&(a.left=t.x*o+i.left),et(t.y)&&(a.top=t.y*o+i.top),et(t.width)&&(a.width=t.width*o),et(t.height)&&(a.height=t.height*o),this.setCropBoxData(a)}return this},getContainerData:function(){return this.ready?pt({},this.containerData):{}},getImageData:function(){return this.sized?pt({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&ct(["left","top","width","height","naturalWidth","naturalHeight"],(function(n){e[n]=t[n]})),e},setCanvasData:function(t){var e=this.canvasData,n=e.aspectRatio;return this.ready&&!this.disabled&&ot(t)&&(et(t.left)&&(e.left=t.left),et(t.top)&&(e.top=t.top),et(t.width)?(e.width=t.width,e.height=t.width/n):et(t.height)&&(e.height=t.height,e.width=t.height*n),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,n,i=this.cropBoxData,a=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&ot(t)&&(et(t.left)&&(i.left=t.left),et(t.top)&&(i.top=t.top),et(t.width)&&t.width!==i.width&&(e=!0,i.width=t.width),et(t.height)&&t.height!==i.height&&(n=!0,i.height=t.height),a&&(e?i.height=i.width/a:n&&(i.width=i.height*a)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,n=function(t,e,n,i){var r=e.aspectRatio,o=e.naturalWidth,d=e.naturalHeight,s=e.rotate,l=void 0===s?0:s,c=e.scaleX,p=void 0===c?1:c,u=e.scaleY,h=void 0===u?1:u,$=n.aspectRatio,A=n.naturalWidth,f=n.naturalHeight,m=i.fillColor,g=void 0===m?"transparent":m,v=i.imageSmoothingEnabled,C=void 0===v||v,y=i.imageSmoothingQuality,b=void 0===y?"low":y,x=i.maxWidth,w=void 0===x?1/0:x,E=i.maxHeight,I=void 0===E?1/0:E,B=i.minWidth,S=void 0===B?0:B,_=i.minHeight,O=void 0===_?0:_,P=document.createElement("canvas"),L=P.getContext("2d"),N=Tt({aspectRatio:$,width:w,height:I}),M=Tt({aspectRatio:$,width:S,height:O},"cover"),T=Math.min(N.width,Math.max(M.width,A)),k=Math.min(N.height,Math.max(M.height,f)),D=Tt({aspectRatio:r,width:w,height:I}),R=Tt({aspectRatio:r,width:S,height:O},"cover"),F=Math.min(D.width,Math.max(R.width,o)),H=Math.min(D.height,Math.max(R.height,d)),j=[-F/2,-H/2,F,H];return P.width=ht(T),P.height=ht(k),L.fillStyle=g,L.fillRect(0,0,T,k),L.save(),L.translate(T/2,k/2),L.rotate(l*Math.PI/180),L.scale(p,h),L.imageSmoothingEnabled=C,L.imageSmoothingQuality=b,L.drawImage.apply(L,[t].concat(a(j.map((function(t){return Math.floor(ht(t))}))))),L.restore(),P}(this.image,this.imageData,e,t);if(!this.cropped)return n;var i=this.getData(t.rounded),r=i.x,o=i.y,d=i.width,s=i.height,l=n.width/Math.floor(e.naturalWidth);1!==l&&(r*=l,o*=l,d*=l,s*=l);var c=d/s,p=Tt({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),u=Tt({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),h=Tt({aspectRatio:c,width:t.width||(1!==l?n.width:d),height:t.height||(1!==l?n.height:s)}),$=h.width,A=h.height;$=Math.min(p.width,Math.max(u.width,$)),A=Math.min(p.height,Math.max(u.height,A));var f=document.createElement("canvas"),m=f.getContext("2d");f.width=ht($),f.height=ht(A),m.fillStyle=t.fillColor||"transparent",m.fillRect(0,0,$,A);var g=t.imageSmoothingEnabled,v=void 0===g||g,C=t.imageSmoothingQuality;m.imageSmoothingEnabled=v,C&&(m.imageSmoothingQuality=C);var y,b,x,w,E,I,B=n.width,S=n.height,_=r,O=o;_<=-d||_>B?(_=0,y=0,x=0,E=0):_<=0?(x=-_,_=0,E=y=Math.min(B,d+_)):_<=B&&(x=0,E=y=Math.min(d,B-_)),y<=0||O<=-s||O>S?(O=0,b=0,w=0,I=0):O<=0?(w=-O,O=0,I=b=Math.min(S,s+O)):O<=S&&(w=0,I=b=Math.min(s,S-O));var P=[_,O,y,b];if(E>0&&I>0){var L=$/d;P.push(x*L,w*L,E*L,I*L)}return m.drawImage.apply(m,[n].concat(a(P.map((function(t){return Math.floor(ht(t))}))))),f},setAspectRatio:function(t){var e=this.options;return this.disabled||it(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,n=this.dragBox,i=this.face;if(this.ready&&!this.disabled){var a=t===N,r=e.movable&&t===M;t=a||r?t:T,e.dragMode=t,bt(n,P,t),gt(n,w,a),gt(n,O,r),e.cropBoxMovable||(bt(i,P,t),gt(i,w,a),gt(i,O,r))}return this}},Yt=s.Cropper,Gt=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!Q.test(e.tagName))throw new Error("The first argument is required and must be an or