-
Notifications
You must be signed in to change notification settings - Fork 0
/
WasmUXP.js
51 lines (47 loc) · 15.2 KB
/
WasmUXP.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var MyWasmUXP = (() => {
var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;
return (
function(moduleArg = {}) {
var moduleRtn;
var h=moduleArg,aa,q;new Promise((a,b)=>{aa=a;q=b});var ba="object"==typeof window,t="function"==typeof importScripts,ca="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type,da=Object.assign({},h),v="",w;
if(ca){var fs=require("fs"),ea=require("path");v=__dirname+"/";w=a=>{a=fa(a)?new URL(a):ea.normalize(a);return fs.readFileSync(a)};process.argv.slice(2)}else if(ba||t)t?v=self.location.href:"undefined"!=typeof document&&document.currentScript&&(v=document.currentScript.src),_scriptName&&(v=_scriptName),v.startsWith("blob:")?v="":v=v.substr(0,v.replace(/[?#].*/,"").lastIndexOf("/")+1),t&&(w=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});
var ha=h.print||console.log.bind(console),x=h.printErr||console.error.bind(console);Object.assign(h,da);da=null;var ja=h.wasmBinary,z,ka=!1,A,C,D,E,F,G,la,ma;function na(){var a=z.buffer;h.HEAP8=A=new Int8Array(a);h.HEAP16=D=new Int16Array(a);h.HEAPU8=C=new Uint8Array(a);h.HEAPU16=E=new Uint16Array(a);h.HEAP32=F=new Int32Array(a);h.HEAPU32=G=new Uint32Array(a);h.HEAPF32=la=new Float32Array(a);h.HEAPF64=ma=new Float64Array(a)}var oa=[],pa=[],qa=[];
function ra(){var a=h.preRun;a&&("function"==typeof a&&(a=[a]),a.forEach(sa));ta(oa)}function sa(a){oa.unshift(a)}function ua(a){qa.unshift(a)}var H=0,va=null,I=null,wa=a=>a.startsWith("data:application/octet-stream;base64,"),fa=a=>a.startsWith("file://"),J;
function xa(a){if(J==J&&ja)var b=new Uint8Array(ja);else if(w)b=w(J);else throw'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)';b=new WebAssembly.Module(b);return[new WebAssembly.Instance(b,a),b]}
var ta=a=>{a.forEach(b=>b(h))},ya,K=a=>{for(var b="";C[a>>>0];)b+=ya[C[a++>>>0]];return b},L={},O={},P={},Q,za=a=>{throw new Q(a);},Aa,Ba=(a,b)=>{function c(f){f=b(f);if(f.length!==d.length)throw new Aa("Mismatched type converter count");for(var k=0;k<d.length;++k)R(d[k],f[k])}var d=[];d.forEach(f=>P[f]=a);var e=Array(a.length),g=[],n=0;a.forEach((f,k)=>{O.hasOwnProperty(f)?e[k]=O[f]:(g.push(f),L.hasOwnProperty(f)||(L[f]=[]),L[f].push(()=>{e[k]=O[f];++n;n===g.length&&c(e)}))});0===g.length&&c(e)};
function Ca(a,b,c={}){var d=b.name;if(!a)throw new Q(`type "${d}" must have a positive integer typeid pointer`);if(O.hasOwnProperty(a)){if(c.L)return;throw new Q(`Cannot register type '${d}' twice`);}O[a]=b;delete P[a];L.hasOwnProperty(a)&&(b=L[a],delete L[a],b.forEach(e=>e()))}function R(a,b,c={}){return Ca(a,b,c)}var Da=[],S=[];function Ea(a){a>>>=0;9<a&&0===--S[a+1]&&(S[a]=void 0,Da.push(a))}
var T=a=>{if(!a)throw new Q("Cannot use deleted val. handle = "+a);return S[a]},U=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=Da.pop()||S.length;S[b]=a;S[b+1]=1;return b}};function Fa(a){return this.fromWireType(G[a>>>2>>>0])}
for(var Ga={name:"emscripten::val",fromWireType:a=>{var b=T(a);Ea(a);return b},toWireType:(a,b)=>U(b),J:8,readValueFromPointer:Fa,H:null},Ha=(a,b)=>{switch(b){case 4:return function(c){return this.fromWireType(la[c>>>2>>>0])};case 8:return function(c){return this.fromWireType(ma[c>>>3>>>0])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}},Ia=(a,b)=>Object.defineProperty(b,"name",{value:a}),Ja=a=>{for(;a.length;){var b=a.pop();a.pop()(b)}},Ka={ftfnnnnnn:function(a,b,c,d,e,g,n,f,
k,m,l,p,r){return function(B,y,u,M,ia,N){B=f.toWireType(null,B);y=k.toWireType(null,y);u=m.toWireType(null,u);M=l.toWireType(null,M);ia=p.toWireType(null,ia);N=r.toWireType(null,N);N=c(d,B,y,u,M,ia,N);return g.fromWireType(N)}}},La=(a,b)=>{if(void 0===h[a].I){var c=h[a];h[a]=function(...d){if(!h[a].I.hasOwnProperty(d.length))throw new Q(`Function '${b}' called with an invalid number of arguments (${d.length}) - expects one of (${h[a].I})!`);return h[a].I[d.length].apply(this,d)};h[a].I=[];h[a].I[c.K]=
c}},Ma=(a,b,c)=>{if(h.hasOwnProperty(a)){if(void 0===c||void 0!==h[a].I&&void 0!==h[a].I[c])throw new Q(`Cannot register public name '${a}' twice`);La(a,a);if(h.hasOwnProperty(c))throw new Q(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);h[a].I[c]=b}else h[a]=b,void 0!==c&&(h[a].N=c)},Na=(a,b)=>{for(var c=[],d=0;d<a;d++)c.push(G[b+4*d>>>2>>>0]);return c},V=[],Oa,Pa=a=>{var b=V[a];b||(a>=V.length&&(V.length=a+1),V[a]=b=Oa.get(a));return b},Qa=(a,b,c=[])=>
{if(a.includes("j"))return a=a.replace(/p/g,"i"),(0,h["dynCall_"+a])(b,...c);b=Pa(b)(...c);return"p"==a[0]?b>>>0:b},Ra=(a,b)=>(...c)=>Qa(a,b,c),Sa=(a,b)=>{a=K(a);var c=a.includes("j")||a.includes("p")?Ra(a,b):Pa(b);if("function"!=typeof c)throw new Q(`unknown function pointer with signature ${a}: ${b}`);return c},Ta,Va=a=>{a=Ua(a);var b=K(a);W(a);return b},Wa=(a,b)=>{function c(g){e[g]||O[g]||(P[g]?P[g].forEach(c):(d.push(g),e[g]=!0))}var d=[],e={};b.forEach(c);throw new Ta(`${a}: `+d.map(Va).join([", "]));
},Xa=a=>{a=a.trim();const b=a.indexOf("(");return-1!==b?a.substr(0,b):a},Ya=(a,b,c)=>{switch(b){case 1:return c?d=>A[d>>>0]:d=>C[d>>>0];case 2:return c?d=>D[d>>>1>>>0]:d=>E[d>>>1>>>0];case 4:return c?d=>F[d>>>2>>>0]:d=>G[d>>>2>>>0];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}},Za="undefined"!=typeof TextDecoder?new TextDecoder:void 0,$a=(a,b=0,c=NaN)=>{b>>>=0;var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.buffer&&Za)return Za.decode(a.subarray(b,c));for(d="";b<c;){var e=
a[b++];if(e&128){var g=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|g);else{var n=a[b++]&63;e=224==(e&240)?(e&15)<<12|g<<6|n:(e&7)<<18|g<<12|n<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},ab="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,bb=(a,b)=>{var c=a>>1;for(var d=c+b/2;!(c>=d)&&E[c>>>0];)++c;c<<=1;if(32<c-a&&ab)return ab.decode(C.subarray(a>>>0,c>>>0));c=
"";for(d=0;!(d>=b/2);++d){var e=D[a+2*d>>>1>>>0];if(0==e)break;c+=String.fromCharCode(e)}return c},cb=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)D[b>>>1>>>0]=a.charCodeAt(e),b+=2;D[b>>>1>>>0]=0;return b-d},db=a=>2*a.length,eb=(a,b)=>{for(var c=0,d="";!(c>=b/4);){var e=F[a+4*c>>>2>>>0];if(0==e)break;++c;65536<=e?(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023)):d+=String.fromCharCode(e)}return d},fb=(a,b,c)=>{b>>>=0;c??=2147483647;
if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var g=a.charCodeAt(e);if(55296<=g&&57343>=g){var n=a.charCodeAt(++e);g=65536+((g&1023)<<10)|n&1023}F[b>>>2>>>0]=g;b+=4;if(b+4>c)break}F[b>>>2>>>0]=0;return b-d},gb=a=>{for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&++c;b+=4}return b},hb=[],ib={},jb=a=>{var b=ib[a];return void 0===b?K(a):b},kb=()=>{function a(b){b.$$$embind_global$$$=b;var c="object"==typeof $$$embind_global$$$&&b.$$$embind_global$$$==b;c||delete b.$$$embind_global$$$;
return c}if("object"==typeof globalThis)return globalThis;if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;"object"==typeof global&&a(global)?$$$embind_global$$$=global:"object"==typeof self&&a(self)&&($$$embind_global$$$=self);if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.");},lb=a=>{var b=hb.length;hb.push(a);return b},mb=(a,b)=>{for(var c=Array(a),d=0;d<a;++d){var e=d,g=G[b+4*d>>>2>>>0],n=O[g];if(void 0===n)throw a=
`${"parameter "+d} has unknown type ${Va(g)}`,new Q(a);c[e]=n}return c},nb=Reflect.construct,ob=[null,[],[]],pb=Array(256),X=0;256>X;++X)pb[X]=String.fromCharCode(X);ya=pb;Q=h.BindingError=class extends Error{constructor(a){super(a);this.name="BindingError"}};Aa=h.InternalError=class extends Error{constructor(a){super(a);this.name="InternalError"}};S.push(0,1,void 0,1,null,1,!0,1,!1,1);h.count_emval_handles=()=>S.length/2-5-Da.length;
Ta=h.UnboundTypeError=((a,b)=>{var c=Ia(b,function(d){this.name=b;this.message=d;d=Error(d).stack;void 0!==d&&(this.stack=this.toString()+"\n"+d.replace(/^Error(:[^\n]*)?\n/,""))});c.prototype=Object.create(a.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`};return c})(Error,"UnboundTypeError");
var rb={n:()=>{var a="";h.onAbort?.(a);a="Aborted("+a+")";x(a);ka=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");q(a);throw a;},m:function(){},h:function(a,b,c,d){b=K(b>>>0);R(a>>>0,{name:b,fromWireType:function(e){return!!e},toWireType:function(e,g){return g?c:d},J:8,readValueFromPointer:function(e){return this.fromWireType(C[e>>>0])},H:null})},x:function(a){return R(a>>>0,Ga)},e:function(a,b,c){b=K(b>>>0);R(a>>>0,{name:b,fromWireType:d=>d,toWireType:(d,e)=>e,J:8,
readValueFromPointer:Ha(b,c>>>0),H:null})},w:function(a,b,c,d,e,g,n){a>>>=0;d>>>=0;e>>>=0;g>>>=0;var f=Na(b,c>>>0);a=K(a);a=Xa(a);e=Sa(d,e);Ma(a,function(){Wa(`Cannot call ${a} due to unbound types`,f)},b-1);Ba(f,k=>{var m=[k[0],null].concat(k.slice(1));k=a;var l=a;var p=e,r=g,B=m.length;if(2>B)throw new Q("argTypes array size mismatch! Must at least get return value and 'this' types!");var y=null!==m[1]&&!1,u;a:{for(u=1;u<m.length;++u)if(null!==m[u]&&void 0===m[u].H){u=!0;break a}u=!1}var M="void"!==
m[0].name;p=[l,za,p,r,Ja,m[0],m[1]];for(r=0;r<B-2;++r)p.push(m[r+2]);if(!u)for(r=y?1:2;r<m.length;++r)null!==m[r].H&&p.push(m[r].H);B=[y?"t":"f",M?"t":"f",n?"t":"f"];for(y=y?1:2;y<m.length;++y)u=m[y],B.push(void 0===u.H?"u":null===u.H?"n":"t");m=Ka[B.join("")](...p);l=Ia(l,m);m=b-1;if(!h.hasOwnProperty(k))throw new Aa("Replacing nonexistent public symbol");void 0!==h[k].I&&void 0!==m?h[k].I[m]=l:(h[k]=l,h[k].K=m);return[]})},b:function(a,b,c,d,e){a>>>=0;c>>>=0;b=K(b>>>0);-1===e&&(e=4294967295);e=
f=>f;if(0===d){var g=32-8*c;e=f=>f<<g>>>g}var n=b.includes("unsigned")?function(f,k){return k>>>0}:function(f,k){return k};R(a,{name:b,fromWireType:e,toWireType:n,J:8,readValueFromPointer:Ya(b,c,0!==d),H:null})},a:function(a,b,c){function d(g){return new e(A.buffer,G[g+4>>>2>>>0],G[g>>>2>>>0])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=K(c>>>0);R(a>>>0,{name:c,fromWireType:d,J:8,readValueFromPointer:d},{L:!0})},d:function(a,b){b=K(b>>>
0);var c="std::string"===b;R(a>>>0,{name:b,fromWireType:function(d){var e=G[d>>>2>>>0],g=d+4;if(c)for(var n=g,f=0;f<=e;++f){var k=g+f;if(f==e||0==C[k>>>0]){var m=n;n=(m>>>=0)?$a(C,m,k-n):"";if(void 0===l)var l=n;else l+=String.fromCharCode(0),l+=n;n=k+1}}else{l=Array(e);for(f=0;f<e;++f)l[f]=String.fromCharCode(C[g+f>>>0]);l=l.join("")}W(d);return l},toWireType:function(d,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var g="string"==typeof e;if(!(g||e instanceof Uint8Array||e instanceof Uint8ClampedArray||
e instanceof Int8Array))throw new Q("Cannot pass non-string to std::string");var n;if(c&&g)for(var f=n=0;f<e.length;++f){var k=e.charCodeAt(f);127>=k?n++:2047>=k?n+=2:55296<=k&&57343>=k?(n+=4,++f):n+=3}else n=e.length;k=n;n=qb(4+k+1);f=n+4;G[n>>>2>>>0]=k;if(c&&g){if(k+=1,g=C,f>>>=0,0<k){k=f+k-1;for(var m=0;m<e.length;++m){var l=e.charCodeAt(m);if(55296<=l&&57343>=l){var p=e.charCodeAt(++m);l=65536+((l&1023)<<10)|p&1023}if(127>=l){if(f>=k)break;g[f++>>>0]=l}else{if(2047>=l){if(f+1>=k)break;g[f++>>>
0]=192|l>>6}else{if(65535>=l){if(f+2>=k)break;g[f++>>>0]=224|l>>12}else{if(f+3>=k)break;g[f++>>>0]=240|l>>18;g[f++>>>0]=128|l>>12&63}g[f++>>>0]=128|l>>6&63}g[f++>>>0]=128|l&63}}g[f>>>0]=0}}else if(g)for(g=0;g<k;++g){m=e.charCodeAt(g);if(255<m)throw W(f),new Q("String has UTF-16 code units that do not fit in 8 bits");C[f+g>>>0]=m}else for(g=0;g<k;++g)C[f+g>>>0]=e[g];null!==d&&d.push(W,n);return n},J:8,readValueFromPointer:Fa,H(d){W(d)}})},c:function(a,b,c){b>>>=0;c>>>=0;c=K(c);if(2===b){var d=bb;var e=
cb;var g=db;var n=f=>E[f>>>1>>>0]}else 4===b&&(d=eb,e=fb,g=gb,n=f=>G[f>>>2>>>0]);R(a>>>0,{name:c,fromWireType:f=>{for(var k=G[f>>>2>>>0],m,l=f+4,p=0;p<=k;++p){var r=f+4+p*b;if(p==k||0==n(r))l=d(l,r-l),void 0===m?m=l:(m+=String.fromCharCode(0),m+=l),l=r+b}W(f);return m},toWireType:(f,k)=>{if("string"!=typeof k)throw new Q(`Cannot pass non-string to C++ string type ${c}`);var m=g(k),l=qb(4+m+b);G[l>>>2>>>0]=m/b;e(k,l+4,m+b);null!==f&&f.push(W,l);return l},J:8,readValueFromPointer:Fa,H(f){W(f)}})},i:function(a,
b){b=K(b>>>0);R(a>>>0,{M:!0,name:b,J:0,fromWireType:()=>{},toWireType:()=>{}})},o:()=>1,s:function(a,b,c){b>>>=0;return C.copyWithin(a>>>0>>>0,b>>>0,b+(c>>>0)>>>0)},r:function(a,b,c,d){c>>>=0;d>>>=0;a=hb[a>>>0];b=T(b>>>0);return a(null,b,c,d)},k:Ea,z:function(a){a>>>=0;if(0===a)return U(kb());a=jb(a);return U(kb()[a])},g:function(a,b,c){var d=mb(a,b>>>0),e=d.shift();a--;var g=Array(a);b=`methodCaller<(${d.map(n=>n.name).join(", ")}) => ${e.name}>`;return lb(Ia(b,(n,f,k,m)=>{for(var l=0,p=0;p<a;++p)g[p]=
d[p].readValueFromPointer(m+l),l+=d[p].J;f=1===c?nb(f,g):f.apply(n,g);n=[];f=e.toWireType(n,f);n.length&&(G[k>>>2>>>0]=U(n));return f}))},u:function(a){return U(jb(a>>>0))},y:function(){return U({})},v:function(a){a>>>=0;var b=T(a);Ja(b);Ea(a)},j:function(a,b,c){b>>>=0;c>>>=0;a=T(a>>>0);b=T(b);c=T(c);a[b]=c},q:()=>performance.now(),p:function(a){a>>>=0;var b=C.length;if(4294901760<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(4294901760,65536*Math.ceil(Math.max(a,
d)/65536))-z.buffer.byteLength+65535)/65536|0;try{z.grow(d);na();var e=1;break a}catch(g){}e=void 0}if(e)return!0}return!1},t:()=>52,l:function(){return 70},f:function(a,b,c,d){b>>>=0;c>>>=0;d>>>=0;for(var e=0,g=0;g<c;g++){var n=G[b>>>2>>>0],f=G[b+4>>>2>>>0];b+=8;for(var k=0;k<f;k++){var m=C[n+k>>>0],l=ob[a];0===m||10===m?((1===a?ha:x)($a(l)),l.length=0):l.push(m)}e+=f}G[d>>>2>>>0]=e;return 0}},Y=function(){function a(c){Y=c.exports;Y=sb();z=Y.A;na();Oa=Y.D;pa.unshift(Y.B);H--;h.monitorRunDependencies?.(H);
0==H&&(null!==va&&(clearInterval(va),va=null),I&&(c=I,I=null,c()));return Y}var b={a:rb};H++;h.monitorRunDependencies?.(H);if(h.instantiateWasm)try{return h.instantiateWasm(b,a)}catch(c){x(`Module.instantiateWasm callback failed with error: ${c}`),q(c)}J??=wa("WasmUXP.wasm")?"WasmUXP.wasm":h.locateFile?h.locateFile("WasmUXP.wasm",v):v+"WasmUXP.wasm";b=xa(b);return a(b[0])}(),Ua=Y.C,W=Y.E,qb=h._malloc=Y.F;h.dynCall_jiji=Y.G;
function sb(){var a=Y;a=Object.assign({},a);var b=c=>d=>c(d)>>>0;a.C=b(a.C);a.F=b(a.F);a._emscripten_stack_alloc=b(a._emscripten_stack_alloc);a.emscripten_stack_get_current=(c=>()=>c()>>>0)(a.emscripten_stack_get_current);return a}var Z,tb;I=function ub(){Z||vb();Z||(I=ub)};
function vb(){function a(){if(!Z&&(Z=1,h.calledRun=1,!ka)){ta(pa);aa(h);h.onRuntimeInitialized?.();var b=h.postRun;b&&("function"==typeof b&&(b=[b]),b.forEach(ua));ta(qa)}}if(!(0<H)){if(!tb&&(tb=1,ra(),0<H))return;h.setStatus?(h.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>h.setStatus(""),1);a()},1)):a()}}if(h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);0<h.preInit.length;)h.preInit.pop()();vb();moduleRtn=h;
return moduleRtn;
}
);
})();
if (typeof exports === 'object' && typeof module === 'object')
module.exports = MyWasmUXP;
else if (typeof define === 'function' && define['amd'])
define([], () => MyWasmUXP);