12345678910 |
- var Se=Object.defineProperty,Re=Object.defineProperties;var Le=Object.getOwnPropertyDescriptors;var Xt=Object.getOwnPropertySymbols;var ke=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable;var Wt=(a,t,i)=>t in a?Se(a,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):a[t]=i,Ut=(a,t)=>{for(var i in t||(t={}))ke.call(t,i)&&Wt(a,i,t[i]);if(Xt)for(var i of Xt(t))Be.call(t,i)&&Wt(a,i,t[i]);return a},jt=(a,t)=>Re(a,Le(t));var nt=(a,t,i)=>new Promise((e,o)=>{var r=u=>{try{s(i.next(u))}catch(f){o(f)}},n=u=>{try{s(i.throw(u))}catch(f){o(f)}},s=u=>u.done?e(u.value):Promise.resolve(u.value).then(r,n);s((i=i.apply(a,t)).next())});import{d as fe,a as ue,r as Q,i as T,ac as Ie,ad as Vt,a9 as Ft,p as Z,k as G,U as ze,u as _e,M as $t,cd as Pe,aa as He}from"./index.7b408720.js";import{g as Gt,o as Ye,a as Xe}from"./oss-file-upload.7ec777f5.js";/*!
- * 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 qt(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 de(a){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?qt(Object(i),!0).forEach(function(e){je(a,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):qt(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))})}return a}function Dt(a){return Dt=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},Dt(a)}function We(a,t){if(!(a instanceof t))throw new TypeError("Cannot call a class as a function")}function Kt(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 Ue(a,t,i){return t&&Kt(a.prototype,t),i&&Kt(a,i),Object.defineProperty(a,"prototype",{writable:!1}),a}function je(a,t,i){return t in a?Object.defineProperty(a,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):a[t]=i,a}function pe(a){return Ve(a)||Fe(a)||$e(a)||Ge()}function Ve(a){if(Array.isArray(a))return Ct(a)}function Fe(a){if(typeof Symbol!="undefined"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function $e(a,t){if(!!a){if(typeof a=="string")return Ct(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 Ct(a,t)}}function Ct(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 Ge(){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 vt=typeof window!="undefined"&&typeof window.document!="undefined",U=vt?window:{},Lt=vt&&U.document.documentElement?"ontouchstart"in U.document.documentElement:!1,kt=vt?"PointerEvent"in U:!1,D="cropper",Bt="all",ge="crop",me="move",ve="zoom",q="e",K="w",tt="s",j="n",ot="ne",st="nw",ht="se",ct="sw",Mt="".concat(D,"-crop"),Qt="".concat(D,"-disabled"),I="".concat(D,"-hidden"),Zt="".concat(D,"-hide"),qe="".concat(D,"-invisible"),mt="".concat(D,"-modal"),Et="".concat(D,"-move"),ft="".concat(D,"Action"),pt="".concat(D,"Preview"),It="crop",ye="move",we="none",Tt="crop",Nt="cropend",Ot="cropmove",At="cropstart",Jt="dblclick",Ke=Lt?"touchstart":"mousedown",Qe=Lt?"touchmove":"mousemove",Ze=Lt?"touchend touchcancel":"mouseup",te=kt?"pointerdown":Ke,ee=kt?"pointermove":Qe,ie=kt?"pointerup pointercancel":Ze,ae="ready",re="resize",ne="wheel",St="zoom",oe="image/jpeg",Je=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,ti=/^data:/,ei=/^data:image\/jpeg;base64,/,ii=/^img|canvas$/i,be=200,xe=100,se={viewMode:0,dragMode:It,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:be,minContainerHeight:xe,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ai='<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>',ri=Number.isNaN||U.isNaN;function v(a){return typeof a=="number"&&!ri(a)}var he=function(t){return t>0&&t<1/0};function bt(a){return typeof a=="undefined"}function J(a){return Dt(a)==="object"&&a!==null}var ni=Object.prototype.hasOwnProperty;function et(a){if(!J(a))return!1;try{var t=a.constructor,i=t.prototype;return t&&i&&ni.call(i,"isPrototypeOf")}catch(e){return!1}}function B(a){return typeof a=="function"}var oi=Array.prototype.slice;function De(a){return Array.from?Array.from(a):oi.call(a)}function A(a,t){return a&&B(t)&&(Array.isArray(a)||v(a.length)?De(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 C=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},si=/\.\d*(?:0|9){12}\d*$/;function at(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return si.test(a)?Math.round(a*t)/t:a}var hi=/^width|height|left|top|marginLeft|marginTop$/;function V(a,t){var i=a.style;A(t,function(e,o){hi.test(o)&&v(e)&&(e="".concat(e,"px")),i[o]=e})}function ci(a,t){return a.classList?a.classList.contains(t):a.className.indexOf(t)>-1}function S(a,t){if(!!t){if(v(a.length)){A(a,function(e){S(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 W(a,t){if(!!t){if(v(a.length)){A(a,function(i){W(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(v(a.length)){A(a,function(e){it(e,t,i)});return}i?S(a,t):W(a,t)}}var li=/([a-z\d])([A-Z])/g;function zt(a){return a.replace(li,"$1-$2").toLowerCase()}function Rt(a,t){return J(a[t])?a[t]:a.dataset?a.dataset[t]:a.getAttribute("data-".concat(zt(t)))}function ut(a,t,i){J(i)?a[t]=i:a.dataset?a.dataset[t]=i:a.setAttribute("data-".concat(zt(t)),i)}function fi(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(zt(t)))}var Ce=/\s\s*/,Me=function(){var a=!1;if(vt){var t=!1,i=function(){},e=Object.defineProperty({},"once",{get:function(){return a=!0,t},set:function(r){t=r}});U.addEventListener("test",i,e),U.removeEventListener("test",i,e)}return a}();function Y(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(Ce).forEach(function(r){if(!Me){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 P(a,t,i){var e=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=i;t.trim().split(Ce).forEach(function(r){if(e.once&&!Me){var n=a.listeners,s=n===void 0?{}:n;o=function(){delete s[r][i],a.removeEventListener(r,o,e);for(var f=arguments.length,c=new Array(f),h=0;h<f;h++)c[h]=arguments[h];i.apply(a,c)},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 Ee(a){var t=a.getBoundingClientRect();return{left:t.left+(window.pageXOffset-document.documentElement.clientLeft),top:t.top+(window.pageYOffset-document.documentElement.clientTop)}}var xt=U.location,ui=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function ce(a){var t=a.match(ui);return t!==null&&(t[1]!==xt.protocol||t[2]!==xt.hostname||t[3]!==xt.port)}function le(a){var t="timestamp=".concat(new Date().getTime());return a+(a.indexOf("?")===-1?"?":"&")+t}function lt(a){var t=a.rotate,i=a.scaleX,e=a.scaleY,o=a.translateX,r=a.translateY,n=[];v(o)&&o!==0&&n.push("translateX(".concat(o,"px)")),v(r)&&r!==0&&n.push("translateY(".concat(r,"px)")),v(t)&&t!==0&&n.push("rotate(".concat(t,"deg)")),v(i)&&i!==1&&n.push("scaleX(".concat(i,")")),v(e)&&e!==1&&n.push("scaleY(".concat(e,")"));var s=n.length?n.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function di(a){var t=de({},a),i=0;return A(a,function(e,o){delete t[o],A(t,function(r){var n=Math.abs(e.startX-r.startX),s=Math.abs(e.startY-r.startY),u=Math.abs(e.endX-r.endX),f=Math.abs(e.endY-r.endY),c=Math.sqrt(n*n+s*s),h=Math.sqrt(u*u+f*f),d=(h-c)/c;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:de({startX:i,startY:e},o)}function pi(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 F(a){var t=a.aspectRatio,i=a.height,e=a.width,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",r=he(e),n=he(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 gi(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,u=t*r+i*n;return e>90?{width:u,height:s}:{width:s,height:u}}function mi(a,t,i,e){var o=t.aspectRatio,r=t.naturalWidth,n=t.naturalHeight,s=t.rotate,u=s===void 0?0:s,f=t.scaleX,c=f===void 0?1:f,h=t.scaleY,d=h===void 0?1:h,g=i.aspectRatio,m=i.naturalWidth,b=i.naturalHeight,w=e.fillColor,N=w===void 0?"transparent":w,O=e.imageSmoothingEnabled,E=O===void 0?!0:O,H=e.imageSmoothingQuality,L=H===void 0?"low":H,l=e.maxWidth,p=l===void 0?1/0:l,y=e.maxHeight,x=y===void 0?1/0:y,R=e.minWidth,M=R===void 0?0:R,z=e.minHeight,_=z===void 0?0:z,X=document.createElement("canvas"),k=X.getContext("2d"),$=F({aspectRatio:g,width:p,height:x}),dt=F({aspectRatio:g,width:M,height:_},"cover"),yt=Math.min($.width,Math.max(dt.width,m)),wt=Math.min($.height,Math.max(dt.height,b)),_t=F({aspectRatio:o,width:p,height:x}),Pt=F({aspectRatio:o,width:M,height:_},"cover"),Ht=Math.min(_t.width,Math.max(Pt.width,r)),Yt=Math.min(_t.height,Math.max(Pt.height,n)),Oe=[-Ht/2,-Yt/2,Ht,Yt];return X.width=at(yt),X.height=at(wt),k.fillStyle=N,k.fillRect(0,0,yt,wt),k.save(),k.translate(yt/2,wt/2),k.rotate(u*Math.PI/180),k.scale(c,d),k.imageSmoothingEnabled=E,k.imageSmoothingQuality=L,k.drawImage.apply(k,[a].concat(pe(Oe.map(function(Ae){return Math.floor(at(Ae))})))),k.restore(),X}var Te=String.fromCharCode;function vi(a,t,i){var e="";i+=t;for(var o=t;o<i;o+=1)e+=Te(a.getUint8(o));return e}var yi=/^data:.*,/;function wi(a){var t=a.replace(yi,""),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 bi(a,t){for(var i=[],e=8192,o=new Uint8Array(a);o.length>0;)i.push(Te.apply(null,De(o.subarray(0,e)))),o=o.subarray(e);return"data:".concat(t,";base64,").concat(btoa(i.join("")))}function xi(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 u=o+4,f=o+10;if(vi(t,u,4)==="Exif"){var c=t.getUint16(f);if(e=c===18761,(e||c===19789)&&t.getUint16(f+2,e)===42){var h=t.getUint32(f+4,e);h>=8&&(r=f+h)}}}if(r){var d=t.getUint16(r,e),g,m;for(m=0;m<d;m+=1)if(g=r+m*12+2,t.getUint16(g,e)===274){g+=8,i=t.getUint16(g,e),t.setUint16(g,1,e);break}}}catch(b){i=1}return i}function Di(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 Ci={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);S(o,I),W(t,I);var s={width:Math.max(e.offsetWidth,r>=0?r:be),height:Math.max(e.offsetHeight,n>=0?n:xe)};this.containerData=s,V(o,{width:s.width,height:s.height}),S(t,I),W(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,u=t.width,f=t.height;t.height*s>t.width?e===3?u=t.height*s:f=t.width/s:e===3?f=t.width/s:u=t.height*s;var c={aspectRatio:s,naturalWidth:r,naturalHeight:n,width:u,height:f};this.canvasData=c,this.limited=e===1||e===2,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=C({},c)},limitCanvas:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,s=e.viewMode,u=r.aspectRatio,f=this.cropped&&n;if(t){var c=Number(e.minCanvasWidth)||0,h=Number(e.minCanvasHeight)||0;s>1?(c=Math.max(c,o.width),h=Math.max(h,o.height),s===3&&(h*u>c?c=h*u:h=c/u)):s>0&&(c?c=Math.max(c,f?n.width:0):h?h=Math.max(h,f?n.height:0):f&&(c=n.width,h=n.height,h*u>c?c=h*u:h=c/u));var d=F({aspectRatio:u,width:c,height:h});c=d.width,h=d.height,r.minWidth=c,r.minHeight=h,r.maxWidth=1/0,r.maxHeight=1/0}if(i)if(s>(f?0:1)){var g=o.width-r.width,m=o.height-r.height;r.minLeft=Math.min(0,g),r.minTop=Math.min(0,m),r.maxLeft=Math.max(0,g),r.maxTop=Math.max(0,m),f&&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,g),r.maxLeft=Math.max(0,g)),r.height>=o.height&&(r.minTop=Math.min(0,m),r.maxTop=Math.max(0,m))))}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=gi({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,u=e.width*(n/e.naturalWidth),f=e.height*(s/e.naturalHeight);e.left-=(u-e.width)/2,e.top-=(f-e.height)/2,e.width=u,e.height=f,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,V(this.canvas,C({width:e.width,height:e.height},lt({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);C(e,{width:o,height:r,left:(i.width-o)/2,top:(i.height-r)/2}),V(this.image,C({width:e.width,height:e.height},lt(C({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=C({},r)},limitCropBox:function(t,i){var e=this.options,o=this.containerData,r=this.canvasData,n=this.cropBoxData,s=this.limited,u=e.aspectRatio;if(t){var f=Number(e.minCropBoxWidth)||0,c=Number(e.minCropBoxHeight)||0,h=s?Math.min(o.width,r.width,r.width+r.left,o.width-r.left):o.width,d=s?Math.min(o.height,r.height,r.height+r.top,o.height-r.top):o.height;f=Math.min(f,o.width),c=Math.min(c,o.height),u&&(f&&c?c*u>f?c=f/u:f=c*u:f?c=f/u:c&&(f=c*u),d*u>h?d=h/u:h=d*u),n.minWidth=Math.min(f,h),n.minHeight=Math.min(c,d),n.maxWidth=h,n.maxHeight=d}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&&ut(this.face,ft,e.width>=i.width&&e.height>=i.height?me:Bt),V(this.cropBox,C({width:e.width,height:e.height},lt({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,Tt,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",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,A(s,function(u){var f=document.createElement("img");ut(u,pt,{width:u.offsetWidth,height:u.offsetHeight,html:u.innerHTML}),i&&(f.crossOrigin=i),f.src=o,f.alt=r,f.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;"',u.innerHTML="",u.appendChild(f)})}},resetPreview:function(){A(this.previews,function(t){var i=Rt(t,pt);V(t,{width:i.width,height:i.height}),t.innerHTML=i.html,fi(t,pt)})},preview:function(){var t=this.imageData,i=this.canvasData,e=this.cropBoxData,o=e.width,r=e.height,n=t.width,s=t.height,u=e.left-i.left-t.left,f=e.top-i.top-t.top;!this.cropped||this.disabled||(V(this.viewBoxImage,C({width:n,height:s},lt(C({translateX:-u,translateY:-f},t)))),A(this.previews,function(c){var h=Rt(c,pt),d=h.width,g=h.height,m=d,b=g,w=1;o&&(w=d/o,b=r*w),r&&b>g&&(w=g/r,m=o*w,b=g),V(c,{width:m,height:b}),V(c.getElementsByTagName("img")[0],C({width:n*w,height:s*w},lt(C({translateX:-u*w,translateY:-f*w},t))))}))}},Ei={bind:function(){var t=this.element,i=this.options,e=this.cropper;B(i.cropstart)&&P(t,At,i.cropstart),B(i.cropmove)&&P(t,Ot,i.cropmove),B(i.cropend)&&P(t,Nt,i.cropend),B(i.crop)&&P(t,Tt,i.crop),B(i.zoom)&&P(t,St,i.zoom),P(e,te,this.onCropStart=this.cropStart.bind(this)),i.zoomable&&i.zoomOnWheel&&P(e,ne,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&P(e,Jt,this.onDblclick=this.dblclick.bind(this)),P(t.ownerDocument,ee,this.onCropMove=this.cropMove.bind(this)),P(t.ownerDocument,ie,this.onCropEnd=this.cropEnd.bind(this)),i.responsive&&P(window,re,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.options,e=this.cropper;B(i.cropstart)&&Y(t,At,i.cropstart),B(i.cropmove)&&Y(t,Ot,i.cropmove),B(i.cropend)&&Y(t,Nt,i.cropend),B(i.crop)&&Y(t,Tt,i.crop),B(i.zoom)&&Y(t,St,i.zoom),Y(e,te,this.onCropStart),i.zoomable&&i.zoomOnWheel&&Y(e,ne,this.onWheel,{passive:!1,capture:!0}),i.toggleDragModeOnDblclick&&Y(e,Jt,this.onDblclick),Y(t.ownerDocument,ee,this.onCropMove),Y(t.ownerDocument,ie,this.onCropEnd),i.responsive&&Y(window,re,this.onResize)}},Ti={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,u;t.restore&&(s=this.getCanvasData(),u=this.getCropBoxData()),this.render(),t.restore&&(this.setCanvasData(A(s,function(f,c){s[c]=f*n})),this.setCropBoxData(A(u,function(f,c){u[c]=f*n})))}}},dblclick:function(){this.disabled||this.options.dragMode===we||this.setDragMode(ci(this.dragBox,Mt)?ye:It)},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")&&(v(i)&&i!==1||v(e)&&e!==0||t.ctrlKey))){var o=this.options,r=this.pointers,n;t.changedTouches?A(t.changedTouches,function(s){r[s.identifier]=gt(s)}):r[t.pointerId||0]=gt(t),Object.keys(r).length>1&&o.zoomable&&o.zoomOnTouch?n=ve:n=Rt(t.target,ft),!!Je.test(n)&&rt(this.element,At,{originalEvent:t,action:n})!==!1&&(t.preventDefault(),this.action=n,this.cropping=!1,n===ge&&(this.cropping=!0,S(this.dragBox,mt)))}},cropMove:function(t){var i=this.action;if(!(this.disabled||!i)){var e=this.pointers;t.preventDefault(),rt(this.element,Ot,{originalEvent:t,action:i})!==!1&&(t.changedTouches?A(t.changedTouches,function(o){C(e[o.identifier]||{},gt(o,!0))}):C(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?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,it(this.dragBox,mt,this.cropped&&this.options.modal)),rt(this.element,Nt,{originalEvent:t,action:i}))}}},Ni={change:function(t){var i=this.options,e=this.canvasData,o=this.containerData,r=this.cropBoxData,n=this.pointers,s=this.action,u=i.aspectRatio,f=r.left,c=r.top,h=r.width,d=r.height,g=f+h,m=c+d,b=0,w=0,N=o.width,O=o.height,E=!0,H;!u&&t.shiftKey&&(u=h&&d?h/d:1),this.limited&&(b=r.minLeft,w=r.minTop,N=b+Math.min(o.width,e.width,e.left+e.width),O=w+Math.min(o.height,e.height,e.top+e.height));var L=n[Object.keys(n)[0]],l={x:L.endX-L.startX,y:L.endY-L.startY},p=function(x){switch(x){case q:g+l.x>N&&(l.x=N-g);break;case K:f+l.x<b&&(l.x=b-f);break;case j:c+l.y<w&&(l.y=w-c);break;case tt:m+l.y>O&&(l.y=O-m);break}};switch(s){case Bt:f+=l.x,c+=l.y;break;case q:if(l.x>=0&&(g>=N||u&&(c<=w||m>=O))){E=!1;break}p(q),h+=l.x,h<0&&(s=K,h=-h,f-=h),u&&(d=h/u,c+=(r.height-d)/2);break;case j:if(l.y<=0&&(c<=w||u&&(f<=b||g>=N))){E=!1;break}p(j),d-=l.y,c+=l.y,d<0&&(s=tt,d=-d,c-=d),u&&(h=d*u,f+=(r.width-h)/2);break;case K:if(l.x<=0&&(f<=b||u&&(c<=w||m>=O))){E=!1;break}p(K),h-=l.x,f+=l.x,h<0&&(s=q,h=-h,f-=h),u&&(d=h/u,c+=(r.height-d)/2);break;case tt:if(l.y>=0&&(m>=O||u&&(f<=b||g>=N))){E=!1;break}p(tt),d+=l.y,d<0&&(s=j,d=-d,c-=d),u&&(h=d*u,f+=(r.width-h)/2);break;case ot:if(u){if(l.y<=0&&(c<=w||g>=N)){E=!1;break}p(j),d-=l.y,c+=l.y,h=d*u}else p(j),p(q),l.x>=0?g<N?h+=l.x:l.y<=0&&c<=w&&(E=!1):h+=l.x,l.y<=0?c>w&&(d-=l.y,c+=l.y):(d-=l.y,c+=l.y);h<0&&d<0?(s=ct,d=-d,h=-h,c-=d,f-=h):h<0?(s=st,h=-h,f-=h):d<0&&(s=ht,d=-d,c-=d);break;case st:if(u){if(l.y<=0&&(c<=w||f<=b)){E=!1;break}p(j),d-=l.y,c+=l.y,h=d*u,f+=r.width-h}else p(j),p(K),l.x<=0?f>b?(h-=l.x,f+=l.x):l.y<=0&&c<=w&&(E=!1):(h-=l.x,f+=l.x),l.y<=0?c>w&&(d-=l.y,c+=l.y):(d-=l.y,c+=l.y);h<0&&d<0?(s=ht,d=-d,h=-h,c-=d,f-=h):h<0?(s=ot,h=-h,f-=h):d<0&&(s=ct,d=-d,c-=d);break;case ct:if(u){if(l.x<=0&&(f<=b||m>=O)){E=!1;break}p(K),h-=l.x,f+=l.x,d=h/u}else p(tt),p(K),l.x<=0?f>b?(h-=l.x,f+=l.x):l.y>=0&&m>=O&&(E=!1):(h-=l.x,f+=l.x),l.y>=0?m<O&&(d+=l.y):d+=l.y;h<0&&d<0?(s=ot,d=-d,h=-h,c-=d,f-=h):h<0?(s=ht,h=-h,f-=h):d<0&&(s=st,d=-d,c-=d);break;case ht:if(u){if(l.x>=0&&(g>=N||m>=O)){E=!1;break}p(q),h+=l.x,d=h/u}else p(tt),p(q),l.x>=0?g<N?h+=l.x:l.y>=0&&m>=O&&(E=!1):h+=l.x,l.y>=0?m<O&&(d+=l.y):d+=l.y;h<0&&d<0?(s=st,d=-d,h=-h,c-=d,f-=h):h<0?(s=ct,h=-h,f-=h):d<0&&(s=ot,d=-d,c-=d);break;case me:this.move(l.x,l.y),E=!1;break;case ve:this.zoom(di(n),t),E=!1;break;case ge:if(!l.x||!l.y){E=!1;break}H=Ee(this.cropper),f=L.startX-H.left,c=L.startY-H.top,h=r.minWidth,d=r.minHeight,l.x>0?s=l.y>0?ht:ot:l.x<0&&(f-=h,s=l.y>0?ct:st),l.y<0&&(c-=d),this.cropped||(W(this.cropBox,I),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}E&&(r.width=h,r.height=d,r.left=f,r.top=c,this.action=s,this.renderCropBox()),A(n,function(y){y.startX=y.endX,y.startY=y.endY})}},Oi={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&S(this.dragBox,mt),W(this.cropBox,I),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=C({},this.initialImageData),this.canvasData=C({},this.initialCanvasData),this.cropBoxData=C({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(C(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),W(this.dragBox,mt),S(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,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,W(this.cropper,Qt)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,S(this.cropper,Qt)),this},destroy:function(){var t=this.element;return t[D]?(t[D]=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(bt(t)?t:o+Number(t),bt(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&&(v(t)&&(e.left=t,o=!0),v(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,u=r.naturalWidth,f=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&o.zoomable){var c=u*t,h=f*t;if(rt(this.element,St,{ratio:t,oldRatio:n/u,originalEvent:e})===!1)return this;if(e){var d=this.pointers,g=Ee(this.cropper),m=d&&Object.keys(d).length?pi(d):{pageX:e.pageX,pageY:e.pageY};r.left-=(c-n)*((m.pageX-g.left-r.left)/n),r.top-=(h-s)*((m.pageY-g.top-r.top)/s)}else et(i)&&v(i.x)&&v(i.y)?(r.left-=(c-n)*((i.x-r.left)/n),r.top-=(h-s)*((i.y-r.top)/s)):(r.left-=(c-n)/2,r.top-=(h-s)/2);r.width=c,r.height=h,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),v(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,v(i)?i:1)},scaleY:function(t){var i=this.imageData.scaleX;return this.scale(v(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&&(v(t)&&(e.scaleX=t,o=!0),v(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(A(n,function(c,h){n[h]=c/s}),t){var u=Math.round(n.y+n.height),f=Math.round(n.x+n.width);n.x=Math.round(n.x),n.y=Math.round(n.y),n.width=f-n.x,n.height=u-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&&v(t.rotate)&&t.rotate!==e.rotate&&(e.rotate=t.rotate,n=!0),i.scalable&&(v(t.scaleX)&&t.scaleX!==e.scaleX&&(e.scaleX=t.scaleX,n=!0),v(t.scaleY)&&t.scaleY!==e.scaleY&&(e.scaleY=t.scaleY,n=!0)),n&&this.renderCanvas(!0,!0);var s=e.width/e.naturalWidth;v(t.x)&&(r.left=t.x*s+o.left),v(t.y)&&(r.top=t.y*s+o.top),v(t.width)&&(r.width=t.width*s),v(t.height)&&(r.height=t.height*s),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?C({},this.containerData):{}},getImageData:function(){return this.sized?C({},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&&et(t)&&(v(t.left)&&(i.left=t.left),v(t.top)&&(i.top=t.top),v(t.width)?(i.width=t.width,i.height=t.width/e):v(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)&&(v(t.left)&&(i.left=t.left),v(t.top)&&(i.top=t.top),v(t.width)&&t.width!==i.width&&(o=!0,i.width=t.width),v(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=mi(this.image,this.imageData,i,t);if(!this.cropped)return e;var o=this.getData(),r=o.x,n=o.y,s=o.width,u=o.height,f=e.width/Math.floor(i.naturalWidth);f!==1&&(r*=f,n*=f,s*=f,u*=f);var c=s/u,h=F({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=F({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),g=F({aspectRatio:c,width:t.width||(f!==1?e.width:s),height:t.height||(f!==1?e.height:u)}),m=g.width,b=g.height;m=Math.min(h.width,Math.max(d.width,m)),b=Math.min(h.height,Math.max(d.height,b));var w=document.createElement("canvas"),N=w.getContext("2d");w.width=at(m),w.height=at(b),N.fillStyle=t.fillColor||"transparent",N.fillRect(0,0,m,b);var O=t.imageSmoothingEnabled,E=O===void 0?!0:O,H=t.imageSmoothingQuality;N.imageSmoothingEnabled=E,H&&(N.imageSmoothingQuality=H);var L=e.width,l=e.height,p=r,y=n,x,R,M,z,_,X;p<=-s||p>L?(p=0,x=0,M=0,_=0):p<=0?(M=-p,p=0,x=Math.min(L,s+p),_=x):p<=L&&(M=0,x=Math.min(s,L-p),_=x),x<=0||y<=-u||y>l?(y=0,R=0,z=0,X=0):y<=0?(z=-y,y=0,R=Math.min(l,u+y),X=R):y<=l&&(z=0,R=Math.min(u,l-y),X=R);var k=[p,y,x,R];if(_>0&&X>0){var $=m/s;k.push(M*$,z*$,_*$,X*$)}return N.drawImage.apply(N,[e].concat(pe(k.map(function(dt){return Math.floor(at(dt))})))),w},setAspectRatio:function(t){var i=this.options;return!this.disabled&&!bt(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===It,n=i.movable&&t===ye;t=r||n?t:we,i.dragMode=t,ut(e,ft,t),it(e,Mt,r),it(e,Et,n),i.cropBoxMovable||(ut(o,ft,t),it(o,Mt,r),it(o,Et,n))}return this}},Ai=U.Cropper,Ne=function(){function a(t){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(We(this,a),!t||!ii.test(t.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=t,this.options=C({},se,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 Ue(a,[{key:"init",value:function(){var i=this.element,e=i.tagName.toLowerCase(),o;if(!i[D]){if(i[D]=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(ti.test(i)){ei.test(i)?this.read(wi(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")!==oe&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},r.checkCrossOrigin&&ce(i)&&o.crossOrigin&&(i=le(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=xi(i),n=0,s=1,u=1;if(r>1){this.url=bi(i,oe);var f=Di(r);n=f.rotate,s=f.scaleX,u=f.scaleY}e.rotatable&&(o.rotate=n),e.scalable&&(o.scaleX=s,o.scaleY=u),this.clone()}},{key:"clone",value:function(){var i=this.element,e=this.url,o=i.crossOrigin,r=e;this.options.checkCrossOrigin&&ce(e)&&(o||(o="anonymous"),r=le(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),S(n,Zt),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=U.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(U.navigator.userAgent),r=function(f,c){C(i.imageData,{naturalWidth:f,naturalHeight:c,aspectRatio:f/c}),i.initialImageData=C({},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=ai;var s=n.querySelector(".".concat(D,"-container")),u=s.querySelector(".".concat(D,"-canvas")),f=s.querySelector(".".concat(D,"-drag-box")),c=s.querySelector(".".concat(D,"-crop-box")),h=c.querySelector(".".concat(D,"-face"));this.container=r,this.cropper=s,this.canvas=u,this.dragBox=f,this.cropBox=c,this.viewBox=s.querySelector(".".concat(D,"-view-box")),this.face=h,u.appendChild(o),S(i,I),r.insertBefore(s,i.nextSibling),W(o,Zt),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,S(c,I),e.guides||S(c.getElementsByClassName("".concat(D,"-dashed")),I),e.center||S(c.getElementsByClassName("".concat(D,"-center")),I),e.background&&S(s,"".concat(D,"-bg")),e.highlight||S(h,qe),e.cropBoxMovable&&(S(h,Et),ut(h,ft,Bt)),e.cropBoxResizable||(S(c.getElementsByClassName("".concat(D,"-line")),I),S(c.getElementsByClassName("".concat(D,"-point")),I)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),B(e.ready)&&P(i,ae,e.ready,{once:!0}),rt(i,ae)}}},{key:"unbuild",value:function(){if(!!this.ready){this.ready=!1,this.unbind(),this.resetPreview();var i=this.cropper.parentNode;i&&i.removeChild(this.cropper),W(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=Ai,a}},{key:"setDefaults",value:function(i){C(se,et(i)&&i)}}]),a}();C(Ne.prototype,Ci,Mi,Ei,Ti,Ni,Oi);const Si=fe({name:"copper",emits:["close","cropperNo","cropperOk"],setup(a,{slots:t,attrs:i,emit:e,expose:o}){const r=ue({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:"\u4FEE\u6539\u5934\u50CF",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},myCropper:null}),n=Q(),s=h=>{const{options:d}=r;r.visible=!0,r.options=Object.assign({},d,h),ze(()=>{u()})},u=()=>{r.myCropper=new Ne(n.value,{viewMode:1,dragMode:"move",aspectRatio:r.options.autoCropWidth/r.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},f=h=>{switch(h){case"left":r.myCropper.rotate(90);break;case"right":r.myCropper.rotate(-90);break;case"zoomIn":r.myCropper.zoom(.1);break;case"zoomOut":r.myCropper.zoom(-.1);break}},c=()=>{r.confirmLoading=!0,r.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob(h=>{e("cropperOk",h),r.confirmLoading=!1})};return o({edit:s}),()=>T("div",null,[T(Ie,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[T(Vt,null,{default:()=>[T("div",{style:"width: 100%; height: 300px"},[T("img",{ref:n,id:"myImages",src:r.options.img,alt:""},null)]),T(Ft,{justify:"end",style:{paddingTop:"12px"}},{default:()=>[T(Z,{type:"primary",size:"small",onClick:()=>f("left")},{default:()=>[G("\u9006\u65F6\u9488\u65CB\u8F6C")]}),T(Z,{type:"primary",size:"small",onClick:()=>f("right")},{default:()=>[G("\u987A\u65F6\u9488\u65CB\u8F6C")]}),T(Z,{type:"primary",size:"small",onClick:()=>f("zoomIn")},{default:()=>[G("\u653E\u5927")]}),T(Z,{type:"primary",size:"small",onClick:()=>f("zoomOut")},{default:()=>[G("\u7F29\u5C0F")]})]})]}),T(Vt,null,{default:()=>[T("span",{style:{fontSize:"15px",fontWeight:600,paddingBottom:"8px",display:"inline-block"}},[G("\u9884\u89C8\u56FE\u7247")]),T("div",{class:"before",style:{width:r.options.autoCropWidth+"px",height:r.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),T(Ft,{justify:"end"},{default:()=>[T(Z,{type:"default",onClick:()=>{r.confirmLoading=!1,e("close"),e("cropperNo")}},{default:()=>[G("\u53D6\u6D88")]}),T(Z,{type:"primary",loading:r.confirmLoading,onClick:c},{default:()=>[G("\u786E\u8BA4")]})]})])}}),Bi=fe({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"},showFileList:{type:Boolean,default:!0},desc:{type:String,default:""},text:{type:String,default:"\u4E0A\u4F20\u6587\u4EF6"},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:"\u4E0A\u4F20\u56FE\u7247"})}},emits:["update:fileList","upload:success","close","readFileInputEventAsArrayBuffer","remove"],setup(a,{slots:t,attrs:i,emit:e,expose:o}){const r=`https://${a.bucketName}.ks3-cn-beijing.ksyuncs.com/`,n=_e(),s=Q(!1),u=Q(!1),f=Q(),c=Q(),h=ue({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),d=Q([]),g=()=>{if(console.log("desc",a.desc),a.fileList){console.log("downloadUrl",a.fileList);const l=a.fileList.split("/");d.value=[{id:new Date().getTime().toString(),name:l[l.length-1],status:"finished",url:a.fileList}]}else if(Array.isArray(a.imageList)){console.log(Array.isArray(a.imageList),a.imageList,"Array.isArray(props.imageList)");let l=[];a.imageList.forEach(p=>{const y=p.split("/");l.push({id:Date.now().toString(),name:y[y.length-1],status:"finished",url:p})}),d.value=l}else d.value=[]};g(),$t(()=>a.imageList,()=>{g()},{deep:!0}),$t(()=>a.fileList,()=>{console.log("list"),g()}),o({handleClearFile:()=>{var l;(l=c.value)==null||l.clear(),console.log("\u6E05\u7A7A",c.value)}});const b=Q(),w=l=>nt(this,null,function*(){const p=l.file;let y=!0;if(a.size&&(y=p.file.size/1024/1024<a.size,!y))return n.error(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7${a.size}M`),!1;if(!y)return y;if(a.cropper)return N(p.file,x=>{const R=Object.assign({},a.options,{img:x,name:p.file.name});s.value=!0,setTimeout(()=>{var M;(M=b.value)==null||M.edit(R),console.log(b.value,"cropper")},100)}),!1;try{u.value=!0,console.log(a.path,p.file);const x=p.file.name,R=x.slice(x.lastIndexOf(".")),M=`${a.path}${a.fileName||Date.now()+R}`,z={filename:M,bucketName:a.bucketName,postData:{filename:M,acl:"public-read",key:M,unknowValueField:[]}},{data:_}=yield Gt(z);h.policy=_.policy,h.signature=_.signature,h.key=M,h.KSSAccessKeyId=_.kssAccessKeyId,h.name=M,f.value=p.file}catch(x){return u.value=!1,!1}return!0}),N=(l,p)=>nt(this,null,function*(){const y=new FileReader;y.addEventListener("load",()=>p(y.result)),y.readAsDataURL(l)}),O=({file:l,action:p,onFinish:y,onError:x,onProgress:R})=>{const M=h;M.file=l,Ye({file:l,action:p,data:M,onProgress:R,onFinish:y,onError:x})},E=l=>{e("update:fileList",l.file.url),e("upload:success",{url:l.file.url,name:l.file.name}),e("readFileInputEventAsArrayBuffer",f.value),s.value=!1,u.value=!1},H=l=>nt(this,null,function*(){console.log("\u{1F680} ~ options",l),e("update:fileList",""),e("upload:success",{}),e("remove"),u.value=!1}),L=l=>nt(this,null,function*(){try{const p=`${a.path}${a.fileName||new Date().getTime()+".png"}`,y={filename:p,bucketName:a.bucketName,postData:{filename:p,acl:"public-read",key:p,unknowValueField:[]}},{data:x}=yield Gt(y);h.policy=x.policy,h.signature=x.signature,h.key=p,h.KSSAccessKeyId=x.kssAccessKeyId,h.name=p;const R=jt(Ut({},h),{file:l});yield Xe(r,R).then(M=>{const z=M.split("/");d.value=[{id:new Date().getTime().toString(),name:z[z.length-1],status:"finished",url:M}],e("update:fileList",M),s.value=!1})}catch(p){return!1}});return()=>T("div",null,[T(Pe,{ref:c,action:r,customRequest:O,data:h,fileList:d.value,"onUpdate:fileList":l=>d.value=l,listType:a.listType,accept:a.accept,multiple:a.multiple,max:a.max,disabled:a.disabled,showFileList:a.showFileList,showPreviewButton:!0,onBeforeUpload:l=>w(l),onFinish:l=>E(l),onRemove:l=>H(l)},{default:()=>[a.listType==="image"&&T(Z,{loading:u.value,type:"primary"},{default:()=>[a.text]})]}),a.tips&&T("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[a.tips]),T(He,{show:s.value,"onUpdate:show":l=>s.value=l,preset:"dialog",showIcon:!1,title:"\u4E0A\u4F20\u56FE\u7247",style:{width:"800px"}},{default:()=>[T(Si,{ref:b,onClose:()=>s.value=!1,onCropperOk:L},null)]})])}});export{Bi as U};
|