diff --git a/codecs/imagequant/build.sh b/codecs/imagequant/build.sh index f9e7b45b..b2852655 100755 --- a/codecs/imagequant/build.sh +++ b/codecs/imagequant/build.sh @@ -11,12 +11,9 @@ echo "=============================================" echo "Compiling libimagequant" echo "=============================================" ( - emcc \ - ${OPTIMIZE} \ - -I node_modules/libimagequant \ - --std=c99 \ - -c \ - node_modules/libimagequant/{libimagequant,pam,mediancut,blur,mempool,kmeans,nearest}.c + cd node_modules/libimagequant + emconfigure ./configure --disable-sse + emmake make static -j`nproc` ) echo "=============================================" echo "Compiling wasm module" @@ -31,9 +28,10 @@ echo "=============================================" -s 'EXPORT_NAME="imagequant"' \ -I node_modules/libimagequant \ -o ./imagequant.js \ - --std=c++11 *.o \ + --std=c++11 \ -x c++ \ - imagequant.cpp + imagequant.cpp \ + node_modules/libimagequant/libimagequant.a ) echo "=============================================" echo "Compiling wasm module done" diff --git a/codecs/imagequant/imagequant.js b/codecs/imagequant/imagequant.js index 6ff3c366..c4506d11 100644 --- a/codecs/imagequant/imagequant.js +++ b/codecs/imagequant/imagequant.js @@ -11,61 +11,61 @@ if(ba)A=z?require("path").dirname(A)+"/":__dirname+"/",da=function(a,b){ea||(ea= else if(ca)"undefined"!=typeof read&&(da=function(a){return read(a)}),B=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");"object"===typeof a||C("Assertion failed: undefined");return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(aa||z)z?A=self.location.href:document.currentScript&&(A=document.currentScript.src),_scriptDir&& (A=_scriptDir),0!==A.indexOf("blob:")?A=A.substr(0,A.lastIndexOf("/")+1):A="",da=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},z&&(B=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var ia=e.print||console.log.bind(console),E=e.printErr||console.warn.bind(console);for(t in r)r.hasOwnProperty(t)&&(e[t]=r[t]);r=null;var F;e.wasmBinary&&(F=e.wasmBinary);var noExitRuntime; e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);"object"!==typeof WebAssembly&&E("no native wasm support detected");var G,ja=new WebAssembly.Table({initial:49,maximum:49,element:"anyfunc"}),ka=!1,la="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0; -function ma(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function na(a){return a?ma(H,a,void 0):""} -function oa(a,b,c){var d=H;if(0=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var pa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0; -function qa(a){var b;for(b=a>>1;I[b];)++b;b<<=1;if(32>1];if(0==d)return c;++b;c+=String.fromCharCode(d)}}function ra(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f>1]=a.charCodeAt(f),b+=2;I[b>>1]=0;return b-d}function sa(a){return 2*a.length} -function ta(a){for(var b=0,c="";;){var d=J[a+4*b>>2];if(0==d)return c;++b;65536<=d?(d-=65536,c+=String.fromCharCode(55296|d>>10,56320|d&1023)):c+=String.fromCharCode(d)}}function ua(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}J[b>>2]=g;b+=4;if(b+4>c)break}J[b>>2]=0;return b-d} -function va(a){for(var b=0,c=0;c=d&&++c;b+=4}return b}var K,wa,H,I,xa,J,L,ya,za;function Aa(a){K=a;e.HEAP8=wa=new Int8Array(a);e.HEAP16=I=new Int16Array(a);e.HEAP32=J=new Int32Array(a);e.HEAPU8=H=new Uint8Array(a);e.HEAPU16=xa=new Uint16Array(a);e.HEAPU32=L=new Uint32Array(a);e.HEAPF32=ya=new Float32Array(a);e.HEAPF64=za=new Float64Array(a)}var Ba=e.INITIAL_MEMORY||16777216;e.wasmMemory?G=e.wasmMemory:G=new WebAssembly.Memory({initial:Ba/65536}); -G&&(K=G.buffer);Ba=K.byteLength;Aa(K);J[1848]=5250432;function Ca(a){for(;0=b?"_"+a:a} -function Sa(a,b){a=Ra(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Ta(a){var b=Error,c=Sa(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c} -var Ua=void 0;function S(a){throw new Ua(a);}var Va=void 0;function Wa(a){throw new Va(a);}function Xa(a,b,c){function d(h){h=c(h);h.length!==a.length&&Wa("Mismatched type converter count");for(var k=0;k>2])}function rb(a,b,c){if(b===c)return a;if(void 0===c.Z)return null;a=rb(a,b,c.Z);return null===a?null:c.ra(a)}var sb={}; -function tb(a,b){for(void 0===b&&S("ptr should not be undefined");a.Z;)b=a.ga(b),a=a.Z;return sb[b]}function ub(a,b){b.W&&b.U||Wa("makeClassHandle requires ptr and ptrType");!!b.Y!==!!b.X&&Wa("Both smartPtrType and smartPtr must be specified");b.count={value:1};return cb(Object.create(a,{T:{value:b}}))} -function W(a,b,c,d){this.name=a;this.V=b;this.ka=c;this.ha=d;this.ia=!1;this.da=this.ya=this.xa=this.oa=this.za=this.wa=void 0;void 0!==b.Z?this.toWireType=mb:(this.toWireType=d?lb:ob,this.aa=null)}function vb(a,b,c){e.hasOwnProperty(a)||Wa("Replacing nonexistant public symbol");void 0!==e[a].$&&void 0!==c?e[a].$[c]=b:(e[a]=b,e[a].pa=c)} -function X(a,b){a=P(a);var c=e["dynCall_"+a];for(var d=[],f=1;f>2])};case 3:return function(c){return this.fromWireType(za[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Fb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Sa(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c} -function Gb(a,b){for(var c=[],d=0;d>2)+d]);return c}function Hb(a,b,c){switch(b){case 0:return c?function(d){return wa[d]}:function(d){return H[d]};case 1:return c?function(d){return I[d>>1]}:function(d){return xa[d>>1]};case 2:return c?function(d){return J[d>>2]}:function(d){return L[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}for(var Ib=[null,[],[]],Jb=Array(256),Kb=0;256>Kb;++Kb)Jb[Kb]=String.fromCharCode(Kb);Pa=Jb;Ua=e.BindingError=Ta("BindingError"); -Va=e.InternalError=Ta("InternalError");U.prototype.isAliasOf=function(a){if(!(this instanceof U&&a instanceof U))return!1;var b=this.T.W.V,c=this.T.U,d=a.T.W.V;for(a=a.T.U;b.Z;)c=b.ga(c),b=b.Z;for(;d.Z;)a=d.ga(a),d=d.Z;return b===d&&c===a};U.prototype.clone=function(){this.T.U||Za(this);if(this.T.fa)return this.T.count.value+=1,this;var a=cb(Object.create(Object.getPrototypeOf(this),{T:{value:Ya(this.T)}}));a.T.count.value+=1;a.T.ea=!1;return a}; -U.prototype["delete"]=function(){this.T.U||Za(this);this.T.ea&&!this.T.fa&&S("Object already scheduled for deletion");ab(this);bb(this.T);this.T.fa||(this.T.X=void 0,this.T.U=void 0)};U.prototype.isDeleted=function(){return!this.T.U};U.prototype.deleteLater=function(){this.T.U||Za(this);this.T.ea&&!this.T.fa&&S("Object already scheduled for deletion");eb.push(this);1===eb.length&&db&&db(fb);this.T.ea=!0;return this};W.prototype.ua=function(a){this.oa&&(a=this.oa(a));return a}; -W.prototype.na=function(a){this.da&&this.da(a)};W.prototype.argPackAdvance=8;W.prototype.readValueFromPointer=pb;W.prototype.deleteObject=function(a){if(null!==a)a["delete"]()}; -W.prototype.fromWireType=function(a){function b(){return this.ia?ub(this.V.ba,{W:this.wa,U:c,Y:this,X:a}):ub(this.V.ba,{W:this,U:a})}var c=this.ua(a);if(!c)return this.na(a),null;var d=tb(this.V,c);if(void 0!==d){if(0===d.T.count.value)return d.T.U=c,d.T.X=a,d.clone();d=d.clone();this.na(a);return d}d=this.V.ta(c);d=gb[d];if(!d)return b.call(this);d=this.ha?d.qa:d.pointerType;var f=rb(c,this.V,d.V);return null===f?b.call(this):this.ia?ub(d.V.ba,{W:d,U:f,Y:this,X:a}):ub(d.V.ba,{W:d,U:f})}; -e.getInheritedInstanceCount=function(){return Object.keys(sb).length};e.getLiveInheritedInstances=function(){var a=[],b;for(b in sb)sb.hasOwnProperty(b)&&a.push(sb[b]);return a};e.flushPendingDeletes=fb;e.setDelayFunction=function(a){db=a;eb.length&&db&&db(fb)};wb=e.UnboundTypeError=Ta("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b>g])},aa:null})},o:function(a,b,c,d,f,g,n,h,k,l,m,q,v){m= -P(m);g=X(f,g);h&&(h=X(n,h));l&&(l=X(k,l));v=X(q,v);var u=Ra(m);ib(u,function(){zb("Cannot construct "+m+" due to unbound types",[d])});Xa([a,b,c],d?[d]:[],function(p){p=p[0];if(d){var w=p.V;var x=w.ba}else x=U.prototype;p=Sa(u,function(){if(Object.getPrototypeOf(this)!==y)throw new Ua("Use 'new' to construct "+m);if(void 0===D.ma)throw new Ua(m+" has no accessible constructor");var qb=D.ma[arguments.length];if(void 0===qb)throw new Ua("Tried to invoke ctor of "+m+" with invalid number of parameters ("+ -arguments.length+") - expected ("+Object.keys(D.ma).toString()+") parameters instead!");return qb.apply(this,arguments)});var y=Object.create(x,{constructor:{value:p}});p.prototype=y;var D=new jb(m,p,y,v,w,g,h,l);w=new W(m,D,!0,!1);x=new W(m+"*",D,!1,!1);var fa=new W(m+" const*",D,!1,!0);gb[a]={pointerType:x,qa:fa};vb(u,p);return[w,x,fa]})},e:function(a,b,c,d,f,g,n,h,k,l){b=P(b);f=X(d,f);Xa([],[a],function(m){m=m[0];var q=m.name+"."+b,v={get:function(){zb("Cannot access "+q+" due to unbound types", -[c,n])},enumerable:!0,configurable:!0};k?v.set=function(){zb("Cannot access "+q+" due to unbound types",[c,n])}:v.set=function(){S(q+" is a read-only property")};Object.defineProperty(m.V.ba,b,v);Xa([],k?[c,n]:[c],function(u){var p=u[0],w={get:function(){var y=Bb(this,m,q+" getter");return p.fromWireType(f(g,y))},enumerable:!0};if(k){k=X(h,k);var x=u[1];w.set=function(y){var D=Bb(this,m,q+" setter"),fa=[];k(l,D,x.toWireType(fa,y));Ab(fa)}}Object.defineProperty(m.V.ba,b,w);return[]});return[]})},t:function(a, -b){b=P(b);T(a,{name:b,fromWireType:function(c){var d=Z[c].value;Db(c);return d},toWireType:function(c,d){return nb(d)},argPackAdvance:8,readValueFromPointer:pb,aa:null})},j:function(a,b,c){c=Oa(c);b=P(b);T(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+V(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Eb(b,c),aa:null})},d:function(a,b,c,d,f,g){var n=Gb(b,c);a=P(a);f=X(d, -f);ib(a,function(){zb("Cannot call "+a+" due to unbound types",n)},b-1);Xa([],n,function(h){var k=[h[0],null].concat(h.slice(1)),l=h=a,m=f,q=k.length;2>q&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var v=null!==k[1]&&!1,u=!1,p=1;p>>h}}var k=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(l,m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+V(m)+'" to '+this.name);if(mf)throw new TypeError('Passing a number "'+V(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:Hb(b,n,0!==d), -aa:null})},a:function(a,b,c){function d(g){g>>=2;var n=L;return new f(K,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=P(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{va:!0})},k:function(a,b){b=P(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var f=L[d>>2];if(c){var g=H[d+4+f],n=0;0!=g&&(n=g,H[d+4+f]=0);var h=d+4;for(g=0;g<=f;++g){var k=d+4+g;if(0==H[k]){h=na(h);if(void 0===l)var l=h; -else l+=String.fromCharCode(0),l+=h;h=k+1}}0!=n&&(H[d+4+f]=n)}else{l=Array(f);for(g=0;g=q&&(q=65536+((q&1023)<<10)| -f.charCodeAt(++m)&1023);127>=q?++l:l=2047>=q?l+2:65535>=q?l+3:l+4}return l}:function(){return f.length})(),h=Lb(4+n+1);L[h>>2]=n;if(c&&g)oa(f,h+4,n+1);else if(g)for(g=0;g>2],m=n(),q=m[k+4+l*b>>h],v=0;0!=q&&(v=q,m[k+4+l*b>>h]=0);var u=k+4;for(q=0;q<=l;++q){var p=k+4+q*b;if(0==m[p>>h]){u=d(u);if(void 0===w)var w=u;else w+=String.fromCharCode(0),w+=u;u=p+b}}0!=v&&(m[k+4+l*b>>h]=v);Y(k);return w},toWireType:function(k,l){"string"!==typeof l&&S("Cannot pass non-string to C++ string type "+c);var m=g(l),q=Lb(4+m+b);L[q>>2]=m>>h;f(l,q+4,m+b);null!==k&&k.push(Y, -q);return q},argPackAdvance:8,readValueFromPointer:pb,aa:function(k){Y(k)}})},v:function(a,b){b=P(b);T(a,{Aa:!0,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},h:Db,n:function(a){4=c;c*=2){var d=b*(1+ -.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0>16);Aa(G.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},m:function(){return 0},p:function(){},g:function(a,b,c,d){for(var f=0,g=0;g>2],h=J[b+(8*g+4)>>2],k=0;k>2]=f;return 0},memory:G,q:function(){},table:ja},Nb=function(){function a(f){e.asm= -f.exports;M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==Ia&&(clearInterval(Ia),Ia=null),N&&(f=N,N=null,f()))}function b(f){a(f.instance)}function c(f){return Ma().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);C(g)})}var d={a:Mb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+ -f),!1}(function(){if(F||"function"!==typeof WebAssembly.instantiateStreaming||Ja()||"function"!==typeof fetch)return c(b);fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");c(b)})})})();return{}}();e.asm=Nb; -var Na=e.___wasm_call_ctors=function(){return(Na=e.___wasm_call_ctors=e.asm.w).apply(null,arguments)},Lb=e._malloc=function(){return(Lb=e._malloc=e.asm.x).apply(null,arguments)},Y=e._free=function(){return(Y=e._free=e.asm.y).apply(null,arguments)},yb=e.___getTypeName=function(){return(yb=e.___getTypeName=e.asm.z).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.A).apply(null,arguments)}; -e.dynCall_ii=function(){return(e.dynCall_ii=e.asm.B).apply(null,arguments)};e.dynCall_vi=function(){return(e.dynCall_vi=e.asm.C).apply(null,arguments)};e.dynCall_vif=function(){return(e.dynCall_vif=e.asm.D).apply(null,arguments)};e.dynCall_iii=function(){return(e.dynCall_iii=e.asm.E).apply(null,arguments)};e.dynCall_viii=function(){return(e.dynCall_viii=e.asm.F).apply(null,arguments)};e.dynCall_viiiiif=function(){return(e.dynCall_viiiiif=e.asm.G).apply(null,arguments)}; -e.dynCall_viiiif=function(){return(e.dynCall_viiiif=e.asm.H).apply(null,arguments)};e.dynCall_i=function(){return(e.dynCall_i=e.asm.I).apply(null,arguments)};e.dynCall_v=function(){return(e.dynCall_v=e.asm.J).apply(null,arguments)};e.dynCall_iiiiiif=function(){return(e.dynCall_iiiiiif=e.asm.K).apply(null,arguments)};e.dynCall_iiiiif=function(){return(e.dynCall_iiiiif=e.asm.L).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.M).apply(null,arguments)}; -e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.N).apply(null,arguments)};e.dynCall_iidiiii=function(){return(e.dynCall_iidiiii=e.asm.O).apply(null,arguments)};e.dynCall_vii=function(){return(e.dynCall_vii=e.asm.P).apply(null,arguments)};e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.Q).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.R).apply(null,arguments)};e.dynCall_viiii=function(){return(e.dynCall_viiii=e.asm.S).apply(null,arguments)}; -e.asm=Nb;var Ob;e.then=function(a){if(Ob)a(e);else{var b=e.onRuntimeInitialized;e.onRuntimeInitialized=function(){b&&b();a(e)}}return e};N=function Pb(){Ob||Qb();Ob||(N=Pb)}; -function Qb(){function a(){if(!Ob&&(Ob=!0,e.calledRun=!0,!ka)){Ca(Ea);Ca(Fa);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Ga.unshift(b)}Ca(Ga)}}if(!(0=d);)++c;if(16f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d} +function na(a,b,c){var d=H;if(0=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}if(127>=g){if(b>=c)break;d[b++]=g}else{if(2047>=g){if(b+1>=c)break;d[b++]=192|g>>6}else{if(65535>=g){if(b+2>=c)break;d[b++]=224|g>>12}else{if(b+3>=c)break;d[b++]=240|g>>18;d[b++]=128|g>>12&63}d[b++]=128|g>>6&63}d[b++]=128|g&63}}d[b]=0}}var oa="undefined"!==typeof TextDecoder?new TextDecoder("utf-16le"):void 0; +function pa(a){var b;for(b=a>>1;I[b];)++b;b<<=1;if(32>1];if(0==d)return c;++b;c+=String.fromCharCode(d)}}function qa(a,b,c){void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var f=0;f>1]=a.charCodeAt(f),b+=2;I[b>>1]=0;return b-d}function ra(a){return 2*a.length} +function sa(a){for(var b=0,c="";;){var d=J[a+4*b>>2];if(0==d)return c;++b;65536<=d?(d-=65536,c+=String.fromCharCode(55296|d>>10,56320|d&1023)):c+=String.fromCharCode(d)}}function ta(a,b,c){void 0===c&&(c=2147483647);if(4>c)return 0;var d=b;c=d+c-4;for(var f=0;f=g){var n=a.charCodeAt(++f);g=65536+((g&1023)<<10)|n&1023}J[b>>2]=g;b+=4;if(b+4>c)break}J[b>>2]=0;return b-d} +function ua(a){for(var b=0,c=0;c=d&&++c;b+=4}return b}var K,va,H,I,wa,J,L,xa,ya;function za(a){K=a;e.HEAP8=va=new Int8Array(a);e.HEAP16=I=new Int16Array(a);e.HEAP32=J=new Int32Array(a);e.HEAPU8=H=new Uint8Array(a);e.HEAPU16=wa=new Uint16Array(a);e.HEAPU32=L=new Uint32Array(a);e.HEAPF32=xa=new Float32Array(a);e.HEAPF64=ya=new Float64Array(a)}var Aa=e.INITIAL_MEMORY||16777216;e.wasmMemory?G=e.wasmMemory:G=new WebAssembly.Memory({initial:Aa/65536}); +G&&(K=G.buffer);Aa=K.byteLength;za(K);J[1660]=5249680;function Ba(a){for(;0=b?"_"+a:a} +function Ra(a,b){a=Qa(a);return(new Function("body","return function "+a+'() {\n "use strict"; return body.apply(this, arguments);\n};\n'))(b)}function Sa(a){var b=Error,c=Ra(a,function(d){this.name=a;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(b.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message};return c} +var Ta=void 0;function S(a){throw new Ta(a);}var Ua=void 0;function Va(a){throw new Ua(a);}function Wa(a,b,c){function d(h){h=c(h);h.length!==a.length&&Va("Mismatched type converter count");for(var k=0;k>2])}function qb(a,b,c){if(b===c)return a;if(void 0===c.Y)return null;a=qb(a,b,c.Y);return null===a?null:c.qa(a)}var rb={}; +function sb(a,b){for(void 0===b&&S("ptr should not be undefined");a.Y;)b=a.fa(b),a=a.Y;return rb[b]}function tb(a,b){b.V&&b.T||Va("makeClassHandle requires ptr and ptrType");!!b.X!==!!b.W&&Va("Both smartPtrType and smartPtr must be specified");b.count={value:1};return bb(Object.create(a,{S:{value:b}}))} +function W(a,b,c,d){this.name=a;this.U=b;this.ja=c;this.ga=d;this.ha=!1;this.ba=this.xa=this.wa=this.na=this.ya=this.va=void 0;void 0!==b.Y?this.toWireType=lb:(this.toWireType=d?kb:nb,this.$=null)}function ub(a,b,c){e.hasOwnProperty(a)||Va("Replacing nonexistant public symbol");void 0!==e[a].Z&&void 0!==c?e[a].Z[c]=b:(e[a]=b,e[a].oa=c)} +function X(a,b){a=P(a);var c=e["dynCall_"+a];for(var d=[],f=1;f>2])};case 3:return function(c){return this.fromWireType(ya[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}function Eb(a){var b=Function;if(!(b instanceof Function))throw new TypeError("new_ called with constructor type "+typeof b+" which is not a function");var c=Ra(b.name||"unknownFunctionName",function(){});c.prototype=b.prototype;c=new c;a=b.apply(c,a);return a instanceof Object?a:c} +function Fb(a,b){for(var c=[],d=0;d>2)+d]);return c}function Gb(a,b,c){switch(b){case 0:return c?function(d){return va[d]}:function(d){return H[d]};case 1:return c?function(d){return I[d>>1]}:function(d){return wa[d>>1]};case 2:return c?function(d){return J[d>>2]}:function(d){return L[d>>2]};default:throw new TypeError("Unknown integer type: "+a);}}for(var Hb=[null,[],[]],Ib=Array(256),Jb=0;256>Jb;++Jb)Ib[Jb]=String.fromCharCode(Jb);Oa=Ib;Ta=e.BindingError=Sa("BindingError"); +Ua=e.InternalError=Sa("InternalError");U.prototype.isAliasOf=function(a){if(!(this instanceof U&&a instanceof U))return!1;var b=this.S.V.U,c=this.S.T,d=a.S.V.U;for(a=a.S.T;b.Y;)c=b.fa(c),b=b.Y;for(;d.Y;)a=d.fa(a),d=d.Y;return b===d&&c===a};U.prototype.clone=function(){this.S.T||Ya(this);if(this.S.ea)return this.S.count.value+=1,this;var a=bb(Object.create(Object.getPrototypeOf(this),{S:{value:Xa(this.S)}}));a.S.count.value+=1;a.S.da=!1;return a}; +U.prototype["delete"]=function(){this.S.T||Ya(this);this.S.da&&!this.S.ea&&S("Object already scheduled for deletion");$a(this);ab(this.S);this.S.ea||(this.S.W=void 0,this.S.T=void 0)};U.prototype.isDeleted=function(){return!this.S.T};U.prototype.deleteLater=function(){this.S.T||Ya(this);this.S.da&&!this.S.ea&&S("Object already scheduled for deletion");db.push(this);1===db.length&&cb&&cb(eb);this.S.da=!0;return this};W.prototype.ta=function(a){this.na&&(a=this.na(a));return a}; +W.prototype.ma=function(a){this.ba&&this.ba(a)};W.prototype.argPackAdvance=8;W.prototype.readValueFromPointer=ob;W.prototype.deleteObject=function(a){if(null!==a)a["delete"]()}; +W.prototype.fromWireType=function(a){function b(){return this.ha?tb(this.U.aa,{V:this.va,T:c,X:this,W:a}):tb(this.U.aa,{V:this,T:a})}var c=this.ta(a);if(!c)return this.ma(a),null;var d=sb(this.U,c);if(void 0!==d){if(0===d.S.count.value)return d.S.T=c,d.S.W=a,d.clone();d=d.clone();this.ma(a);return d}d=this.U.sa(c);d=fb[d];if(!d)return b.call(this);d=this.ga?d.pa:d.pointerType;var f=qb(c,this.U,d.U);return null===f?b.call(this):this.ha?tb(d.U.aa,{V:d,T:f,X:this,W:a}):tb(d.U.aa,{V:d,T:f})}; +e.getInheritedInstanceCount=function(){return Object.keys(rb).length};e.getLiveInheritedInstances=function(){var a=[],b;for(b in rb)rb.hasOwnProperty(b)&&a.push(rb[b]);return a};e.flushPendingDeletes=eb;e.setDelayFunction=function(a){cb=a;db.length&&cb&&cb(eb)};vb=e.UnboundTypeError=Sa("UnboundTypeError");e.count_emval_handles=function(){for(var a=0,b=5;b>g])},$:null})},p:function(a,b,c,d,f,g,n,h,k,l,m,q,v){m=P(m);g=X(f,g);h&&(h=X(n,h));l&&(l=X(k,l));v=X(q,v);var u=Qa(m);hb(u,function(){yb("Cannot construct "+m+" due to unbound types", +[d])});Wa([a,b,c],d?[d]:[],function(p){p=p[0];if(d){var w=p.U;var x=w.aa}else x=U.prototype;p=Ra(u,function(){if(Object.getPrototypeOf(this)!==y)throw new Ta("Use 'new' to construct "+m);if(void 0===D.la)throw new Ta(m+" has no accessible constructor");var pb=D.la[arguments.length];if(void 0===pb)throw new Ta("Tried to invoke ctor of "+m+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(D.la).toString()+") parameters instead!");return pb.apply(this,arguments)}); +var y=Object.create(x,{constructor:{value:p}});p.prototype=y;var D=new ib(m,p,y,v,w,g,h,l);w=new W(m,D,!0,!1);x=new W(m+"*",D,!1,!1);var fa=new W(m+" const*",D,!1,!0);fb[a]={pointerType:x,pa:fa};ub(u,p);return[w,x,fa]})},d:function(a,b,c,d,f,g,n,h,k,l){b=P(b);f=X(d,f);Wa([],[a],function(m){m=m[0];var q=m.name+"."+b,v={get:function(){yb("Cannot access "+q+" due to unbound types",[c,n])},enumerable:!0,configurable:!0};k?v.set=function(){yb("Cannot access "+q+" due to unbound types",[c,n])}:v.set=function(){S(q+ +" is a read-only property")};Object.defineProperty(m.U.aa,b,v);Wa([],k?[c,n]:[c],function(u){var p=u[0],w={get:function(){var y=Ab(this,m,q+" getter");return p.fromWireType(f(g,y))},enumerable:!0};if(k){k=X(h,k);var x=u[1];w.set=function(y){var D=Ab(this,m,q+" setter"),fa=[];k(l,D,x.toWireType(fa,y));zb(fa)}}Object.defineProperty(m.U.aa,b,w);return[]});return[]})},t:function(a,b){b=P(b);T(a,{name:b,fromWireType:function(c){var d=Z[c].value;Cb(c);return d},toWireType:function(c,d){return mb(d)},argPackAdvance:8, +readValueFromPointer:ob,$:null})},h:function(a,b,c){c=Na(c);b=P(b);T(a,{name:b,fromWireType:function(d){return d},toWireType:function(d,f){if("number"!==typeof f&&"boolean"!==typeof f)throw new TypeError('Cannot convert "'+V(f)+'" to '+this.name);return f},argPackAdvance:8,readValueFromPointer:Db(b,c),$:null})},c:function(a,b,c,d,f,g){var n=Fb(b,c);a=P(a);f=X(d,f);hb(a,function(){yb("Cannot call "+a+" due to unbound types",n)},b-1);Wa([],n,function(h){var k=[h[0],null].concat(h.slice(1)),l=h=a,m= +f,q=k.length;2>q&&S("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var v=null!==k[1]&&!1,u=!1,p=1;p>>h}}var k=-1!=b.indexOf("unsigned");T(a,{name:b,fromWireType:g,toWireType:function(l, +m){if("number"!==typeof m&&"boolean"!==typeof m)throw new TypeError('Cannot convert "'+V(m)+'" to '+this.name);if(mf)throw new TypeError('Passing a number "'+V(m)+'" from JS side to C/C++ side to an argument of type "'+b+'", which is outside the valid range ['+d+", "+f+"]!");return k?m>>>0:m|0},argPackAdvance:8,readValueFromPointer:Gb(b,n,0!==d),$:null})},a:function(a,b,c){function d(g){g>>=2;var n=L;return new f(K,n[g+1],n[g])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array, +Float32Array,Float64Array][b];c=P(c);T(a,{name:c,fromWireType:d,argPackAdvance:8,readValueFromPointer:d},{ua:!0})},i:function(a,b){b=P(b);var c="std::string"===b;T(a,{name:b,fromWireType:function(d){var f=L[d>>2];if(c){var g=H[d+4+f],n=0;0!=g&&(n=g,H[d+4+f]=0);var h=d+4;for(g=0;g<=f;++g){var k=d+4+g;if(0==H[k]){h=h?ma(H,h,void 0):"";if(void 0===l)var l=h;else l+=String.fromCharCode(0),l+=h;h=k+1}}0!=n&&(H[d+4+f]=n)}else{l=Array(f);for(g=0;g=q&&(q=65536+((q&1023)<<10)|f.charCodeAt(++m)&1023);127>=q?++l:l=2047>=q?l+2:65535>=q?l+3:l+4}return l}:function(){return f.length})(),h=Kb(4+n+1);L[h>>2]=n;if(c&&g)na(f,h+ +4,n+1);else if(g)for(g=0;g>2],m=n(),q=m[k+4+l*b>>h],v= +0;0!=q&&(v=q,m[k+4+l*b>>h]=0);var u=k+4;for(q=0;q<=l;++q){var p=k+4+q*b;if(0==m[p>>h]){u=d(u);if(void 0===w)var w=u;else w+=String.fromCharCode(0),w+=u;u=p+b}}0!=v&&(m[k+4+l*b>>h]=v);Y(k);return w},toWireType:function(k,l){"string"!==typeof l&&S("Cannot pass non-string to C++ string type "+c);var m=g(l),q=Kb(4+m+b);L[q>>2]=m>>h;f(l,q+4,m+b);null!==k&&k.push(Y,q);return q},argPackAdvance:8,readValueFromPointer:ob,$:function(k){Y(k)}})},l:function(a,b){b=P(b);T(a,{za:!0,name:b,argPackAdvance:0,fromWireType:function(){}, +toWireType:function(){}})},j:Cb,n:function(a){4=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0>16);za(G.buffer); +var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},m:function(){return 0},o:function(){},f:function(a,b,c,d){for(var f=0,g=0;g>2],h=J[b+(8*g+4)>>2],k=0;k>2]=f;return 0},memory:G,q:function(){},table:ja},Mb=function(){function a(f){e.asm=f.exports;M--;e.monitorRunDependencies&&e.monitorRunDependencies(M);0==M&&(null!==Ha&&(clearInterval(Ha),Ha=null),N&&(f=N,N=null,f()))} +function b(f){a(f.instance)}function c(f){return La().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);C(g)})}var d={a:Lb};M++;e.monitorRunDependencies&&e.monitorRunDependencies(M);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+f),!1}(function(){if(F||"function"!==typeof WebAssembly.instantiateStreaming||Ia()||"function"!==typeof fetch)return c(b); +fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");c(b)})})})();return{}}();e.asm=Mb; +var Ma=e.___wasm_call_ctors=function(){return(Ma=e.___wasm_call_ctors=e.asm.v).apply(null,arguments)},Kb=e._malloc=function(){return(Kb=e._malloc=e.asm.w).apply(null,arguments)},Y=e._free=function(){return(Y=e._free=e.asm.x).apply(null,arguments)},xb=e.___getTypeName=function(){return(xb=e.___getTypeName=e.asm.y).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.z).apply(null,arguments)}; +e.dynCall_ii=function(){return(e.dynCall_ii=e.asm.A).apply(null,arguments)};e.dynCall_vi=function(){return(e.dynCall_vi=e.asm.B).apply(null,arguments)};e.dynCall_iii=function(){return(e.dynCall_iii=e.asm.C).apply(null,arguments)};e.dynCall_viii=function(){return(e.dynCall_viii=e.asm.D).apply(null,arguments)};e.dynCall_viiiiif=function(){return(e.dynCall_viiiiif=e.asm.E).apply(null,arguments)};e.dynCall_viiiif=function(){return(e.dynCall_viiiif=e.asm.F).apply(null,arguments)}; +e.dynCall_i=function(){return(e.dynCall_i=e.asm.G).apply(null,arguments)};e.dynCall_v=function(){return(e.dynCall_v=e.asm.H).apply(null,arguments)};e.dynCall_iiiiiif=function(){return(e.dynCall_iiiiiif=e.asm.I).apply(null,arguments)};e.dynCall_iiiiif=function(){return(e.dynCall_iiiiif=e.asm.J).apply(null,arguments)};e.dynCall_vif=function(){return(e.dynCall_vif=e.asm.K).apply(null,arguments)};e.dynCall_iiii=function(){return(e.dynCall_iiii=e.asm.L).apply(null,arguments)}; +e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.M).apply(null,arguments)};e.dynCall_iidiiii=function(){return(e.dynCall_iidiiii=e.asm.N).apply(null,arguments)};e.dynCall_vii=function(){return(e.dynCall_vii=e.asm.O).apply(null,arguments)};e.dynCall_viiiiii=function(){return(e.dynCall_viiiiii=e.asm.P).apply(null,arguments)};e.dynCall_viiiii=function(){return(e.dynCall_viiiii=e.asm.Q).apply(null,arguments)};e.dynCall_viiii=function(){return(e.dynCall_viiii=e.asm.R).apply(null,arguments)}; +e.asm=Mb;var Nb;e.then=function(a){if(Nb)a(e);else{var b=e.onRuntimeInitialized;e.onRuntimeInitialized=function(){b&&b();a(e)}}return e};N=function Ob(){Nb||Pb();Nb||(N=Ob)}; +function Pb(){function a(){if(!Nb&&(Nb=!0,e.calledRun=!0,!ka)){Ba(Da);Ba(Ea);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();Fa.unshift(b)}Ba(Fa)}}if(!(0