UNPKG

@rive-app/webgl

Version:

Rive's webgl based web api.

1,775 lines (1,756 loc) 327 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_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Animation: () => (/* reexport safe */ _Animation__WEBPACK_IMPORTED_MODULE_0__.Animation) /* harmony export */ }); /* harmony import */ var _Animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /***/ }), /* 2 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Animation: () => (/* binding */ Animation) /* harmony export */ }); /** * Represents an animation that can be played on an Artboard. * Wraps animations and instances from the runtime and keeps track of playback state. * * The `Animation` class manages the state and behavior of a single animation instance, * including its current time, loop count, and ability to scrub to a specific time. * * The class provides methods to advance the animation, apply its interpolated keyframe * values to the Artboard, and clean up the underlying animation instance when the * animation is no longer needed. */ var Animation = /** @class */ (function () { /** * Constructs a new animation * @constructor * @param {any} animation: runtime animation object * @param {any} instance: runtime animation instance object */ function Animation(animation, artboard, runtime, playing) { this.animation = animation; this.artboard = artboard; this.playing = playing; this.loopCount = 0; /** * The time to which the animation should move to on the next render. * If not null, the animation will scrub to this time instead of advancing by the given time. */ this.scrubTo = null; this.instance = new runtime.LinearAnimationInstance(animation, artboard); } Object.defineProperty(Animation.prototype, "name", { /** * Returns the animation's name */ get: function () { return this.animation.name; }, enumerable: false, configurable: true }); Object.defineProperty(Animation.prototype, "time", { /** * Returns the animation's name */ get: function () { return this.instance.time; }, /** * Sets the animation's current time */ set: function (value) { this.instance.time = value; }, enumerable: false, configurable: true }); Object.defineProperty(Animation.prototype, "loopValue", { /** * Returns the animation's loop type */ get: function () { return this.animation.loopValue; }, enumerable: false, configurable: true }); Object.defineProperty(Animation.prototype, "needsScrub", { /** * Indicates whether the animation needs to be scrubbed. * @returns `true` if the animation needs to be scrubbed, `false` otherwise. */ get: function () { return this.scrubTo !== null; }, enumerable: false, configurable: true }); /** * Advances the animation by the give time. If the animation needs scrubbing, * time is ignored and the stored scrub value is used. * @param time the time to advance the animation by if no scrubbing required */ Animation.prototype.advance = function (time) { if (this.scrubTo === null) { this.instance.advance(time); } else { this.instance.time = 0; this.instance.advance(this.scrubTo); this.scrubTo = null; } }; /** * Apply interpolated keyframe values to the artboard. This should be called after calling * .advance() on an animation instance so that new values are applied to properties. * * Note: This does not advance the artboard, which updates all objects on the artboard * @param mix - Mix value for the animation from 0 to 1 */ Animation.prototype.apply = function (mix) { this.instance.apply(mix); }; /** * Deletes the backing Wasm animation instance; once this is called, this * animation is no more. */ Animation.prototype.cleanup = function () { this.instance.delete(); }; return Animation; }()); /***/ }), /* 3 */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ RuntimeLoader: () => (/* binding */ RuntimeLoader) /* harmony export */ }); /* harmony import */ var _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); /* harmony import */ var package_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5); // Runtime singleton; use getInstance to provide a callback that returns the // Rive runtime var RuntimeLoader = /** @class */ (function () { // Class is never instantiated function RuntimeLoader() { } // Loads the runtime RuntimeLoader.loadRuntime = function () { if (RuntimeLoader.enablePerfMarks) performance.mark('rive:wasm-init:start'); _rive_advanced_mjs__WEBPACK_IMPORTED_MODULE_0__["default"]({ // Loads Wasm bundle locateFile: function () { return RuntimeLoader.wasmURL; }, }) .then(function (rive) { var _a; if (RuntimeLoader.enablePerfMarks) { performance.mark('rive:wasm-init:end'); performance.measure('rive:wasm-init', 'rive:wasm-init:start', 'rive:wasm-init:end'); } RuntimeLoader.runtime = rive; // Fire all the callbacks while (RuntimeLoader.callBackQueue.length > 0) { (_a = RuntimeLoader.callBackQueue.shift()) === null || _a === void 0 ? void 0 : _a(RuntimeLoader.runtime); } }) .catch(function (error) { // Capture specific error details var errorDetails = { message: (error === null || error === void 0 ? void 0 : error.message) || "Unknown error", type: (error === null || error === void 0 ? void 0 : error.name) || "Error", // Some browsers may provide additional WebAssembly-specific details wasmError: error instanceof WebAssembly.CompileError || error instanceof WebAssembly.RuntimeError, originalError: error, }; // Log detailed error for debugging console.debug("Rive WASM load error details:", errorDetails); // In case unpkg fails, or the wasm was not supported, we try to load the fallback module from jsdelivr. // This `rive_fallback.wasm` is compiled to support older architecture. // TODO: (Gordon): preemptively test browser support and load the correct wasm file. Then use jsdelvr only if unpkg fails. var backupJsdelivrUrl = "https://cdn.jsdelivr.net/npm/".concat(package_json__WEBPACK_IMPORTED_MODULE_1__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_1__.version, "/rive_fallback.wasm"); if (RuntimeLoader.wasmURL.toLowerCase() !== backupJsdelivrUrl) { console.warn("Failed to load WASM from ".concat(RuntimeLoader.wasmURL, " (").concat(errorDetails.message, "), trying jsdelivr as a backup")); RuntimeLoader.setWasmUrl(backupJsdelivrUrl); RuntimeLoader.loadRuntime(); } else { var errorMessage = [ "Could not load Rive WASM file from ".concat(RuntimeLoader.wasmURL, " or ").concat(backupJsdelivrUrl, "."), "Possible reasons:", "- Network connection is down", "- WebAssembly is not supported in this environment", "- The WASM file is corrupted or incompatible", "\nError details:", "- Type: ".concat(errorDetails.type), "- Message: ".concat(errorDetails.message), "- WebAssembly-specific error: ".concat(errorDetails.wasmError), "\nTo resolve, you may need to:", "1. Check your network connection", "2. Set a new WASM source via RuntimeLoader.setWasmUrl()", "3. Call RuntimeLoader.loadRuntime() again", ].join("\n"); console.error(errorMessage); } }); }; // Provides a runtime instance via a callback RuntimeLoader.getInstance = function (callback) { // If it's not loading, start loading runtime if (!RuntimeLoader.isLoading) { RuntimeLoader.isLoading = true; RuntimeLoader.loadRuntime(); } if (!RuntimeLoader.runtime) { RuntimeLoader.callBackQueue.push(callback); } else { callback(RuntimeLoader.runtime); } }; // Provides a runtime instance via a promise RuntimeLoader.awaitInstance = function () { return new Promise(function (resolve) { return RuntimeLoader.getInstance(function (rive) { return resolve(rive); }); }); }; // Manually sets the wasm url RuntimeLoader.setWasmUrl = function (url) { RuntimeLoader.wasmURL = url; }; // Gets the current wasm url RuntimeLoader.getWasmUrl = function () { return RuntimeLoader.wasmURL; }; // Flag to indicate that loading has started/completed RuntimeLoader.isLoading = false; // List of callbacks for the runtime that come in while loading RuntimeLoader.callBackQueue = []; // Path to the Wasm file; default path works for testing only; // if embedded wasm is used then this is never used. RuntimeLoader.wasmURL = "https://unpkg.com/".concat(package_json__WEBPACK_IMPORTED_MODULE_1__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_1__.version, "/rive.wasm"); /** * When true, performance.mark / performance.measure entries are emitted for * WASM initialization. */ RuntimeLoader.enablePerfMarks = false; return RuntimeLoader; }()); /***/ }), /* 4 */ /***/ ((__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 l = moduleArg, aa, ba, ca = new Promise((a, b) => { aa = a; ba = b; }), da = "object" == typeof window, ea = "function" == typeof importScripts; function fa() { function a(g) { const k = d; c = b = 0; d = new Map(); k.forEach(m => { try { m(g); } catch (p) { console.error(p); } }); this.jb(); e && e.Ib(); } 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.Gb = 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, m = 0; this.Ib = function() { var p = performance.now(); m ? (++k, p -= m, 1000 < p && (g(1000 * k / p), k = m = 0)) : (m = p, k = 0); }; }(); }; this.jb = function() { }; } function ia() { 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 ja = l.onRuntimeInitialized; l.onRuntimeInitialized = function() { ja && ja(); let a = l.decodeAudio; l.decodeAudio = function(f, g) { f = a(f); g(f); }; let b = l.decodeFont; l.decodeFont = function(f, g) { f = b(f); g(f); }; let c = l.setFallbackFontCb; l.setFallbackFontCallback = "function" === typeof c ? function(f) { c(f); } : function() { console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build."); }; const d = l.FileAssetLoader; l.ptrToAsset = f => { let g = l.ptrToFileAsset(f); return g.isImage ? l.ptrToImageAsset(f) : g.isFont ? l.ptrToFontAsset(f) : g.isAudio ? l.ptrToAudioAsset(f) : g; }; l.CustomFileAssetLoader = d.extend("CustomFileAssetLoader", {__construct:function({loadContents:f}) { this.__parent.__construct.call(this); this.yb = f; }, loadContents:function(f, g) { f = l.ptrToAsset(f); return this.yb(f, g); },}); l.CDNFileAssetLoader = d.extend("CDNFileAssetLoader", {__construct:function() { this.__parent.__construct.call(this); }, loadContents:function(f) { let g = l.ptrToAsset(f); f = g.cdnUuid; if ("" === f) { return !1; } (function(k, m) { var p = new XMLHttpRequest(); p.responseType = "arraybuffer"; p.onreadystatechange = function() { 4 == p.readyState && 200 == p.status && m(p); }; p.open("GET", k, !0); p.send(null); })(g.cdnBaseUrl + "/" + f, k => { g.decode(new Uint8Array(k.response)); }); return !0; },}); l.FallbackFileAssetLoader = d.extend("FallbackFileAssetLoader", {__construct:function() { this.__parent.__construct.call(this); this.eb = []; }, addLoader:function(f) { this.eb.push(f); }, loadContents:function(f, g) { for (let k of this.eb) { if (k.loadContents(f, g)) { return !0; } } return !1; },}); let e = l.computeAlignment; l.computeAlignment = function(f, g, k, m, p = 1.0) { return e.call(this, f, g, k, m, p); }; }; const ka = l.onRuntimeInitialized; l.onRuntimeInitialized = function() { function a(t) { this.G = t; this.vb = t.getContext("2d"); this.Ab = e; this.R = []; this.ia = 0; this.clear = function() { console.assert(0 == this.ia); this.R = []; f.delete(this); }; this.save = function() { ++this.ia; this.R.push(e.save.bind(e)); }; this.restore = function() { 0 < this.ia && (this.R.push(e.restore.bind(e)), --this.ia); }; this.transform = function(v) { this.R.push(e.transform.bind(e, v)); }; this.align = function(v, z, D, F, M = 1.0) { this.R.push(e.align.bind(e, v, z, D, F, M)); }; this.flush = function() { console.assert(0 == this.ia); f.add(this); d && c(); }; } function b(t) { var v = {alpha:1, depth:0, stencil:8, antialias:0, premultipliedAlpha:1, preserveDrawingBuffer:0, powerPreference:"high-performance", failIfMajorPerformanceCaveat:0, enableExtensionsByDefault:1, explicitSwapControl:0, renderViaOffscreenBackBuffer:0,}, z = t.getContext("webgl2", v); z ||= t.getContext("webgl", v); var D = z, F = la(ma), M = {handle:F, attributes:v, version:v.zc, Sa:D}; D.canvas && (D.canvas.ic = M); ma[F] = M; ("undefined" == typeof v.Fb || v.Fb) && na(M); oa(F); v = g(t.width, t.height); v.xb = F; v.G = t; v.Ua = t.width; v.Ta = t.height; v.wb = z; return v; } function c() { if (e) { var t = e.zb, v = 0, z = 0, D = 0, F = Array(f.size), M = 0; for (var N of f) { N.ca = Math.min(N.G.width, t), N.ba = Math.min(N.G.height, t), N.Ha = N.ba * N.ca, v = Math.max(v, N.ca), z = Math.max(z, N.ba), D += N.Ha, F[M++] = N; } f.clear(); if (!(0 >= D)) { v = 1 << (0 >= v ? 0 : 32 - Math.clz32(v - 1)); for (z = 1 << (0 >= z ? 0 : 32 - Math.clz32(z - 1)); z * v < D;) { v <= z ? v *= 2 : z *= 2; } v = Math.min(v, t); v = Math.min(z, t); F.sort((ha, zb) => zb.Ha - ha.Ha); D = new l.DynamicRectanizer(t); for (N = 0; N < F.length;) { D.reset(v, z); for (M = N; M < F.length; ++M) { var O = F[M], L = D.addRect(O.ca, O.ba); if (0 > L) { console.assert(M > N); break; } O.oa = L & 65535; O.pa = L >> 16; } O = m.push(D.drawWidth()); L = p.push(D.drawHeight()); console.assert(O >= D.drawWidth()); console.assert(L >= D.drawHeight()); console.assert(O <= t); console.assert(L <= t); e.G.width != O && (e.G.width = O); e.G.height != L && (e.G.height = L); e.clear(); for (O = N; O < M; ++O) { L = F[O]; e.saveClipRect(L.oa, L.pa, L.oa + L.ca, L.pa + L.ba); let ha = new l.Mat2D(); ha.xx = L.ca / L.G.width; ha.yy = L.ba / L.G.height; ha.xy = ha.yx = 0; ha.tx = L.oa; ha.ty = L.pa; e.transform(ha); for (const zb of L.R) { zb(); } e.restoreClipRect(); L.R = []; } for (e.flush(); N < M; ++N) { O = F[N], L = O.vb, L.globalCompositeOperation = "copy", L.drawImage(e.G, O.oa, O.pa, O.ca, O.ba, 0, 0, O.G.width, O.G.height); } N = M; } } } } ka && ka(); const d = navigator.userAgent.match(/firefox|fxios/i); let e = null; const f = new Set(), g = l.makeRenderer; l.makeRenderer = function(t, v) { return v ? (e || (e = b(document.createElement("canvas")), v = e.wb, e.zb = Math.min(v.getParameter(v.MAX_RENDERBUFFER_SIZE), v.getParameter(v.MAX_TEXTURE_SIZE))), new a(t)) : b(t); }; const k = l.Artboard.prototype.draw; l.Artboard.prototype.draw = function(t) { t.R ? t.R.push(k.bind(this, t.Ab)) : k.call(this, t); }; const m = new ia(), p = new ia(), r = new fa(); l.requestAnimationFrame = r.requestAnimationFrame.bind(r); l.cancelAnimationFrame = r.cancelAnimationFrame.bind(r); l.enableFPSCounter = r.Gb.bind(r); r.jb = c; l.resolveAnimationFrame = c; let w = l.load; l.load = function(t, v, z = !0) { const D = new l.FallbackFileAssetLoader(); void 0 !== v && D.addLoader(v); z && (v = new l.CDNFileAssetLoader(), D.addLoader(v)); return Promise.resolve(w(t, D)); }; const y = l.WebGLRenderer.prototype.clear; l.WebGLRenderer.prototype.clear = function() { oa(this.xb); const t = this.G; if (this.Ua != t.width || this.Ta != t.height) { this.resize(t.width, t.height), this.Ua = t.width, this.Ta = t.height; } y.call(this); }; l.decodeImage = function(t, v) { t = l.decodeImageSkia(t); v(t); }; let q = l.Renderer.prototype.align; l.Renderer.prototype.align = function(t, v, z, D, F = 1.0) { q.call(this, t, v, z, D, F); }; }; var pa = Object.assign({}, l), qa = "./this.program", ra = "", sa, ta; if (da || ea) { ea ? ra = self.location.href : "undefined" != typeof document && document.currentScript && (ra = document.currentScript.src), _scriptName && (ra = _scriptName), ra.startsWith("blob:") ? ra = "" : ra = ra.substr(0, ra.replace(/[?#].*/, "").lastIndexOf("/") + 1), ea && (ta = a => { var b = new XMLHttpRequest(); b.open("GET", a, !1); b.responseType = "arraybuffer"; b.send(null); return new Uint8Array(b.response); }), sa = (a, b, c) => { if (ua(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 va = l.print || console.log.bind(console), wa = l.printErr || console.error.bind(console); Object.assign(l, pa); pa = null; l.thisProgram && (qa = l.thisProgram); var xa; l.wasmBinary && (xa = l.wasmBinary); var ya, za = !1, n, u, Aa, Ba, x, A, B, Ca; function Da() { var a = ya.buffer; l.HEAP8 = n = new Int8Array(a); l.HEAP16 = Aa = new Int16Array(a); l.HEAPU8 = u = new Uint8Array(a); l.HEAPU16 = Ba = new Uint16Array(a); l.HEAP32 = x = new Int32Array(a); l.HEAPU32 = A = new Uint32Array(a); l.HEAPF32 = B = new Float32Array(a); l.HEAPF64 = Ca = new Float64Array(a); } var Ea = [], Fa = [], Ga = []; function Ha() { var a = l.preRun.shift(); Ea.unshift(a); } var Ia = 0, Ja = null, Ka = null; function La(a) { l.onAbort?.(a); a = "Aborted(" + a + ")"; wa(a); za = !0; a = new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info."); ba(a); throw a; } var Ma = a => a.startsWith("data:application/octet-stream;base64,"), ua = a => a.startsWith("file://"), Na; function Oa(a) { if (a == Na && xa) { return new Uint8Array(xa); } if (ta) { return ta(a); } throw "both async and sync fetching of the wasm failed"; } function Pa(a) { return xa ? Promise.resolve().then(() => Oa(a)) : new Promise((b, c) => { sa(a, d => b(new Uint8Array(d)), () => { try { b(Oa(a)); } catch (d) { c(d); } }); }); } function Qa(a, b, c) { return Pa(a).then(d => WebAssembly.instantiate(d, b)).then(c, d => { wa(`failed to asynchronously prepare wasm: ${d}`); La(d); }); } function Ra(a, b) { var c = Na; return xa || "function" != typeof WebAssembly.instantiateStreaming || Ma(c) || ua(c) || "function" != typeof fetch ? Qa(c, a, b) : fetch(c, {credentials:"same-origin"}).then(d => WebAssembly.instantiateStreaming(d, a).then(b, function(e) { wa(`wasm streaming compile failed: ${e}`); wa("falling back to ArrayBuffer instantiation"); return Qa(c, a, b); })); } var Sa, Ta, Xa = {729298:(a, b, c, d, e) => { if ("undefined" === typeof window || void 0 === (window.AudioContext || window.webkitAudioContext)) { return 0; } if ("undefined" === typeof window.h) { window.h = {Ca:0}; window.h.H = {}; window.h.H.Aa = a; window.h.H.capture = b; window.h.H.Ja = c; window.h.ga = {}; window.h.ga.stopped = d; window.h.ga.qb = e; let f = window.h; f.C = []; f.fc = 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.ub = 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.Gc = function(g) { for (var k = 0; k < f.C.length; ++k) { if (f.C[k] == g) { return f.ub(k); } } }; f.ra = function(g) { return f.C[g]; }; f.Ra = ["touchend", "click"]; f.unlock = function() { for (var g = 0; g < f.C.length; ++g) { var k = f.C[g]; null != k && null != k.J && k.state === f.ga.qb && k.J.resume().then(() => { Ua(k.kb); }, m => { console.error("Failed to resume audiocontext", m); }); } f.Ra.map(function(m) { document.removeEventListener(m, f.unlock, !0); }); }; f.Ra.map(function(g) { document.addEventListener(g, f.unlock, !0); }); } window.h.Ca += 1; return 1; }, 731476:() => { "undefined" !== typeof window.h && (window.h.Ra.map(function(a) { document.removeEventListener(a, window.h.unlock, !0); }), --window.h.Ca, 0 === window.h.Ca && delete window.h); }, 731780:() => void 0 !== navigator.mediaDevices && void 0 !== navigator.mediaDevices.getUserMedia, 731884:() => { try { var a = new (window.AudioContext || window.webkitAudioContext)(), b = a.sampleRate; a.close(); return b; } catch (c) { return 0; } }, 732055:(a, b, c, d, e, f) => { if ("undefined" === typeof window.h) { return -1; } var g = {}, k = {}; a == window.h.H.Aa && 0 != c && (k.sampleRate = c); g.J = new (window.AudioContext || window.webkitAudioContext)(k); g.J.suspend(); g.state = window.h.ga.stopped; c = 0; a != window.h.H.Aa && (c = b); g.W = g.J.createScriptProcessor(d, c, b); g.W.onaudioprocess = function(m) { if (null == g.sa || 0 == g.sa.length) { g.sa = new Float32Array(B.buffer, e, d * b); } if (a == window.h.H.capture || a == window.h.H.Ja) { for (var p = 0; p < b; p += 1) { for (var r = m.inputBuffer.getChannelData(p), w = g.sa, y = 0; y < d; y += 1) { w[y * b + p] = r[y]; } } Va(f, d, e); } if (a == window.h.H.Aa || a == window.h.H.Ja) { for (Wa(f, d, e), p = 0; p < m.outputBuffer.numberOfChannels; ++p) { for (r = m.outputBuffer.getChannelData(p), w = g.sa, y = 0; y < d; y += 1) { r[y] = w[y * b + p]; } } } else { for (p = 0; p < m.outputBuffer.numberOfChannels; ++p) { m.outputBuffer.getChannelData(p).fill(0.0); } } }; a != window.h.H.capture && a != window.h.H.Ja || navigator.mediaDevices.getUserMedia({audio:!0, video:!1}).then(function(m) { g.Da = g.J.createMediaStreamSource(m); g.Da.connect(g.W); g.W.connect(g.J.destination); }).catch(function(m) { console.log("Failed to get user media: " + m); }); a == window.h.H.Aa && g.W.connect(g.J.destination); g.kb = f; return window.h.fc(g); }, 734932:a => window.h.ra(a).J.sampleRate, 735005:a => { a = window.h.ra(a); void 0 !== a.W && (a.W.onaudioprocess = function() { }, a.W.disconnect(), a.W = void 0); void 0 !== a.Da && (a.Da.disconnect(), a.Da = void 0); a.J.close(); a.J = void 0; a.kb = void 0; }, 735405:a => { window.h.ub(a); }, 735455:a => { a = window.h.ra(a); a.J.resume(); a.state = window.h.ga.qb; }, 735594:a => { a = window.h.ra(a); a.J.suspend(); a.state = window.h.ga.stopped; }}, Ya = a => { for (; 0 < a.length;) { a.shift()(l); } }; function Za() { var a = x[+$a >> 2]; $a += 4; return a; } var ab = (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; }, bb = a => { var b = "/" === a.charAt(0), c = "/" === a.substr(-1); (a = ab(a.split("/").filter(d => !!d), !b).join("/")) || b || (a = "."); a && c && (a += "/"); return (b ? "/" : "") + a; }, cb = 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; }, db = a => { if ("/" === a) { return "/"; } a = bb(a); a = a.replace(/\/$/, ""); var b = a.lastIndexOf("/"); return -1 === b ? a : a.substr(b + 1); }, eb = () => { if ("object" == typeof crypto && "function" == typeof crypto.getRandomValues) { return a => crypto.getRandomValues(a); } La("initRandomDevice"); }, fb = a => (fb = eb())(a), gb = (...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 = ab(b.split("/").filter(e => !!e), !c).join("/"); return (c ? "/" : "") + b || "."; }, hb = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, C = (a, b, c) => { var d = b + c; for (c = b; a[c] && !(c >= d);) { ++c; } if (16 < c - b && a.buffer && hb) { return hb.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; }, ib = [], jb = 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; }, kb = (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 lb(a, b) { var c = Array(jb(a) + 1); a = kb(a, c, 0, c.length); b && (c.length = a); return c; } var mb = []; function nb(a, b) { mb[a] = {input:[], F:[], T:b}; ob(a, pb); } var pb = {open(a) { var b = mb[a.node.Ba]; if (!b) { throw new E(43); } a.s = b; a.seekable = !1; }, close(a) { a.s.T.qa(a.s); }, qa(a) { a.s.T.qa(a.s); }, read(a, b, c, d) { if (!a.s || !a.s.T.cb) { throw new E(60); } for (var e = 0, f = 0; f < d; f++) { try { var g = a.s.T.cb(a.s); } catch (k) { throw new E(29); } if (void 0 === g && 0 === e) { throw new E(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.T.Ma) { throw new E(60); } try { for (var e = 0; e < d; e++) { a.s.T.Ma(a.s, b[c + e]); } } catch (f) { throw new E(29); } d && (a.node.timestamp = Date.now()); return e; },}, qb = {cb() { a: { if (!ib.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; } ib = lb(a, !0); } a = ib.shift(); } return a; }, Ma(a, b) { null === b || 10 === b ? (va(C(a.F, 0)), a.F = []) : 0 != b && a.F.push(b); }, qa(a) { a.F && 0 < a.F.length && (va(C(a.F, 0)), a.F = []); }, Rb() { return {oc:25856, qc:5, nc:191, pc:35387, mc:[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,]}; }, Sb() { return 0; }, Tb() { return [24, 80]; },}, rb = {Ma(a, b) { null === b || 10 === b ? (wa(C(a.F, 0)), a.F = []) : 0 != b && a.F.push(b); }, qa(a) { a.F && 0 < a.F.length && (wa(C(a.F, 0)), a.F = []); },}; function sb(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 G = {M:null, S() { return G.createNode(null, "/", 16895, 0); }, createNode(a, b, c, d) { if (24576 === (c & 61440) || 4096 === (c & 61440)) { throw new E(63); } G.M || (G.M = {dir:{node:{V:G.j.V, O:G.j.O, ja:G.j.ja, ya:G.j.ya, ob:G.j.ob, tb:G.j.tb, pb:G.j.pb, nb:G.j.nb, Ea:G.j.Ea}, stream:{Z:G.m.Z}}, file:{node:{V:G.j.V, O:G.j.O}, stream:{Z:G.m.Z, read:G.m.read, write:G.m.write, Va:G.m.Va, gb:G.m.gb, ib:G.m.ib}}, link:{node:{V:G.j.V, O:G.j.O, ka:G.j.ka}, stream:{}}, Wa:{node:{V:G.j.V, O:G.j.O}, stream:tb}}); c = ub(a, b, c, d); 16384 === (c.mode & 61440) ? (c.j = G.M.dir.node, c.m = G.M.dir.stream, c.l = {}) : 32768 === (c.mode & 61440) ? (c.j = G.M.file.node, c.m = G.M.file.stream, c.v = 0, c.l = null) : 40960 === (c.mode & 61440) ? (c.j = G.M.link.node, c.m = G.M.link.stream) : 8192 === (c.mode & 61440) && (c.j = G.M.Wa.node, c.m = G.M.Wa.stream); c.timestamp = Date.now(); a && (a.l[b] = c, a.timestamp = c.timestamp); return c; }, vc(a) { return a.l ? a.l.subarray ? a.l.subarray(0, a.v) : new Uint8Array(a.l) : new Uint8Array(0); }, j:{V(a) { var b = {}; b.tc = 8192 === (a.mode & 61440) ? a.id : 1; b.xc = a.id; b.mode = a.mode; b.Cc = 1; b.uid = 0; b.wc = 0; b.Ba = a.Ba; 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.kc = new Date(a.timestamp); b.Ac = new Date(a.timestamp); b.rc = new Date(a.timestamp); b.Bb = 4096; b.lc = Math.ceil(b.size / b.Bb); 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.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; } } }, ja() { throw vb[44]; }, ya(a, b, c, d) { return G.createNode(a, b, c, d); }, ob(a, b, c) { if (16384 === (a.mode & 61440)) { try { var d = wb(b, c); } catch (f) { } if (d) { for (var e in d.l) { throw new E(55); } } } delete a.parent.l[a.name]; a.parent.timestamp = Date.now(); a.name = c; b.l[c] = a; b.timestamp = a.parent.timestamp; }, tb(a, b) { delete a.l[b]; a.timestamp = Date.now(); }, pb(a, b) { var c = wb(a, b), d; for (d in c.l) { throw new E(55); } delete a.l[b]; a.timestamp = Date.now(); }, nb(a) { var b = [".", ".."], c; for (c of Object.keys(a.l)) { b.push(c); } return b; }, Ea(a, b, c) { a = G.createNode(a, b, 41471, 0); a.link = c; return a; }, ka(a) { if (40960 !== (a.mode & 61440)) { throw new E(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 === n.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; } } sb(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; }, Z(a, b, c) { 1 === c ? b += a.position : 2 === c && 32768 === (a.node.mode & 61440) && (b += a.node.v); if (0 > b) { throw new E(28); } return b; }, Va(a, b, c) { sb(a.node, b + c); a.node.v = Math.max(a.node.v, b + c); }, gb(a, b, c, d, e) { if (32768 !== (a.node.mode & 61440)) { throw new E(43); } a = a.node.l; if (e & 2 || a.buffer !== n.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 = xb(65536, b)) ? (u.fill(0, e, e + b), b = e) : b = 0; if (!b) { throw new E(48); } n.set(a, b); } else { c = !1, b = a.byteOffset; } return {o:b, jc:c}; }, ib(a, b, c, d) { G.m.write(a, b, 0, d, c, !1); return 0; },},}, yb = (a, b) => { var c = 0; a && (c |= 365); b && (c |= 146); return c; }, Ab = null, Bb = {}, Cb = [], Db = 1, Eb = null, Fb = !0, E = class { constructor(a) { this.name = "ErrnoError"; this.Y = a; } }, vb = {}, Gb = 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; } }, Hb = class { constructor(a, b, c, d) { a ||= this; this.parent = a; this.S = a.S; this.za = null; this.id = Db++; this.name = b; this.mode = c; this.j = {}; this.m = {}; this.Ba = 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 Ib(a, b = {}) { a = gb(a); if (!a) { return {path:"", node:null}; } b = Object.assign({bb:!0, Oa:0}, b); if (8 < b.Oa) { throw new E(32); } a = a.split("/").filter(g => !!g); for (var c = Ab, d = "/", e = 0; e < a.length; e++) { var f = e === a.length - 1; if (f && b.parent) { break; } c = wb(c, a[e]); d = bb(d + "/" + a[e]); c.za && (!f || f && b.bb) && (c = c.za.root); if (!f || b.ab) { for (f = 0; 40960 === (c.mode & 61440);) { if (c = Jb(d), d = gb(cb(d), c), c = Ib(d, {Oa:b.Oa + 1}).node, 40 < f++) { throw new E(32); } } } } return {path:d, node:c}; } function Kb(a) { for (var b;;) { if (a === a.parent) { return a = a.S.hb, b ? "/" !== a[a.length - 1] ? `${a}/${b}` : a + b : a; } b = b ? `${a.name}/${b}` : a.name; a = a.parent; } } function Lb(a, b) { for (var c = 0, d = 0; d < b.length; d++) { c = (c << 5) - c + b.charCodeAt(d) | 0; } return (a + c >>> 0) % Eb.length; } function wb(a, b) { var c = 16384 === (a.mode & 61440) ? (c = Mb(a, "x")) ? c : a.j.ja ? 0 : 2 : 54; if (c) { throw new E(c); } for (c = Eb[Lb(a.id, b)]; c; c = c.Vb) { var d = c.name; if (c.parent.id === a.id && d === b) { return c; } } return a.j.ja(a, b); } function ub(a, b, c, d) { a = new Hb(a, b, c, d); b = Lb(a.parent.id, a.name); a.Vb = Eb[b]; return Eb[b] = a; } function Nb(a) { var b = ["r", "w", "rw"][a & 3]; a & 512 && (b += "w"); return b; } function Mb(a, b) { if (Fb) { 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 Ob(a, b) { try { return wb(a, b), 20; } catch (c) { } return Mb(a, "wx"); } function Pb(a) { a = Cb[a]; if (!a) { throw new E(8); } return a; } function Qb(a, b = -1) { a = Object.assign(new Gb(), a); if (-1 == b) { a: { for (b = 0; 4096 >= b; b++) { if (!Cb[b]) { break a; } } throw new E(33); } } a.U = b; return Cb[b] = a; } function Rb(a, b = -1) { a = Qb(a, b); a.m?.uc?.(a); return a; } var tb = {open(a) { a.m = Bb[a.node.Ba].m; a.m.open?.(a); }, Z() { throw new E(70); },}; function ob(a, b) { Bb[a] = {m:b}; } function Sb(a, b) { var c = "/" === b; if (c && Ab) { throw new E(10); } if (!c && b) { var d = Ib(b, {bb:!1}); b = d.path; d = d.node; if (d.za) { throw new E(10); } if (16384 !== (d.mode & 61440)) { throw new E(54); } } b = {type:a, Ec:{}, hb:b, Ub:[]}; a = a.S(b); a.S = b; b.root = a; c ? Ab = a : d && (d.za = b, d.S && d.S.Ub.push(b)); } function Tb(a, b, c) { var d = Ib(a, {parent:!0}).node; a = db(a); if (!a || "." === a || ".." === a) { throw new E(28); } var e = Ob(d, a); if (e) { throw new E(e); } if (!d.j.ya) { throw new E(63); } return d.j.ya(d, a, b, c); } function Ub(a) { return Tb(a, 16895, 0); } function Vb(a, b, c) { "undefined" == typeof c && (c = b, b = 438); Tb(a, b | 8192, c); } function Wb(a, b) { if (!gb(a)) { throw new E(44); } var c = Ib(b, {parent:!0}).node; if (!c) { throw new E(44); } b = db(b); var d = Ob(c, b); if (d) { throw new E(d); } if (!c.j.Ea) { throw new E(63); } c.j.Ea(c, b, a); } function Jb(a) { a = Ib(a).node; if (!a) { throw new E(44); } if (!a.j.ka) { throw new E(28); } return gb(Kb(a.parent), a.j.ka(a)); } function Xb(a, b, c) { if ("" === a) { throw new E(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 = bb(a); try { e = Ib(a, {ab:!(b & 131072)}).node; } catch (f) { } } d = !1; if (b & 64) { if (e) { if (b & 128) { throw new E(20); } } else { e = Tb(a, c, 0), d = !0; } } if (!e) { throw new E(44); } 8192 === (e.mode & 61440) && (b &= -513); if (b & 65536 && 16384 !== (e.mode & 61440)) { throw new E(54); } if (!d && (c = e ? 40960 === (e.mode & 61440) ? 32 : 16384 === (e.mode & 61440) && ("r" !== Nb(b) || b & 512) ? 31 : Mb(e, Nb(b)) : 44)) { throw new E(c); } if (b & 512 && !d) { c = e; c = "string" == typeof c ? Ib(c, {ab:!0}).node : c; if (!c.j.O) { throw new E(63); } if (16384 === (c.mode & 61440)) { throw new E(31); } if (32768 !== (c.mode & 61440)) { throw new E(28); } if (d = Mb(c, "w")) { throw new E(d); } c.j.O(c, {size:0, timestamp:Date.now()}); } b &= -131713; e = Qb({node:e, path:Kb(e), flags:b, seekable:!0, position:0, m:e.m, hc:[], error:!1}); e.m.open && e.m.open(e); !l.logReadFiles || b & 1 || (Yb ||= {}, a in Yb || (Yb[a] = 1)); return e; } function Zb(a, b, c) { if (null === a.U) { throw new E(8); } if (!a.seekable || !a.m.Z) { throw new E(70); } if (0 != c && 1 != c && 2 != c) { throw new E(28); } a.position = a.m.Z(a, b, c); a.hc = []; } var $b; function ac(a, b, c) { a = bb("/dev/" + a); var d = yb(!!b, !!c); bc ||= 64; var e = bc++ << 8 | 0; ob(e, {open(f) { f.seekable = !1; }, close() { c?.buffer?.length && c(10); }, read(f, g, k, m) { for (var p = 0, r = 0; r < m; r++) { try { var w = b(); } catch (y) { throw new E(29); } if (void 0 === w && 0 === p) { throw new E(6); } if (null === w || void 0 === w) { break; } p++; g[k + r] = w; } p && (f.node.timestamp = Date.now()); return p; }, write(f, g, k, m) { for (var p = 0; p < m; p++) { try { c(g[k + p]); } catch (r) { throw new E(29); } } m && (f.node.timestamp = Date.now()); return p; }}); Vb(a, d, e); } var bc, cc = {}, Yb, $a = void 0, dc = (a, b) => Object.defineProperty(b, "name", {value:a}), ec = [], fc = [], H, I = a => { if (!a) { throw new H("Cannot use deleted val. handle = " + a); } return fc[a]; }, gc = a => { switch(a) { case void 0: return 2; case null: return 4; case !0: return 6; case !1: return 8; default: const b = ec.pop() || fc.length; fc[b] = a; fc[b + 1] = 1; return b; } }, hc = a => { var b = Error, c = dc(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; }, ic, jc, J = a => { for (var b = ""; u[a];) { b += jc[u[a++]]; } return b; }, kc = [], lc = () => { for (; kc.length;) { var a = kc.pop(); a.g.fa = !1; a["delete"](); } }, mc, nc = {}, oc = (a, b) => { if (void 0 === b) { throw new H("ptr should not be undefined"); } for (; a.B;) { b = a.ma(b), a = a.B; } return b; }, pc = {}, sc = a => { a = qc(a); var b = J(a); rc(a); return b; }, tc = (a, b) => { var c = pc[a]; if (void 0 === c) { throw a = `${b} has unknown type ${sc(a)}`, new H(a); } return c; }, uc = () => { }, vc = !1, wc = (a, b, c) => { if (b === c) { return a; } if (void 0 === c.B) { return null; } a = wc(a, b, c.B); return null === a ? null : c.Eb(a); }, xc = {}, yc = (a, b) => { b = oc(a, b); return nc[b]; }, zc, Bc = (a, b) => { if (!b.u || !b.o) { throw new zc("makeClassHandle requires ptr and ptrType"); } if (!!b.I !== !!b.D) { throw new zc("Both smartPtrType and smartPtr must be specified"); } b.count = {value:1}; return Ac(Object.create(a, {g:{value:b, writable:!0,},})); }, Ac = a => { if ("undefined" === typeof FinalizationRegistry) { return Ac = b => b, a; } vc = new FinalizationRegistry(b => { b = b.g; --b.count.value; 0 === b.count.value && (b.D ? b.I.N(b.D) : b.u.i.N(b.o)); }); Ac = b => { var c = b.g; c.D && vc.register(b, {g:c}, b); return b; }; uc = b => { vc.unregister(b); }; return Ac(a); }, Cc = {}, Dc = a => { for (; a.length;) { var b = a.pop(); a.pop()(b); } }; function Ec(a) { return this.fromWireType(A[a >> 2]); } var Fc = {}, Gc = {}, K = (a, b, c) => { function d(k) { k = c(k); if (k.length !== a.length) { throw new zc("Mismatched type converter count"); } for (var m = 0; m < a.length; ++m) { Hc(a[m], k[m]); } } a.forEach(function(k) { Gc[k] = b; }); var e = Array(b.length), f = [], g = 0; b.forEach((k, m) => { pc.hasOwnProperty(k) ? e[m] = pc[k] : (f.push(k), Fc.hasOwnProperty(k) || (Fc[k] = []), Fc[k].push(() => { e[m] = pc[k]; ++g; g === f.length && d(e); })); }); 0 === f.length && d(e); }; function Ic(a, b, c = {}) { var d = b.name; if (!a) { throw new H(`type "${d}" must have a positive integer typeid pointer`); } if (pc.hasOwnProperty(a)) { if (c.Ob) { return; } throw new H(`Cannot register type '${d}' twice`); } pc[a] = b; delete Gc[a]; Fc.hasOwnProperty(a) && (b = Fc[a], delete Fc[a], b.forEach(e => e())); } function Hc(a, b, c = {}) { if (!("argPackAdvance" in b)) { throw new TypeError("registerType registeredInstance requires argPackAdvance"); } return Ic(a, b, c); } var Jc = a => { throw new H(a.g.u.i.name + " instance already deleted"); }; function Kc() { } var Lc = (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 H(`Function '${c}' called with an invalid number of arguments (${e.length}) - expects one of (${a[b].A})!`); } return a[b].A[e.length].apply(this, e); }; a[b].A = []; a[b].A[d.da] = d; } }, Mc = (a, b, c) => { if (l.hasOwnProperty(a)) { if (void 0 === c || void 0 !== l[a].A && void 0 !== l[a].A[c]) { throw new H(`Cannot register public name '${a}' twice`); } Lc(l, a, a); if (l.hasOwnProperty(c)) { throw new H(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`); } l[a].A[c] = b; } else { l[a] = b, void 0 !== c && (l[a].Dc = c); } }, Nc = 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 Oc(a, b, c, d, e, f, g, k) { this.name = a; this.constructor = b; this.L = c; this.N = d; this.B = e; this.Jb = f; this.ma = g; this.Eb = k; this.lb = []; } var Pc = (a, b, c) => { for (; b !== c;) { if (!b.ma) { throw new H(`Expected null or instance of ${c.name}, got an instance of ${b.name}`); } a = b.ma(a); b = b.B; } return a; }; function Qc(a, b) { if (null === b) { if (this.La) { throw new H(`null is not a valid ${this.name}`); } return 0;