123456789 |
- import{B as Me,d as oe,e as se,r as Q,f as N,cg as Te,ch as Yt,w as Xt,j as Z,k as G,E as Ne,b as Oe,y as Wt,C as Ae,v as Se,dj as Re}from"./index-54f41458-1694675857467.js";const Ut=a=>Me.post("/edu-app/open/getUploadSign",{data:a});/*!
- * 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 jt(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 he(a){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?jt(Object(i),!0).forEach(function(e){Be(a,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):jt(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))})}return a}function xt(a){"@babel/helpers - typeof";return xt=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},xt(a)}function ke(a,t){if(!(a instanceof t))throw new TypeError("Cannot call a class as a function")}function Ft(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 Le(a,t,i){return t&&Ft(a.prototype,t),i&&Ft(a,i),Object.defineProperty(a,"prototype",{writable:!1}),a}function Be(a,t,i){return t in a?Object.defineProperty(a,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[t]=i,a}function ce(a){return Ie(a)||ze(a)||_e(a)||He()}function Ie(a){if(Array.isArray(a))return Dt(a)}function ze(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function _e(a,t){if(a){if(typeof a=="string")return Dt(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 Dt(a,t)}}function Dt(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.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var mt=typeof window<"u"&&typeof window.document<"u",X=mt?window:{},Rt=mt&&X.document.documentElement?"ontouchstart"in X.document.documentElement:!1,kt=mt?"PointerEvent"in X:!1,E="cropper",Lt="all",le="crop",fe="move",ue="zoom",K="e",q="w",tt="s",U="n",nt="ne",ot="nw",st="se",ht="sw",Ct="".concat(E,"-crop"),Vt="".concat(E,"-disabled"),I="".concat(E,"-hidden"),$t="".concat(E,"-hide"),Pe="".concat(E,"-invisible"),gt="".concat(E,"-modal"),Et="".concat(E,"-move"),lt="".concat(E,"Action"),dt="".concat(E,"Preview"),Bt="crop",de="move",pe="none",Mt="crop",Tt="cropend",Nt="cropmove",Ot="cropstart",Gt="dblclick",Ye=Rt?"touchstart":"mousedown",Xe=Rt?"touchmove":"mousemove",We=Rt?"touchend touchcancel":"mouseup",Kt=kt?"pointerdown":Ye,qt=kt?"pointermove":Xe,Qt=kt?"pointerup pointercancel":We,Zt="ready",Jt="resize",te="wheel",At="zoom",ee="image/jpeg",Ue=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,je=/^data:/,Fe=/^data:image\/jpeg;base64,/,Ve=/^img|canvas$/i,ge=200,me=100,ie={viewMode:0,dragMode:Bt,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:ge,minContainerHeight:me,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},$e='<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>',Ge=Number.isNaN||X.isNaN;function y(a){return typeof a=="number"&&!Ge(a)}var ae=function(t){return t>0&&t<1/0};function wt(a){return typeof a>"u"}function J(a){return xt(a)==="object"&&a!==null}var Ke=Object.prototype.hasOwnProperty;function et(a){if(!J(a))return!1;try{var t=a.constructor,i=t.prototype;return t&&i&&Ke.call(i,"isPrototypeOf")}catch(e){return!1}}function B(a){return typeof a=="function"}var qe=Array.prototype.slice;function ve(a){return Array.from?Array.from(a):qe.call(a)}function S(a,t){return a&&B(t)&&(Array.isArray(a)||y(a.length)?ve(a).forEach(function(i,e){t.call(a,i,e,a)}):J(a)&&Object.keys(a).forEach(function(i){t.call(a,a[i],i,a)})),a}var M=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 J(t)&&e.length>0&&e.forEach(function(r){J(r)&&Object.keys(r).forEach(function(n){t[n]=r[n]})}),t},Qe=/\.\d*(?:0|9){12}\d*$/;function at(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Qe.test(a)?Math.round(a*t)/t:a}var Ze=/^width|height|left|top|marginLeft|marginTop$/;function j(a,t){var i=a.style;S(t,function(e,o){Ze.test(o)&&y(e)&&(e="".concat(e,"px")),i[o]=e})}function Je(a,t){return a.classList?a.classList.contains(t):a.className.indexOf(t)>-1}function R(a,t){if(t){if(y(a.length)){S(a,function(e){R(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 Y(a,t){if(t){if(y(a.length)){S(a,function(i){Y(i,t)});return}if(a.classList){a.classList.remove(t);return}a.className.indexOf(t)>=0&&(a.className=a.className.replace(t,""))}}function it(a,t,i){if(t){if(y(a.length)){S(a,function(e){it(e,t,i)});return}i?R(a,t):Y(a,t)}}var ti=/([a-z\d])([A-Z])/g;function It(a){return a.replace(ti,"$1-$2").toLowerCase()}function St(a,t){return J(a[t])?a[t]:a.dataset?a.dataset[t]:a.getAttribute("data-".concat(It(t)))}function ft(a,t,i){J(i)?a[t]=i:a.dataset?a.dataset[t]=i:a.setAttribute("data-".concat(It(t)),i)}function ei(a,t){if(J(a[t]))try{delete a[t]}catch(i){a[t]=void 0}else if(a.dataset)try{delete a.dataset[t]}catch(i){a.dataset[t]=void 0}else a.removeAttribute("data-".concat(It(t)))}var ye=/\s\s*/,we=function(){var a=!1;if(mt){var t=!1,i=function(){},e=Object.defineProperty({},"once",{get:function(){return a=!0,t},set:function(r){t=r}});X.addEventListener("test",i,e),X.removeEventListener("test",i,e)}return a}();function H(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(ye).forEach(function(r){if(!we){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 z(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(ye).forEach(function(r){if(e.once&&!we){var n=a.listeners,s=n===void 0?{}:n;o=function(){delete s[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)},s[r]||(s[r]={}),s[r][i]&&a.removeEventListener(r,s[r][i],e),s[r][i]=o,a.listeners=s}a.addEventListener(r,o,e)})}function rt(a,t,i){var e;return B(Event)&&B(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 bt=X.location,ii=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function re(a){var t=a.match(ii);return t!==null&&(t[1]!==bt.protocol||t[2]!==bt.hostname||t[3]!==bt.port)}function ne(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,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 s=n.length?n.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function ai(a){var t=he({},a),i=0;return S(a,function(e,o){delete t[o],S(t,function(r){var n=Math.abs(e.startX-r.startX),s=Math.abs(e.startY-r.startY),d=Math.abs(e.endX-r.endX),l=Math.abs(e.endY-r.endY),h=Math.sqrt(n*n+s*s),c=Math.sqrt(d*d+l*l),f=(c-h)/h;Math.abs(f)>Math.abs(i)&&(i=f)})}),i}function pt(a,t){var i=a.pageX,e=a.pageY,o={endX:i,endY:e};return t?o:he({startX:i,startY:e},o)}function ri(a){var t=0,i=0,e=0;return S(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 F(a){var t=a.aspectRatio,i=a.height,e=a.width,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=ae(e),n=ae(i);if(r&&n){var s=i*t;o==="contain"&&s>e||o==="cover"&&s<e?i=e/t:e=i*t}else r?i=e/t:n&&(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),n=Math.cos(o),s=t*n+i*r,d=t*r+i*n;return e>90?{width:d,height:s}:{width:s,height:d}}function oi(a,t,i,e){var o=t.aspectRatio,r=t.naturalWidth,n=t.naturalHeight,s=t.rotate,d=s===void 0?0:s,l=t.scaleX,h=l===void 0?1:l,c=t.scaleY,f=c===void 0?1:c,w=i.aspectRatio,g=i.naturalWidth,C=i.naturalHeight,b=e.fillColor,O=b===void 0?"transparent":b,A=e.imageSmoothingEnabled,T=A===void 0?!0:A,m=e.imageSmoothingQuality,v=m===void 0?"low":m,u=e.maxWidth,p=u===void 0?1/0:u,D=e.maxHeight,x=D===void 0?1/0:D,k=e.minWidth,_=k===void 0?0:k,V=e.minHeight,W=V===void 0?0:V,P=document.createElement("canvas"),L=P.getContext("2d"),$=F({aspectRatio:w,width:p,height:x}),ut=F({aspectRatio:w,width:_,height:W},"cover"),vt=Math.min($.width,Math.max(ut.width,g)),yt=Math.min($.height,Math.max(ut.height,C)),zt=F({aspectRatio:o,width:p,height:x}),_t=F({aspectRatio:o,width:_,height:W},"cover"),Ht=Math.min(zt.width,Math.max(_t.width,r)),Pt=Math.min(zt.height,Math.max(_t.height,n)),Ce=[-Ht/2,-Pt/2,Ht,Pt];return P.width=at(vt),P.height=at(yt),L.fillStyle=O,L.fillRect(0,0,vt,yt),L.save(),L.translate(vt/2,yt/2),L.rotate(d*Math.PI/180),L.scale(h,f),L.imageSmoothingEnabled=T,L.imageSmoothingQuality=v,L.drawImage.apply(L,[a].concat(ce(Ce.map(function(Ee){return Math.floor(at(Ee))})))),L.restore(),P}var xe=String.fromCharCode;function si(a,t,i){var e="";i+=t;for(var o=t;o<i;o+=1)e+=xe(a.getUint8(o));return e}var hi=/^data:.*,/;function ci(a){var t=a.replace(hi,""),i=atob(t),e=new ArrayBuffer(i.length),o=new Uint8Array(e);return S(o,function(r,n){o[n]=i.charCodeAt(n)}),e}function li(a,t){for(var i=[],e=8192,o=new Uint8Array(a);o.length>0;)i.push(xe.apply(null,ve(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 n=t.byteLength,s=2;s+1<n;){if(t.getUint8(s)===255&&t.getUint8(s+1)===225){o=s;break}s+=1}if(o){var d=o+4,l=o+10;if(si(t,d,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 f=t.getUint16(r,e),w,g;for(g=0;g<f;g+=1)if(w=r+g*12+2,t.getUint16(w,e)===274){w+=8,i=t.getUint16(w,e),t.setUint16(w,1,e);break}}}catch(C){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 di={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);R(o,I),Y(t,I);var s={width:Math.max(e.offsetWidth,r>=0?r:ge),height:Math.max(e.offsetHeight,n>=0?n:me)};this.containerData=s,j(o,{width:s.width,height:s.height}),R(t,I),Y(o,I)},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,s=r/n,d=t.width,l=t.height;t.height*s>t.width?e===3?d=t.height*s:l=t.width/s:e===3?l=t.width/s:d=t.height*s;var h={aspectRatio:s,naturalWidth:r,naturalHeight:n,width:d,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=M({},h)},limitCanvas:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,s=e.viewMode,d=r.aspectRatio,l=this.cropped&&n;if(t){var h=Number(e.minCanvasWidth)||0,c=Number(e.minCanvasHeight)||0;s>1?(h=Math.max(h,o.width),c=Math.max(c,o.height),s===3&&(c*d>h?h=c*d:c=h/d)):s>0&&(h?h=Math.max(h,l?n.width:0):c?c=Math.max(c,l?n.height:0):l&&(h=n.width,c=n.height,c*d>h?h=c*d:c=h/d));var f=F({aspectRatio:d,width:h,height:c});h=f.width,c=f.height,r.minWidth=h,r.minHeight=c,r.maxWidth=1/0,r.maxHeight=1/0}if(i)if(s>(l?0:1)){var w=o.width-r.width,g=o.height-r.height;r.minLeft=Math.min(0,w),r.minTop=Math.min(0,g),r.maxLeft=Math.max(0,w),r.maxTop=Math.max(0,g),l&&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,s===2&&(r.width>=o.width&&(r.minLeft=Math.min(0,w),r.maxLeft=Math.max(0,w)),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}),n=r.width,s=r.height,d=e.width*(n/e.naturalWidth),l=e.height*(s/e.naturalHeight);e.left-=(d-e.width)/2,e.top-=(l-e.height)/2,e.width=d,e.height=l,e.aspectRatio=n/s,e.naturalWidth=n,e.naturalHeight=s,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,j(this.canvas,M({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);M(e,{width:o,height:r,left:(i.width-o)/2,top:(i.height-r)/2}),j(this.image,M({width:e.width,height:e.height},ct(M({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=M({},r)},limitCropBox:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,s=this.limited,d=e.aspectRatio;if(t){var l=Number(e.minCropBoxWidth)||0,h=Number(e.minCropBoxHeight)||0,c=s?Math.min(o.width,r.width,r.width+r.left,o.width-r.left):o.width,f=s?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),d&&(l&&h?h*d>l?h=l/d:l=h*d:l?h=l/d:h&&(l=h*d),f*d>c?f=c/d:c=f*d),n.minWidth=Math.min(l,c),n.minHeight=Math.min(h,f),n.maxWidth=c,n.maxHeight=f}i&&(s?(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&&ft(this.face,lt,e.width>=i.width&&e.height>=i.height?fe:Lt),j(this.cropBox,M({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(),rt(this.element,Mt,this.getData())}},pi={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 s=e;typeof e=="string"?s=t.ownerDocument.querySelectorAll(e):e.querySelector&&(s=[e]),this.previews=s,S(s,function(d){var l=document.createElement("img");ft(d,dt,{width:d.offsetWidth,height:d.offsetHeight,html:d.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;"',d.innerHTML="",d.appendChild(l)})}},resetPreview:function(){S(this.previews,function(t){var i=St(t,dt);j(t,{width:i.width,height:i.height}),t.innerHTML=i.html,ei(t,dt)})},preview:function(){var t=this.imageData,i=this.canvasData,e=this.cropBoxData,o=e.width,r=e.height,n=t.width,s=t.height,d=e.left-i.left-t.left,l=e.top-i.top-t.top;!this.cropped||this.disabled||(j(this.viewBoxImage,M({width:n,height:s},ct(M({translateX:-d,translateY:-l},t)))),S(this.previews,function(h){var c=St(h,dt),f=c.width,w=c.height,g=f,C=w,b=1;o&&(b=f/o,C=r*b),r&&C>w&&(b=w/r,g=o*b,C=w),j(h,{width:g,height:C}),j(h.getElementsByTagName("img")[0],M({width:n*b,height:s*b},ct(M({translateX:-d*b,translateY:-l*b},t))))}))}},gi={bind:function(){var t=this.element,i=this.options,e=this.cropper;B(i.cropstart)&&z(t,Ot,i.cropstart),B(i.cropmove)&&z(t,Nt,i.cropmove),B(i.cropend)&&z(t,Tt,i.cropend),B(i.crop)&&z(t,Mt,i.crop),B(i.zoom)&&z(t,At,i.zoom),z(e,Kt,this.onCropStart=this.cropStart.bind(this)),i.zoomable&&i.zoomOnWheel&&z(e,te,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&z(e,Gt,this.onDblclick=this.dblclick.bind(this)),z(t.ownerDocument,qt,this.onCropMove=this.cropMove.bind(this)),z(t.ownerDocument,Qt,this.onCropEnd=this.cropEnd.bind(this)),i.responsive&&z(window,Jt,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.options,e=this.cropper;B(i.cropstart)&&H(t,Ot,i.cropstart),B(i.cropmove)&&H(t,Nt,i.cropmove),B(i.cropend)&&H(t,Tt,i.cropend),B(i.crop)&&H(t,Mt,i.crop),B(i.zoom)&&H(t,At,i.zoom),H(e,Kt,this.onCropStart),i.zoomable&&i.zoomOnWheel&&H(e,te,this.onWheel,{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&H(e,Gt,this.onDblclick),H(t.ownerDocument,qt,this.onCropMove),H(t.ownerDocument,Qt,this.onCropEnd),i.responsive&&H(window,Jt,this.onResize)}},mi={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 s,d;t.restore&&(s=this.getCanvasData(),d=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(S(s,function(l,h){s[h]=l*n})),this.setCropBoxData(S(d,function(l,h){d[h]=l*n})))}}},dblclick:function(){this.disabled||this.options.dragMode===pe||this.setDragMode(Je(this.dragBox,Ct)?de:Bt)},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?S(t.changedTouches,function(s){r[s.identifier]=pt(s)}):r[t.pointerId||0]=pt(t),Object.keys(r).length>1&&o.zoomable&&o.zoomOnTouch?n=ue:n=St(t.target,lt),Ue.test(n)&&rt(this.element,Ot,{originalEvent:t,action:n})!==!1&&(t.preventDefault(),this.action=n,this.cropping=!1,n===le&&(this.cropping=!0,R(this.dragBox,gt)))}},cropMove:function(t){var i=this.action;if(!(this.disabled||!i)){var e=this.pointers;t.preventDefault(),rt(this.element,Nt,{originalEvent:t,action:i})!==!1&&(t.changedTouches?S(t.changedTouches,function(o){M(e[o.identifier]||{},pt(o,!0))}):M(e[t.pointerId||0]||{},pt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var i=this.action,e=this.pointers;t.changedTouches?S(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,it(this.dragBox,gt,this.cropped&&this.options.modal)),rt(this.element,Tt,{originalEvent:t,action:i}))}}},vi={change:function(t){var i=this.options,e=this.canvasData,o=this.containerData,r=this.cropBoxData,n=this.pointers,s=this.action,d=i.aspectRatio,l=r.left,h=r.top,c=r.width,f=r.height,w=l+c,g=h+f,C=0,b=0,O=o.width,A=o.height,T=!0,m;!d&&t.shiftKey&&(d=c&&f?c/f:1),this.limited&&(C=r.minLeft,b=r.minTop,O=C+Math.min(o.width,e.width,e.left+e.width),A=b+Math.min(o.height,e.height,e.top+e.height));var v=n[Object.keys(n)[0]],u={x:v.endX-v.startX,y:v.endY-v.startY},p=function(x){switch(x){case K:w+u.x>O&&(u.x=O-w);break;case q:l+u.x<C&&(u.x=C-l);break;case U:h+u.y<b&&(u.y=b-h);break;case tt:g+u.y>A&&(u.y=A-g);break}};switch(s){case Lt:l+=u.x,h+=u.y;break;case K:if(u.x>=0&&(w>=O||d&&(h<=b||g>=A))){T=!1;break}p(K),c+=u.x,c<0&&(s=q,c=-c,l-=c),d&&(f=c/d,h+=(r.height-f)/2);break;case U:if(u.y<=0&&(h<=b||d&&(l<=C||w>=O))){T=!1;break}p(U),f-=u.y,h+=u.y,f<0&&(s=tt,f=-f,h-=f),d&&(c=f*d,l+=(r.width-c)/2);break;case q:if(u.x<=0&&(l<=C||d&&(h<=b||g>=A))){T=!1;break}p(q),c-=u.x,l+=u.x,c<0&&(s=K,c=-c,l-=c),d&&(f=c/d,h+=(r.height-f)/2);break;case tt:if(u.y>=0&&(g>=A||d&&(l<=C||w>=O))){T=!1;break}p(tt),f+=u.y,f<0&&(s=U,f=-f,h-=f),d&&(c=f*d,l+=(r.width-c)/2);break;case nt:if(d){if(u.y<=0&&(h<=b||w>=O)){T=!1;break}p(U),f-=u.y,h+=u.y,c=f*d}else p(U),p(K),u.x>=0?w<O?c+=u.x:u.y<=0&&h<=b&&(T=!1):c+=u.x,u.y<=0?h>b&&(f-=u.y,h+=u.y):(f-=u.y,h+=u.y);c<0&&f<0?(s=ht,f=-f,c=-c,h-=f,l-=c):c<0?(s=ot,c=-c,l-=c):f<0&&(s=st,f=-f,h-=f);break;case ot:if(d){if(u.y<=0&&(h<=b||l<=C)){T=!1;break}p(U),f-=u.y,h+=u.y,c=f*d,l+=r.width-c}else p(U),p(q),u.x<=0?l>C?(c-=u.x,l+=u.x):u.y<=0&&h<=b&&(T=!1):(c-=u.x,l+=u.x),u.y<=0?h>b&&(f-=u.y,h+=u.y):(f-=u.y,h+=u.y);c<0&&f<0?(s=st,f=-f,c=-c,h-=f,l-=c):c<0?(s=nt,c=-c,l-=c):f<0&&(s=ht,f=-f,h-=f);break;case ht:if(d){if(u.x<=0&&(l<=C||g>=A)){T=!1;break}p(q),c-=u.x,l+=u.x,f=c/d}else p(tt),p(q),u.x<=0?l>C?(c-=u.x,l+=u.x):u.y>=0&&g>=A&&(T=!1):(c-=u.x,l+=u.x),u.y>=0?g<A&&(f+=u.y):f+=u.y;c<0&&f<0?(s=nt,f=-f,c=-c,h-=f,l-=c):c<0?(s=st,c=-c,l-=c):f<0&&(s=ot,f=-f,h-=f);break;case st:if(d){if(u.x>=0&&(w>=O||g>=A)){T=!1;break}p(K),c+=u.x,f=c/d}else p(tt),p(K),u.x>=0?w<O?c+=u.x:u.y>=0&&g>=A&&(T=!1):c+=u.x,u.y>=0?g<A&&(f+=u.y):f+=u.y;c<0&&f<0?(s=ot,f=-f,c=-c,h-=f,l-=c):c<0?(s=ht,c=-c,l-=c):f<0&&(s=nt,f=-f,h-=f);break;case fe:this.move(u.x,u.y),T=!1;break;case ue:this.zoom(ai(n),t),T=!1;break;case le:if(!u.x||!u.y){T=!1;break}m=be(this.cropper),l=v.startX-m.left,h=v.startY-m.top,c=r.minWidth,f=r.minHeight,u.x>0?s=u.y>0?st:nt:u.x<0&&(l-=c,s=u.y>0?ht:ot),u.y<0&&(h-=f),this.cropped||(Y(this.cropBox,I),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}T&&(r.width=c,r.height=f,r.left=l,r.top=h,this.action=s,this.renderCropBox()),S(n,function(D){D.startX=D.endX,D.startY=D.endY})}},yi={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&R(this.dragBox,gt),Y(this.cropBox,I),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=M({},this.initialImageData),this.canvasData=M({},this.initialCanvasData),this.cropBoxData=M({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(M(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Y(this.dragBox,gt),R(this.cropBox,I)),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,S(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,Y(this.cropper,Vt)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,R(this.cropper,Vt)),this},destroy:function(){var t=this.element;return t[E]?(t[E]=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(wt(t)?t:o+Number(t),wt(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,s=r.height,d=r.naturalWidth,l=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&o.zoomable){var h=d*t,c=l*t;if(rt(this.element,At,{ratio:t,oldRatio:n/d,originalEvent:e})===!1)return this;if(e){var f=this.pointers,w=be(this.cropper),g=f&&Object.keys(f).length?ri(f):{pageX:e.pageX,pageY:e.pageY};r.left-=(h-n)*((g.pageX-w.left-r.left)/n),r.top-=(c-s)*((g.pageY-w.top-r.top)/s)}else et(i)&&y(i.x)&&y(i.y)?(r.left-=(h-n)*((i.x-r.left)/n),r.top-=(c-s)*((i.y-r.top)/s)):(r.left-=(h-n)/2,r.top-=(c-s)/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),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 s=e.width/e.naturalWidth;if(S(n,function(h,c){n[c]=h/s}),t){var d=Math.round(n.y+n.height),l=Math.round(n.x+n.width);n.x=Math.round(n.x),n.y=Math.round(n.y),n.width=l-n.x,n.height=d-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&&et(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 s=e.width/e.naturalWidth;y(t.x)&&(r.left=t.x*s+o.left),y(t.y)&&(r.top=t.y*s+o.top),y(t.width)&&(r.width=t.width*s),y(t.height)&&(r.height=t.height*s),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?M({},this.containerData):{}},getImageData:function(){return this.sized?M({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,i={};return this.ready&&S(["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&&et(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&&et(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=oi(this.image,this.imageData,i,t);if(!this.cropped)return e;var o=this.getData(),r=o.x,n=o.y,s=o.width,d=o.height,l=e.width/Math.floor(i.naturalWidth);l!==1&&(r*=l,n*=l,s*=l,d*=l);var h=s/d,c=F({aspectRatio:h,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),f=F({aspectRatio:h,width:t.minWidth||0,height:t.minHeight||0},"cover"),w=F({aspectRatio:h,width:t.width||(l!==1?e.width:s),height:t.height||(l!==1?e.height:d)}),g=w.width,C=w.height;g=Math.min(c.width,Math.max(f.width,g)),C=Math.min(c.height,Math.max(f.height,C));var b=document.createElement("canvas"),O=b.getContext("2d");b.width=at(g),b.height=at(C),O.fillStyle=t.fillColor||"transparent",O.fillRect(0,0,g,C);var A=t.imageSmoothingEnabled,T=A===void 0?!0:A,m=t.imageSmoothingQuality;O.imageSmoothingEnabled=T,m&&(O.imageSmoothingQuality=m);var v=e.width,u=e.height,p=r,D=n,x,k,_,V,W,P;p<=-s||p>v?(p=0,x=0,_=0,W=0):p<=0?(_=-p,p=0,x=Math.min(v,s+p),W=x):p<=v&&(_=0,x=Math.min(s,v-p),W=x),x<=0||D<=-d||D>u?(D=0,k=0,V=0,P=0):D<=0?(V=-D,D=0,k=Math.min(u,d+D),P=k):D<=u&&(V=0,k=Math.min(d,u-D),P=k);var L=[p,D,x,k];if(W>0&&P>0){var $=g/s;L.push(_*$,V*$,W*$,P*$)}return O.drawImage.apply(O,[e].concat(ce(L.map(function(ut){return Math.floor(at(ut))})))),b},setAspectRatio:function(t){var i=this.options;return!this.disabled&&!wt(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===Bt,n=i.movable&&t===de;t=r||n?t:pe,i.dragMode=t,ft(e,lt,t),it(e,Ct,r),it(e,Et,n),i.cropBoxMovable||(ft(o,lt,t),it(o,Ct,r),it(o,Et,n))}return this}},wi=X.Cropper,De=function(){function a(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(ke(this,a),!t||!Ve.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=M({},ie,et(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 Le(a,[{key:"init",value:function(){var i=this.element,e=i.tagName.toLowerCase(),o;if(!i[E]){if(i[E]=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)){Fe.test(i)?this.read(ci(i)):this.clone();return}var n=new XMLHttpRequest,s=this.clone.bind(this);this.reloading=!0,this.xhr=n,n.onabort=s,n.onerror=s,n.ontimeout=s,n.onprogress=function(){n.getResponseHeader("content-type")!==ee&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},r.checkCrossOrigin&&re(i)&&o.crossOrigin&&(i=ne(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=fi(i),n=0,s=1,d=1;if(r>1){this.url=li(i,ee);var l=ui(r);n=l.rotate,s=l.scaleX,d=l.scaleY}e.rotatable&&(o.rotate=n),e.scalable&&(o.scaleX=s,o.scaleY=d),this.clone()}},{key:"clone",value:function(){var i=this.element,e=this.url,o=i.crossOrigin,r=e;this.options.checkCrossOrigin&&re(e)&&(o||(o="anonymous"),r=ne(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),R(n,$t),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=X.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(X.navigator.userAgent),r=function(l,h){M(i.imageData,{naturalWidth:l,naturalHeight:h,aspectRatio:l/h}),i.initialImageData=M({},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"),s=document.body||document.documentElement;this.sizingImage=n,n.onload=function(){r(n.width,n.height),o||s.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;",s.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=$e;var s=n.querySelector(".".concat(E,"-container")),d=s.querySelector(".".concat(E,"-canvas")),l=s.querySelector(".".concat(E,"-drag-box")),h=s.querySelector(".".concat(E,"-crop-box")),c=h.querySelector(".".concat(E,"-face"));this.container=r,this.cropper=s,this.canvas=d,this.dragBox=l,this.cropBox=h,this.viewBox=s.querySelector(".".concat(E,"-view-box")),this.face=c,d.appendChild(o),R(i,I),r.insertBefore(s,i.nextSibling),Y(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,R(h,I),e.guides||R(h.getElementsByClassName("".concat(E,"-dashed")),I),e.center||R(h.getElementsByClassName("".concat(E,"-center")),I),e.background&&R(s,"".concat(E,"-bg")),e.highlight||R(c,Pe),e.cropBoxMovable&&(R(c,Et),ft(c,lt,Lt)),e.cropBoxResizable||(R(h.getElementsByClassName("".concat(E,"-line")),I),R(h.getElementsByClassName("".concat(E,"-point")),I)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),B(e.ready)&&z(i,Zt,e.ready,{once:!0}),rt(i,Zt)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var i=this.cropper.parentNode;i&&i.removeChild(this.cropper),Y(this.element,I)}}},{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=wi,a}},{key:"setDefaults",value:function(i){M(ie,et(i)&&i)}}]),a}();M(De.prototype,di,pi,gi,mi,vi,yi);const bi=oe({name:"copper-image",emits:["close","cropperNo","cropperOk"],setup(a,{emit:t,expose:i}){const e=se({visible:!1,img:null,confirmLoading:!1,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"修改头像",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},myCropper:null}),o=Q(),r=l=>{const{options:h}=e;e.visible=!0,e.options=Object.assign({},h,l),Ne(()=>{n()})},n=()=>{e.myCropper=new De(o.value,{viewMode:1,dragMode:"move",aspectRatio:e.options.autoCropWidth/e.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},s=l=>{switch(l){case"left":e.myCropper.rotate(90);break;case"right":e.myCropper.rotate(-90);break;case"zoomIn":e.myCropper.zoom(.1);break;case"zoomOut":e.myCropper.zoom(-.1);break}},d=()=>{e.confirmLoading=!0,e.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob(l=>{console.log(l,"1212"),t("cropperOk",l),e.confirmLoading=!1})};return i({edit:r}),()=>N("div",null,[N(Te,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[N(Yt,null,{default:()=>[N("div",{style:"width: 100%; height: 300px"},[N("img",{ref:o,id:"myImages",src:e.options.img,alt:""},null)]),N(Xt,{justify:"center",style:{paddingTop:"12px"}},{default:()=>[N(Z,{type:"primary",size:"small",onClick:()=>s("left")},{default:()=>[G("逆时针旋转")]}),N(Z,{type:"primary",size:"small",onClick:()=>s("right")},{default:()=>[G("顺时针旋转")]}),N(Z,{type:"primary",size:"small",onClick:()=>s("zoomIn")},{default:()=>[G("放大")]}),N(Z,{type:"primary",size:"small",onClick:()=>s("zoomOut")},{default:()=>[G("缩小")]})]})]}),N(Yt,null,{default:()=>[N("span",{style:{fontSize:"15px",fontWeight:600,paddingBottom:"8px",display:"inline-block"}},[G("预览图片")]),N("div",{class:"before",style:{width:e.options.autoCropWidth+"px",height:e.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),N(Xt,{justify:"end"},{default:()=>[N(Z,{type:"default",onClick:()=>{e.confirmLoading=!1,t("close"),t("cropperNo")}},{default:()=>[G("取消")]}),N(Z,{type:"primary",loading:e.confirmLoading,onClick:d},{default:()=>[G("确认")]})]})])}}),Di=oe({name:"upload-file",props:{fileList:{type:String,default:""},imageList:{type:Array,default:()=>[]},accept:{type:String,default:".jpg,.png,.jpeg,.gif"},listType:{type:String,default:"image-card"},showType:{type:String,default:"default"},showFileList:{type:Boolean,default:!0},text:{type:String,default:"上传文件"},size:{type:Number,default:5},max:{type:Number,default:1},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},tips:{type:String,default:""},bucketName:{type:String,default:"gyt"},path:{type:String,default:""},fileName:{type:String,default:""},cropper:{type:Boolean,default:!1},options:{type:Object,default:()=>({viewMode:0,autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!1,previewsCircle:!0,title:"上传图片"})}},emits:["update:fileList","close","readFileInputEventAsArrayBuffer","remove"],setup(a,{emit:t,expose:i,slots:e}){const o="https://".concat(a.bucketName,".ks3-cn-beijing.ksyuncs.com/"),r=Oe(),n=Q(!1),s=Q(!1),d=Q(),l=Q(),h=se({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),c=Q([]),f=()=>{if(a.fileList){const m=a.fileList.split("/");c.value=[{id:new Date().getTime().toString(),name:m[m.length-1],status:"finished",url:a.fileList}]}else if(Array.isArray(a.imageList)){const m=[];a.imageList.forEach(v=>{const u=v.split("/");m.push({id:Date.now().toString(),name:u[u.length-1],status:"finished",url:v})}),c.value=m}else c.value=[]};f(),Wt(()=>a.imageList,()=>{f()}),Wt(()=>a.fileList,()=>{console.log("list"),f()}),i({handleClearFile:()=>{var m;(m=l.value)==null||m.clear(),console.log("清空",l.value)}});const g=Q(),C=async m=>{const v=m.file;let u=!0;if(a.size&&(u=v.file.size/1024/1024<a.size,!u))return r.error("文件大小不能超过".concat(a.size,"M")),!1;if(!u)return u;if(a.cropper)return b(v.file,p=>{const D=Object.assign({},a.options,{img:p,name:v.file.name});n.value=!0,setTimeout(()=>{var x;(x=g.value)==null||x.edit(D),console.log(g.value,"cropper")},100)}),!1;try{s.value=!0,console.log(a.path,v.file);const p=v.file.name,D=p.slice(p.lastIndexOf(".")),x="".concat(a.path).concat(a.fileName||Date.now()+D),k={filename:x,bucketName:a.bucketName,postData:{filename:x,acl:"public-read",key:x,unknowValueField:[]}},{data:_}=await Ut(k);h.policy=_.policy,h.signature=_.signature,h.key=x,h.KSSAccessKeyId=_.kssAccessKeyId,h.name=x,d.value=v.file}catch(p){return s.value=!1,!1}return!0},b=async(m,v)=>{const u=new FileReader;u.addEventListener("load",()=>v(u.result)),u.readAsDataURL(m)},O=m=>{const v=o+h.key;console.log(v,"url"),t("update:fileList",v),t("readFileInputEventAsArrayBuffer",d.value),m.file.url=v,n.value=!1,s.value=!1},A=async m=>{console.log("🚀 ~ options",m),t("update:fileList",""),t("remove"),s.value=!1},T=async m=>{try{const v="".concat(a.path).concat(a.fileName||new Date().getTime()+".png"),u={filename:v,bucketName:a.bucketName,postData:{filename:v,acl:"public-read",key:v,unknowValueField:[]}},{data:p}=await Ut(u);h.policy=p.policy,h.signature=p.signature,h.key=v,h.KSSAccessKeyId=p.kssAccessKeyId,h.name=v;const D=new FormData;for(const x in h)D.append(x,h[x]);D.append("file",m),await Re.post(o,D).then(()=>{const x=o+h.key;console.log(x,"url");const k=x.split("/");c.value=[{id:new Date().getTime().toString(),name:k[k.length-1],status:"finished",url:x}],t("update:fileList",x),n.value=!1})}catch(v){return!1}};return()=>N("div",null,[N(Ae,{ref:l,action:o,data:h,fileList:c.value,"onUpdate:fileList":m=>c.value=m,listType:a.listType,accept:a.accept,multiple:a.multiple,max:a.max,disabled:a.disabled,showFileList:a.showFileList,showPreviewButton:!0,onBeforeUpload:m=>C(m),onFinish:m=>O(m),onRemove:m=>A(m)},{default:()=>[a.showType==="default"&&a.listType==="image"&&N(Z,{loading:s.value,type:"primary"},{default:()=>[a.text]}),a.showType==="custom"&&e.custom&&e.custom()]}),a.tips&&N("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[a.tips]),N(Se,{show:n.value,"onUpdate:show":m=>n.value=m,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[N(bi,{ref:g,onClose:()=>n.value=!1,onCropperOk:T},null)]})])}});export{Di as U,Ut as p};
|