@rive-app/canvas-lite 2.48.0 → 2.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/rive.d.ts +22 -0
- package/rive.js +342 -157
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +85 -1
- package/rive_fallback.wasm +0 -0
- package/runtimeLoader.d.ts +33 -0
package/rive.js
CHANGED
|
@@ -215,16 +215,21 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
215
215
|
RuntimeLoader.callBackQueue = [];
|
|
216
216
|
};
|
|
217
217
|
RuntimeLoader.loaded = function (rive) {
|
|
218
|
-
var _a;
|
|
218
|
+
var _a, _b;
|
|
219
219
|
if (RuntimeLoader.enablePerfMarks) {
|
|
220
220
|
performance.mark('rive:wasm-init:end');
|
|
221
221
|
performance.measure('rive:wasm-init', 'rive:wasm-init:start', 'rive:wasm-init:end');
|
|
222
222
|
}
|
|
223
223
|
RuntimeLoader.runtime = rive;
|
|
224
|
+
RuntimeLoader.applyParallelParts();
|
|
224
225
|
RuntimeLoader.errorCallbackQueue = [];
|
|
226
|
+
// Before any callback can import a file, so its images reach the worker.
|
|
227
|
+
if (RuntimeLoader.replayWorker) {
|
|
228
|
+
(_a = rive.enableReplayWorker) === null || _a === void 0 ? void 0 : _a.call(rive);
|
|
229
|
+
}
|
|
225
230
|
// Fire all the callbacks
|
|
226
231
|
while (RuntimeLoader.callBackQueue.length > 0) {
|
|
227
|
-
(
|
|
232
|
+
(_b = RuntimeLoader.callBackQueue.shift()) === null || _b === void 0 ? void 0 : _b(RuntimeLoader.runtime);
|
|
228
233
|
}
|
|
229
234
|
};
|
|
230
235
|
// Loads the runtime, threaded once per page where it can be, and otherwise
|
|
@@ -346,6 +351,29 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
346
351
|
return RuntimeLoader.getInstance(resolve, reject);
|
|
347
352
|
});
|
|
348
353
|
};
|
|
354
|
+
/**
|
|
355
|
+
* @internal Resolves once the replay worker's device caps reach the page,
|
|
356
|
+
* so scripts init against them. Null when there is nothing left to wait
|
|
357
|
+
* for, which keeps every later instance's load synchronous.
|
|
358
|
+
*/
|
|
359
|
+
RuntimeLoader.awaitReplayCaps = function () {
|
|
360
|
+
var _a, _b;
|
|
361
|
+
if (RuntimeLoader.replayCapsArrived) {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
var pending = (_b = (_a = RuntimeLoader.runtime) === null || _a === void 0 ? void 0 : _a.awaitReplayCaps) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
365
|
+
if (!pending) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
// A worker that never answers must not hold every load back; its caps
|
|
369
|
+
// then bind when the surface does, as before.
|
|
370
|
+
var timeout = new Promise(function (resolve) {
|
|
371
|
+
return setTimeout(resolve, RuntimeLoader.replayCapsTimeoutMs);
|
|
372
|
+
});
|
|
373
|
+
return Promise.race([pending, timeout]).then(function () {
|
|
374
|
+
RuntimeLoader.replayCapsArrived = true;
|
|
375
|
+
});
|
|
376
|
+
};
|
|
349
377
|
// Manually sets the wasm url
|
|
350
378
|
RuntimeLoader.setWasmUrl = function (url) {
|
|
351
379
|
RuntimeLoader.wasmURL = url;
|
|
@@ -382,6 +410,46 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
382
410
|
RuntimeLoader.getWasmThreadsUrl = function () {
|
|
383
411
|
return RuntimeLoader.wasmThreadsURL;
|
|
384
412
|
};
|
|
413
|
+
/**
|
|
414
|
+
* Sets how many parts a script's parallel call gets on a page that runs
|
|
415
|
+
* the threaded build, the page's thread and one worker thread for each
|
|
416
|
+
* other part. 1 turns parallel calls off, and null leaves the runtime's
|
|
417
|
+
* default of one part per core, up to 8. Set it before the first file
|
|
418
|
+
* loads.
|
|
419
|
+
*/
|
|
420
|
+
RuntimeLoader.setParallelParts = function (parts) {
|
|
421
|
+
RuntimeLoader.parallelParts = parts;
|
|
422
|
+
RuntimeLoader.applyParallelParts();
|
|
423
|
+
};
|
|
424
|
+
// Gets the parts set with setParallelParts (null means the default)
|
|
425
|
+
RuntimeLoader.getParallelParts = function () {
|
|
426
|
+
return RuntimeLoader.parallelParts;
|
|
427
|
+
};
|
|
428
|
+
RuntimeLoader.applyParallelParts = function () {
|
|
429
|
+
var _a;
|
|
430
|
+
var scripting = (_a = RuntimeLoader.runtime) === null || _a === void 0 ? void 0 : _a.riveScripting;
|
|
431
|
+
if (scripting) {
|
|
432
|
+
scripting.parallelParts = RuntimeLoader.parallelParts;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
/**
|
|
436
|
+
* @experimental When the threaded build loads, instances with
|
|
437
|
+
* `enableGPUCanvas` hand their canvas to one worker that replays every
|
|
438
|
+
* instance's frames while the page records the next ones. Pass `false`
|
|
439
|
+
* before the runtime loads to keep replay on the page's thread; a single
|
|
440
|
+
* instance can opt out with `useReplayWorker: false`. Pages where the
|
|
441
|
+
* browser cannot draw WebGL2 on a transferred canvas stay on the page's
|
|
442
|
+
* thread regardless.
|
|
443
|
+
*
|
|
444
|
+
* True by default.
|
|
445
|
+
*/
|
|
446
|
+
RuntimeLoader.setReplayWorker = function (enabled) {
|
|
447
|
+
RuntimeLoader.replayWorker = enabled;
|
|
448
|
+
};
|
|
449
|
+
// Gets whether a threaded runtime may replay on a worker
|
|
450
|
+
RuntimeLoader.getReplayWorker = function () {
|
|
451
|
+
return RuntimeLoader.replayWorker;
|
|
452
|
+
};
|
|
385
453
|
// Manually sets the wasm binary or clears it with null
|
|
386
454
|
RuntimeLoader.setWasmBinary = function (value) {
|
|
387
455
|
if ((value instanceof ArrayBuffer) || value === null) {
|
|
@@ -411,6 +479,13 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
411
479
|
? "https://unpkg.com/".concat(package_json__WEBPACK_IMPORTED_MODULE_2__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_2__.version, "/rive_threads.wasm")
|
|
412
480
|
: null;
|
|
413
481
|
RuntimeLoader.triedThreads = false;
|
|
482
|
+
// The parts a script's parallel call gets on the threaded build, or null
|
|
483
|
+
// for the runtime's default.
|
|
484
|
+
RuntimeLoader.parallelParts = null;
|
|
485
|
+
// Whether a threaded runtime replays deferred frames on a worker.
|
|
486
|
+
RuntimeLoader.replayWorker = true;
|
|
487
|
+
RuntimeLoader.replayCapsArrived = false;
|
|
488
|
+
RuntimeLoader.replayCapsTimeoutMs = 2000;
|
|
414
489
|
// Error callbacks enqueued from .getInstance()
|
|
415
490
|
RuntimeLoader.errorCallbackQueue = [];
|
|
416
491
|
/**
|
|
@@ -432,109 +507,110 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
432
507
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
433
508
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
434
509
|
/* harmony export */ });
|
|
435
|
-
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var
|
|
436
|
-
function da(){function b(h){const g=d;c=a=0;d=new Map;g.forEach(n=>{try{n(h)}catch(r){console.error(r)}});this
|
|
437
|
-
"fixed",
|
|
438
|
-
function
|
|
439
|
-
|
|
440
|
-
"function"===typeof d?function(h){d(h)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};const f=
|
|
441
|
-
return this.
|
|
442
|
-
|
|
443
|
-
function
|
|
444
|
-
function
|
|
445
|
-
r(),
|
|
446
|
-
const
|
|
447
|
-
w))c=2;else if(p=q.getContext("webgl",w))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(q,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=p}return!0}let a=null,c=0,d=0,f=null,
|
|
451
|
-
0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,q);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);2==c?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_LINEAR),a.generateMipmap(a.TEXTURE_2D)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);return w};const r=new
|
|
452
|
-
w)a.canvas.width=q,a.canvas.height=w;a.viewport(0,0,q,w);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);var
|
|
453
|
-
console.assert(
|
|
454
|
-
|
|
455
|
-
function
|
|
456
|
-
|
|
457
|
-
case
|
|
458
|
-
|
|
459
|
-
C=h.fill,
|
|
460
|
-
{type:"image/png"}));t.onload=function(){k.
|
|
461
|
-
k)}
|
|
462
|
-
class
|
|
463
|
-
this.m=e;this.i=this.
|
|
464
|
-
k,t,u,v,
|
|
465
|
-
this.
|
|
466
|
-
__destruct:function(){null!==this.
|
|
467
|
-
c(e,k,t,u
|
|
468
|
-
null,u=null;if(null!==this.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
2,
|
|
476
|
-
x
|
|
477
|
-
|
|
478
|
-
1,0,0,1,
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
var
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
function
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
var
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
a
|
|
533
|
-
f)=>
|
|
534
|
-
|
|
535
|
-
0):
|
|
536
|
-
|
|
537
|
-
(function(){function b(){
|
|
510
|
+
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var l=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope;
|
|
511
|
+
function da(){function b(h){const g=d;c=a=0;d=new Map;g.forEach(n=>{try{n(h)}catch(r){console.error(r)}});this.$a();f&&f.Db()}let a=0,c=0,d=new Map,f=null,m=null;this.requestAnimationFrame=function(h){a||=requestAnimationFrame(b.bind(this));const g=++c;d.set(g,h);return g};this.cancelAnimationFrame=function(h){d.delete(h);a&&0==d.size&&(cancelAnimationFrame(a),a=0)};this.Bb=function(h){m&&(document.body.remove(m),m=null);h||(m=document.createElement("div"),m.style.backgroundColor="black",m.style.position=
|
|
512
|
+
"fixed",m.style.right=0,m.style.top=0,m.style.color="white",m.style.padding="4px",m.innerHTML="RIVE FPS",h=function(g){m.innerHTML="RIVE FPS "+g.toFixed(1)},document.body.appendChild(m));f=new function(){let g=0,n=0;this.Db=function(){var r=performance.now();n?(++g,r-=n,1E3<r&&(h(1E3*g/r),g=n=0)):(n=r,g=0)}}};this.yb=function(){m&&(document.body.remove(m),m=null);f=null};this.$a=function(){}}
|
|
513
|
+
function ea(b){console.assert(!0);const a=new Map;let c=-Infinity;this.push=function(d){d=d+((1<<b)-1)>>b;a.has(d)&&clearTimeout(a.get(d));a.set(d,setTimeout(function(){a.delete(d);0==a.length?c=-Infinity:d==c&&(c=Math.max(...a.keys()),console.assert(c<d))},1E3));c=Math.max(d,c);return c<<b}}function ha(b){return function(){b();const a=l.riveScripting;if(a)for(const c of a.frameBoundary())console.warn(c)}}const ia=l.onRuntimeInitialized;
|
|
514
|
+
l.onRuntimeInitialized=function(){ia&&ia();l.startFileScripts=function(h){const g=l.riveScripting;return h&&g&&h.startScripts?g.prepare().then(function(){h.startScripts();return h}):Promise.resolve(h)};let b=l.decodeAudio;l.decodeAudio=function(h,g,n=null){h=b(h,n??null);g(h)};let a=l.decodeFont;l.decodeFont=function(h,g,n=null){h=a(h,n??null);g(h)};const c=l.FileAsset.prototype.decode;l.FileAsset.prototype.decode=function(h,g){return c.call(this,h,g??null)};let d=l.setFallbackFontCb;l.setFallbackFontCallback=
|
|
515
|
+
"function"===typeof d?function(h){d(h)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};const f=l.FileAssetLoader;l.ptrToAsset=h=>{let g=l.ptrToFileAsset(h);return g.isImage?l.ptrToImageAsset(h):g.isFont?l.ptrToFontAsset(h):g.isAudio?l.ptrToAudioAsset(h):g};l.CustomFileAssetLoader=f.extend("CustomFileAssetLoader",{__construct:function({loadContents:h}){this.__parent.__construct.call(this);this.nb=h},loadContents:function(h,g){h=l.ptrToAsset(h);
|
|
516
|
+
return this.nb(h,g)}});l.CDNFileAssetLoader=f.extend("CDNFileAssetLoader",{__construct:function(h){this.__parent.__construct.call(this);this.ob=h??null},loadContents:function(h){let g=l.ptrToAsset(h);h=g.cdnUuid;if(""===h)return!1;const n=this.ob??null;(function(r,A){var q=new XMLHttpRequest;q.responseType="arraybuffer";q.onreadystatechange=function(){4==q.readyState&&200==q.status&&A(q)};q.open("GET",r,!0);q.send(null)})(g.cdnBaseUrl+"/"+h,r=>{g.decode(new Uint8Array(r.response),n)});return!0}});
|
|
517
|
+
l.FallbackFileAssetLoader=f.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.Ya=[]},addLoader:function(h){this.Ya.push(h)},loadContents:function(h,g){for(let n of this.Ya)if(n.loadContents(h,g))return!0;return!1}});let m=l.computeAlignment;l.computeAlignment=function(h,g,n,r,A=1){return m.call(this,h,g,n,r,A)}};function la(){}const F=new Int32Array(5);
|
|
518
|
+
function ma(b,a,c,d,f){b(a,c,F);b=Math.max(F[0],0);const m=Math.max(F[1],0);a=Math.min(F[2],Math.ceil(d*a));c=Math.min(F[3],Math.ceil(f*c));F[4]=b!==F[0]||m!==F[1]||a!==F[2]||c!==F[3]?1:0;F[0]=b;F[1]=m;F[2]=a;F[3]=c;return a>b&&c>m}function na(){const b=oa.Mb();return 0===b?0:b}
|
|
519
|
+
function pa(b,a,c,d,f,m,h,g,n,r,A){var q=na(),w=q-1,p=w-6;if(!(0<p))return r(),la;let z=1,C=1;if(!ma(g,z,C,c,d))return r(),la;const G=F[2]-F[0],E=F[3]-F[1];if(G>w||E>w)if(z*=Math.min(1,p/G),C*=Math.min(1,p/E),!ma(g,z,C,c,d))return r(),la;c=F[0];d=F[1];w=F[2];p=F[3];g=0!==F[4];if(1>z||1>C)--c,--d,w+=1,p+=1;const H=w-c,L=p-d;b.i||(b.i=new l.DynamicRectanizer(q),b.i.reset(512,512));q=b.i.addRect(H+1,L+1);if(0>q&&(A(),q=b.i.addRect(H+1,L+1),0>q))return console.assert(!1,"draw does not fit in an empty atlas"),
|
|
520
|
+
r(),la;const R=q&65535,I=q>>16;b.m.push({pb:[z*f[0],C*f[1],z*f[2],C*f[3],z*f[4]-c+R,C*f[5]-d+I],qb:R,rb:I,Vb:H,Xa:L,Za:g,N:n,Pb:()=>{r()}});const S=c/z,Y=d/C,ca=H/z,ra=L/C,sa=b.M;return function(){const Ea=sa.canvas();Ea&&(a.save(),a.resetTransform(),a.globalCompositeOperation=m,a.globalAlpha=h,a.drawImage(Ea,R,I,H,L,S,Y,ca,ra),a.restore())}}class qa{constructor(){this.M=new ua;this.i=null;this.m=[];this.na=new ea(8);this.$=new ea(8)}}
|
|
521
|
+
const oa=new function(){function b(){if(!a){var q=document.createElement("canvas"),w={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,renderViaOffscreenBackBuffer:1};let p;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(p=q.getContext("webgl",w),c=1,!p)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(p=q.getContext("webgl2",
|
|
522
|
+
w))c=2;else if(p=q.getContext("webgl",w))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(C,G){if(C.isContextLost()){if(n||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",G),n=!0),"function"===typeof C[G])return function(){}}else return"function"===typeof C[G]?function(...E){return C[G].apply(C,E)}:C[G]},set(C,G,E){if(C.isContextLost())n||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+
|
|
523
|
+
G),n=!0);else return C[G]=E,!0}});d=Math.min(p.getParameter(p.MAX_RENDERBUFFER_SIZE),p.getParameter(p.MAX_TEXTURE_SIZE));function z(C,G,E){G=p.createShader(G);p.shaderSource(G,E);p.compileShader(G);E=p.getShaderInfoLog(G);if(0<(E||"").length)throw E;p.attachShader(C,G)}q=p.createProgram();z(q,p.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 }");
|
|
524
|
+
z(q,p.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");p.bindAttribLocation(q,0,"vertex");p.bindAttribLocation(q,1,"uv");p.linkProgram(q);w=p.getProgramInfoLog(q);if(0<(w||"").trim().length)throw w;f=p.getUniformLocation(q,"mat");m=p.getUniformLocation(q,"translate");p.useProgram(q);p.bindBuffer(p.ARRAY_BUFFER,p.createBuffer());
|
|
525
|
+
p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(q,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=p}return!0}let a=null,c=0,d=0,f=null,m=null,h=0,g=0,n=!1;b();this.Mb=function(){b();return d};this.xb=function(q){a&&a.deleteTexture&&a.deleteTexture(q)};this.vb=function(q){if(!b())return null;const w=a.createTexture();if(!w)return null;a.bindTexture(a.TEXTURE_2D,w);a.texImage2D(a.TEXTURE_2D,
|
|
526
|
+
0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,q);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);2==c?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR_MIPMAP_LINEAR),a.generateMipmap(a.TEXTURE_2D)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);return w};const r=new ea(10),A=new ea(10);this.Ab=function(q,w,p){if(b()&&a.canvas){if(a.canvas.width!=q||a.canvas.height!=
|
|
527
|
+
w)a.canvas.width=q,a.canvas.height=w;a.viewport(0,0,q,w);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);var z=I=>I.N.image.Ca<<1|(I.Za?1:0);p.sort((I,S)=>z(S)-z(I));var C=0,G=0;for(var E of p)C+=E.N.pa.length,G+=E.N.indices.length;E=r.push(C);h!=E&&(a.bufferData(a.ARRAY_BUFFER,8*E,a.DYNAMIC_DRAW),h=E);E=0;for(var H of p)a.bufferSubData(a.ARRAY_BUFFER,E,H.N.pa),E+=4*H.N.pa.length;console.assert(E==4*C);for(var L of p)a.bufferSubData(a.ARRAY_BUFFER,E,L.N.hb),E+=4*L.N.hb.length;
|
|
528
|
+
console.assert(E==8*C);E=A.push(G);g!=E&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,2*E,a.DYNAMIC_DRAW),g=E);H=0;for(var R of p)a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,H,R.N.indices),H+=2*R.N.indices.length;console.assert(H==2*G);R=0;L=!1;E=H=0;for(const I of p){p=I.N;p.image.Ca!=R&&(a.bindTexture(a.TEXTURE_2D,p.image.V||null),R=p.image.Ca);I.Za?(a.scissor(I.qb,w-I.rb-I.Xa,I.Vb,I.Xa),L||(a.enable(a.SCISSOR_TEST),L=!0)):L&&(a.disable(a.SCISSOR_TEST),L=!1);const S=I.pb,Y=2/q,ca=-2/w;a.uniform4f(f,S[0]*Y,S[1]*
|
|
529
|
+
ca,S[2]*Y,S[3]*ca);a.uniform2f(m,S[4]*Y-1,S[5]*ca+1);a.vertexAttribPointer(0,2,a.FLOAT,!1,0,E);a.vertexAttribPointer(1,2,a.FLOAT,!1,0,E+4*C);a.drawElements(a.TRIANGLES,p.indices.length,a.UNSIGNED_SHORT,H);E+=4*p.pa.length;H+=2*p.indices.length}console.assert(E==4*C);console.assert(H==2*G)}};this.canvas=function(){return b()&&a.canvas}};class ua{constructor(){this.eb=!1}canvas(){return oa.canvas()||null}}const va=new qa;
|
|
530
|
+
function wa(b,a,c,d,f,m){const h=new DOMMatrix;h.a=b;h.b=a;h.c=c;h.d=d;h.e=f;h.f=m;return h}const xa="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),ya=l.onRuntimeInitialized;
|
|
531
|
+
l.onRuntimeInitialized=function(){function b(e){switch(e){case z.srcOver:return"source-over";case z.Yb:return"plus-lighter";case z.screen:return"screen";case z.overlay:return"overlay";case z.darken:return"darken";case z.lighten:return"lighten";case z.colorDodge:return"color-dodge";case z.colorBurn:return"color-burn";case z.hardLight:return"hard-light";case z.softLight:return"soft-light";case z.difference:return"difference";case z.exclusion:return"exclusion";case z.multiply:return"multiply";case z.hue:return"hue";
|
|
532
|
+
case z.saturation:return"saturation";case z.color:return"color";case z.luminosity:return"luminosity"}}function a(e){return"rgba("+((16711680&e)>>>16)+","+((65280&e)>>>8)+","+((255&e)>>>0)+","+((4278190080&e)>>>24)/255+")"}function c(e,k,t,u,v){return{fb:e,gb:k,Sa:t,Ta:u,type:v,Ka:[],T:null}}function d(e,k,t,u){if(k.Y===H&&!(0<k.Z))return null;t=1===t;return{Ha:e.La(t?k.xa:null),gradientTransform:t?k.ca:null,Ub:t?k.Z*k.Ba:k.Z,fillRule:e.ha===L?"evenodd":"nonzero",opacity:u,style:k.Y,color:k.sa,Wa:k.I,
|
|
533
|
+
tb:k.ra,join:k.ya,sb:k.qa}}function f(e,k){return k.Y!==H||0<k.Z?{path:e.kb(e.ha),Ga:k.lb()}:null}function m(){if(0!==I.m.length){var e=na();if(0!==e){var k=Math.min(I.na.push(I.i.drawWidth()),e);e=Math.min(I.$.push(I.i.drawHeight()),e);oa.Ab(k,e,I.m)}}for(const t of ta){for(const u of t.G)u();t.G=[]}ta.clear();for(const t of I.m)t.Pb();I.m=[];I.i&&I.i.reset(512,512)}ya&&ya();var h=l.RenderPaintStyle,g=l.FillRule;const n=l.RenderPath,r=l.RenderPaint,A=l.Renderer,q=l.StrokeCap,w=l.StrokeJoin,p=l.StrokePosition,
|
|
534
|
+
z=l.BlendMode,C=l.ImageFilter,G=l.ImageWrap,E=h.fill,H=h.stroke,L=g.evenOdd,R=g.nonZero,I=va,S=I.M;let Y=1;var ca=l.RenderImage.extend("CanvasRenderImage",{__construct:function({ea:e,oa:k}={}){this.__parent.__construct.call(this);this.Ca=Y;Y=Y+1&2147483647||1;this.ea=e;this.oa=k;this.V=this.Pa=this.ia=this.wa=null},__destruct:function(){this.V&&(oa.xb(this.V),this.V=null);this.ia&&URL.revokeObjectURL(this.ia);this.__parent.__destruct.call(this)},decode:function(e){var k=this;k.oa&&k.oa(k);var t=new Image;
|
|
535
|
+
k.ia=URL.createObjectURL(new Blob([e],{type:"image/png"}));t.onload=function(){k.wa=t;k.V=oa.vb(t);k.size(t.width,t.height);k.ea&&k.ea(k)};t.src=k.ia}});class ra{constructor(e){this.i=e;this.path=new Path2D;this.m=null;this.ua=!1}M(){null!==this.m&&(this.path.lineTo(this.m.x,this.m.y),this.m=null)}moveTo(e,k){this.M();let t=e,u=k;null!==this.i&&(e=this.i.transformPoint({x:e,y:k}),t=e.x,u=e.y);this.path.moveTo(t,u);this.m={x:t,y:u}}lineTo(e,k){this.m=null;null!==this.i?(e=this.i.transformPoint({x:e,
|
|
536
|
+
y:k}),this.path.lineTo(e.x,e.y)):this.path.lineTo(e,k)}wb(e,k,t,u,v,B){this.m=null;null!==this.i?(e=this.i.transformPoint({x:e,y:k}),t=this.i.transformPoint({x:t,y:u}),v=this.i.transformPoint({x:v,y:B}),this.path.bezierCurveTo(e.x,e.y,t.x,t.y,v.x,v.y)):this.path.bezierCurveTo(e,k,t,u,v,B)}close(){this.m=null;this.path.closePath()}addPath(e,k,t,u,v,B,D){this.M();const y=new ra(null);for(const x of e)x(y);y.Va();e=wa(k,t,u,v,B,D);null!==this.i&&(e=this.i.multiply(e));this.path.addPath(y.path,e)}Va(){null===
|
|
537
|
+
this.m||this.ua||(this.M(),this.ua=!0)}dispose(){}}class sa{constructor(e){this.Lb=e;this.$=this.M=0;this.m=null;this.i=e(null)}clear(){this.na(null)}Da(e,k){for(((null===k?null!==this.m:null===this.m||this.m.a!==k.a||this.m.b!==k.b||this.m.c!==k.c||this.m.d!==k.d||this.m.e!==k.e||this.m.f!==k.f)||this.$<e.length&&(0<this.M||this.i.ua))&&this.na(k);this.$<e.length;)e[this.$++](this.i);this.i.Va();this.M++;return this.i.path}Ja(e){null!==this.i&&e===this.i.path&&this.M--}dispose(){this.i.dispose();
|
|
538
|
+
this.i=null}na(e){this.i.dispose();this.$=this.M=0;this.m=e;this.i=this.Lb(e)}}var Ea=n.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.W=[];this.ja=new sa(e=>new ra(e));this.ka=new sa(e=>new ra(e));this.X=new Map;this.ha=R;this.va=!1},__destruct:function(){this.ja.dispose();this.ka.dispose();for(const e of this.X.values())e.dispose();this.X.clear();this.__parent.__destruct.call(this)},rewind:function(){this.W.length=0;this.ja.clear();this.ka.clear();for(const e of this.X.values())e.clear();
|
|
539
|
+
this.va=!1},addPath:function(e,k,t,u,v,B,D){const y=e.W.slice();this.ba(x=>x.addPath(y,k,t,u,v,B,D))},fillRule:function(e){this.ha=e},moveTo:function(e,k){this.va=!0;this.ba(t=>t.moveTo(e,k))},lineTo:function(e,k){this.Oa();this.ba(t=>t.lineTo(e,k))},cubicTo:function(e,k,t,u,v,B){this.Oa();this.ba(D=>D.wb(e,k,t,u,v,B))},close:function(){this.ba(e=>e.close())},Oa:function(){this.va||this.moveTo(0,0)},ba:function(e){this.W.push(e)},La:function(e){e=null===e?this.ja.Da(this.W,null):this.ka.Da(this.W,
|
|
540
|
+
e);e.ref&&e.ref();return e},kb:function(e){var k=this.X.get(e);void 0===k&&(k=new sa(()=>S.Zb(e)),this.X.set(e,k));k=k.Da(this.W,null);k.ref&&k.ref();return k},za:function(e){this.ja.Ja(e);this.ka.Ja(e);for(const k of this.X.values())k.Ja(e);e.unref&&e.unref()}});const bc=c(0,0,0,0,0);var dc=r.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.Y=E;this.sa=4278190080;this.Z=1;this.ya=w.miter;this.ra=q.butt;this.Aa=p.center;this.ta=0;this.qa=b(z.srcOver);this.xa=
|
|
541
|
+
this.A=this.ca=this.I=null;this.Ba=1;this.B=0;this.S=null;this.Qa=-1},__destruct:function(){null!==this.S&&(l.unrefWebGL2Paint(this.S),this.S=null);this.__parent.__destruct.call(this)},color:function(e){this.sa=e;this.I=null;this.B++},thickness:function(e){this.Z=Math.abs(e);this.B++},join:function(e){this.ya=e;this.B++},cap:function(e){this.ra=e;this.B++},strokePosition:function(e){this.Aa=e;this.B++},feather:function(e){this.ta=Math.abs(e);this.B++},style:function(e){this.Y=e;this.B++},blendMode:function(e){this.qa=
|
|
542
|
+
b(e);this.B++},clearGradient:function(){this.I=null;this.B++},linearGradient:function(e,k,t,u){this.I=c(e,k,t,u,0);this.B++},radialGradient:function(e,k,t,u){this.I=c(e,k,t,u,1);this.B++},angularGradient:function(){this.I=c(0,0,0,0,2);this.B++},addStop:function(e,k){this.I.Ka.push({color:e,stop:k});this.I.T=null;this.B++},modulatedImage:function(e,k,t,u,v,B,D,y,x,J){const K=e.wa;K?this.A={image:K,jb:e.Pa,filter:k,Wb:t,Xb:u,transform:wa(v,B,D,y,x,J)}:this.A=null},completeGradient:function(){},_setGradientTransform:function(e,
|
|
543
|
+
k,t,u,v,B,D,y,x,J,K,P,T){1===e&&0===k&&0===t&&1===u&&0===v&&0===B?this.xa=this.ca=null:(this.ca=wa(e,k,t,u,v,B),this.xa=wa(D,y,x,J,K,P));this.Ba=T;this.B++},lb:function(){if(this.Qa!==this.B){null!==this.S&&l.unrefWebGL2Paint(this.S);const k=null!==this.I?this.I:bc;let t=null,u=null;if(null!==this.I){var e=k.Ka;t=new Uint32Array(e.length);u=new Float32Array(e.length);for(let ja=0,cc=e.length;ja<cc;ja++)t[ja]=e[ja].color,u[ja]=e[ja].stop}e=null;let v=C.bilinear,B=G.clamp,D=G.clamp,y=1,x=0,J=0,K=1,
|
|
544
|
+
P=0,T=0;null!==this.A&&(e=this.A.jb,v=this.A.filter,B=this.A.Wb,D=this.A.Xb,y=this.A.transform.a,x=this.A.transform.b,J=this.A.transform.c,K=this.A.transform.d,P=this.A.transform.e,T=this.A.transform.f);let Z=1,ka=0,Ga=0,Va=1,sb=0,tb=0;const fa=this.ca;null!==fa&&(Z=fa.a,ka=fa.b,Ga=fa.c,Va=fa.d,sb=fa.e,tb=fa.f);this.S=l.makeWebGL2Paint(this.Y,this.sa,this.Z,this.ya,this.ra,this.Aa,this.ta,t,u,k.type,k.fb,k.gb,k.Sa,k.Ta,Z,ka,Ga,Va,sb,tb,e,v,B,D,y,x,J,K,P,T);this.Qa=this.B}l.refWebGL2Paint(this.S);
|
|
545
|
+
return this.S}});const ta=new Set,ub=Object.prototype.hasOwnProperty;var ec=l.CanvasRenderer=A.extend("Renderer",{__construct:function(e){this.__parent.__construct.call(this);this.L=[1,0,0,1,0,0];this.F=[1];this.s=e.getContext("2d");this.Na=e;this.G=[]},save:function(){this.L.push(...this.L.slice(this.L.length-6));this.F.push(this.F[this.F.length-1]);this.G.push(this.s.save.bind(this.s))},restore:function(){const e=this.L.length-6;if(6>e)throw"restore() called without matching save().";this.L.splice(e);
|
|
546
|
+
this.F.pop();this.G.push(this.s.restore.bind(this.s))},transform:function(e,k,t,u,v,B){const D=this.L,y=D.length-6;D.splice(y,6,D[y]*e+D[y+2]*k,D[y+1]*e+D[y+3]*k,D[y]*t+D[y+2]*u,D[y+1]*t+D[y+3]*u,D[y]*v+D[y+2]*B+D[y+4],D[y+1]*v+D[y+3]*B+D[y+5]);this.G.push(this.s.transform.bind(this.s,e,k,t,u,v,B))},rotate:function(e){const k=Math.sin(e);e=Math.cos(e);this.transform(e,k,-k,e,0,0)},modulateOpacity:function(e){this.F[this.F.length-1]*=e},_drawPath:function(e,k){const t=Math.max(0,this.F[this.F.length-
|
|
547
|
+
1]),u=k.A||k.Aa!==p.center?2:0!==k.ta?S.eb?2:0:null===k.I||null===k.ca?0:k.Y!==H||0<k.Ba?1:S.eb?2:0;if(2===u)(null===k.A||k.A.jb)&&this.mb(e,k,t);else{var v=d(e,k,u,t);null!==v&&this.G.push(()=>{var B=this.s;const D=B.globalCompositeOperation,y=B.globalAlpha;B.globalCompositeOperation=v.sb;B.globalAlpha=v.opacity;if(null!==v.Wa){var x=v.Wa;if(null===x.T){var J=x.fb;const T=x.gb;var K=x.Sa,P=x.Ta;0==x.type?x.T=B.createLinearGradient(J,T,K,P):1==x.type?(K-=J,P-=T,x.T=B.createRadialGradient(J,T,0,J,
|
|
548
|
+
T,Math.sqrt(K*K+P*P))):x.T=B.createConicGradient(0,0,0);J=x.Ka;for(let Z=0,ka=J.length;Z<ka;Z++)x.T.addColorStop(J[Z].stop,a(J[Z].color))}x=x.T}else x=a(v.color);null!==v.gradientTransform&&(B.save(),B.transform(v.gradientTransform.a,v.gradientTransform.b,v.gradientTransform.c,v.gradientTransform.d,v.gradientTransform.e,v.gradientTransform.f));switch(v.style){case H:B.strokeStyle=x;B.lineWidth=v.Ub;a:{switch(v.tb){case q.butt:x="butt";break a;case q.round:x="round";break a;case q.square:x="square";
|
|
549
|
+
break a}x=void 0}B.lineCap=x;a:{switch(v.join){case w.miter:x="miter";break a;case w.round:x="round";break a;case w.bevel:x="bevel";break a}x=void 0}B.lineJoin=x;B.miterLimit=4;B.stroke(v.Ha);break;case E:B.fillStyle=x,B.fill(v.Ha,v.fillRule)}null!==v.gradientTransform&&B.restore();B.globalCompositeOperation=D;B.globalAlpha=y;e.za(v.Ha)})}},mb:function(e,k,t){const u=f(e,k);if(null!==u){var v=this.L.slice(this.L.length-6);k=pa(I,this.s,this.s.canvas.width,this.s.canvas.height,v,k.qa,t,(B,D,y)=>l.webGL2PathPixelBounds(u.path,
|
|
550
|
+
u.Ga,B*v[0],D*v[1],B*v[2],D*v[3],B*v[4],D*v[5],y),B=>B.drawPath(u.path,u.Ga),()=>{e.za(u.path);l.unrefWebGL2Paint(u.Ga)},m);ta.add(this);this.G.push(k)}},_drawRiveImage:function(e,k,t){var u=e.wa;if(u){var v=this.s,B=b(k),D=Math.max(0,t*this.F[this.F.length-1]);this.G.push(function(){v.globalCompositeOperation=B;v.globalAlpha=D;v.drawImage(u,0,0);v.globalAlpha=1})}},_getMatrix:function(e){const k=this.L,t=k.length-6;for(let u=0;6>u;++u)e[u]=k[t+u]},_drawImageMesh:function(e,k,t,u,v,B,D,y){const x=
|
|
551
|
+
e.Pa;x?this.Ma(t,u,v,B,D,y,J=>l.drawWebGL2PendingMesh(J,k,x),()=>k.unref()):k.unref()},_drawImageMeshFromHeap:function(e,k,t,u,v,B,D,y,x,J,K,P,T){if(e.V){try{var Z=l.HEAPF32.slice(u>>2,(u>>2)+v);var ka=l.HEAPF32.slice(B>>2,(B>>2)+D);var Ga=l.HEAPU16.slice(y>>1,(y>>1)+x)}catch(Va){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}this.Ma(k,t,J,K,P,T,{image:e,pa:Z,hb:ka,indices:Ga},()=>{})}},Ma:function(e,k,t,u,v,B,D,y){e=pa(I,this.s,
|
|
552
|
+
this.s.canvas.width,this.s.canvas.height,this.L.slice(this.L.length-6),b(e),Math.max(0,k*this.F[this.F.length-1]),(x,J,K)=>{K[0]=Math.floor(t*x);K[1]=Math.floor(u*J);K[2]=Math.ceil(v*x);K[3]=Math.ceil(B*J)},D,y,m);ta.add(this);this.G.push(e)},_clipPath:function(e){const k=e.ha===L?"evenodd":"nonzero",t=e.La(null);this.G.push(()=>{this.s.clip(t,k);e.za(t)})},beginFrame:function(e=!0){ta.add(this);e&&this.G.push(this.s.clearRect.bind(this.s,0,0,this.Na.width,this.Na.height))},clear:function(){this.beginFrame(!0)},
|
|
553
|
+
flush:function(){},translate:function(e,k){this.transform(1,0,0,1,e,k)}});l.makeRenderer=function(e){const k=new ec(e),t=k.s;let u=null,v=null;const B={attachSession:function(y){if(y&&u===y)return!0;if(!y||u||"function"!==typeof l.c2dDeferredClaim||"function"!==typeof l.c2dDeferredRenderer||!l.c2dDeferredClaim(y))return!1;const x=l.c2dDeferredRenderer(y);if(!x)return!1;u=y;v=x;return!0},detachSession:function(){u&&l.c2dDeferredDetach(u);v=u=null},deferredActive:function(){return null!==v}},D={save:function(){l.c2dDeferredSave(u)},
|
|
554
|
+
restore:function(){l.c2dDeferredRestore(u)},transform:function(y,x,J,K,P,T){l.c2dDeferredTransform(u,y,x,J,K,P,T)},translate:function(y,x){l.c2dDeferredTransform(u,1,0,0,1,y,x)},rotate:function(y){const x=Math.sin(y);y=Math.cos(y);l.c2dDeferredTransform(u,y,x,-x,y,0,0)},align:function(y,x,J,K,P){l.c2dDeferredAlign(u,y,x,J.minX,J.minY,J.maxX,J.maxY,K.minX,K.minY,K.maxX,K.maxY,void 0===P?1:P)},beginFrame:function(y=!0){k.beginFrame(y);l.c2dDeferredBeginFrame(u)},clear:function(){k.beginFrame(!0);l.c2dDeferredBeginFrame(u)},
|
|
555
|
+
flush:function(){l.c2dDeferredReplay(u,k)}};return new Proxy(k,{get(y,x){if(ub.call(B,x))return B[x];if("_deferredRecorder"===x)return v;if(null!==v&&ub.call(D,x))return D[x];if("function"===typeof y[x])return function(...J){return y[x].apply(y,J)};if("function"===typeof t[x]){if(-1<xa.indexOf(x))throw Error("RiveException: Method call to '"+x+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...J){k.G.push(t[x].bind(t,
|
|
556
|
+
...J))}}return y[x]},set(y,x,J){if(x in t)return k.G.push(()=>{t[x]=J}),!0}})};l.decodeImage=function(e,k){(new ca({ea:k})).decode(e)};l.renderFactory={makeRenderPaint:function(){return new dc},makeRenderPath:function(){return new Ea},makeRenderImage:function(){let e=Wa;return new ca({oa:()=>{e.total++},ea:()=>{e.loaded++;if(e.loaded===e.total){const k=e.ready;k&&(k(),e.ready=null)}}})}};let fc=l.load,Wa=null;l.load=function(e,k,t=!0,u=null){const v=new l.FallbackFileAssetLoader;void 0!==k&&v.addLoader(k);
|
|
557
|
+
t&&(k=new l.CDNFileAssetLoader(u),v.addLoader(k));return(new Promise(function(B){let D=null;Wa={total:0,loaded:0,ready:function(){B(D)}};D=fc(e,v,u??null);const y=l.riveScripting;y&&y.prepare();0==Wa.total&&B(D)})).then(l.startFileScripts)};const gc=l.Artboard.prototype.draw;l.Artboard.prototype.draw=function(e){gc.call(this,e._deferredRecorder||e)};let hc=l.RendererWrapper.prototype.align;l.RendererWrapper.prototype.align=function(e,k,t,u,v=1){hc.call(this,e,k,t,u,v)};h=new da;l.requestAnimationFrame=
|
|
558
|
+
h.requestAnimationFrame.bind(h);l.cancelAnimationFrame=h.cancelAnimationFrame.bind(h);l.enableFPSCounter=h.Bb.bind(h);l.disableFPSCounter=h.yb;g=ha(m);h.$a=g;l.resolveAnimationFrame=g;l.cleanup=function(){I.i&&(I.i["delete"](),I.i=null)}};ba&&(_scriptName=self.location.href);var za="",Aa,Ba;
|
|
559
|
+
if(aa||ba){try{za=(new URL(".",_scriptName)).href}catch{}ba&&(Ba=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});Aa=async b=>{if(Ca(b))return new Promise((c,d)=>{var f=new XMLHttpRequest;f.open("GET",b,!0);f.responseType="arraybuffer";f.onload=()=>{200==f.status||0==f.status&&f.response?c(f.response):d(f.status)};f.onerror=d;f.send(null)});var a=await fetch(b,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+
|
|
560
|
+
" : "+a.url);}}var Da=console.log.bind(console),Fa=console.error.bind(console),Ha,Ia=!1,Ca=b=>b.startsWith("file://"),Ja,Ka,La,M,Ma,Na,Oa,N,Pa,Qa,Ra=!1;function Sa(){var b=Ta.buffer;l.HEAP8=La=new Int8Array(b);Ma=new Int16Array(b);l.HEAPU8=M=new Uint8Array(b);l.HEAPU16=Na=new Uint16Array(b);l.HEAP32=Oa=new Int32Array(b);l.HEAPU32=N=new Uint32Array(b);l.HEAPF32=Pa=new Float32Array(b);Qa=new Float64Array(b)}
|
|
561
|
+
function Ua(b){l.onAbort?.(b);b="Aborted("+b+")";Fa(b);Ia=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");Ka?.(b);throw b;}var Xa;async function Ya(b){if(!Ha)try{var a=await Aa(b);return new Uint8Array(a)}catch{}if(b==Xa&&Ha)b=new Uint8Array(Ha);else if(Ba)b=Ba(b);else throw"both async and sync fetching of the wasm failed";return b}
|
|
562
|
+
async function Za(b,a){try{var c=await Ya(b);return await WebAssembly.instantiate(c,a)}catch(d){Fa(`failed to asynchronously prepare wasm: ${d}`),Ua(d)}}async function $a(b){var a=Xa;if(!Ha&&!Ca(a))try{var c=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,b)}catch(d){Fa(`wasm streaming compile failed: ${d}`),Fa("falling back to ArrayBuffer instantiation")}return Za(a,b)}
|
|
563
|
+
var ab,bb,cb=b=>{for(;0<b.length;)b.shift()(l)},db=[],eb=[],fb=()=>{var b=l.preRun.shift();eb.push(b)},gb=(b,a)=>Object.defineProperty(a,"name",{value:b}),hb=[],ib=[0,1,,1,null,1,!0,1,!1,1],O=class extends Error{constructor(b){super(b);this.name="BindingError"}},Q=b=>{if(!b)throw new O(`Cannot use deleted val. handle = ${b}`);return ib[b]},jb=b=>{switch(b){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const a=hb.pop()||ib.length;ib[a]=b;ib[a+1]=1;return a}};
|
|
564
|
+
class kb extends Error{}
|
|
565
|
+
var U=b=>{for(var a="";;){var c=M[b++];if(!c)return a;a+=String.fromCharCode(c)}},lb={},mb=(b,a)=>{if(void 0===a)throw new O("ptr should not be undefined");for(;b.C;)a=b.fa(a),b=b.C;return a},nb={},qb=b=>{b=ob(b);var a=U(b);pb(b);return a},rb=(b,a)=>{var c=nb[b];if(void 0===c)throw b=`${a} has unknown type ${qb(b)}`,new O(b);return c},vb=()=>{},wb=!1,xb=b=>{if(!globalThis.FinalizationRegistry)return xb=a=>a,b;wb=new FinalizationRegistry(a=>{a=a.g;--a.count.value;0===a.count.value&&(a.D?a.K.P(a.D):
|
|
566
|
+
a.o.h.P(a.l))});xb=a=>{var c=a.g;c.D&&wb.register(a,{g:c},a);return a};vb=a=>{wb.unregister(a)};return xb(b)},yb={},zb=b=>{for(;b.length;){var a=b.pop();b.pop()(a)}};function Ab(b){return this.j(N[b>>2])}
|
|
567
|
+
var Bb={},Cb={},Db=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(g){g=c(g);if(g.length!==b.length)throw new Db("Mismatched type converter count");for(var n=0;n<b.length;++n)V(b[n],g[n])}b.forEach(g=>Cb[g]=a);var f=Array(a.length),m=[],h=0;for(let [g,n]of a.entries())nb.hasOwnProperty(n)?f[g]=nb[n]:(m.push(n),Bb.hasOwnProperty(n)||(Bb[n]=[]),Bb[n].push(()=>{f[g]=nb[n];++h;h===m.length&&d(f)}));0===m.length&&d(f)};
|
|
568
|
+
function Eb(b,a,c={}){var d=a.name;if(!b)throw new O(`type "${d}" must have a positive integer typeid pointer`);if(nb.hasOwnProperty(b)){if(c.Jb)return;throw new O(`Cannot register type '${d}' twice`);}nb[b]=a;delete Cb[b];Bb.hasOwnProperty(b)&&(a=Bb[b],delete Bb[b],a.forEach(f=>f()))}function V(b,a,c={}){return Eb(b,a,c)}var Fb=b=>{throw new O(b.g.o.h.name+" instance already deleted");},Gb=[];function Hb(){}
|
|
569
|
+
var Ib={},Jb=(b,a,c)=>{if(void 0===b[a].u){var d=b[a];b[a]=function(...f){if(!b[a].u.hasOwnProperty(f.length))throw new O(`Function '${c}' called with an invalid number of arguments (${f.length}) - expects one of (${b[a].u})!`);return b[a].u[f.length].apply(this,f)};b[a].u=[];b[a].u[d.R]=d}},Kb=(b,a,c)=>{if(l.hasOwnProperty(b)){if(void 0===c||void 0!==l[b].u&&void 0!==l[b].u[c])throw new O(`Cannot register public name '${b}' twice`);Jb(l,b,b);if(l[b].u.hasOwnProperty(c))throw new O(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
|
|
570
|
+
l[b].u[c]=a}else l[b]=a,l[b].R=c},Lb=b=>{b=b.replace(/[^a-zA-Z0-9_]/g,"$");var a=b.charCodeAt(0);return 48<=a&&57>=a?`_${b}`:b};function Mb(b,a,c,d,f,m,h,g){this.name=b;this.constructor=a;this.O=c;this.P=d;this.C=f;this.Eb=m;this.fa=h;this.zb=g;this.ab=[]}
|
|
571
|
+
var Nb=(b,a,c)=>{for(;a!==c;){if(!a.fa)throw new O(`Expected null or instance of ${c.name}, got an instance of ${a.name}`);b=a.fa(b);a=a.C}return b},Ob=b=>{if(null===b)return"null";var a=typeof b;return"object"===a||"array"===a||"function"===a?b.toString():""+b};
|
|
572
|
+
function Pb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);return 0}if(!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);return Nb(a.g.l,a.g.o.h,this.h)}
|
|
573
|
+
function Qb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);if(this.ma){var c=this.Ia();null!==b&&b.push(this.P,c);return c}return 0}if(!a||!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.la&&a.g.o.la)throw new O(`Cannot convert argument of type ${a.g.K?a.g.K.name:a.g.o.name} to parameter type ${this.name}`);c=Nb(a.g.l,a.g.o.h,this.h);if(this.ma){if(void 0===a.g.D)throw new O("Passing raw pointer to smart pointer is illegal");
|
|
574
|
+
switch(this.Tb){case 0:if(a.g.K===this)c=a.g.D;else throw new O(`Cannot convert argument of type ${a.g.K?a.g.K.name:a.g.o.name} to parameter type ${this.name}`);break;case 1:c=a.g.D;break;case 2:if(a.g.K===this)c=a.g.D;else{var d=a.clone();c=this.Ob(c,jb(()=>d["delete"]()));null!==b&&b.push(this.P,c)}break;default:throw new O("Unsupported sharing policy");}}return c}
|
|
575
|
+
function Rb(b,a){if(null===a){if(this.Ea)throw new O(`null is not a valid ${this.name}`);return 0}if(!a.g)throw new O(`Cannot pass "${Ob(a)}" as a ${this.name}`);if(!a.g.l)throw new O(`Cannot pass deleted object as a pointer of type ${this.name}`);if(a.g.o.la)throw new O(`Cannot convert argument of type ${a.g.o.name} to parameter type ${this.name}`);return Nb(a.g.l,a.g.o.h,this.h)}
|
|
576
|
+
var Sb=(b,a,c)=>{if(a===c)return b;if(void 0===c.C)return null;b=Sb(b,a,c.C);return null===b?null:c.zb(b)},Tb=(b,a)=>{a=mb(b,a);return lb[a]},Ub=(b,a)=>{if(!a.o||!a.l)throw new Db("makeClassHandle requires ptr and ptrType");if(!!a.K!==!!a.D)throw new Db("Both smartPtrType and smartPtr must be specified");a.count={value:1};return xb(Object.create(b,{g:{value:a,writable:!0}}))};
|
|
577
|
+
function Vb(b,a,c,d,f,m,h,g,n,r,A){this.name=b;this.h=a;this.Ea=c;this.la=d;this.ma=f;this.Nb=m;this.Tb=h;this.bb=g;this.Ia=n;this.Ob=r;this.P=A;f||void 0!==a.C?this.v=Qb:(this.v=d?Pb:Rb,this.H=null)}
|
|
578
|
+
var Wb=(b,a,c)=>{if(!l.hasOwnProperty(b))throw new Db("Replacing nonexistent public symbol");void 0!==l[b].u&&void 0!==c?l[b].u[c]=a:(l[b]=a,l[b].R=c)},Xb={},Zb=(b,a,c=[])=>{b.includes("j")?(b=b.replace(/p/g,"i"),a=(0,Xb[b])(a,...c)):a=Yb.get(a)(...c);return a},$b=(b,a)=>(...c)=>Zb(b,a,c),X=(b,a)=>{b=U(b);var c=b.includes("j")?$b(b,a):Yb.get(a);if("function"!=typeof c)throw new O(`unknown function pointer with signature ${b}: ${a}`);return c};class ac extends Error{}
|
|
579
|
+
var ic=(b,a)=>{function c(m){f[m]||nb[m]||(Cb[m]?Cb[m].forEach(c):(d.push(m),f[m]=!0))}var d=[],f={};a.forEach(c);throw new ac(`${b}: `+d.map(qb).join([", "]));};function jc(b){for(var a=1;a<b.length;++a)if(null!==b[a]&&void 0===b[a].H)return!0;return!1}
|
|
580
|
+
function kc(b,a,c,d,f){var m=a.length;if(2>m)throw new O("argTypes array size mismatch! Must at least get return value and 'this' types!");var h=null!==a[1]&&null!==c,g=jc(a),n=!a[0].Kb,r=m-2,A=Array(r),q=[],w=[];return gb(b,function(...p){w.length=0;q.length=h?2:1;q[0]=f;if(h){var z=a[1].v(w,this);q[1]=z}for(var C=0;C<r;++C)A[C]=a[C+2].v(w,p[C]),q.push(A[C]);p=d(...q);if(g)zb(w);else for(C=h?1:2;C<a.length;C++){var G=1===C?z:A[C-2];null!==a[C].H&&a[C].H(G)}z=n?a[0].j(p):void 0;return z})}
|
|
581
|
+
var lc=(b,a)=>{for(var c=[],d=0;d<b;d++)c.push(N[a+4*d>>2]);return c},mc=b=>{b=b.trim();const a=b.indexOf("(");return-1===a?b:b.slice(0,a)},nc=(b,a,c)=>{if(!(b instanceof Object))throw new O(`${c} with invalid "this": ${b}`);if(!(b instanceof a.h.constructor))throw new O(`${c} incompatible with "this" of type ${b.constructor.name}`);if(!b.g.l)throw new O(`cannot call emscripten binding method ${c} on deleted object`);return Nb(b.g.l,b.g.o.h,a.h)},oc=b=>{9<b&&0===--ib[b+1]&&(ib[b]=void 0,hb.push(b))},
|
|
582
|
+
pc={name:"emscripten::val",j:b=>{var a=Q(b);oc(b);return a},v:(b,a)=>jb(a),J:Ab,H:null},qc=(b,a,c)=>{switch(a){case 1:return c?function(d){return this.j(La[d])}:function(d){return this.j(M[d])};case 2:return c?function(d){return this.j(Ma[d>>1])}:function(d){return this.j(Na[d>>1])};case 4:return c?function(d){return this.j(Oa[d>>2])}:function(d){return this.j(N[d>>2])};default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},rc=(b,a)=>{switch(a){case 4:return function(c){return this.j(Pa[c>>
|
|
583
|
+
2])};case 8:return function(c){return this.j(Qa[c>>3])};default:throw new TypeError(`invalid float width (${a}): ${b}`);}},sc=(b,a,c)=>{switch(a){case 1:return c?d=>La[d]:d=>M[d];case 2:return c?d=>Ma[d>>1]:d=>Na[d>>1];case 4:return c?d=>Oa[d>>2]:d=>N[d>>2];default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},tc=globalThis.TextDecoder&&new TextDecoder,uc=(b,a,c,d)=>{c=a+c;if(d)return c;for(;b[a]&&!(a>=c);)++a;return a},vc=(b,a=0,c,d)=>{c=uc(b,a,c,d);if(16<c-a&&b.buffer&&tc)return tc.decode(b.subarray(a,
|
|
584
|
+
c));for(d="";a<c;){var f=b[a++];if(f&128){var m=b[a++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|m);else{var h=b[a++]&63;f=224==(f&240)?(f&15)<<12|m<<6|h:(f&7)<<18|m<<12|h<<6|b[a++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d},wc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,xc=(b,a,c)=>{b>>=1;a=uc(Na,b,a/2,c);if(16<a-b&&wc)return wc.decode(Na.subarray(b,a));for(c="";b<a;++b)c+=String.fromCharCode(Na[b]);
|
|
585
|
+
return c},yc=(b,a,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=a;c=c<2*b.length?c/2:b.length;for(var f=0;f<c;++f)Ma[a>>1]=b.charCodeAt(f),a+=2;Ma[a>>1]=0;return a-d},zc=b=>2*b.length,Ac=(b,a,c)=>{var d="";b>>=2;for(var f=0;!(f>=a/4);f++){var m=N[b+f];if(!m&&!c)break;d+=String.fromCodePoint(m)}return d},Bc=(b,a,c)=>{c??=2147483647;if(4>c)return 0;var d=a;c=d+c-4;for(var f=0;f<b.length;++f){var m=b.codePointAt(f);65535<m&&f++;Oa[a>>2]=m;a+=4;if(a+4>c)break}Oa[a>>2]=0;return a-d},Cc=b=>{for(var a=
|
|
586
|
+
0,c=0;c<b.length;++c)65535<b.codePointAt(c)&&c++,a+=4;return a},Dc=[],Ec=b=>{var a=Dc.length;Dc.push(b);return a},Fc=(b,a)=>{for(var c=Array(b),d=0;d<b;++d)c[d]=rb(N[a+4*d>>2],`parameter ${d}`);return c},Gc={},Hc=b=>{var a=Gc[b];return void 0===a?U(b):a},Ic=[null,[],[]];
|
|
587
|
+
(()=>{let b=Hb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Hb&&c instanceof Hb))return!1;var d=this.g.o.h,f=this.g.l;c.g=c.g;var m=c.g.o.h;for(c=c.g.l;d.C;)f=d.fa(f),d=d.C;for(;m.C;)c=m.fa(c),m=m.C;return d===m&&f===c},clone:function(){this.g.l||Fb(this);if(this.g.aa)return this.g.count.value+=1,this;var c=xb,d=Object,f=d.create,m=Object.getPrototypeOf(this),h=this.g;c=c(f.call(d,m,{g:{value:{count:h.count,da:h.da,aa:h.aa,l:h.l,o:h.o,D:h.D,K:h.K}}}));c.g.count.value+=1;c.g.da=
|
|
588
|
+
!1;return c},["delete"](){this.g.l||Fb(this);if(this.g.da&&!this.g.aa)throw new O("Object already scheduled for deletion");vb(this);var c=this.g;--c.count.value;0===c.count.value&&(c.D?c.K.P(c.D):c.o.h.P(c.l));this.g.aa||(this.g.D=void 0,this.g.l=void 0)},isDeleted:function(){return!this.g.l},deleteLater:function(){this.g.l||Fb(this);if(this.g.da&&!this.g.aa)throw new O("Object already scheduled for deletion");Gb.push(this);this.g.da=!0;return this}});const a=Symbol.dispose;a&&(b[a]=b["delete"])})();
|
|
589
|
+
Object.assign(Vb.prototype,{Fb(b){this.bb&&(b=this.bb(b));return b},Ra(b){this.P?.(b)},J:Ab,j:function(b){function a(){return this.ma?Ub(this.h.O,{o:this.Nb,l:c,K:this,D:b}):Ub(this.h.O,{o:this,l:b})}var c=this.Fb(b);if(!c)return this.Ra(b),null;var d=Tb(this.h,c);if(void 0!==d){if(0===d.g.count.value)return d.g.l=c,d.g.D=b,d.clone();d=d.clone();this.Ra(b);return d}d=this.h.Eb(c);d=Ib[d];if(!d)return a.call(this);d=this.la?d.ub:d.pointerType;var f=Sb(c,this.h,d.h);return null===f?a.call(this):this.ma?
|
|
590
|
+
Ub(d.h.O,{o:d,l:f,K:this,D:b}):Ub(d.h.O,{o:d,l:f})}});l.print&&(Da=l.print);l.printErr&&(Fa=l.printErr);l.wasmBinary&&(Ha=l.wasmBinary);if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.shift()();
|
|
591
|
+
var pb,Jc,ob,Ta,Yb,Kc={_abort_js:()=>Ua(""),_embind_create_inheriting_constructor:(b,a,c)=>{b=U(b);a=rb(a,"wrapper");c=Q(c);var d=a.h,f=d.O,m=d.C.O,h=d.C.constructor;b=gb(b,function(...g){for(var n of d.C.ab)if(this[n]===m[n])throw new kb(`Pure virtual function ${n} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:f});this.__construct(...g)});f.__construct=function(...g){if(this===f)throw new O("Pass correct 'this' to __construct");g=h.implement(this,...g);vb(g);var n=
|
|
592
|
+
g.g;g.notifyOnDestruction();n.aa=!0;Object.defineProperties(this,{g:{value:n}});xb(this);g=n.l;g=mb(d,g);if(lb.hasOwnProperty(g))throw new O(`Tried to register registered instance: ${g}`);lb[g]=this};f.__destruct=function(){if(this===f)throw new O("Pass correct 'this' to __destruct");vb(this);var g=this.g.l;g=mb(d,g);if(lb.hasOwnProperty(g))delete lb[g];else throw new O(`Tried to unregister unregistered instance: ${g}`);};b.prototype=Object.create(f);Object.assign(b.prototype,c);return jb(b)},_embind_finalize_value_object:b=>
|
|
593
|
+
{var a=yb[b];delete yb[b];var c=a.Ia,d=a.P,f=a.Ua,m=f.map(h=>h.Ib).concat(f.map(h=>h.Rb));W([b],m,h=>{var g={},n,r;for([n,r]of f.entries()){const A=h[n],q=r.Gb,w=r.Hb,p=h[n+f.length],z=r.Qb,C=r.Sb;g[r.Cb]={read:G=>A.j(q(w,G)),write:(G,E)=>{var H=[];z(C,G,p.v(H,E));zb(H)},optional:A.optional}}return[{name:a.name,j:A=>{var q={},w;for(w in g)q[w]=g[w].read(A);d(A);return q},v:(A,q)=>{for(var w in g)if(!(w in q||g[w].optional))throw new TypeError(`Missing field: "${w}"`);var p=c();for(w in g)g[w].write(p,
|
|
594
|
+
q[w]);null!==A&&A.push(d,p);return p},J:Ab,H:d}]})},_embind_register_bigint:()=>{},_embind_register_bool:(b,a,c,d)=>{a=U(a);V(b,{name:a,j:function(f){return!!f},v:function(f,m){return m?c:d},J:function(f){return this.j(M[f])},H:null})},_embind_register_class:(b,a,c,d,f,m,h,g,n,r,A,q,w)=>{A=U(A);m=X(f,m);g&&=X(h,g);r&&=X(n,r);w=X(q,w);var p=Lb(A);Kb(p,function(){ic(`Cannot construct ${A} due to unbound types`,[d])});W([b,a,c],d?[d]:[],z=>{z=z[0];if(d){var C=z.h;var G=C.O}else G=Hb.prototype;z=gb(A,
|
|
595
|
+
function(...R){if(Object.getPrototypeOf(this)!==E)throw new O(`Use 'new' to construct ${A}`);if(void 0===H.U)throw new O(`${A} has no accessible constructor`);var I=H.U[R.length];if(void 0===I)throw new O(`Tried to invoke ctor of ${A} with invalid number of parameters (${R.length}) - expected (${Object.keys(H.U).toString()}) parameters instead!`);return I.apply(this,R)});var E=Object.create(G,{constructor:{value:z}});z.prototype=E;var H=new Mb(A,z,E,w,C,m,g,r);if(H.C){var L;(L=H.C).ga??(L.ga=[]);
|
|
596
|
+
H.C.ga.push(H)}C=new Vb(A,H,!0,!1,!1);L=new Vb(A+"*",H,!1,!1,!1);G=new Vb(A+" const*",H,!1,!0,!1);Ib[b]={pointerType:L,ub:G};Wb(p,z);return[C,L,G]})},_embind_register_class_class_function:(b,a,c,d,f,m,h)=>{var g=lc(c,d);a=U(a);a=mc(a);m=X(f,m);W([],[b],n=>{function r(){ic(`Cannot call ${A} due to unbound types`,g)}n=n[0];var A=`${n.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);var q=n.h.constructor;void 0===q[a]?(r.R=c-1,q[a]=r):(Jb(q,a,A),q[a].u[c-1]=r);W([],g,w=>{w=kc(A,[w[0],null].concat(w.slice(1)),
|
|
597
|
+
null,m,h);void 0===q[a].u?(w.R=c-1,q[a]=w):q[a].u[c-1]=w;if(n.h.ga)for(const p of n.h.ga)p.constructor.hasOwnProperty(a)||(p.constructor[a]=w);return[]});return[]})},_embind_register_class_class_property:(b,a,c,d,f,m,h,g)=>{a=U(a);m=X(f,m);W([],[b],n=>{n=n[0];var r=`${n.name}.${a}`,A={get(){ic(`Cannot access ${r} due to unbound types`,[c])},enumerable:!0,configurable:!0};A.set=g?()=>{ic(`Cannot access ${r} due to unbound types`,[c])}:()=>{throw new O(`${r} is a read-only property`);};Object.defineProperty(n.h.constructor,
|
|
598
|
+
a,A);W([],[c],q=>{q=q[0];var w={get(){return q.j(m(d))},enumerable:!0};g&&(g=X(h,g),w.set=p=>{var z=[];g(d,q.v(z,p));zb(z)});Object.defineProperty(n.h.constructor,a,w);return[]});return[]})},_embind_register_class_constructor:(b,a,c,d,f,m)=>{var h=lc(a,c);f=X(d,f);W([],[b],g=>{g=g[0];var n=`constructor ${g.name}`;void 0===g.h.U&&(g.h.U=[]);if(void 0!==g.h.U[a-1])throw new O(`Cannot register multiple constructors with identical number of parameters (${a-1}) for class '${g.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
|
|
599
|
+
g.h.U[a-1]=()=>{ic(`Cannot construct ${g.name} due to unbound types`,h)};W([],h,r=>{r.splice(1,0,null);g.h.U[a-1]=kc(n,r,null,f,m);return[]});return[]})},_embind_register_class_function:(b,a,c,d,f,m,h,g)=>{var n=lc(c,d);a=U(a);a=mc(a);m=X(f,m);W([],[b],r=>{function A(){ic(`Cannot call ${q} due to unbound types`,n)}r=r[0];var q=`${r.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);g&&r.h.ab.push(a);var w=r.h.O,p=w[a];void 0===p||void 0===p.u&&p.className!==r.name&&p.R===c-2?(A.R=c-2,A.className=
|
|
600
|
+
r.name,w[a]=A):(Jb(w,a,q),w[a].u[c-2]=A);W([],n,z=>{z=kc(q,z,r,m,h);void 0===w[a].u?(z.R=c-2,w[a]=z):w[a].u[c-2]=z;return[]});return[]})},_embind_register_class_property:(b,a,c,d,f,m,h,g,n,r)=>{a=U(a);f=X(d,f);W([],[b],A=>{A=A[0];var q=`${A.name}.${a}`,w={get(){ic(`Cannot access ${q} due to unbound types`,[c,h])},enumerable:!0,configurable:!0};w.set=n?()=>ic(`Cannot access ${q} due to unbound types`,[c,h]):()=>{throw new O(q+" is a read-only property");};Object.defineProperty(A.h.O,a,w);W([],n?[c,
|
|
601
|
+
h]:[c],p=>{var z=p[0],C={get(){var E=nc(this,A,q+" getter");return z.j(f(m,E))},enumerable:!0};if(n){n=X(g,n);var G=p[1];C.set=function(E){var H=nc(this,A,q+" setter"),L=[];n(r,H,G.v(L,E));zb(L)}}Object.defineProperty(A.h.O,a,C);return[]});return[]})},_embind_register_emval:b=>V(b,pc),_embind_register_enum:(b,a,c,d,f)=>{a=U(a);f=0===f?"object":1===f?"number":"string";switch(f){case "object":function h(){}h.values={};V(b,{name:a,constructor:h,valueType:f,j:function(g){return this.constructor.values[g]},
|
|
602
|
+
v:(g,n)=>n.value,J:qc(a,c,d),H:null});Kb(a,h);break;case "number":var m={};V(b,{name:a,Fa:m,valueType:f,j:g=>g,v:(g,n)=>n,J:qc(a,c,d),H:null});Kb(a,m);delete l[a].R;break;case "string":m={},V(b,{name:a,ib:{},cb:{},Fa:m,valueType:f,j:function(g){return this.cb[g]},v:function(g,n){return this.ib[n]},J:qc(a,c,d),H:null}),Kb(a,m),delete l[a].R}},_embind_register_enum_value:(b,a,c)=>{var d=rb(b,"enum");a=U(a);switch(d.valueType){case "object":b=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},
|
|
603
|
+
constructor:{value:gb(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=d;break;case "number":d.Fa[a]=c;break;case "string":d.ib[a]=c,d.cb[c]=a,d.Fa[a]=a}},_embind_register_float:(b,a,c)=>{a=U(a);V(b,{name:a,j:d=>d,v:(d,f)=>f,J:rc(a,c),H:null})},_embind_register_function:(b,a,c,d,f,m)=>{var h=lc(a,c);b=U(b);b=mc(b);f=X(d,f);Kb(b,function(){ic(`Cannot call ${b} due to unbound types`,h)},a-1);W([],h,g=>{Wb(b,kc(b,[g[0],null].concat(g.slice(1)),null,f,m),a-1);return[]})},_embind_register_integer:(b,
|
|
604
|
+
a,c,d,f)=>{a=U(a);let m=g=>g;if(0===d){var h=32-8*c;m=g=>g<<h>>>h;f=m(f)}V(b,{name:a,j:m,v:(g,n)=>n,J:sc(a,c,0!==d),H:null})},_embind_register_memory_view:(b,a,c)=>{function d(m){return new f(La.buffer,N[m+4>>2],N[m>>2])}var f=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][a];c=U(c);V(b,{name:c,j:d,J:d},{Jb:!0})},_embind_register_std_string:(b,a)=>{a=U(a);V(b,{name:a,j(c){var d=(d=c+4)?vc(M,d,N[c>>2],!0):"";pb(c);return d},v(c,d){d instanceof ArrayBuffer&&
|
|
605
|
+
(d=new Uint8Array(d));var f,m="string"==typeof d;if(!(m||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new O("Cannot pass non-string to std::string");var h;if(m)for(f=h=0;f<d.length;++f){var g=d.charCodeAt(f);127>=g?h++:2047>=g?h+=2:55296<=g&&57343>=g?(h+=4,++f):h+=3}else h=d.length;f=h;h=Jc(4+f+1);g=h+4;N[h>>2]=f;if(m){if(m=g,g=f+1,f=M,0<g){g=m+g-1;for(var n=0;n<d.length;++n){var r=d.codePointAt(n);if(127>=r){if(m>=g)break;f[m++]=r}else if(2047>=r){if(m+1>=g)break;f[m++]=192|r>>6;f[m++]=128|
|
|
606
|
+
r&63}else if(65535>=r){if(m+2>=g)break;f[m++]=224|r>>12;f[m++]=128|r>>6&63;f[m++]=128|r&63}else{if(m+3>=g)break;f[m++]=240|r>>18;f[m++]=128|r>>12&63;f[m++]=128|r>>6&63;f[m++]=128|r&63;n++}}f[m]=0}}else M.set(d,g);null!==c&&c.push(pb,h);return h},J:Ab,H(c){pb(c)}})},_embind_register_std_wstring:(b,a,c)=>{c=U(c);if(2===a){var d=xc;var f=yc;var m=zc}else d=Ac,f=Bc,m=Cc;V(b,{name:c,j:h=>{var g=d(h+4,N[h>>2]*a,!0);pb(h);return g},v:(h,g)=>{if("string"!=typeof g)throw new O(`Cannot pass non-string to C++ string type ${c}`);
|
|
607
|
+
var n=m(g),r=Jc(4+n+a);N[r>>2]=n/a;f(g,r+4,n+a);null!==h&&h.push(pb,r);return r},J:Ab,H(h){pb(h)}})},_embind_register_value_object:(b,a,c,d,f,m)=>{yb[b]={name:U(a),Ia:X(c,d),P:X(f,m),Ua:[]}},_embind_register_value_object_field:(b,a,c,d,f,m,h,g,n,r)=>{yb[b].Ua.push({Cb:U(a),Ib:c,Gb:X(d,f),Hb:m,Rb:h,Qb:X(g,n),Sb:r})},_embind_register_void:(b,a)=>{a=U(a);V(b,{Kb:!0,name:a,j:()=>{},v:()=>{}})},_emval_create_invoker:(b,a,c)=>{var [d,...f]=Fc(b,a),m=d.v.bind(d),h=f.map(n=>n.J.bind(n));b--;var g=Array(b);
|
|
608
|
+
a=`methodCaller<(${f.map(n=>n.name)}) => ${d.name}>`;return Ec(gb(a,(n,r,A,q)=>{for(var w=0,p=0;p<b;++p)g[p]=h[p](q+w),w+=8;switch(c){case 0:var z=Q(n).apply(null,g);break;case 2:z=Reflect.construct(Q(n),g);break;case 3:z=g[0];break;case 1:z=Q(n)[Hc(r)](...g)}n=[];z=m(n,z);n.length&&(N[A>>2]=jb(n));return z}))},_emval_decref:oc,_emval_get_module_property:b=>{b=Hc(b);return jb(l[b])},_emval_get_property:(b,a)=>{b=Q(b);a=Q(a);return jb(b[a])},_emval_incref:b=>{9<b&&(ib[b+1]+=1)},_emval_invoke:(b,a,
|
|
609
|
+
c,d,f)=>Dc[b](a,c,d,f),_emval_new_array:()=>jb([]),_emval_new_cstring:b=>jb(Hc(b)),_emval_new_object:()=>jb({}),_emval_run_destructors:b=>{var a=Q(b);zb(a);oc(b)},_emval_set_property:(b,a,c)=>{b=Q(b);a=Q(a);c=Q(c);b[a]=c},clock_time_get:function(b,a,c,d){if(!(0<=b&&3>=b))return 28;b=Math.round(1E6*(0===b?Date.now():performance.now()));bb=[b>>>0,(ab=b,1<=+Math.abs(ab)?0<ab?+Math.floor(ab/4294967296)>>>0:~~+Math.ceil((ab-+(~~ab>>>0))/4294967296)>>>0:0)];Oa[d>>2]=bb[0];Oa[d+4>>2]=bb[1];return 0},emscripten_resize_heap:b=>
|
|
610
|
+
{var a=M.length;b>>>=0;if(2147483648<b)return!1;for(var c=1;4>=c;c*=2){var d=a*(1+.2/c);d=Math.min(d,b+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(b,d)/65536))-Ta.buffer.byteLength+65535)/65536|0;try{Ta.grow(d);Sa();var f=1;break a}catch(m){}f=void 0}if(f)return!0}return!1},fd_close:()=>52,fd_seek:function(){return 70},fd_write:(b,a,c,d)=>{for(var f=0,m=0;m<c;m++){var h=N[a>>2],g=N[a+4>>2];a+=8;for(var n=0;n<g;n++){var r=b,A=M[h+n],q=Ic[r];0===A||10===A?((1===r?Da:Fa)(vc(q)),q.length=
|
|
611
|
+
0):q.push(A)}f+=g}N[d>>2]=f;return 0}},Lc;
|
|
612
|
+
Lc=await (async function(){function b(c){c=Lc=c.exports;pb=c.free;Jc=c.malloc;ob=c.__getTypeName;Xb.vij=c.dynCall_vij;Xb.iij=c.dynCall_iij;Xb.ji=c.dynCall_ji;Xb.jiji=c.dynCall_jiji;Ta=c.memory;Yb=c.__indirect_function_table;Sa();return Lc}var a={env:Kc,wasi_snapshot_preview1:Kc};if(l.instantiateWasm)return new Promise(c=>{l.instantiateWasm(a,(d,f)=>{c(b(d,f))})});Xa??=l.locateFile?l.locateFile("canvas_advanced_c2d_only.wasm",za):za+"canvas_advanced_c2d_only.wasm";return b((await $a(a)).instance)}());
|
|
613
|
+
(function(){function b(){l.calledRun=!0;if(!Ia){Ra=!0;Lc.__wasm_call_ctors();Ja?.(l);l.onRuntimeInitialized?.();if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;){var a=l.postRun.shift();db.push(a)}cb(db)}}if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)fb();cb(eb);l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1);b()},1)):b()})();Ra?moduleRtn=l:moduleRtn=new Promise((b,a)=>{Ja=b;Ka=a});
|
|
538
614
|
;return moduleRtn}})();
|
|
539
615
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
540
616
|
|
|
@@ -550,7 +626,7 @@ Cc=await (async function(){function b(c){c=Cc=c.exports;kb=c.free;Ac=c.malloc;jb
|
|
|
550
626
|
/***/ ((module) => {
|
|
551
627
|
|
|
552
628
|
"use strict";
|
|
553
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
629
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.49.1","description":"A lite version of Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
554
630
|
|
|
555
631
|
/***/ }),
|
|
556
632
|
/* 7 */
|
|
@@ -7072,7 +7148,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
7072
7148
|
var Rive = /** @class */ (function () {
|
|
7073
7149
|
function Rive(params) {
|
|
7074
7150
|
var _this = this;
|
|
7075
|
-
var _a, _b, _c, _d, _e;
|
|
7151
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7076
7152
|
// Tracks if a Rive file is loaded
|
|
7077
7153
|
this.loaded = false;
|
|
7078
7154
|
// Tracks if a Rive file is destroyed
|
|
@@ -7090,6 +7166,8 @@ var Rive = /** @class */ (function () {
|
|
|
7090
7166
|
// Deferred rendering was requested for this instance. The file it renders
|
|
7091
7167
|
// has the final say, since a file's mode is fixed at import.
|
|
7092
7168
|
this.deferredRenderer = false;
|
|
7169
|
+
// Whether a deferred instance may hand its canvas to the replay worker.
|
|
7170
|
+
this.useReplayWorker = true;
|
|
7093
7171
|
// Decides the context attributes on every init(); cleared if the renderer can't inkbleed.
|
|
7094
7172
|
this._inkbleedCapable = false;
|
|
7095
7173
|
this._inkbleed = false;
|
|
@@ -7270,6 +7348,7 @@ var Rive = /** @class */ (function () {
|
|
|
7270
7348
|
this._focusOptions = (_d = params.focusOptions) !== null && _d !== void 0 ? _d : this._focusOptions;
|
|
7271
7349
|
this._tabIndex = (_e = params.tabIndex) !== null && _e !== void 0 ? _e : null;
|
|
7272
7350
|
this.deferredRenderer = !!params.enableGPUCanvas;
|
|
7351
|
+
this.useReplayWorker = (_f = params.useReplayWorker) !== null && _f !== void 0 ? _f : true;
|
|
7273
7352
|
this._inkbleedCapable = !!params.enableInkbleed;
|
|
7274
7353
|
this._inkbleed = this._inkbleedCapable;
|
|
7275
7354
|
// New event management system
|
|
@@ -7462,6 +7541,7 @@ var Rive = /** @class */ (function () {
|
|
|
7462
7541
|
// Ensure the runtime is loaded
|
|
7463
7542
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.awaitInstance()
|
|
7464
7543
|
.then(function (runtime) {
|
|
7544
|
+
var _a, _b;
|
|
7465
7545
|
if (_this.destroyed) {
|
|
7466
7546
|
return;
|
|
7467
7547
|
}
|
|
@@ -7477,7 +7557,19 @@ var Rive = /** @class */ (function () {
|
|
|
7477
7557
|
try {
|
|
7478
7558
|
// Always immediate at creation; a deferred file attaches its session
|
|
7479
7559
|
// to this renderer once the file has loaded.
|
|
7480
|
-
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer, {
|
|
7560
|
+
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer, {
|
|
7561
|
+
inkbleed: _this._inkbleedCapable,
|
|
7562
|
+
// An immediate file would only re-import for the worker.
|
|
7563
|
+
replayWorker: _this.deferredRenderer &&
|
|
7564
|
+
_this.useReplayWorker &&
|
|
7565
|
+
((_b = (_a = _this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredRequested) !== null && _b !== void 0 ? _b : true),
|
|
7566
|
+
// Draws notice a restored context, so one has to be scheduled.
|
|
7567
|
+
onContextRestored: function () {
|
|
7568
|
+
if (!_this._explicitlyStoppedRendering) {
|
|
7569
|
+
_this.scheduleRendering();
|
|
7570
|
+
}
|
|
7571
|
+
},
|
|
7572
|
+
});
|
|
7481
7573
|
if (!_this.renderer) {
|
|
7482
7574
|
throw new Error("Renderer is null, cannot render Rive on the canvas.");
|
|
7483
7575
|
}
|
|
@@ -7696,11 +7788,11 @@ var Rive = /** @class */ (function () {
|
|
|
7696
7788
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
7697
7789
|
return __awaiter(this, void 0, void 0, function () {
|
|
7698
7790
|
var riveFile, error_4, msg;
|
|
7699
|
-
var _a, _b;
|
|
7700
|
-
return __generator(this, function (
|
|
7701
|
-
switch (
|
|
7791
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7792
|
+
return __generator(this, function (_g) {
|
|
7793
|
+
switch (_g.label) {
|
|
7702
7794
|
case 0:
|
|
7703
|
-
|
|
7795
|
+
_g.trys.push([0, 8, , 9]);
|
|
7704
7796
|
// A caller-supplied riveFile is theirs to release; one we import here is
|
|
7705
7797
|
// ours, which matters if a deferred fallback replaces it below.
|
|
7706
7798
|
this.ownsRiveFile = this.riveFile == null;
|
|
@@ -7717,30 +7809,41 @@ var Rive = /** @class */ (function () {
|
|
|
7717
7809
|
this.riveFile = riveFile;
|
|
7718
7810
|
return [4 /*yield*/, riveFile.init()];
|
|
7719
7811
|
case 1:
|
|
7720
|
-
|
|
7812
|
+
_g.sent();
|
|
7721
7813
|
if (this.destroyed) {
|
|
7722
7814
|
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
7723
7815
|
// another rive file, we only want to destroy it if this file is the only owner.
|
|
7724
7816
|
riveFile.destroyIfUnused();
|
|
7725
7817
|
return [2 /*return*/, false];
|
|
7726
7818
|
}
|
|
7727
|
-
|
|
7819
|
+
_g.label = 2;
|
|
7728
7820
|
case 2:
|
|
7729
|
-
if (!(this.riveFile.deferredSession !== null ||
|
|
7730
|
-
|
|
7821
|
+
if (!(this.riveFile.deferredSession !== null ||
|
|
7822
|
+
this.deferredRenderer ||
|
|
7823
|
+
((_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.replaysOnWorker) === null || _b === void 0 ? void 0 : _b.call(_a)) === true)) return [3 /*break*/, 7];
|
|
7824
|
+
if (!(((_d = (_c = this.renderer) === null || _c === void 0 ? void 0 : _c.replaysOnWorker) === null || _d === void 0 ? void 0 : _d.call(_c)) === true)) return [3 /*break*/, 4];
|
|
7825
|
+
return [4 /*yield*/, _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.awaitReplayCaps()];
|
|
7731
7826
|
case 3:
|
|
7732
|
-
|
|
7827
|
+
_g.sent();
|
|
7828
|
+
_g.label = 4;
|
|
7829
|
+
case 4:
|
|
7830
|
+
if (!!this.destroyed) return [3 /*break*/, 6];
|
|
7831
|
+
return [4 /*yield*/, this.resolveDeferredRendering()];
|
|
7832
|
+
case 5:
|
|
7833
|
+
_g.sent();
|
|
7834
|
+
_g.label = 6;
|
|
7835
|
+
case 6:
|
|
7733
7836
|
if (this.destroyed) {
|
|
7734
7837
|
// cleanup() ran during a re-import. Taking a reference now would
|
|
7735
7838
|
// resurrect a file this instance is never going to draw. Only ours
|
|
7736
7839
|
// to release — a caller-supplied file stays theirs.
|
|
7737
7840
|
if (this.ownsRiveFile) {
|
|
7738
|
-
(
|
|
7841
|
+
(_e = this.riveFile) === null || _e === void 0 ? void 0 : _e.destroyIfUnused();
|
|
7739
7842
|
}
|
|
7740
7843
|
return [2 /*return*/, false];
|
|
7741
7844
|
}
|
|
7742
|
-
|
|
7743
|
-
case
|
|
7845
|
+
_g.label = 7;
|
|
7846
|
+
case 7:
|
|
7744
7847
|
this.file = this.riveFile.getInstance();
|
|
7745
7848
|
this.reportDisplayScale();
|
|
7746
7849
|
// Initialize and draw frame
|
|
@@ -7760,7 +7863,7 @@ var Rive = /** @class */ (function () {
|
|
|
7760
7863
|
this.loaded = true;
|
|
7761
7864
|
this.eventManager.fire({
|
|
7762
7865
|
type: EventType.Load,
|
|
7763
|
-
data: (
|
|
7866
|
+
data: (_f = this.src) !== null && _f !== void 0 ? _f : "buffer",
|
|
7764
7867
|
});
|
|
7765
7868
|
}
|
|
7766
7869
|
catch (e) {
|
|
@@ -7778,12 +7881,12 @@ var Rive = /** @class */ (function () {
|
|
|
7778
7881
|
this.taskQueue.process();
|
|
7779
7882
|
this.drawFrame();
|
|
7780
7883
|
return [2 /*return*/, true];
|
|
7781
|
-
case
|
|
7782
|
-
error_4 =
|
|
7884
|
+
case 8:
|
|
7885
|
+
error_4 = _g.sent();
|
|
7783
7886
|
msg = resolveErrorMessage(error_4);
|
|
7784
7887
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
7785
7888
|
return [2 /*return*/, Promise.reject(msg)];
|
|
7786
|
-
case
|
|
7889
|
+
case 9: return [2 /*return*/];
|
|
7787
7890
|
}
|
|
7788
7891
|
});
|
|
7789
7892
|
});
|
|
@@ -7797,35 +7900,46 @@ var Rive = /** @class */ (function () {
|
|
|
7797
7900
|
*/
|
|
7798
7901
|
Rive.prototype.resolveDeferredRendering = function () {
|
|
7799
7902
|
return __awaiter(this, void 0, void 0, function () {
|
|
7800
|
-
var file, ownsFile, renderer, session, attachSession, immediate, copy,
|
|
7801
|
-
var
|
|
7802
|
-
return __generator(this, function (
|
|
7803
|
-
switch (
|
|
7903
|
+
var file, ownsFile, renderer, session, deferredOnly, attached_1, attachSession, immediate, _a, copy, attached, fallback;
|
|
7904
|
+
var _b, _c;
|
|
7905
|
+
return __generator(this, function (_d) {
|
|
7906
|
+
switch (_d.label) {
|
|
7804
7907
|
case 0:
|
|
7805
7908
|
file = this.riveFile;
|
|
7806
7909
|
ownsFile = this.ownsRiveFile;
|
|
7807
7910
|
renderer = this.renderer;
|
|
7808
7911
|
session = file.deferredSession;
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7912
|
+
deferredOnly = ((_b = renderer === null || renderer === void 0 ? void 0 : renderer.replaysOnWorker) === null || _b === void 0 ? void 0 : _b.call(renderer)) === true;
|
|
7913
|
+
if (!(session === null)) return [3 /*break*/, 3];
|
|
7914
|
+
if (!deferredOnly) return [3 /*break*/, 2];
|
|
7915
|
+
console.warn("Rive: this canvas draws on the replay worker, which only replays GPU Canvas files. Re-importing the file with `enableGPUCanvas: true` for this instance.");
|
|
7916
|
+
return [4 /*yield*/, this.attachDeferredCopy(file, renderer)];
|
|
7917
|
+
case 1:
|
|
7918
|
+
attached_1 = (_d.sent()).attached;
|
|
7919
|
+
if (attached_1 && ownsFile) {
|
|
7920
|
+
file.destroyIfUnused();
|
|
7817
7921
|
}
|
|
7922
|
+
return [2 /*return*/];
|
|
7923
|
+
case 2:
|
|
7924
|
+
// No second warning when the file asked for deferred and the build
|
|
7925
|
+
// could not honor it; the unsupported-build warning already fired, and
|
|
7926
|
+
// telling the user to set a flag they set would mislead.
|
|
7927
|
+
if (this.deferredRenderer && !file.deferredRequested) {
|
|
7928
|
+
console.warn("Rive: `enableGPUCanvas: true` was ignored because this RiveFile was imported without it. The mode is fixed at import: construct the RiveFile with `enableGPUCanvas: true` to opt in.");
|
|
7929
|
+
}
|
|
7930
|
+
return [2 /*return*/];
|
|
7931
|
+
case 3:
|
|
7818
7932
|
if (!this.deferredRenderer) {
|
|
7819
7933
|
console.warn("Rive: this RiveFile was imported with `enableGPUCanvas: true`, so this instance renders deferred even though `enableGPUCanvas` is false on the instance. An immediate renderer would drop the file's deferred resources and draw nothing.");
|
|
7820
7934
|
}
|
|
7821
7935
|
attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
|
|
7822
|
-
if (!(typeof attachSession !== "function")) return [3 /*break*/,
|
|
7936
|
+
if (!(typeof attachSession !== "function")) return [3 /*break*/, 5];
|
|
7823
7937
|
// Offscreen renderers share one context across canvases, which a session
|
|
7824
7938
|
// cannot record for. An immediate copy of the file still renders.
|
|
7825
7939
|
console.warn("Rive: this renderer cannot replay a deferred session (`useOffscreenRenderer` is not supported with deferred rendering). Re-importing the file in immediate mode for this instance.");
|
|
7826
7940
|
return [4 /*yield*/, file.reimport(false)];
|
|
7827
|
-
case
|
|
7828
|
-
immediate =
|
|
7941
|
+
case 4:
|
|
7942
|
+
immediate = _d.sent();
|
|
7829
7943
|
if (this.destroyed) {
|
|
7830
7944
|
// cleanup() ran while we were importing; nothing will use this copy.
|
|
7831
7945
|
immediate.destroyIfUnused();
|
|
@@ -7838,7 +7952,7 @@ var Rive = /** @class */ (function () {
|
|
|
7838
7952
|
file.destroyIfUnused();
|
|
7839
7953
|
}
|
|
7840
7954
|
return [2 /*return*/];
|
|
7841
|
-
case
|
|
7955
|
+
case 5:
|
|
7842
7956
|
// Never re-offered once claimed, even if that renderer is gone: the
|
|
7843
7957
|
// resources the session's stream refers to died with it.
|
|
7844
7958
|
if (!file.sessionClaimed && attachSession.call(renderer, session)) {
|
|
@@ -7848,20 +7962,14 @@ var Rive = /** @class */ (function () {
|
|
|
7848
7962
|
// Bound to another instance. Re-import from the retained buffer into a
|
|
7849
7963
|
// session of our own.
|
|
7850
7964
|
file.warnBoundElsewhereOnce();
|
|
7851
|
-
return [4 /*yield*/,
|
|
7852
|
-
case
|
|
7853
|
-
|
|
7854
|
-
if (this.destroyed) {
|
|
7855
|
-
// The renderer was deleted while we imported; attaching to it would hand
|
|
7856
|
-
// embind a deleted object.
|
|
7857
|
-
copy.destroyIfUnused();
|
|
7965
|
+
return [4 /*yield*/, this.attachDeferredCopy(file, renderer)];
|
|
7966
|
+
case 6:
|
|
7967
|
+
_a = _d.sent(), copy = _a.copy, attached = _a.attached;
|
|
7968
|
+
if (attached || this.destroyed) {
|
|
7858
7969
|
return [2 /*return*/];
|
|
7859
7970
|
}
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
copySession = copy.deferredSession;
|
|
7863
|
-
if (copySession !== null && attachSession.call(renderer, copySession)) {
|
|
7864
|
-
copy.claimSession();
|
|
7971
|
+
if (deferredOnly) {
|
|
7972
|
+
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas, which draws on the replay worker and has no immediate fallback.");
|
|
7865
7973
|
return [2 /*return*/];
|
|
7866
7974
|
}
|
|
7867
7975
|
// The copy's session could not take this canvas either (this renderer
|
|
@@ -7870,10 +7978,10 @@ var Rive = /** @class */ (function () {
|
|
|
7870
7978
|
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.");
|
|
7871
7979
|
// If a leftover session is why the attach failed, it would keep routing
|
|
7872
7980
|
// the immediate file's draws into its recorder, which drops them.
|
|
7873
|
-
(
|
|
7981
|
+
(_c = renderer.detachSession) === null || _c === void 0 ? void 0 : _c.call(renderer);
|
|
7874
7982
|
return [4 /*yield*/, file.reimport(false)];
|
|
7875
|
-
case
|
|
7876
|
-
fallback =
|
|
7983
|
+
case 7:
|
|
7984
|
+
fallback = _d.sent();
|
|
7877
7985
|
// The deferred copy was only ever ours, so it always goes.
|
|
7878
7986
|
copy.destroyIfUnused();
|
|
7879
7987
|
if (this.destroyed) {
|
|
@@ -7890,6 +7998,63 @@ var Rive = /** @class */ (function () {
|
|
|
7890
7998
|
});
|
|
7891
7999
|
});
|
|
7892
8000
|
};
|
|
8001
|
+
// Reloads what this instance was playing. State the reload does not carry,
|
|
8002
|
+
// such as a view model instance bound by hand, starts over.
|
|
8003
|
+
Rive.prototype.reloadForRestoredContext = function () {
|
|
8004
|
+
// A copy re-imported for this instance kept no source to reload from.
|
|
8005
|
+
var riveFile = this.ownsRiveFile ? undefined : this.riveFile;
|
|
8006
|
+
if (!this.src && !this.buffer && !riveFile) {
|
|
8007
|
+
this.stopRendering();
|
|
8008
|
+
if (!Rive.replayContextLostWarned) {
|
|
8009
|
+
Rive.replayContextLostWarned = true;
|
|
8010
|
+
console.warn("Rive: the replay worker's WebGL context was restored, but this instance has no `src` or `buffer` to reload from, so its canvas stays blank.");
|
|
8011
|
+
}
|
|
8012
|
+
return;
|
|
8013
|
+
}
|
|
8014
|
+
this.load({
|
|
8015
|
+
src: this.src,
|
|
8016
|
+
buffer: this.buffer,
|
|
8017
|
+
riveFile: riveFile,
|
|
8018
|
+
artboard: this.activeArtboard,
|
|
8019
|
+
animations: this.playingAnimationNames.concat(this.pausedAnimationNames),
|
|
8020
|
+
stateMachines: this.playingStateMachineNames.concat(this.pausedStateMachineNames),
|
|
8021
|
+
autoplay: this.isPlaying,
|
|
8022
|
+
autoBind: this._viewModelInstance !== null,
|
|
8023
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
8024
|
+
});
|
|
8025
|
+
};
|
|
8026
|
+
/**
|
|
8027
|
+
* Re-imports `file` deferred and attaches the copy's session to `renderer`.
|
|
8028
|
+
* The copy becomes this instance's file either way, unless the instance was
|
|
8029
|
+
* destroyed while it imported.
|
|
8030
|
+
*/
|
|
8031
|
+
Rive.prototype.attachDeferredCopy = function (file, renderer) {
|
|
8032
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
8033
|
+
var copy, copySession, attached;
|
|
8034
|
+
var _a;
|
|
8035
|
+
return __generator(this, function (_b) {
|
|
8036
|
+
switch (_b.label) {
|
|
8037
|
+
case 0: return [4 /*yield*/, file.reimport(true)];
|
|
8038
|
+
case 1:
|
|
8039
|
+
copy = _b.sent();
|
|
8040
|
+
if (this.destroyed) {
|
|
8041
|
+
// The renderer was deleted while we imported; attaching to it would hand
|
|
8042
|
+
// embind a deleted object.
|
|
8043
|
+
copy.destroyIfUnused();
|
|
8044
|
+
return [2 /*return*/, { copy: copy, attached: false }];
|
|
8045
|
+
}
|
|
8046
|
+
this.riveFile = copy;
|
|
8047
|
+
this.ownsRiveFile = true;
|
|
8048
|
+
copySession = copy.deferredSession;
|
|
8049
|
+
attached = copySession !== null && ((_a = renderer.attachSession) === null || _a === void 0 ? void 0 : _a.call(renderer, copySession)) === true;
|
|
8050
|
+
if (attached) {
|
|
8051
|
+
copy.claimSession();
|
|
8052
|
+
}
|
|
8053
|
+
return [2 /*return*/, { copy: copy, attached: attached }];
|
|
8054
|
+
}
|
|
8055
|
+
});
|
|
8056
|
+
});
|
|
8057
|
+
};
|
|
7893
8058
|
// Initialize for playback
|
|
7894
8059
|
Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
7895
8060
|
if (!this.file) {
|
|
@@ -8217,6 +8382,7 @@ var Rive = /** @class */ (function () {
|
|
|
8217
8382
|
* @param time the rAF timestamp, or null to draw now without advancing
|
|
8218
8383
|
*/
|
|
8219
8384
|
Rive.prototype.draw = function (time, onSecond) {
|
|
8385
|
+
var _a, _b, _c, _d;
|
|
8220
8386
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
8221
8387
|
this.frameRequestId = null;
|
|
8222
8388
|
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
@@ -8224,6 +8390,19 @@ var Rive = /** @class */ (function () {
|
|
|
8224
8390
|
if (!this.artboard) {
|
|
8225
8391
|
return;
|
|
8226
8392
|
}
|
|
8393
|
+
// The replay worker's context came back empty, so everything it held has
|
|
8394
|
+
// to be recorded again through a fresh renderer and session.
|
|
8395
|
+
if (((_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.contextRestored) === null || _b === void 0 ? void 0 : _b.call(_a)) === true) {
|
|
8396
|
+
this.reloadForRestoredContext();
|
|
8397
|
+
return;
|
|
8398
|
+
}
|
|
8399
|
+
// The replay worker has yet to take the canvas, or is still on earlier
|
|
8400
|
+
// frames. Waiting keeps its queue bounded, and the frame that follows
|
|
8401
|
+
// advances by the whole wait, so playback keeps time.
|
|
8402
|
+
if (((_d = (_c = this.renderer) === null || _c === void 0 ? void 0 : _c.acceptsFrame) === null || _d === void 0 ? void 0 : _d.call(_c)) === false) {
|
|
8403
|
+
this.scheduleRendering();
|
|
8404
|
+
return;
|
|
8405
|
+
}
|
|
8227
8406
|
var before = performance.now();
|
|
8228
8407
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
8229
8408
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -8254,8 +8433,13 @@ var Rive = /** @class */ (function () {
|
|
|
8254
8433
|
this.lastRenderTime = frameTime;
|
|
8255
8434
|
this.advanceAndReportChanges(elapsedTime, time);
|
|
8256
8435
|
var renderer = this.renderer;
|
|
8257
|
-
//
|
|
8258
|
-
|
|
8436
|
+
// Don't draw on a 0-size canvas; redraw once it has area. The observer
|
|
8437
|
+
// flags zero size late, so also check the surface itself.
|
|
8438
|
+
var hasSurface = this.canvas.width > 0 && this.canvas.height > 0;
|
|
8439
|
+
if (!hasSurface) {
|
|
8440
|
+
this._needsRedraw = true;
|
|
8441
|
+
}
|
|
8442
|
+
if (!this._hasZeroSize && hasSurface) {
|
|
8259
8443
|
// If there was no dirt on this frame, do not clear and draw. The deferred
|
|
8260
8444
|
// term has to be read here, before `clear()` below: clearing opens the
|
|
8261
8445
|
// session's recording window and marks its stream, so a read taken after
|
|
@@ -9655,6 +9839,7 @@ var Rive = /** @class */ (function () {
|
|
|
9655
9839
|
playingStateMachines.forEach(function (sm) { return sm.clearFocus(); });
|
|
9656
9840
|
};
|
|
9657
9841
|
Rive.inkbleedUnsupportedWarned = false;
|
|
9842
|
+
Rive.replayContextLostWarned = false;
|
|
9658
9843
|
Rive.inkbleedNotCapableWarned = false;
|
|
9659
9844
|
// Error message for missing source or buffer
|
|
9660
9845
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|