/*! Build based on gin-vue-admin Time : 1757946830000 */ !function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1920;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.file=t,this.fileSize=i,this.maxWH=n},(i=[{key:"compress",value:function(){var e=this,t=this.file.type;return this.file.size,new Promise(function(i){var n=new FileReader;n.readAsDataURL(e.file),n.onload=function(){var r=document.createElement("canvas"),o=document.createElement("img");o.src=n.result,o.onload=function(){var n=r.getContext("2d"),a=e.dWH(o.width,o.height,e.maxWH);r.width=a.width,r.height=a.height,n.clearRect(0,0,r.width,r.height),n.drawImage(o,0,0,r.width,r.height);var u=r.toDataURL(t,.9);e.fileSizeKB(u),e.fileSize;var l=e.dataURLtoBlob(u,t),f=new File([l],e.file.name);i(f)}}})}},{key:"dWH",value:function(e,t,i){var n={width:e,height:t};return Math.max(e,t)>i?e>t?(n.width=i,n.height=Math.round(t*(i/e)),n):(n.height=i,n.width=Math.round(e*(i/t)),n):n}},{key:"fileSizeKB",value:function(e){return Math.round(3*e.split(",")[1].length/4/1024)}},{key:"dataURLtoBlob",value:function(e,t){for(var i=atob(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],r=new ArrayBuffer(i.length),o=new Uint8Array(r),a=0;a