@rive-app/webgl
Version:
Rive's webgl based web api.
1,893 lines (1,889 loc) • 300 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["rive"] = factory();
else
root["rive"] = factory();
})(this, () => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
var Rive = (() => {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
return (
function(moduleArg = {}) {
var l = moduleArg, aa, ba;
l.ready = new Promise((a, b) => {
aa = a;
ba = b;
});
function ca() {
function a(g) {
const k = d;
c = b = 0;
d = new Map();
k.forEach(p => {
try {
p(g);
} catch (n) {
console.error(n);
}
});
this.lb();
e && e.Mb();
}
let b = 0, c = 0, d = new Map(), e = null, f = null;
this.requestAnimationFrame = function(g) {
b || (b = requestAnimationFrame(a.bind(this)));
const k = ++c;
d.set(k, g);
return k;
};
this.cancelAnimationFrame = function(g) {
d.delete(g);
b && 0 == d.size && (cancelAnimationFrame(b), b = 0);
};
this.Kb = function(g) {
f && (document.body.remove(f), f = null);
g || (f = document.createElement("div"), f.style.backgroundColor = "black", f.style.position = "fixed", f.style.right = 0, f.style.top = 0, f.style.color = "white", f.style.padding = "4px", f.innerHTML = "RIVE FPS", g = function(k) {
f.innerHTML = "RIVE FPS " + k.toFixed(1);
}, document.body.appendChild(f));
e = new function() {
let k = 0, p = 0;
this.Mb = function() {
var n = performance.now();
p ? (++k, n -= p, 1000 < n && (g(1000 * k / n), k = p = 0)) : (p = n, k = 0);
};
}();
};
this.lb = function() {
};
}
function da() {
console.assert(!0);
const a = new Map();
let b = -Infinity;
this.push = function(c) {
c = c + 255 >> 8;
a.has(c) && clearTimeout(a.get(c));
a.set(c, setTimeout(function() {
a.delete(c);
0 == a.length ? b = -Infinity : c == b && (b = Math.max(...a.keys()), console.assert(b < c));
}, 1000));
b = Math.max(c, b);
return b << 8;
};
}
const ea = l.onRuntimeInitialized;
l.onRuntimeInitialized = function() {
ea && ea();
let a = l.decodeAudio;
l.decodeAudio = function(e, f) {
e = a(e);
f(e);
};
let b = l.decodeFont;
l.decodeFont = function(e, f) {
e = b(e);
f(e);
};
const c = l.FileAssetLoader;
l.ptrToAsset = e => {
let f = l.ptrToFileAsset(e);
return f.isImage ? l.ptrToImageAsset(e) : f.isFont ? l.ptrToFontAsset(e) : f.isAudio ? l.ptrToAudioAsset(e) : f;
};
l.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:e}) {
this.__parent.__construct.call(this);
this.Bb = e;
}, loadContents:function(e, f) {
e = l.ptrToAsset(e);
return this.Bb(e, f);
},});
l.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() {
this.__parent.__construct.call(this);
}, loadContents:function(e) {
let f = l.ptrToAsset(e);
e = f.cdnUuid;
if ("" === e) {
return !1;
}
(function(g, k) {
var p = new XMLHttpRequest();
p.responseType = "arraybuffer";
p.onreadystatechange = function() {
4 == p.readyState && 200 == p.status && k(p);
};
p.open("GET", g, !0);
p.send(null);
})(f.cdnBaseUrl + "/" + e, g => {
f.decode(new Uint8Array(g.response));
});
return !0;
},});
l.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() {
this.__parent.__construct.call(this);
this.gb = [];
}, addLoader:function(e) {
this.gb.push(e);
}, loadContents:function(e, f) {
for (let g of this.gb) {
if (g.loadContents(e, f)) {
return !0;
}
}
return !1;
},});
let d = l.computeAlignment;
l.computeAlignment = function(e, f, g, k, p = 1.0) {
return d.call(this, e, f, g, k, p);
};
};
const fa = l.onRuntimeInitialized;
l.onRuntimeInitialized = function() {
function a(r) {
this.F = r;
this.yb = r.getContext("2d");
this.Db = e;
this.R = [];
this.ja = 0;
this.clear = function() {
console.assert(0 == this.ja);
this.R = [];
f.delete(this);
};
this.save = function() {
++this.ja;
this.R.push(e.save.bind(e));
};
this.restore = function() {
0 < this.ja && (this.R.push(e.restore.bind(e)), --this.ja);
};
this.transform = function(u) {
this.R.push(e.transform.bind(e, u));
};
this.align = function(u, z, B, C, O = 1.0) {
this.R.push(e.align.bind(e, u, z, B, C, O));
};
this.flush = function() {
console.assert(0 == this.ja);
f.add(this);
d && c();
};
}
function b(r) {
var u = {alpha:1, depth:0, stencil:8, antialias:0, premultipliedAlpha:1, preserveDrawingBuffer:0, powerPreference:"high-performance", failIfMajorPerformanceCaveat:0, enableExtensionsByDefault:1, explicitSwapControl:0, renderViaOffscreenBackBuffer:0,}, z = r.getContext("webgl2", u);
z || (z = r.getContext("webgl", u));
var B = z, C = ha(ia), O = {handle:C, attributes:u, version:u.Dc, Ua:B};
B.canvas && (B.canvas.pc = O);
ia[C] = O;
("undefined" == typeof u.Jb || u.Jb) && ka(O);
la(C);
u = g(r.width, r.height);
u.Ab = C;
u.F = r;
u.Wa = r.width;
u.Va = r.height;
u.zb = z;
return u;
}
function c() {
if (e) {
var r = e.Cb, u = 0, z = 0, B = 0, C = Array(f.size), O = 0;
for (var M of f) {
M.da = Math.min(M.F.width, r), M.ca = Math.min(M.F.height, r), M.Ja = M.ca * M.da, u = Math.max(u, M.da), z = Math.max(z, M.ca), B += M.Ja, C[O++] = M;
}
f.clear();
if (!(0 >= B)) {
u = 1 << (0 >= u ? 0 : 32 - Math.clz32(u - 1));
for (z = 1 << (0 >= z ? 0 : 32 - Math.clz32(z - 1)); z * u < B;) {
u <= z ? u *= 2 : z *= 2;
}
u = Math.min(u, r);
u = Math.min(z, r);
C.sort((ja, Gb) => Gb.Ja - ja.Ja);
B = new l.DynamicRectanizer(r);
for (M = 0; M < C.length;) {
B.reset(u, z);
for (O = M; O < C.length; ++O) {
var P = C[O], J = B.addRect(P.da, P.ca);
if (0 > J) {
console.assert(O > M);
break;
}
P.pa = J & 65535;
P.qa = J >> 16;
}
P = p.push(B.drawWidth());
J = n.push(B.drawHeight());
console.assert(P >= B.drawWidth());
console.assert(J >= B.drawHeight());
console.assert(P <= r);
console.assert(J <= r);
e.F.width != P && (e.F.width = P);
e.F.height != J && (e.F.height = J);
e.clear();
for (P = M; P < O; ++P) {
J = C[P];
e.saveClipRect(J.pa, J.qa, J.pa + J.da, J.qa + J.ca);
let ja = new l.Mat2D();
ja.xx = J.da / J.F.width;
ja.yy = J.ca / J.F.height;
ja.xy = ja.yx = 0;
ja.tx = J.pa;
ja.ty = J.qa;
e.transform(ja);
for (const Gb of J.R) {
Gb();
}
e.restoreClipRect();
J.R = [];
}
for (e.flush(); M < O; ++M) {
P = C[M], J = P.yb, J.globalCompositeOperation = "copy", J.drawImage(e.F, P.pa, P.qa, P.da, P.ca, 0, 0, P.F.width, P.F.height);
}
M = O;
}
}
}
}
fa && fa();
const d = navigator.userAgent.match(/firefox|fxios/i);
let e = null;
const f = new Set(), g = l.makeRenderer;
l.makeRenderer = function(r, u) {
return u ? (e || (e = b(document.createElement("canvas")), u = e.zb, e.Cb = Math.min(u.getParameter(u.MAX_RENDERBUFFER_SIZE), u.getParameter(u.MAX_TEXTURE_SIZE))), new a(r)) : b(r);
};
const k = l.Artboard.prototype.draw;
l.Artboard.prototype.draw = function(r) {
r.R ? r.R.push(k.bind(this, r.Db)) : k.call(this, r);
};
const p = new da(), n = new da(), t = new ca();
l.requestAnimationFrame = t.requestAnimationFrame.bind(t);
l.cancelAnimationFrame = t.cancelAnimationFrame.bind(t);
l.enableFPSCounter = t.Kb.bind(t);
t.lb = c;
l.resolveAnimationFrame = c;
let w = l.load;
l.load = function(r, u, z = !0) {
const B = new l.FallbackFileAssetLoader();
void 0 !== u && B.addLoader(u);
z && (u = new l.CDNFileAssetLoader(), B.addLoader(u));
return Promise.resolve(w(r, B));
};
const y = l.WebGLRenderer.prototype.clear;
l.WebGLRenderer.prototype.clear = function() {
la(this.Ab);
const r = this.F;
if (this.Wa != r.width || this.Va != r.height) {
this.resize(r.width, r.height), this.Wa = r.width, this.Va = r.height;
}
y.call(this);
};
l.decodeImage = function(r, u) {
r = l.decodeImageSkia(r);
u(r);
};
let q = l.Renderer.prototype.align;
l.Renderer.prototype.align = function(r, u, z, B, C = 1.0) {
q.call(this, r, u, z, B, C);
};
};
var ma = Object.assign({}, l), na = "./this.program", oa = "object" == typeof window, pa = "function" == typeof importScripts, qa = "", ra, sa;
if (oa || pa) {
pa ? qa = self.location.href : "undefined" != typeof document && document.currentScript && (qa = document.currentScript.src), _scriptDir && (qa = _scriptDir), 0 !== qa.indexOf("blob:") ? qa = qa.substr(0, qa.replace(/[?#].*/, "").lastIndexOf("/") + 1) : qa = "", pa && (sa = a => {
var b = new XMLHttpRequest();
b.open("GET", a, !1);
b.responseType = "arraybuffer";
b.send(null);
return new Uint8Array(b.response);
}), ra = (a, b, c) => {
var d = new XMLHttpRequest();
d.open("GET", a, !0);
d.responseType = "arraybuffer";
d.onload = () => {
200 == d.status || 0 == d.status && d.response ? b(d.response) : c();
};
d.onerror = c;
d.send(null);
};
}
var ta = l.print || console.log.bind(console), ua = l.printErr || console.error.bind(console);
Object.assign(l, ma);
ma = null;
l.thisProgram && (na = l.thisProgram);
var va;
l.wasmBinary && (va = l.wasmBinary);
var noExitRuntime = l.noExitRuntime || !0;
"object" != typeof WebAssembly && wa("no native wasm support detected");
var xa, m, ya = !1, v, x, A, za, D, E, F, Aa;
function Ba() {
var a = xa.buffer;
l.HEAP8 = v = new Int8Array(a);
l.HEAP16 = A = new Int16Array(a);
l.HEAP32 = D = new Int32Array(a);
l.HEAPU8 = x = new Uint8Array(a);
l.HEAPU16 = za = new Uint16Array(a);
l.HEAPU32 = E = new Uint32Array(a);
l.HEAPF32 = F = new Float32Array(a);
l.HEAPF64 = Aa = new Float64Array(a);
}
var Ca, Da = [], Ea = [], Fa = [];
function Ga() {
var a = l.preRun.shift();
Da.unshift(a);
}
var Ha = 0, Ia = null, Ja = null;
function wa(a) {
if (l.onAbort) {
l.onAbort(a);
}
a = "Aborted(" + a + ")";
ua(a);
ya = !0;
a = new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info.");
ba(a);
throw a;
}
function Ka(a) {
return a.startsWith("data:application/octet-stream;base64,");
}
var La;
La = "webgl_advanced.wasm";
if (!Ka(La)) {
var Ma = La;
La = l.locateFile ? l.locateFile(Ma, qa) : qa + Ma;
}
function Na(a) {
if (a == La && va) {
return new Uint8Array(va);
}
if (sa) {
return sa(a);
}
throw "both async and sync fetching of the wasm failed";
}
function Oa(a) {
if (!va && (oa || pa)) {
if ("function" == typeof fetch && !a.startsWith("file://")) {
return fetch(a, {credentials:"same-origin"}).then(b => {
if (!b.ok) {
throw "failed to load wasm binary file at '" + a + "'";
}
return b.arrayBuffer();
}).catch(() => Na(a));
}
if (ra) {
return new Promise((b, c) => {
ra(a, d => b(new Uint8Array(d)), c);
});
}
}
return Promise.resolve().then(() => Na(a));
}
function Pa(a, b, c) {
return Oa(a).then(d => WebAssembly.instantiate(d, b)).then(d => d).then(c, d => {
ua("failed to asynchronously prepare wasm: " + d);
wa(d);
});
}
function Qa(a, b) {
var c = La;
return va || "function" != typeof WebAssembly.instantiateStreaming || Ka(c) || c.startsWith("file://") || "function" != typeof fetch ? Pa(c, a, b) : fetch(c, {credentials:"same-origin"}).then(d => WebAssembly.instantiateStreaming(d, a).then(b, function(e) {
ua("wasm streaming compile failed: " + e);
ua("falling back to ArrayBuffer instantiation");
return Pa(c, a, b);
}));
}
var Ra, Sa, Wa = {711388:(a, b, c, d, e) => {
if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) {
return 0;
}
if ("undefined" === typeof window.h) {
window.h = {Ea:0};
window.h.H = {};
window.h.H.Ca = a;
window.h.H.capture = b;
window.h.H.La = c;
window.h.ha = {};
window.h.ha.stopped = d;
window.h.ha.tb = e;
let f = window.h;
f.C = [];
f.nc = function(g) {
for (var k = 0; k < f.C.length; ++k) {
if (null == f.C[k]) {
return f.C[k] = g, k;
}
}
f.C.push(g);
return f.C.length - 1;
};
f.xb = function(g) {
for (f.C[g] = null; 0 < f.C.length;) {
if (null == f.C[f.C.length - 1]) {
f.C.pop();
} else {
break;
}
}
};
f.Kc = function(g) {
for (var k = 0; k < f.C.length; ++k) {
if (f.C[k] == g) {
return f.xb(k);
}
}
};
f.ta = function(g) {
return f.C[g];
};
f.Ta = ["touchend", "click"];
f.unlock = function() {
for (var g = 0; g < f.C.length; ++g) {
var k = f.C[g];
null != k && null != k.I && k.state === f.ha.tb && k.I.resume().then(() => {
Ta(k.mb);
}, p => {
console.error("Failed to resume audiocontext", p);
});
}
f.Ta.map(function(p) {
document.removeEventListener(p, f.unlock, !0);
});
};
f.Ta.map(function(g) {
document.addEventListener(g, f.unlock, !0);
});
}
window.h.Ea += 1;
return 1;
}, 713566:() => {
"undefined" !== typeof window.h && (window.h.Ta.map(function(a) {
document.removeEventListener(a, window.h.unlock, !0);
}), --window.h.Ea, 0 === window.h.Ea && delete window.h);
}, 713870:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 713974:() => {
try {
var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate;
a.close();
return b;
} catch (c) {
return 0;
}
}, 714145:(a, b, c, d, e, f) => {
if ("undefined" === typeof window.h) {
return -1;
}
var g = {}, k = {};
a == window.h.H.Ca && 0 != c && (k.sampleRate = c);
g.I = new (window.AudioContext || window.webkitAudioContext)(k);
g.I.suspend();
g.state = window.h.ha.stopped;
c = 0;
a != window.h.H.Ca && (c = b);
g.X = g.I.createScriptProcessor(d, c, b);
g.X.onaudioprocess = function(p) {
if (null == g.ua || 0 == g.ua.length) {
g.ua = new Float32Array(F.buffer, e, d * b);
}
if (a == window.h.H.capture || a == window.h.H.La) {
for (var n = 0; n < b; n += 1) {
for (var t = p.inputBuffer.getChannelData(n), w = g.ua, y = 0; y < d; y += 1) {
w[y * b + n] = t[y];
}
}
Ua(f, d, e);
}
if (a == window.h.H.Ca || a == window.h.H.La) {
for (Va(f, d, e), n = 0; n < p.outputBuffer.numberOfChannels; ++n) {
for (t = p.outputBuffer.getChannelData(n), w = g.ua, y = 0; y < d; y += 1) {
t[y] = w[y * b + n];
}
}
} else {
for (n = 0; n < p.outputBuffer.numberOfChannels; ++n) {
p.outputBuffer.getChannelData(n).fill(0.0);
}
}
};
a != window.h.H.capture && a != window.h.H.La || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(p) {
g.Fa = g.I.createMediaStreamSource(p);
g.Fa.connect(g.X);
g.X.connect(g.I.destination);
}).catch(function(p) {
console.log("Failed to get user media: " + p);
});
a == window.h.H.Ca && g.X.connect(g.I.destination);
g.mb = f;
return window.h.nc(g);
}, 717022:a => window.h.ta(a).I.sampleRate, 717095:a => {
a = window.h.ta(a);
void 0 !== a.X && (a.X.onaudioprocess = function() {
}, a.X.disconnect(), a.X = void 0);
void 0 !== a.Fa && (a.Fa.disconnect(), a.Fa = void 0);
a.I.close();
a.I = void 0;
a.mb = void 0;
}, 717495:a => {
window.h.xb(a);
}, 717545:a => {
a = window.h.ta(a);
a.I.resume();
a.state = window.h.ha.tb;
}, 717684:a => {
a = window.h.ta(a);
a.I.suspend();
a.state = window.h.ha.stopped;
}}, Xa = a => {
for (; 0 < a.length;) {
a.shift()(l);
}
}, Ya = (a, b) => {
for (var c = 0, d = a.length - 1; 0 <= d; d--) {
var e = a[d];
"." === e ? a.splice(d, 1) : ".." === e ? (a.splice(d, 1), c++) : c && (a.splice(d, 1), c--);
}
if (b) {
for (; c; c--) {
a.unshift("..");
}
}
return a;
}, Za = a => {
var b = "/" === a.charAt(0), c = "/" === a.substr(-1);
(a = Ya(a.split("/").filter(d => !!d), !b).join("/")) || b || (a = ".");
a && c && (a += "/");
return (b ? "/" : "") + a;
}, $a = a => {
var b = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);
a = b[0];
b = b[1];
if (!a && !b) {
return ".";
}
b && (b = b.substr(0, b.length - 1));
return a + b;
}, ab = a => {
if ("/" === a) {
return "/";
}
a = Za(a);
a = a.replace(/\/$/, "");
var b = a.lastIndexOf("/");
return -1 === b ? a : a.substr(b + 1);
}, bb = () => {
if ("object" == typeof crypto && "function" == typeof crypto.getRandomValues) {
return a => crypto.getRandomValues(a);
}
wa("initRandomDevice");
}, cb = a => (cb = bb())(a);
function db() {
for (var a = "", b = !1, c = arguments.length - 1; -1 <= c && !b; c--) {
b = 0 <= c ? arguments[c] : "/";
if ("string" != typeof b) {
throw new TypeError("Arguments to path.resolve must be strings");
}
if (!b) {
return "";
}
a = b + "/" + a;
b = "/" === b.charAt(0);
}
a = Ya(a.split("/").filter(d => !!d), !b).join("/");
return (b ? "/" : "") + a || ".";
}
var eb = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, fb = (a, b, c) => {
var d = b + c;
for (c = b; a[c] && !(c >= d);) {
++c;
}
if (16 < c - b && a.buffer && eb) {
return eb.decode(a.subarray(b, c));
}
for (d = ""; b < c;) {
var e = a[b++];
if (e & 128) {
var f = a[b++] & 63;
if (192 == (e & 224)) {
d += String.fromCharCode((e & 31) << 6 | f);
} else {
var g = a[b++] & 63;
e = 224 == (e & 240) ? (e & 15) << 12 | f << 6 | g : (e & 7) << 18 | f << 12 | g << 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;
}, gb = [], hb = a => {
for (var b = 0, c = 0; c < a.length; ++c) {
var d = a.charCodeAt(c);
127 >= d ? b++ : 2047 >= d ? b += 2 : 55296 <= d && 57343 >= d ? (b += 4, ++c) : b += 3;
}
return b;
}, ib = (a, b, c, d) => {
if (!(0 < d)) {
return 0;
}
var e = c;
d = c + d - 1;
for (var f = 0; f < a.length; ++f) {
var g = a.charCodeAt(f);
if (55296 <= g && 57343 >= g) {
var k = a.charCodeAt(++f);
g = 65536 + ((g & 1023) << 10) | k & 1023;
}
if (127 >= g) {
if (c >= d) {
break;
}
b[c++] = g;
} else {
if (2047 >= g) {
if (c + 1 >= d) {
break;
}
b[c++] = 192 | g >> 6;
} else {
if (65535 >= g) {
if (c + 2 >= d) {
break;
}
b[c++] = 224 | g >> 12;
} else {
if (c + 3 >= d) {
break;
}
b[c++] = 240 | g >> 18;
b[c++] = 128 | g >> 12 & 63;
}
b[c++] = 128 | g >> 6 & 63;
}
b[c++] = 128 | g & 63;
}
}
b[c] = 0;
return c - e;
};
function jb(a, b) {
var c = Array(hb(a) + 1);
a = ib(a, c, 0, c.length);
b && (c.length = a);
return c;
}
var kb = [];
function lb(a, b) {
kb[a] = {input:[], D:[], T:b};
mb(a, nb);
}
var nb = {open:function(a) {
var b = kb[a.node.Da];
if (!b) {
throw new G(43);
}
a.s = b;
a.seekable = !1;
}, close:function(a) {
a.s.T.sa(a.s);
}, sa:function(a) {
a.s.T.sa(a.s);
}, read:function(a, b, c, d) {
if (!a.s || !a.s.T.fb) {
throw new G(60);
}
for (var e = 0, f = 0; f < d; f++) {
try {
var g = a.s.T.fb(a.s);
} catch (k) {
throw new G(29);
}
if (void 0 === g && 0 === e) {
throw new G(6);
}
if (null === g || void 0 === g) {
break;
}
e++;
b[c + f] = g;
}
e && (a.node.timestamp = Date.now());
return e;
}, write:function(a, b, c, d) {
if (!a.s || !a.s.T.Oa) {
throw new G(60);
}
try {
for (var e = 0; e < d; e++) {
a.s.T.Oa(a.s, b[c + e]);
}
} catch (f) {
throw new G(29);
}
d && (a.node.timestamp = Date.now());
return e;
},}, ob = {fb:function() {
a: {
if (!gb.length) {
var a = null;
"undefined" != typeof window && "function" == typeof window.prompt ? (a = window.prompt("Input: "), null !== a && (a += "\n")) : "function" == typeof readline && (a = readline(), null !== a && (a += "\n"));
if (!a) {
a = null;
break a;
}
gb = jb(a, !0);
}
a = gb.shift();
}
return a;
}, Oa:function(a, b) {
null === b || 10 === b ? (ta(fb(a.D, 0)), a.D = []) : 0 != b && a.D.push(b);
}, sa:function(a) {
a.D && 0 < a.D.length && (ta(fb(a.D, 0)), a.D = []);
}, Wb:function() {
return {uc:25856, wc:5, tc:191, vc:35387, sc:[3, 28, 127, 21, 4, 0, 1, 0, 17, 19, 26, 0, 18, 15, 23, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]};
}, Xb:function() {
return 0;
}, Yb:function() {
return [24, 80];
},}, pb = {Oa:function(a, b) {
null === b || 10 === b ? (ua(fb(a.D, 0)), a.D = []) : 0 != b && a.D.push(b);
}, sa:function(a) {
a.D && 0 < a.D.length && (ua(fb(a.D, 0)), a.D = []);
},};
function qb(a, b) {
var c = a.j ? a.j.length : 0;
c >= b || (b = Math.max(b, c * (1048576 > c ? 2.0 : 1.125) >>> 0), 0 != c && (b = Math.max(b, 256)), c = a.j, a.j = new Uint8Array(b), 0 < a.v && a.j.set(c.subarray(0, a.v), 0));
}
var H = {N:null, S() {
return H.createNode(null, "/", 16895, 0);
}, createNode(a, b, c, d) {
if (24576 === (c & 61440) || 4096 === (c & 61440)) {
throw new G(63);
}
H.N || (H.N = {dir:{node:{W:H.l.W, O:H.l.O, ka:H.l.ka, Aa:H.l.Aa, rb:H.l.rb, wb:H.l.wb, sb:H.l.sb, pb:H.l.pb, Ga:H.l.Ga}, stream:{$:H.m.$}}, file:{node:{W:H.l.W, O:H.l.O}, stream:{$:H.m.$, read:H.m.read, write:H.m.write, ra:H.m.ra, ib:H.m.ib, kb:H.m.kb}}, link:{node:{W:H.l.W, O:H.l.O, la:H.l.la}, stream:{}}, Xa:{node:{W:H.l.W, O:H.l.O}, stream:rb}});
c = sb(a, b, c, d);
16384 === (c.mode & 61440) ? (c.l = H.N.dir.node, c.m = H.N.dir.stream, c.j = {}) : 32768 === (c.mode & 61440) ? (c.l = H.N.file.node, c.m = H.N.file.stream, c.v = 0, c.j = null) : 40960 === (c.mode & 61440) ? (c.l = H.N.link.node, c.m = H.N.link.stream) : 8192 === (c.mode & 61440) && (c.l = H.N.Xa.node, c.m = H.N.Xa.stream);
c.timestamp = Date.now();
a && (a.j[b] = c, a.timestamp = c.timestamp);
return c;
}, Ac(a) {
return a.j ? a.j.subarray ? a.j.subarray(0, a.v) : new Uint8Array(a.j) : new Uint8Array(0);
}, l:{W(a) {
var b = {};
b.zc = 8192 === (a.mode & 61440) ? a.id : 1;
b.Cc = a.id;
b.mode = a.mode;
b.Gc = 1;
b.uid = 0;
b.Bc = 0;
b.Da = a.Da;
16384 === (a.mode & 61440) ? b.size = 4096 : 32768 === (a.mode & 61440) ? b.size = a.v : 40960 === (a.mode & 61440) ? b.size = a.link.length : b.size = 0;
b.qc = new Date(a.timestamp);
b.Ec = new Date(a.timestamp);
b.xc = new Date(a.timestamp);
b.Eb = 4096;
b.rc = Math.ceil(b.size / b.Eb);
return b;
}, O(a, b) {
void 0 !== b.mode && (a.mode = b.mode);
void 0 !== b.timestamp && (a.timestamp = b.timestamp);
if (void 0 !== b.size && (b = b.size, a.v != b)) {
if (0 == b) {
a.j = null, a.v = 0;
} else {
var c = a.j;
a.j = new Uint8Array(b);
c && a.j.set(c.subarray(0, Math.min(b, a.v)));
a.v = b;
}
}
}, ka() {
throw tb[44];
}, Aa(a, b, c, d) {
return H.createNode(a, b, c, d);
}, rb(a, b, c) {
if (16384 === (a.mode & 61440)) {
try {
var d = ub(b, c);
} catch (f) {
}
if (d) {
for (var e in d.j) {
throw new G(55);
}
}
}
delete a.parent.j[a.name];
a.parent.timestamp = Date.now();
a.name = c;
b.j[c] = a;
b.timestamp = a.parent.timestamp;
a.parent = b;
}, wb(a, b) {
delete a.j[b];
a.timestamp = Date.now();
}, sb(a, b) {
var c = ub(a, b), d;
for (d in c.j) {
throw new G(55);
}
delete a.j[b];
a.timestamp = Date.now();
}, pb(a) {
var b = [".", ".."], c;
for (c in a.j) {
a.j.hasOwnProperty(c) && b.push(c);
}
return b;
}, Ga(a, b, c) {
a = H.createNode(a, b, 41471, 0);
a.link = c;
return a;
}, la(a) {
if (40960 !== (a.mode & 61440)) {
throw new G(28);
}
return a.link;
},}, m:{read(a, b, c, d, e) {
var f = a.node.j;
if (e >= a.node.v) {
return 0;
}
a = Math.min(a.node.v - e, d);
if (8 < a && f.subarray) {
b.set(f.subarray(e, e + a), c);
} else {
for (d = 0; d < a; d++) {
b[c + d] = f[e + d];
}
}
return a;
}, write(a, b, c, d, e, f) {
b.buffer === v.buffer && (f = !1);
if (!d) {
return 0;
}
a = a.node;
a.timestamp = Date.now();
if (b.subarray && (!a.j || a.j.subarray)) {
if (f) {
return a.j = b.subarray(c, c + d), a.v = d;
}
if (0 === a.v && 0 === e) {
return a.j = b.slice(c, c + d), a.v = d;
}
if (e + d <= a.v) {
return a.j.set(b.subarray(c, c + d), e), d;
}
}
qb(a, e + d);
if (a.j.subarray && b.subarray) {
a.j.set(b.subarray(c, c + d), e);
} else {
for (f = 0; f < d; f++) {
a.j[e + f] = b[c + f];
}
}
a.v = Math.max(a.v, e + d);
return d;
}, $(a, b, c) {
1 === c ? b += a.position : 2 === c && 32768 === (a.node.mode & 61440) && (b += a.node.v);
if (0 > b) {
throw new G(28);
}
return b;
}, ra(a, b, c) {
qb(a.node, b + c);
a.node.v = Math.max(a.node.v, b + c);
}, ib(a, b, c, d, e) {
if (32768 !== (a.node.mode & 61440)) {
throw new G(43);
}
a = a.node.j;
if (e & 2 || a.buffer !== v.buffer) {
if (0 < c || c + b < a.length) {
a.subarray ? a = a.subarray(c, c + b) : a = Array.prototype.slice.call(a, c, c + b);
}
c = !0;
b = 65536 * Math.ceil(b / 65536);
(e = vb(65536, b)) ? (x.fill(0, e, e + b), b = e) : b = 0;
if (!b) {
throw new G(48);
}
v.set(a, b);
} else {
c = !1, b = a.byteOffset;
}
return {o:b, L:c};
}, kb(a, b, c, d) {
H.m.write(a, b, 0, d, c, !1);
return 0;
},},};
function wb(a, b) {
var c = 0;
a && (c |= 365);
b && (c |= 146);
return c;
}
var xb = null, yb = {}, zb = [], Ab = 1, Bb = null, Cb = !0, G = null, tb = {}, Eb = (a, b = {}) => {
a = db(a);
if (!a) {
return {path:"", node:null};
}
b = Object.assign({cb:!0, Qa:0}, b);
if (8 < b.Qa) {
throw new G(32);
}
a = a.split("/").filter(g => !!g);
for (var c = xb, d = "/", e = 0; e < a.length; e++) {
var f = e === a.length - 1;
if (f && b.parent) {
break;
}
c = ub(c, a[e]);
d = Za(d + "/" + a[e]);
c.Ba && (!f || f && b.cb) && (c = c.Ba.root);
if (!f || b.bb) {
for (f = 0; 40960 === (c.mode & 61440);) {
if (c = Db(d), d = db($a(d), c), c = Eb(d, {Qa:b.Qa + 1}).node, 40 < f++) {
throw new G(32);
}
}
}
}
return {path:d, node:c};
}, Fb = a => {
for (var b;;) {
if (a === a.parent) {
return a = a.S.jb, b ? "/" !== a[a.length - 1] ? `${a}/${b}` : a + b : a;
}
b = b ? `${a.name}/${b}` : a.name;
a = a.parent;
}
}, Hb = (a, b) => {
for (var c = 0, d = 0; d < b.length; d++) {
c = (c << 5) - c + b.charCodeAt(d) | 0;
}
return (a + c >>> 0) % Bb.length;
}, ub = (a, b) => {
var c;
if (c = (c = Ib(a, "x")) ? c : a.l.ka ? 0 : 2) {
throw new G(c, a);
}
for (c = Bb[Hb(a.id, b)]; c; c = c.ac) {
var d = c.name;
if (c.parent.id === a.id && d === b) {
return c;
}
}
return a.l.ka(a, b);
}, sb = (a, b, c, d) => {
a = new Jb(a, b, c, d);
b = Hb(a.parent.id, a.name);
a.ac = Bb[b];
return Bb[b] = a;
}, Kb = a => {
var b = ["r", "w", "rw"][a & 3];
a & 512 && (b += "w");
return b;
}, Ib = (a, b) => {
if (Cb) {
return 0;
}
if (!b.includes("r") || a.mode & 292) {
if (b.includes("w") && !(a.mode & 146) || b.includes("x") && !(a.mode & 73)) {
return 2;
}
} else {
return 2;
}
return 0;
}, Lb = (a, b) => {
try {
return ub(a, b), 20;
} catch (c) {
}
return Ib(a, "wx");
}, Mb = () => {
for (var a = 0; 4096 >= a; a++) {
if (!zb[a]) {
return a;
}
}
throw new G(33);
}, Nb = a => {
a = zb[a];
if (!a) {
throw new G(8);
}
return a;
}, Pb = (a, b = -1) => {
Ob || (Ob = function() {
this.h = {};
}, Ob.prototype = {}, Object.defineProperties(Ob.prototype, {object:{get() {
return this.node;
}, set(c) {
this.node = c;
}}, flags:{get() {
return this.h.flags;
}, set(c) {
this.h.flags = c;
},}, position:{get() {
return this.h.position;
}, set(c) {
this.h.position = c;
},},}));
a = Object.assign(new Ob(), a);
-1 == b && (b = Mb());
a.V = b;
return zb[b] = a;
}, rb = {open:a => {
a.m = yb[a.node.Da].m;
a.m.open && a.m.open(a);
}, $:() => {
throw new G(70);
},}, mb = (a, b) => {
yb[a] = {m:b};
}, Qb = (a, b) => {
var c = "/" === b, d = !b;
if (c && xb) {
throw new G(10);
}
if (!c && !d) {
var e = Eb(b, {cb:!1});
b = e.path;
e = e.node;
if (e.Ba) {
throw new G(10);
}
if (16384 !== (e.mode & 61440)) {
throw new G(54);
}
}
b = {type:a, Ic:{}, jb:b, $b:[]};
a = a.S(b);
a.S = b;
b.root = a;
c ? xb = a : e && (e.Ba = b, e.S && e.S.$b.push(b));
}, Rb = (a, b, c) => {
var d = Eb(a, {parent:!0}).node;
a = ab(a);
if (!a || "." === a || ".." === a) {
throw new G(28);
}
var e = Lb(d, a);
if (e) {
throw new G(e);
}
if (!d.l.Aa) {
throw new G(63);
}
return d.l.Aa(d, a, b, c);
}, Sb = (a, b, c) => {
"undefined" == typeof c && (c = b, b = 438);
Rb(a, b | 8192, c);
}, Tb = (a, b) => {
if (!db(a)) {
throw new G(44);
}
var c = Eb(b, {parent:!0}).node;
if (!c) {
throw new G(44);
}
b = ab(b);
var d = Lb(c, b);
if (d) {
throw new G(d);
}
if (!c.l.Ga) {
throw new G(63);
}
c.l.Ga(c, b, a);
}, Db = a => {
a = Eb(a).node;
if (!a) {
throw new G(44);
}
if (!a.l.la) {
throw new G(28);
}
return db(Fb(a.parent), a.l.la(a));
}, Vb = (a, b, c) => {
if ("" === a) {
throw new G(44);
}
if ("string" == typeof b) {
var d = {r:0, "r+":2, w:577, "w+":578, a:1089, "a+":1090,}[b];
if ("undefined" == typeof d) {
throw Error(`Unknown file open mode: ${b}`);
}
b = d;
}
c = b & 64 ? ("undefined" == typeof c ? 438 : c) & 4095 | 32768 : 0;
if ("object" == typeof a) {
var e = a;
} else {
a = Za(a);
try {
e = Eb(a, {bb:!(b & 131072)}).node;
} catch (f) {
}
}
d = !1;
if (b & 64) {
if (e) {
if (b & 128) {
throw new G(20);
}
} else {
e = Rb(a, c, 0), d = !0;
}
}
if (!e) {
throw new G(44);
}
8192 === (e.mode & 61440) && (b &= -513);
if (b & 65536 && 16384 !== (e.mode & 61440)) {
throw new G(54);
}
if (!d && (c = e ? 40960 === (e.mode & 61440) ? 32 : 16384 === (e.mode & 61440) && ("r" !== Kb(b) || b & 512) ? 31 : Ib(e, Kb(b)) : 44)) {
throw new G(c);
}
if (b & 512 && !d) {
c = e;
c = "string" == typeof c ? Eb(c, {bb:!0}).node : c;
if (!c.l.O) {
throw new G(63);
}
if (16384 === (c.mode & 61440)) {
throw new G(31);
}
if (32768 !== (c.mode & 61440)) {
throw new G(28);
}
if (d = Ib(c, "w")) {
throw new G(d);
}
c.l.O(c, {size:0, timestamp:Date.now()});
}
b &= -131713;
e = Pb({node:e, path:Fb(e), flags:b, seekable:!0, position:0, m:e.m, oc:[], error:!1});
e.m.open && e.m.open(e);
!l.logReadFiles || b & 1 || (Ub || (Ub = {}), a in Ub || (Ub[a] = 1));
return e;
}, Wb = (a, b, c) => {
if (null === a.V) {
throw new G(8);
}
if (!a.seekable || !a.m.$) {
throw new G(70);
}
if (0 != c && 1 != c && 2 != c) {
throw new G(28);
}
a.position = a.m.$(a, b, c);
a.oc = [];
}, Xb = () => {
G || (G = function(a, b) {
this.name = "ErrnoError";
this.node = b;
this.dc = function(c) {
this.Z = c;
};
this.dc(a);
this.message = "FS error";
}, G.prototype = Error(), G.prototype.constructor = G, [44].forEach(a => {
tb[a] = new G(a);
tb[a].stack = "<generic error, no stack>";
}));
}, Yb, $b = (a, b, c) => {
a = Za("/dev/" + a);
var d = wb(!!b, !!c);
Zb || (Zb = 64);
var e = Zb++ << 8 | 0;
mb(e, {open:f => {
f.seekable = !1;
}, close:() => {
c && c.buffer && c.buffer.length && c(10);
}, read:(f, g, k, p) => {
for (var n = 0, t = 0; t < p; t++) {
try {
var w = b();
} catch (y) {
throw new G(29);
}
if (void 0 === w && 0 === n) {
throw new G(6);
}
if (null === w || void 0 === w) {
break;
}
n++;
g[k + t] = w;
}
n && (f.node.timestamp = Date.now());
return n;
}, write:(f, g, k, p) => {
for (var n = 0; n < p; n++) {
try {
c(g[k + n]);
} catch (t) {
throw new G(29);
}
}
p && (f.node.timestamp = Date.now());
return n;
}});
Sb(a, d, e);
}, Zb, ac = {}, Ob, Ub, bc = void 0;
function cc() {
bc += 4;
return D[bc - 4 >> 2];
}
function dc(a) {
if (void 0 === a) {
return "_unknown";
}
a = a.replace(/[^a-zA-Z0-9_]/g, "$");
var b = a.charCodeAt(0);
return 48 <= b && 57 >= b ? `_${a}` : a;
}
function ec(a, b) {
a = dc(a);
return {[a]:function() {
return b.apply(this, arguments);
}}[a];
}
function fc() {
this.L = [void 0];
this.eb = [];
}
var I = new fc(), gc = void 0;
function K(a) {
throw new gc(a);
}
var hc = a => {
a || K("Cannot use deleted val. handle = " + a);
return I.get(a).value;
}, ic = a => {
switch(a) {
case void 0:
return 1;
case null:
return 2;
case !0:
return 3;
case !1:
return 4;
default:
return I.ra({qb:1, value:a});
}
};
function jc(a) {
var b = Error, c = ec(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 kc = void 0, lc = void 0;
function L(a) {
for (var b = ""; x[a];) {
b += lc[x[a++]];
}
return b;
}
var mc = [];
function nc() {
for (; mc.length;) {
var a = mc.pop();
a.g.ga = !1;
a["delete"]();
}
}
var oc = void 0, pc = {};
function qc(a, b) {
for (void 0 === b && K("ptr should not be undefined"); a.A;) {
b = a.na(b), a = a.A;
}
return b;
}
var rc = {};
function sc(a) {
a = tc(a);
var b = L(a);
uc(a);
return b;
}
function vc(a, b) {
var c = rc[a];
void 0 === c && K(b + " has unknown type " + sc(a));
return c;
}
function wc() {
}
var xc = !1;
function yc(a) {
--a.count.value;
0 === a.count.value && (a.G ? a.K.U(a.G) : a.u.i.U(a.o));
}
function zc(a, b, c) {
if (b === c) {
return a;
}
if (void 0 === c.A) {
return null;
}
a = zc(a, b, c.A);
return null === a ? null : c.Ib(a);
}
var Ac = {};
function Bc(a, b) {
b = qc(a, b);
return pc[b];
}
var Cc = void 0;
function Dc(a) {
throw new Cc(a);
}
function Ec(a, b) {
b.u && b.o || Dc("makeClassHandle requires ptr and ptrType");
!!b.K !== !!b.G && Dc("Both smartPtrType and smartPtr must be specified");
b.count = {value:1};
return Fc(Object.create(a, {g:{value:b,},}));
}
function Fc(a) {
if ("undefined" === typeof FinalizationRegistry) {
return Fc = b => b, a;
}
xc = new FinalizationRegistry(b => {
yc(b.g);
});
Fc = b => {
var c = b.g;
c.G && xc.register(b, {g:c}, b);
return b;
};
wc = b => {
xc.unregister(b);
};
return Fc(a);
}
var Gc = {};
function Hc(a) {
for (; a.length;) {
var b = a.pop();
a.pop()(b);
}
}
function Ic(a) {
return this.fromWireType(D[a >> 2]);
}
var Jc = {}, Kc = {};
function N(a, b, c) {
function d(k) {
k = c(k);
k.length !== a.length && Dc("Mismatched type converter count");
for (var p = 0; p < a.length; ++p) {
Lc(a[p], k[p]);
}
}
a.forEach(function(k) {
Kc[k] = b;
});
var e = Array(b.length), f = [], g = 0;
b.forEach((k, p) => {
rc.hasOwnProperty(k) ? e[p] = rc[k] : (f.push(k), Jc.hasOwnProperty(k) || (Jc[k] = []), Jc[k].push(() => {
e[p] = rc[k];
++g;
g === f.length && d(e);
}));
});
0 === f.length && d(e);
}
function Mc(a) {
switch(a) {
case 1:
return 0;
case 2:
return 1;
case 4:
return 2;
case 8:
return 3;
default:
throw new TypeError(`Unknown type size: ${a}`);
}
}
function Nc(a, b, c = {}) {
var d = b.name;
a || K(`type "${d}" must have a positive integer typeid pointer`);
if (rc.hasOwnProperty(a)) {
if (c.Tb) {
return;
}
K(`Cannot register type '${d}' twice`);
}
rc[a] = b;
delete Kc[a];
Jc.hasOwnProperty(a) && (b = Jc[a], delete Jc[a], b.forEach(e => e()));
}
function Lc(a, b, c = {}) {
if (!("argPackAdvance" in b)) {
throw new TypeError("registerType registeredInstance requires argPackAdvance");
}
Nc(a, b, c);
}
function Oc(a) {
K(a.g.u.i.name + " instance already deleted");
}
function Pc() {
}
function Qc(a, b, c) {
if (void 0 === a[b].B) {
var d = a[b];
a[b] = function() {
a[b].B.hasOwnProperty(arguments.length) || K(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${a[b].B})!`);
return a[b].B[arguments.length].apply(this, arguments);
};
a[b].B = [];
a[b].B[d.ea] = d;
}
}
function Rc(a, b, c) {
l.hasOwnProperty(a) ? ((void 0 === c || void 0 !== l[a].B && void 0 !== l[a].B[c]) && K(`Cannot register public name '${a}' twice`), Qc(l, a, a), l.hasOwnProperty(c) && K(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`), l[a].B[c] = b) : (l[a] = b, void 0 !== c && (l[a].Hc = c));
}
function Sc(a, b, c, d, e, f, g, k) {
this.name = a;
this.constructor = b;
this.M = c;
this.U = d;
this.A = e;
this.Nb = f;
this.na = g;
this.Ib = k;
this.nb = [];
}
function Tc(a, b, c) {
for (; b !== c;) {
b.na || K(`Expected null or instance of ${c.name}, got an instance of ${b.name}`), a = b.na(a), b = b.A;
}
return a;
}
function Uc(a, b) {
if (null === b) {
return this.Na && K(`null is not a valid ${this.name}`), 0;
}
b.g || K(`Cannot pass "${Vc(b)}" as a ${this.name}`);
b.g.o || K(`Cannot pass deleted object as a pointer of type ${this.name}`);
return Tc(b.g.o, b.g.u.i, this.i);
}
function Wc(a, b) {
if (null === b) {
this.Na && K(`null is not a valid ${this.name}`);
if (this.wa) {
var c = this.Pa();
null !== a && a.push(this.U, c);
return c;
}
return 0;
}
b.g || K(`Cannot pass "${Vc(b)}" as a ${this.name}`);
b.g.o || K(`Cannot pass deleted object as a pointer of type ${this.name}`);
!this.va && b.g.u.va && K(`Cannot convert argument of type ${b.g.K ? b.g.K.name : b.g.u.name} to parameter type ${this.name}`);
c = Tc(b.g.o, b.g.u.i, this.i);
if (this.wa) {
switch(void 0 === b.g.G && K("Passing raw pointer to smart pointer is illegal"), this.ic) {
case 0:
b.g.K === this ? c = b.g.G : K(`Cannot convert argument of type ${b.g.K ? b.g.K.name : b.g.u.name} to parameter type ${this.name}`);
break;
case 1:
c = b.g.G;
break;
case 2:
if (b.g.K === this) {
c = b.g.G;
} else {
var d = b.clone();
c = this.cc(c, ic(function() {
d["delete"]();
}));
null !== a && a.push(this.U, c);
}
break;
default:
K("Unsupporting sharing policy");
}
}
return c;
}
function Xc(a, b) {
if (null === b) {
return this.Na && K(`null is not a valid ${this.name}`), 0;
}
b.g || K(`Cannot pass "${Vc(b)}" as a ${this.name}`);
b.g.o || K(`Cannot pass deleted object as a pointer of type ${this.name}`);
b.g.u.va && K(`Cannot convert argument of type ${b.g.u.name} to parameter type ${this.name}`);
return Tc(b.g.o, b.g.u.i, this.i);
}
function Yc(a, b, c, d) {
this.name = a;
this.i = b;
this.Na = c;
this.va = d;
this.wa = !1;
this.U = this.cc = this.Pa = this.ob = this.ic = this.bc = void 0;
void 0 !== b.A ? this.toWireType = Wc : (this.toWireType = d ? Uc : Xc, this.J = null);
}
function Zc(a, b, c) {
l.hasOwnProperty(a) || Dc("Replacing nonexistant public symbol");
void 0 !== l[a].B && void 0 !== c ? l[a].B[c] = b : (l[a] = b, l[a].ea = c);
}
var $c = [], Q = a => {
var b = $c[a];
b || (a >= $c.length && ($c.length = a + 1), $c[a] = b = Ca.get(a));
return b;
}, ad = (a, b) => {
var c = [];
return function() {
c.length = 0;
Object.assign(c, arguments);
if (a.includes("j")) {
var d = l["dynCall_" + a];
d = c && c.length ? d.apply(null, [b].concat(c)) : d.call(null, b);
} else {
d = Q(b).apply(null, c);
}
return d;
};
};
function R(a, b) {
a = L(a);
var c = a.includes("j") ? ad(a, b) : Q(b);
"function" != typeof c && K(`unknown function pointer with signature ${a}: ${b}`);
return c;
}
var bd = void 0;
function cd(a, b) {
function c(f) {
e[f] || rc[f] || (Kc[f] ? Kc[f].forEach(c) : (d.push(f), e[f] = !0));
}
var d = [], e = {};
b.forEach(c);
throw new bd(`${a}: ` + d.map(sc).join([", "]));
}
function dd(a, b, c, d, e) {
var f = b.length;
2 > f && K("argTypes array size mismatch! Must at least get return value and 'this' types!");
var g = null !== b[1] && null !== c, k = !1;
for (c = 1; c < b.length; ++c) {
if (null !== b[c] && void 0 === b[c].J) {
k = !0;
break;
}
}
var p = "void" !== b[0].name, n = f - 2, t = Array(n), w = [], y = [];
return function() {
arguments.length !== n && K(`function ${a} called with ${arguments.length} arguments, expected ${n} args!`);
y.length = 0;
w.length = g ? 2 : 1;
w[0] = e;
if (g) {
var q = b[1].toWireType(y, this);
w[1] = q;
}
for (var r = 0; r < n; ++r) {
t[r] = b[r + 2].toWireType(y, arguments[r]), w.push(t[r]);
}
r = d.apply(null, w);
if (k) {
Hc(y);
} else {
for (var u = g ? 1 : 2; u < b.length; u++) {
var z = 1 === u ? q : t[u - 2];
null !== b[u].J && b[u].J(z);
}
}
q = p ? b[0].fromWireType(r) : void 0;
return q;
};
}
function ed(a, b) {
for (var c = [], d = 0; d < a; d++) {
c.push(E[b + 4 * d >> 2]);
}
return c;
}
function fd(a, b, c) {
a instanceof Object || K(`${c} with invalid "this": ${a}`);
a instanceof b.i.constructor || K(`${c} incompatible with "this" of type ${a.constructor.name}`);
a.g.o || K(`cannot call emscripten binding method ${c} on deleted object`);
return Tc(a.g.o, a.g.u.i, b.i);
}
function gd(a) {
a >= I.h && 0 === --I.get(a).qb && I.Sb(a);
}
function hd(a, b, c) {
switch(b) {
case 0:
return function(d) {
return this.fromWireType((c ? v : x)[d]);
};
case 1:
return function(d) {
return this.fromWireType((c ? A : za)[d >> 1]);
};
case 2:
return function(d) {
return this.fromWireType((c ? D : E)[d >> 2]);
};
default:
throw new TypeError("Unknown integer type: " + a);
}
}
function Vc(a) {
if (null === a) {
return "null";
}
var b = typeof a;
return "object" === b || "array" === b || "function" === b ? a.toString() : "" + a;
}
function jd(a, b) {
switch(b) {
case 2:
return function(c) {
return this.fromWireType(F[c >> 2]);
};
case 3:
return function(c) {
return this.fromWireType(Aa[c >> 3]);
};
default:
throw new TypeError("Unknown float type: " + a);
}
}
function kd(a, b, c) {
switch(b) {
case 0:
return c ? function(d) {
return v[d];
} : function(d) {
return x[d];
};
case 1:
return c ? function(d) {
return A[d >> 1];
} : function(d) {
return za[d >> 1];
};
case 2:
return c ? function(d) {
return D[d >> 2];
} : function(d) {
return E[d >> 2];
};
default:
throw new TypeError("Unknown integer type: " + a);
}
}
var ld = "undefined" != typeof TextDecoder ? new TextDecoder("utf-16le") : void 0, md = (a, b) => {
var c = a >> 1;
for (var d = c + b / 2; !(c >= d) && za[c];) {
++c;
}
c <<= 1;
if (32 < c - a && ld) {
return ld.decode(x.subarray(a, c));
}
c = "";
for (d = 0; !(d >= b / 2); ++d) {
var e = A[a + 2 * d >> 1];
if (0 == e) {
break;
}
c += String.fromCharCode(e);
}
return c;
}, nd = (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 e = 0; e < c; ++e) {
A[b >> 1] = a.charCodeAt(e), b += 2;
}
A[b >> 1] = 0;
return b - d;
}, od = a => 2 * a.length, pd = (a, b) => {
for (var c = 0, d = ""; !(c >= b / 4);) {
var e = D[a + 4 * c >> 2];
if (0 == e) {
break;
}
++c;
65536 <= e ? (e -= 65536, d += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023)) : d += String.fromCharCode(e);
}
return d;
}, qd = (a, b, c) => {
void 0 === c && (c = 2147483647);
if (4 > c) {
return 0;
}
var d = b;
c = d + c - 4;
for (var e = 0; e < a.length; ++e) {
var f = a.charCodeAt(e);
if (55296 <= f && 57343 >= f) {
var g = a.charCodeAt(++e);
f = 65536 + ((f & 1023) << 10) | g & 1023;
}
D[b >> 2] = f;
b += 4;
if (b + 4 > c) {
break;
}
}
D[b >> 2] = 0;
return b - d;
}, rd = 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;
}, sd = {};
function td(a) {
var b = sd[a];
return void 0 === b ? L(a) : b;
}
var ud = [];
function vd(a) {
var b = ud.length;
ud.push(a);
return b;
}
function wd(a, b) {
for (var c = Array(a), d = 0; d < a; ++d) {
c[d] = vc(E[b + 4 * d >> 2], "parameter " + d);
}
return c;
}
var xd = [], yd = [];
function zd(a) {
var b = a.getExtension("ANGLE_instanced_arrays");
b && (a.vertexAttribDivisor = function(c, d) {
b.vertexAttribDivisorANGLE(c, d);
}, a.drawArraysInstanced = function(c, d, e, f) {
b.drawArraysInstancedANGLE(c, d, e, f);
}, a.drawElementsInstanced = function(c, d, e, f, g) {
b.drawElementsInstancedANGLE(c, d, e, f, g);
});
}
function Ad(a) {
var b = a.getExtension("OES_vertex_array_object");
b && (a.createVertexArray = function() {
return b.createVertexArrayOES();
}, a.deleteVertexArray = function(c) {
b.deleteVertexArrayOES(c);
}, a.bindVertexArray = function(c) {
b.bindVertexArrayOES(c);
}, a.isVertexArray = function(c) {
return b.isVertexArrayOES(c);
});
}
function Bd(a) {
var b = a.getExtension("WEBGL_draw_buffers");
b && (a.drawBuffers = function(c, d) {
b.drawBuffersWEBGL(c, d);
});
}
var Cd = 1, Dd = [], Ed = [], Fd = [], Gd = [], Hd = [], Id = [], Jd = [], ia = [], Kd = [], Ld = [], Md = {}, Nd = {}, Od = 4;
function S(a) {
Pd || (Pd = a);
}
function ha(a) {
for (var b = Cd++, c = a.length; c < b; c++) {
a[c] = null;
}
return b;
}
function la(a) {
T = ia[a];
l.yc = U = T && T.Ua;
return !(a && !U);
}
function ka(a) {
a || (a = T);
if (!a.Ub) {
a.Ub = !0;
var b = a.Ua;
zd(b);
Ad(b);
Bd(b);
b.Za = b.getExtension("WEBGL_draw_instanced_base_vertex_base_instance");
b.hb = b.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance");
2 <= a.version && (b.$a = b.getExtension("EXT_disjoint_timer_query_webgl2"));
if (2 > a.version || !b.$a) {
b.$a = b.getExtension("EXT_disjoint_timer_query");
}
b.Fc = b.getExtension("WEBGL_multi_draw");
(b.getSupportedExtensions() || []).forEach(function(c) {
c.includes("lose_context") || c.includes("debug") || b.getExtension(c);
});
}
}
var Pd, T;
function Qd(a, b) {
U.bindFramebuffer(a, Fd[b]);
}
function Rd(a) {
U.bindVertexArray(Jd[a]);
}
function Sd(a, b) {
for (var c = 0; c < a; c++) {
var d = D[b + 4 * c >> 2];
U.deleteVertexArray(Jd[d]);
Jd[d] = null;
}
}
var Td = [];
function Ud(a, b, c, d) {
U.drawElements(a, b, c, d);
}
function Vd(a, b, c, d) {
for (var e = 0; e < a; e++) {
var f = U[c](), g = f && ha(d);
f ? (f.name = g, d[g] = f) : S(1282);
D[b + 4 * e >> 2] = g;
}
}
function Wd(a, b) {
Vd(a, b, "createVertexArray", Jd);
}
function Xd(a, b) {
if (b) {
var c = void 0;
switch(a) {
case 36346:
c = 1;