UNPKG

file-previewer-vue

Version:
11 lines 1.3 MB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["file-previewer"]=t():e["file-previewer"]=t()})("undefined"!==typeof self?self:this,(function(){return function(){var e={526:function(e,t){"use strict";t.byteLength=l,t.toByteArray=h,t.fromByteArray=p;for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function l(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function u(e,t,r){return 3*(t+r)/4-r}function h(e){var t,r,a=c(e),o=a[0],s=a[1],l=new i(u(e,o,s)),h=0,f=s>0?o-4:o;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],l[h++]=t>>16&255,l[h++]=t>>8&255,l[h++]=255&t;return 2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,l[h++]=255&t),1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,l[h++]=t>>8&255,l[h++]=255&t),l}function f(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function d(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(f(n));return i.join("")}function p(e){for(var t,n=e.length,i=n%3,a=[],o=16383,s=0,c=n-i;s<c;s+=o)a.push(d(e,s,s+o>c?c:s+o));return 1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},75:function(e,t,r){"use strict";var n=r(453),i=r(487),a=i(n("String.prototype.indexOf"));e.exports=function(e,t){var r=n(e,!!t);return"function"===typeof r&&a(e,".prototype.")>-1?i(r):r}},487:function(e,t,r){"use strict";var n=r(743),i=r(453),a=r(897),o=r(675),s=i("%Function.prototype.apply%"),c=i("%Function.prototype.call%"),l=i("%Reflect.apply%",!0)||n.call(c,s),u=r(655),h=i("%Math.max%");e.exports=function(e){if("function"!==typeof e)throw new o("a function is required");var t=l(n,c,arguments);return a(t,1+h(0,e.length-(arguments.length-1)),!0)};var f=function(){return l(n,s,arguments)};u?u(e.exports,"apply",{value:f}):e.exports.apply=f},643:function(e){ /*! * Cropper.js v1.6.2 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2024-04-21T07:43:05.335Z */ (function(t,r){e.exports=r()})(0,(function(){"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function t(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function n(e){var t=r(e,"string");return"symbol"==typeof t?t:t+""}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function s(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e,t,r){return t=n(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e){return u(e)||h(e)||f(e)||p()}function u(e){if(Array.isArray(e))return d(e)}function h(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function f(e,t){if(e){if("string"===typeof e)return d(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(){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 g="undefined"!==typeof window&&"undefined"!==typeof window.document,m=g?window:{},v=!(!g||!m.document.documentElement)&&"ontouchstart"in m.document.documentElement,y=!!g&&"PointerEvent"in m,b="cropper",w="all",S="crop",_="move",k="zoom",x="e",A="w",C="s",P="n",E="ne",T="nw",I="se",O="sw",R="".concat(b,"-crop"),F="".concat(b,"-disabled"),L="".concat(b,"-hidden"),M="".concat(b,"-hide"),D="".concat(b,"-invisible"),N="".concat(b,"-modal"),B="".concat(b,"-move"),j="".concat(b,"Action"),U="".concat(b,"Preview"),q="crop",z="move",W="none",H="crop",G="cropend",V="cropmove",X="cropstart",Y="dblclick",K=v?"touchstart":"mousedown",J=v?"touchmove":"mousemove",Q=v?"touchend touchcancel":"mouseup",Z=y?"pointerdown":K,$=y?"pointermove":J,ee=y?"pointerup pointercancel":Q,te="ready",re="resize",ne="wheel",ie="zoom",ae="image/jpeg",oe=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,se=/^data:/,ce=/^data:image\/jpeg;base64,/,le=/^img|canvas$/i,ue=200,he=100,fe={viewMode:0,dragMode:q,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:ue,minContainerHeight:he,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},de='<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>',pe=Number.isNaN||m.isNaN;function ge(e){return"number"===typeof e&&!pe(e)}var me=function(e){return e>0&&e<1/0};function ve(e){return"undefined"===typeof e}function ye(e){return"object"===i(e)&&null!==e}var be=Object.prototype.hasOwnProperty;function we(e){if(!ye(e))return!1;try{var t=e.constructor,r=t.prototype;return t&&r&&be.call(r,"isPrototypeOf")}catch(n){return!1}}function Se(e){return"function"===typeof e}var _e=Array.prototype.slice;function ke(e){return Array.from?Array.from(e):_e.call(e)}function xe(e,t){return e&&Se(t)&&(Array.isArray(e)||ge(e.length)?ke(e).forEach((function(r,n){t.call(e,r,n,e)})):ye(e)&&Object.keys(e).forEach((function(r){t.call(e,e[r],r,e)}))),e}var Ae=Object.assign||function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return ye(e)&&r.length>0&&r.forEach((function(t){ye(t)&&Object.keys(t).forEach((function(r){e[r]=t[r]}))})),e},Ce=/\.\d*(?:0|9){12}\d*$/;function Pe(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Ce.test(e)?Math.round(e*t)/t:e}var Ee=/^width|height|left|top|marginLeft|marginTop$/;function Te(e,t){var r=e.style;xe(t,(function(e,t){Ee.test(t)&&ge(e)&&(e="".concat(e,"px")),r[t]=e}))}function Ie(e,t){return e.classList?e.classList.contains(t):e.className.indexOf(t)>-1}function Oe(e,t){if(t)if(ge(e.length))xe(e,(function(e){Oe(e,t)}));else if(e.classList)e.classList.add(t);else{var r=e.className.trim();r?r.indexOf(t)<0&&(e.className="".concat(r," ").concat(t)):e.className=t}}function Re(e,t){t&&(ge(e.length)?xe(e,(function(e){Re(e,t)})):e.classList?e.classList.remove(t):e.className.indexOf(t)>=0&&(e.className=e.className.replace(t,"")))}function Fe(e,t,r){t&&(ge(e.length)?xe(e,(function(e){Fe(e,t,r)})):r?Oe(e,t):Re(e,t))}var Le=/([a-z\d])([A-Z])/g;function Me(e){return e.replace(Le,"$1-$2").toLowerCase()}function De(e,t){return ye(e[t])?e[t]:e.dataset?e.dataset[t]:e.getAttribute("data-".concat(Me(t)))}function Ne(e,t,r){ye(r)?e[t]=r:e.dataset?e.dataset[t]=r:e.setAttribute("data-".concat(Me(t)),r)}function Be(e,t){if(ye(e[t]))try{delete e[t]}catch(r){e[t]=void 0}else if(e.dataset)try{delete e.dataset[t]}catch(r){e.dataset[t]=void 0}else e.removeAttribute("data-".concat(Me(t)))}var je=/\s\s*/,Ue=function(){var e=!1;if(g){var t=!1,r=function(){},n=Object.defineProperty({},"once",{get:function(){return e=!0,t},set:function(e){t=e}});m.addEventListener("test",r,n),m.removeEventListener("test",r,n)}return e}();function qe(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r;t.trim().split(je).forEach((function(t){if(!Ue){var a=e.listeners;a&&a[t]&&a[t][r]&&(i=a[t][r],delete a[t][r],0===Object.keys(a[t]).length&&delete a[t],0===Object.keys(a).length&&delete e.listeners)}e.removeEventListener(t,i,n)}))}function ze(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r;t.trim().split(je).forEach((function(t){if(n.once&&!Ue){var a=e.listeners,o=void 0===a?{}:a;i=function(){delete o[t][r],e.removeEventListener(t,i,n);for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];r.apply(e,s)},o[t]||(o[t]={}),o[t][r]&&e.removeEventListener(t,o[t][r],n),o[t][r]=i,e.listeners=o}e.addEventListener(t,i,n)}))}function We(e,t,r){var n;return Se(Event)&&Se(CustomEvent)?n=new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(t,!0,!0,r)),e.dispatchEvent(n)}function He(e){var t=e.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var Ge=m.location,Ve=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Xe(e){var t=e.match(Ve);return null!==t&&(t[1]!==Ge.protocol||t[2]!==Ge.hostname||t[3]!==Ge.port)}function Ye(e){var t="timestamp=".concat((new Date).getTime());return e+(-1===e.indexOf("?")?"?":"&")+t}function Ke(e){var t=e.rotate,r=e.scaleX,n=e.scaleY,i=e.translateX,a=e.translateY,o=[];ge(i)&&0!==i&&o.push("translateX(".concat(i,"px)")),ge(a)&&0!==a&&o.push("translateY(".concat(a,"px)")),ge(t)&&0!==t&&o.push("rotate(".concat(t,"deg)")),ge(r)&&1!==r&&o.push("scaleX(".concat(r,")")),ge(n)&&1!==n&&o.push("scaleY(".concat(n,")"));var s=o.length?o.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function Je(e){var r=t({},e),n=0;return xe(e,(function(e,t){delete r[t],xe(r,(function(t){var r=Math.abs(e.startX-t.startX),i=Math.abs(e.startY-t.startY),a=Math.abs(e.endX-t.endX),o=Math.abs(e.endY-t.endY),s=Math.sqrt(r*r+i*i),c=Math.sqrt(a*a+o*o),l=(c-s)/s;Math.abs(l)>Math.abs(n)&&(n=l)}))})),n}function Qe(e,r){var n=e.pageX,i=e.pageY,a={endX:n,endY:i};return r?a:t({startX:n,startY:i},a)}function Ze(e){var t=0,r=0,n=0;return xe(e,(function(e){var i=e.startX,a=e.startY;t+=i,r+=a,n+=1})),t/=n,r/=n,{pageX:t,pageY:r}}function $e(e){var t=e.aspectRatio,r=e.height,n=e.width,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",a=me(n),o=me(r);if(a&&o){var s=r*t;"contain"===i&&s>n||"cover"===i&&s<n?r=n/t:n=r*t}else a?r=n/t:o&&(n=r*t);return{width:n,height:r}}function et(e){var t=e.width,r=e.height,n=e.degree;if(n=Math.abs(n)%180,90===n)return{width:r,height:t};var i=n%90*Math.PI/180,a=Math.sin(i),o=Math.cos(i),s=t*o+r*a,c=t*a+r*o;return n>90?{width:c,height:s}:{width:s,height:c}}function tt(e,t,r,n){var i=t.aspectRatio,a=t.naturalWidth,o=t.naturalHeight,s=t.rotate,c=void 0===s?0:s,u=t.scaleX,h=void 0===u?1:u,f=t.scaleY,d=void 0===f?1:f,p=r.aspectRatio,g=r.naturalWidth,m=r.naturalHeight,v=n.fillColor,y=void 0===v?"transparent":v,b=n.imageSmoothingEnabled,w=void 0===b||b,S=n.imageSmoothingQuality,_=void 0===S?"low":S,k=n.maxWidth,x=void 0===k?1/0:k,A=n.maxHeight,C=void 0===A?1/0:A,P=n.minWidth,E=void 0===P?0:P,T=n.minHeight,I=void 0===T?0:T,O=document.createElement("canvas"),R=O.getContext("2d"),F=$e({aspectRatio:p,width:x,height:C}),L=$e({aspectRatio:p,width:E,height:I},"cover"),M=Math.min(F.width,Math.max(L.width,g)),D=Math.min(F.height,Math.max(L.height,m)),N=$e({aspectRatio:i,width:x,height:C}),B=$e({aspectRatio:i,width:E,height:I},"cover"),j=Math.min(N.width,Math.max(B.width,a)),U=Math.min(N.height,Math.max(B.height,o)),q=[-j/2,-U/2,j,U];return O.width=Pe(M),O.height=Pe(D),R.fillStyle=y,R.fillRect(0,0,M,D),R.save(),R.translate(M/2,D/2),R.rotate(c*Math.PI/180),R.scale(h,d),R.imageSmoothingEnabled=w,R.imageSmoothingQuality=_,R.drawImage.apply(R,[e].concat(l(q.map((function(e){return Math.floor(Pe(e))}))))),R.restore(),O}var rt=String.fromCharCode;function nt(e,t,r){var n="";r+=t;for(var i=t;i<r;i+=1)n+=rt(e.getUint8(i));return n}var it=/^data:.*,/;function at(e){var t=e.replace(it,""),r=atob(t),n=new ArrayBuffer(r.length),i=new Uint8Array(n);return xe(i,(function(e,t){i[t]=r.charCodeAt(t)})),n}function ot(e,t){var r=[],n=8192,i=new Uint8Array(e);while(i.length>0)r.push(rt.apply(null,ke(i.subarray(0,n)))),i=i.subarray(n);return"data:".concat(t,";base64,").concat(btoa(r.join("")))}function st(e){var t,r=new DataView(e);try{var n,i,a;if(255===r.getUint8(0)&&216===r.getUint8(1)){var o=r.byteLength,s=2;while(s+1<o){if(255===r.getUint8(s)&&225===r.getUint8(s+1)){i=s;break}s+=1}}if(i){var c=i+4,l=i+10;if("Exif"===nt(r,c,4)){var u=r.getUint16(l);if(n=18761===u,(n||19789===u)&&42===r.getUint16(l+2,n)){var h=r.getUint32(l+4,n);h>=8&&(a=l+h)}}}if(a){var f,d,p=r.getUint16(a,n);for(d=0;d<p;d+=1)if(f=a+12*d+2,274===r.getUint16(f,n)){f+=8,t=r.getUint16(f,n),r.setUint16(f,1,n);break}}}catch(g){t=1}return t}function ct(e){var t=0,r=1,n=1;switch(e){case 2:r=-1;break;case 3:t=-180;break;case 4:n=-1;break;case 5:t=90,n=-1;break;case 6:t=90;break;case 7:t=90,r=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:r,scaleY:n}}var lt={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var e=this.element,t=this.options,r=this.container,n=this.cropper,i=Number(t.minContainerWidth),a=Number(t.minContainerHeight);Oe(n,L),Re(e,L);var o={width:Math.max(r.offsetWidth,i>=0?i:ue),height:Math.max(r.offsetHeight,a>=0?a:he)};this.containerData=o,Te(n,{width:o.width,height:o.height}),Oe(e,L),Re(n,L)},initCanvas:function(){var e=this.containerData,t=this.imageData,r=this.options.viewMode,n=Math.abs(t.rotate)%180===90,i=n?t.naturalHeight:t.naturalWidth,a=n?t.naturalWidth:t.naturalHeight,o=i/a,s=e.width,c=e.height;e.height*o>e.width?3===r?s=e.height*o:c=e.width/o:3===r?c=e.width/o:s=e.height*o;var l={aspectRatio:o,naturalWidth:i,naturalHeight:a,width:s,height:c};this.canvasData=l,this.limited=1===r||2===r,this.limitCanvas(!0,!0),l.width=Math.min(Math.max(l.width,l.minWidth),l.maxWidth),l.height=Math.min(Math.max(l.height,l.minHeight),l.maxHeight),l.left=(e.width-l.width)/2,l.top=(e.height-l.height)/2,l.oldLeft=l.left,l.oldTop=l.top,this.initialCanvasData=Ae({},l)},limitCanvas:function(e,t){var r=this.options,n=this.containerData,i=this.canvasData,a=this.cropBoxData,o=r.viewMode,s=i.aspectRatio,c=this.cropped&&a;if(e){var l=Number(r.minCanvasWidth)||0,u=Number(r.minCanvasHeight)||0;o>1?(l=Math.max(l,n.width),u=Math.max(u,n.height),3===o&&(u*s>l?l=u*s:u=l/s)):o>0&&(l?l=Math.max(l,c?a.width:0):u?u=Math.max(u,c?a.height:0):c&&(l=a.width,u=a.height,u*s>l?l=u*s:u=l/s));var h=$e({aspectRatio:s,width:l,height:u});l=h.width,u=h.height,i.minWidth=l,i.minHeight=u,i.maxWidth=1/0,i.maxHeight=1/0}if(t)if(o>(c?0:1)){var f=n.width-i.width,d=n.height-i.height;i.minLeft=Math.min(0,f),i.minTop=Math.min(0,d),i.maxLeft=Math.max(0,f),i.maxTop=Math.max(0,d),c&&this.limited&&(i.minLeft=Math.min(a.left,a.left+(a.width-i.width)),i.minTop=Math.min(a.top,a.top+(a.height-i.height)),i.maxLeft=a.left,i.maxTop=a.top,2===o&&(i.width>=n.width&&(i.minLeft=Math.min(0,f),i.maxLeft=Math.max(0,f)),i.height>=n.height&&(i.minTop=Math.min(0,d),i.maxTop=Math.max(0,d))))}else i.minLeft=-i.width,i.minTop=-i.height,i.maxLeft=n.width,i.maxTop=n.height},renderCanvas:function(e,t){var r=this.canvasData,n=this.imageData;if(t){var i=et({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),a=i.width,o=i.height,s=r.width*(a/r.naturalWidth),c=r.height*(o/r.naturalHeight);r.left-=(s-r.width)/2,r.top-=(c-r.height)/2,r.width=s,r.height=c,r.aspectRatio=a/o,r.naturalWidth=a,r.naturalHeight=o,this.limitCanvas(!0,!1)}(r.width>r.maxWidth||r.width<r.minWidth)&&(r.left=r.oldLeft),(r.height>r.maxHeight||r.height<r.minHeight)&&(r.top=r.oldTop),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),this.limitCanvas(!1,!0),r.left=Math.min(Math.max(r.left,r.minLeft),r.maxLeft),r.top=Math.min(Math.max(r.top,r.minTop),r.maxTop),r.oldLeft=r.left,r.oldTop=r.top,Te(this.canvas,Ae({width:r.width,height:r.height},Ke({translateX:r.left,translateY:r.top}))),this.renderImage(e),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(e){var t=this.canvasData,r=this.imageData,n=r.naturalWidth*(t.width/t.naturalWidth),i=r.naturalHeight*(t.height/t.naturalHeight);Ae(r,{width:n,height:i,left:(t.width-n)/2,top:(t.height-i)/2}),Te(this.image,Ae({width:r.width,height:r.height},Ke(Ae({translateX:r.left,translateY:r.top},r)))),e&&this.output()},initCropBox:function(){var e=this.options,t=this.canvasData,r=e.aspectRatio||e.initialAspectRatio,n=Number(e.autoCropArea)||.8,i={width:t.width,height:t.height};r&&(t.height*r>t.width?i.height=i.width/r:i.width=i.height*r),this.cropBoxData=i,this.limitCropBox(!0,!0),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),i.width=Math.max(i.minWidth,i.width*n),i.height=Math.max(i.minHeight,i.height*n),i.left=t.left+(t.width-i.width)/2,i.top=t.top+(t.height-i.height)/2,i.oldLeft=i.left,i.oldTop=i.top,this.initialCropBoxData=Ae({},i)},limitCropBox:function(e,t){var r=this.options,n=this.containerData,i=this.canvasData,a=this.cropBoxData,o=this.limited,s=r.aspectRatio;if(e){var c=Number(r.minCropBoxWidth)||0,l=Number(r.minCropBoxHeight)||0,u=o?Math.min(n.width,i.width,i.width+i.left,n.width-i.left):n.width,h=o?Math.min(n.height,i.height,i.height+i.top,n.height-i.top):n.height;c=Math.min(c,n.width),l=Math.min(l,n.height),s&&(c&&l?l*s>c?l=c/s:c=l*s:c?l=c/s:l&&(c=l*s),h*s>u?h=u/s:u=h*s),a.minWidth=Math.min(c,u),a.minHeight=Math.min(l,h),a.maxWidth=u,a.maxHeight=h}t&&(o?(a.minLeft=Math.max(0,i.left),a.minTop=Math.max(0,i.top),a.maxLeft=Math.min(n.width,i.left+i.width)-a.width,a.maxTop=Math.min(n.height,i.top+i.height)-a.height):(a.minLeft=0,a.minTop=0,a.maxLeft=n.width-a.width,a.maxTop=n.height-a.height))},renderCropBox:function(){var e=this.options,t=this.containerData,r=this.cropBoxData;(r.width>r.maxWidth||r.width<r.minWidth)&&(r.left=r.oldLeft),(r.height>r.maxHeight||r.height<r.minHeight)&&(r.top=r.oldTop),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),this.limitCropBox(!1,!0),r.left=Math.min(Math.max(r.left,r.minLeft),r.maxLeft),r.top=Math.min(Math.max(r.top,r.minTop),r.maxTop),r.oldLeft=r.left,r.oldTop=r.top,e.movable&&e.cropBoxMovable&&Ne(this.face,j,r.width>=t.width&&r.height>=t.height?_:w),Te(this.cropBox,Ae({width:r.width,height:r.height},Ke({translateX:r.left,translateY:r.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),We(this.element,H,this.getData())}},ut={initPreview:function(){var e=this.element,t=this.crossOrigin,r=this.options.preview,n=t?this.crossOriginUrl:this.url,i=e.alt||"The image to preview",a=document.createElement("img");if(t&&(a.crossOrigin=t),a.src=n,a.alt=i,this.viewBox.appendChild(a),this.viewBoxImage=a,r){var o=r;"string"===typeof r?o=e.ownerDocument.querySelectorAll(r):r.querySelector&&(o=[r]),this.previews=o,xe(o,(function(e){var r=document.createElement("img");Ne(e,U,{width:e.offsetWidth,height:e.offsetHeight,html:e.innerHTML}),t&&(r.crossOrigin=t),r.src=n,r.alt=i,r.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;"',e.innerHTML="",e.appendChild(r)}))}},resetPreview:function(){xe(this.previews,(function(e){var t=De(e,U);Te(e,{width:t.width,height:t.height}),e.innerHTML=t.html,Be(e,U)}))},preview:function(){var e=this.imageData,t=this.canvasData,r=this.cropBoxData,n=r.width,i=r.height,a=e.width,o=e.height,s=r.left-t.left-e.left,c=r.top-t.top-e.top;this.cropped&&!this.disabled&&(Te(this.viewBoxImage,Ae({width:a,height:o},Ke(Ae({translateX:-s,translateY:-c},e)))),xe(this.previews,(function(t){var r=De(t,U),l=r.width,u=r.height,h=l,f=u,d=1;n&&(d=l/n,f=i*d),i&&f>u&&(d=u/i,h=n*d,f=u),Te(t,{width:h,height:f}),Te(t.getElementsByTagName("img")[0],Ae({width:a*d,height:o*d},Ke(Ae({translateX:-s*d,translateY:-c*d},e))))})))}},ht={bind:function(){var e=this.element,t=this.options,r=this.cropper;Se(t.cropstart)&&ze(e,X,t.cropstart),Se(t.cropmove)&&ze(e,V,t.cropmove),Se(t.cropend)&&ze(e,G,t.cropend),Se(t.crop)&&ze(e,H,t.crop),Se(t.zoom)&&ze(e,ie,t.zoom),ze(r,Z,this.onCropStart=this.cropStart.bind(this)),t.zoomable&&t.zoomOnWheel&&ze(r,ne,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&ze(r,Y,this.onDblclick=this.dblclick.bind(this)),ze(e.ownerDocument,$,this.onCropMove=this.cropMove.bind(this)),ze(e.ownerDocument,ee,this.onCropEnd=this.cropEnd.bind(this)),t.responsive&&ze(window,re,this.onResize=this.resize.bind(this))},unbind:function(){var e=this.element,t=this.options,r=this.cropper;Se(t.cropstart)&&qe(e,X,t.cropstart),Se(t.cropmove)&&qe(e,V,t.cropmove),Se(t.cropend)&&qe(e,G,t.cropend),Se(t.crop)&&qe(e,H,t.crop),Se(t.zoom)&&qe(e,ie,t.zoom),qe(r,Z,this.onCropStart),t.zoomable&&t.zoomOnWheel&&qe(r,ne,this.onWheel,{passive:!1,capture:!0}),t.toggleDragModeOnDblclick&&qe(r,Y,this.onDblclick),qe(e.ownerDocument,$,this.onCropMove),qe(e.ownerDocument,ee,this.onCropEnd),t.responsive&&qe(window,re,this.onResize)}},ft={resize:function(){if(!this.disabled){var e,t,r=this.options,n=this.container,i=this.containerData,a=n.offsetWidth/i.width,o=n.offsetHeight/i.height,s=Math.abs(a-1)>Math.abs(o-1)?a:o;if(1!==s)r.restore&&(e=this.getCanvasData(),t=this.getCropBoxData()),this.render(),r.restore&&(this.setCanvasData(xe(e,(function(t,r){e[r]=t*s}))),this.setCropBoxData(xe(t,(function(e,r){t[r]=e*s}))))}},dblclick:function(){this.disabled||this.options.dragMode===W||this.setDragMode(Ie(this.dragBox,R)?z:q)},wheel:function(e){var t=this,r=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(e.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){t.wheeling=!1}),50),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*r,e)))},cropStart:function(e){var t=e.buttons,r=e.button;if(!(this.disabled||("mousedown"===e.type||"pointerdown"===e.type&&"mouse"===e.pointerType)&&(ge(t)&&1!==t||ge(r)&&0!==r||e.ctrlKey))){var n,i=this.options,a=this.pointers;e.changedTouches?xe(e.changedTouches,(function(e){a[e.identifier]=Qe(e)})):a[e.pointerId||0]=Qe(e),n=Object.keys(a).length>1&&i.zoomable&&i.zoomOnTouch?k:De(e.target,j),oe.test(n)&&!1!==We(this.element,X,{originalEvent:e,action:n})&&(e.preventDefault(),this.action=n,this.cropping=!1,n===S&&(this.cropping=!0,Oe(this.dragBox,N)))}},cropMove:function(e){var t=this.action;if(!this.disabled&&t){var r=this.pointers;e.preventDefault(),!1!==We(this.element,V,{originalEvent:e,action:t})&&(e.changedTouches?xe(e.changedTouches,(function(e){Ae(r[e.identifier]||{},Qe(e,!0))})):Ae(r[e.pointerId||0]||{},Qe(e,!0)),this.change(e))}},cropEnd:function(e){if(!this.disabled){var t=this.action,r=this.pointers;e.changedTouches?xe(e.changedTouches,(function(e){delete r[e.identifier]})):delete r[e.pointerId||0],t&&(e.preventDefault(),Object.keys(r).length||(this.action=""),this.cropping&&(this.cropping=!1,Fe(this.dragBox,N,this.cropped&&this.options.modal)),We(this.element,G,{originalEvent:e,action:t}))}}},dt={change:function(e){var t,r=this.options,n=this.canvasData,i=this.containerData,a=this.cropBoxData,o=this.pointers,s=this.action,c=r.aspectRatio,l=a.left,u=a.top,h=a.width,f=a.height,d=l+h,p=u+f,g=0,m=0,v=i.width,y=i.height,b=!0;!c&&e.shiftKey&&(c=h&&f?h/f:1),this.limited&&(g=a.minLeft,m=a.minTop,v=g+Math.min(i.width,n.width,n.left+n.width),y=m+Math.min(i.height,n.height,n.top+n.height));var R=o[Object.keys(o)[0]],F={x:R.endX-R.startX,y:R.endY-R.startY},M=function(e){switch(e){case x:d+F.x>v&&(F.x=v-d);break;case A:l+F.x<g&&(F.x=g-l);break;case P:u+F.y<m&&(F.y=m-u);break;case C:p+F.y>y&&(F.y=y-p);break}};switch(s){case w:l+=F.x,u+=F.y;break;case x:if(F.x>=0&&(d>=v||c&&(u<=m||p>=y))){b=!1;break}M(x),h+=F.x,h<0&&(s=A,h=-h,l-=h),c&&(f=h/c,u+=(a.height-f)/2);break;case P:if(F.y<=0&&(u<=m||c&&(l<=g||d>=v))){b=!1;break}M(P),f-=F.y,u+=F.y,f<0&&(s=C,f=-f,u-=f),c&&(h=f*c,l+=(a.width-h)/2);break;case A:if(F.x<=0&&(l<=g||c&&(u<=m||p>=y))){b=!1;break}M(A),h-=F.x,l+=F.x,h<0&&(s=x,h=-h,l-=h),c&&(f=h/c,u+=(a.height-f)/2);break;case C:if(F.y>=0&&(p>=y||c&&(l<=g||d>=v))){b=!1;break}M(C),f+=F.y,f<0&&(s=P,f=-f,u-=f),c&&(h=f*c,l+=(a.width-h)/2);break;case E:if(c){if(F.y<=0&&(u<=m||d>=v)){b=!1;break}M(P),f-=F.y,u+=F.y,h=f*c}else M(P),M(x),F.x>=0?d<v?h+=F.x:F.y<=0&&u<=m&&(b=!1):h+=F.x,F.y<=0?u>m&&(f-=F.y,u+=F.y):(f-=F.y,u+=F.y);h<0&&f<0?(s=O,f=-f,h=-h,u-=f,l-=h):h<0?(s=T,h=-h,l-=h):f<0&&(s=I,f=-f,u-=f);break;case T:if(c){if(F.y<=0&&(u<=m||l<=g)){b=!1;break}M(P),f-=F.y,u+=F.y,h=f*c,l+=a.width-h}else M(P),M(A),F.x<=0?l>g?(h-=F.x,l+=F.x):F.y<=0&&u<=m&&(b=!1):(h-=F.x,l+=F.x),F.y<=0?u>m&&(f-=F.y,u+=F.y):(f-=F.y,u+=F.y);h<0&&f<0?(s=I,f=-f,h=-h,u-=f,l-=h):h<0?(s=E,h=-h,l-=h):f<0&&(s=O,f=-f,u-=f);break;case O:if(c){if(F.x<=0&&(l<=g||p>=y)){b=!1;break}M(A),h-=F.x,l+=F.x,f=h/c}else M(C),M(A),F.x<=0?l>g?(h-=F.x,l+=F.x):F.y>=0&&p>=y&&(b=!1):(h-=F.x,l+=F.x),F.y>=0?p<y&&(f+=F.y):f+=F.y;h<0&&f<0?(s=E,f=-f,h=-h,u-=f,l-=h):h<0?(s=I,h=-h,l-=h):f<0&&(s=T,f=-f,u-=f);break;case I:if(c){if(F.x>=0&&(d>=v||p>=y)){b=!1;break}M(x),h+=F.x,f=h/c}else M(C),M(x),F.x>=0?d<v?h+=F.x:F.y>=0&&p>=y&&(b=!1):h+=F.x,F.y>=0?p<y&&(f+=F.y):f+=F.y;h<0&&f<0?(s=T,f=-f,h=-h,u-=f,l-=h):h<0?(s=O,h=-h,l-=h):f<0&&(s=E,f=-f,u-=f);break;case _:this.move(F.x,F.y),b=!1;break;case k:this.zoom(Je(o),e),b=!1;break;case S:if(!F.x||!F.y){b=!1;break}t=He(this.cropper),l=R.startX-t.left,u=R.startY-t.top,h=a.minWidth,f=a.minHeight,F.x>0?s=F.y>0?I:E:F.x<0&&(l-=h,s=F.y>0?O:T),F.y<0&&(u-=f),this.cropped||(Re(this.cropBox,L),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}b&&(a.width=h,a.height=f,a.left=l,a.top=u,this.action=s,this.renderCropBox()),xe(o,(function(e){e.startX=e.endX,e.startY=e.endY}))}},pt={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Oe(this.dragBox,N),Re(this.cropBox,L),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ae({},this.initialImageData),this.canvasData=Ae({},this.initialCanvasData),this.cropBoxData=Ae({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ae(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Re(this.dragBox,N),Oe(this.cropBox,L)),this},replace:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&e&&(this.isImg&&(this.element.src=e),t?(this.url=e,this.image.src=e,this.ready&&(this.viewBoxImage.src=e,xe(this.previews,(function(t){t.getElementsByTagName("img")[0].src=e})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(e))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Re(this.cropper,F)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Oe(this.cropper,F)),this},destroy:function(){var e=this.element;return e[b]?(e[b]=void 0,this.isImg&&this.replaced&&(e.src=this.originalUrl),this.uncreate(),this):this},move:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.canvasData,n=r.left,i=r.top;return this.moveTo(ve(e)?e:n+Number(e),ve(t)?t:i+Number(t))},moveTo:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.canvasData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.movable&&(ge(e)&&(r.left=e,n=!0),ge(t)&&(r.top=t,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(e,t){var r=this.canvasData;return e=Number(e),e=e<0?1/(1-e):1+e,this.zoomTo(r.width*e/r.naturalWidth,null,t)},zoomTo:function(e,t,r){var n=this.options,i=this.canvasData,a=i.width,o=i.height,s=i.naturalWidth,c=i.naturalHeight;if(e=Number(e),e>=0&&this.ready&&!this.disabled&&n.zoomable){var l=s*e,u=c*e;if(!1===We(this.element,ie,{ratio:e,oldRatio:a/s,originalEvent:r}))return this;if(r){var h=this.pointers,f=He(this.cropper),d=h&&Object.keys(h).length?Ze(h):{pageX:r.pageX,pageY:r.pageY};i.left-=(l-a)*((d.pageX-f.left-i.left)/a),i.top-=(u-o)*((d.pageY-f.top-i.top)/o)}else we(t)&&ge(t.x)&&ge(t.y)?(i.left-=(l-a)*((t.x-i.left)/a),i.top-=(u-o)*((t.y-i.top)/o)):(i.left-=(l-a)/2,i.top-=(u-o)/2);i.width=l,i.height=u,this.renderCanvas(!0)}return this},rotate:function(e){return this.rotateTo((this.imageData.rotate||0)+Number(e))},rotateTo:function(e){return e=Number(e),ge(e)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=e%360,this.renderCanvas(!0,!0)),this},scaleX:function(e){var t=this.imageData.scaleY;return this.scale(e,ge(t)?t:1)},scaleY:function(e){var t=this.imageData.scaleX;return this.scale(ge(t)?t:1,e)},scale:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,r=this.imageData,n=!1;return e=Number(e),t=Number(t),this.ready&&!this.disabled&&this.options.scalable&&(ge(e)&&(r.scaleX=e,n=!0),ge(t)&&(r.scaleY=t,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.options,n=this.imageData,i=this.canvasData,a=this.cropBoxData;if(this.ready&&this.cropped){e={x:a.left-i.left,y:a.top-i.top,width:a.width,height:a.height};var o=n.width/n.naturalWidth;if(xe(e,(function(t,r){e[r]=t/o})),t){var s=Math.round(e.y+e.height),c=Math.round(e.x+e.width);e.x=Math.round(e.x),e.y=Math.round(e.y),e.width=c-e.x,e.height=s-e.y}}else e={x:0,y:0,width:0,height:0};return r.rotatable&&(e.rotate=n.rotate||0),r.scalable&&(e.scaleX=n.scaleX||1,e.scaleY=n.scaleY||1),e},setData:function(e){var t=this.options,r=this.imageData,n=this.canvasData,i={};if(this.ready&&!this.disabled&&we(e)){var a=!1;t.rotatable&&ge(e.rotate)&&e.rotate!==r.rotate&&(r.rotate=e.rotate,a=!0),t.scalable&&(ge(e.scaleX)&&e.scaleX!==r.scaleX&&(r.scaleX=e.scaleX,a=!0),ge(e.scaleY)&&e.scaleY!==r.scaleY&&(r.scaleY=e.scaleY,a=!0)),a&&this.renderCanvas(!0,!0);var o=r.width/r.naturalWidth;ge(e.x)&&(i.left=e.x*o+n.left),ge(e.y)&&(i.top=e.y*o+n.top),ge(e.width)&&(i.width=e.width*o),ge(e.height)&&(i.height=e.height*o),this.setCropBoxData(i)}return this},getContainerData:function(){return this.ready?Ae({},this.containerData):{}},getImageData:function(){return this.sized?Ae({},this.imageData):{}},getCanvasData:function(){var e=this.canvasData,t={};return this.ready&&xe(["left","top","width","height","naturalWidth","naturalHeight"],(function(r){t[r]=e[r]})),t},setCanvasData:function(e){var t=this.canvasData,r=t.aspectRatio;return this.ready&&!this.disabled&&we(e)&&(ge(e.left)&&(t.left=e.left),ge(e.top)&&(t.top=e.top),ge(e.width)?(t.width=e.width,t.height=e.width/r):ge(e.height)&&(t.height=e.height,t.width=e.height*r),this.renderCanvas(!0)),this},getCropBoxData:function(){var e,t=this.cropBoxData;return this.ready&&this.cropped&&(e={left:t.left,top:t.top,width:t.width,height:t.height}),e||{}},setCropBoxData:function(e){var t,r,n=this.cropBoxData,i=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&we(e)&&(ge(e.left)&&(n.left=e.left),ge(e.top)&&(n.top=e.top),ge(e.width)&&e.width!==n.width&&(t=!0,n.width=e.width),ge(e.height)&&e.height!==n.height&&(r=!0,n.height=e.height),i&&(t?n.height=n.width/i:r&&(n.width=n.height*i)),this.renderCropBox()),this},getCroppedCanvas:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var t=this.canvasData,r=tt(this.image,this.imageData,t,e);if(!this.cropped)return r;var n=this.getData(e.rounded),i=n.x,a=n.y,o=n.width,s=n.height,c=r.width/Math.floor(t.naturalWidth);1!==c&&(i*=c,a*=c,o*=c,s*=c);var u=o/s,h=$e({aspectRatio:u,width:e.maxWidth||1/0,height:e.maxHeight||1/0}),f=$e({aspectRatio:u,width:e.minWidth||0,height:e.minHeight||0},"cover"),d=$e({aspectRatio:u,width:e.width||(1!==c?r.width:o),height:e.height||(1!==c?r.height:s)}),p=d.width,g=d.height;p=Math.min(h.width,Math.max(f.width,p)),g=Math.min(h.height,Math.max(f.height,g));var m=document.createElement("canvas"),v=m.getContext("2d");m.width=Pe(p),m.height=Pe(g),v.fillStyle=e.fillColor||"transparent",v.fillRect(0,0,p,g);var y=e.imageSmoothingEnabled,b=void 0===y||y,w=e.imageSmoothingQuality;v.imageSmoothingEnabled=b,w&&(v.imageSmoothingQuality=w);var S,_,k,x,A,C,P=r.width,E=r.height,T=i,I=a;T<=-o||T>P?(T=0,S=0,k=0,A=0):T<=0?(k=-T,T=0,S=Math.min(P,o+T),A=S):T<=P&&(k=0,S=Math.min(o,P-T),A=S),S<=0||I<=-s||I>E?(I=0,_=0,x=0,C=0):I<=0?(x=-I,I=0,_=Math.min(E,s+I),C=_):I<=E&&(x=0,_=Math.min(s,E-I),C=_);var O=[T,I,S,_];if(A>0&&C>0){var R=p/o;O.push(k*R,x*R,A*R,C*R)}return v.drawImage.apply(v,[r].concat(l(O.map((function(e){return Math.floor(Pe(e))}))))),m},setAspectRatio:function(e){var t=this.options;return this.disabled||ve(e)||(t.aspectRatio=Math.max(0,e)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(e){var t=this.options,r=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var i=e===q,a=t.movable&&e===z;e=i||a?e:W,t.dragMode=e,Ne(r,j,e),Fe(r,R,i),Fe(r,B,a),t.cropBoxMovable||(Ne(n,j,e),Fe(n,R,i),Fe(n,B,a))}return this}},gt=m.Cropper,mt=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(a(this,e),!t||!le.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=Ae({},fe,we(r)&&r),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 s(e,[{key:"init",value:function(){var e,t=this.element,r=t.tagName.toLowerCase();if(!t[b]){if(t[b]=this,"img"===r){if(this.isImg=!0,e=t.getAttribute("src")||"",this.originalUrl=e,!e)return;e=t.src}else"canvas"===r&&window.HTMLCanvasElement&&(e=t.toDataURL());this.load(e)}}},{key:"load",value:function(e){var t=this;if(e){this.url=e,this.imageData={};var r=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(se.test(e))ce.test(e)?this.read(at(e)):this.clone();else{var i=new XMLHttpRequest,a=this.clone.bind(this);this.reloading=!0,this.xhr=i,i.onabort=a,i.onerror=a,i.ontimeout=a,i.onprogress=function(){i.getResponseHeader("content-type")!==ae&&i.abort()},i.onload=function(){t.read(i.response)},i.onloadend=function(){t.reloading=!1,t.xhr=null},n.checkCrossOrigin&&Xe(e)&&r.crossOrigin&&(e=Ye(e)),i.open("GET",e,!0),i.responseType="arraybuffer",i.withCredentials="use-credentials"===r.crossOrigin,i.send()}else this.clone()}}},{key:"read",value:function(e){var t=this.options,r=this.imageData,n=st(e),i=0,a=1,o=1;if(n>1){this.url=ot(e,ae);var s=ct(n);i=s.rotate,a=s.scaleX,o=s.scaleY}t.rotatable&&(r.rotate=i),t.scalable&&(r.scaleX=a,r.scaleY=o),this.clone()}},{key:"clone",value:function(){var e=this.element,t=this.url,r=e.crossOrigin,n=t;this.options.checkCrossOrigin&&Xe(t)&&(r||(r="anonymous"),n=Ye(t)),this.crossOrigin=r,this.crossOriginUrl=n;var i=document.createElement("img");r&&(i.crossOrigin=r),i.src=n||t,i.alt=e.alt||"The image to crop",this.image=i,i.onload=this.start.bind(this),i.onerror=this.stop.bind(this),Oe(i,M),e.parentNode.insertBefore(i,e.nextSibling)}},{key:"start",value:function(){var e=this,t=this.image;t.onload=null,t.onerror=null,this.sizing=!0;var r=m.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(m.navigator.userAgent),n=function(t,r){Ae(e.imageData,{naturalWidth:t,naturalHeight:r,aspectRatio:t/r}),e.initialImageData=Ae({},e.imageData),e.sizing=!1,e.sized=!0,e.build()};if(!t.naturalWidth||r){var i=document.createElement("img"),a=document.body||document.documentElement;this.sizingImage=i,i.onload=function(){n(i.width,i.height),r||a.removeChild(i)},i.src=t.src,r||(i.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;",a.appendChild(i))}else n(t.naturalWidth,t.naturalHeight)}},{key:"stop",value:function(){var e=this.image;e.onload=null,e.onerror=null,e.parentNode.removeChild(e),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var e=this.element,t=this.options,r=this.image,n=e.parentNode,i=document.createElement("div");i.innerHTML=de;var a=i.querySelector(".".concat(b,"-container")),o=a.querySelector(".".concat(b,"-canvas")),s=a.querySelector(".".concat(b,"-drag-box")),c=a.querySelector(".".concat(b,"-crop-box")),l=c.querySelector(".".concat(b,"-face"));this.container=n,this.cropper=a,this.canvas=o,this.dragBox=s,this.cropBox=c,this.viewBox=a.querySelector(".".concat(b,"-view-box")),this.face=l,o.appendChild(r),Oe(e,L),n.insertBefore(a,e.nextSibling),Re(r,M),this.initPreview(),this.bind(),t.initialAspectRatio=Math.max(0,t.initialAspectRatio)||NaN,t.aspectRatio=Math.max(0,t.aspectRatio)||NaN,t.viewMode=Math.max(0,Math.min(3,Math.round(t.viewMode)))||0,Oe(c,L),t.guides||Oe(c.getElementsByClassName("".concat(b,"-dashed")),L),t.center||Oe(c.getElementsByClassName("".concat(b,"-center")),L),t.background&&Oe(a,"".concat(b,"-bg")),t.highlight||Oe(l,D),t.cropBoxMovable&&(Oe(l,B),Ne(l,j,w)),t.cropBoxResizable||(Oe(c.getElementsByClassName("".concat(b,"-line")),L),Oe(c.getElementsByClassName("".concat(b,"-point")),L)),this.render(),this.ready=!0,this.setDragMode(t.dragMode),t.autoCrop&&this.crop(),this.setData(t.data),Se(t.ready)&&ze(e,te,t.ready,{once:!0}),We(e,te)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var e=this.cropper.parentNode;e&&e.removeChild(this.cropper),Re(this.element,L)}}},{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=gt,e}},{key:"setDefaults",value:function(e){Ae(fe,we(e)&&e)}}])}();return Ae(mt.prototype,lt,ut,ht,ft,dt,pt),mt}))},41:function(e,t,r){"use strict";var n=r(655),i=r(68),a=r(675),o=r(795);e.exports=function(e,t,r){if(!e||"object"!==typeof e&&"function"!==typeof e)throw new a("`obj` must be an object or a function`");if("string"!==typeof t&&"symbol"!==typeof t)throw new a("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!==typeof arguments[3]&&null!==arguments[3])throw new a("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!==typeof arguments[4]&&null!==arguments[4])throw new a("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!==typeof arguments[5]&&null!==arguments[5])throw new a("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!==typeof arguments[6])throw new a("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6&&arguments[6],h=!!o&&o(e,t);if(n)n(e,t,{configurable:null===l&&h?h.configurable:!l,enumerable:null===s&&h?h.enumerable:!s,value:r,writable:null===c&&h?h.writable:!c});else{if(!u&&(s||c||l))throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}}},655:function(e,t,r){"use strict";var n=r(453),i=n("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch(a){i=!1}e.exports=i},618:function(e){"use strict";e.exports=EvalError},383:function(e){"use strict";e.exports=Error},290:function(e){"use strict";e.exports=RangeError},538:function(e){"use strict";e.exports=ReferenceError},68:function(e){"use strict";e.exports=SyntaxError},675:function(e){"use strict";e.exports=TypeError},345:function(e){"use strict";e.exports=URIError},353:function(e){"use strict";var t="Function.prototype.bind called on incompatible ",r=Object.prototype.toString,n=Math.max,i="[object Function]",a=function(e,t){for(var r=[],n=0;n<e.length;n+=1)r[n]=e[n];for(var i=0;i<t.length;i+=1)r[i+e.length]=t[i];return r},o=function(e,t){for(var r=[],n=t||0,i=0;n<e.length;n+=1,i+=1)r[i]=e[n];return r},s=function(e,t){for(var r="",n=0;n<e.length;n+=1)r+=e[n],n+1<e.length&&(r+=t);return r};e.exports=function(e){var c=this;if("function"!==typeof c||r.apply(c)!==i)throw new TypeError(t+c);for(var l,u=o(arguments,1),h=function(){if(this instanceof l){var t=c.apply(this,a(u,arguments));return Object(t)===t?t:this}return c.apply(e,a(u,arguments))},f=n(0,c.length-u.length),d=[],p=0;p<f;p++)d[p]="$"+p;if(l=Function("binder","return function ("+s(d,",")+"){ return binder.apply(this,arguments); }")(h),c.prototype){var g=function(){};g.prototype=c.prototype,l.prototype=new g,g.prototype=null}return l}},743:function(e,t,r){"use strict";var n=r(353);e.exports=Function.prototype.bind||n},453:function(e,t,r){"use strict";var n,i=r(383),a=r(618),o=r(290),s=r(538),c=r(68),l=r(675),u=r(345),h=Function,f=function(e){try{return h('"use strict"; return ('+e+").constructor;")()}catch(t){}},d=Object.getOwnPropertyDescriptor;if(d)try{d({},"")}catch(D){d=null}var p=function(){throw new l},g=d?function(){try{return p}catch(e){try{return d(arguments,"callee").get}catch(t){return p}}}():p,m=r(39)(),v=r(24)(),y=Object.getPrototypeOf||(v?function(e){return e.__proto__}:null),b={},w="undefined"!==typeof Uint8Array&&y?y(Uint8Array):n,S={__proto__:null,"%AggregateError%":"undefined"===typeof AggregateError?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"===typeof ArrayBuffer?n:ArrayBuffer,"%ArrayIteratorPrototype%":m&&y?y([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":b,"%AsyncGenerator%":b,"%AsyncGeneratorFunction%":b,"%AsyncIteratorPrototype%":b,"%Atomics%":"undefined"===typeof Atomics?n:Atomics,"%BigInt%":"undefined"===typeof BigInt?n:BigInt,"%BigInt64Array%":"undefined"===typeof BigInt64Array?n:BigInt64Array,"%BigUint64Array%":"undefined"===typeof BigUint64Array?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"===typeof DataView?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float32Array%":"undefined"===typeof Float32Array?n:Float32Array,"%Float64Array%":"undefined"===typeof Float64Array?n:Float64Array,"%FinalizationRegistry%":"undefined"===typeof FinalizationRegistry?n:FinalizationRegistry,"%Function%":h,"%GeneratorFunction%":b,"%Int8Array%":"undefined"===typeof Int8Array?n:Int8Array,"%Int16Array%":"undefined"===typeof Int16Array?n:Int16Array,"%Int32Array%":"undefined"===typeof Int32Array?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":m&&y?y(y([][Symbol.iterator]())):n,"%JSON%":"object"===typeof JSON?JSON:n,"%Map%":"undefined"===typeof Map?n:Map,"%MapIteratorPrototype%":"undefined"!==typeof Map&&m&&y?y((new Map)[Symbol.iterator]()):n,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"===typeof Promise?n:Promise,"%Proxy%":"undefined"===typeof Proxy?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":"undefined"===typeof Reflect?n:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"===typeof Set?n:Set,"%SetIteratorPrototype%":"undefined"!==typeof Set&&m&&y?y((new Set)[Symbol.iterator]()):n,"%SharedArrayBuffer%":"undefined"===typeof SharedArrayBuffer?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":m&&y?y(""[Symbol.iterator]()):n,"%Symbol%":m?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":g,"%TypedArray%":w,"%TypeError%":l,"%Uint8Array%":"undefined"===typeof Uint8Array?n:Uint8Array,"%Uint8ClampedArray%":"undefined"===typeof Uint8ClampedArray?n:Uint8ClampedArray,"%Uint16Array%":"undefined"===typeof Uint16Array?n:Uint16Array,"%Uint32Array%":"undefined"===typeof Uint32Array?n:Uint32Array,"%URIError%":u,"%WeakMap%":"undefined"===typeof WeakMap?n:WeakMap,"%WeakRef%":"undefined"===typeof WeakRef?n:WeakRef,"%WeakSet%":"undefined"===typeof WeakSet?n:WeakSet};if(y)try{null.error}catch(D){var _=y(y(D));S["%Error.prototype%"]=_}var k=function e(t){var r;if("%AsyncFunction%"===t)r=f("async function () {}");else if("%GeneratorFunction%"===t)r=f("function* () {}");else if("%AsyncGeneratorFunction%"===t)r=f("async function* () {}");else if("%AsyncGenerator%"===t){var n=e("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&y&&(r=y(i.prototype))}return S[t]=r,r},x={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},A=r(743),C=r(957),P=A.call(Function.call,Array.prototype.concat),E=A.call(Function.apply,Array.prototype.splice),T=A.call(Function.call,String.prototype.replace),I=A.call(Function.call,String.prototype.slice),O=A.call(Function.call,RegExp