index.70f820ec.js 46 KB

12345678910
  1. import{d as Ht,af as xe,E as wt,c as x,K as Me,q as De,v as Ut,a as bt,k as Yt,ag as Ce,x as Ae}from"./vendor.f5bf56e4.js";import{r as Ee}from"./index.ebd578f0.js";const Te="_uploadSection_107z7_1",Se="_uploadClass_107z7_11",Oe="_previewImg_107z7_34",qe="_operation_107z7_44",Ne="_myImages_107z7_1";var Y={uploadSection:Te,uploadClass:Se,"avatar-upload-preview_range":"_avatar-upload-preview_range_107z7_19","avatar-upload-preview":"_avatar-upload-preview_107z7_19",previewImg:Oe,operation:qe,"icon-rate":"_icon-rate_107z7_54","vue-cropper":"_vue-cropper_107z7_61","el-dialog":"_el-dialog_107z7_65","el-dialog__header":"_el-dialog__header_107z7_68","el-dialog__title":"_el-dialog__title_107z7_72","el-dialog__headerbtn":"_el-dialog__headerbtn_107z7_75","el-dialog__close":"_el-dialog__close_107z7_75","el-dialog__body":"_el-dialog__body_107z7_78",myImages:Ne},Re="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA4CAMAAAB6xg5AAAAAAXNSR0IArs4c6QAAAsRQTFRFAAAAAP8AAP//AICAAP+AAP//AKqqVaqqVf+qAL+/QL+/M8yZKqqqKtWqJNu2IN+/HMaqM8yZM8yzLtGiLtG5Kr+qJMikML+fMM+vM8ymLMixKcKjKcKtKcytJ8SnJ86xMcSnL8aqLsitLMqwKsOqKcWtMMenMMevLsmqLcOtLcutLMWoK8aqKcilKcisMMisL8moLsSqLcysLMeuK8iqL8qsLcaqLMisK8moK8muMMqqL8usLMmsL8yqLsmrLcqpLcqtLcaqK8ipLcepK8apK8msLcerLMmqLMaoLMmrLsepLcWoLcapLMaqLsipLsisLsWqLMepLMeqLsirLcerLsarLsmrLceqLcqqLMisLsmqLserLcesLciqLcmrLcipLcisLcaqLMepLMesLMaqLsiqLsirLMirLMipLcerLcmrLciqLMepLseqLsmqLcipLcirLMepLcapLcepLMeqLMiqLsiqLsipLceqLcerLcipLsiqLsepLcepLceqLcirLMirLMeqLcerLcirLcepLcisLserLsiqLcerLceqLcirLMepLcerLciqLMeqLceqLciqLcirLceqLMepLseqLserLcaqLciqLceqLceqLceqLMiqLsiqLcirLceqLcepLceqLcaqLciqLsaqLMepLsiqLceqLcerLceqLciqLseqLcerLceqLceqLciqLceqLceqLciqLceqLcaqLcirLMeqLceqLceqLcerLciqLcepLceqLciqLMeqLMeqLceqLceqLcirLceqLciqLceqLMeqLMerLMaqLceqLcirLceqLceqLceqLceqLceqLMiqLMeqLceqLcepLceqLceqLMeqLMeqLcaqLceqLceqLceqLceqLMepLMeqLceqLcaqLceqLciqLcepLceqLcerLceqLMeqLMiqLciqLceqLcirLceqkeY/1AAAAOt0Uk5TAAEBAgICAwMDBAQFBgYHCAkKCgsLDA4QEBQXGRkZGhoaGxwdHh8gICEiIiMkJSUlJicoKSorLS4vLzAxNDw9Pj4/QURHR0lLTExNT1BRU1NUVldYW15eYGBiY2RlZmdra2xubm9vcHN0dnZ4ent7fX2AgoOEioqMjY6PkJGSk5SVlpqdnp+goqSlpqepqqyur7CxsrOztLS1tre4uLm6u7y9vb2+vr+/wMLExcrMzM3O0NLU1NXV1tfY2dnZ2tvb3N3e3t/g4OHj4+Tl5+jq6+zt7u7w8fLz8/T19vf39/j5+fr6+/z9/f3+/ne0wvQAAAMbSURBVEjHnZb5W0xRGMdfyVjSqMiSfUsGCZUoS4WyZkkiS6Hs+55s2RIp+74rW5aIsmUP2WWUBoWS6fwT7n3vzG3uzD1z79z3p3M+53w/zzxz3nOeC2BrheUVHfME5RVYSQh55krf0Hz2xkTL2jS3nWF9J2FrODU/vYSI14853IZ0nEXT8lFVhFozcEeGVYHTJ3qeFDeWFowk1ipcWrCVltUu9XWpZScpUH2g5O958HusCgZQ8jqmcTRRMVgPkaTgOHp0Iz5bz5WptRRBAkBEqejK066YDk5+W2nt3wsCN1p7nGDiTfcTidJAKG2pFKDJHak88Qc/2lIeQJpknsQB7BBfqQyDgdJ58kQNqtiDGelsFSJ5wA4z0ncFAmyWISDbVfQ+eEyPVRSXG4fnfKmCn+Lh16uHtGZWWw5akY/zqpzDqWlp86oF9vUNAtF4waTq32w/Pp/nqdWCOi5WBBucBB2uXlVlKahNF/yeanFJjI3MC2KsCSaKXLNxelw6AnAUBxPAmSqIN75OwxasWTjCuG05d60BZmIDdwFvmuCRA+IGi7XcO7asIfdU3MJpb1AxPVkSAbCEJhiLtEUmD7LaIxnK9QNzOn6hbgAeWorgdg0WutwwQdn4mMJVrifVOPG8TyiC+QhXCk8VWazhXsT5a4ISdIQmCGBZs+/Cc23Lwl5mO8UF5Y4sizTbO42Fdjo5glfI1psJtiC9K0eQiyzFTHAI6XU5gufIEs0ESUiz5Qh0NVk2y0ywCHd+liMg3VjWXS+EfVjYRtYpkCkIUwXsOLJweYLTCDt9NEFfeiDbJ0+gx06CfoU8+RqMxKdCnoCc5bDXBcP8sg8HDhCZAu4zgqn+8Weyzq8Lon56UAW6AJEXybdIvoC86WuR935JbBCQb6PM8iFaYpOA6Hd7mcQ7J/8jNgoI+ZMUwn29OA/eVia+xbqAdeSe2nMy5xd1XVIgVUZBmcK83sEgeKFQ8N74HycrFOzlz1ihYAx/zBcV5TPteEGrAgX5d+4mndbhms35mxrhR3rkpQob0n+vTK5rcd0cO/aUW+5qQfI/vbBmnVf4WssAAAAASUVORK5CYII=";/*!
  2. * Cropper.js v1.5.12
  3. * https://fengyuanchen.github.io/cropperjs
  4. *
  5. * Copyright 2015-present Chen Fengyuan
  6. * Released under the MIT license
  7. *
  8. * Date: 2021-06-12T08:00:17.411Z
  9. */function Xt(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 Pt(a){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?Xt(Object(i),!0).forEach(function(e){ze(a,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):Xt(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))})}return a}function pt(a){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pt=function(t){return typeof t}:pt=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(a)}function _e(a,t){if(!(a instanceof t))throw new TypeError("Cannot call a class as a function")}function Vt(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 Ie(a,t,i){return t&&Vt(a.prototype,t),i&&Vt(a,i),a}function ze(a,t,i){return t in a?Object.defineProperty(a,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[t]=i,a}function jt(a){return ke(a)||Be(a)||We(a)||He()}function ke(a){if(Array.isArray(a))return yt(a)}function Be(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function We(a,t){if(!!a){if(typeof a=="string")return yt(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 yt(a,t)}}function yt(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 He(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
  10. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var dt=typeof window!="undefined"&&typeof window.document!="undefined",k=dt?window:{},Lt=dt&&k.document.documentElement?"ontouchstart"in k.document.documentElement:!1,xt=dt?"PointerEvent"in k:!1,y="cropper",Mt="all",Kt="crop",Ft="move",Gt="zoom",G="e",Q="w",J="s",X="n",at="ne",rt="nw",st="se",ot="sw",Dt="".concat(y,"-crop"),Qt="".concat(y,"-disabled"),O="".concat(y,"-hidden"),$t="".concat(y,"-hide"),Ue="".concat(y,"-invisible"),ft="".concat(y,"-modal"),Ct="".concat(y,"-move"),nt="".concat(y,"Action"),ut="".concat(y,"Preview"),At="crop",Jt="move",Zt="none",Et="crop",Tt="cropend",St="cropmove",Ot="cropstart",te="dblclick",Ye=Lt?"touchstart":"mousedown",Xe=Lt?"touchmove":"mousemove",Pe=Lt?"touchend touchcancel":"mouseup",ee=xt?"pointerdown":Ye,ie=xt?"pointermove":Xe,ae=xt?"pointerup pointercancel":Pe,re="ready",se="resize",oe="wheel",qt="zoom",ne="image/jpeg",Ve=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,je=/^data:/,Ke=/^data:image\/jpeg;base64,/,Fe=/^img|canvas$/i,he=200,ce=100,le={viewMode:0,dragMode:At,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:he,minContainerHeight:ce,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Ge='<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>',Qe=Number.isNaN||k.isNaN;function u(a){return typeof a=="number"&&!Qe(a)}var pe=function(t){return t>0&&t<1/0};function Nt(a){return typeof a=="undefined"}function $(a){return pt(a)==="object"&&a!==null}var $e=Object.prototype.hasOwnProperty;function Z(a){if(!$(a))return!1;try{var t=a.constructor,i=t.prototype;return t&&i&&$e.call(i,"isPrototypeOf")}catch{return!1}}function q(a){return typeof a=="function"}var Je=Array.prototype.slice;function de(a){return Array.from?Array.from(a):Je.call(a)}function D(a,t){return a&&q(t)&&(Array.isArray(a)||u(a.length)?de(a).forEach(function(i,e){t.call(a,i,e,a)}):$(a)&&Object.keys(a).forEach(function(i){t.call(a,a[i],i,a)})),a}var L=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 $(t)&&e.length>0&&e.forEach(function(r){$(r)&&Object.keys(r).forEach(function(s){t[s]=r[s]})}),t},Ze=/\.\d*(?:0|9){12}\d*$/;function tt(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Ze.test(a)?Math.round(a*t)/t:a}var ti=/^width|height|left|top|marginLeft|marginTop$/;function P(a,t){var i=a.style;D(t,function(e,o){ti.test(o)&&u(e)&&(e="".concat(e,"px")),i[o]=e})}function ei(a,t){return a.classList?a.classList.contains(t):a.className.indexOf(t)>-1}function T(a,t){if(!!t){if(u(a.length)){D(a,function(e){T(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 B(a,t){if(!!t){if(u(a.length)){D(a,function(i){B(i,t)});return}if(a.classList){a.classList.remove(t);return}a.className.indexOf(t)>=0&&(a.className=a.className.replace(t,""))}}function et(a,t,i){if(!!t){if(u(a.length)){D(a,function(e){et(e,t,i)});return}i?T(a,t):B(a,t)}}var ii=/([a-z\d])([A-Z])/g;function Rt(a){return a.replace(ii,"$1-$2").toLowerCase()}function _t(a,t){return $(a[t])?a[t]:a.dataset?a.dataset[t]:a.getAttribute("data-".concat(Rt(t)))}function ht(a,t,i){$(i)?a[t]=i:a.dataset?a.dataset[t]=i:a.setAttribute("data-".concat(Rt(t)),i)}function ai(a,t){if($(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(Rt(t)))}var fe=/\s\s*/,ue=function(){var a=!1;if(dt){var t=!1,i=function(){},e=Object.defineProperty({},"once",{get:function(){return a=!0,t},set:function(r){t=r}});k.addEventListener("test",i,e),k.removeEventListener("test",i,e)}return a}();function I(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(fe).forEach(function(r){if(!ue){var s=a.listeners;s&&s[r]&&s[r][i]&&(o=s[r][i],delete s[r][i],Object.keys(s[r]).length===0&&delete s[r],Object.keys(s).length===0&&delete a.listeners)}a.removeEventListener(r,o,e)})}function _(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(fe).forEach(function(r){if(e.once&&!ue){var s=a.listeners,n=s===void 0?{}:s;o=function(){delete n[r][i],a.removeEventListener(r,o,e);for(var l=arguments.length,h=new Array(l),c=0;c<l;c++)h[c]=arguments[c];i.apply(a,h)},n[r]||(n[r]={}),n[r][i]&&a.removeEventListener(r,n[r][i],e),n[r][i]=o,a.listeners=n}a.addEventListener(r,o,e)})}function it(a,t,i){var e;return q(Event)&&q(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 ge(a){var t=a.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var It=k.location,ri=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function me(a){var t=a.match(ri);return t!==null&&(t[1]!==It.protocol||t[2]!==It.hostname||t[3]!==It.port)}function ve(a){var t="timestamp=".concat(new Date().getTime());return a+(a.indexOf("?")===-1?"?":"&")+t}function ct(a){var t=a.rotate,i=a.scaleX,e=a.scaleY,o=a.translateX,r=a.translateY,s=[];u(o)&&o!==0&&s.push("translateX(".concat(o,"px)")),u(r)&&r!==0&&s.push("translateY(".concat(r,"px)")),u(t)&&t!==0&&s.push("rotate(".concat(t,"deg)")),u(i)&&i!==1&&s.push("scaleX(".concat(i,")")),u(e)&&e!==1&&s.push("scaleY(".concat(e,")"));var n=s.length?s.join(" "):"none";return{WebkitTransform:n,msTransform:n,transform:n}}function si(a){var t=Pt({},a),i=0;return D(a,function(e,o){delete t[o],D(t,function(r){var s=Math.abs(e.startX-r.startX),n=Math.abs(e.startY-r.startY),p=Math.abs(e.endX-r.endX),l=Math.abs(e.endY-r.endY),h=Math.sqrt(s*s+n*n),c=Math.sqrt(p*p+l*l),d=(c-h)/h;Math.abs(d)>Math.abs(i)&&(i=d)})}),i}function gt(a,t){var i=a.pageX,e=a.pageY,o={endX:i,endY:e};return t?o:Pt({startX:i,startY:e},o)}function oi(a){var t=0,i=0,e=0;return D(a,function(o){var r=o.startX,s=o.startY;t+=r,i+=s,e+=1}),t/=e,i/=e,{pageX:t,pageY:i}}function V(a){var t=a.aspectRatio,i=a.height,e=a.width,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=pe(e),s=pe(i);if(r&&s){var n=i*t;o==="contain"&&n>e||o==="cover"&&n<e?i=e/t:e=i*t}else r?i=e/t:s&&(e=i*t);return{width:e,height:i}}function ni(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),s=Math.cos(o),n=t*s+i*r,p=t*r+i*s;return e>90?{width:p,height:n}:{width:n,height:p}}function hi(a,t,i,e){var o=t.aspectRatio,r=t.naturalWidth,s=t.naturalHeight,n=t.rotate,p=n===void 0?0:n,l=t.scaleX,h=l===void 0?1:l,c=t.scaleY,d=c===void 0?1:c,m=i.aspectRatio,g=i.naturalWidth,b=i.naturalHeight,v=e.fillColor,C=v===void 0?"transparent":v,E=e.imageSmoothingEnabled,M=E===void 0?!0:E,W=e.imageSmoothingQuality,N=W===void 0?"low":W,f=e.maxWidth,w=f===void 0?1/0:f,A=e.maxHeight,R=A===void 0?1/0:A,H=e.minWidth,j=H===void 0?0:H,K=e.minHeight,U=K===void 0?0:K,z=document.createElement("canvas"),S=z.getContext("2d"),F=V({aspectRatio:m,width:w,height:R}),lt=V({aspectRatio:m,width:j,height:U},"cover"),mt=Math.min(F.width,Math.max(lt.width,g)),vt=Math.min(F.height,Math.max(lt.height,b)),zt=V({aspectRatio:o,width:w,height:R}),kt=V({aspectRatio:o,width:j,height:U},"cover"),Bt=Math.min(zt.width,Math.max(kt.width,r)),Wt=Math.min(zt.height,Math.max(kt.height,s)),ye=[-Bt/2,-Wt/2,Bt,Wt];return z.width=tt(mt),z.height=tt(vt),S.fillStyle=C,S.fillRect(0,0,mt,vt),S.save(),S.translate(mt/2,vt/2),S.rotate(p*Math.PI/180),S.scale(h,d),S.imageSmoothingEnabled=M,S.imageSmoothingQuality=N,S.drawImage.apply(S,[a].concat(jt(ye.map(function(Le){return Math.floor(tt(Le))})))),S.restore(),z}var we=String.fromCharCode;function ci(a,t,i){var e="";i+=t;for(var o=t;o<i;o+=1)e+=we(a.getUint8(o));return e}var li=/^data:.*,/;function pi(a){var t=a.replace(li,""),i=atob(t),e=new ArrayBuffer(i.length),o=new Uint8Array(e);return D(o,function(r,s){o[s]=i.charCodeAt(s)}),e}function di(a,t){for(var i=[],e=8192,o=new Uint8Array(a);o.length>0;)i.push(we.apply(null,de(o.subarray(0,e)))),o=o.subarray(e);return"data:".concat(t,";base64,").concat(btoa(i.join("")))}function fi(a){var t=new DataView(a),i;try{var e,o,r;if(t.getUint8(0)===255&&t.getUint8(1)===216)for(var s=t.byteLength,n=2;n+1<s;){if(t.getUint8(n)===255&&t.getUint8(n+1)===225){o=n;break}n+=1}if(o){var p=o+4,l=o+10;if(ci(t,p,4)==="Exif"){var h=t.getUint16(l);if(e=h===18761,(e||h===19789)&&t.getUint16(l+2,e)===42){var c=t.getUint32(l+4,e);c>=8&&(r=l+c)}}}if(r){var d=t.getUint16(r,e),m,g;for(g=0;g<d;g+=1)if(m=r+g*12+2,t.getUint16(m,e)===274){m+=8,i=t.getUint16(m,e),t.setUint16(m,1,e);break}}}catch{i=1}return i}function ui(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 gi={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),s=Number(i.minContainerHeight);T(o,O),B(t,O);var n={width:Math.max(e.offsetWidth,r>=0?r:he),height:Math.max(e.offsetHeight,s>=0?s:ce)};this.containerData=n,P(o,{width:n.width,height:n.height}),T(t,O),B(o,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,s=o?i.naturalWidth:i.naturalHeight,n=r/s,p=t.width,l=t.height;t.height*n>t.width?e===3?p=t.height*n:l=t.width/n:e===3?l=t.width/n:p=t.height*n;var h={aspectRatio:n,naturalWidth:r,naturalHeight:s,width:p,height:l};this.canvasData=h,this.limited=e===1||e===2,this.limitCanvas(!0,!0),h.width=Math.min(Math.max(h.width,h.minWidth),h.maxWidth),h.height=Math.min(Math.max(h.height,h.minHeight),h.maxHeight),h.left=(t.width-h.width)/2,h.top=(t.height-h.height)/2,h.oldLeft=h.left,h.oldTop=h.top,this.initialCanvasData=L({},h)},limitCanvas:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,s=this.cropBoxData,n=e.viewMode,p=r.aspectRatio,l=this.cropped&&s;if(t){var h=Number(e.minCanvasWidth)||0,c=Number(e.minCanvasHeight)||0;n>1?(h=Math.max(h,o.width),c=Math.max(c,o.height),n===3&&(c*p>h?h=c*p:c=h/p)):n>0&&(h?h=Math.max(h,l?s.width:0):c?c=Math.max(c,l?s.height:0):l&&(h=s.width,c=s.height,c*p>h?h=c*p:c=h/p));var d=V({aspectRatio:p,width:h,height:c});h=d.width,c=d.height,r.minWidth=h,r.minHeight=c,r.maxWidth=1/0,r.maxHeight=1/0}if(i)if(n>(l?0:1)){var m=o.width-r.width,g=o.height-r.height;r.minLeft=Math.min(0,m),r.minTop=Math.min(0,g),r.maxLeft=Math.max(0,m),r.maxTop=Math.max(0,g),l&&this.limited&&(r.minLeft=Math.min(s.left,s.left+(s.width-r.width)),r.minTop=Math.min(s.top,s.top+(s.height-r.height)),r.maxLeft=s.left,r.maxTop=s.top,n===2&&(r.width>=o.width&&(r.minLeft=Math.min(0,m),r.maxLeft=Math.max(0,m)),r.height>=o.height&&(r.minTop=Math.min(0,g),r.maxTop=Math.max(0,g))))}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=ni({width:o.naturalWidth*Math.abs(o.scaleX||1),height:o.naturalHeight*Math.abs(o.scaleY||1),degree:o.rotate||0}),s=r.width,n=r.height,p=e.width*(s/e.naturalWidth),l=e.height*(n/e.naturalHeight);e.left-=(p-e.width)/2,e.top-=(l-e.height)/2,e.width=p,e.height=l,e.aspectRatio=s/n,e.naturalWidth=s,e.naturalHeight=n,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,P(this.canvas,L({width:e.width,height:e.height},ct({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);L(e,{width:o,height:r,left:(i.width-o)/2,top:(i.height-r)/2}),P(this.image,L({width:e.width,height:e.height},ct(L({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=L({},r)},limitCropBox:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,s=this.cropBoxData,n=this.limited,p=e.aspectRatio;if(t){var l=Number(e.minCropBoxWidth)||0,h=Number(e.minCropBoxHeight)||0,c=n?Math.min(o.width,r.width,r.width+r.left,o.width-r.left):o.width,d=n?Math.min(o.height,r.height,r.height+r.top,o.height-r.top):o.height;l=Math.min(l,o.width),h=Math.min(h,o.height),p&&(l&&h?h*p>l?h=l/p:l=h*p:l?h=l/p:h&&(l=h*p),d*p>c?d=c/p:c=d*p),s.minWidth=Math.min(l,c),s.minHeight=Math.min(h,d),s.maxWidth=c,s.maxHeight=d}i&&(n?(s.minLeft=Math.max(0,r.left),s.minTop=Math.max(0,r.top),s.maxLeft=Math.min(o.width,r.left+r.width)-s.width,s.maxTop=Math.min(o.height,r.top+r.height)-s.height):(s.minLeft=0,s.minTop=0,s.maxLeft=o.width-s.width,s.maxTop=o.height-s.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&&ht(this.face,nt,e.width>=i.width&&e.height>=i.height?Ft:Mt),P(this.cropBox,L({width:e.width,height:e.height},ct({translateX:e.left,translateY:e.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),it(this.element,Et,this.getData())}},mi={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",s=document.createElement("img");if(i&&(s.crossOrigin=i),s.src=o,s.alt=r,this.viewBox.appendChild(s),this.viewBoxImage=s,!!e){var n=e;typeof e=="string"?n=t.ownerDocument.querySelectorAll(e):e.querySelector&&(n=[e]),this.previews=n,D(n,function(p){var l=document.createElement("img");ht(p,ut,{width:p.offsetWidth,height:p.offsetHeight,html:p.innerHTML}),i&&(l.crossOrigin=i),l.src=o,l.alt=r,l.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(l)})}},resetPreview:function(){D(this.previews,function(t){var i=_t(t,ut);P(t,{width:i.width,height:i.height}),t.innerHTML=i.html,ai(t,ut)})},preview:function(){var t=this.imageData,i=this.canvasData,e=this.cropBoxData,o=e.width,r=e.height,s=t.width,n=t.height,p=e.left-i.left-t.left,l=e.top-i.top-t.top;!this.cropped||this.disabled||(P(this.viewBoxImage,L({width:s,height:n},ct(L({translateX:-p,translateY:-l},t)))),D(this.previews,function(h){var c=_t(h,ut),d=c.width,m=c.height,g=d,b=m,v=1;o&&(v=d/o,b=r*v),r&&b>m&&(v=m/r,g=o*v,b=m),P(h,{width:g,height:b}),P(h.getElementsByTagName("img")[0],L({width:s*v,height:n*v},ct(L({translateX:-p*v,translateY:-l*v},t))))}))}},vi={bind:function(){var t=this.element,i=this.options,e=this.cropper;q(i.cropstart)&&_(t,Ot,i.cropstart),q(i.cropmove)&&_(t,St,i.cropmove),q(i.cropend)&&_(t,Tt,i.cropend),q(i.crop)&&_(t,Et,i.crop),q(i.zoom)&&_(t,qt,i.zoom),_(e,ee,this.onCropStart=this.cropStart.bind(this)),i.zoomable&&i.zoomOnWheel&&_(e,oe,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&_(e,te,this.onDblclick=this.dblclick.bind(this)),_(t.ownerDocument,ie,this.onCropMove=this.cropMove.bind(this)),_(t.ownerDocument,ae,this.onCropEnd=this.cropEnd.bind(this)),i.responsive&&_(window,se,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.options,e=this.cropper;q(i.cropstart)&&I(t,Ot,i.cropstart),q(i.cropmove)&&I(t,St,i.cropmove),q(i.cropend)&&I(t,Tt,i.cropend),q(i.crop)&&I(t,Et,i.crop),q(i.zoom)&&I(t,qt,i.zoom),I(e,ee,this.onCropStart),i.zoomable&&i.zoomOnWheel&&I(e,oe,this.onWheel,{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&I(e,te,this.onDblclick),I(t.ownerDocument,ie,this.onCropMove),I(t.ownerDocument,ae,this.onCropEnd),i.responsive&&I(window,se,this.onResize)}},wi={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,s=Math.abs(o-1)>Math.abs(r-1)?o:r;if(s!==1){var n,p;t.restore&&(n=this.getCanvasData(),p=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(D(n,function(l,h){n[h]=l*s})),this.setCropBoxData(D(p,function(l,h){p[h]=l*s})))}}},dblclick:function(){this.disabled||this.options.dragMode===Zt||this.setDragMode(ei(this.dragBox,Dt)?Jt:At)},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")&&(u(i)&&i!==1||u(e)&&e!==0||t.ctrlKey))){var o=this.options,r=this.pointers,s;t.changedTouches?D(t.changedTouches,function(n){r[n.identifier]=gt(n)}):r[t.pointerId||0]=gt(t),Object.keys(r).length>1&&o.zoomable&&o.zoomOnTouch?s=Gt:s=_t(t.target,nt),!!Ve.test(s)&&it(this.element,Ot,{originalEvent:t,action:s})!==!1&&(t.preventDefault(),this.action=s,this.cropping=!1,s===Kt&&(this.cropping=!0,T(this.dragBox,ft)))}},cropMove:function(t){var i=this.action;if(!(this.disabled||!i)){var e=this.pointers;t.preventDefault(),it(this.element,St,{originalEvent:t,action:i})!==!1&&(t.changedTouches?D(t.changedTouches,function(o){L(e[o.identifier]||{},gt(o,!0))}):L(e[t.pointerId||0]||{},gt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var i=this.action,e=this.pointers;t.changedTouches?D(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,et(this.dragBox,ft,this.cropped&&this.options.modal)),it(this.element,Tt,{originalEvent:t,action:i}))}}},bi={change:function(t){var i=this.options,e=this.canvasData,o=this.containerData,r=this.cropBoxData,s=this.pointers,n=this.action,p=i.aspectRatio,l=r.left,h=r.top,c=r.width,d=r.height,m=l+c,g=h+d,b=0,v=0,C=o.width,E=o.height,M=!0,W;!p&&t.shiftKey&&(p=c&&d?c/d:1),this.limited&&(b=r.minLeft,v=r.minTop,C=b+Math.min(o.width,e.width,e.left+e.width),E=v+Math.min(o.height,e.height,e.top+e.height));var N=s[Object.keys(s)[0]],f={x:N.endX-N.startX,y:N.endY-N.startY},w=function(R){switch(R){case G:m+f.x>C&&(f.x=C-m);break;case Q:l+f.x<b&&(f.x=b-l);break;case X:h+f.y<v&&(f.y=v-h);break;case J:g+f.y>E&&(f.y=E-g);break}};switch(n){case Mt:l+=f.x,h+=f.y;break;case G:if(f.x>=0&&(m>=C||p&&(h<=v||g>=E))){M=!1;break}w(G),c+=f.x,c<0&&(n=Q,c=-c,l-=c),p&&(d=c/p,h+=(r.height-d)/2);break;case X:if(f.y<=0&&(h<=v||p&&(l<=b||m>=C))){M=!1;break}w(X),d-=f.y,h+=f.y,d<0&&(n=J,d=-d,h-=d),p&&(c=d*p,l+=(r.width-c)/2);break;case Q:if(f.x<=0&&(l<=b||p&&(h<=v||g>=E))){M=!1;break}w(Q),c-=f.x,l+=f.x,c<0&&(n=G,c=-c,l-=c),p&&(d=c/p,h+=(r.height-d)/2);break;case J:if(f.y>=0&&(g>=E||p&&(l<=b||m>=C))){M=!1;break}w(J),d+=f.y,d<0&&(n=X,d=-d,h-=d),p&&(c=d*p,l+=(r.width-c)/2);break;case at:if(p){if(f.y<=0&&(h<=v||m>=C)){M=!1;break}w(X),d-=f.y,h+=f.y,c=d*p}else w(X),w(G),f.x>=0?m<C?c+=f.x:f.y<=0&&h<=v&&(M=!1):c+=f.x,f.y<=0?h>v&&(d-=f.y,h+=f.y):(d-=f.y,h+=f.y);c<0&&d<0?(n=ot,d=-d,c=-c,h-=d,l-=c):c<0?(n=rt,c=-c,l-=c):d<0&&(n=st,d=-d,h-=d);break;case rt:if(p){if(f.y<=0&&(h<=v||l<=b)){M=!1;break}w(X),d-=f.y,h+=f.y,c=d*p,l+=r.width-c}else w(X),w(Q),f.x<=0?l>b?(c-=f.x,l+=f.x):f.y<=0&&h<=v&&(M=!1):(c-=f.x,l+=f.x),f.y<=0?h>v&&(d-=f.y,h+=f.y):(d-=f.y,h+=f.y);c<0&&d<0?(n=st,d=-d,c=-c,h-=d,l-=c):c<0?(n=at,c=-c,l-=c):d<0&&(n=ot,d=-d,h-=d);break;case ot:if(p){if(f.x<=0&&(l<=b||g>=E)){M=!1;break}w(Q),c-=f.x,l+=f.x,d=c/p}else w(J),w(Q),f.x<=0?l>b?(c-=f.x,l+=f.x):f.y>=0&&g>=E&&(M=!1):(c-=f.x,l+=f.x),f.y>=0?g<E&&(d+=f.y):d+=f.y;c<0&&d<0?(n=at,d=-d,c=-c,h-=d,l-=c):c<0?(n=st,c=-c,l-=c):d<0&&(n=rt,d=-d,h-=d);break;case st:if(p){if(f.x>=0&&(m>=C||g>=E)){M=!1;break}w(G),c+=f.x,d=c/p}else w(J),w(G),f.x>=0?m<C?c+=f.x:f.y>=0&&g>=E&&(M=!1):c+=f.x,f.y>=0?g<E&&(d+=f.y):d+=f.y;c<0&&d<0?(n=rt,d=-d,c=-c,h-=d,l-=c):c<0?(n=ot,c=-c,l-=c):d<0&&(n=at,d=-d,h-=d);break;case Ft:this.move(f.x,f.y),M=!1;break;case Gt:this.zoom(si(s),t),M=!1;break;case Kt:if(!f.x||!f.y){M=!1;break}W=ge(this.cropper),l=N.startX-W.left,h=N.startY-W.top,c=r.minWidth,d=r.minHeight,f.x>0?n=f.y>0?st:at:f.x<0&&(l-=c,n=f.y>0?ot:rt),f.y<0&&(h-=d),this.cropped||(B(this.cropBox,O),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}M&&(r.width=c,r.height=d,r.left=l,r.top=h,this.action=n,this.renderCropBox()),D(s,function(A){A.startX=A.endX,A.startY=A.endY})}},yi={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&T(this.dragBox,ft),B(this.cropBox,O),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=L({},this.initialImageData),this.canvasData=L({},this.initialCanvasData),this.cropBoxData=L({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(L(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),B(this.dragBox,ft),T(this.cropBox,O)),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,D(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,B(this.cropper,Qt)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,T(this.cropper,Qt)),this},destroy:function(){var t=this.element;return t[y]?(t[y]=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(Nt(t)?t:o+Number(t),Nt(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&&(u(t)&&(e.left=t,o=!0),u(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,s=r.width,n=r.height,p=r.naturalWidth,l=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&o.zoomable){var h=p*t,c=l*t;if(it(this.element,qt,{ratio:t,oldRatio:s/p,originalEvent:e})===!1)return this;if(e){var d=this.pointers,m=ge(this.cropper),g=d&&Object.keys(d).length?oi(d):{pageX:e.pageX,pageY:e.pageY};r.left-=(h-s)*((g.pageX-m.left-r.left)/s),r.top-=(c-n)*((g.pageY-m.top-r.top)/n)}else Z(i)&&u(i.x)&&u(i.y)?(r.left-=(h-s)*((i.x-r.left)/s),r.top-=(c-n)*((i.y-r.top)/n)):(r.left-=(h-s)/2,r.top-=(c-n)/2);r.width=h,r.height=c,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),u(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,u(i)?i:1)},scaleY:function(t){var i=this.imageData.scaleX;return this.scale(u(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&&(u(t)&&(e.scaleX=t,o=!0),u(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,s;if(this.ready&&this.cropped){s={x:r.left-o.left,y:r.top-o.top,width:r.width,height:r.height};var n=e.width/e.naturalWidth;if(D(s,function(h,c){s[c]=h/n}),t){var p=Math.round(s.y+s.height),l=Math.round(s.x+s.width);s.x=Math.round(s.x),s.y=Math.round(s.y),s.width=l-s.x,s.height=p-s.y}}else s={x:0,y:0,width:0,height:0};return i.rotatable&&(s.rotate=e.rotate||0),i.scalable&&(s.scaleX=e.scaleX||1,s.scaleY=e.scaleY||1),s},setData:function(t){var i=this.options,e=this.imageData,o=this.canvasData,r={};if(this.ready&&!this.disabled&&Z(t)){var s=!1;i.rotatable&&u(t.rotate)&&t.rotate!==e.rotate&&(e.rotate=t.rotate,s=!0),i.scalable&&(u(t.scaleX)&&t.scaleX!==e.scaleX&&(e.scaleX=t.scaleX,s=!0),u(t.scaleY)&&t.scaleY!==e.scaleY&&(e.scaleY=t.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var n=e.width/e.naturalWidth;u(t.x)&&(r.left=t.x*n+o.left),u(t.y)&&(r.top=t.y*n+o.top),u(t.width)&&(r.width=t.width*n),u(t.height)&&(r.height=t.height*n),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?L({},this.containerData):{}},getImageData:function(){return this.sized?L({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,i={};return this.ready&&D(["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&&Z(t)&&(u(t.left)&&(i.left=t.left),u(t.top)&&(i.top=t.top),u(t.width)?(i.width=t.width,i.height=t.width/e):u(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&&Z(t)&&(u(t.left)&&(i.left=t.left),u(t.top)&&(i.top=t.top),u(t.width)&&t.width!==i.width&&(o=!0,i.width=t.width),u(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=hi(this.image,this.imageData,i,t);if(!this.cropped)return e;var o=this.getData(),r=o.x,s=o.y,n=o.width,p=o.height,l=e.width/Math.floor(i.naturalWidth);l!==1&&(r*=l,s*=l,n*=l,p*=l);var h=n/p,c=V({aspectRatio:h,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=V({aspectRatio:h,width:t.minWidth||0,height:t.minHeight||0},"cover"),m=V({aspectRatio:h,width:t.width||(l!==1?e.width:n),height:t.height||(l!==1?e.height:p)}),g=m.width,b=m.height;g=Math.min(c.width,Math.max(d.width,g)),b=Math.min(c.height,Math.max(d.height,b));var v=document.createElement("canvas"),C=v.getContext("2d");v.width=tt(g),v.height=tt(b),C.fillStyle=t.fillColor||"transparent",C.fillRect(0,0,g,b);var E=t.imageSmoothingEnabled,M=E===void 0?!0:E,W=t.imageSmoothingQuality;C.imageSmoothingEnabled=M,W&&(C.imageSmoothingQuality=W);var N=e.width,f=e.height,w=r,A=s,R,H,j,K,U,z;w<=-n||w>N?(w=0,R=0,j=0,U=0):w<=0?(j=-w,w=0,R=Math.min(N,n+w),U=R):w<=N&&(j=0,R=Math.min(n,N-w),U=R),R<=0||A<=-p||A>f?(A=0,H=0,K=0,z=0):A<=0?(K=-A,A=0,H=Math.min(f,p+A),z=H):A<=f&&(K=0,H=Math.min(p,f-A),z=H);var S=[w,A,R,H];if(U>0&&z>0){var F=g/n;S.push(j*F,K*F,U*F,z*F)}return C.drawImage.apply(C,[e].concat(jt(S.map(function(lt){return Math.floor(tt(lt))})))),v},setAspectRatio:function(t){var i=this.options;return!this.disabled&&!Nt(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===At,s=i.movable&&t===Jt;t=r||s?t:Zt,i.dragMode=t,ht(e,nt,t),et(e,Dt,r),et(e,Ct,s),i.cropBoxMovable||(ht(o,nt,t),et(o,Dt,r),et(o,Ct,s))}return this}},Li=k.Cropper,be=function(){function a(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_e(this,a),!t||!Fe.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=L({},le,Z(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 Ie(a,[{key:"init",value:function(){var i=this.element,e=i.tagName.toLowerCase(),o;if(!i[y]){if(i[y]=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(je.test(i)){Ke.test(i)?this.read(pi(i)):this.clone();return}var s=new XMLHttpRequest,n=this.clone.bind(this);this.reloading=!0,this.xhr=s,s.onabort=n,s.onerror=n,s.ontimeout=n,s.onprogress=function(){s.getResponseHeader("content-type")!==ne&&s.abort()},s.onload=function(){e.read(s.response)},s.onloadend=function(){e.reloading=!1,e.xhr=null},r.checkCrossOrigin&&me(i)&&o.crossOrigin&&(i=ve(i)),s.open("GET",i,!0),s.responseType="arraybuffer",s.withCredentials=o.crossOrigin==="use-credentials",s.send()}}},{key:"read",value:function(i){var e=this.options,o=this.imageData,r=fi(i),s=0,n=1,p=1;if(r>1){this.url=di(i,ne);var l=ui(r);s=l.rotate,n=l.scaleX,p=l.scaleY}e.rotatable&&(o.rotate=s),e.scalable&&(o.scaleX=n,o.scaleY=p),this.clone()}},{key:"clone",value:function(){var i=this.element,e=this.url,o=i.crossOrigin,r=e;this.options.checkCrossOrigin&&me(e)&&(o||(o="anonymous"),r=ve(e)),this.crossOrigin=o,this.crossOriginUrl=r;var s=document.createElement("img");o&&(s.crossOrigin=o),s.src=r||e,s.alt=i.alt||"The image to crop",this.image=s,s.onload=this.start.bind(this),s.onerror=this.stop.bind(this),T(s,$t),i.parentNode.insertBefore(s,i.nextSibling)}},{key:"start",value:function(){var i=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var o=k.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(k.navigator.userAgent),r=function(l,h){L(i.imageData,{naturalWidth:l,naturalHeight:h,aspectRatio:l/h}),i.initialImageData=L({},i.imageData),i.sizing=!1,i.sized=!0,i.build()};if(e.naturalWidth&&!o){r(e.naturalWidth,e.naturalHeight);return}var s=document.createElement("img"),n=document.body||document.documentElement;this.sizingImage=s,s.onload=function(){r(s.width,s.height),o||n.removeChild(s)},s.src=e.src,o||(s.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;",n.appendChild(s))}},{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,s=document.createElement("div");s.innerHTML=Ge;var n=s.querySelector(".".concat(y,"-container")),p=n.querySelector(".".concat(y,"-canvas")),l=n.querySelector(".".concat(y,"-drag-box")),h=n.querySelector(".".concat(y,"-crop-box")),c=h.querySelector(".".concat(y,"-face"));this.container=r,this.cropper=n,this.canvas=p,this.dragBox=l,this.cropBox=h,this.viewBox=n.querySelector(".".concat(y,"-view-box")),this.face=c,p.appendChild(o),T(i,O),r.insertBefore(n,i.nextSibling),this.isImg||B(o,$t),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,T(h,O),e.guides||T(h.getElementsByClassName("".concat(y,"-dashed")),O),e.center||T(h.getElementsByClassName("".concat(y,"-center")),O),e.background&&T(n,"".concat(y,"-bg")),e.highlight||T(c,Ue),e.cropBoxMovable&&(T(c,Ct),ht(c,nt,Mt)),e.cropBoxResizable||(T(h.getElementsByClassName("".concat(y,"-line")),O),T(h.getElementsByClassName("".concat(y,"-point")),O)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),q(e.ready)&&_(i,re,e.ready,{once:!0}),it(i,re)}}},{key:"unbuild",value:function(){!this.ready||(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),B(this.element,O))}},{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=Li,a}},{key:"setDefaults",value:function(i){L(le,Z(i)&&i)}}]),a}();L(be.prototype,gi,mi,vi,wi,bi,yi);var xi=Ht({name:"cropper",props:{cropperNo:{type:Function,default:a=>{}},cropperOk:{type:Function,default:a=>{}},bucket:{type:String,default:"daya"}},data(){return{ossUploadUrl:`https://${this.bucket}.ks3-cn-beijing.ksyuncs.com/`,dataObj:{policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""},visible:!1,img:null,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"\u4FEE\u6539\u5934\u50CF",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},submitLoading:!1,myCropper:null}},methods:{edit(a){const{options:t}=this;this.visible=!0,this.options=Object.assign({},t,a),console.log(this.options)},cancelHandel(){this.visible=!1,this.cropperNo()},okHandel(){this.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob(async a=>{this.submitLoading=!0;const t=this.options,i=(t.name?t.name.split(".")[0]:+new Date)+".png";try{let e=new Date().getTime()+i,o={filename:i,bucketName:this.bucket,postData:{filename:i,acl:"public-read",key:e,unknowValueField:[]}};const r=await Ee.post("/api-website/getUploadSign",{data:o});this.dataObj={policy:r.data.policy,signature:r.data.signature,key:e,KSSAccessKeyId:r.data.kssAccessKeyId,acl:"public-read",name:i};let s=new FormData;for(let p in this.dataObj)s.append(p,this.dataObj[p]);s.append("file",a,i),await xe(this.ossUploadUrl,{method:"POST",data:s}),console.log(this.ossUploadUrl+e);const n=this.ossUploadUrl+e;this.cropperOk(n)}catch(e){wt.error(e)}finally{this.submitLoading=!1,this.cancelHandel()}})},blobToFile(a,t){return a.lastModifiedDate=new Date,a.name=t,a},base64ToFile(a,t){let i=a.split(","),e=i[0].match(/:(.*?);/)[1],o=atob(i[1]),r=o.length,s=new Uint8Array(r);for(;r--;)s[r]=o.charCodeAt(r);return new File([s],t,{type:e})},realTime(a){this.previews=a},changeScale(a){a=a||1,this.$refs.cropperRef.changeScale(a)},rotateLeft(){this.$refs.cropperRef.rotateLeft()},rotateRight(){this.$refs.cropperRef.rotateRight()},initImgCropper(){this.myCropper=new be(this.$refs.imgCropper,{viewMode:1,dragMode:"move",aspectRatio:this.options.autoCropWidth/this.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!1,movable:!0,modal:!0,preview:".before"})}},render(){return x(Me,{modelValue:this.visible,"onUpdate:modelValue":a=>this.visible=a,appendToBody:!0,title:this.options.title,closeOnClickModal:!1,width:"900px",destroyOnClose:!0,onOpened:()=>{this.initImgCropper()}},{default:()=>[x(De,null,{default:()=>[x(Ut,{xs:24,md:12,style:{width:"350px"}},{default:()=>[x("div",{class:Y.imgwarp},[x("img",{ref:"imgCropper",id:"myImages",src:this.options.img,alt:"",style:{height:"350px"}},null)])]}),x(Ut,{xs:24,md:12,style:{height:"350px"}},{default:()=>[x("div",{class:Y.previewImg},[x("span",null,[bt("\u9884\u89C8\u56FE\u7247")]),x("div",{class:[this.options.previewsCircle?Y["avatar-upload-preview"]:Y["avatar-upload-preview_range"],"before"],style:{width:this.options.autoCropWidth+"px",height:this.options.autoCropHeight+"px"}},null)])]})]})],footer:()=>x("span",{class:"dialog-footer !text-center block"},[x(Yt,{onClick:this.cancelHandel,disabled:this.submitLoading},{default:()=>[bt("\u53D6\u6D88")]}),x(Yt,{type:"primary",onClick:this.okHandel,loading:this.submitLoading},{default:()=>[bt("\u4FDD \u5B58")]})])})}}),Ci=Ht({name:"col-cropper",props:{modelValue:{type:String,default:""},options:{type:Object,default:{autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!0,previewsCircle:!0,title:"\u4E0A\u4F20\u56FE\u7247"}},showSize:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bucket:{type:String,default:"daya"},size:{type:Number,default:5},accept:{type:String,default:".png,.jpg,.jpeg"},tips:{type:String,default:"\u8BF7\u4E0A\u4F20\u56FE\u7247"},extraTips:{type:String,default:"\u56FE\u7247\u6700\u5927\u4E0D\u80FD\u8D85\u8FC75MB"},cropUploadSuccess:{type:Function,default:a=>{}},domSize:{type:Object,default:{width:"150px",height:"85px"}}},data(){return{isStopRun:!1,loading:!1}},methods:{onDelete(){this.$emit("update:modelValue","")},async handleChange(a){if(this.isStopRun)return;this.loading=!0;const t=this.options;this.getBase64(a.file,i=>{const e=Object.assign({},t,{img:i,name:a.file.name});this.$refs.CropperModal.edit(e)})},beforeUpload(a){this.isStopRun=!1;var t=a.type;if(t.indexOf("image")<0)return wt.warning("\u8BF7\u4E0A\u4F20\u56FE\u7247"),this.isStopRun=!0,!1;const i=this.size||0,e=a.size<i*1024*1024;return e||(wt.error("\u56FE\u7247\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7"+this.size+"MB!"),this.isStopRun=!0),e},error(){this.remove(),this.loading=!1},remove(){this.onDelete()},handleCropperSuccess(a){this.loading=!1,this.$emit("update:modelValue",a),this.cropUploadSuccess(a)},handleCropperClose(){this.loading=!1,this.remove()},getBase64(a,t){const i=new FileReader;i.addEventListener("load",()=>t(i.result)),i.readAsDataURL(a)}},render(){return x("div",{class:[Y.colUpload,"w-full"],style:{lineHeight:0}},[x(Ce,{disabled:this.disabled,showFileList:!1,accept:this.accept,beforeUpload:this.beforeUpload,httpRequest:this.handleChange,ref:"uploadRef"},{default:()=>[x("div",{ref:"uploadDom",class:[Y.uploadClass,"w-full"],style:{height:this.domSize.height,width:this.domSize.width}},[this.modelValue?x(Ae,{src:this.modelValue,fit:"cover",style:{height:this.domSize.height,width:this.domSize.width},class:Y.uploadSection},null):x("div",{class:[Y.uploadSection,"flex items-center flex-col justify-center"],style:{height:this.domSize.height,width:this.domSize.width}},[x("img",{src:Re,class:"w-8 h-7 mb-3"},null),x("p",null,[this.tips])])])]}),x("p",{class:"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips]),x(xi,{ref:"CropperModal",bucket:this.bucket,cropperNo:this.handleCropperClose,cropperOk:this.handleCropperSuccess},null)])}});export{Ci as C,Re as i};