UNPKG

@rive-app/canvas

Version:

Rive's canvas based web api.

1,803 lines (1,799 loc) 296 kB
(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 _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined; return ( function(moduleArg = {}) { var moduleRtn; var m = moduleArg, ba, ca, da = new Promise((a, b) => { ba = a; ca = b; }), ea = "object" == typeof window, fa = "function" == typeof importScripts; function ha() { function a(g) { const k = d; c = b = 0; d = new Map(); k.forEach(p => { try { p(g); } catch (n) { console.error(n); } }); this.ob(); e && e.Qb(); } let b = 0, c = 0, d = new Map(), e = null, f = null; this.requestAnimationFrame = function(g) { 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.Ob = 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.Qb = 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() { f && (document.body.remove(f), f = null); e = null; }; this.ob = function() { }; } function ia(a) { console.assert(!0); const b = new Map(); let c = -Infinity; this.push = function(d) { d = d + ((1 << a) - 1) >> a; b.has(d) && clearTimeout(b.get(d)); b.set(d, setTimeout(function() { b.delete(d); 0 == b.length ? c = -Infinity : d == c && (c = Math.max(...b.keys()), console.assert(c < d)); }, 1000)); c = Math.max(d, c); return c << a; }; } const ja = m.onRuntimeInitialized; m.onRuntimeInitialized = function() { ja && ja(); let a = m.decodeAudio; m.decodeAudio = function(e, f) { e = a(e); f(e); }; let b = m.decodeFont; m.decodeFont = function(e, f) { e = b(e); f(e); }; const c = m.FileAssetLoader; m.ptrToAsset = e => { let f = m.ptrToFileAsset(e); return f.isImage ? m.ptrToImageAsset(e) : f.isFont ? m.ptrToFontAsset(e) : f.isAudio ? m.ptrToAudioAsset(e) : f; }; m.CustomFileAssetLoader = c.extend("CustomFileAssetLoader", {__construct:function({loadContents:e}) { this.__parent.__construct.call(this); this.Eb = e; }, loadContents:function(e, f) { e = m.ptrToAsset(e); return this.Eb(e, f); },}); m.CDNFileAssetLoader = c.extend("CDNFileAssetLoader", {__construct:function() { this.__parent.__construct.call(this); }, loadContents:function(e) { let f = m.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; },}); m.FallbackFileAssetLoader = c.extend("FallbackFileAssetLoader", {__construct:function() { this.__parent.__construct.call(this); this.kb = []; }, addLoader:function(e) { this.kb.push(e); }, loadContents:function(e, f) { for (let g of this.kb) { if (g.loadContents(e, f)) { return !0; } } return !1; },}); let d = m.computeAlignment; m.computeAlignment = function(e, f, g, k, p = 1.0) { return d.call(this, e, f, g, k, p); }; }; const ka = "createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "), la = new function() { function a() { if (!b) { var l = document.createElement("canvas"), u = {alpha:1, depth:0, stencil:0, antialias:0, premultipliedAlpha:1, preserveDrawingBuffer:0, powerPreference:"high-performance", failIfMajorPerformanceCaveat:0, enableExtensionsByDefault:1, explicitSwapControl:1, renderViaOffscreenBackBuffer:1,}; let r; if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) { if (r = l.getContext("webgl", u), c = 1, !r) { return console.log("No WebGL support. Image mesh will not be drawn."), !1; } } else { if (r = l.getContext("webgl2", u)) { c = 2; } else { if (r = l.getContext("webgl", u)) { c = 1; } else { return console.log("No WebGL support. Image mesh will not be drawn."), !1; } } } r = new Proxy(r, {get(G, w) { if (G.isContextLost()) { if (p || (console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ", w), p = !0), "function" === typeof G[w]) { return function() { }; } } else { return "function" === typeof G[w] ? function(...M) { return G[w].apply(G, M); } : G[w]; } }, set(G, w, M) { if (G.isContextLost()) { p || (console.error("Cannot render the mesh because the GL Context was lost. Tried to set property " + w), p = !0); } else { return G[w] = M, !0; } },}); d = Math.min(r.getParameter(r.MAX_RENDERBUFFER_SIZE), r.getParameter(r.MAX_TEXTURE_SIZE)); function C(G, w, M) { w = r.createShader(w); r.shaderSource(w, M); r.compileShader(w); M = r.getShaderInfoLog(w); if (0 < (M || "").length) { throw M; } r.attachShader(G, w); } l = r.createProgram(); C(l, r.VERTEX_SHADER, "attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }"); C(l, r.FRAGMENT_SHADER, "precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }"); r.bindAttribLocation(l, 0, "vertex"); r.bindAttribLocation(l, 1, "uv"); r.linkProgram(l); u = r.getProgramInfoLog(l); if (0 < (u || "").trim().length) { throw u; } e = r.getUniformLocation(l, "mat"); f = r.getUniformLocation(l, "translate"); r.useProgram(l); r.bindBuffer(r.ARRAY_BUFFER, r.createBuffer()); r.enableVertexAttribArray(0); r.enableVertexAttribArray(1); r.bindBuffer(r.ELEMENT_ARRAY_BUFFER, r.createBuffer()); r.uniform1i(r.getUniformLocation(l, "image"), 0); r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0); b = r; } return !0; } let b = null, c = 0, d = 0, e = null, f = null, g = 0, k = 0, p = !1; a(); this.bc = function() { a(); return d; }; this.Kb = function(l) { b.deleteTexture && b.deleteTexture(l); }; this.Jb = function(l) { if (!a()) { return null; } const u = b.createTexture(); if (!u) { return null; } b.bindTexture(b.TEXTURE_2D, u); b.texImage2D(b.TEXTURE_2D, 0, b.RGBA, b.RGBA, b.UNSIGNED_BYTE, l); b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_S, b.CLAMP_TO_EDGE); b.texParameteri(b.TEXTURE_2D, b.TEXTURE_WRAP_T, b.CLAMP_TO_EDGE); b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MAG_FILTER, b.LINEAR); 2 == c ? (b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR_MIPMAP_LINEAR), b.generateMipmap(b.TEXTURE_2D)) : b.texParameteri(b.TEXTURE_2D, b.TEXTURE_MIN_FILTER, b.LINEAR); return u; }; const n = new ia(8), t = new ia(8), x = new ia(10), y = new ia(10); this.Nb = function(l, u, r, C, G) { if (a()) { var w = n.push(l), M = t.push(u); if (b.canvas) { if (b.canvas.width != w || b.canvas.height != M) { b.canvas.width = w, b.canvas.height = M; } b.viewport(0, M - u, l, u); b.disable(b.SCISSOR_TEST); b.clearColor(0, 0, 0, 0); b.clear(b.COLOR_BUFFER_BIT); b.enable(b.SCISSOR_TEST); r.sort((J, Z) => Z.vb - J.vb); w = x.push(C); g != w && (b.bufferData(b.ARRAY_BUFFER, 8 * w, b.DYNAMIC_DRAW), g = w); w = 0; for (var T of r) { b.bufferSubData(b.ARRAY_BUFFER, w, T.Ta), w += 4 * T.Ta.length; } console.assert(w == 4 * C); for (var W of r) { b.bufferSubData(b.ARRAY_BUFFER, w, W.Bb), w += 4 * W.Bb.length; } console.assert(w == 8 * C); w = y.push(G); k != w && (b.bufferData(b.ELEMENT_ARRAY_BUFFER, 2 * w, b.DYNAMIC_DRAW), k = w); T = 0; for (var pa of r) { b.bufferSubData(b.ELEMENT_ARRAY_BUFFER, T, pa.indices), T += 2 * pa.indices.length; } console.assert(T == 2 * G); pa = 0; W = !0; w = T = 0; for (const J of r) { J.image.Ja != pa && (b.bindTexture(b.TEXTURE_2D, J.image.Ia || null), pa = J.image.Ja); J.hc ? (b.scissor(J.Za, M - J.$a - J.jb, J.uc, J.jb), W = !0) : W && (b.scissor(0, M - u, l, u), W = !1); r = 2 / l; const Z = -2 / u; b.uniform4f(e, J.ha[0] * r * J.Aa, J.ha[1] * Z * J.Ba, J.ha[2] * r * J.Aa, J.ha[3] * Z * J.Ba); b.uniform2f(f, J.ha[4] * r * J.Aa + r * (J.Za - J.cc * J.Aa) - 1, J.ha[5] * Z * J.Ba + Z * (J.$a - J.dc * J.Ba) + 1); b.vertexAttribPointer(0, 2, b.FLOAT, !1, 0, w); b.vertexAttribPointer(1, 2, b.FLOAT, !1, 0, w + 4 * C); b.drawElements(b.TRIANGLES, J.indices.length, b.UNSIGNED_SHORT, T); w += 4 * J.Ta.length; T += 2 * J.indices.length; } console.assert(w == 4 * C); console.assert(T == 2 * G); } } }; this.canvas = function() { return a() && b.canvas; }; }(), ma = m.onRuntimeInitialized; m.onRuntimeInitialized = function() { function a(q) { switch(q) { case n.srcOver: return "source-over"; case n.screen: return "screen"; case n.overlay: return "overlay"; case n.darken: return "darken"; case n.lighten: return "lighten"; case n.colorDodge: return "color-dodge"; case n.colorBurn: return "color-burn"; case n.hardLight: return "hard-light"; case n.softLight: return "soft-light"; case n.difference: return "difference"; case n.exclusion: return "exclusion"; case n.multiply: return "multiply"; case n.hue: return "hue"; case n.saturation: return "saturation"; case n.color: return "color"; case n.luminosity: return "luminosity"; } } function b(q) { return "rgba(" + ((16711680 & q) >>> 16) + "," + ((65280 & q) >>> 8) + "," + ((255 & q) >>> 0) + "," + ((4278190080 & q) >>> 24) / 255 + ")"; } function c() { 0 < M.length && (la.Nb(w.drawWidth(), w.drawHeight(), M, T, W), M = [], W = T = 0, w.reset(512, 512)); for (const q of G) { for (const v of q.I) { v(); } q.I = []; } G.clear(); } ma && ma(); var d = m.RenderPaintStyle; const e = m.RenderPath, f = m.RenderPaint, g = m.Renderer, k = m.StrokeCap, p = m.StrokeJoin, n = m.BlendMode, t = d.fill, x = d.stroke, y = m.FillRule.evenOdd; let l = 1; var u = m.RenderImage.extend("CanvasRenderImage", {__construct:function({la:q, wa:v} = {}) { this.__parent.__construct.call(this); this.Ja = l; l = l + 1 & 2147483647 || 1; this.la = q; this.wa = v; }, __destruct:function() { this.Ia && (la.Kb(this.Ia), URL.revokeObjectURL(this.Wa)); this.__parent.__destruct.call(this); }, decode:function(q) { var v = this; v.wa && v.wa(v); var H = new Image(); v.Wa = URL.createObjectURL(new Blob([q], {type:"image/png",})); H.onload = function() { v.Db = H; v.Ia = la.Jb(H); v.size(H.width, H.height); v.la && v.la(v); }; H.src = v.Wa; },}), r = e.extend("CanvasRenderPath", {__construct:function() { this.__parent.__construct.call(this); this.U = new Path2D(); }, rewind:function() { this.U = new Path2D(); }, addPath:function(q, v, H, E, K, I, F) { var L = this.U, aa = L.addPath; q = q.U; const R = new DOMMatrix(); R.a = v; R.b = H; R.c = E; R.d = K; R.e = I; R.f = F; aa.call(L, q, R); }, fillRule:function(q) { this.Va = q; }, moveTo:function(q, v) { this.U.moveTo(q, v); }, lineTo:function(q, v) { this.U.lineTo(q, v); }, cubicTo:function(q, v, H, E, K, I) { this.U.bezierCurveTo(q, v, H, E, K, I); }, close:function() { this.U.closePath(); },}), C = f.extend("CanvasRenderPaint", {color:function(q) { this.Xa = b(q); }, thickness:function(q) { this.Gb = q; }, join:function(q) { switch(q) { case p.miter: this.Ha = "miter"; break; case p.round: this.Ha = "round"; break; case p.bevel: this.Ha = "bevel"; } }, cap:function(q) { switch(q) { case k.butt: this.Ga = "butt"; break; case k.round: this.Ga = "round"; break; case k.square: this.Ga = "square"; } }, style:function(q) { this.Fb = q; }, blendMode:function(q) { this.Cb = a(q); }, clearGradient:function() { this.ja = null; }, linearGradient:function(q, v, H, E) { this.ja = {xb:q, yb:v, cb:H, eb:E, Qa:[],}; }, radialGradient:function(q, v, H, E) { this.ja = {xb:q, yb:v, cb:H, eb:E, Qa:[], ac:!0,}; }, addStop:function(q, v) { this.ja.Qa.push({color:q, stop:v,}); }, completeGradient:function() { }, draw:function(q, v, H, E) { let K = this.Fb; var I = this.Xa, F = this.ja; const L = q.globalCompositeOperation, aa = q.globalAlpha; q.globalCompositeOperation = this.Cb; q.globalAlpha = E; if (null != F) { I = F.xb; const X = F.yb, S = F.cb; var R = F.eb; E = F.Qa; F.ac ? (F = S - I, R -= X, I = q.createRadialGradient(I, X, 0, I, X, Math.sqrt(F * F + R * R))) : I = q.createLinearGradient(I, X, S, R); for (let xa = 0, Ya = E.length; xa < Ya; xa++) { F = E[xa], I.addColorStop(F.stop, b(F.color)); } this.Xa = I; this.ja = null; } switch(K) { case x: q.strokeStyle = I; q.lineWidth = this.Gb; q.lineCap = this.Ga; q.lineJoin = this.Ha; q.stroke(v); break; case t: q.fillStyle = I, q.fill(v, H); } q.globalCompositeOperation = L; q.globalAlpha = aa; },}); const G = new Set(); let w = null, M = [], T = 0, W = 0; var pa = m.CanvasRenderer = g.extend("Renderer", {__construct:function(q) { this.__parent.__construct.call(this); this.T = [1, 0, 0, 1, 0, 0]; this.G = [1.0]; this.B = q.getContext("2d"); this.Ua = q; this.I = []; }, save:function() { this.T.push(...this.T.slice(this.T.length - 6)); this.G.push(this.G[this.G.length - 1]); this.I.push(this.B.save.bind(this.B)); }, restore:function() { const q = this.T.length - 6; if (6 > q) { throw "restore() called without matching save()."; } this.T.splice(q); this.G.pop(); this.I.push(this.B.restore.bind(this.B)); }, transform:function(q, v, H, E, K, I) { const F = this.T, L = F.length - 6; F.splice(L, 6, F[L] * q + F[L + 2] * v, F[L + 1] * q + F[L + 3] * v, F[L] * H + F[L + 2] * E, F[L + 1] * H + F[L + 3] * E, F[L] * K + F[L + 2] * I + F[L + 4], F[L + 1] * K + F[L + 3] * I + F[L + 5]); this.I.push(this.B.transform.bind(this.B, q, v, H, E, K, I)); }, rotate:function(q) { const v = Math.sin(q); q = Math.cos(q); this.transform(q, v, -v, q, 0, 0); }, modulateOpacity:function(q) { this.G[this.G.length - 1] *= q; }, _drawPath:function(q, v) { this.I.push(v.draw.bind(v, this.B, q.U, q.Va === y ? "evenodd" : "nonzero", Math.max(0, this.G[this.G.length - 1]))); }, _drawRiveImage:function(q, v, H, E) { var K = q.Db; if (K) { var I = this.B, F = a(H), L = Math.max(0, E * this.G[this.G.length - 1]); this.I.push(function() { I.globalCompositeOperation = F; I.globalAlpha = L; I.drawImage(K, 0, 0); I.globalAlpha = 1; }); } }, _getMatrix:function(q) { const v = this.T, H = v.length - 6; for (let E = 0; 6 > E; ++E) { q[E] = v[H + E]; } }, _drawImageMesh:function(q, v, H, E, K, I, F, L, aa, R, X) { v = this.B.canvas.width; var S = this.B.canvas.height; const xa = R - L, Ya = X - aa; L = Math.max(L, 0); aa = Math.max(aa, 0); R = Math.min(R, v); X = Math.min(X, S); const Fa = R - L, Ga = X - aa; console.assert(Fa <= Math.min(xa, v)); console.assert(Ga <= Math.min(Ya, S)); if (!(0 >= Fa || 0 >= Ga)) { R = Fa < xa || Ga < Ya; v = X = 1; var qa = Math.ceil(Fa * X), ra = Math.ceil(Ga * v); S = la.bc(); qa > S && (X *= S / qa, qa = S); ra > S && (v *= S / ra, ra = S); w || (w = new m.DynamicRectanizer(S), w.reset(512, 512)); S = w.addRect(qa, ra); 0 > S && (c(), G.add(this), S = w.addRect(qa, ra), console.assert(0 <= S)); var $b = S & 65535, ac = S >> 16; M.push({ha:this.T.slice(this.T.length - 6), image:q, Za:$b, $a:ac, cc:L, dc:aa, uc:qa, jb:ra, Aa:X, Ba:v, Ta:new Float32Array(K), Bb:new Float32Array(I), indices:new Uint16Array(F), hc:R, vb:q.Ja << 1 | (R ? 1 : 0),}); T += K.length; W += F.length; var ya = this.B, od = a(H), pd = Math.max(0, E * this.G[this.G.length - 1]); this.I.push(function() { ya.save(); ya.resetTransform(); ya.globalCompositeOperation = od; ya.globalAlpha = pd; const bc = la.canvas(); bc && ya.drawImage(bc, $b, ac, qa, ra, L, aa, Fa, Ga); ya.restore(); }); } }, _clipPath:function(q) { this.I.push(this.B.clip.bind(this.B, q.U, q.Va === y ? "evenodd" : "nonzero")); }, clear:function() { G.add(this); this.I.push(this.B.clearRect.bind(this.B, 0, 0, this.Ua.width, this.Ua.height)); }, flush:function() { }, translate:function(q, v) { this.transform(1, 0, 0, 1, q, v); },}); m.makeRenderer = function(q) { const v = new pa(q), H = v.B; return new Proxy(v, {get(E, K) { if ("function" === typeof E[K]) { return function(...I) { return E[K].apply(E, I); }; } if ("function" === typeof H[K]) { if (-1 < ka.indexOf(K)) { throw Error("RiveException: Method call to '" + K + "()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods."); } return function(...I) { v.I.push(H[K].bind(H, ...I)); }; } return E[K]; }, set(E, K, I) { if (K in H) { return v.I.push(() => { H[K] = I; }), !0; } },}); }; m.decodeImage = function(q, v) { (new u({la:v})).decode(q); }; m.renderFactory = {makeRenderPaint:function() { return new C(); }, makeRenderPath:function() { return new r(); }, makeRenderImage:function() { let q = Z; return new u({wa:() => { q.total++; }, la:() => { q.loaded++; if (q.loaded === q.total) { const v = q.ready; v && (v(), q.ready = null); } },}); },}; let J = m.load, Z = null; m.load = function(q, v, H = !0) { const E = new m.FallbackFileAssetLoader(); void 0 !== v && E.addLoader(v); H && (v = new m.CDNFileAssetLoader(), E.addLoader(v)); return new Promise(function(K) { let I = null; Z = {total:0, loaded:0, ready:function() { K(I); },}; I = J(q, E); 0 == Z.total && K(I); }); }; let qd = m.RendererWrapper.prototype.align; m.RendererWrapper.prototype.align = function(q, v, H, E, K = 1.0) { qd.call(this, q, v, H, E, K); }; d = new ha(); m.requestAnimationFrame = d.requestAnimationFrame.bind(d); m.cancelAnimationFrame = d.cancelAnimationFrame.bind(d); m.enableFPSCounter = d.Ob.bind(d); m.disableFPSCounter = d.Lb; d.ob = c; m.resolveAnimationFrame = c; m.cleanup = function() { w && w.delete(); }; }; var na = Object.assign({}, m), oa = "./this.program", sa = "", ta, ua; if (ea || fa) { fa ? sa = self.location.href : "undefined" != typeof document && document.currentScript && (sa = document.currentScript.src), _scriptName && (sa = _scriptName), sa.startsWith("blob:") ? sa = "" : sa = sa.substr(0, sa.replace(/[?#].*/, "").lastIndexOf("/") + 1), fa && (ua = a => { var b = new XMLHttpRequest(); b.open("GET", a, !1); b.responseType = "arraybuffer"; b.send(null); return new Uint8Array(b.response); }), ta = (a, b, c) => { if (va(a)) { 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); } else { fetch(a, {credentials:"same-origin"}).then(e => e.ok ? e.arrayBuffer() : Promise.reject(Error(e.status + " : " + e.url))).then(b, c); } }; } var wa = m.print || console.log.bind(console), za = m.printErr || console.error.bind(console); Object.assign(m, na); na = null; m.thisProgram && (oa = m.thisProgram); var Aa; m.wasmBinary && (Aa = m.wasmBinary); var Ba, Ca = !1, z, A, Da, Ea, B, D, Ha, Ia; function Ja() { var a = Ba.buffer; m.HEAP8 = z = new Int8Array(a); m.HEAP16 = Da = new Int16Array(a); m.HEAPU8 = A = new Uint8Array(a); m.HEAPU16 = Ea = new Uint16Array(a); m.HEAP32 = B = new Int32Array(a); m.HEAPU32 = D = new Uint32Array(a); m.HEAPF32 = Ha = new Float32Array(a); m.HEAPF64 = Ia = new Float64Array(a); } var Ka = [], La = [], Ma = []; function Na() { var a = m.preRun.shift(); Ka.unshift(a); } var Oa = 0, Pa = null, Qa = null; function Ra(a) { m.onAbort?.(a); a = "Aborted(" + a + ")"; za(a); Ca = !0; a = new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info."); ca(a); throw a; } var Sa = a => a.startsWith("data:application/octet-stream;base64,"), va = a => a.startsWith("file://"), Ta; function Ua(a) { if (a == Ta && Aa) { return new Uint8Array(Aa); } if (ua) { return ua(a); } throw "both async and sync fetching of the wasm failed"; } function Va(a) { return Aa ? Promise.resolve().then(() => Ua(a)) : new Promise((b, c) => { ta(a, d => b(new Uint8Array(d)), () => { try { b(Ua(a)); } catch (d) { c(d); } }); }); } function Wa(a, b, c) { return Va(a).then(d => WebAssembly.instantiate(d, b)).then(c, d => { za(`failed to asynchronously prepare wasm: ${d}`); Ra(d); }); } function Xa(a, b) { var c = Ta; return Aa || "function" != typeof WebAssembly.instantiateStreaming || Sa(c) || va(c) || "function" != typeof fetch ? Wa(c, a, b) : fetch(c, {credentials:"same-origin"}).then(d => WebAssembly.instantiateStreaming(d, a).then(b, function(e) { za(`wasm streaming compile failed: ${e}`); za("falling back to ArrayBuffer instantiation"); return Wa(c, a, b); })); } var Za, $a, db = {491138:(a, b, c, d, e) => { if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) { return 0; } if ("undefined" === typeof window.h) { window.h = {za:0}; window.h.J = {}; window.h.J.xa = a; window.h.J.capture = b; window.h.J.Ka = c; window.h.ga = {}; window.h.ga.stopped = d; window.h.ga.wb = e; let f = window.h; f.D = []; f.sc = function(g) { for (var k = 0; k < f.D.length; ++k) { if (null == f.D[k]) { return f.D[k] = g, k; } } f.D.push(g); return f.D.length - 1; }; f.Ab = function(g) { for (f.D[g] = null; 0 < f.D.length;) { if (null == f.D[f.D.length - 1]) { f.D.pop(); } else { break; } } }; f.Pc = function(g) { for (var k = 0; k < f.D.length; ++k) { if (f.D[k] == g) { return f.Ab(k); } } }; f.qa = function(g) { return f.D[g]; }; f.Sa = ["touchend", "click"]; f.unlock = function() { for (var g = 0; g < f.D.length; ++g) { var k = f.D[g]; null != k && null != k.L && k.state === f.ga.wb && k.L.resume().then(() => { ab(k.pb); }, p => { console.error("Failed to resume audiocontext", p); }); } f.Sa.map(function(p) { document.removeEventListener(p, f.unlock, !0); }); }; f.Sa.map(function(g) { document.addEventListener(g, f.unlock, !0); }); } window.h.za += 1; return 1; }, 493316:() => { "undefined" !== typeof window.h && (window.h.Sa.map(function(a) { document.removeEventListener(a, window.h.unlock, !0); }), --window.h.za, 0 === window.h.za && delete window.h); }, 493620:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 493724:() => { try { var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate; a.close(); return b; } catch (c) { return 0; } }, 493895:(a, b, c, d, e, f) => { if ("undefined" === typeof window.h) { return -1; } var g = {}, k = {}; a == window.h.J.xa && 0 != c && (k.sampleRate = c); g.L = new (window.AudioContext || window.webkitAudioContext)(k); g.L.suspend(); g.state = window.h.ga.stopped; c = 0; a != window.h.J.xa && (c = b); g.Z = g.L.createScriptProcessor(d, c, b); g.Z.onaudioprocess = function(p) { if (null == g.ra || 0 == g.ra.length) { g.ra = new Float32Array(Ha.buffer, e, d * b); } if (a == window.h.J.capture || a == window.h.J.Ka) { for (var n = 0; n < b; n += 1) { for (var t = p.inputBuffer.getChannelData(n), x = g.ra, y = 0; y < d; y += 1) { x[y * b + n] = t[y]; } } bb(f, d, e); } if (a == window.h.J.xa || a == window.h.J.Ka) { for (cb(f, d, e), n = 0; n < p.outputBuffer.numberOfChannels; ++n) { for (t = p.outputBuffer.getChannelData(n), x = g.ra, y = 0; y < d; y += 1) { t[y] = x[y * b + n]; } } } else { for (n = 0; n < p.outputBuffer.numberOfChannels; ++n) { p.outputBuffer.getChannelData(n).fill(0.0); } } }; a != window.h.J.capture && a != window.h.J.Ka || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(p) { g.Ca = g.L.createMediaStreamSource(p); g.Ca.connect(g.Z); g.Z.connect(g.L.destination); }).catch(function(p) { console.log("Failed to get user media: " + p); }); a == window.h.J.xa && g.Z.connect(g.L.destination); g.pb = f; return window.h.sc(g); }, 496772:a => window.h.qa(a).L.sampleRate, 496845:a => { a = window.h.qa(a); void 0 !== a.Z && (a.Z.onaudioprocess = function() { }, a.Z.disconnect(), a.Z = void 0); void 0 !== a.Ca && (a.Ca.disconnect(), a.Ca = void 0); a.L.close(); a.L = void 0; a.pb = void 0; }, 497245:a => { window.h.Ab(a); }, 497295:a => { a = window.h.qa(a); a.L.resume(); a.state = window.h.ga.wb; }, 497434:a => { a = window.h.qa(a); a.L.suspend(); a.state = window.h.ga.stopped; }}, eb = a => { for (; 0 < a.length;) { a.shift()(m); } }; function fb() { var a = B[+gb >> 2]; gb += 4; return a; } var hb = (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; }, ib = a => { var b = "/" === a.charAt(0), c = "/" === a.substr(-1); (a = hb(a.split("/").filter(d => !!d), !b).join("/")) || b || (a = "."); a && c && (a += "/"); return (b ? "/" : "") + a; }, jb = a => { var b = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1); a = b[0]; b = b[1]; if (!a && !b) { return "."; } b &&= b.substr(0, b.length - 1); return a + b; }, kb = a => { if ("/" === a) { return "/"; } a = ib(a); a = a.replace(/\/$/, ""); var b = a.lastIndexOf("/"); return -1 === b ? a : a.substr(b + 1); }, lb = () => { if ("object" == typeof crypto && "function" == typeof crypto.getRandomValues) { return a => crypto.getRandomValues(a); } Ra("initRandomDevice"); }, mb = a => (mb = lb())(a), nb = (...a) => { for (var b = "", c = !1, d = a.length - 1; -1 <= d && !c; d--) { c = 0 <= d ? a[d] : "/"; if ("string" != typeof c) { throw new TypeError("Arguments to path.resolve must be strings"); } if (!c) { return ""; } b = c + "/" + b; c = "/" === c.charAt(0); } b = hb(b.split("/").filter(e => !!e), !c).join("/"); return (c ? "/" : "") + b || "."; }, ob = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, pb = (a, b, c) => { var d = b + c; for (c = b; a[c] && !(c >= d);) { ++c; } if (16 < c - b && a.buffer && ob) { return ob.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; }, qb = [], rb = 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; }, sb = (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 tb(a, b) { var c = Array(rb(a) + 1); a = sb(a, c, 0, c.length); b && (c.length = a); return c; } var ub = []; function vb(a, b) { ub[a] = {input:[], H:[], W:b}; wb(a, xb); } var xb = {open(a) { var b = ub[a.node.ya]; if (!b) { throw new N(43); } a.s = b; a.seekable = !1; }, close(a) { a.s.W.pa(a.s); }, pa(a) { a.s.W.pa(a.s); }, read(a, b, c, d) { if (!a.s || !a.s.W.ib) { throw new N(60); } for (var e = 0, f = 0; f < d; f++) { try { var g = a.s.W.ib(a.s); } catch (k) { throw new N(29); } if (void 0 === g && 0 === e) { throw new N(6); } if (null === g || void 0 === g) { break; } e++; b[c + f] = g; } e && (a.node.timestamp = Date.now()); return e; }, write(a, b, c, d) { if (!a.s || !a.s.W.Na) { throw new N(60); } try { for (var e = 0; e < d; e++) { a.s.W.Na(a.s, b[c + e]); } } catch (f) { throw new N(29); } d && (a.node.timestamp = Date.now()); return e; },}, yb = {ib() { a: { if (!qb.length) { var a = null; "undefined" != typeof window && "function" == typeof window.prompt && (a = window.prompt("Input: "), null !== a && (a += "\n")); if (!a) { a = null; break a; } qb = tb(a, !0); } a = qb.shift(); } return a; }, Na(a, b) { null === b || 10 === b ? (wa(pb(a.H, 0)), a.H = []) : 0 != b && a.H.push(b); }, pa(a) { a.H && 0 < a.H.length && (wa(pb(a.H, 0)), a.H = []); }, Yb() { return {Ac:25856, Cc:5, zc:191, Bc:35387, yc:[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,]}; }, Zb() { return 0; }, $b() { return [24, 80]; },}, zb = {Na(a, b) { null === b || 10 === b ? (za(pb(a.H, 0)), a.H = []) : 0 != b && a.H.push(b); }, pa(a) { a.H && 0 < a.H.length && (za(pb(a.H, 0)), a.H = []); },}; function Ab(a, b) { var c = a.l ? a.l.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.l, a.l = new Uint8Array(b), 0 < a.v && a.l.set(c.subarray(0, a.v), 0)); } var O = {O:null, V() { return O.createNode(null, "/", 16895, 0); }, createNode(a, b, c, d) { if (24576 === (c & 61440) || 4096 === (c & 61440)) { throw new N(63); } O.O || (O.O = {dir:{node:{Y:O.j.Y, R:O.j.R, ka:O.j.ka, ua:O.j.ua, tb:O.j.tb, zb:O.j.zb, ub:O.j.ub, sb:O.j.sb, Da:O.j.Da}, stream:{ba:O.m.ba}}, file:{node:{Y:O.j.Y, R:O.j.R}, stream:{ba:O.m.ba, read:O.m.read, write:O.m.write, Ya:O.m.Ya, lb:O.m.lb, nb:O.m.nb}}, link:{node:{Y:O.j.Y, R:O.j.R, ma:O.j.ma}, stream:{}}, ab:{node:{Y:O.j.Y, R:O.j.R}, stream:Bb}}); c = Cb(a, b, c, d); 16384 === (c.mode & 61440) ? (c.j = O.O.dir.node, c.m = O.O.dir.stream, c.l = {}) : 32768 === (c.mode & 61440) ? (c.j = O.O.file.node, c.m = O.O.file.stream, c.v = 0, c.l = null) : 40960 === (c.mode & 61440) ? (c.j = O.O.link.node, c.m = O.O.link.stream) : 8192 === (c.mode & 61440) && (c.j = O.O.ab.node, c.m = O.O.ab.stream); c.timestamp = Date.now(); a && (a.l[b] = c, a.timestamp = c.timestamp); return c; }, Gc(a) { return a.l ? a.l.subarray ? a.l.subarray(0, a.v) : new Uint8Array(a.l) : new Uint8Array(0); }, j:{Y(a) { var b = {}; b.Ec = 8192 === (a.mode & 61440) ? a.id : 1; b.Ic = a.id; b.mode = a.mode; b.Lc = 1; b.uid = 0; b.Hc = 0; b.ya = a.ya; 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.wc = new Date(a.timestamp); b.Kc = new Date(a.timestamp); b.Dc = new Date(a.timestamp); b.Hb = 4096; b.xc = Math.ceil(b.size / b.Hb); return b; }, R(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.l = null, a.v = 0; } else { var c = a.l; a.l = new Uint8Array(b); c && a.l.set(c.subarray(0, Math.min(b, a.v))); a.v = b; } } }, ka() { throw Db[44]; }, ua(a, b, c, d) { return O.createNode(a, b, c, d); }, tb(a, b, c) { if (16384 === (a.mode & 61440)) { try { var d = Eb(b, c); } catch (f) { } if (d) { for (var e in d.l) { throw new N(55); } } } delete a.parent.l[a.name]; a.parent.timestamp = Date.now(); a.name = c; b.l[c] = a; b.timestamp = a.parent.timestamp; }, zb(a, b) { delete a.l[b]; a.timestamp = Date.now(); }, ub(a, b) { var c = Eb(a, b), d; for (d in c.l) { throw new N(55); } delete a.l[b]; a.timestamp = Date.now(); }, sb(a) { var b = [".", ".."], c; for (c of Object.keys(a.l)) { b.push(c); } return b; }, Da(a, b, c) { a = O.createNode(a, b, 41471, 0); a.link = c; return a; }, ma(a) { if (40960 !== (a.mode & 61440)) { throw new N(28); } return a.link; },}, m:{read(a, b, c, d, e) { var f = a.node.l; 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 === z.buffer && (f = !1); if (!d) { return 0; } a = a.node; a.timestamp = Date.now(); if (b.subarray && (!a.l || a.l.subarray)) { if (f) { return a.l = b.subarray(c, c + d), a.v = d; } if (0 === a.v && 0 === e) { return a.l = b.slice(c, c + d), a.v = d; } if (e + d <= a.v) { return a.l.set(b.subarray(c, c + d), e), d; } } Ab(a, e + d); if (a.l.subarray && b.subarray) { a.l.set(b.subarray(c, c + d), e); } else { for (f = 0; f < d; f++) { a.l[e + f] = b[c + f]; } } a.v = Math.max(a.v, e + d); return d; }, ba(a, b, c) { 1 === c ? b += a.position : 2 === c && 32768 === (a.node.mode & 61440) && (b += a.node.v); if (0 > b) { throw new N(28); } return b; }, Ya(a, b, c) { Ab(a.node, b + c); a.node.v = Math.max(a.node.v, b + c); }, lb(a, b, c, d, e) { if (32768 !== (a.node.mode & 61440)) { throw new N(43); } a = a.node.l; if (e & 2 || a.buffer !== z.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; Ra(); b = void 0; if (!b) { throw new N(48); } z.set(a, b); } else { c = !1, b = a.byteOffset; } return {o:b, vc:c}; }, nb(a, b, c, d) { O.m.write(a, b, 0, d, c, !1); return 0; },},}, Fb = (a, b) => { var c = 0; a && (c |= 365); b && (c |= 146); return c; }, Gb = null, Hb = {}, Ib = [], Jb = 1, Kb = null, Lb = !0, N = class { constructor(a) { this.name = "ErrnoError"; this.aa = a; } }, Db = {}, Mb = class { constructor() { this.h = {}; this.node = null; } get flags() { return this.h.flags; } set flags(a) { this.h.flags = a; } get position() { return this.h.position; } set position(a) { this.h.position = a; } }, Nb = class { constructor(a, b, c, d) { a ||= this; this.parent = a; this.V = a.V; this.va = null; this.id = Jb++; this.name = b; this.mode = c; this.j = {}; this.m = {}; this.ya = d; } get read() { return 365 === (this.mode & 365); } set read(a) { a ? this.mode |= 365 : this.mode &= -366; } get write() { return 146 === (this.mode & 146); } set write(a) { a ? this.mode |= 146 : this.mode &= -147; } }; function Ob(a, b = {}) { a = nb(a); if (!a) { return {path:"", node:null}; } b = Object.assign({hb:!0, Pa:0}, b); if (8 < b.Pa) { throw new N(32); } a = a.split("/").filter(g => !!g); for (var c = Gb, d = "/", e = 0; e < a.length; e++) { var f = e === a.length - 1; if (f && b.parent) { break; } c = Eb(c, a[e]); d = ib(d + "/" + a[e]); c.va && (!f || f && b.hb) && (c = c.va.root); if (!f || b.gb) { for (f = 0; 40960 === (c.mode & 61440);) { if (c = Pb(d), d = nb(jb(d), c), c = Ob(d, {Pa:b.Pa + 1}).node, 40 < f++) { throw new N(32); } } } } return {path:d, node:c}; } function Qb(a) { for (var b;;) { if (a === a.parent) { return a = a.V.mb, b ? "/" !== a[a.length - 1] ? `${a}/${b}` : a + b : a; } b = b ? `${a.name}/${b}` : a.name; a = a.parent; } } function Rb(a, b) { for (var c = 0, d = 0; d < b.length; d++) { c = (c << 5) - c + b.charCodeAt(d) | 0; } return (a + c >>> 0) % Kb.length; } function Eb(a, b) { var c = 16384 === (a.mode & 61440) ? (c = Sb(a, "x")) ? c : a.j.ka ? 0 : 2 : 54; if (c) { throw new N(c); } for (c = Kb[Rb(a.id, b)]; c; c = c.fc) { var d = c.name; if (c.parent.id === a.id && d === b) { return c; } } return a.j.ka(a, b); } function Cb(a, b, c, d) { a = new Nb(a, b, c, d); b = Rb(a.parent.id, a.name); a.fc = Kb[b]; return Kb[b] = a; } function Tb(a) { var b = ["r", "w", "rw"][a & 3]; a & 512 && (b += "w"); return b; } function Sb(a, b) { if (Lb) { 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; } function Ub(a, b) { try { return Eb(a, b), 20; } catch (c) { } return Sb(a, "wx"); } function Vb(a) { a = Ib[a]; if (!a) { throw new N(8); } return a; } function Wb(a, b = -1) { a = Object.assign(new Mb(), a); if (-1 == b) { a: { for (b = 0; 4096 >= b; b++) { if (!Ib[b]) { break a; } } throw new N(33); } } a.X = b; return Ib[b] = a; } function Xb(a, b = -1) { a = Wb(a, b); a.m?.Fc?.(a); return a; } var Bb = {open(a) { a.m = Hb[a.node.ya].m; a.m.open?.(a); }, ba() { throw new N(70); },}; function wb(a, b) { Hb[a] = {m:b}; } function Yb(a, b) { var c = "/" === b; if (c && Gb) { throw new N(10); } if (!c && b) { var d = Ob(b, {hb:!1}); b = d.path; d = d.node; if (d.va) { throw new N(10); } if (16384 !== (d.mode & 61440)) { throw new N(54); } } b = {type:a, Nc:{}, mb:b, ec:[]}; a = a.V(b); a.V = b; b.root = a; c ? Gb = a : d && (d.va = b, d.V && d.V.ec.push(b)); } function Zb(a, b, c) { var d = Ob(a, {parent:!0}).node; a = kb(a); if (!a || "." === a || ".." === a) { throw new N(28); } var e = Ub(d, a); if (e) { throw new N(e); } if (!d.j.ua) { throw new N(63); } return d.j.ua(d, a, b, c); } function cc(a) { return Zb(a, 16895, 0); } function dc(a, b, c) { "undefined" == typeof c && (c = b, b = 438); Zb(a, b | 8192, c); } function ec(a, b) { if (!nb(a)) { throw new N(44); } var c = Ob(b, {parent:!0}).node; if (!c) { throw new N(44); } b = kb(b); var d = Ub(c, b); if (d) { throw new N(d); } if (!c.j.Da) { throw new N(63); } c.j.Da(c, b, a); } function Pb(a) { a = Ob(a).node; if (!a) { throw new N(44); } if (!a.j.ma) { throw new N(28); } return nb(Qb(a.parent), a.j.ma(a)); } function fc(a, b, c) { if ("" === a) { throw new N(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 = ib(a); try { e = Ob(a, {gb:!(b & 131072)}).node; } catch (f) { } } d = !1; if (b & 64) { if (e) { if (b & 128) { throw new N(20); } } else { e = Zb(a, c, 0), d = !0; } } if (!e) { throw new N(44); } 8192 === (e.mode & 61440) && (b &= -513); if (b & 65536 && 16384 !== (e.mode & 61440)) { throw new N(54); } if (!d && (c = e ? 40960 === (e.mode & 61440) ? 32 : 16384 === (e.mode & 61440) && ("r" !== Tb(b) || b & 512) ? 31 : Sb(e, Tb(b)) : 44)) { throw new N(c); } if (b & 512 && !d) { c = e; c = "string" == typeof c ? Ob(c, {gb:!0}).node : c; if (!c.j.R) { throw new N(63); } if (16384 === (c.mode & 61440)) { throw new N(31); } if (32768 !== (c.mode & 61440)) { throw new N(28); } if (d = Sb(c, "w")) { throw new N(d); } c.j.R(c, {size:0, timestamp:Date.now()}); } b &= -131713; e = Wb({node:e, path:Qb(e), flags:b, seekable:!0, position:0, m:e.m, tc:[], error:!1}); e.m.open && e.m.open(e); !m.logReadFiles || b & 1 || (gc ||= {}, a in gc || (gc[a] = 1)); return e; } function hc(a, b, c) { if (null === a.X) { throw new N(8); } if (!a.seekable || !a.m.ba) { throw new N(70); } if (0 != c && 1 != c && 2 != c) { throw new N(28); } a.position = a.m.ba(a, b, c); a.tc = []; } var ic; function jc(a, b, c) { a = ib("/dev/" + a); var d = Fb(!!b, !!c); kc ||= 64; var e = kc++ << 8 | 0; wb(e, {open(f) { f.seekable = !1; }, close() { c?.buffer?.length && c(10); }, read(f, g, k, p) { for (var n = 0, t = 0; t < p; t++) { try { var x = b(); } catch (y) { throw new N(29); } if (void 0 === x && 0 === n) { throw new N(6); } if (null === x || void 0 === x) { break; } n++; g[k + t] = x; } 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 N(29); } } p && (f.node.timestamp = Date.now()); return n; }}); dc(a, d, e); } var kc, lc = {}, gc, gb = void 0, mc = (a, b) => Object.defineProperty(b, "name", {value:a}), nc = [], oc = [], P, pc = a => { if (!a) { throw new P("Cannot use deleted val. handle = " + a); } return oc[a]; }, qc = a => { switch(a) { case void 0: return 2; case null: return 4; case !0: return 6; case !1: return 8; default: const b = nc.pop() || oc.length; oc[b] = a; oc[b + 1] = 1; return b; } }, rc = a => { var b = Error, c = mc(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; }, sc, tc, Q = a => { for (var b = ""; A[a];) { b += tc[A[a++]]; } return b; }, uc = [], vc = () => { for (; uc.length;) { var a = uc.pop(); a.g.fa = !1; a["delete"](); } }, wc, xc = {}, yc = (a, b) => { if (void 0 === b) { throw new P("ptr should not be undefined"); } for (; a.C;) { b = a.na(b), a = a.C; } return b; }, zc = {}, Cc = a => { a = Ac(a); var b = Q(a); Bc(a); return b; }, Dc = (a, b) => { var c = zc[a]; if (void 0 === c) { throw a = `${b} has unknown type ${Cc(a)}`, new P(a); } return c; }, Ec = () => { }, Fc = !1, Gc = (a, b, c) => { if (b === c) { return a; } if (void 0 === c.C) { return null; } a = Gc(a, b, c.C); return null === a ? null : c.Mb(a); }, Hc = {}, Ic = (a, b) => { b = yc(a, b); return xc[b]; }, Jc, Lc = (a, b) => { if (!b.u || !b.o) { throw new Jc("makeClassHandle requires ptr and ptrType"); } if (!!b.K !== !!b.F) { throw new Jc("Both smartPtrType and smartPtr must be specified"); } b.count = {value:1}; return Kc(Object.create(a, {g:{value:b, writable:!0,},})); }, Kc = a => { if ("undefined" === typeof FinalizationRegistry) { return Kc = b => b, a; } Fc = new FinalizationRegistry(b => { b = b.g; --b.count.value; 0 === b.count.value && (b.F ? b.K.P(b.F) : b.u.i.P(b.o)); }); Kc = b => { var c = b.g; c.F && Fc.register(b, {g:c}, b); return b; }; Ec = b => { Fc.unregister(b); }; return Kc(a); }, Mc = {}, Nc = a => { for (; a.length;) { var b = a.pop(); a.pop()(b); } }; function Oc(a) { return this.fromWireType(D[a >> 2]); } var Pc = {}, Qc = {}, U = (a, b, c) => { function d(k) { k = c(k); if (k.length !== a.length) { throw new Jc("Mismatched type converter count"); } for (var p = 0; p < a.length; ++p) { Rc(a[p], k[p]); } } a.forEach(function(k) { Qc[k] = b; }); var e = Array(b.length), f = [], g = 0; b.forEach((k, p) => { zc.hasOwnProperty(k) ? e[p] = zc[k] : (f.push(k), Pc.hasOwnProperty(k) || (Pc[k] = []), Pc[k].push(() => { e[p] = zc[k]; ++g; g === f.length && d(e); })); }); 0 === f.length && d(e); }; function Sc(a, b, c = {}) { var d = b.name; if (!a) { throw new P(`type "${d}" must have a positive integer typeid pointer`); } if (zc.hasOwnProperty(a)) { if (c.Wb) { return; } throw new P(`Cannot register type '${d}' twice`); } zc[a] = b; delete Qc[a]; Pc.hasOwnProperty(a) && (b = Pc[a], delete Pc[a], b.forEach(e => e())); } function Rc(a, b, c = {}) { if (!("argPackAdvance" in b)) { throw new TypeError("registerType registeredInstance requires argPackAdvance"); } return Sc(a, b, c); } var Tc = a => { throw new P(a.g.u.i.name + " instance already deleted"); }; function Uc() { } var Vc = (a, b, c) => { if (void 0 === a[b].A) { var d = a[b]; a[b] = function(...e) { if (!a[b].A.hasOwnProperty(e.length)) { throw new P(`Function '${c}' c