!function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dists/",t(t.s=0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";(function(e){function t(e){return e&&e.__esModule?e:{default:e}}function r(e){function t(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=r?document.querySelector(e):Array.from(document.querySelectorAll(e));return Array.isArray(o)?o.forEach(function(e){n(e,t,function(e){(0,i.default)(e,p,{rate:a.rate,dimension:a.dimen})})}):n(o,t,function(e){(0,i.default)(e,p,{rate:a.rate,dimension:a.dimen})}),o}function n(e,t,n){e.addEventListener(t,function(e){e.preventDefault(),e.stopPropagation(),n(e)})}function r(e){e.preventDefault(),e.stopPropagation();var t=m=m||document.createElement("a");t.download=a.imagePrefix+a.name.replace(/\..+/,""),t.href=s[0],t.click()}var o={rate:50,imagePrefix:"compressed-",name:"image"},a=Object.assign({},o,e),f=[],s=[],d=(a.inputSelector&&t(a.inputSelector,"change"),a.dropSelector?t(a.dropSelector,"drop"):null);!function(e){e&&(e.addEventListener("dragenter",function(e){e.preventDefault(),console.log("drag entered")}),e.addEventListener("dragover",function(e){e.preventDefault(),console.log("drag entered")}),e.addEventListener("dragleave",function(e){e.preventDefault(),console.log("drag entered")}))}(d);a.rateSelector&&function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=r?document.querySelector(e):Array.from(document.querySelectorAll(e));Array.isArray(o)?o.forEach(function(e){n(e,t,function(e){a.rate=parseInt(e.target.value),p.emit("startCompression",f,p,{rate:a.rate,dimension:a.dimen})})}):n(o,t,function(e){a.rate=parseInt(e.target.value),p.emit("startCompression",f,p,{rate:a.rate,dimension:a.dimen})})}(a.rateSelector,"change");(a.downloadSelector?document.querySelector(a.downloadSelector):null).addEventListener("click",r);var m=null,p=new u.default;return p.on("startCompression",l.default),p.on("saveFileUrl",function(e){f=e}),p.on("ImageCreated",function(e){var t=e.map(function(e){return(0,c.compress)(e,a.rate)});p.emit("compressed",t)}),p.on("compressed",function(e){a.imageSelector&&(document.querySelector(a.imageSelector).src=e[0]),s=e}),{options:a,on:function(e,t){p.on(e,t)}}}var o=n(3),i=t(o),a=n(4),u=t(a),c=n(5),l=t(c);e.Compress=r}).call(t,n(2))},function(e,t,n){"use strict";var r,o="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};r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"===("undefined"==typeof window?"undefined":o(window))&&(r=window)}e.exports=r},function(e,t,n){"use strict";function r(e,t){var n=Array.from(e.target.files||e.dataTransfer.files),r=e.target.files?"changed":"dropped";return t.emit(r,n),n}function o(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];var i=new FileReader,a=0,u=[];i.onload=function(){a--,u.push(i.result),0===a&&(t.emit("saveFileUrl",u),t.emit.apply(t,["startCompression",u,t].concat(r)))},e.forEach(function(e){a++,i.readAsDataURL(e)})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),a=2;a<n;a++)i[a-2]=arguments[a];o.apply(void 0,[r(e,t),t].concat(i))}},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){r(this,e),this._events={}}return o(e,[{key:"on",value:function(e,t){var n=this._events;n[e]=n[e]||[],n[e].push(t)}},{key:"emit",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this._events;if(!(e in o))return!1;o[e].forEach(function(e){return e.apply(void 0,n)})}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[];return e.map(function(e){var o=new Image;o.src=e,o.onload=function(){r.push({img:o,dimension:Object.assign({},{width:o.width,height:o.height},n)}),t.emit("ImageCreated",r)}})}function o(e,t){var n=a.getContext("2d");return a.width=e.dimension.width,a.height=e.dimension.height,n.drawImage(e.img,0,0,e.dimension.width,e.dimension.height),a.toDataURL("image/jpeg",t/100)}function i(e,t,n){var o=n.dimension;t.emit("compressing"),r(e,t,o)}Object.defineProperty(t,"__esModule",{value:!0}),t.compress=o,t.default=i;var a=document.createElement("canvas")}]);