1 line
45 KiB
JavaScript
1 line
45 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([[16],{YQfW:function(t,e,i){},urRO:function(t,e,i){(function(e,i){t.exports=i()})(0,(function(){"use strict";function t(e){return t="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function a(t,e,a){return e&&i(t.prototype,e),a&&i(t,a),t}function n(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function r(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?o(Object(i),!0).forEach((function(e){n(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):o(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function s(t){return h(t)||c(t)||l(t)||d()}function h(t){if(Array.isArray(t))return p(t)}function c(t){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}function l(t,e){if(t){if("string"===typeof t)return p(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?p(t,e):void 0}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var u="undefined"!==typeof window&&"undefined"!==typeof window.document,f=u?window:{},m=!(!u||!f.document.documentElement)&&"ontouchstart"in f.document.documentElement,g=!!u&&"PointerEvent"in f,v="cropper",b="all",w="crop",y="move",x="zoom",C="e",M="w",D="s",k="n",O="ne",T="nw",B="se",E="sw",W="".concat(v,"-crop"),z="".concat(v,"-disabled"),R="".concat(v,"-hidden"),H="".concat(v,"-hide"),N="".concat(v,"-invisible"),Y="".concat(v,"-modal"),j="".concat(v,"-move"),X="".concat(v,"Action"),L="".concat(v,"Preview"),S="crop",A="move",P="none",I="crop",U="cropend",_="cropmove",q="cropstart",$="dblclick",Q=m?"touchstart":"mousedown",Z=m?"touchmove":"mousemove",K=m?"touchend touchcancel":"mouseup",J=g?"pointerdown":Q,F=g?"pointermove":Z,G=g?"pointerup pointercancel":K,V="ready",tt="resize",et="wheel",it="zoom",at="image/jpeg",nt=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,ot=/^data:/,rt=/^data:image\/jpeg;base64,/,st=/^img|canvas$/i,ht={viewMode:0,dragMode:S,initialAspectRatio:NaN,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},ct='<div class="cropper-container" touch-action="none"><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-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',lt=Number.isNaN||f.isNaN;function pt(t){return"number"===typeof t&&!lt(t)}var dt=function(t){return t>0&&t<1/0};function ut(t){return"undefined"===typeof t}function ft(e){return"object"===t(e)&&null!==e}var mt=Object.prototype.hasOwnProperty;function gt(t){if(!ft(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&mt.call(i,"isPrototypeOf")}catch(a){return!1}}function vt(t){return"function"===typeof t}var bt=Array.prototype.slice;function wt(t){return Array.from?Array.from(t):bt.call(t)}function yt(t,e){return t&&vt(e)&&(Array.isArray(t)||pt(t.length)?wt(t).forEach((function(i,a){e.call(t,i,a,t)})):ft(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var xt=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];return ft(t)&&i.length>0&&i.forEach((function(e){ft(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Ct=/\.\d*(?:0|9){12}\d*$/;function Mt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Ct.test(t)?Math.round(t*e)/e:t}var Dt=/^width|height|left|top|marginLeft|marginTop$/;function kt(t,e){var i=t.style;yt(e,(function(t,e){Dt.test(e)&&pt(t)&&(t="".concat(t,"px")),i[e]=t}))}function Ot(t,e){return t.classList?t.classList.contains(e):t.className.indexOf(e)>-1}function Tt(t,e){if(e)if(pt(t.length))yt(t,(function(t){Tt(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Bt(t,e){e&&(pt(t.length)?yt(t,(function(t){Bt(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Et(t,e,i){e&&(pt(t.length)?yt(t,(function(t){Et(t,e,i)})):i?Tt(t,e):Bt(t,e))}var Wt=/([a-z\d])([A-Z])/g;function zt(t){return t.replace(Wt,"$1-$2").toLowerCase()}function Rt(t,e){return ft(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(zt(e)))}function Ht(t,e,i){ft(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(zt(e)),i)}function Nt(t,e){if(ft(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(zt(e)))}var Yt=/\s\s*/,jt=function(){var t=!1;if(u){var e=!1,i=function(){},a=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});f.addEventListener("test",i,a),f.removeEventListener("test",i,a)}return t}();function Xt(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(Yt).forEach((function(e){if(!jt){var o=t.listeners;o&&o[e]&&o[e][i]&&(n=o[e][i],delete o[e][i],0===Object.keys(o[e]).length&&delete o[e],0===Object.keys(o).length&&delete t.listeners)}t.removeEventListener(e,n,a)}))}function Lt(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=i;e.trim().split(Yt).forEach((function(e){if(a.once&&!jt){var o=t.listeners,r=void 0===o?{}:o;n=function(){delete r[e][i],t.removeEventListener(e,n,a);for(var o=arguments.length,s=new Array(o),h=0;h<o;h++)s[h]=arguments[h];i.apply(t,s)},r[e]||(r[e]={}),r[e][i]&&t.removeEventListener(e,r[e][i],a),r[e][i]=n,t.listeners=r}t.addEventListener(e,n,a)}))}function St(t,e,i){var a;return vt(Event)&&vt(CustomEvent)?a=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(a=document.createEvent("CustomEvent"),a.initCustomEvent(e,!0,!0,i)),t.dispatchEvent(a)}function At(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var Pt=f.location,It=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Ut(t){var e=t.match(It);return null!==e&&(e[1]!==Pt.protocol||e[2]!==Pt.hostname||e[3]!==Pt.port)}function _t(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function qt(t){var e=t.rotate,i=t.scaleX,a=t.scaleY,n=t.translateX,o=t.translateY,r=[];pt(n)&&0!==n&&r.push("translateX(".concat(n,"px)")),pt(o)&&0!==o&&r.push("translateY(".concat(o,"px)")),pt(e)&&0!==e&&r.push("rotate(".concat(e,"deg)")),pt(i)&&1!==i&&r.push("scaleX(".concat(i,")")),pt(a)&&1!==a&&r.push("scaleY(".concat(a,")"));var s=r.length?r.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function $t(t){var e=r({},t),i=[];return yt(t,(function(t,a){delete e[a],yt(e,(function(e){var a=Math.abs(t.startX-e.startX),n=Math.abs(t.startY-e.startY),o=Math.abs(t.endX-e.endX),r=Math.abs(t.endY-e.endY),s=Math.sqrt(a*a+n*n),h=Math.sqrt(o*o+r*r),c=(h-s)/s;i.push(c)}))})),i.sort((function(t,e){return Math.abs(t)<Math.abs(e)})),i[0]}function Qt(t,e){var i=t.pageX,a=t.pageY,n={endX:i,endY:a};return e?n:r({startX:i,startY:a},n)}function Zt(t){var e=0,i=0,a=0;return yt(t,(function(t){var n=t.startX,o=t.startY;e+=n,i+=o,a+=1})),e/=a,i/=a,{pageX:e,pageY:i}}function Kt(t){var e=t.aspectRatio,i=t.height,a=t.width,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",o=dt(a),r=dt(i);if(o&&r){var s=i*e;"contain"===n&&s>a||"cover"===n&&s<a?i=a/e:a=i*e}else o?i=a/e:r&&(a=i*e);return{width:a,height:i}}function Jt(t){var e=t.width,i=t.height,a=t.degree;if(a=Math.abs(a)%180,90===a)return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),r=Math.cos(n),s=e*r+i*o,h=e*o+i*r;return a>90?{width:h,height:s}:{width:s,height:h}}function Ft(t,e,i,a){var n=e.aspectRatio,o=e.naturalWidth,r=e.naturalHeight,h=e.rotate,c=void 0===h?0:h,l=e.scaleX,p=void 0===l?1:l,d=e.scaleY,u=void 0===d?1:d,f=i.aspectRatio,m=i.naturalWidth,g=i.naturalHeight,v=a.fillColor,b=void 0===v?"transparent":v,w=a.imageSmoothingEnabled,y=void 0===w||w,x=a.imageSmoothingQuality,C=void 0===x?"low":x,M=a.maxWidth,D=void 0===M?1/0:M,k=a.maxHeight,O=void 0===k?1/0:k,T=a.minWidth,B=void 0===T?0:T,E=a.minHeight,W=void 0===E?0:E,z=document.createElement("canvas"),R=z.getContext("2d"),H=Kt({aspectRatio:f,width:D,height:O}),N=Kt({aspectRatio:f,width:B,height:W},"cover"),Y=Math.min(H.width,Math.max(N.width,m)),j=Math.min(H.height,Math.max(N.height,g)),X=Kt({aspectRatio:n,width:D,height:O}),L=Kt({aspectRatio:n,width:B,height:W},"cover"),S=Math.min(X.width,Math.max(L.width,o)),A=Math.min(X.height,Math.max(L.height,r)),P=[-S/2,-A/2,S,A];return z.width=Mt(Y),z.height=Mt(j),R.fillStyle=b,R.fillRect(0,0,Y,j),R.save(),R.translate(Y/2,j/2),R.rotate(c*Math.PI/180),R.scale(p,u),R.imageSmoothingEnabled=y,R.imageSmoothingQuality=C,R.drawImage.apply(R,[t].concat(s(P.map((function(t){return Math.floor(Mt(t))}))))),R.restore(),z}var Gt=String.fromCharCode;function Vt(t,e,i){var a="";i+=e;for(var n=e;n<i;n+=1)a+=Gt(t.getUint8(n));return a}var te=/^data:.*,/;function ee(t){var e=t.replace(te,""),i=atob(e),a=new ArrayBuffer(i.length),n=new Uint8Array(a);return yt(n,(function(t,e){n[e]=i.charCodeAt(e)})),a}function ie(t,e){var i=[],a=8192,n=new Uint8Array(t);while(n.length>0)i.push(Gt.apply(null,wt(n.subarray(0,a)))),n=n.subarray(a);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}function ae(t){var e,i=new DataView(t);try{var a,n,o;if(255===i.getUint8(0)&&216===i.getUint8(1)){var r=i.byteLength,s=2;while(s+1<r){if(255===i.getUint8(s)&&225===i.getUint8(s+1)){n=s;break}s+=1}}if(n){var h=n+4,c=n+10;if("Exif"===Vt(i,h,4)){var l=i.getUint16(c);if(a=18761===l,(a||19789===l)&&42===i.getUint16(c+2,a)){var p=i.getUint32(c+4,a);p>=8&&(o=c+p)}}}if(o){var d,u,f=i.getUint16(o,a);for(u=0;u<f;u+=1)if(d=o+12*u+2,274===i.getUint16(d,a)){d+=8,e=i.getUint16(d,a),i.setUint16(d,1,a);break}}}catch(m){e=1}return e}function ne(t){var e=0,i=1,a=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:a=-1;break;case 5:e=90,a=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90;break}return{rotate:e,scaleX:i,scaleY:a}}var oe={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,a=this.cropper;Tt(a,R),Bt(t,R);var n={width:Math.max(i.offsetWidth,Number(e.minContainerWidth)||200),height:Math.max(i.offsetHeight,Number(e.minContainerHeight)||100)};this.containerData=n,kt(a,{width:n.width,height:n.height}),Tt(t,R),Bt(a,R)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,a=Math.abs(e.rotate)%180===90,n=a?e.naturalHeight:e.naturalWidth,o=a?e.naturalWidth:e.naturalHeight,r=n/o,s=t.width,h=t.height;t.height*r>t.width?3===i?s=t.height*r:h=t.width/r:3===i?h=t.width/r:s=t.height*r;var c={aspectRatio:r,naturalWidth:n,naturalHeight:o,width:s,height:h};c.left=(t.width-s)/2,c.top=(t.height-h)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=xt({},e),this.initialCanvasData=xt({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=i.viewMode,s=n.aspectRatio,h=this.cropped&&o;if(t){var c=Number(i.minCanvasWidth)||0,l=Number(i.minCanvasHeight)||0;r>1?(c=Math.max(c,a.width),l=Math.max(l,a.height),3===r&&(l*s>c?c=l*s:l=c/s)):r>0&&(c?c=Math.max(c,h?o.width:0):l?l=Math.max(l,h?o.height:0):h&&(c=o.width,l=o.height,l*s>c?c=l*s:l=c/s));var p=Kt({aspectRatio:s,width:c,height:l});c=p.width,l=p.height,n.minWidth=c,n.minHeight=l,n.maxWidth=1/0,n.maxHeight=1/0}if(e)if(r>(h?0:1)){var d=a.width-n.width,u=a.height-n.height;n.minLeft=Math.min(0,d),n.minTop=Math.min(0,u),n.maxLeft=Math.max(0,d),n.maxTop=Math.max(0,u),h&&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===r&&(n.width>=a.width&&(n.minLeft=Math.min(0,d),n.maxLeft=Math.max(0,d)),n.height>=a.height&&(n.minTop=Math.min(0,u),n.maxTop=Math.max(0,u))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var n=Jt({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),o=n.width,r=n.height,s=i.width*(o/i.naturalWidth),h=i.height*(r/i.naturalHeight);i.left-=(s-i.width)/2,i.top-=(h-i.height)/2,i.width=s,i.height=h,i.aspectRatio=o/r,i.naturalWidth=o,i.naturalHeight=r,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,kt(this.canvas,xt({width:i.width,height:i.height},qt({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,a=i.naturalWidth*(e.width/e.naturalWidth),n=i.naturalHeight*(e.height/e.naturalHeight);xt(i,{width:a,height:n,left:(e.width-a)/2,top:(e.height-n)/2}),kt(this.image,xt({width:i.width,height:i.height},qt(xt({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,a=Number(t.autoCropArea)||.8,n={width:e.width,height:e.height};i&&(e.height*i>e.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=xt({},n)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=this.limited,s=i.aspectRatio;if(t){var h=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,l=r?Math.min(a.width,n.width,n.width+n.left,a.width-n.left):a.width,p=r?Math.min(a.height,n.height,n.height+n.top,a.height-n.top):a.height;h=Math.min(h,a.width),c=Math.min(c,a.height),s&&(h&&c?c*s>h?c=h/s:h=c*s:h?c=h/s:c&&(h=c*s),p*s>l?p=l/s:l=p*s),o.minWidth=Math.min(h,l),o.minHeight=Math.min(c,p),o.maxWidth=l,o.maxHeight=p}e&&(r?(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,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&Ht(this.face,X,i.width>=e.width&&i.height>=e.height?y:b),kt(this.cropBox,xt({width:i.width,height:i.height},qt({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),St(this.element,I,this.getData())}},re={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,a=e?this.crossOriginUrl:this.url,n=t.alt||"The image to preview",o=document.createElement("img");if(e&&(o.crossOrigin=e),o.src=a,o.alt=n,this.viewBox.appendChild(o),this.viewBoxImage=o,i){var r=i;"string"===typeof i?r=t.ownerDocument.querySelectorAll(i):i.querySelector&&(r=[i]),this.previews=r,yt(r,(function(t){var i=document.createElement("img");Ht(t,L,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=a,i.alt=n,i.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;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){yt(this.previews,(function(t){var e=Rt(t,L);kt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,Nt(t,L)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,a=i.width,n=i.height,o=t.width,r=t.height,s=i.left-e.left-t.left,h=i.top-e.top-t.top;this.cropped&&!this.disabled&&(kt(this.viewBoxImage,xt({width:o,height:r},qt(xt({translateX:-s,translateY:-h},t)))),yt(this.previews,(function(e){var i=Rt(e,L),c=i.width,l=i.height,p=c,d=l,u=1;a&&(u=c/a,d=n*u),n&&d>l&&(u=l/n,p=a*u,d=l),kt(e,{width:p,height:d}),kt(e.getElementsByTagName("img")[0],xt({width:o*u,height:r*u},qt(xt({translateX:-s*u,translateY:-h*u},t))))})))}},se={bind:function(){var t=this.element,e=this.options,i=this.cropper;vt(e.cropstart)&&Lt(t,q,e.cropstart),vt(e.cropmove)&&Lt(t,_,e.cropmove),vt(e.cropend)&&Lt(t,U,e.cropend),vt(e.crop)&&Lt(t,I,e.crop),vt(e.zoom)&&Lt(t,it,e.zoom),Lt(i,J,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&Lt(i,et,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Lt(i,$,this.onDblclick=this.dblclick.bind(this)),Lt(t.ownerDocument,F,this.onCropMove=this.cropMove.bind(this)),Lt(t.ownerDocument,G,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&Lt(window,tt,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;vt(e.cropstart)&&Xt(t,q,e.cropstart),vt(e.cropmove)&&Xt(t,_,e.cropmove),vt(e.cropend)&&Xt(t,U,e.cropend),vt(e.crop)&&Xt(t,I,e.crop),vt(e.zoom)&&Xt(t,it,e.zoom),Xt(i,J,this.onCropStart),e.zoomable&&e.zoomOnWheel&&Xt(i,et,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Xt(i,$,this.onDblclick),Xt(t.ownerDocument,F,this.onCropMove),Xt(t.ownerDocument,G,this.onCropEnd),e.responsive&&Xt(window,tt,this.onResize)}},he={resize:function(){if(!this.disabled){var t,e,i=this.options,a=this.container,n=this.containerData,o=a.offsetWidth/n.width;if(1!==o||a.offsetHeight!==n.height)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(yt(t,(function(e,i){t[i]=e*o}))),this.setCropBoxData(yt(e,(function(t,i){e[i]=t*o}))))}},dblclick:function(){this.disabled||this.options.dragMode===P||this.setDragMode(Ot(this.dragBox,W)?A:S)},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(pt(e)&&1!==e||pt(i)&&0!==i||t.ctrlKey))){var a,n=this.options,o=this.pointers;t.changedTouches?yt(t.changedTouches,(function(t){o[t.identifier]=Qt(t)})):o[t.pointerId||0]=Qt(t),a=Object.keys(o).length>1&&n.zoomable&&n.zoomOnTouch?x:Rt(t.target,X),nt.test(a)&&!1!==St(this.element,q,{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,a===w&&(this.cropping=!0,Tt(this.dragBox,Y)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==St(this.element,_,{originalEvent:t,action:e})&&(t.changedTouches?yt(t.changedTouches,(function(t){xt(i[t.identifier]||{},Qt(t,!0))})):xt(i[t.pointerId||0]||{},Qt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?yt(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Et(this.dragBox,Y,this.cropped&&this.options.modal)),St(this.element,U,{originalEvent:t,action:e}))}}},ce={change:function(t){var e,i=this.options,a=this.canvasData,n=this.containerData,o=this.cropBoxData,r=this.pointers,s=this.action,h=i.aspectRatio,c=o.left,l=o.top,p=o.width,d=o.height,u=c+p,f=l+d,m=0,g=0,v=n.width,W=n.height,z=!0;!h&&t.shiftKey&&(h=p&&d?p/d:1),this.limited&&(m=o.minLeft,g=o.minTop,v=m+Math.min(n.width,a.width,a.left+a.width),W=g+Math.min(n.height,a.height,a.top+a.height));var H=r[Object.keys(r)[0]],N={x:H.endX-H.startX,y:H.endY-H.startY},Y=function(t){switch(t){case C:u+N.x>v&&(N.x=v-u);break;case M:c+N.x<m&&(N.x=m-c);break;case k:l+N.y<g&&(N.y=g-l);break;case D:f+N.y>W&&(N.y=W-f);break}};switch(s){case b:c+=N.x,l+=N.y;break;case C:if(N.x>=0&&(u>=v||h&&(l<=g||f>=W))){z=!1;break}Y(C),p+=N.x,p<0&&(s=M,p=-p,c-=p),h&&(d=p/h,l+=(o.height-d)/2);break;case k:if(N.y<=0&&(l<=g||h&&(c<=m||u>=v))){z=!1;break}Y(k),d-=N.y,l+=N.y,d<0&&(s=D,d=-d,l-=d),h&&(p=d*h,c+=(o.width-p)/2);break;case M:if(N.x<=0&&(c<=m||h&&(l<=g||f>=W))){z=!1;break}Y(M),p-=N.x,c+=N.x,p<0&&(s=C,p=-p,c-=p),h&&(d=p/h,l+=(o.height-d)/2);break;case D:if(N.y>=0&&(f>=W||h&&(c<=m||u>=v))){z=!1;break}Y(D),d+=N.y,d<0&&(s=k,d=-d,l-=d),h&&(p=d*h,c+=(o.width-p)/2);break;case O:if(h){if(N.y<=0&&(l<=g||u>=v)){z=!1;break}Y(k),d-=N.y,l+=N.y,p=d*h}else Y(k),Y(C),N.x>=0?u<v?p+=N.x:N.y<=0&&l<=g&&(z=!1):p+=N.x,N.y<=0?l>g&&(d-=N.y,l+=N.y):(d-=N.y,l+=N.y);p<0&&d<0?(s=E,d=-d,p=-p,l-=d,c-=p):p<0?(s=T,p=-p,c-=p):d<0&&(s=B,d=-d,l-=d);break;case T:if(h){if(N.y<=0&&(l<=g||c<=m)){z=!1;break}Y(k),d-=N.y,l+=N.y,p=d*h,c+=o.width-p}else Y(k),Y(M),N.x<=0?c>m?(p-=N.x,c+=N.x):N.y<=0&&l<=g&&(z=!1):(p-=N.x,c+=N.x),N.y<=0?l>g&&(d-=N.y,l+=N.y):(d-=N.y,l+=N.y);p<0&&d<0?(s=B,d=-d,p=-p,l-=d,c-=p):p<0?(s=O,p=-p,c-=p):d<0&&(s=E,d=-d,l-=d);break;case E:if(h){if(N.x<=0&&(c<=m||f>=W)){z=!1;break}Y(M),p-=N.x,c+=N.x,d=p/h}else Y(D),Y(M),N.x<=0?c>m?(p-=N.x,c+=N.x):N.y>=0&&f>=W&&(z=!1):(p-=N.x,c+=N.x),N.y>=0?f<W&&(d+=N.y):d+=N.y;p<0&&d<0?(s=O,d=-d,p=-p,l-=d,c-=p):p<0?(s=B,p=-p,c-=p):d<0&&(s=T,d=-d,l-=d);break;case B:if(h){if(N.x>=0&&(u>=v||f>=W)){z=!1;break}Y(C),p+=N.x,d=p/h}else Y(D),Y(C),N.x>=0?u<v?p+=N.x:N.y>=0&&f>=W&&(z=!1):p+=N.x,N.y>=0?f<W&&(d+=N.y):d+=N.y;p<0&&d<0?(s=T,d=-d,p=-p,l-=d,c-=p):p<0?(s=E,p=-p,c-=p):d<0&&(s=O,d=-d,l-=d);break;case y:this.move(N.x,N.y),z=!1;break;case x:this.zoom($t(r),t),z=!1;break;case w:if(!N.x||!N.y){z=!1;break}e=At(this.cropper),c=H.startX-e.left,l=H.startY-e.top,p=o.minWidth,d=o.minHeight,N.x>0?s=N.y>0?B:O:N.x<0&&(c-=p,s=N.y>0?E:T),N.y<0&&(l-=d),this.cropped||(Bt(this.cropBox,R),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}z&&(o.width=p,o.height=d,o.left=c,o.top=l,this.action=s,this.renderCropBox()),yt(r,(function(t){t.startX=t.endX,t.startY=t.endY}))}},le={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Tt(this.dragBox,Y),Bt(this.cropBox,R),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=xt({},this.initialImageData),this.canvasData=xt({},this.initialCanvasData),this.cropBoxData=xt({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(xt(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Bt(this.dragBox,Y),Tt(this.cropBox,R)),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,yt(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,Bt(this.cropper,z)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Tt(this.cropper,z)),this},destroy:function(){var t=this.element;return t[v]?(t[v]=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,i=this.canvasData,a=i.left,n=i.top;return this.moveTo(ut(t)?t:a+Number(t),ut(e)?e:n+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(pt(t)&&(i.left=t,a=!0),pt(e)&&(i.top=e,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=Number(t),t=t<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var a=this.options,n=this.canvasData,o=n.width,r=n.height,s=n.naturalWidth,h=n.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&a.zoomable){var c=s*t,l=h*t;if(!1===St(this.element,it,{ratio:t,oldRatio:o/s,originalEvent:i}))return this;if(i){var p=this.pointers,d=At(this.cropper),u=p&&Object.keys(p).length?Zt(p):{pageX:i.pageX,pageY:i.pageY};n.left-=(c-o)*((u.pageX-d.left-n.left)/o),n.top-=(l-r)*((u.pageY-d.top-n.top)/r)}else gt(e)&&pt(e.x)&&pt(e.y)?(n.left-=(c-o)*((e.x-n.left)/o),n.top-=(l-r)*((e.y-n.top)/r)):(n.left-=(c-o)/2,n.top-=(l-r)/2);n.width=c,n.height=l,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),pt(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,pt(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(pt(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(pt(t)&&(i.scaleX=t,a=!0),pt(e)&&(i.scaleY=e,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,a=this.imageData,n=this.canvasData,o=this.cropBoxData;if(this.ready&&this.cropped){t={x:o.left-n.left,y:o.top-n.top,width:o.width,height:o.height};var r=a.width/a.naturalWidth;if(yt(t,(function(e,i){t[i]=e/r})),e){var s=Math.round(t.y+t.height),h=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=h-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=a.rotate||0),i.scalable&&(t.scaleX=a.scaleX||1,t.scaleY=a.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,a=this.canvasData,n={};if(this.ready&&!this.disabled&>(t)){var o=!1;e.rotatable&&pt(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),e.scalable&&(pt(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),pt(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var r=i.width/i.naturalWidth;pt(t.x)&&(n.left=t.x*r+a.left),pt(t.y)&&(n.top=t.y*r+a.top),pt(t.width)&&(n.width=t.width*r),pt(t.height)&&(n.height=t.height*r),this.setCropBoxData(n)}return this},getContainerData:function(){return this.ready?xt({},this.containerData):{}},getImageData:function(){return this.sized?xt({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&yt(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&>(t)&&(pt(t.left)&&(e.left=t.left),pt(t.top)&&(e.top=t.top),pt(t.width)?(e.width=t.width,e.height=t.width/i):pt(t.height)&&(e.height=t.height,e.width=t.height*i),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,i,a=this.cropBoxData,n=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&>(t)&&(pt(t.left)&&(a.left=t.left),pt(t.top)&&(a.top=t.top),pt(t.width)&&t.width!==a.width&&(e=!0,a.width=t.width),pt(t.height)&&t.height!==a.height&&(i=!0,a.height=t.height),n&&(e?a.height=a.width/n:i&&(a.width=a.height*n)),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,i=Ft(this.image,this.imageData,e,t);if(!this.cropped)return i;var a=this.getData(),n=a.x,o=a.y,r=a.width,h=a.height,c=i.width/Math.floor(e.naturalWidth);1!==c&&(n*=c,o*=c,r*=c,h*=c);var l=r/h,p=Kt({aspectRatio:l,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=Kt({aspectRatio:l,width:t.minWidth||0,height:t.minHeight||0},"cover"),u=Kt({aspectRatio:l,width:t.width||(1!==c?i.width:r),height:t.height||(1!==c?i.height:h)}),f=u.width,m=u.height;f=Math.min(p.width,Math.max(d.width,f)),m=Math.min(p.height,Math.max(d.height,m));var g=document.createElement("canvas"),v=g.getContext("2d");g.width=Mt(f),g.height=Mt(m),v.fillStyle=t.fillColor||"transparent",v.fillRect(0,0,f,m);var b=t.imageSmoothingEnabled,w=void 0===b||b,y=t.imageSmoothingQuality;v.imageSmoothingEnabled=w,y&&(v.imageSmoothingQuality=y);var x,C,M,D,k,O,T=i.width,B=i.height,E=n,W=o;E<=-r||E>T?(E=0,x=0,M=0,k=0):E<=0?(M=-E,E=0,x=Math.min(T,r+E),k=x):E<=T&&(M=0,x=Math.min(r,T-E),k=x),x<=0||W<=-h||W>B?(W=0,C=0,D=0,O=0):W<=0?(D=-W,W=0,C=Math.min(B,h+W),O=C):W<=B&&(D=0,C=Math.min(h,B-W),O=C);var z=[E,W,x,C];if(k>0&&O>0){var R=f/r;z.push(M*R,D*R,k*R,O*R)}return v.drawImage.apply(v,[i].concat(s(z.map((function(t){return Math.floor(Mt(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||ut(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var n=t===S,o=e.movable&&t===A;t=n||o?t:P,e.dragMode=t,Ht(i,X,t),Et(i,W,n),Et(i,j,o),e.cropBoxMovable||(Ht(a,X,t),Et(a,W,n),Et(a,j,o))}return this}},pe=f.Cropper,de=function(){function t(i){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e(this,t),!i||!st.test(i.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=i,this.options=xt({},ht,gt(a)&&a),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return a(t,[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[v]){if(e[v]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(ot.test(t))rt.test(t)?this.read(ee(t)):this.clone();else{var n=new XMLHttpRequest,o=this.clone.bind(this);this.reloading=!0,this.xhr=n,n.onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){n.getResponseHeader("content-type")!==at&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&Ut(t)&&i.crossOrigin&&(t=_t(t)),n.open("GET",t),n.responseType="arraybuffer",n.withCredentials="use-credentials"===i.crossOrigin,n.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=ae(t),n=0,o=1,r=1;if(a>1){this.url=ie(t,at);var s=ne(a);n=s.rotate,o=s.scaleX,r=s.scaleY}e.rotatable&&(i.rotate=n),e.scalable&&(i.scaleX=o,i.scaleY=r),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,a=e;this.options.checkCrossOrigin&&Ut(e)&&(i||(i="anonymous"),a=_t(e)),this.crossOrigin=i,this.crossOriginUrl=a;var n=document.createElement("img");i&&(n.crossOrigin=i),n.src=a||e,n.alt=t.alt||"The image to crop",this.image=n,n.onload=this.start.bind(this),n.onerror=this.stop.bind(this),Tt(n,H),t.parentNode.insertBefore(n,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=f.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(f.navigator.userAgent),a=function(e,i){xt(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var n=document.createElement("img"),o=document.body||document.documentElement;this.sizingImage=n,n.onload=function(){a(n.width,n.height),i||o.removeChild(n)},n.src=e.src,i||(n.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",o.appendChild(n))}else a(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,a=t.parentNode,n=document.createElement("div");n.innerHTML=ct;var o=n.querySelector(".".concat(v,"-container")),r=o.querySelector(".".concat(v,"-canvas")),s=o.querySelector(".".concat(v,"-drag-box")),h=o.querySelector(".".concat(v,"-crop-box")),c=h.querySelector(".".concat(v,"-face"));this.container=a,this.cropper=o,this.canvas=r,this.dragBox=s,this.cropBox=h,this.viewBox=o.querySelector(".".concat(v,"-view-box")),this.face=c,r.appendChild(i),Tt(t,R),a.insertBefore(o,t.nextSibling),this.isImg||Bt(i,H),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Tt(h,R),e.guides||Tt(h.getElementsByClassName("".concat(v,"-dashed")),R),e.center||Tt(h.getElementsByClassName("".concat(v,"-center")),R),e.background&&Tt(o,"".concat(v,"-bg")),e.highlight||Tt(c,N),e.cropBoxMovable&&(Tt(c,j),Ht(c,X,b)),e.cropBoxResizable||(Tt(h.getElementsByClassName("".concat(v,"-line")),R),Tt(h.getElementsByClassName("".concat(v,"-point")),R)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),vt(e.ready)&&Lt(t,V,e.ready,{once:!0}),St(t,V)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),Bt(this.element,R))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=pe,t}},{key:"setDefaults",value:function(t){xt(ht,gt(t)&&t)}}]),t}();return xt(de.prototype,oe,re,se,he,ce,le),de}))},wyMu:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=void 0;var a=s(i("q1tI")),n=r(i("17x9")),o=r(i("urRO"));function r(t){return t&&t.__esModule?t:{default:t}}function s(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var a=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(t,i):{};a.get||a.set?Object.defineProperty(e,i,a):e[i]=t[i]}return e["default"]=t,e}function h(t){return h="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}function c(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function l(){return l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t},l.apply(this,arguments)}function p(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function u(t,e,i){return e&&d(t.prototype,e),i&&d(t,i),t}function f(t,e){return!e||"object"!==h(e)&&"function"!==typeof e?m(t):e}function m(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},g(t)}function v(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&b(t,e)}function b(t,e){return b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},b(t,e)}var w=["dragMode","aspectRatio","data","crop","viewMode","preview","responsive","restore","checkCrossOrigin","checkOrientation","modal","guides","center","highlight","background","autoCrop","autoCropArea","movable","rotatable","scalable","zoomable","zoomOnTouch","zoomOnWheel","wheelZoomRatio","cropBoxMovable","cropBoxResizable","toggleDragModeOnDblclick","minContainerWidth","minContainerHeight","minCanvasWidth","minCanvasHeight","minCropBoxWidth","minCropBoxHeight","ready","cropstart","cropmove","cropend","zoom"],y=w.slice(4),x=function(t){function e(){return p(this,e),f(this,g(e).apply(this,arguments))}return v(e,t),u(e,[{key:"componentDidMount",value:function(){var t=this,e=Object.keys(this.props).filter((function(t){return-1!==w.indexOf(t)})).reduce((function(e,i){return l({},e,c({},i,t.props[i]))}),{});this.cropper=new o["default"](this.img,e)}},{key:"UNSAFE_componentWillReceiveProps",value:function(t){var e=this;t.src!==this.props.src&&this.cropper.reset().clear().replace(t.src),t.aspectRatio!==this.props.aspectRatio&&this.setAspectRatio(t.aspectRatio),t.data!==this.props.data&&this.setData(t.data),t.dragMode!==this.props.dragMode&&this.setDragMode(t.dragMode),t.cropBoxData!==this.props.cropBoxData&&this.setCropBoxData(t.cropBoxData),t.canvasData!==this.props.canvasData&&this.setCanvasData(t.canvasData),t.moveTo!==this.props.moveTo&&(t.moveTo.length>1?this.moveTo(t.moveTo[0],t.moveTo[1]):this.moveTo(t.moveTo[0])),t.zoomTo!==this.props.zoomTo&&this.zoomTo(t.zoomTo),t.rotateTo!==this.props.rotateTo&&this.rotateTo(t.rotateTo),t.scaleX!==this.props.scaleX&&this.scaleX(t.scaleX),t.scaleY!==this.props.scaleY&&this.scaleY(t.scaleY),t.enable!==this.props.enable&&(t.enable?this.enable():this.disable()),Object.keys(t).forEach((function(i){var a=t[i]!==e.props[i],n=-1!==y.indexOf(i);if("function"===typeof t[i]&&"function"===typeof e.props[i]&&(a=t[i].toString()!==e.props[i].toString()),a&&n)throw new Error("prop: ".concat(i," can't be change after componentDidMount"))}))}},{key:"componentWillUnmount",value:function(){this.img&&(this.cropper.destroy(),delete this.img,delete this.cropper)}},{key:"setDragMode",value:function(t){return this.cropper.setDragMode(t)}},{key:"setAspectRatio",value:function(t){return this.cropper.setAspectRatio(t)}},{key:"getCroppedCanvas",value:function(t){return this.cropper.getCroppedCanvas(t)}},{key:"setCropBoxData",value:function(t){return this.cropper.setCropBoxData(t)}},{key:"getCropBoxData",value:function(){return this.cropper.getCropBoxData()}},{key:"setCanvasData",value:function(t){return this.cropper.setCanvasData(t)}},{key:"getCanvasData",value:function(){return this.cropper.getCanvasData()}},{key:"getImageData",value:function(){return this.cropper.getImageData()}},{key:"getContainerData",value:function(){return this.cropper.getContainerData()}},{key:"setData",value:function(t){return this.cropper.setData(t)}},{key:"getData",value:function(t){return this.cropper.getData(t)}},{key:"crop",value:function(){return this.cropper.crop()}},{key:"move",value:function(t,e){return this.cropper.move(t,e)}},{key:"moveTo",value:function(t,e){return this.cropper.moveTo(t,e)}},{key:"zoom",value:function(t){return this.cropper.zoom(t)}},{key:"zoomTo",value:function(t){return this.cropper.zoomTo(t)}},{key:"rotate",value:function(t){return this.cropper.rotate(t)}},{key:"rotateTo",value:function(t){return this.cropper.rotateTo(t)}},{key:"enable",value:function(){return this.cropper.enable()}},{key:"disable",value:function(){return this.cropper.disable()}},{key:"reset",value:function(){return this.cropper.reset()}},{key:"clear",value:function(){return this.cropper.clear()}},{key:"replace",value:function(t,e){return this.cropper.replace(t,e)}},{key:"scale",value:function(t,e){return this.cropper.scale(t,e)}},{key:"scaleX",value:function(t){return this.cropper.scaleX(t)}},{key:"scaleY",value:function(t){return this.cropper.scaleY(t)}},{key:"render",value:function(){var t=this,e=this.props,i=e.src,n=e.alt,o=e.crossOrigin,r=e.style,s=e.className;return a["default"].createElement("div",{style:r,className:s},a["default"].createElement("img",{crossOrigin:o,ref:function(e){t.img=e},src:i,alt:void 0===n?"picture":n,style:{opacity:0}}))}}]),e}(a.Component);x.propTypes={style:n["default"].object,className:n["default"].string,crossOrigin:n["default"].string,src:n["default"].string,alt:n["default"].string,aspectRatio:n["default"].number,dragMode:n["default"].oneOf(["crop","move","none"]),data:n["default"].shape({x:n["default"].number,y:n["default"].number,width:n["default"].number,height:n["default"].number,rotate:n["default"].number,scaleX:n["default"].number,scaleY:n["default"].number}),scaleX:n["default"].number,scaleY:n["default"].number,enable:n["default"].bool,cropBoxData:n["default"].shape({left:n["default"].number,top:n["default"].number,width:n["default"].number,height:n["default"].number}),canvasData:n["default"].shape({left:n["default"].number,top:n["default"].number,width:n["default"].number,height:n["default"].number}),zoomTo:n["default"].number,moveTo:n["default"].arrayOf(n["default"].number),rotateTo:n["default"].number,viewMode:n["default"].oneOf([0,1,2,3]),preview:n["default"].string,responsive:n["default"].bool,restore:n["default"].bool,checkCrossOrigin:n["default"].bool,checkOrientation:n["default"].bool,modal:n["default"].bool,guides:n["default"].bool,center:n["default"].bool,highlight:n["default"].bool,background:n["default"].bool,autoCrop:n["default"].bool,autoCropArea:n["default"].number,movable:n["default"].bool,rotatable:n["default"].bool,scalable:n["default"].bool,zoomable:n["default"].bool,zoomOnTouch:n["default"].bool,zoomOnWheel:n["default"].bool,wheelZoomRatio:n["default"].number,cropBoxMovable:n["default"].bool,cropBoxResizable:n["default"].bool,toggleDragModeOnDblclick:n["default"].bool,minContainerWidth:n["default"].number,minContainerHeight:n["default"].number,minCanvasWidth:n["default"].number,minCanvasHeight:n["default"].number,minCropBoxWidth:n["default"].number,minCropBoxHeight:n["default"].number,ready:n["default"].func,cropstart:n["default"].func,cropmove:n["default"].func,cropend:n["default"].func,crop:n["default"].func,zoom:n["default"].func},x.defaultProps={src:null,dragMode:"crop",data:null,scaleX:1,scaleY:1,enable:!0,zoomTo:1,rotateTo:0};var C=x;e["default"]=C}}]); |