UNPKG

yk-element-components-v2

Version:

10 lines 53.6 kB
(function(At,Ct){typeof exports=="object"&&typeof module<"u"?module.exports=Ct():typeof define=="function"&&define.amd?define(Ct):(At=typeof globalThis<"u"?globalThis:At||self,At.index=Ct())})(this,function(){"use strict";const At="";var Ct=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ie={},ae={exports:{}};/*! * Cropper.js v1.5.13 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2022-11-20T05:30:46.114Z */(function(s,h){(function(m,v){s.exports=v()})(Ct,function(){function m(a,t){var i=Object.keys(a);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(a);t&&(e=e.filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable})),i.push.apply(i,e)}return i}function v(a){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?m(Object(i),!0).forEach(function(e){E(a,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):m(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))})}return a}function b(a){return b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(a)}function N(a,t){if(!(a instanceof t))throw new TypeError("Cannot call a class as a function")}function _(a,t){for(var i=0;i<t.length;i++){var e=t[i];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}function M(a,t,i){return t&&_(a.prototype,t),i&&_(a,i),Object.defineProperty(a,"prototype",{writable:!1}),a}function E(a,t,i){return t in a?Object.defineProperty(a,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[t]=i,a}function L(a){return dt(a)||Z(a)||z(a)||ut()}function dt(a){if(Array.isArray(a))return tt(a)}function Z(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function z(a,t){if(!!a){if(typeof a=="string")return tt(a,t);var i=Object.prototype.toString.call(a).slice(8,-1);if(i==="Object"&&a.constructor&&(i=a.constructor.name),i==="Map"||i==="Set")return Array.from(a);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return tt(a,t)}}function tt(a,t){(t==null||t>a.length)&&(t=a.length);for(var i=0,e=new Array(t);i<t;i++)e[i]=a[i];return e}function ut(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var pt=typeof window<"u"&&typeof window.document<"u",Y=pt?window:{},at=pt&&Y.document.documentElement?"ontouchstart"in Y.document.documentElement:!1,gt=pt?"PointerEvent"in Y:!1,T="cropper",Tt="all",mt="crop",S="move",G="zoom",j="e",K="w",vt="s",rt="n",Mt="ne",Et="nw",Ot="se",Rt="sw",Xt="".concat(T,"-crop"),pe="".concat(T,"-disabled"),$="".concat(T,"-hidden"),ge="".concat(T,"-hide"),Bi="".concat(T,"-invisible"),It="".concat(T,"-modal"),Yt="".concat(T,"-move"),Nt="".concat(T,"Action"),Ht="".concat(T,"Preview"),jt="crop",me="move",ve="none",Ut="crop",Vt="cropend",Ft="cropmove",Gt="cropstart",be="dblclick",Wi=at?"touchstart":"mousedown",Ii=at?"touchmove":"mousemove",Hi=at?"touchend touchcancel":"mouseup",ye=gt?"pointerdown":Wi,we=gt?"pointermove":Ii,xe=gt?"pointerup pointercancel":Hi,Ce="ready",De="resize",Te="wheel",qt="zoom",Me="image/jpeg",ki=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Li=/^data:/,zi=/^data:image\/jpeg;base64,/,$i=/^img|canvas$/i,Ee=200,Oe=100,Re={viewMode:0,dragMode:jt,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:Ee,minContainerHeight:Oe,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Pi='<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>',Xi=Number.isNaN||Y.isNaN;function y(a){return typeof a=="number"&&!Xi(a)}var Ne=function(t){return t>0&&t<1/0};function Zt(a){return typeof a>"u"}function ht(a){return b(a)==="object"&&a!==null}var Yi=Object.prototype.hasOwnProperty;function bt(a){if(!ht(a))return!1;try{var t=a.constructor,i=t.prototype;return t&&i&&Yi.call(i,"isPrototypeOf")}catch{return!1}}function P(a){return typeof a=="function"}var ji=Array.prototype.slice;function Se(a){return Array.from?Array.from(a):ji.call(a)}function A(a,t){return a&&P(t)&&(Array.isArray(a)||y(a.length)?Se(a).forEach(function(i,e){t.call(a,i,e,a)}):ht(a)&&Object.keys(a).forEach(function(i){t.call(a,a[i],i,a)})),a}var O=Object.assign||function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),o=1;o<i;o++)e[o-1]=arguments[o];return ht(t)&&e.length>0&&e.forEach(function(r){ht(r)&&Object.keys(r).forEach(function(n){t[n]=r[n]})}),t},Ui=/\.\d*(?:0|9){12}\d*$/;function yt(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Ui.test(a)?Math.round(a*t)/t:a}var Vi=/^width|height|left|top|marginLeft|marginTop$/;function nt(a,t){var i=a.style;A(t,function(e,o){Vi.test(o)&&y(e)&&(e="".concat(e,"px")),i[o]=e})}function Fi(a,t){return a.classList?a.classList.contains(t):a.className.indexOf(t)>-1}function H(a,t){if(!!t){if(y(a.length)){A(a,function(e){H(e,t)});return}if(a.classList){a.classList.add(t);return}var i=a.className.trim();i?i.indexOf(t)<0&&(a.className="".concat(i," ").concat(t)):a.className=t}}function Q(a,t){if(!!t){if(y(a.length)){A(a,function(i){Q(i,t)});return}if(a.classList){a.classList.remove(t);return}a.className.indexOf(t)>=0&&(a.className=a.className.replace(t,""))}}function wt(a,t,i){if(!!t){if(y(a.length)){A(a,function(e){wt(e,t,i)});return}i?H(a,t):Q(a,t)}}var Gi=/([a-z\d])([A-Z])/g;function Kt(a){return a.replace(Gi,"$1-$2").toLowerCase()}function Qt(a,t){return ht(a[t])?a[t]:a.dataset?a.dataset[t]:a.getAttribute("data-".concat(Kt(t)))}function St(a,t,i){ht(i)?a[t]=i:a.dataset?a.dataset[t]=i:a.setAttribute("data-".concat(Kt(t)),i)}function qi(a,t){if(ht(a[t]))try{delete a[t]}catch{a[t]=void 0}else if(a.dataset)try{delete a.dataset[t]}catch{a.dataset[t]=void 0}else a.removeAttribute("data-".concat(Kt(t)))}var _e=/\s\s*/,Ae=function(){var a=!1;if(pt){var t=!1,i=function(){},e=Object.defineProperty({},"once",{get:function(){return a=!0,t},set:function(r){t=r}});Y.addEventListener("test",i,e),Y.removeEventListener("test",i,e)}return a}();function q(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(_e).forEach(function(r){if(!Ae){var n=a.listeners;n&&n[r]&&n[r][i]&&(o=n[r][i],delete n[r][i],Object.keys(n[r]).length===0&&delete n[r],Object.keys(n).length===0&&delete a.listeners)}a.removeEventListener(r,o,e)})}function V(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(_e).forEach(function(r){if(e.once&&!Ae){var n=a.listeners,c=n===void 0?{}:n;o=function(){delete c[r][i],a.removeEventListener(r,o,e);for(var d=arguments.length,l=new Array(d),f=0;f<d;f++)l[f]=arguments[f];i.apply(a,l)},c[r]||(c[r]={}),c[r][i]&&a.removeEventListener(r,c[r][i],e),c[r][i]=o,a.listeners=c}a.addEventListener(r,o,e)})}function xt(a,t,i){var e;return P(Event)&&P(CustomEvent)?e=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0}):(e=document.createEvent("CustomEvent"),e.initCustomEvent(t,!0,!0,i)),a.dispatchEvent(e)}function Be(a){var t=a.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var Jt=Y.location,Zi=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function We(a){var t=a.match(Zi);return t!==null&&(t[1]!==Jt.protocol||t[2]!==Jt.hostname||t[3]!==Jt.port)}function Ie(a){var t="timestamp=".concat(new Date().getTime());return a+(a.indexOf("?")===-1?"?":"&")+t}function _t(a){var t=a.rotate,i=a.scaleX,e=a.scaleY,o=a.translateX,r=a.translateY,n=[];y(o)&&o!==0&&n.push("translateX(".concat(o,"px)")),y(r)&&r!==0&&n.push("translateY(".concat(r,"px)")),y(t)&&t!==0&&n.push("rotate(".concat(t,"deg)")),y(i)&&i!==1&&n.push("scaleX(".concat(i,")")),y(e)&&e!==1&&n.push("scaleY(".concat(e,")"));var c=n.length?n.join(" "):"none";return{WebkitTransform:c,msTransform:c,transform:c}}function Ki(a){var t=v({},a),i=0;return A(a,function(e,o){delete t[o],A(t,function(r){var n=Math.abs(e.startX-r.startX),c=Math.abs(e.startY-r.startY),p=Math.abs(e.endX-r.endX),d=Math.abs(e.endY-r.endY),l=Math.sqrt(n*n+c*c),f=Math.sqrt(p*p+d*d),u=(f-l)/l;Math.abs(u)>Math.abs(i)&&(i=u)})}),i}function kt(a,t){var i=a.pageX,e=a.pageY,o={endX:i,endY:e};return t?o:v({startX:i,startY:e},o)}function Qi(a){var t=0,i=0,e=0;return A(a,function(o){var r=o.startX,n=o.startY;t+=r,i+=n,e+=1}),t/=e,i/=e,{pageX:t,pageY:i}}function ot(a){var t=a.aspectRatio,i=a.height,e=a.width,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=Ne(e),n=Ne(i);if(r&&n){var c=i*t;o==="contain"&&c>e||o==="cover"&&c<e?i=e/t:e=i*t}else r?i=e/t:n&&(e=i*t);return{width:e,height:i}}function Ji(a){var t=a.width,i=a.height,e=a.degree;if(e=Math.abs(e)%180,e===90)return{width:i,height:t};var o=e%90*Math.PI/180,r=Math.sin(o),n=Math.cos(o),c=t*n+i*r,p=t*r+i*n;return e>90?{width:p,height:c}:{width:c,height:p}}function ta(a,t,i,e){var o=t.aspectRatio,r=t.naturalWidth,n=t.naturalHeight,c=t.rotate,p=c===void 0?0:c,d=t.scaleX,l=d===void 0?1:d,f=t.scaleY,u=f===void 0?1:f,x=i.aspectRatio,w=i.naturalWidth,R=i.naturalHeight,C=e.fillColor,W=C===void 0?"transparent":C,k=e.imageSmoothingEnabled,B=k===void 0?!0:k,et=e.imageSmoothingQuality,U=et===void 0?"low":et,g=e.maxWidth,D=g===void 0?1/0:g,I=e.maxHeight,F=I===void 0?1/0:I,it=e.minWidth,ct=it===void 0?0:it,lt=e.minHeight,st=lt===void 0?0:lt,J=document.createElement("canvas"),X=J.getContext("2d"),ft=ot({aspectRatio:x,width:D,height:F}),Lt=ot({aspectRatio:x,width:ct,height:st},"cover"),te=Math.min(ft.width,Math.max(Lt.width,w)),ee=Math.min(ft.height,Math.max(Lt.height,R)),Le=ot({aspectRatio:o,width:D,height:F}),ze=ot({aspectRatio:o,width:ct,height:st},"cover"),$e=Math.min(Le.width,Math.max(ze.width,r)),Pe=Math.min(Le.height,Math.max(ze.height,n)),pa=[-$e/2,-Pe/2,$e,Pe];return J.width=yt(te),J.height=yt(ee),X.fillStyle=W,X.fillRect(0,0,te,ee),X.save(),X.translate(te/2,ee/2),X.rotate(p*Math.PI/180),X.scale(l,u),X.imageSmoothingEnabled=B,X.imageSmoothingQuality=U,X.drawImage.apply(X,[a].concat(L(pa.map(function(ga){return Math.floor(yt(ga))})))),X.restore(),J}var He=String.fromCharCode;function ea(a,t,i){var e="";i+=t;for(var o=t;o<i;o+=1)e+=He(a.getUint8(o));return e}var ia=/^data:.*,/;function aa(a){var t=a.replace(ia,""),i=atob(t),e=new ArrayBuffer(i.length),o=new Uint8Array(e);return A(o,function(r,n){o[n]=i.charCodeAt(n)}),e}function ra(a,t){for(var i=[],e=8192,o=new Uint8Array(a);o.length>0;)i.push(He.apply(null,Se(o.subarray(0,e)))),o=o.subarray(e);return"data:".concat(t,";base64,").concat(btoa(i.join("")))}function na(a){var t=new DataView(a),i;try{var e,o,r;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var n=t.byteLength,c=2;c+1<n;){if(t.getUint8(c)===255&&t.getUint8(c+1)===225){o=c;break}c+=1}if(o){var p=o+4,d=o+10;if(ea(t,p,4)==="Exif"){var l=t.getUint16(d);if(e=l===18761,(e||l===19789)&&t.getUint16(d+2,e)===42){var f=t.getUint32(d+4,e);f>=8&&(r=d+f)}}}if(r){var u=t.getUint16(r,e),x,w;for(w=0;w<u;w+=1)if(x=r+w*12+2,t.getUint16(x,e)===274){x+=8,i=t.getUint16(x,e),t.setUint16(x,1,e);break}}}catch{i=1}return i}function oa(a){var t=0,i=1,e=1;switch(a){case 2:i=-1;break;case 3:t=-180;break;case 4:e=-1;break;case 5:t=90,e=-1;break;case 6:t=90;break;case 7:t=90,i=-1;break;case 8:t=-90;break}return{rotate:t,scaleX:i,scaleY:e}}var sa={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,i=this.options,e=this.container,o=this.cropper,r=Number(i.minContainerWidth),n=Number(i.minContainerHeight);H(o,$),Q(t,$);var c={width:Math.max(e.offsetWidth,r>=0?r:Ee),height:Math.max(e.offsetHeight,n>=0?n:Oe)};this.containerData=c,nt(o,{width:c.width,height:c.height}),H(t,$),Q(o,$)},initCanvas:function(){var t=this.containerData,i=this.imageData,e=this.options.viewMode,o=Math.abs(i.rotate)%180===90,r=o?i.naturalHeight:i.naturalWidth,n=o?i.naturalWidth:i.naturalHeight,c=r/n,p=t.width,d=t.height;t.height*c>t.width?e===3?p=t.height*c:d=t.width/c:e===3?d=t.width/c:p=t.height*c;var l={aspectRatio:c,naturalWidth:r,naturalHeight:n,width:p,height:d};this.canvasData=l,this.limited=e===1||e===2,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=(t.width-l.width)/2,l.top=(t.height-l.height)/2,l.oldLeft=l.left,l.oldTop=l.top,this.initialCanvasData=O({},l)},limitCanvas:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,c=e.viewMode,p=r.aspectRatio,d=this.cropped&&n;if(t){var l=Number(e.minCanvasWidth)||0,f=Number(e.minCanvasHeight)||0;c>1?(l=Math.max(l,o.width),f=Math.max(f,o.height),c===3&&(f*p>l?l=f*p:f=l/p)):c>0&&(l?l=Math.max(l,d?n.width:0):f?f=Math.max(f,d?n.height:0):d&&(l=n.width,f=n.height,f*p>l?l=f*p:f=l/p));var u=ot({aspectRatio:p,width:l,height:f});l=u.width,f=u.height,r.minWidth=l,r.minHeight=f,r.maxWidth=1/0,r.maxHeight=1/0}if(i)if(c>(d?0:1)){var x=o.width-r.width,w=o.height-r.height;r.minLeft=Math.min(0,x),r.minTop=Math.min(0,w),r.maxLeft=Math.max(0,x),r.maxTop=Math.max(0,w),d&&this.limited&&(r.minLeft=Math.min(n.left,n.left+(n.width-r.width)),r.minTop=Math.min(n.top,n.top+(n.height-r.height)),r.maxLeft=n.left,r.maxTop=n.top,c===2&&(r.width>=o.width&&(r.minLeft=Math.min(0,x),r.maxLeft=Math.max(0,x)),r.height>=o.height&&(r.minTop=Math.min(0,w),r.maxTop=Math.max(0,w))))}else r.minLeft=-r.width,r.minTop=-r.height,r.maxLeft=o.width,r.maxTop=o.height},renderCanvas:function(t,i){var e=this.canvasData,o=this.imageData;if(i){var r=Ji({width:o.naturalWidth*Math.abs(o.scaleX||1),height:o.naturalHeight*Math.abs(o.scaleY||1),degree:o.rotate||0}),n=r.width,c=r.height,p=e.width*(n/e.naturalWidth),d=e.height*(c/e.naturalHeight);e.left-=(p-e.width)/2,e.top-=(d-e.height)/2,e.width=p,e.height=d,e.aspectRatio=n/c,e.naturalWidth=n,e.naturalHeight=c,this.limitCanvas(!0,!1)}(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCanvas(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,nt(this.canvas,O({width:e.width,height:e.height},_t({translateX:e.left,translateY:e.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var i=this.canvasData,e=this.imageData,o=e.naturalWidth*(i.width/i.naturalWidth),r=e.naturalHeight*(i.height/i.naturalHeight);O(e,{width:o,height:r,left:(i.width-o)/2,top:(i.height-r)/2}),nt(this.image,O({width:e.width,height:e.height},_t(O({translateX:e.left,translateY:e.top},e)))),t&&this.output()},initCropBox:function(){var t=this.options,i=this.canvasData,e=t.aspectRatio||t.initialAspectRatio,o=Number(t.autoCropArea)||.8,r={width:i.width,height:i.height};e&&(i.height*e>i.width?r.height=r.width/e:r.width=r.height*e),this.cropBoxData=r,this.limitCropBox(!0,!0),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),r.width=Math.max(r.minWidth,r.width*o),r.height=Math.max(r.minHeight,r.height*o),r.left=i.left+(i.width-r.width)/2,r.top=i.top+(i.height-r.height)/2,r.oldLeft=r.left,r.oldTop=r.top,this.initialCropBoxData=O({},r)},limitCropBox:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,c=this.limited,p=e.aspectRatio;if(t){var d=Number(e.minCropBoxWidth)||0,l=Number(e.minCropBoxHeight)||0,f=c?Math.min(o.width,r.width,r.width+r.left,o.width-r.left):o.width,u=c?Math.min(o.height,r.height,r.height+r.top,o.height-r.top):o.height;d=Math.min(d,o.width),l=Math.min(l,o.height),p&&(d&&l?l*p>d?l=d/p:d=l*p:d?l=d/p:l&&(d=l*p),u*p>f?u=f/p:f=u*p),n.minWidth=Math.min(d,f),n.minHeight=Math.min(l,u),n.maxWidth=f,n.maxHeight=u}i&&(c?(n.minLeft=Math.max(0,r.left),n.minTop=Math.max(0,r.top),n.maxLeft=Math.min(o.width,r.left+r.width)-n.width,n.maxTop=Math.min(o.height,r.top+r.height)-n.height):(n.minLeft=0,n.minTop=0,n.maxLeft=o.width-n.width,n.maxTop=o.height-n.height))},renderCropBox:function(){var t=this.options,i=this.containerData,e=this.cropBoxData;(e.width>e.maxWidth||e.width<e.minWidth)&&(e.left=e.oldLeft),(e.height>e.maxHeight||e.height<e.minHeight)&&(e.top=e.oldTop),e.width=Math.min(Math.max(e.width,e.minWidth),e.maxWidth),e.height=Math.min(Math.max(e.height,e.minHeight),e.maxHeight),this.limitCropBox(!1,!0),e.left=Math.min(Math.max(e.left,e.minLeft),e.maxLeft),e.top=Math.min(Math.max(e.top,e.minTop),e.maxTop),e.oldLeft=e.left,e.oldTop=e.top,t.movable&&t.cropBoxMovable&&St(this.face,Nt,e.width>=i.width&&e.height>=i.height?S:Tt),nt(this.cropBox,O({width:e.width,height:e.height},_t({translateX:e.left,translateY:e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),xt(this.element,Ut,this.getData())}},ha={initPreview:function(){var t=this.element,i=this.crossOrigin,e=this.options.preview,o=i?this.crossOriginUrl:this.url,r=t.alt||"The image to preview",n=document.createElement("img");if(i&&(n.crossOrigin=i),n.src=o,n.alt=r,this.viewBox.appendChild(n),this.viewBoxImage=n,!!e){var c=e;typeof e=="string"?c=t.ownerDocument.querySelectorAll(e):e.querySelector&&(c=[e]),this.previews=c,A(c,function(p){var d=document.createElement("img");St(p,Ht,{width:p.offsetWidth,height:p.offsetHeight,html:p.innerHTML}),i&&(d.crossOrigin=i),d.src=o,d.alt=r,d.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;"',p.innerHTML="",p.appendChild(d)})}},resetPreview:function(){A(this.previews,function(t){var i=Qt(t,Ht);nt(t,{width:i.width,height:i.height}),t.innerHTML=i.html,qi(t,Ht)})},preview:function(){var t=this.imageData,i=this.canvasData,e=this.cropBoxData,o=e.width,r=e.height,n=t.width,c=t.height,p=e.left-i.left-t.left,d=e.top-i.top-t.top;!this.cropped||this.disabled||(nt(this.viewBoxImage,O({width:n,height:c},_t(O({translateX:-p,translateY:-d},t)))),A(this.previews,function(l){var f=Qt(l,Ht),u=f.width,x=f.height,w=u,R=x,C=1;o&&(C=u/o,R=r*C),r&&R>x&&(C=x/r,w=o*C,R=x),nt(l,{width:w,height:R}),nt(l.getElementsByTagName("img")[0],O({width:n*C,height:c*C},_t(O({translateX:-p*C,translateY:-d*C},t))))}))}},ca={bind:function(){var t=this.element,i=this.options,e=this.cropper;P(i.cropstart)&&V(t,Gt,i.cropstart),P(i.cropmove)&&V(t,Ft,i.cropmove),P(i.cropend)&&V(t,Vt,i.cropend),P(i.crop)&&V(t,Ut,i.crop),P(i.zoom)&&V(t,qt,i.zoom),V(e,ye,this.onCropStart=this.cropStart.bind(this)),i.zoomable&&i.zoomOnWheel&&V(e,Te,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&V(e,be,this.onDblclick=this.dblclick.bind(this)),V(t.ownerDocument,we,this.onCropMove=this.cropMove.bind(this)),V(t.ownerDocument,xe,this.onCropEnd=this.cropEnd.bind(this)),i.responsive&&V(window,De,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.options,e=this.cropper;P(i.cropstart)&&q(t,Gt,i.cropstart),P(i.cropmove)&&q(t,Ft,i.cropmove),P(i.cropend)&&q(t,Vt,i.cropend),P(i.crop)&&q(t,Ut,i.crop),P(i.zoom)&&q(t,qt,i.zoom),q(e,ye,this.onCropStart),i.zoomable&&i.zoomOnWheel&&q(e,Te,this.onWheel,{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&q(e,be,this.onDblclick),q(t.ownerDocument,we,this.onCropMove),q(t.ownerDocument,xe,this.onCropEnd),i.responsive&&q(window,De,this.onResize)}},la={resize:function(){if(!this.disabled){var t=this.options,i=this.container,e=this.containerData,o=i.offsetWidth/e.width,r=i.offsetHeight/e.height,n=Math.abs(o-1)>Math.abs(r-1)?o:r;if(n!==1){var c,p;t.restore&&(c=this.getCanvasData(),p=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(A(c,function(d,l){c[l]=d*n})),this.setCropBoxData(A(p,function(d,l){p[l]=d*n})))}}},dblclick:function(){this.disabled||this.options.dragMode===ve||this.setDragMode(Fi(this.dragBox,Xt)?me:jt)},wheel:function(t){var i=this,e=Number(this.options.wheelZoomRatio)||.1,o=1;this.disabled||(t.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50),t.deltaY?o=t.deltaY>0?1:-1:t.wheelDelta?o=-t.wheelDelta/120:t.detail&&(o=t.detail>0?1:-1),this.zoom(-o*e,t)))},cropStart:function(t){var i=t.buttons,e=t.button;if(!(this.disabled||(t.type==="mousedown"||t.type==="pointerdown"&&t.pointerType==="mouse")&&(y(i)&&i!==1||y(e)&&e!==0||t.ctrlKey))){var o=this.options,r=this.pointers,n;t.changedTouches?A(t.changedTouches,function(c){r[c.identifier]=kt(c)}):r[t.pointerId||0]=kt(t),Object.keys(r).length>1&&o.zoomable&&o.zoomOnTouch?n=G:n=Qt(t.target,Nt),!!ki.test(n)&&xt(this.element,Gt,{originalEvent:t,action:n})!==!1&&(t.preventDefault(),this.action=n,this.cropping=!1,n===mt&&(this.cropping=!0,H(this.dragBox,It)))}},cropMove:function(t){var i=this.action;if(!(this.disabled||!i)){var e=this.pointers;t.preventDefault(),xt(this.element,Ft,{originalEvent:t,action:i})!==!1&&(t.changedTouches?A(t.changedTouches,function(o){O(e[o.identifier]||{},kt(o,!0))}):O(e[t.pointerId||0]||{},kt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var i=this.action,e=this.pointers;t.changedTouches?A(t.changedTouches,function(o){delete e[o.identifier]}):delete e[t.pointerId||0],i&&(t.preventDefault(),Object.keys(e).length||(this.action=""),this.cropping&&(this.cropping=!1,wt(this.dragBox,It,this.cropped&&this.options.modal)),xt(this.element,Vt,{originalEvent:t,action:i}))}}},fa={change:function(t){var i=this.options,e=this.canvasData,o=this.containerData,r=this.cropBoxData,n=this.pointers,c=this.action,p=i.aspectRatio,d=r.left,l=r.top,f=r.width,u=r.height,x=d+f,w=l+u,R=0,C=0,W=o.width,k=o.height,B=!0,et;!p&&t.shiftKey&&(p=f&&u?f/u:1),this.limited&&(R=r.minLeft,C=r.minTop,W=R+Math.min(o.width,e.width,e.left+e.width),k=C+Math.min(o.height,e.height,e.top+e.height));var U=n[Object.keys(n)[0]],g={x:U.endX-U.startX,y:U.endY-U.startY},D=function(F){switch(F){case j:x+g.x>W&&(g.x=W-x);break;case K:d+g.x<R&&(g.x=R-d);break;case rt:l+g.y<C&&(g.y=C-l);break;case vt:w+g.y>k&&(g.y=k-w);break}};switch(c){case Tt:d+=g.x,l+=g.y;break;case j:if(g.x>=0&&(x>=W||p&&(l<=C||w>=k))){B=!1;break}D(j),f+=g.x,f<0&&(c=K,f=-f,d-=f),p&&(u=f/p,l+=(r.height-u)/2);break;case rt:if(g.y<=0&&(l<=C||p&&(d<=R||x>=W))){B=!1;break}D(rt),u-=g.y,l+=g.y,u<0&&(c=vt,u=-u,l-=u),p&&(f=u*p,d+=(r.width-f)/2);break;case K:if(g.x<=0&&(d<=R||p&&(l<=C||w>=k))){B=!1;break}D(K),f-=g.x,d+=g.x,f<0&&(c=j,f=-f,d-=f),p&&(u=f/p,l+=(r.height-u)/2);break;case vt:if(g.y>=0&&(w>=k||p&&(d<=R||x>=W))){B=!1;break}D(vt),u+=g.y,u<0&&(c=rt,u=-u,l-=u),p&&(f=u*p,d+=(r.width-f)/2);break;case Mt:if(p){if(g.y<=0&&(l<=C||x>=W)){B=!1;break}D(rt),u-=g.y,l+=g.y,f=u*p}else D(rt),D(j),g.x>=0?x<W?f+=g.x:g.y<=0&&l<=C&&(B=!1):f+=g.x,g.y<=0?l>C&&(u-=g.y,l+=g.y):(u-=g.y,l+=g.y);f<0&&u<0?(c=Rt,u=-u,f=-f,l-=u,d-=f):f<0?(c=Et,f=-f,d-=f):u<0&&(c=Ot,u=-u,l-=u);break;case Et:if(p){if(g.y<=0&&(l<=C||d<=R)){B=!1;break}D(rt),u-=g.y,l+=g.y,f=u*p,d+=r.width-f}else D(rt),D(K),g.x<=0?d>R?(f-=g.x,d+=g.x):g.y<=0&&l<=C&&(B=!1):(f-=g.x,d+=g.x),g.y<=0?l>C&&(u-=g.y,l+=g.y):(u-=g.y,l+=g.y);f<0&&u<0?(c=Ot,u=-u,f=-f,l-=u,d-=f):f<0?(c=Mt,f=-f,d-=f):u<0&&(c=Rt,u=-u,l-=u);break;case Rt:if(p){if(g.x<=0&&(d<=R||w>=k)){B=!1;break}D(K),f-=g.x,d+=g.x,u=f/p}else D(vt),D(K),g.x<=0?d>R?(f-=g.x,d+=g.x):g.y>=0&&w>=k&&(B=!1):(f-=g.x,d+=g.x),g.y>=0?w<k&&(u+=g.y):u+=g.y;f<0&&u<0?(c=Mt,u=-u,f=-f,l-=u,d-=f):f<0?(c=Ot,f=-f,d-=f):u<0&&(c=Et,u=-u,l-=u);break;case Ot:if(p){if(g.x>=0&&(x>=W||w>=k)){B=!1;break}D(j),f+=g.x,u=f/p}else D(vt),D(j),g.x>=0?x<W?f+=g.x:g.y>=0&&w>=k&&(B=!1):f+=g.x,g.y>=0?w<k&&(u+=g.y):u+=g.y;f<0&&u<0?(c=Et,u=-u,f=-f,l-=u,d-=f):f<0?(c=Rt,f=-f,d-=f):u<0&&(c=Mt,u=-u,l-=u);break;case S:this.move(g.x,g.y),B=!1;break;case G:this.zoom(Ki(n),t),B=!1;break;case mt:if(!g.x||!g.y){B=!1;break}et=Be(this.cropper),d=U.startX-et.left,l=U.startY-et.top,f=r.minWidth,u=r.minHeight,g.x>0?c=g.y>0?Ot:Mt:g.x<0&&(d-=f,c=g.y>0?Rt:Et),g.y<0&&(l-=u),this.cropped||(Q(this.cropBox,$),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}B&&(r.width=f,r.height=u,r.left=d,r.top=l,this.action=c,this.renderCropBox()),A(n,function(I){I.startX=I.endX,I.startY=I.endY})}},da={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&H(this.dragBox,It),Q(this.cropBox,$),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=O({},this.initialImageData),this.canvasData=O({},this.initialCanvasData),this.cropBoxData=O({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(O(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Q(this.dragBox,It),H(this.cropBox,$)),this},replace:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&t&&(this.isImg&&(this.element.src=t),i?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,A(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,Q(this.cropper,pe)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,H(this.cropper,pe)),this},destroy:function(){var t=this.element;return t[T]?(t[T]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,e=this.canvasData,o=e.left,r=e.top;return this.moveTo(Zt(t)?t:o+Number(t),Zt(i)?i:r+Number(i))},moveTo:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,e=this.canvasData,o=!1;return t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.movable&&(y(t)&&(e.left=t,o=!0),y(i)&&(e.top=i,o=!0),o&&this.renderCanvas(!0)),this},zoom:function(t,i){var e=this.canvasData;return t=Number(t),t<0?t=1/(1-t):t=1+t,this.zoomTo(e.width*t/e.naturalWidth,null,i)},zoomTo:function(t,i,e){var o=this.options,r=this.canvasData,n=r.width,c=r.height,p=r.naturalWidth,d=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&o.zoomable){var l=p*t,f=d*t;if(xt(this.element,qt,{ratio:t,oldRatio:n/p,originalEvent:e})===!1)return this;if(e){var u=this.pointers,x=Be(this.cropper),w=u&&Object.keys(u).length?Qi(u):{pageX:e.pageX,pageY:e.pageY};r.left-=(l-n)*((w.pageX-x.left-r.left)/n),r.top-=(f-c)*((w.pageY-x.top-r.top)/c)}else bt(i)&&y(i.x)&&y(i.y)?(r.left-=(l-n)*((i.x-r.left)/n),r.top-=(f-c)*((i.y-r.top)/c)):(r.left-=(l-n)/2,r.top-=(f-c)/2);r.width=l,r.height=f,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),y(t)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var i=this.imageData.scaleY;return this.scale(t,y(i)?i:1)},scaleY:function(t){var i=this.imageData.scaleX;return this.scale(y(i)?i:1,t)},scale:function(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:t,e=this.imageData,o=!1;return t=Number(t),i=Number(i),this.ready&&!this.disabled&&this.options.scalable&&(y(t)&&(e.scaleX=t,o=!0),y(i)&&(e.scaleY=i,o=!0),o&&this.renderCanvas(!0,!0)),this},getData:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,i=this.options,e=this.imageData,o=this.canvasData,r=this.cropBoxData,n;if(this.ready&&this.cropped){n={x:r.left-o.left,y:r.top-o.top,width:r.width,height:r.height};var c=e.width/e.naturalWidth;if(A(n,function(l,f){n[f]=l/c}),t){var p=Math.round(n.y+n.height),d=Math.round(n.x+n.width);n.x=Math.round(n.x),n.y=Math.round(n.y),n.width=d-n.x,n.height=p-n.y}}else n={x:0,y:0,width:0,height:0};return i.rotatable&&(n.rotate=e.rotate||0),i.scalable&&(n.scaleX=e.scaleX||1,n.scaleY=e.scaleY||1),n},setData:function(t){var i=this.options,e=this.imageData,o=this.canvasData,r={};if(this.ready&&!this.disabled&&bt(t)){var n=!1;i.rotatable&&y(t.rotate)&&t.rotate!==e.rotate&&(e.rotate=t.rotate,n=!0),i.scalable&&(y(t.scaleX)&&t.scaleX!==e.scaleX&&(e.scaleX=t.scaleX,n=!0),y(t.scaleY)&&t.scaleY!==e.scaleY&&(e.scaleY=t.scaleY,n=!0)),n&&this.renderCanvas(!0,!0);var c=e.width/e.naturalWidth;y(t.x)&&(r.left=t.x*c+o.left),y(t.y)&&(r.top=t.y*c+o.top),y(t.width)&&(r.width=t.width*c),y(t.height)&&(r.height=t.height*c),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?O({},this.containerData):{}},getImageData:function(){return this.sized?O({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,i={};return this.ready&&A(["left","top","width","height","naturalWidth","naturalHeight"],function(e){i[e]=t[e]}),i},setCanvasData:function(t){var i=this.canvasData,e=i.aspectRatio;return this.ready&&!this.disabled&&bt(t)&&(y(t.left)&&(i.left=t.left),y(t.top)&&(i.top=t.top),y(t.width)?(i.width=t.width,i.height=t.width/e):y(t.height)&&(i.height=t.height,i.width=t.height*e),this.renderCanvas(!0)),this},getCropBoxData:function(){var t=this.cropBoxData,i;return this.ready&&this.cropped&&(i={left:t.left,top:t.top,width:t.width,height:t.height}),i||{}},setCropBoxData:function(t){var i=this.cropBoxData,e=this.options.aspectRatio,o,r;return this.ready&&this.cropped&&!this.disabled&&bt(t)&&(y(t.left)&&(i.left=t.left),y(t.top)&&(i.top=t.top),y(t.width)&&t.width!==i.width&&(o=!0,i.width=t.width),y(t.height)&&t.height!==i.height&&(r=!0,i.height=t.height),e&&(o?i.height=i.width/e:r&&(i.width=i.height*e)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var i=this.canvasData,e=ta(this.image,this.imageData,i,t);if(!this.cropped)return e;var o=this.getData(),r=o.x,n=o.y,c=o.width,p=o.height,d=e.width/Math.floor(i.naturalWidth);d!==1&&(r*=d,n*=d,c*=d,p*=d);var l=c/p,f=ot({aspectRatio:l,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),u=ot({aspectRatio:l,width:t.minWidth||0,height:t.minHeight||0},"cover"),x=ot({aspectRatio:l,width:t.width||(d!==1?e.width:c),height:t.height||(d!==1?e.height:p)}),w=x.width,R=x.height;w=Math.min(f.width,Math.max(u.width,w)),R=Math.min(f.height,Math.max(u.height,R));var C=document.createElement("canvas"),W=C.getContext("2d");C.width=yt(w),C.height=yt(R),W.fillStyle=t.fillColor||"transparent",W.fillRect(0,0,w,R);var k=t.imageSmoothingEnabled,B=k===void 0?!0:k,et=t.imageSmoothingQuality;W.imageSmoothingEnabled=B,et&&(W.imageSmoothingQuality=et);var U=e.width,g=e.height,D=r,I=n,F,it,ct,lt,st,J;D<=-c||D>U?(D=0,F=0,ct=0,st=0):D<=0?(ct=-D,D=0,F=Math.min(U,c+D),st=F):D<=U&&(ct=0,F=Math.min(c,U-D),st=F),F<=0||I<=-p||I>g?(I=0,it=0,lt=0,J=0):I<=0?(lt=-I,I=0,it=Math.min(g,p+I),J=it):I<=g&&(lt=0,it=Math.min(p,g-I),J=it);var X=[D,I,F,it];if(st>0&&J>0){var ft=w/c;X.push(ct*ft,lt*ft,st*ft,J*ft)}return W.drawImage.apply(W,[e].concat(L(X.map(function(Lt){return Math.floor(yt(Lt))})))),C},setAspectRatio:function(t){var i=this.options;return!this.disabled&&!Zt(t)&&(i.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var i=this.options,e=this.dragBox,o=this.face;if(this.ready&&!this.disabled){var r=t===jt,n=i.movable&&t===me;t=r||n?t:ve,i.dragMode=t,St(e,Nt,t),wt(e,Xt,r),wt(e,Yt,n),i.cropBoxMovable||(St(o,Nt,t),wt(o,Xt,r),wt(o,Yt,n))}return this}},ua=Y.Cropper,ke=function(){function a(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(N(this,a),!t||!$i.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=O({},Re,bt(i)&&i),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 M(a,[{key:"init",value:function(){var i=this.element,e=i.tagName.toLowerCase(),o;if(!i[T]){if(i[T]=this,e==="img"){if(this.isImg=!0,o=i.getAttribute("src")||"",this.originalUrl=o,!o)return;o=i.src}else e==="canvas"&&window.HTMLCanvasElement&&(o=i.toDataURL());this.load(o)}}},{key:"load",value:function(i){var e=this;if(!!i){this.url=i,this.imageData={};var o=this.element,r=this.options;if(!r.rotatable&&!r.scalable&&(r.checkOrientation=!1),!r.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Li.test(i)){zi.test(i)?this.read(aa(i)):this.clone();return}var n=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=n,n.onabort=c,n.onerror=c,n.ontimeout=c,n.onprogress=function(){n.getResponseHeader("content-type")!==Me&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},r.checkCrossOrigin&&We(i)&&o.crossOrigin&&(i=Ie(i)),n.open("GET",i,!0),n.responseType="arraybuffer",n.withCredentials=o.crossOrigin==="use-credentials",n.send()}}},{key:"read",value:function(i){var e=this.options,o=this.imageData,r=na(i),n=0,c=1,p=1;if(r>1){this.url=ra(i,Me);var d=oa(r);n=d.rotate,c=d.scaleX,p=d.scaleY}e.rotatable&&(o.rotate=n),e.scalable&&(o.scaleX=c,o.scaleY=p),this.clone()}},{key:"clone",value:function(){var i=this.element,e=this.url,o=i.crossOrigin,r=e;this.options.checkCrossOrigin&&We(e)&&(o||(o="anonymous"),r=Ie(e)),this.crossOrigin=o,this.crossOriginUrl=r;var n=document.createElement("img");o&&(n.crossOrigin=o),n.src=r||e,n.alt=i.alt||"The image to crop",this.image=n,n.onload=this.start.bind(this),n.onerror=this.stop.bind(this),H(n,ge),i.parentNode.insertBefore(n,i.nextSibling)}},{key:"start",value:function(){var i=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var o=Y.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Y.navigator.userAgent),r=function(d,l){O(i.imageData,{naturalWidth:d,naturalHeight:l,aspectRatio:d/l}),i.initialImageData=O({},i.imageData),i.sizing=!1,i.sized=!0,i.build()};if(e.naturalWidth&&!o){r(e.naturalWidth,e.naturalHeight);return}var n=document.createElement("img"),c=document.body||document.documentElement;this.sizingImage=n,n.onload=function(){r(n.width,n.height),o||c.removeChild(n)},n.src=e.src,o||(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;",c.appendChild(n))}},{key:"stop",value:function(){var i=this.image;i.onload=null,i.onerror=null,i.parentNode.removeChild(i),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var i=this.element,e=this.options,o=this.image,r=i.parentNode,n=document.createElement("div");n.innerHTML=Pi;var c=n.querySelector(".".concat(T,"-container")),p=c.querySelector(".".concat(T,"-canvas")),d=c.querySelector(".".concat(T,"-drag-box")),l=c.querySelector(".".concat(T,"-crop-box")),f=l.querySelector(".".concat(T,"-face"));this.container=r,this.cropper=c,this.canvas=p,this.dragBox=d,this.cropBox=l,this.viewBox=c.querySelector(".".concat(T,"-view-box")),this.face=f,p.appendChild(o),H(i,$),r.insertBefore(c,i.nextSibling),Q(o,ge),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,H(l,$),e.guides||H(l.getElementsByClassName("".concat(T,"-dashed")),$),e.center||H(l.getElementsByClassName("".concat(T,"-center")),$),e.background&&H(c,"".concat(T,"-bg")),e.highlight||H(f,Bi),e.cropBoxMovable&&(H(f,Yt),St(f,Nt,Tt)),e.cropBoxResizable||(H(l.getElementsByClassName("".concat(T,"-line")),$),H(l.getElementsByClassName("".concat(T,"-point")),$)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),P(e.ready)&&V(i,Ce,e.ready,{once:!0}),xt(i,Ce)}}},{key:"unbuild",value:function(){if(!!this.ready){this.ready=!1,this.unbind(),this.resetPreview();var i=this.cropper.parentNode;i&&i.removeChild(this.cropper),Q(this.element,$)}}},{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=ua,a}},{key:"setDefaults",value:function(i){O(Re,bt(i)&&i)}}]),a}();return O(ke.prototype,sa,ha,ca,la,fa,da),ke})})(ae),Object.defineProperty(ie,"__esModule",{value:!0});var Xe=ae.exports,Ye=je(Xe);function je(s){return s&&s.__esModule?s:{default:s}}function Ue(s,h){var m={};for(var v in s)h.indexOf(v)>=0||!Object.prototype.hasOwnProperty.call(s,v)||(m[v]=s[v]);return m}var Ve=typeof window>"u"?[String,Array]:[String,Array,Element,NodeList],Fe=ie.default={render:function(h){var m=this.crossorigin||void 0;return h("div",{style:this.containerStyle},[h("img",{ref:"img",attrs:{src:this.src,alt:this.alt||"image",style:"max-width: 100%",crossorigin:m},on:this.$listeners,style:this.imgStyle})])},props:{containerStyle:Object,src:{type:String,default:""},alt:String,imgStyle:Object,viewMode:Number,dragMode:String,initialAspectRatio:Number,aspectRatio:Number,data:Object,preview:Ve,responsive:{type:Boolean,default:!0},restore:{type:Boolean,default:!0},checkCrossOrigin:{type:Boolean,default:!0},checkOrientation:{type:Boolean,default:!0},crossorigin:{type:String},modal:{type:Boolean,default:!0},guides:{type:Boolean,default:!0},center:{type:Boolean,default:!0},highlight:{type:Boolean,default:!0},background:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!0},autoCropArea:Number,movable:{type:Boolean,default:!0},rotatable:{type:Boolean,default:!0},scalable:{type:Boolean,default:!0},zoomable:{type:Boolean,default:!0},zoomOnTouch:{type:Boolean,default:!0},zoomOnWheel:{type:Boolean,default:!0},wheelZoomRatio:Number,cropBoxMovable:{type:Boolean,default:!0},cropBoxResizable:{type:Boolean,default:!0},toggleDragModeOnDblclick:{type:Boolean,default:!0},minCanvasWidth:Number,minCanvasHeight:Number,minCropBoxWidth:Number,minCropBoxHeight:Number,minContainerWidth:Number,minContainerHeight:Number,ready:Function,cropstart:Function,cropmove:Function,cropend:Function,crop:Function,zoom:Function},mounted:function(){var h=this.$options.props;h.containerStyle,h.src,h.alt,h.imgStyle;var m=Ue(h,["containerStyle","src","alt","imgStyle"]),v={};for(var b in m)this[b]!==void 0&&(v[b]=this[b]);this.cropper=new Ye.default(this.$refs.img,v)},methods:{reset:function(){return this.cropper.reset()},clear:function(){return this.cropper.clear()},initCrop:function(){return this.cropper.crop()},replace:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.cropper.replace(h,m)},enable:function(){return this.cropper.enable()},disable:function(){return this.cropper.disable()},destroy:function(){return this.cropper.destroy()},move:function(h,m){return this.cropper.move(h,m)},moveTo:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;return this.cropper.moveTo(h,m)},relativeZoom:function(h,m){return this.cropper.zoom(h,m)},zoomTo:function(h,m){return this.cropper.zoomTo(h,m)},rotate:function(h){return this.cropper.rotate(h)},rotateTo:function(h){return this.cropper.rotateTo(h)},scaleX:function(h){return this.cropper.scaleX(h)},scaleY:function(h){return this.cropper.scaleY(h)},scale:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;return this.cropper.scale(h,m)},getData:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return this.cropper.getData(h)},setData:function(h){return this.cropper.setData(h)},getContainerData:function(){return this.cropper.getContainerData()},getImageData:function(){return this.cropper.getImageData()},getCanvasData:function(){return this.cropper.getCanvasData()},setCanvasData:function(h){return this.cropper.setCanvasData(h)},getCropBoxData:function(){return this.cropper.getCropBoxData()},setCropBoxData:function(h){return this.cropper.setCropBoxData(h)},getCroppedCanvas:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.cropper.getCroppedCanvas(h)},setAspectRatio:function(h){return this.cropper.setAspectRatio(h)},setDragMode:function(h){return this.cropper.setDragMode(h)}}},Ge=typeof global=="object"&&global&&global.Object===Object&&global;const qe=Ge;var Ze=typeof self=="object"&&self&&self.Object===Object&&self,Ke=qe||Ze||Function("return this")();const re=Ke;var Qe=re.Symbol;const Bt=Qe;var ne=Object.prototype,Je=ne.hasOwnProperty,ti=ne.toString,Dt=Bt?Bt.toStringTag:void 0;function ei(s){var h=Je.call(s,Dt),m=s[Dt];try{s[Dt]=void 0;var v=!0}catch{}var b=ti.call(s);return v&&(h?s[Dt]=m:delete s[Dt]),b}var ii=Object.prototype,ai=ii.toString;function ri(s){return ai.call(s)}var ni="[object Null]",oi="[object Undefined]",oe=Bt?Bt.toStringTag:void 0;function si(s){return s==null?s===void 0?oi:ni:oe&&oe in Object(s)?ei(s):ri(s)}function hi(s){return s!=null&&typeof s=="object"}var ci="[object Symbol]";function li(s){return typeof s=="symbol"||hi(s)&&si(s)==ci}var fi=/\s/;function di(s){for(var h=s.length;h--&&fi.test(s.charAt(h)););return h}var ui=/^\s+/;function pi(s){return s&&s.slice(0,di(s)+1).replace(ui,"")}function Wt(s){var h=typeof s;return s!=null&&(h=="object"||h=="function")}var se=0/0,gi=/^[-+]0x[0-9a-f]+$/i,mi=/^0b[01]+$/i,vi=/^0o[0-7]+$/i,bi=parseInt;function he(s){if(typeof s=="number")return s;if(li(s))return se;if(Wt(s)){var h=typeof s.valueOf=="function"?s.valueOf():s;s=Wt(h)?h+"":h}if(typeof s!="string")return s===0?s:+s;s=pi(s);var m=mi.test(s);return m||vi.test(s)?bi(s.slice(2),m?2:8):gi.test(s)?se:+s}var yi=function(){return re.Date.now()};const zt=yi;var wi="Expected a function",xi=Math.max,Ci=Math.min;function Di(s,h,m){var v,b,N,_,M,E,L=0,dt=!1,Z=!1,z=!0;if(typeof s!="function")throw new TypeError(wi);h=he(h)||0,Wt(m)&&(dt=!!m.leading,Z="maxWait"in m,N=Z?xi(he(m.maxWait)||0,h):N,z="trailing"in m?!!m.trailing:z);function tt(S){var G=v,j=b;return v=b=void 0,L=S,_=s.apply(j,G),_}function ut(S){return L=S,M=setTimeout(at,h),dt?tt(S):_}function pt(S){var G=S-E,j=S-L,K=h-G;return Z?Ci(K,N-j):K}function Y(S){var G=S-E,j=S-L;return E===void 0||G>=h||G<0||Z&&j>=N}function at(){var S=zt();if(Y(S))return gt(S);M=setTimeout(at,pt(S))}function gt(S){return M=void 0,z&&v?tt(S):(v=b=void 0,_)}function T(){M!==void 0&&clearTimeout(M),L=0,v=E=b=M=void 0}function Tt(){return M===void 0?_:gt(zt())}function mt(){var S=zt(),G=Y(S);if(v=arguments,b=this,E=S,G){if(M===void 0)return ut(E);if(Z)return clearTimeout(M),M=setTimeout(at,h),tt(E)}return M===void 0&&(M=setTimeout(at,h)),_}return mt.cancel=T,mt.flush=Tt,mt}var Ti="Expected a function";function Mi(s,h,m){var v=!0,b=!0;if(typeof s!="function")throw new TypeError(Ti);return Wt(m)&&(v="leading"in m?!!m.leading:v,b="trailing"in m?!!m.trailing:b),Di(s,h,{leading:v,maxWait:h,trailing:b})}const ce=Math.pow(1024,2),le=1024;function $t(s){return s>=ce?(s/ce).toFixed(2)+"M":(s/le).toFixed(2)+"K"}function Ei(s,h){let m=new FileReader;m.onload=v=>{typeof h=="function"&&h(v.target.result)},m.readAsDataURL(s)}function Oi(s){return s?Array.isArray(s)?s.map(h=>h.replace("/",":")).join(" ~ "):s.replace("/",":"):""}const ma="",va="";function Ri(s,h,m,v,b,N,_,M){var E=typeof s=="function"?s.options:s;h&&(E.render=h,E.staticRenderFns=m,E._compiled=!0),v&&(E.functional=!0),N&&(E._scopeId="data-v-"+N);var L;if(_?(L=function(z){z=z||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!z&&typeof __VUE_SSR_CONTEXT__<"u"&&(z=__VUE_SSR_CONTEXT__),b&&b.call(this,z),z&&z._registeredComponents&&z._registeredComponents.add(_)},E._ssrRegister=L):b&&(L=M?function(){b.call(this,(E.functional?this.parent:this).$root.$options.shadowRoot)}:b),L)if(E.functional){E._injectStyles=L;var dt=E.render;E.render=function(tt,ut){return L.call(ut),dt(tt,ut)}}else{var Z=E.beforeCreate;E.beforeCreate=Z?[].concat(Z,L):[L]}return{exports:s,options:E}}const Pt=1024,fe=()=>({containerStyle:{},rotateDegree:0,maxResolution:Pt,quality:1,isTouched:!1}),de=()=>({...fe(),loading:!0,aspectRatioMismatched:!1,submitting:!1,src:"",sizeText:"",isLargeResolution:!1,canvas:{},cropBox:{}}),Ni={name:"yk-imgCropper",props:{fixedCoverHeight:{type:Number,default:null},minCoverHeight:{type:Number,default:null},maxCoverHeight:{type:Number,default:null},fixedCoverWidth:{type:Number,default:null},maxCoverWidth:{type:Number,default:null},minCoverWidth:{type:Number,default:null},cropperWidth:{type:Number,default:150},cropperHeight:{type:Number,default:150},cropBoxResizable:{type:Boolean,default(){return!0}},guides:{type:Boolean,default(){return!0}},show:{type:Boolean,required:!0},file:File,aspectRatio:[Array,String],aspectRatioDeviation:Number},components:{VueCropper:Fe},data(){return{orChange:null,croppedWidth:"",croppedHeight:"",saveInfo:null,viewMode:2,...de()}},computed:{aspectRatioText(){return Oi(this.aspectRatioValue)},mustCrop(){return this.aspectRatioMismatched||this.isTouched},aspectRatioValue(){if(this.aspectRatio)if(typeof this.aspectRatio=="string"){const[s,h]=this.aspectRatio.split("/");return s/h}else return"";else return""}},watch:{async file(s,h){s?(this.aspectRatioValue&&(this.aspectRatioMismatched=await this.checkAspectRatio(s)),this.sizeText=$t(s.size),Ei(s,m=>{const v=new Image;v.src=m,v.onload=()=>{const{width:b,height:N}=v;this.src=m,N>3e3||b>3e3?this.quality=.5:N>2e3||b>2e3?this.quality=.7:(N>1024||b>1024)&&(this.quality=.9),this.$nextTick(()=>{this.$refs.cropper.replace(m),this.isLargeResolution=b>=Pt||N>=Pt,this.$refs.cropper.setData({width:b})})}})):Object.assign(this.$data,de())}},methods:{onRotateDegreeChange(s){this.touch(),this.updateCropBox||(this.updateCropBox=Mi(h=>{this.$refs.cropper.rotateTo(h),this.$nextTick(()=>{const{width:m,height:v,left:b,top:N}=this.$refs.cropper.getCanvasData();this.$refs.cropper.setCropBoxData({width:m,height:v,left:b,top:N}),this.$refs.cropper.setData({width:m,height:v})})},Math.min(300,Math.round(this.file.size/le)),{leading:!1,trailing:!0})),this.file&&this.updateCropBox(s)},getSizeDiffText(s,h){const m=h-s;let v=`\u539F\u56FE\u4F53\u79EF ${$t(s)}\uFF0C\u7F16\u8F91\u540E ${$t(h)}`,b=m===0?"":`${(m/s*100).toFixed(2)}%`;return m>0&&(b="+"+b),b&&(b=`\uFF08${b}\uFF09`),v+b},checkAspectRatio(s){return new Promise(h=>{const m=new FileReader;m.onload=v=>{const b=new Image;b.onload=()=>{const N=b.width/b.height;h(N<this.aspectRatioValue*(1-this.aspectRatioDeviation)||N>this.aspectRatioValue*(1+this.aspectRatioDeviation))},b.src=v.target.result},m.readAsDataURL(s)})},cancel(){this.src="",this.$emit("cancel")},onConfirm(){this.submitting=!0,this.$refs.cropper.getCroppedCanvas({width:this.croppedWidth,height:this.croppedHeight}).toBlob(s=>{this.$emit("confirm",s),this.src="",this.submitting=!1},this.file.type,this.quality)},touch(){this.isTouched=!0},cropChange(s){this.croppedWidth=Math.trunc(s.detail.width),this.croppedHeight=Math.trunc(s.detail.height);let h=this.$refs.cropper.getContainerData(),m=this.$refs.cropper.getImageData(),v=m.naturalWidth/m.width,b=h.width*v,N=h.height*v;this.orChange=!1;let _=null,M=null;this.fixedCoverWidth&&this.fixedCoverWidth<b?this.fixedCoverWidth!=s.detail.width&&(this.fixedCoverWidth-s.detail.width>1||this.fixedCoverWidth-s.detail.width<-1)&&(this.orChange=!0,_=this.fixedCoverWidth):(this.maxCoverWidth||this.minCoverWidth)&&(this.maxCoverWidth&&this.minCoverWidth?(s.detail.width>this.maxCoverWidth||s.detail.width<this.minCoverWidth)&&(this.orChange=!0,_=Math.max(this.minCoverWidth,Math.min(this.maxCoverWidth,s.detail.width))):this.maxCoverWidth?s.detail.width>this.maxCoverWidth&&(this.orChange=!0,_=this.maxCoverWidth):this.minCoverWidth&&s.detail.width<this.minCoverWidth&&(this.orChange=!0,_=this.minCoverWidth)),this.fixedCoverHeight&&this.fixedCoverHeight<N?this.fixedCoverHeight!=s.detail.height&&(this.fixedCoverHeight-s.detail.height>1||this.fixedCoverHeight-s.detail.height<-1)&&(this.orChange=!0,M=this.fixedCoverHeight):(this.maxCoverHeight||this.minCoverHeight)&&(this.maxCoverHei