text: !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.DownScaler=e():t.DownScaler=e()}(this,function(){return function(t){function e(a){if(r[a])return r[a].exports;var i=r[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var r={};return e.m=t,e.c=r,e.d=function(t,r,a){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,r){"use strict";function a(t,e){var r=t>>>16&65535,a=65535&t,i=e>>>16&65535,n=65535&e;return a*n+(r*n+a*i<<16>>>0)|0}function i(t,e){if(0===t)return e;for(;0!==e;)t>e?t-=e:e-=t;return t}function n(t,r){return e.imul(t,r)/i(t,r)}Object.defineProperty(e,"__esModule",{value:!0}),e.imul=Math.imul?Math.imul:a,e.gcd=i,e.lcm=n},function(t,e,r){"use strict";function a(t,e,r){if(t.width<e.width||t.height<e.height)throw new Error("upscale is not supported");if(t.width===e.width&&t.height===e.height)return void u.copy(t,e);var a=new f.Gamma32(r),i=a.apply(t),n={width:e.width,height:e.height,data:new Float32Array(e.data.length)};if(t.height!==e.height)if(t.width!==e.width){var h={width:e.width,height:t.height,data:new Float32Array(o.imul(e.width<<2,t.height))};u.horz(i,h),u.vert(h,n)}else u.vert(i,n);else u.horz(i,n);a.restore(n,e)}function i(t,e,r){if(t.width<e.width||t.height<e.height)throw new Error("upscale is not supported");if(t.width===e.width&&t.height===e.height)return void u.copy(t,e);var a=new f.Gamma16(r),i=a.apply(t),n={width:e.width,height:e.height,data:new Uint16Array(e.data.length)};if(t.height!==e.height)if(t.width!==e.width){var h={width:e.width,height:t.height,data:new Uint16Array(o.imul(e.width<<2,t.height))};u.horz(i,h),u.vert(h,n)}else u.vert(i,n);else u.horz(i,n);a.restore(n,e)}function n(t,e){if(t.width<e.width||t.height<e.height)throw new Error("upscale is not supported");if(t.width===e.width&&t.height===e.height)return void u.copy(t,e);if(t.height!==e.height)if(t.width!==e.width){var r={width:e.width,height:t.height,data:new Uint8ClampedArray(o.imul(e.width<<2,t.height))};u.horz8(t,r),u.vert8(r,e)}else u.vert8(t,e);else u.horz8(t,e)}function h(t,e,r){if(void 0===r)return n(t,e);i(t,e,r)}Object.defineProperty(e,"__esModule",{value:!0});var o=r(0),u=r(2),f=r(3);e.scaleGamma32=a,e.scaleGamma16=i,e.scaleNoGamma=n,e.scale=h},function(t,e,r){"use strict";function a(t,e){for(var r=new Uint8Array(t.data.buffer,t.data.byteOffset,t.data.byteLength),a=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength),i=t.data.length,n=0;n<i;++n)a[n]=r[n]}function i(t,e){for(var r=new Uint8Array(t.data.buffer,t.data.byteOffset,t.data.length),a=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.length),i=t.width,n=e.width,h=0|u.lcm(i,n),o=h/i|0,f=h/n|0,d=new Int32Array(n+1),l=new Int32Array(n+1),w=0;w<=n;++w)l[w]=u.imul(f,w+1)%o,d[w]=u.imul(f,w)/o|0;for(var s=e.height,c=t.width<<2,m=e.width<<2,v=0;v<s;++v)for(var g=u.imul(v,m),y=u.imul(v,c),p=0,b=0;p<n;++p){var A=d[p],O=d[p+1],U=o-b;b=l[p];var M=0,_=0,j=0,x=0,z=0;0!==U&&(z=u.imul(r[y+3],U),_+=u.imul(r[y+0],z),j+=u.imul(r[y+1],z),x+=u.imul(r[y+2],z),M+=z,y+=4);for(var w=A+1;w<O;++w)z=u.imul(r[y+3],o),_+=u.imul(r[y+0],z),j+=u.imul(r[y+1],z),x+=u.imul(r[y+2],z),M+=z,y+=4;0!==b&&(z=u.imul(r[y+3],b),_+=u.imul(r[y+0],z),j+=u.imul(r[y+1],z),x+=u.imul(r[y+2],z),M+=z),0===M?(a[g+0]=0,a[g+1]=0,a[g+2]=0,a[g+3]=0):(a[g+0]=_/M|0,a[g+1]=j/M|0,a[g+2]=x/M|0,a[g+3]=M/f|0),g+=4}}function n(t,e){for(var r=t.data,a=e.data,i=t.width,n=e.width,h=0|u.lcm(i,n),o=h/i|0,f=h/n|0,d=new Int32Array(n+1),l=new Int32Array(n+1),w=0;w<=n;++w)l[w]=u.imul(f,w+1)%o,d[w]=u.imul(f,w)/o|0;for(var s=e.height,c=t.width<<2,m=e.width<<2,v=0;v<s;++v)for(var g=u.imul(v,m),y=u.imul(v,c),p=0,b=0;p<n;++p){var A=d[p],O=d[p+1],U=o-b;b=l[p];var M=0,_=0,j=0,x=0,z=0;0!==U&&(z=r[y+3]*U,_+=r[y+0]*z,j+=r[y+1]*z,x+=r[y+2]*z,M+=z,y+=4);for(var w=A+1;w<O;++w)z=r[y+3]*o,_+=r[y+0]*z,j+=r[y+1]*z,x+=r[y+2]*z,M+=z,y+=4;0!==b&&(z=r[y+3]*b,_+=r[y+0]*z,j+=r[y+1]*z,x+=r[y+2]*z,M+=z),0===M?(a[g+0]=0,a[g+1]=0,a[g+2]=0,a[g+3]=0):(a[g+0]=_/M,a[g+1]=j/M,a[g+2]=x/M,a[g+3]=M/f),g+=4}}function h(t,e){for(var r=new Uint8Array(t.data.buffer,t.data.byteOffset,t.data.length),a=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.length),i=t.height,n=e.height,h=u.lcm(i,n),o=h/i|0,f=h/n|0,d=new Int32Array(n+1),l=new Int32Array(n+1),w=0;w<=n;++w)l[w]=u.imul(f,w+1)%o,d[w]=u.imul(f,w)/o|0;for(var s=t.width<<2,c=e.width<<2,m=0;m<c;m+=4)for(var v=m,g=m,y=0,p=0;y<n;++y){var b=d[y],A=d[y+1],O=o-p;p=l[y];var U=0,M=0,_=0,j=0,x=0;0!==O&&(x=u.imul(r[g+3],O),M+=u.imul(r[g+0],x),_+=u.imul(r[g+1],x),j+=u.imul(r[g+2],x),U+=x,g+=s);for(var w=b+1;w<A;++w)x=u.imul(r[g+3],o),M+=u.imul(r[g+0],x),_+=u.imul(r[g+1],x),j+=u.imul(r[g+2],x),U+=x,g+=s;0!==p&&(x=u.imul(r[g+3],p),M+=u.imul(r[g+0],x),_+=u.imul(r[g+1],x),j+=u.imul(r[g+2],x),U+=x),0===U?(a[v+0]=0,a[v+1]=0,a[v+2]=0,a[v+3]=0):(a[v+0]=M/U|0,a[v+1]=_/U|0,a[v+2]=j/U|0,a[v+3]=U/f|0),v+=c}}function o(t,e){for(var r=t.data,a=e.data,i=t.height,n=e.height,h=u.lcm(i,n),o=h/i|0,f=h/n|0,d=new Int32Array(n+1),l=new Int32Array(n+1),w=0;w<=n;++w)l[w]=u.imul(f,w+1)%o,d[w]=u.imul(f,w)/o|0;for(var s=t.width<<2,c=e.width<<2,m=0;m<c;m+=4)for(var v=m,g=m,y=0,p=0;y<n;++y){var b=d[y],A=d[y+1],O=o-p;p=l[y];var U=0,M=0,_=0,j=0,x=0;0!==O&&(x=r[g+3]*O,M+=r[g+0]*x,_+=r[g+1]*x,j+=r[g+2]*x,U+=x,g+=s);for(var w=b+1;w<A;++w)x=r[g+3]*o,M+=r[g+0]*x,_+=r[g+1]*x,j+=r[g+2]*x,U+=x,g+=s;0!==p&&(x=r[g+3]*p,M+=r[g+0]*x,_+=r[g+1]*x,j+=r[g+2]*x,U+=x),0===U?(a[v+0]=0,a[v+1]=0,a[v+2]=0,a[v+3]=0):(a[v+0]=M/U,a[v+1]=_/U,a[v+2]=j/U,a[v+3]=U/f),v+=c}}Object.defineProperty(e,"__esModule",{value:!0});var u=r(0);e.copy=a,e.horz8=i,e.horz=n,e.vert8=h,e.vert=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a=r(0),i=function(){function t(t){for(var e=new Uint16Array(256),r=0;r<256;++r)e[r]=65535*Math.pow(r/255,t)|0;this.table=e,t=1/t;for(var a=new Uint8Array(65536),r=0;r<65536;++r)a[r]=255*Math.pow(r/65535,t)|0;this.revTable=a}return t.prototype.apply=function(t){for(var e={width:t.width,height:t.height,data:new Uint16Array(t.data.length)},r=this.table,i=new Uint8Array(t.data.buffer,t.data.byteOffset,t.data.length),n=e.data,h=t.data.length,o=0;o<h;o+=4)n[o+0]=r[i[o+0]],n[o+1]=r[i[o+1]],n[o+2]=r[i[o+2]],n[o+3]=a.imul(i[o+3],257);return e},t.prototype.restore=function(t,e){for(var r=this.revTable,a=t.data,i=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.length),n=t.data.length,h=0;h<n;h+=4)i[h+0]=r[a[h+0]],i[h+1]=r[a[h+1]],i[h+2]=r[a[h+2]],i[h+3]=a[h+3]>>8},t}();e.Gamma16=i;var n=function(){function t(t){for(var e=new Float32Array(256),r=0;r<256;++r)e[r]=Math.pow(r/255,t);this.table=e}return t.prototype.reverseLookup=function(t){for(var e,r=this.table,a=0,i=r.length-1;i-a>1;)e=a+i>>1,r[e]<=t?a=e:i=e;return t-r[a]<=r[i]-t?a:i},t.prototype.apply=function(t){for(var e={width:t.width,height:t.height,data:new Float32Array(t.data.length)},r=this.table,a=new Uint8Array(t.data.buffer,t.data.byteOffset,t.data.length),i=e.data,n=t.data.length,h=0;h<n;h+=4)i[h+0]=r[a[h+0]],i[h+1]=r[a[h+1]],i[h+2]=r[a[h+2]],i[h+3]=a[h+3]/255;return e},t.prototype.restore=function(t,e){for(var r=t.data,a=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.length),i=t.data.length,n=0;n<i;n+=4)a[n+0]=this.reverseLookup(r[n+0]),a[n+1]=this.reverseLookup(r[n+1]),a[n+2]=this.reverseLookup(r[n+2]),a[n+3]=255*r[n+3]|0},t}();e.Gamma32=n}])});