12345678910 |
- System.register(["./index-legacy-35b1c5cd-1694675857467.js"],(function(t,e){"use strict";var i,a,o,n,r,s,h,c,l,p,d,u,m,g,f,v;return{setters:[t=>{i=t.B,a=t.d,o=t.e,n=t.r,r=t.f,s=t.cg,h=t.ch,c=t.w,l=t.j,p=t.k,d=t.E,u=t.b,m=t.y,g=t.C,f=t.v,v=t.dj}],execute:function(){var e=document.createElement("style");e.textContent='/*!\n * Cropper.js v1.5.13\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2022-11-20T05:30:43.444Z\n */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-wrap-box,.cropper-canvas,.cropper-drag-box,.cropper-crop-box,.cropper-modal{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-wrap-box,.cropper-canvas{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:calc(100% / 3);left:0;top:calc(100% / 3);width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:calc(100% / 3);top:0;width:calc(100% / 3)}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:before,.cropper-center:after{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-.15625vw;top:0;width:.36458333vw}.cropper-center:after{height:.36458333vw;left:0;top:-.15625vw;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-.15625vw;top:0;width:.26041667vw}.cropper-line.line-n{cursor:ns-resize;height:.26041667vw;left:0;top:-.15625vw}.cropper-line.line-w{cursor:ew-resize;left:-.15625vw;top:0;width:.26041667vw}.cropper-line.line-s{bottom:-.15625vw;cursor:ns-resize;height:.26041667vw;left:0}.cropper-point{background-color:#39f;height:.26041667vw;opacity:.75;width:.26041667vw}.cropper-point.point-e{cursor:ew-resize;margin-top:-.15625vw;right:-.15625vw;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-.15625vw;top:-.15625vw}.cropper-point.point-w{cursor:ew-resize;left:-.15625vw;margin-top:-.15625vw;top:50%}.cropper-point.point-s{bottom:-.15625vw;cursor:s-resize;left:50%;margin-left:-.15625vw}.cropper-point.point-ne{cursor:nesw-resize;right:-.15625vw;top:-.15625vw}.cropper-point.point-nw{cursor:nwse-resize;left:-.15625vw;top:-.15625vw}.cropper-point.point-sw{bottom:-.15625vw;cursor:nesw-resize;left:-.15625vw}.cropper-point.point-se{bottom:-.15625vw;cursor:nwse-resize;height:1.04166667vw;opacity:1;right:-.15625vw;width:1.04166667vw}@media (min-width: 768px){.cropper-point.point-se{height:.78125vw;width:.78125vw}}@media (min-width: 992px){.cropper-point.point-se{height:.52083333vw;width:.52083333vw}}@media (min-width: 1200px){.cropper-point.point-se{height:.26041667vw;opacity:.75;width:.26041667vw}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}\n',document.head.appendChild(e);const w=t("p",(t=>i.post("/edu-app/open/getUploadSign",{data:t})));
- /*!
- * 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 b(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,a)}return i}function y(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?b(Object(i),!0).forEach((function(e){M(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):b(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function x(t){return x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(t)}function C(t,e){for(var i=0;i<e.length;i++){var a=e[i];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function M(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function k(t){return function(t){if(Array.isArray(t))return D(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return D(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?D(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,a=new Array(e);i<e;i++)a[i]=t[i];return a}var A="undefined"!=typeof window&&void 0!==window.document,B=A?window:{},T=!(!A||!B.document.documentElement)&&"ontouchstart"in B.document.documentElement,z=!!A&&"PointerEvent"in B,O="cropper",L="all",E="crop",N="move",W="zoom",S="e",H="w",R="s",j="n",X="ne",Y="nw",I="se",U="sw",P="".concat(O,"-crop"),F="".concat(O,"-disabled"),K="".concat(O,"-hidden"),$="".concat(O,"-hide"),q="".concat(O,"-invisible"),Q="".concat(O,"-modal"),V="".concat(O,"-move"),Z="".concat(O,"Action"),G="".concat(O,"Preview"),J="crop",_="move",tt="none",et="crop",it="cropend",at="cropmove",ot="cropstart",nt="dblclick",rt=z?"pointerdown":T?"touchstart":"mousedown",st=z?"pointermove":T?"touchmove":"mousemove",ht=z?"pointerup pointercancel":T?"touchend touchcancel":"mouseup",ct="ready",lt="resize",pt="wheel",dt="zoom",ut="image/jpeg",mt=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,gt=/^data:/,ft=/^data:image\/jpeg;base64,/,vt=/^img|canvas$/i,wt={viewMode:0,dragMode:J,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:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},bt=Number.isNaN||B.isNaN;function yt(t){return"number"==typeof t&&!bt(t)}var xt=function(t){return t>0&&t<1/0};function Ct(t){return void 0===t}function Mt(t){return"object"===x(t)&&null!==t}var kt=Object.prototype.hasOwnProperty;function Dt(t){if(!Mt(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&kt.call(i,"isPrototypeOf")}catch(a){return!1}}function At(t){return"function"==typeof t}var Bt=Array.prototype.slice;function Tt(t){return Array.from?Array.from(t):Bt.call(t)}function zt(t,e){return t&&At(e)&&(Array.isArray(t)||yt(t.length)?Tt(t).forEach((function(i,a){e.call(t,i,a,t)})):Mt(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Ot=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];return Mt(t)&&i.length>0&&i.forEach((function(e){Mt(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Lt=/\.\d*(?:0|9){12}\d*$/;function Et(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Lt.test(t)?Math.round(t*e)/e:t}var Nt=/^width|height|left|top|marginLeft|marginTop$/;function Wt(t,e){var i=t.style;zt(e,(function(t,e){Nt.test(e)&&yt(t)&&(t="".concat(t,"px")),i[e]=t}))}function St(t,e){if(e)if(yt(t.length))zt(t,(function(t){St(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Ht(t,e){e&&(yt(t.length)?zt(t,(function(t){Ht(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Rt(t,e,i){e&&(yt(t.length)?zt(t,(function(t){Rt(t,e,i)})):i?St(t,e):Ht(t,e))}var jt=/([a-z\d])([A-Z])/g;function Xt(t){return t.replace(jt,"$1-$2").toLowerCase()}function Yt(t,e){return Mt(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Xt(e)))}function It(t,e,i){Mt(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Xt(e)),i)}var Ut=/\s\s*/,Pt=function(){var t=!1;if(A){var e=!1,i=function(){},a=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});B.addEventListener("test",i,a),B.removeEventListener("test",i,a)}return t}();function Ft(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(Ut).forEach((function(e){if(!Pt){var n=t.listeners;n&&n[e]&&n[e][i]&&(o=n[e][i],delete n[e][i],0===Object.keys(n[e]).length&&delete n[e],0===Object.keys(n).length&&delete t.listeners)}t.removeEventListener(e,o,a)}))}function Kt(t,e,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(Ut).forEach((function(e){if(a.once&&!Pt){var n=t.listeners,r=void 0===n?{}:n;o=function(){delete r[e][i],t.removeEventListener(e,o,a);for(var n=arguments.length,s=new Array(n),h=0;h<n;h++)s[h]=arguments[h];i.apply(t,s)},r[e]||(r[e]={}),r[e][i]&&t.removeEventListener(e,r[e][i],a),r[e][i]=o,t.listeners=r}t.addEventListener(e,o,a)}))}function $t(t,e,i){var a;return At(Event)&&At(CustomEvent)?a=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(a=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(a)}function qt(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var Qt=B.location,Vt=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Zt(t){var e=t.match(Vt);return null!==e&&(e[1]!==Qt.protocol||e[2]!==Qt.hostname||e[3]!==Qt.port)}function Gt(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function Jt(t){var e=t.rotate,i=t.scaleX,a=t.scaleY,o=t.translateX,n=t.translateY,r=[];yt(o)&&0!==o&&r.push("translateX(".concat(o,"px)")),yt(n)&&0!==n&&r.push("translateY(".concat(n,"px)")),yt(e)&&0!==e&&r.push("rotate(".concat(e,"deg)")),yt(i)&&1!==i&&r.push("scaleX(".concat(i,")")),yt(a)&&1!==a&&r.push("scaleY(".concat(a,")"));var s=r.length?r.join(" "):"none";return{WebkitTransform:s,msTransform:s,transform:s}}function _t(t,e){var i=t.pageX,a=t.pageY,o={endX:i,endY:a};return e?o:y({startX:i,startY:a},o)}function te(t){var e=t.aspectRatio,i=t.height,a=t.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",n=xt(a),r=xt(i);if(n&&r){var s=i*e;"contain"===o&&s>a||"cover"===o&&s<a?i=a/e:a=i*e}else n?i=a/e:r&&(a=i*e);return{width:a,height:i}}var ee=String.fromCharCode,ie=/^data:.*,/;function ae(t){var e,i=new DataView(t);try{var a,o,n;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var r=i.byteLength,s=2;s+1<r;){if(255===i.getUint8(s)&&225===i.getUint8(s+1)){o=s;break}s+=1}if(o){var h=o+10;if("Exif"===function(t,e,i){var a="";i+=e;for(var o=e;o<i;o+=1)a+=ee(t.getUint8(o));return a}(i,o+4,4)){var c=i.getUint16(h);if(((a=18761===c)||19789===c)&&42===i.getUint16(h+2,a)){var l=i.getUint32(h+4,a);l>=8&&(n=h+l)}}}if(n){var p,d,u=i.getUint16(n,a);for(d=0;d<u;d+=1)if(p=n+12*d+2,274===i.getUint16(p,a)){p+=8,e=i.getUint16(p,a),i.setUint16(p,1,a);break}}}catch(m){e=1}return e}var oe={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,a=this.cropper,o=Number(e.minContainerWidth),n=Number(e.minContainerHeight);St(a,K),Ht(t,K);var r={width:Math.max(i.offsetWidth,o>=0?o:200),height:Math.max(i.offsetHeight,n>=0?n:100)};this.containerData=r,Wt(a,{width:r.width,height:r.height}),St(t,K),Ht(a,K)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,a=Math.abs(e.rotate)%180==90,o=a?e.naturalHeight:e.naturalWidth,n=a?e.naturalWidth:e.naturalHeight,r=o/n,s=t.width,h=t.height;t.height*r>t.width?3===i?s=t.height*r:h=t.width/r:3===i?h=t.width/r:s=t.height*r;var c={aspectRatio:r,naturalWidth:o,naturalHeight:n,width:s,height:h};this.canvasData=c,this.limited=1===i||2===i,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=Ot({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,o=this.canvasData,n=this.cropBoxData,r=i.viewMode,s=o.aspectRatio,h=this.cropped&&n;if(t){var c=Number(i.minCanvasWidth)||0,l=Number(i.minCanvasHeight)||0;r>1?(c=Math.max(c,a.width),l=Math.max(l,a.height),3===r&&(l*s>c?c=l*s:l=c/s)):r>0&&(c?c=Math.max(c,h?n.width:0):l?l=Math.max(l,h?n.height:0):h&&(c=n.width,(l=n.height)*s>c?c=l*s:l=c/s));var p=te({aspectRatio:s,width:c,height:l});c=p.width,l=p.height,o.minWidth=c,o.minHeight=l,o.maxWidth=1/0,o.maxHeight=1/0}if(e)if(r>(h?0:1)){var d=a.width-o.width,u=a.height-o.height;o.minLeft=Math.min(0,d),o.minTop=Math.min(0,u),o.maxLeft=Math.max(0,d),o.maxTop=Math.max(0,u),h&&this.limited&&(o.minLeft=Math.min(n.left,n.left+(n.width-o.width)),o.minTop=Math.min(n.top,n.top+(n.height-o.height)),o.maxLeft=n.left,o.maxTop=n.top,2===r&&(o.width>=a.width&&(o.minLeft=Math.min(0,d),o.maxLeft=Math.max(0,d)),o.height>=a.height&&(o.minTop=Math.min(0,u),o.maxTop=Math.max(0,u))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=a.width,o.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var o=function(t){var e=t.width,i=t.height,a=t.degree;if(90==(a=Math.abs(a)%180))return{width:i,height:e};var o=a%90*Math.PI/180,n=Math.sin(o),r=Math.cos(o),s=e*r+i*n,h=e*n+i*r;return a>90?{width:h,height:s}:{width:s,height:h}}({width:a.naturalWidth*Math.abs(a.scaleX||1),height:a.naturalHeight*Math.abs(a.scaleY||1),degree:a.rotate||0}),n=o.width,r=o.height,s=i.width*(n/i.naturalWidth),h=i.height*(r/i.naturalHeight);i.left-=(s-i.width)/2,i.top-=(h-i.height)/2,i.width=s,i.height=h,i.aspectRatio=n/r,i.naturalWidth=n,i.naturalHeight=r,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,Wt(this.canvas,Ot({width:i.width,height:i.height},Jt({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,a=i.naturalWidth*(e.width/e.naturalWidth),o=i.naturalHeight*(e.height/e.naturalHeight);Ot(i,{width:a,height:o,left:(e.width-a)/2,top:(e.height-o)/2}),Wt(this.image,Ot({width:i.width,height:i.height},Jt(Ot({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,a=Number(t.autoCropArea)||.8,o={width:e.width,height:e.height};i&&(e.height*i>e.width?o.height=o.width/i:o.width=o.height*i),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*a),o.height=Math.max(o.minHeight,o.height*a),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=Ot({},o)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,o=this.canvasData,n=this.cropBoxData,r=this.limited,s=i.aspectRatio;if(t){var h=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,l=r?Math.min(a.width,o.width,o.width+o.left,a.width-o.left):a.width,p=r?Math.min(a.height,o.height,o.height+o.top,a.height-o.top):a.height;h=Math.min(h,a.width),c=Math.min(c,a.height),s&&(h&&c?c*s>h?c=h/s:h=c*s:h?c=h/s:c&&(h=c*s),p*s>l?p=l/s:l=p*s),n.minWidth=Math.min(h,l),n.minHeight=Math.min(c,p),n.maxWidth=l,n.maxHeight=p}e&&(r?(n.minLeft=Math.max(0,o.left),n.minTop=Math.max(0,o.top),n.maxLeft=Math.min(a.width,o.left+o.width)-n.width,n.maxTop=Math.min(a.height,o.top+o.height)-n.height):(n.minLeft=0,n.minTop=0,n.maxLeft=a.width-n.width,n.maxTop=a.height-n.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&It(this.face,Z,i.width>=e.width&&i.height>=e.height?N:L),Wt(this.cropBox,Ot({width:i.width,height:i.height},Jt({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),$t(this.element,et,this.getData())}},ne={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,a=e?this.crossOriginUrl:this.url,o=t.alt||"The image to preview",n=document.createElement("img");if(e&&(n.crossOrigin=e),n.src=a,n.alt=o,this.viewBox.appendChild(n),this.viewBoxImage=n,i){var r=i;"string"==typeof i?r=t.ownerDocument.querySelectorAll(i):i.querySelector&&(r=[i]),this.previews=r,zt(r,(function(t){var i=document.createElement("img");It(t,G,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=a,i.alt=o,i.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;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){zt(this.previews,(function(t){var e=Yt(t,G);Wt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Mt(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Xt(e)))}(t,G)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,a=i.width,o=i.height,n=t.width,r=t.height,s=i.left-e.left-t.left,h=i.top-e.top-t.top;this.cropped&&!this.disabled&&(Wt(this.viewBoxImage,Ot({width:n,height:r},Jt(Ot({translateX:-s,translateY:-h},t)))),zt(this.previews,(function(e){var i=Yt(e,G),c=i.width,l=i.height,p=c,d=l,u=1;a&&(d=o*(u=c/a)),o&&d>l&&(p=a*(u=l/o),d=l),Wt(e,{width:p,height:d}),Wt(e.getElementsByTagName("img")[0],Ot({width:n*u,height:r*u},Jt(Ot({translateX:-s*u,translateY:-h*u},t))))})))}},re={bind:function(){var t=this.element,e=this.options,i=this.cropper;At(e.cropstart)&&Kt(t,ot,e.cropstart),At(e.cropmove)&&Kt(t,at,e.cropmove),At(e.cropend)&&Kt(t,it,e.cropend),At(e.crop)&&Kt(t,et,e.crop),At(e.zoom)&&Kt(t,dt,e.zoom),Kt(i,rt,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&Kt(i,pt,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Kt(i,nt,this.onDblclick=this.dblclick.bind(this)),Kt(t.ownerDocument,st,this.onCropMove=this.cropMove.bind(this)),Kt(t.ownerDocument,ht,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&Kt(window,lt,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;At(e.cropstart)&&Ft(t,ot,e.cropstart),At(e.cropmove)&&Ft(t,at,e.cropmove),At(e.cropend)&&Ft(t,it,e.cropend),At(e.crop)&&Ft(t,et,e.crop),At(e.zoom)&&Ft(t,dt,e.zoom),Ft(i,rt,this.onCropStart),e.zoomable&&e.zoomOnWheel&&Ft(i,pt,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Ft(i,nt,this.onDblclick),Ft(t.ownerDocument,st,this.onCropMove),Ft(t.ownerDocument,ht,this.onCropEnd),e.responsive&&Ft(window,lt,this.onResize)}},se={resize:function(){if(!this.disabled){var t,e,i=this.options,a=this.container,o=this.containerData,n=a.offsetWidth/o.width,r=a.offsetHeight/o.height,s=Math.abs(n-1)>Math.abs(r-1)?n:r;1!==s&&(i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(zt(t,(function(e,i){t[i]=e*s}))),this.setCropBoxData(zt(e,(function(t,i){e[i]=t*s})))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===tt||this.setDragMode((t=this.dragBox,e=P,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?_:J))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,a=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?a=t.deltaY>0?1:-1:t.wheelDelta?a=-t.wheelDelta/120:t.detail&&(a=t.detail>0?1:-1),this.zoom(-a*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(yt(e)&&1!==e||yt(i)&&0!==i||t.ctrlKey))){var a,o=this.options,n=this.pointers;t.changedTouches?zt(t.changedTouches,(function(t){n[t.identifier]=_t(t)})):n[t.pointerId||0]=_t(t),a=Object.keys(n).length>1&&o.zoomable&&o.zoomOnTouch?W:Yt(t.target,Z),mt.test(a)&&!1!==$t(this.element,ot,{originalEvent:t,action:a})&&(t.preventDefault(),this.action=a,this.cropping=!1,a===E&&(this.cropping=!0,St(this.dragBox,Q)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==$t(this.element,at,{originalEvent:t,action:e})&&(t.changedTouches?zt(t.changedTouches,(function(t){Ot(i[t.identifier]||{},_t(t,!0))})):Ot(i[t.pointerId||0]||{},_t(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?zt(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Rt(this.dragBox,Q,this.cropped&&this.options.modal)),$t(this.element,it,{originalEvent:t,action:e}))}}},he={change:function(t){var e,i=this.options,a=this.canvasData,o=this.containerData,n=this.cropBoxData,r=this.pointers,s=this.action,h=i.aspectRatio,c=n.left,l=n.top,p=n.width,d=n.height,u=c+p,m=l+d,g=0,f=0,v=o.width,w=o.height,b=!0;!h&&t.shiftKey&&(h=p&&d?p/d:1),this.limited&&(g=n.minLeft,f=n.minTop,v=g+Math.min(o.width,a.width,a.left+a.width),w=f+Math.min(o.height,a.height,a.top+a.height));var x=r[Object.keys(r)[0]],C={x:x.endX-x.startX,y:x.endY-x.startY},M=function(t){switch(t){case S:u+C.x>v&&(C.x=v-u);break;case H:c+C.x<g&&(C.x=g-c);break;case j:l+C.y<f&&(C.y=f-l);break;case R:m+C.y>w&&(C.y=w-m)}};switch(s){case L:c+=C.x,l+=C.y;break;case S:if(C.x>=0&&(u>=v||h&&(l<=f||m>=w))){b=!1;break}M(S),(p+=C.x)<0&&(s=H,c-=p=-p),h&&(d=p/h,l+=(n.height-d)/2);break;case j:if(C.y<=0&&(l<=f||h&&(c<=g||u>=v))){b=!1;break}M(j),d-=C.y,l+=C.y,d<0&&(s=R,l-=d=-d),h&&(p=d*h,c+=(n.width-p)/2);break;case H:if(C.x<=0&&(c<=g||h&&(l<=f||m>=w))){b=!1;break}M(H),p-=C.x,c+=C.x,p<0&&(s=S,c-=p=-p),h&&(d=p/h,l+=(n.height-d)/2);break;case R:if(C.y>=0&&(m>=w||h&&(c<=g||u>=v))){b=!1;break}M(R),(d+=C.y)<0&&(s=j,l-=d=-d),h&&(p=d*h,c+=(n.width-p)/2);break;case X:if(h){if(C.y<=0&&(l<=f||u>=v)){b=!1;break}M(j),d-=C.y,l+=C.y,p=d*h}else M(j),M(S),C.x>=0?u<v?p+=C.x:C.y<=0&&l<=f&&(b=!1):p+=C.x,C.y<=0?l>f&&(d-=C.y,l+=C.y):(d-=C.y,l+=C.y);p<0&&d<0?(s=U,l-=d=-d,c-=p=-p):p<0?(s=Y,c-=p=-p):d<0&&(s=I,l-=d=-d);break;case Y:if(h){if(C.y<=0&&(l<=f||c<=g)){b=!1;break}M(j),d-=C.y,l+=C.y,p=d*h,c+=n.width-p}else M(j),M(H),C.x<=0?c>g?(p-=C.x,c+=C.x):C.y<=0&&l<=f&&(b=!1):(p-=C.x,c+=C.x),C.y<=0?l>f&&(d-=C.y,l+=C.y):(d-=C.y,l+=C.y);p<0&&d<0?(s=I,l-=d=-d,c-=p=-p):p<0?(s=X,c-=p=-p):d<0&&(s=U,l-=d=-d);break;case U:if(h){if(C.x<=0&&(c<=g||m>=w)){b=!1;break}M(H),p-=C.x,c+=C.x,d=p/h}else M(R),M(H),C.x<=0?c>g?(p-=C.x,c+=C.x):C.y>=0&&m>=w&&(b=!1):(p-=C.x,c+=C.x),C.y>=0?m<w&&(d+=C.y):d+=C.y;p<0&&d<0?(s=X,l-=d=-d,c-=p=-p):p<0?(s=I,c-=p=-p):d<0&&(s=Y,l-=d=-d);break;case I:if(h){if(C.x>=0&&(u>=v||m>=w)){b=!1;break}M(S),d=(p+=C.x)/h}else M(R),M(S),C.x>=0?u<v?p+=C.x:C.y>=0&&m>=w&&(b=!1):p+=C.x,C.y>=0?m<w&&(d+=C.y):d+=C.y;p<0&&d<0?(s=Y,l-=d=-d,c-=p=-p):p<0?(s=U,c-=p=-p):d<0&&(s=X,l-=d=-d);break;case N:this.move(C.x,C.y),b=!1;break;case W:this.zoom(function(t){var e=y({},t),i=0;return zt(t,(function(t,a){delete e[a],zt(e,(function(e){var a=Math.abs(t.startX-e.startX),o=Math.abs(t.startY-e.startY),n=Math.abs(t.endX-e.endX),r=Math.abs(t.endY-e.endY),s=Math.sqrt(a*a+o*o),h=(Math.sqrt(n*n+r*r)-s)/s;Math.abs(h)>Math.abs(i)&&(i=h)}))})),i}(r),t),b=!1;break;case E:if(!C.x||!C.y){b=!1;break}e=qt(this.cropper),c=x.startX-e.left,l=x.startY-e.top,p=n.minWidth,d=n.minHeight,C.x>0?s=C.y>0?I:X:C.x<0&&(c-=p,s=C.y>0?U:Y),C.y<0&&(l-=d),this.cropped||(Ht(this.cropBox,K),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}b&&(n.width=p,n.height=d,n.left=c,n.top=l,this.action=s,this.renderCropBox()),zt(r,(function(t){t.startX=t.endX,t.startY=t.endY}))}},ce={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&St(this.dragBox,Q),Ht(this.cropBox,K),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ot({},this.initialImageData),this.canvasData=Ot({},this.initialCanvasData),this.cropBoxData=Ot({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ot(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Ht(this.dragBox,Q),St(this.cropBox,K)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,zt(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,Ht(this.cropper,F)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,St(this.cropper,F)),this},destroy:function(){var t=this.element;return t[O]?(t[O]=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=i.left,o=i.top;return this.moveTo(Ct(t)?t:a+Number(t),Ct(e)?e:o+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(yt(t)&&(i.left=t,a=!0),yt(e)&&(i.top=e,a=!0),a&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var a=this.options,o=this.canvasData,n=o.width,r=o.height,s=o.naturalWidth,h=o.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&a.zoomable){var c=s*t,l=h*t;if(!1===$t(this.element,dt,{ratio:t,oldRatio:n/s,originalEvent:i}))return this;if(i){var p=this.pointers,d=qt(this.cropper),u=p&&Object.keys(p).length?function(t){var e=0,i=0,a=0;return zt(t,(function(t){var o=t.startX,n=t.startY;e+=o,i+=n,a+=1})),{pageX:e/=a,pageY:i/=a}}(p):{pageX:i.pageX,pageY:i.pageY};o.left-=(c-n)*((u.pageX-d.left-o.left)/n),o.top-=(l-r)*((u.pageY-d.top-o.top)/r)}else Dt(e)&&yt(e.x)&&yt(e.y)?(o.left-=(c-n)*((e.x-o.left)/n),o.top-=(l-r)*((e.y-o.top)/r)):(o.left-=(c-n)/2,o.top-=(l-r)/2);o.width=c,o.height=l,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return yt(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,yt(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(yt(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,a=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(yt(t)&&(i.scaleX=t,a=!0),yt(e)&&(i.scaleY=e,a=!0),a&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,a=this.imageData,o=this.canvasData,n=this.cropBoxData;if(this.ready&&this.cropped){t={x:n.left-o.left,y:n.top-o.top,width:n.width,height:n.height};var r=a.width/a.naturalWidth;if(zt(t,(function(e,i){t[i]=e/r})),e){var s=Math.round(t.y+t.height),h=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=h-t.x,t.height=s-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=a.rotate||0),i.scalable&&(t.scaleX=a.scaleX||1,t.scaleY=a.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,a=this.canvasData,o={};if(this.ready&&!this.disabled&&Dt(t)){var n=!1;e.rotatable&&yt(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,n=!0),e.scalable&&(yt(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,n=!0),yt(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,n=!0)),n&&this.renderCanvas(!0,!0);var r=i.width/i.naturalWidth;yt(t.x)&&(o.left=t.x*r+a.left),yt(t.y)&&(o.top=t.y*r+a.top),yt(t.width)&&(o.width=t.width*r),yt(t.height)&&(o.height=t.height*r),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Ot({},this.containerData):{}},getImageData:function(){return this.sized?Ot({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&zt(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&Dt(t)&&(yt(t.left)&&(e.left=t.left),yt(t.top)&&(e.top=t.top),yt(t.width)?(e.width=t.width,e.height=t.width/i):yt(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,a=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&Dt(t)&&(yt(t.left)&&(a.left=t.left),yt(t.top)&&(a.top=t.top),yt(t.width)&&t.width!==a.width&&(e=!0,a.width=t.width),yt(t.height)&&t.height!==a.height&&(i=!0,a.height=t.height),o&&(e?a.height=a.width/o:i&&(a.width=a.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=function(t,e,i,a){var o=e.aspectRatio,n=e.naturalWidth,r=e.naturalHeight,s=e.rotate,h=void 0===s?0:s,c=e.scaleX,l=void 0===c?1:c,p=e.scaleY,d=void 0===p?1:p,u=i.aspectRatio,m=i.naturalWidth,g=i.naturalHeight,f=a.fillColor,v=void 0===f?"transparent":f,w=a.imageSmoothingEnabled,b=void 0===w||w,y=a.imageSmoothingQuality,x=void 0===y?"low":y,C=a.maxWidth,M=void 0===C?1/0:C,D=a.maxHeight,A=void 0===D?1/0:D,B=a.minWidth,T=void 0===B?0:B,z=a.minHeight,O=void 0===z?0:z,L=document.createElement("canvas"),E=L.getContext("2d"),N=te({aspectRatio:u,width:M,height:A}),W=te({aspectRatio:u,width:T,height:O},"cover"),S=Math.min(N.width,Math.max(W.width,m)),H=Math.min(N.height,Math.max(W.height,g)),R=te({aspectRatio:o,width:M,height:A}),j=te({aspectRatio:o,width:T,height:O},"cover"),X=Math.min(R.width,Math.max(j.width,n)),Y=Math.min(R.height,Math.max(j.height,r)),I=[-X/2,-Y/2,X,Y];return L.width=Et(S),L.height=Et(H),E.fillStyle=v,E.fillRect(0,0,S,H),E.save(),E.translate(S/2,H/2),E.rotate(h*Math.PI/180),E.scale(l,d),E.imageSmoothingEnabled=b,E.imageSmoothingQuality=x,E.drawImage.apply(E,[t].concat(k(I.map((function(t){return Math.floor(Et(t))}))))),E.restore(),L}(this.image,this.imageData,e,t);if(!this.cropped)return i;var a=this.getData(),o=a.x,n=a.y,r=a.width,s=a.height,h=i.width/Math.floor(e.naturalWidth);1!==h&&(o*=h,n*=h,r*=h,s*=h);var c=r/s,l=te({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),p=te({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),d=te({aspectRatio:c,width:t.width||(1!==h?i.width:r),height:t.height||(1!==h?i.height:s)}),u=d.width,m=d.height;u=Math.min(l.width,Math.max(p.width,u)),m=Math.min(l.height,Math.max(p.height,m));var g=document.createElement("canvas"),f=g.getContext("2d");g.width=Et(u),g.height=Et(m),f.fillStyle=t.fillColor||"transparent",f.fillRect(0,0,u,m);var v=t.imageSmoothingEnabled,w=void 0===v||v,b=t.imageSmoothingQuality;f.imageSmoothingEnabled=w,b&&(f.imageSmoothingQuality=b);var y,x,C,M,D,A,B=i.width,T=i.height,z=o,O=n;z<=-r||z>B?(z=0,y=0,C=0,D=0):z<=0?(C=-z,z=0,D=y=Math.min(B,r+z)):z<=B&&(C=0,D=y=Math.min(r,B-z)),y<=0||O<=-s||O>T?(O=0,x=0,M=0,A=0):O<=0?(M=-O,O=0,A=x=Math.min(T,s+O)):O<=T&&(M=0,A=x=Math.min(s,T-O));var L=[z,O,y,x];if(D>0&&A>0){var E=u/r;L.push(C*E,M*E,D*E,A*E)}return f.drawImage.apply(f,[i].concat(k(L.map((function(t){return Math.floor(Et(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||Ct(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,a=this.face;if(this.ready&&!this.disabled){var o=t===J,n=e.movable&&t===_;t=o||n?t:tt,e.dragMode=t,It(i,Z,t),Rt(i,P,o),Rt(i,V,n),e.cropBoxMovable||(It(a,Z,t),Rt(a,P,o),Rt(a,V,n))}return this}},le=B.Cropper,pe=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!vt.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Ot({},wt,Dt(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()}var e,i,a;return e=t,i=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[O]){if(e[O]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(gt.test(t))ft.test(t)?this.read((o=t.replace(ie,""),n=atob(o),r=new ArrayBuffer(n.length),zt(s=new Uint8Array(r),(function(t,e){s[e]=n.charCodeAt(e)})),r)):this.clone();else{var o,n,r,s,h=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=h,h.onabort=c,h.onerror=c,h.ontimeout=c,h.onprogress=function(){h.getResponseHeader("content-type")!==ut&&h.abort()},h.onload=function(){e.read(h.response)},h.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&Zt(t)&&i.crossOrigin&&(t=Gt(t)),h.open("GET",t,!0),h.responseType="arraybuffer",h.withCredentials="use-credentials"===i.crossOrigin,h.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=ae(t),o=0,n=1,r=1;if(a>1){this.url=function(t,e){for(var i=[],a=new Uint8Array(t);a.length>0;)i.push(ee.apply(null,Tt(a.subarray(0,8192)))),a=a.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,ut);var s=function(t){var e=0,i=1,a=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:a=-1;break;case 5:e=90,a=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:a}}(a);o=s.rotate,n=s.scaleX,r=s.scaleY}e.rotatable&&(i.rotate=o),e.scalable&&(i.scaleX=n,i.scaleY=r),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,a=e;this.options.checkCrossOrigin&&Zt(e)&&(i||(i="anonymous"),a=Gt(e)),this.crossOrigin=i,this.crossOriginUrl=a;var o=document.createElement("img");i&&(o.crossOrigin=i),o.src=a||e,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),St(o,$),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=B.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(B.navigator.userAgent),a=function(e,i){Ot(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Ot({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var o=document.createElement("img"),n=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){a(o.width,o.height),i||n.removeChild(o)},o.src=e.src,i||(o.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(o))}else a(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,a=t.parentNode,o=document.createElement("div");o.innerHTML='<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>';var n=o.querySelector(".".concat(O,"-container")),r=n.querySelector(".".concat(O,"-canvas")),s=n.querySelector(".".concat(O,"-drag-box")),h=n.querySelector(".".concat(O,"-crop-box")),c=h.querySelector(".".concat(O,"-face"));this.container=a,this.cropper=n,this.canvas=r,this.dragBox=s,this.cropBox=h,this.viewBox=n.querySelector(".".concat(O,"-view-box")),this.face=c,r.appendChild(i),St(t,K),a.insertBefore(n,t.nextSibling),Ht(i,$),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,St(h,K),e.guides||St(h.getElementsByClassName("".concat(O,"-dashed")),K),e.center||St(h.getElementsByClassName("".concat(O,"-center")),K),e.background&&St(n,"".concat(O,"-bg")),e.highlight||St(c,q),e.cropBoxMovable&&(St(c,V),It(c,Z,L)),e.cropBoxResizable||(St(h.getElementsByClassName("".concat(O,"-line")),K),St(h.getElementsByClassName("".concat(O,"-point")),K)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),At(e.ready)&&Kt(t,ct,e.ready,{once:!0}),$t(t,ct)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),Ht(this.element,K)}}},{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()}}],a=[{key:"noConflict",value:function(){return window.Cropper=le,t}},{key:"setDefaults",value:function(t){Ot(wt,Dt(t)&&t)}}],i&&C(e.prototype,i),a&&C(e,a),Object.defineProperty(e,"prototype",{writable:!1}),t}();Ot(pe.prototype,oe,ne,re,se,he,ce);const de=a({name:"copper-image",emits:["close","cropperNo","cropperOk"],setup(t,{emit:e,expose:i}){const a=o({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}),u=n(),m=()=>{a.myCropper=new pe(u.value,{viewMode:1,dragMode:"move",aspectRatio:a.options.autoCropWidth/a.options.autoCropHeight,initialAspectRatio:1,autoCropArea:1,cropBoxMovable:!0,cropBoxResizable:!1,background:!0,movable:!0,modal:!0,preview:".before"})},g=t=>{switch(t){case"left":a.myCropper.rotate(90);break;case"right":a.myCropper.rotate(-90);break;case"zoomIn":a.myCropper.zoom(.1);break;case"zoomOut":a.myCropper.zoom(-.1)}},f=()=>{a.confirmLoading=!0,a.myCropper.getCroppedCanvas({imageSmoothingQuality:"high"}).toBlob((t=>{console.log(t,"1212"),e("cropperOk",t),a.confirmLoading=!1}))};return i({edit:t=>{const{options:e}=a;a.visible=!0,a.options=Object.assign({},e,t),d((()=>{m()}))}}),()=>r("div",null,[r(s,{cols:2,xGap:24,style:{paddingTop:"12px"}},{default:()=>[r(h,null,{default:()=>[r("div",{style:"width: 100%; height: 300px"},[r("img",{ref:u,id:"myImages",src:a.options.img,alt:""},null)]),r(c,{justify:"center",style:{paddingTop:"12px"}},{default:()=>[r(l,{type:"primary",size:"small",onClick:()=>g("left")},{default:()=>[p("逆时针旋转")]}),r(l,{type:"primary",size:"small",onClick:()=>g("right")},{default:()=>[p("顺时针旋转")]}),r(l,{type:"primary",size:"small",onClick:()=>g("zoomIn")},{default:()=>[p("放大")]}),r(l,{type:"primary",size:"small",onClick:()=>g("zoomOut")},{default:()=>[p("缩小")]})]})]}),r(h,null,{default:()=>[r("span",{style:{fontSize:"15px",fontWeight:600,paddingBottom:"8px",display:"inline-block"}},[p("预览图片")]),r("div",{class:"before",style:{width:a.options.autoCropWidth+"px",height:a.options.autoCropHeight+"px",overflow:"hidden"}},null)]})]}),r(c,{justify:"end"},{default:()=>[r(l,{type:"default",onClick:()=>{a.confirmLoading=!1,e("close"),e("cropperNo")}},{default:()=>[p("取消")]}),r(l,{type:"primary",loading:a.confirmLoading,onClick:f},{default:()=>[p("确认")]})]})])}});t("U",a({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(t,{emit:e,expose:i,slots:a}){const s=`https://${t.bucketName}.ks3-cn-beijing.ksyuncs.com/`,h=u(),c=n(!1),p=n(!1),d=n(),b=n(),y=o({policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""}),x=n([]),C=()=>{if(t.fileList){const e=t.fileList.split("/");x.value=[{id:(new Date).getTime().toString(),name:e[e.length-1],status:"finished",url:t.fileList}]}else if(Array.isArray(t.imageList)){const e=[];t.imageList.forEach((t=>{const i=t.split("/");e.push({id:Date.now().toString(),name:i[i.length-1],status:"finished",url:t})})),x.value=e}else x.value=[]};C(),m((()=>t.imageList),(()=>{C()})),m((()=>t.fileList),(()=>{console.log("list"),C()})),i({handleClearFile:()=>{b.value?.clear(),console.log("清空",b.value)}});const M=n(),k=async(t,e)=>{const i=new FileReader;i.addEventListener("load",(()=>e(i.result))),i.readAsDataURL(t)},D=async i=>{try{const a=`${t.path}${t.fileName||(new Date).getTime()+".png"}`,o={filename:a,bucketName:t.bucketName,postData:{filename:a,acl:"public-read",key:a,unknowValueField:[]}},{data:n}=await w(o);y.policy=n.policy,y.signature=n.signature,y.key=a,y.KSSAccessKeyId=n.kssAccessKeyId,y.name=a;const r=new FormData;for(const t in y)r.append(t,y[t]);r.append("file",i),await v.post(s,r).then((()=>{const t=s+y.key;console.log(t,"url");const i=t.split("/");x.value=[{id:(new Date).getTime().toString(),name:i[i.length-1],status:"finished",url:t}],e("update:fileList",t),c.value=!1}))}catch{return!1}};return()=>r("div",null,[r(g,{ref:b,action:s,data:y,fileList:x.value,"onUpdate:fileList":t=>x.value=t,listType:t.listType,accept:t.accept,multiple:t.multiple,max:t.max,disabled:t.disabled,showFileList:t.showFileList,showPreviewButton:!0,onBeforeUpload:e=>(async e=>{const i=e.file;let a=!0;if(t.size&&(a=i.file.size/1024/1024<t.size,!a))return h.error(`文件大小不能超过${t.size}M`),!1;if(!a)return a;if(t.cropper)return k(i.file,(e=>{const a=Object.assign({},t.options,{img:e,name:i.file.name});c.value=!0,setTimeout((()=>{M.value?.edit(a),console.log(M.value,"cropper")}),100)})),!1;try{p.value=!0,console.log(t.path,i.file);const e=i.file.name,a=e.slice(e.lastIndexOf(".")),o=`${t.path}${t.fileName||Date.now()+a}`,n={filename:o,bucketName:t.bucketName,postData:{filename:o,acl:"public-read",key:o,unknowValueField:[]}},{data:r}=await w(n);y.policy=r.policy,y.signature=r.signature,y.key=o,y.KSSAccessKeyId=r.kssAccessKeyId,y.name=o,d.value=i.file}catch{return p.value=!1,!1}return!0})(e),onFinish:t=>(t=>{const i=s+y.key;console.log(i,"url"),e("update:fileList",i),e("readFileInputEventAsArrayBuffer",d.value),t.file.url=i,c.value=!1,p.value=!1})(t),onRemove:t=>(async t=>{console.log("🚀 ~ options",t),e("update:fileList",""),e("remove"),p.value=!1})(t)},{default:()=>["default"===t.showType&&"image"===t.listType&&r(l,{loading:p.value,type:"primary"},{default:()=>[t.text]}),"custom"===t.showType&&a.custom&&a.custom()]}),t.tips&&r("p",{style:"font-size: 13px; color: #666; padding-top: 4px;"},[t.tips]),r(f,{show:c.value,"onUpdate:show":t=>c.value=t,preset:"dialog",showIcon:!1,class:["modalTitle background"],title:"上传图片",style:{width:"800px"}},{default:()=>[r(de,{ref:M,onClose:()=>c.value=!1,onCropperOk:D},null)]})])}}))}}}));
|