@rive-app/canvas-lite 2.48.0 → 2.49.0
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 +297 -151
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +77 -1
- package/rive_fallback.wasm +0 -0
- package/runtimeLoader.d.ts +25 -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
|
|
@@ -382,6 +387,46 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
382
387
|
RuntimeLoader.getWasmThreadsUrl = function () {
|
|
383
388
|
return RuntimeLoader.wasmThreadsURL;
|
|
384
389
|
};
|
|
390
|
+
/**
|
|
391
|
+
* Sets how many parts a script's parallel call gets on a page that runs
|
|
392
|
+
* the threaded build, the page's thread and one worker thread for each
|
|
393
|
+
* other part. 1 turns parallel calls off, and null leaves the runtime's
|
|
394
|
+
* default of one part per core, up to 8. Set it before the first file
|
|
395
|
+
* loads.
|
|
396
|
+
*/
|
|
397
|
+
RuntimeLoader.setParallelParts = function (parts) {
|
|
398
|
+
RuntimeLoader.parallelParts = parts;
|
|
399
|
+
RuntimeLoader.applyParallelParts();
|
|
400
|
+
};
|
|
401
|
+
// Gets the parts set with setParallelParts (null means the default)
|
|
402
|
+
RuntimeLoader.getParallelParts = function () {
|
|
403
|
+
return RuntimeLoader.parallelParts;
|
|
404
|
+
};
|
|
405
|
+
RuntimeLoader.applyParallelParts = function () {
|
|
406
|
+
var _a;
|
|
407
|
+
var scripting = (_a = RuntimeLoader.runtime) === null || _a === void 0 ? void 0 : _a.riveScripting;
|
|
408
|
+
if (scripting) {
|
|
409
|
+
scripting.parallelParts = RuntimeLoader.parallelParts;
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* @experimental When the threaded build loads, instances with
|
|
414
|
+
* `enableGPUCanvas` hand their canvas to one worker that replays every
|
|
415
|
+
* instance's frames while the page records the next ones. Pass `false`
|
|
416
|
+
* before the runtime loads to keep replay on the page's thread; a single
|
|
417
|
+
* instance can opt out with `useReplayWorker: false`. Pages where the
|
|
418
|
+
* browser cannot draw WebGL2 on a transferred canvas stay on the page's
|
|
419
|
+
* thread regardless.
|
|
420
|
+
*
|
|
421
|
+
* True by default.
|
|
422
|
+
*/
|
|
423
|
+
RuntimeLoader.setReplayWorker = function (enabled) {
|
|
424
|
+
RuntimeLoader.replayWorker = enabled;
|
|
425
|
+
};
|
|
426
|
+
// Gets whether a threaded runtime may replay on a worker
|
|
427
|
+
RuntimeLoader.getReplayWorker = function () {
|
|
428
|
+
return RuntimeLoader.replayWorker;
|
|
429
|
+
};
|
|
385
430
|
// Manually sets the wasm binary or clears it with null
|
|
386
431
|
RuntimeLoader.setWasmBinary = function (value) {
|
|
387
432
|
if ((value instanceof ArrayBuffer) || value === null) {
|
|
@@ -411,6 +456,11 @@ var RuntimeLoader = /** @class */ (function () {
|
|
|
411
456
|
? "https://unpkg.com/".concat(package_json__WEBPACK_IMPORTED_MODULE_2__.name, "@").concat(package_json__WEBPACK_IMPORTED_MODULE_2__.version, "/rive_threads.wasm")
|
|
412
457
|
: null;
|
|
413
458
|
RuntimeLoader.triedThreads = false;
|
|
459
|
+
// The parts a script's parallel call gets on the threaded build, or null
|
|
460
|
+
// for the runtime's default.
|
|
461
|
+
RuntimeLoader.parallelParts = null;
|
|
462
|
+
// Whether a threaded runtime replays deferred frames on a worker.
|
|
463
|
+
RuntimeLoader.replayWorker = true;
|
|
414
464
|
// Error callbacks enqueued from .getInstance()
|
|
415
465
|
RuntimeLoader.errorCallbackQueue = [];
|
|
416
466
|
/**
|
|
@@ -432,109 +482,110 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
432
482
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
433
483
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
434
484
|
/* 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(){
|
|
485
|
+
var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var l=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope;
|
|
486
|
+
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=
|
|
487
|
+
"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(){}}
|
|
488
|
+
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;
|
|
489
|
+
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=
|
|
490
|
+
"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);
|
|
491
|
+
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}});
|
|
492
|
+
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);
|
|
493
|
+
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}
|
|
494
|
+
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"),
|
|
495
|
+
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)}}
|
|
496
|
+
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",
|
|
497
|
+
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 "+
|
|
498
|
+
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 }");
|
|
499
|
+
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());
|
|
500
|
+
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,
|
|
501
|
+
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!=
|
|
502
|
+
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;
|
|
503
|
+
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]*
|
|
504
|
+
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;
|
|
505
|
+
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;
|
|
506
|
+
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";
|
|
507
|
+
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,
|
|
508
|
+
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,
|
|
509
|
+
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;
|
|
510
|
+
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,
|
|
511
|
+
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===
|
|
512
|
+
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();
|
|
513
|
+
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();
|
|
514
|
+
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,
|
|
515
|
+
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=
|
|
516
|
+
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=
|
|
517
|
+
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,
|
|
518
|
+
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,
|
|
519
|
+
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);
|
|
520
|
+
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);
|
|
521
|
+
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-
|
|
522
|
+
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,
|
|
523
|
+
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";
|
|
524
|
+
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,
|
|
525
|
+
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=
|
|
526
|
+
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,
|
|
527
|
+
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)},
|
|
528
|
+
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)},
|
|
529
|
+
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)},
|
|
530
|
+
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,
|
|
531
|
+
...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);
|
|
532
|
+
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=
|
|
533
|
+
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;
|
|
534
|
+
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+
|
|
535
|
+
" : "+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)}
|
|
536
|
+
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}
|
|
537
|
+
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)}
|
|
538
|
+
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}};
|
|
539
|
+
class kb extends Error{}
|
|
540
|
+
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):
|
|
541
|
+
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])}
|
|
542
|
+
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)};
|
|
543
|
+
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(){}
|
|
544
|
+
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})!`);
|
|
545
|
+
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=[]}
|
|
546
|
+
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};
|
|
547
|
+
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)}
|
|
548
|
+
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");
|
|
549
|
+
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}
|
|
550
|
+
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)}
|
|
551
|
+
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}}))};
|
|
552
|
+
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)}
|
|
553
|
+
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{}
|
|
554
|
+
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}
|
|
555
|
+
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})}
|
|
556
|
+
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))},
|
|
557
|
+
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>>
|
|
558
|
+
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,
|
|
559
|
+
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]);
|
|
560
|
+
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=
|
|
561
|
+
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,[],[]];
|
|
562
|
+
(()=>{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=
|
|
563
|
+
!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"])})();
|
|
564
|
+
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?
|
|
565
|
+
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()();
|
|
566
|
+
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=
|
|
567
|
+
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=>
|
|
568
|
+
{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,
|
|
569
|
+
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,
|
|
570
|
+
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=[]);
|
|
571
|
+
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)),
|
|
572
|
+
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,
|
|
573
|
+
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!`);
|
|
574
|
+
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=
|
|
575
|
+
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,
|
|
576
|
+
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]},
|
|
577
|
+
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},
|
|
578
|
+
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,
|
|
579
|
+
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&&
|
|
580
|
+
(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|
|
|
581
|
+
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}`);
|
|
582
|
+
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);
|
|
583
|
+
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,
|
|
584
|
+
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=>
|
|
585
|
+
{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=
|
|
586
|
+
0):q.push(A)}f+=g}N[d>>2]=f;return 0}},Lc;
|
|
587
|
+
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)}());
|
|
588
|
+
(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
589
|
;return moduleRtn}})();
|
|
539
590
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
540
591
|
|
|
@@ -550,7 +601,7 @@ Cc=await (async function(){function b(c){c=Cc=c.exports;kb=c.free;Ac=c.malloc;jb
|
|
|
550
601
|
/***/ ((module) => {
|
|
551
602
|
|
|
552
603
|
"use strict";
|
|
553
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.
|
|
604
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.49.0","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
605
|
|
|
555
606
|
/***/ }),
|
|
556
607
|
/* 7 */
|
|
@@ -7072,7 +7123,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
7072
7123
|
var Rive = /** @class */ (function () {
|
|
7073
7124
|
function Rive(params) {
|
|
7074
7125
|
var _this = this;
|
|
7075
|
-
var _a, _b, _c, _d, _e;
|
|
7126
|
+
var _a, _b, _c, _d, _e, _f;
|
|
7076
7127
|
// Tracks if a Rive file is loaded
|
|
7077
7128
|
this.loaded = false;
|
|
7078
7129
|
// Tracks if a Rive file is destroyed
|
|
@@ -7090,6 +7141,8 @@ var Rive = /** @class */ (function () {
|
|
|
7090
7141
|
// Deferred rendering was requested for this instance. The file it renders
|
|
7091
7142
|
// has the final say, since a file's mode is fixed at import.
|
|
7092
7143
|
this.deferredRenderer = false;
|
|
7144
|
+
// Whether a deferred instance may hand its canvas to the replay worker.
|
|
7145
|
+
this.useReplayWorker = true;
|
|
7093
7146
|
// Decides the context attributes on every init(); cleared if the renderer can't inkbleed.
|
|
7094
7147
|
this._inkbleedCapable = false;
|
|
7095
7148
|
this._inkbleed = false;
|
|
@@ -7270,6 +7323,7 @@ var Rive = /** @class */ (function () {
|
|
|
7270
7323
|
this._focusOptions = (_d = params.focusOptions) !== null && _d !== void 0 ? _d : this._focusOptions;
|
|
7271
7324
|
this._tabIndex = (_e = params.tabIndex) !== null && _e !== void 0 ? _e : null;
|
|
7272
7325
|
this.deferredRenderer = !!params.enableGPUCanvas;
|
|
7326
|
+
this.useReplayWorker = (_f = params.useReplayWorker) !== null && _f !== void 0 ? _f : true;
|
|
7273
7327
|
this._inkbleedCapable = !!params.enableInkbleed;
|
|
7274
7328
|
this._inkbleed = this._inkbleedCapable;
|
|
7275
7329
|
// New event management system
|
|
@@ -7462,6 +7516,7 @@ var Rive = /** @class */ (function () {
|
|
|
7462
7516
|
// Ensure the runtime is loaded
|
|
7463
7517
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.awaitInstance()
|
|
7464
7518
|
.then(function (runtime) {
|
|
7519
|
+
var _a, _b;
|
|
7465
7520
|
if (_this.destroyed) {
|
|
7466
7521
|
return;
|
|
7467
7522
|
}
|
|
@@ -7477,7 +7532,19 @@ var Rive = /** @class */ (function () {
|
|
|
7477
7532
|
try {
|
|
7478
7533
|
// Always immediate at creation; a deferred file attaches its session
|
|
7479
7534
|
// to this renderer once the file has loaded.
|
|
7480
|
-
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer, {
|
|
7535
|
+
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer, {
|
|
7536
|
+
inkbleed: _this._inkbleedCapable,
|
|
7537
|
+
// An immediate file would only re-import for the worker.
|
|
7538
|
+
replayWorker: _this.deferredRenderer &&
|
|
7539
|
+
_this.useReplayWorker &&
|
|
7540
|
+
((_b = (_a = _this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredRequested) !== null && _b !== void 0 ? _b : true),
|
|
7541
|
+
// Draws notice a restored context, so one has to be scheduled.
|
|
7542
|
+
onContextRestored: function () {
|
|
7543
|
+
if (!_this._explicitlyStoppedRendering) {
|
|
7544
|
+
_this.scheduleRendering();
|
|
7545
|
+
}
|
|
7546
|
+
},
|
|
7547
|
+
});
|
|
7481
7548
|
if (!_this.renderer) {
|
|
7482
7549
|
throw new Error("Renderer is null, cannot render Rive on the canvas.");
|
|
7483
7550
|
}
|
|
@@ -7696,11 +7763,11 @@ var Rive = /** @class */ (function () {
|
|
|
7696
7763
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
7697
7764
|
return __awaiter(this, void 0, void 0, function () {
|
|
7698
7765
|
var riveFile, error_4, msg;
|
|
7699
|
-
var _a, _b;
|
|
7700
|
-
return __generator(this, function (
|
|
7701
|
-
switch (
|
|
7766
|
+
var _a, _b, _c, _d;
|
|
7767
|
+
return __generator(this, function (_e) {
|
|
7768
|
+
switch (_e.label) {
|
|
7702
7769
|
case 0:
|
|
7703
|
-
|
|
7770
|
+
_e.trys.push([0, 5, , 6]);
|
|
7704
7771
|
// A caller-supplied riveFile is theirs to release; one we import here is
|
|
7705
7772
|
// ours, which matters if a deferred fallback replaces it below.
|
|
7706
7773
|
this.ownsRiveFile = this.riveFile == null;
|
|
@@ -7717,29 +7784,31 @@ var Rive = /** @class */ (function () {
|
|
|
7717
7784
|
this.riveFile = riveFile;
|
|
7718
7785
|
return [4 /*yield*/, riveFile.init()];
|
|
7719
7786
|
case 1:
|
|
7720
|
-
|
|
7787
|
+
_e.sent();
|
|
7721
7788
|
if (this.destroyed) {
|
|
7722
7789
|
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
7723
7790
|
// another rive file, we only want to destroy it if this file is the only owner.
|
|
7724
7791
|
riveFile.destroyIfUnused();
|
|
7725
7792
|
return [2 /*return*/, false];
|
|
7726
7793
|
}
|
|
7727
|
-
|
|
7794
|
+
_e.label = 2;
|
|
7728
7795
|
case 2:
|
|
7729
|
-
if (!(this.riveFile.deferredSession !== null ||
|
|
7796
|
+
if (!(this.riveFile.deferredSession !== null ||
|
|
7797
|
+
this.deferredRenderer ||
|
|
7798
|
+
((_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*/, 4];
|
|
7730
7799
|
return [4 /*yield*/, this.resolveDeferredRendering()];
|
|
7731
7800
|
case 3:
|
|
7732
|
-
|
|
7801
|
+
_e.sent();
|
|
7733
7802
|
if (this.destroyed) {
|
|
7734
7803
|
// cleanup() ran during a re-import. Taking a reference now would
|
|
7735
7804
|
// resurrect a file this instance is never going to draw. Only ours
|
|
7736
7805
|
// to release — a caller-supplied file stays theirs.
|
|
7737
7806
|
if (this.ownsRiveFile) {
|
|
7738
|
-
(
|
|
7807
|
+
(_c = this.riveFile) === null || _c === void 0 ? void 0 : _c.destroyIfUnused();
|
|
7739
7808
|
}
|
|
7740
7809
|
return [2 /*return*/, false];
|
|
7741
7810
|
}
|
|
7742
|
-
|
|
7811
|
+
_e.label = 4;
|
|
7743
7812
|
case 4:
|
|
7744
7813
|
this.file = this.riveFile.getInstance();
|
|
7745
7814
|
this.reportDisplayScale();
|
|
@@ -7760,7 +7829,7 @@ var Rive = /** @class */ (function () {
|
|
|
7760
7829
|
this.loaded = true;
|
|
7761
7830
|
this.eventManager.fire({
|
|
7762
7831
|
type: EventType.Load,
|
|
7763
|
-
data: (
|
|
7832
|
+
data: (_d = this.src) !== null && _d !== void 0 ? _d : "buffer",
|
|
7764
7833
|
});
|
|
7765
7834
|
}
|
|
7766
7835
|
catch (e) {
|
|
@@ -7779,7 +7848,7 @@ var Rive = /** @class */ (function () {
|
|
|
7779
7848
|
this.drawFrame();
|
|
7780
7849
|
return [2 /*return*/, true];
|
|
7781
7850
|
case 5:
|
|
7782
|
-
error_4 =
|
|
7851
|
+
error_4 = _e.sent();
|
|
7783
7852
|
msg = resolveErrorMessage(error_4);
|
|
7784
7853
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
7785
7854
|
return [2 /*return*/, Promise.reject(msg)];
|
|
@@ -7797,35 +7866,46 @@ var Rive = /** @class */ (function () {
|
|
|
7797
7866
|
*/
|
|
7798
7867
|
Rive.prototype.resolveDeferredRendering = function () {
|
|
7799
7868
|
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 (
|
|
7869
|
+
var file, ownsFile, renderer, session, deferredOnly, attached_1, attachSession, immediate, _a, copy, attached, fallback;
|
|
7870
|
+
var _b, _c;
|
|
7871
|
+
return __generator(this, function (_d) {
|
|
7872
|
+
switch (_d.label) {
|
|
7804
7873
|
case 0:
|
|
7805
7874
|
file = this.riveFile;
|
|
7806
7875
|
ownsFile = this.ownsRiveFile;
|
|
7807
7876
|
renderer = this.renderer;
|
|
7808
7877
|
session = file.deferredSession;
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7878
|
+
deferredOnly = ((_b = renderer === null || renderer === void 0 ? void 0 : renderer.replaysOnWorker) === null || _b === void 0 ? void 0 : _b.call(renderer)) === true;
|
|
7879
|
+
if (!(session === null)) return [3 /*break*/, 3];
|
|
7880
|
+
if (!deferredOnly) return [3 /*break*/, 2];
|
|
7881
|
+
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.");
|
|
7882
|
+
return [4 /*yield*/, this.attachDeferredCopy(file, renderer)];
|
|
7883
|
+
case 1:
|
|
7884
|
+
attached_1 = (_d.sent()).attached;
|
|
7885
|
+
if (attached_1 && ownsFile) {
|
|
7886
|
+
file.destroyIfUnused();
|
|
7887
|
+
}
|
|
7888
|
+
return [2 /*return*/];
|
|
7889
|
+
case 2:
|
|
7890
|
+
// No second warning when the file asked for deferred and the build
|
|
7891
|
+
// could not honor it; the unsupported-build warning already fired, and
|
|
7892
|
+
// telling the user to set a flag they set would mislead.
|
|
7893
|
+
if (this.deferredRenderer && !file.deferredRequested) {
|
|
7894
|
+
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.");
|
|
7817
7895
|
}
|
|
7896
|
+
return [2 /*return*/];
|
|
7897
|
+
case 3:
|
|
7818
7898
|
if (!this.deferredRenderer) {
|
|
7819
7899
|
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
7900
|
}
|
|
7821
7901
|
attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
|
|
7822
|
-
if (!(typeof attachSession !== "function")) return [3 /*break*/,
|
|
7902
|
+
if (!(typeof attachSession !== "function")) return [3 /*break*/, 5];
|
|
7823
7903
|
// Offscreen renderers share one context across canvases, which a session
|
|
7824
7904
|
// cannot record for. An immediate copy of the file still renders.
|
|
7825
7905
|
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
7906
|
return [4 /*yield*/, file.reimport(false)];
|
|
7827
|
-
case
|
|
7828
|
-
immediate =
|
|
7907
|
+
case 4:
|
|
7908
|
+
immediate = _d.sent();
|
|
7829
7909
|
if (this.destroyed) {
|
|
7830
7910
|
// cleanup() ran while we were importing; nothing will use this copy.
|
|
7831
7911
|
immediate.destroyIfUnused();
|
|
@@ -7838,7 +7918,7 @@ var Rive = /** @class */ (function () {
|
|
|
7838
7918
|
file.destroyIfUnused();
|
|
7839
7919
|
}
|
|
7840
7920
|
return [2 /*return*/];
|
|
7841
|
-
case
|
|
7921
|
+
case 5:
|
|
7842
7922
|
// Never re-offered once claimed, even if that renderer is gone: the
|
|
7843
7923
|
// resources the session's stream refers to died with it.
|
|
7844
7924
|
if (!file.sessionClaimed && attachSession.call(renderer, session)) {
|
|
@@ -7848,20 +7928,14 @@ var Rive = /** @class */ (function () {
|
|
|
7848
7928
|
// Bound to another instance. Re-import from the retained buffer into a
|
|
7849
7929
|
// session of our own.
|
|
7850
7930
|
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();
|
|
7931
|
+
return [4 /*yield*/, this.attachDeferredCopy(file, renderer)];
|
|
7932
|
+
case 6:
|
|
7933
|
+
_a = _d.sent(), copy = _a.copy, attached = _a.attached;
|
|
7934
|
+
if (attached || this.destroyed) {
|
|
7858
7935
|
return [2 /*return*/];
|
|
7859
7936
|
}
|
|
7860
|
-
|
|
7861
|
-
|
|
7862
|
-
copySession = copy.deferredSession;
|
|
7863
|
-
if (copySession !== null && attachSession.call(renderer, copySession)) {
|
|
7864
|
-
copy.claimSession();
|
|
7937
|
+
if (deferredOnly) {
|
|
7938
|
+
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
7939
|
return [2 /*return*/];
|
|
7866
7940
|
}
|
|
7867
7941
|
// The copy's session could not take this canvas either (this renderer
|
|
@@ -7870,10 +7944,10 @@ var Rive = /** @class */ (function () {
|
|
|
7870
7944
|
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
7945
|
// If a leftover session is why the attach failed, it would keep routing
|
|
7872
7946
|
// the immediate file's draws into its recorder, which drops them.
|
|
7873
|
-
(
|
|
7947
|
+
(_c = renderer.detachSession) === null || _c === void 0 ? void 0 : _c.call(renderer);
|
|
7874
7948
|
return [4 /*yield*/, file.reimport(false)];
|
|
7875
|
-
case
|
|
7876
|
-
fallback =
|
|
7949
|
+
case 7:
|
|
7950
|
+
fallback = _d.sent();
|
|
7877
7951
|
// The deferred copy was only ever ours, so it always goes.
|
|
7878
7952
|
copy.destroyIfUnused();
|
|
7879
7953
|
if (this.destroyed) {
|
|
@@ -7890,6 +7964,63 @@ var Rive = /** @class */ (function () {
|
|
|
7890
7964
|
});
|
|
7891
7965
|
});
|
|
7892
7966
|
};
|
|
7967
|
+
// Reloads what this instance was playing. State the reload does not carry,
|
|
7968
|
+
// such as a view model instance bound by hand, starts over.
|
|
7969
|
+
Rive.prototype.reloadForRestoredContext = function () {
|
|
7970
|
+
// A copy re-imported for this instance kept no source to reload from.
|
|
7971
|
+
var riveFile = this.ownsRiveFile ? undefined : this.riveFile;
|
|
7972
|
+
if (!this.src && !this.buffer && !riveFile) {
|
|
7973
|
+
this.stopRendering();
|
|
7974
|
+
if (!Rive.replayContextLostWarned) {
|
|
7975
|
+
Rive.replayContextLostWarned = true;
|
|
7976
|
+
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.");
|
|
7977
|
+
}
|
|
7978
|
+
return;
|
|
7979
|
+
}
|
|
7980
|
+
this.load({
|
|
7981
|
+
src: this.src,
|
|
7982
|
+
buffer: this.buffer,
|
|
7983
|
+
riveFile: riveFile,
|
|
7984
|
+
artboard: this.activeArtboard,
|
|
7985
|
+
animations: this.playingAnimationNames.concat(this.pausedAnimationNames),
|
|
7986
|
+
stateMachines: this.playingStateMachineNames.concat(this.pausedStateMachineNames),
|
|
7987
|
+
autoplay: this.isPlaying,
|
|
7988
|
+
autoBind: this._viewModelInstance !== null,
|
|
7989
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
7990
|
+
});
|
|
7991
|
+
};
|
|
7992
|
+
/**
|
|
7993
|
+
* Re-imports `file` deferred and attaches the copy's session to `renderer`.
|
|
7994
|
+
* The copy becomes this instance's file either way, unless the instance was
|
|
7995
|
+
* destroyed while it imported.
|
|
7996
|
+
*/
|
|
7997
|
+
Rive.prototype.attachDeferredCopy = function (file, renderer) {
|
|
7998
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7999
|
+
var copy, copySession, attached;
|
|
8000
|
+
var _a;
|
|
8001
|
+
return __generator(this, function (_b) {
|
|
8002
|
+
switch (_b.label) {
|
|
8003
|
+
case 0: return [4 /*yield*/, file.reimport(true)];
|
|
8004
|
+
case 1:
|
|
8005
|
+
copy = _b.sent();
|
|
8006
|
+
if (this.destroyed) {
|
|
8007
|
+
// The renderer was deleted while we imported; attaching to it would hand
|
|
8008
|
+
// embind a deleted object.
|
|
8009
|
+
copy.destroyIfUnused();
|
|
8010
|
+
return [2 /*return*/, { copy: copy, attached: false }];
|
|
8011
|
+
}
|
|
8012
|
+
this.riveFile = copy;
|
|
8013
|
+
this.ownsRiveFile = true;
|
|
8014
|
+
copySession = copy.deferredSession;
|
|
8015
|
+
attached = copySession !== null && ((_a = renderer.attachSession) === null || _a === void 0 ? void 0 : _a.call(renderer, copySession)) === true;
|
|
8016
|
+
if (attached) {
|
|
8017
|
+
copy.claimSession();
|
|
8018
|
+
}
|
|
8019
|
+
return [2 /*return*/, { copy: copy, attached: attached }];
|
|
8020
|
+
}
|
|
8021
|
+
});
|
|
8022
|
+
});
|
|
8023
|
+
};
|
|
7893
8024
|
// Initialize for playback
|
|
7894
8025
|
Rive.prototype.initArtboard = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
7895
8026
|
if (!this.file) {
|
|
@@ -8217,6 +8348,7 @@ var Rive = /** @class */ (function () {
|
|
|
8217
8348
|
* @param time the rAF timestamp, or null to draw now without advancing
|
|
8218
8349
|
*/
|
|
8219
8350
|
Rive.prototype.draw = function (time, onSecond) {
|
|
8351
|
+
var _a, _b, _c, _d;
|
|
8220
8352
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
8221
8353
|
this.frameRequestId = null;
|
|
8222
8354
|
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
@@ -8224,6 +8356,19 @@ var Rive = /** @class */ (function () {
|
|
|
8224
8356
|
if (!this.artboard) {
|
|
8225
8357
|
return;
|
|
8226
8358
|
}
|
|
8359
|
+
// The replay worker's context came back empty, so everything it held has
|
|
8360
|
+
// to be recorded again through a fresh renderer and session.
|
|
8361
|
+
if (((_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.contextRestored) === null || _b === void 0 ? void 0 : _b.call(_a)) === true) {
|
|
8362
|
+
this.reloadForRestoredContext();
|
|
8363
|
+
return;
|
|
8364
|
+
}
|
|
8365
|
+
// The replay worker has yet to take the canvas, or is still on earlier
|
|
8366
|
+
// frames. Waiting keeps its queue bounded, and the frame that follows
|
|
8367
|
+
// advances by the whole wait, so playback keeps time.
|
|
8368
|
+
if (((_d = (_c = this.renderer) === null || _c === void 0 ? void 0 : _c.acceptsFrame) === null || _d === void 0 ? void 0 : _d.call(_c)) === false) {
|
|
8369
|
+
this.scheduleRendering();
|
|
8370
|
+
return;
|
|
8371
|
+
}
|
|
8227
8372
|
var before = performance.now();
|
|
8228
8373
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
8229
8374
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -9655,6 +9800,7 @@ var Rive = /** @class */ (function () {
|
|
|
9655
9800
|
playingStateMachines.forEach(function (sm) { return sm.clearFocus(); });
|
|
9656
9801
|
};
|
|
9657
9802
|
Rive.inkbleedUnsupportedWarned = false;
|
|
9803
|
+
Rive.replayContextLostWarned = false;
|
|
9658
9804
|
Rive.inkbleedNotCapableWarned = false;
|
|
9659
9805
|
// Error message for missing source or buffer
|
|
9660
9806
|
Rive.missingErrorMessage = "Rive source file or data buffer required";
|