31 lines
7.4 KiB
JavaScript
31 lines
7.4 KiB
JavaScript
|
|
||
|
var Module = (function() {
|
||
|
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
|
||
|
return (
|
||
|
function(Module) {
|
||
|
Module = Module || {};
|
||
|
|
||
|
var a;a||(a=typeof Module !== 'undefined' ? Module : {});var f={},g;for(g in a)a.hasOwnProperty(g)&&(f[g]=a[g]);a.arguments=[];a.thisProgram="./this.program";a.quit=function(b,c){throw c;};a.preRun=[];a.postRun=[];var h=!1,k=!1,l=!1,m=!1;h="object"===typeof window;k="function"===typeof importScripts;l="object"===typeof process&&"function"===typeof require&&!h&&!k;m=!h&&!l&&!k;var n="";
|
||
|
if(l){n=__dirname+"/";var p,q;a.read=function(b,c){p||(p=require("fs"));q||(q=require("path"));b=q.normalize(b);b=p.readFileSync(b);return c?b:b.toString()};a.readBinary=function(b){b=a.read(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||r("Assertion failed: undefined");return b};1<process.argv.length&&(a.thisProgram=process.argv[1].replace(/\\/g,"/"));a.arguments=process.argv.slice(2);process.on("uncaughtException",function(b){if(!(b instanceof t))throw b;});process.on("unhandledRejection",r);a.quit=
|
||
|
function(b){process.exit(b)};a.inspect=function(){return"[Emscripten Module object]"}}else if(m)"undefined"!=typeof read&&(a.read=function(b){return read(b)}),a.readBinary=function(b){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(b));b=read(b,"binary");"object"===typeof b||r("Assertion failed: undefined");return b},"undefined"!=typeof scriptArgs?a.arguments=scriptArgs:"undefined"!=typeof arguments&&(a.arguments=arguments),"function"===typeof quit&&(a.quit=function(b){quit(b)});
|
||
|
else if(h||k)k?n=self.location.href:document.currentScript&&(n=document.currentScript.src),_scriptDir&&(n=_scriptDir),0!==n.indexOf("blob:")?n=n.substr(0,n.lastIndexOf("/")+1):n="",a.read=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.send(null);return c.responseText},k&&(a.readBinary=function(b){var c=new XMLHttpRequest;c.open("GET",b,!1);c.responseType="arraybuffer";c.send(null);return new Uint8Array(c.response)}),a.readAsync=function(b,c,d){var e=new XMLHttpRequest;e.open("GET",b,!0);
|
||
|
e.responseType="arraybuffer";e.onload=function(){200==e.status||0==e.status&&e.response?c(e.response):d()};e.onerror=d;e.send(null)},a.setWindowTitle=function(b){document.title=b};var u=a.print||("undefined"!==typeof console?console.log.bind(console):"undefined"!==typeof print?print:null),v=a.printErr||("undefined"!==typeof printErr?printErr:"undefined"!==typeof console&&console.warn.bind(console)||u);for(g in f)f.hasOwnProperty(g)&&(a[g]=f[g]);f=void 0;
|
||
|
var w={"f64-rem":function(b,c){return b%c},"debugger":function(){debugger}};"object"!==typeof WebAssembly&&v("no native wasm support detected");var x,y=!1;"undefined"!==typeof TextDecoder&&new TextDecoder("utf8");"undefined"!==typeof TextDecoder&&new TextDecoder("utf-16le");function z(b){0<b%65536&&(b+=65536-b%65536);return b}var buffer,A,B;
|
||
|
function C(){a.HEAP8=A=new Int8Array(buffer);a.HEAP16=new Int16Array(buffer);a.HEAP32=B=new Int32Array(buffer);a.HEAPU8=new Uint8Array(buffer);a.HEAPU16=new Uint16Array(buffer);a.HEAPU32=new Uint32Array(buffer);a.HEAPF32=new Float32Array(buffer);a.HEAPF64=new Float64Array(buffer)}var E=a.TOTAL_MEMORY||16777216;5242880>E&&v("TOTAL_MEMORY should be larger than TOTAL_STACK, was "+E+"! (TOTAL_STACK=5242880)");
|
||
|
a.buffer?buffer=a.buffer:"object"===typeof WebAssembly&&"function"===typeof WebAssembly.Memory?(x=new WebAssembly.Memory({initial:E/65536}),buffer=x.buffer):buffer=new ArrayBuffer(E);C();B[684]=5245648;function F(b){for(;0<b.length;){var c=b.shift();if("function"==typeof c)c();else{var d=c.l;"number"===typeof d?void 0===c.j?a.dynCall_v(d):a.dynCall_vi(d,c.j):d(void 0===c.j?null:c.j)}}}var G=[],H=[],I=[],J=[],K=!1;function L(){var b=a.preRun.shift();G.unshift(b)}var M=0,N=null,O=null;
|
||
|
a.preloadedImages={};a.preloadedAudios={};function P(){var b=Q;return String.prototype.startsWith?b.startsWith("data:application/octet-stream;base64,"):0===b.indexOf("data:application/octet-stream;base64,")}var Q="simplify.wasm";if(!P()){var R=Q;Q=a.locateFile?a.locateFile(R,n):n+R}function S(){try{if(a.wasmBinary)return new Uint8Array(a.wasmBinary);if(a.readBinary)return a.readBinary(Q);throw"both async and sync fetching of the wasm failed";}catch(b){r(b)}}
|
||
|
function T(){return a.wasmBinary||!h&&!k||"function"!==typeof fetch?new Promise(function(b){b(S())}):fetch(Q,{credentials:"same-origin"}).then(function(b){if(!b.ok)throw"failed to load wasm binary file at '"+Q+"'";return b.arrayBuffer()}).catch(function(){return S()})}
|
||
|
function U(b){function c(b){a.asm=b.exports;M--;a.monitorRunDependencies&&a.monitorRunDependencies(M);0==M&&(null!==N&&(clearInterval(N),N=null),O&&(b=O,O=null,b()))}function d(b){c(b.instance)}function e(b){T().then(function(b){return WebAssembly.instantiate(b,D)}).then(b,function(b){v("failed to asynchronously prepare wasm: "+b);r(b)})}var D={env:b,global:{NaN:NaN,Infinity:Infinity},"global.Math":Math,asm2wasm:w};M++;a.monitorRunDependencies&&a.monitorRunDependencies(M);if(a.instantiateWasm)try{return a.instantiateWasm(D,
|
||
|
c)}catch(Y){return v("Module.instantiateWasm callback failed with error: "+Y),!1}a.wasmBinary||"function"!==typeof WebAssembly.instantiateStreaming||P()||"function"!==typeof fetch?e(d):WebAssembly.instantiateStreaming(fetch(Q,{credentials:"same-origin"}),D).then(d,function(b){v("wasm streaming compile failed: "+b);v("falling back to ArrayBuffer instantiation");e(d)});return{}}
|
||
|
a.asm=function(b,c){c.memory=x;c.table=new WebAssembly.Table({initial:0,maximum:0,element:"anyfunc"});c.__memory_base=1024;c.__table_base=0;return U(c)};function V(){return A.length}function W(b){b=z(b);var c=buffer.byteLength;try{return-1!==x.grow((b-c)/65536)?(buffer=x.buffer,!0):!1}catch(d){return!1}}
|
||
|
var X=a.asm({},{b:function(b){a.___errno_location&&(B[a.___errno_location()>>2]=b);return b},e:V,d:function(b){if(2147418112<b)return!1;for(var c=Math.max(V(),16777216);c<b;)536870912>=c?c=z(2*c):c=Math.min(z((3*c+2147483648)/4),2147418112);if(!W(c))return!1;C();return!0},c:function(){r("OOM")},a:2736},buffer);a.asm=X;a.___errno_location=function(){return a.asm.f.apply(null,arguments)};a._free=function(){return a.asm.g.apply(null,arguments)};a._malloc=function(){return a.asm.h.apply(null,arguments)};
|
||
|
a._simplify=function(){return a.asm.i.apply(null,arguments)};a.asm=X;a.then=function(b){if(a.calledRun)b(a);else{var c=a.onRuntimeInitialized;a.onRuntimeInitialized=function(){c&&c();b(a)}}return a};function t(b){this.name="ExitStatus";this.message="Program terminated with exit("+b+")";this.status=b}t.prototype=Error();t.prototype.constructor=t;O=function aa(){a.calledRun||Z();a.calledRun||(O=aa)};
|
||
|
function Z(){function b(){if(!a.calledRun&&(a.calledRun=!0,!y)){K||(K=!0,F(H));F(I);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var b=a.postRun.shift();J.unshift(b)}F(J)}}if(!(0<M)){if(a.preRun)for("function"==typeof a.preRun&&(a.preRun=[a.preRun]);a.preRun.length;)L();F(G);0<M||a.calledRun||(a.setStatus?(a.setStatus("Running..."),setTimeout(function(){setTimeout(function(){a.setStatus("")},1);b()},1)):
|
||
|
b())}}a.run=Z;function r(b){if(a.onAbort)a.onAbort(b);void 0!==b?(u(b),v(b),b=JSON.stringify(b)):b="";y=!0;throw"abort("+b+"). Build with -s ASSERTIONS=1 for more info.";}a.abort=r;if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0<a.preInit.length;)a.preInit.pop()();a.noExitRuntime=!0;Z();
|
||
|
|
||
|
|
||
|
return Module
|
||
|
}
|
||
|
);
|
||
|
})();
|
||
|
export default Module;
|