@rive-app/canvas-lite 2.41.1 → 2.42.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/rive.js CHANGED
@@ -349,100 +349,103 @@ __webpack_require__.r(__webpack_exports__);
349
349
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
350
350
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
351
351
  /* harmony export */ });
352
- var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var l=moduleArg,aa=!!globalThis.window,ba=!!globalThis.WorkerGlobalScope;
353
- function ea(){function b(h){const g=d;c=a=0;d=new Map;g.forEach(m=>{try{m(h)}catch(n){console.error(n)}});this.rb();e&&e.Pb()}let a=0,c=0,d=new Map,e=null,f=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.Nb=function(h){f&&(document.body.remove(f),f=null);h||(f=document.createElement("div"),f.style.backgroundColor="black",f.style.position=
354
- "fixed",f.style.right=0,f.style.top=0,f.style.color="white",f.style.padding="4px",f.innerHTML="RIVE FPS",h=function(g){f.innerHTML="RIVE FPS "+g.toFixed(1)},document.body.appendChild(f));e=new function(){let g=0,m=0;this.Pb=function(){var n=performance.now();m?(++g,n-=m,1E3<n&&(h(1E3*g/n),g=m=0)):(m=n,g=0)}}};this.Kb=function(){f&&(document.body.remove(f),f=null);e=null};this.rb=function(){}}
355
- function ia(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}}const ja=l.onRuntimeInitialized;
356
- l.onRuntimeInitialized=function(){ja&&ja();let b=l.decodeAudio;l.decodeAudio=function(f,h){f=b(f);h(f)};let a=l.decodeFont;l.decodeFont=function(f,h){f=a(f);h(f)};let c=l.setFallbackFontCb;l.setFallbackFontCallback="function"===typeof c?function(f){c(f)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};const d=l.FileAssetLoader;l.ptrToAsset=f=>{let h=l.ptrToFileAsset(f);return h.isImage?l.ptrToImageAsset(f):h.isFont?l.ptrToFontAsset(f):
357
- h.isAudio?l.ptrToAudioAsset(f):h};l.CustomFileAssetLoader=d.extend("CustomFileAssetLoader",{__construct:function({loadContents:f}){this.__parent.__construct.call(this);this.Fb=f},loadContents:function(f,h){f=l.ptrToAsset(f);return this.Fb(f,h)}});l.CDNFileAssetLoader=d.extend("CDNFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this)},loadContents:function(f){let h=l.ptrToAsset(f);f=h.cdnUuid;if(""===f)return!1;(function(g,m){var n=new XMLHttpRequest;n.responseType="arraybuffer";
358
- n.onreadystatechange=function(){4==n.readyState&&200==n.status&&m(n)};n.open("GET",g,!0);n.send(null)})(h.cdnBaseUrl+"/"+f,g=>{h.decode(new Uint8Array(g.response))});return!0}});l.FallbackFileAssetLoader=d.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.qb=[]},addLoader:function(f){this.qb.push(f)},loadContents:function(f,h){for(let g of this.qb)if(g.loadContents(f,h))return!0;return!1}});let e=l.computeAlignment;l.computeAlignment=function(f,h,g,
359
- m,n=1){return e.call(this,f,h,g,m,n)}};
360
- const ka="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),la=new function(){function b(){if(!a){var t=document.createElement("canvas"),v={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,
361
- renderViaOffscreenBackBuffer:1};let p;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(p=t.getContext("webgl",v),c=1,!p)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(p=t.getContext("webgl2",v))c=2;else if(p=t.getContext("webgl",v))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;p=new Proxy(p,{get(G,r){if(G.isContextLost()){if(m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",r),m=!0),
362
- "function"===typeof G[r])return function(){}}else return"function"===typeof G[r]?function(...E){return G[r].apply(G,E)}:G[r]},set(G,r,E){if(G.isContextLost())m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+r),m=!0);else return G[r]=E,!0}});d=Math.min(p.getParameter(p.MAX_RENDERBUFFER_SIZE),p.getParameter(p.MAX_TEXTURE_SIZE));function I(G,r,E){r=p.createShader(r);p.shaderSource(r,E);p.compileShader(r);E=p.getShaderInfoLog(r);if(0<(E||"").length)throw E;
363
- p.attachShader(G,r)}t=p.createProgram();I(t,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 }");I(t,p.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");
364
- p.bindAttribLocation(t,0,"vertex");p.bindAttribLocation(t,1,"uv");p.linkProgram(t);v=p.getProgramInfoLog(t);if(0<(v||"").trim().length)throw v;e=p.getUniformLocation(t,"mat");f=p.getUniformLocation(t,"translate");p.useProgram(t);p.bindBuffer(p.ARRAY_BUFFER,p.createBuffer());p.enableVertexAttribArray(0);p.enableVertexAttribArray(1);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,p.createBuffer());p.uniform1i(p.getUniformLocation(t,"image"),0);p.pixelStorei(p.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=p}return!0}let a=
365
- null,c=0,d=0,e=null,f=null,h=0,g=0,m=!1;b();this.Yb=function(){b();return d};this.Jb=function(t){a.deleteTexture&&a.deleteTexture(t)};this.Ib=function(t){if(!b())return null;const v=a.createTexture();if(!v)return null;a.bindTexture(a.TEXTURE_2D,v);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,t);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,
366
- 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 v};const n=new ia(8),u=new ia(8),A=new ia(10),x=new ia(10);this.Mb=function(t,v,p,I,G){if(b()){var r=n.push(t),E=u.push(v);if(a.canvas){if(a.canvas.width!=r||a.canvas.height!=E)a.canvas.width=r,a.canvas.height=E;a.viewport(0,E-v,t,v);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.SCISSOR_TEST);p.sort((F,Z)=>Z.vb-F.vb);
367
- r=A.push(I);h!=r&&(a.bufferData(a.ARRAY_BUFFER,8*r,a.DYNAMIC_DRAW),h=r);r=0;for(var L of p)a.bufferSubData(a.ARRAY_BUFFER,r,L.ab),r+=4*L.ab.length;console.assert(r==4*I);for(var O of p)a.bufferSubData(a.ARRAY_BUFFER,r,O.yb),r+=4*O.yb.length;console.assert(r==8*I);r=x.push(G);g!=r&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,2*r,a.DYNAMIC_DRAW),g=r);L=0;for(var W of p)a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,L,W.indices),L+=2*W.indices.length;console.assert(L==2*G);W=0;O=!0;r=L=0;for(const F of p){F.image.Va!=
368
- W&&(a.bindTexture(a.TEXTURE_2D,F.image.Ta||null),W=F.image.Va);F.ac?(a.scissor(F.ib,E-F.jb-F.pb,F.ic,F.pb),O=!0):O&&(a.scissor(0,E-v,t,v),O=!1);p=2/t;const Z=-2/v;a.uniform4f(e,F.wa[0]*p*F.La,F.wa[1]*Z*F.Ma,F.wa[2]*p*F.La,F.wa[3]*Z*F.Ma);a.uniform2f(f,F.wa[4]*p*F.La+p*(F.ib-F.Zb*F.La)-1,F.wa[5]*Z*F.Ma+Z*(F.jb-F.$b*F.Ma)+1);a.vertexAttribPointer(0,2,a.FLOAT,!1,0,r);a.vertexAttribPointer(1,2,a.FLOAT,!1,0,r+4*I);a.drawElements(a.TRIANGLES,F.indices.length,a.UNSIGNED_SHORT,L);r+=4*F.ab.length;L+=2*F.indices.length}console.assert(r==
369
- 4*I);console.assert(L==2*G)}}};this.canvas=function(){return b()&&a.canvas}},ma=l.onRuntimeInitialized;
370
- l.onRuntimeInitialized=function(){function b(k){switch(k){case n.srcOver:return"source-over";case n.screen:return"screen";case n.overlay:return"overlay";case n.darken:return"darken";case n.lighten:return"lighten";case n.colorDodge:return"color-dodge";case n.colorBurn:return"color-burn";case n.hardLight:return"hard-light";case n.softLight:return"soft-light";case n.difference:return"difference";case n.exclusion:return"exclusion";case n.multiply:return"multiply";case n.hue:return"hue";case n.saturation:return"saturation";
371
- case n.color:return"color";case n.luminosity:return"luminosity"}}function a(k){return"rgba("+((16711680&k)>>>16)+","+((65280&k)>>>8)+","+((255&k)>>>0)+","+((4278190080&k)>>>24)/255+")"}function c(){0<L.length&&(la.Mb(E.drawWidth(),E.drawHeight(),L,O,W),L=[],W=O=0,E.reset(512,512));for(const k of r){for(const q of k.na)q();k.na=[]}r.clear()}ma&&ma();var d=l.RenderPaintStyle;const e=l.RenderPath,f=l.RenderPaint,h=l.Renderer,g=l.StrokeCap,m=l.StrokeJoin,n=l.BlendMode,u=d.fill,A=d.stroke,x=l.FillRule.evenOdd;
372
- let t=1;var v=l.RenderImage.extend("CanvasRenderImage",{__construct:function({Ba:k,Ka:q}={}){this.__parent.__construct.call(this);this.Va=t;t=t+1&2147483647||1;this.Ba=k;this.Ka=q},__destruct:function(){this.Ta&&(la.Jb(this.Ta),URL.revokeObjectURL(this.gb));this.__parent.__destruct.call(this)},decode:function(k){var q=this;q.Ka&&q.Ka(q);var z=new Image;q.gb=URL.createObjectURL(new Blob([k],{type:"image/png"}));z.onload=function(){q.Eb=z;q.Ta=la.Ib(z);q.size(z.width,z.height);q.Ba&&q.Ba(q)};z.src=
373
- q.gb}});class p{constructor(){this.Da=this.Ha=0;this.sa=new Path2D}clear(){this.Da=this.Ha=0;this.sa=new Path2D}Gb(k){for(0<this.Ha&&this.Da<k.length&&this.clear();this.Da<k.length;)k[this.Da++](this.sa);this.Ha++;return this.sa}release(k){k===this.sa&&this.Ha--}}var I=e.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.Ra=[];this.sa=new p;this.Qa=!1;this.za=null},rewind:function(){this.Ra.length=0;this.sa.clear();this.Qa=!1;this.za=null},addPath:function(k,
374
- q,z,y,D,w,C){const H=k.Ab();this.ya(fa=>{const M=new DOMMatrix;M.a=q;M.b=z;M.c=y;M.d=D;M.e=w;M.f=C;fa.addPath(H,M)})},fillRule:function(k){this.fb=k},moveTo:function(k,q){this.Qa=!0;const z={kb:!0};this.za=z;this.ya(y=>{y.moveTo(k,q);z.kb&&y.lineTo(k,q)})},lineTo:function(k,q){this.eb();this.Oa();this.ya(z=>{z.lineTo(k,q)})},cubicTo:function(k,q,z,y,D,w){this.eb();this.Oa();this.ya(C=>{C.bezierCurveTo(k,q,z,y,D,w)})},close:function(){this.Oa();this.ya(k=>{k.closePath()})},eb:function(){this.Qa||this.moveTo(0,
375
- 0)},Oa:function(){null!==this.za&&(this.za.kb=!1,this.za=null)},ya:function(k){this.Ra.push(k)},Na:function(){return this.sa.Gb(this.Ra)},hb:function(k){this.sa.release(k)},Ab:function(){const k=this.Na();this.sa.clear();return k}}),G=f.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.la=[];this.Pa=0;this.Sa=u;this.Wa=a(4278190080);this.Ua=1;this.Ga="miter";this.Fa="butt";this.bb=b(n.srcOver);this.va=null},color:function(k){this.la.push(()=>{this.Wa=a(k)})},
376
- thickness:function(k){this.la.push(()=>{this.Ua=Math.abs(k)})},join:function(k){this.la.push(()=>{switch(k){case m.miter:this.Ga="miter";break;case m.round:this.Ga="round";break;case m.bevel:this.Ga="bevel"}})},cap:function(k){this.la.push(()=>{switch(k){case g.butt:this.Fa="butt";break;case g.round:this.Fa="round";break;case g.square:this.Fa="square"}})},style:function(k){this.la.push(()=>{this.Sa=k})},blendMode:function(k){this.la.push(()=>{this.bb=b(k)})},clearGradient:function(){this.la.push(()=>
377
- {this.va=null})},linearGradient:function(k,q,z,y){this.la.push(()=>{this.va={wb:k,xb:q,mb:z,nb:y,$a:[]}})},radialGradient:function(k,q,z,y){this.la.push(()=>{this.va={wb:k,xb:q,mb:z,nb:y,$a:[],Wb:!0}})},addStop:function(k,q){this.la.push(()=>{this.va.$a.push({color:k,stop:q})})},completeGradient:function(){},Bb:function(k,q,z,y){if(this.Sa!==A||0<this.Ua){var D=this.Sa,w=this.Wa,C=this.va,H=k.globalCompositeOperation,fa=k.globalAlpha;k.globalCompositeOperation=this.bb;k.globalAlpha=y;if(null!=C){w=
378
- C.wb;const S=C.xb,U=C.mb;var M=C.nb;y=C.$a;C.Wb?(C=U-w,M-=S,w=k.createRadialGradient(w,S,0,w,S,Math.sqrt(C*C+M*M))):w=k.createLinearGradient(w,S,U,M);for(let R=0,Aa=y.length;R<Aa;R++)C=y[R],w.addColorStop(C.stop,a(C.color));this.Wa=w;this.va=null}switch(D){case A:k.strokeStyle=w;k.lineWidth=this.Ua;k.lineCap=this.Fa;k.lineJoin=this.Ga;k.stroke(q);break;case u:k.fillStyle=w,k.fill(q,z)}k.globalCompositeOperation=H;k.globalAlpha=fa}},Db:function(){return this.Pa+this.la.length},Cb:function(k){const q=
379
- k-this.Pa;for(let z=0;z<q;z++)this.la[z]();this.la.splice(0,q);this.Pa=k}});const r=new Set;let E=null,L=[],O=0,W=0;var F=l.CanvasRenderer=h.extend("Renderer",{__construct:function(k){this.__parent.__construct.call(this);this.ra=[1,0,0,1,0,0];this.ja=[1];this.ha=k.getContext("2d");this.cb=k;this.na=[]},save:function(){this.ra.push(...this.ra.slice(this.ra.length-6));this.ja.push(this.ja[this.ja.length-1]);this.na.push(this.ha.save.bind(this.ha))},restore:function(){const k=this.ra.length-6;if(6>k)throw"restore() called without matching save().";
380
- this.ra.splice(k);this.ja.pop();this.na.push(this.ha.restore.bind(this.ha))},transform:function(k,q,z,y,D,w){const C=this.ra,H=C.length-6;C.splice(H,6,C[H]*k+C[H+2]*q,C[H+1]*k+C[H+3]*q,C[H]*z+C[H+2]*y,C[H+1]*z+C[H+3]*y,C[H]*D+C[H+2]*w+C[H+4],C[H+1]*D+C[H+3]*w+C[H+5]);this.na.push(this.ha.transform.bind(this.ha,k,q,z,y,D,w))},rotate:function(k){const q=Math.sin(k);k=Math.cos(k);this.transform(k,q,-q,k,0,0)},modulateOpacity:function(k){this.ja[this.ja.length-1]*=k},_drawPath:function(k,q){const z=k.fb===
381
- x?"evenodd":"nonzero",y=Math.max(0,this.ja[this.ja.length-1]),D=k.Na(),w=q.Db();this.na.push(()=>{q.Cb(w);q.Bb(this.ha,D,z,y);k.hb(D)})},_drawRiveImage:function(k,q,z){var y=k.Eb;if(y){var D=this.ha,w=b(q),C=Math.max(0,z*this.ja[this.ja.length-1]);this.na.push(function(){D.globalCompositeOperation=w;D.globalAlpha=C;D.drawImage(y,0,0);D.globalAlpha=1})}},_getMatrix:function(k){const q=this.ra,z=q.length-6;for(let y=0;6>y;++y)k[y]=q[z+y]},_drawImageMesh:function(k,q,z,y,D,w,C,H,fa,M,S,U,R){let Aa,ob,
382
- pb;try{Aa=l.HEAPF32.slice(y>>2,(y>>2)+D),ob=l.HEAPF32.slice(w>>2,(w>>2)+C),pb=l.HEAPU16.slice(H>>1,(H>>1)+fa)}catch(Ra){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}y=this.ha.canvas.width;w=this.ha.canvas.height;C=U-M;H=R-S;M=Math.max(M,0);S=Math.max(S,0);U=Math.min(U,y);R=Math.min(R,w);const pa=U-M,qa=R-S;console.assert(pa<=Math.min(C,y));console.assert(qa<=Math.min(H,w));if(!(0>=pa||0>=qa)){U=pa<C||qa<H;y=R=1;var ca=Math.ceil(pa*
383
- R),da=Math.ceil(qa*y);w=la.Yb();ca>w&&(R*=w/ca,ca=w);da>w&&(y*=w/da,da=w);E||(E=new l.DynamicRectanizer(w),E.reset(512,512));w=E.addRect(ca,da);0>w&&(c(),r.add(this),w=E.addRect(ca,da),console.assert(0<=w));var qb=w&65535,rb=w>>16;L.push({wa:this.ra.slice(this.ra.length-6),image:k,ib:qb,jb:rb,Zb:M,$b:S,ic:ca,pb:da,La:R,Ma:y,ab:Aa,yb:ob,indices:pb,ac:U,vb:k.Va<<1|(U?1:0)});O+=D;W+=fa;var ha=this.ha,cc=b(q),dc=Math.max(0,z*this.ja[this.ja.length-1]);this.na.push(function(){ha.save();ha.resetTransform();
384
- ha.globalCompositeOperation=cc;ha.globalAlpha=dc;const Ra=la.canvas();Ra&&ha.drawImage(Ra,qb,rb,ca,da,M,S,pa,qa);ha.restore()})}},_clipPath:function(k){const q=k.fb===x?"evenodd":"nonzero",z=k.Na();this.na.push(()=>{this.ha.clip(z,q);k.hb(z)})},beginFrame:function(k=!0){r.add(this);k&&this.na.push(this.ha.clearRect.bind(this.ha,0,0,this.cb.width,this.cb.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(k,q){this.transform(1,0,0,1,k,q)}});l.makeRenderer=function(k){const q=
385
- new F(k),z=q.ha;return new Proxy(q,{get(y,D){if("function"===typeof y[D])return function(...w){return y[D].apply(y,w)};if("function"===typeof z[D]){if(-1<ka.indexOf(D))throw Error("RiveException: Method call to '"+D+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...w){q.na.push(z[D].bind(z,...w))}}return y[D]},set(y,D,w){if(D in z)return q.na.push(()=>{z[D]=w}),!0}})};l.decodeImage=function(k,
386
- q){(new v({Ba:q})).decode(k)};l.renderFactory={makeRenderPaint:function(){return new G},makeRenderPath:function(){return new I},makeRenderImage:function(){let k=Sa;return new v({Ka:()=>{k.total++},Ba:()=>{k.loaded++;if(k.loaded===k.total){const q=k.ready;q&&(q(),k.ready=null)}}})}};let Z=l.load,Sa=null;l.load=function(k,q,z=!0){const y=new l.FallbackFileAssetLoader;void 0!==q&&y.addLoader(q);z&&(q=new l.CDNFileAssetLoader,y.addLoader(q));return new Promise(function(D){let w=null;Sa={total:0,loaded:0,
387
- ready:function(){D(w)}};w=Z(k,y);0==Sa.total&&D(w)})};let ec=l.RendererWrapper.prototype.align;l.RendererWrapper.prototype.align=function(k,q,z,y,D=1){ec.call(this,k,q,z,y,D)};d=new ea;l.requestAnimationFrame=d.requestAnimationFrame.bind(d);l.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);l.enableFPSCounter=d.Nb.bind(d);l.disableFPSCounter=d.Kb;d.rb=c;l.resolveAnimationFrame=c;l.cleanup=function(){E&&E.delete()}};var na="./this.program";ba&&(_scriptName=self.location.href);var oa="",ra,sa;
388
- if(aa||ba){try{oa=(new URL(".",_scriptName)).href}catch{}ba&&(sa=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});ra=async b=>{if(ta(b))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var a=await fetch(b,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+
389
- " : "+a.url);}}var ua=console.log.bind(console),va=console.error.bind(console),wa,xa=!1,ya,ta=b=>b.startsWith("file://"),za,Ba,Ca,B,Da,Ea,Fa,J,Ga,Ha,Ia,Ja,Ka=!1;function La(){var b=Ma.buffer;l.HEAP8=Ca=new Int8Array(b);Da=new Int16Array(b);l.HEAPU8=B=new Uint8Array(b);l.HEAPU16=Ea=new Uint16Array(b);l.HEAP32=Fa=new Int32Array(b);l.HEAPU32=J=new Uint32Array(b);l.HEAPF32=Ga=new Float32Array(b);Ha=new Float64Array(b);Ia=new BigInt64Array(b);Ja=new BigUint64Array(b)}
390
- function Na(b){l.onAbort?.(b);b="Aborted("+b+")";va(b);xa=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");Ba?.(b);throw b;}var Oa;async function Pa(b){if(!wa)try{var a=await ra(b);return new Uint8Array(a)}catch{}if(b==Oa&&wa)b=new Uint8Array(wa);else if(sa)b=sa(b);else throw"both async and sync fetching of the wasm failed";return b}
352
+ var Rive=(()=>{var _scriptName=globalThis.document?.currentScript?.src;return async function(moduleArg={}){var moduleRtn;var h=moduleArg,ba=!!globalThis.window,ca=!!globalThis.WorkerGlobalScope;
353
+ function fa(){function b(g){const f=d;c=a=0;d=new Map;f.forEach(m=>{try{m(g)}catch(n){console.error(n)}});this.rb();e&&e.Qb()}let a=0,c=0,d=new Map,e=null,k=null;this.requestAnimationFrame=function(g){a||=requestAnimationFrame(b.bind(this));const f=++c;d.set(f,g);return f};this.cancelAnimationFrame=function(g){d.delete(g);a&&0==d.size&&(cancelAnimationFrame(a),a=0)};this.Ob=function(g){k&&(document.body.remove(k),k=null);g||(k=document.createElement("div"),k.style.backgroundColor="black",k.style.position=
354
+ "fixed",k.style.right=0,k.style.top=0,k.style.color="white",k.style.padding="4px",k.innerHTML="RIVE FPS",g=function(f){k.innerHTML="RIVE FPS "+f.toFixed(1)},document.body.appendChild(k));e=new function(){let f=0,m=0;this.Qb=function(){var n=performance.now();m?(++f,n-=m,1E3<n&&(g(1E3*f/n),f=m=0)):(m=n,f=0)}}};this.Lb=function(){k&&(document.body.remove(k),k=null);e=null};this.rb=function(){}}
355
+ function ia(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}}const ja=h.onRuntimeInitialized;
356
+ h.onRuntimeInitialized=function(){ja&&ja();let b=h.decodeAudio;h.decodeAudio=function(g,f,m=null){g=b(g,m??null);f(g)};let a=h.decodeFont;h.decodeFont=function(g,f,m=null){g=a(g,m??null);f(g)};const c=h.FileAsset.prototype.decode;h.FileAsset.prototype.decode=function(g,f){return c.call(this,g,f??null)};let d=h.setFallbackFontCb;h.setFallbackFontCallback="function"===typeof d?function(g){d(g)}:function(){console.warn("Module.setFallbackFontCallback called, but text support is not enabled in this build.")};
357
+ const e=h.FileAssetLoader;h.ptrToAsset=g=>{let f=h.ptrToFileAsset(g);return f.isImage?h.ptrToImageAsset(g):f.isFont?h.ptrToFontAsset(g):f.isAudio?h.ptrToAudioAsset(g):f};h.CustomFileAssetLoader=e.extend("CustomFileAssetLoader",{__construct:function({loadContents:g}){this.__parent.__construct.call(this);this.Fb=g},loadContents:function(g,f){g=h.ptrToAsset(g);return this.Fb(g,f)}});h.CDNFileAssetLoader=e.extend("CDNFileAssetLoader",{__construct:function(g){this.__parent.__construct.call(this);this.Gb=
358
+ g??null},loadContents:function(g){let f=h.ptrToAsset(g);g=f.cdnUuid;if(""===g)return!1;const m=this.Gb??null;(function(n,r){var w=new XMLHttpRequest;w.responseType="arraybuffer";w.onreadystatechange=function(){4==w.readyState&&200==w.status&&r(w)};w.open("GET",n,!0);w.send(null)})(f.cdnBaseUrl+"/"+g,n=>{f.decode(new Uint8Array(n.response),m)});return!0}});h.FallbackFileAssetLoader=e.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.qb=[]},addLoader:function(g){this.qb.push(g)},
359
+ loadContents:function(g,f){for(let m of this.qb)if(m.loadContents(g,f))return!0;return!1}});let k=h.computeAlignment;h.computeAlignment=function(g,f,m,n,r=1){return k.call(this,g,f,m,n,r)}};
360
+ const ka="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),la=new function(){function b(){if(!a){var v=document.createElement("canvas"),x={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,
361
+ renderViaOffscreenBackBuffer:1};let q;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(q=v.getContext("webgl",x),c=1,!q)return console.log("No WebGL support. Image mesh will not be drawn."),!1}else if(q=v.getContext("webgl2",x))c=2;else if(q=v.getContext("webgl",x))c=1;else return console.log("No WebGL support. Image mesh will not be drawn."),!1;q=new Proxy(q,{get(I,u){if(I.isContextLost()){if(m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",u),m=!0),
362
+ "function"===typeof I[u])return function(){}}else return"function"===typeof I[u]?function(...J){return I[u].apply(I,J)}:I[u]},set(I,u,J){if(I.isContextLost())m||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+u),m=!0);else return I[u]=J,!0}});d=Math.min(q.getParameter(q.MAX_RENDERBUFFER_SIZE),q.getParameter(q.MAX_TEXTURE_SIZE));function L(I,u,J){u=q.createShader(u);q.shaderSource(u,J);q.compileShader(u);J=q.getShaderInfoLog(u);if(0<(J||"").length)throw J;
363
+ q.attachShader(I,u)}v=q.createProgram();L(v,q.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 }");L(v,q.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }");
364
+ q.bindAttribLocation(v,0,"vertex");q.bindAttribLocation(v,1,"uv");q.linkProgram(v);x=q.getProgramInfoLog(v);if(0<(x||"").trim().length)throw x;e=q.getUniformLocation(v,"mat");k=q.getUniformLocation(v,"translate");q.useProgram(v);q.bindBuffer(q.ARRAY_BUFFER,q.createBuffer());q.enableVertexAttribArray(0);q.enableVertexAttribArray(1);q.bindBuffer(q.ELEMENT_ARRAY_BUFFER,q.createBuffer());q.uniform1i(q.getUniformLocation(v,"image"),0);q.pixelStorei(q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);a=q}return!0}let a=
365
+ null,c=0,d=0,e=null,k=null,g=0,f=0,m=!1;b();this.Zb=function(){b();return d};this.Kb=function(v){a&&a.deleteTexture&&a.deleteTexture(v)};this.Jb=function(v){if(!b())return null;const x=a.createTexture();if(!x)return null;a.bindTexture(a.TEXTURE_2D,x);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,v);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==
366
+ 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 x};const n=new ia(8),r=new ia(8),w=new ia(10),z=new ia(10);this.Nb=function(v,x,q,L,I){if(b()){var u=n.push(v),J=r.push(x);if(a.canvas){if(a.canvas.width!=u||a.canvas.height!=J)a.canvas.width=u,a.canvas.height=J;a.viewport(0,J-x,v,x);a.disable(a.SCISSOR_TEST);a.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.SCISSOR_TEST);
367
+ q.sort((E,aa)=>aa.vb-E.vb);u=w.push(L);g!=u&&(a.bufferData(a.ARRAY_BUFFER,8*u,a.DYNAMIC_DRAW),g=u);u=0;for(var K of q)a.bufferSubData(a.ARRAY_BUFFER,u,K.ab),u+=4*K.ab.length;console.assert(u==4*L);for(var R of q)a.bufferSubData(a.ARRAY_BUFFER,u,R.yb),u+=4*R.yb.length;console.assert(u==8*L);u=z.push(I);f!=u&&(a.bufferData(a.ELEMENT_ARRAY_BUFFER,2*u,a.DYNAMIC_DRAW),f=u);K=0;for(var X of q)a.bufferSubData(a.ELEMENT_ARRAY_BUFFER,K,X.indices),K+=2*X.indices.length;console.assert(K==2*I);X=0;R=!0;u=K=0;
368
+ for(const E of q){E.image.Va!=X&&(a.bindTexture(a.TEXTURE_2D,E.image.Ta||null),X=E.image.Va);E.bc?(a.scissor(E.ib,J-E.jb-E.pb,E.jc,E.pb),R=!0):R&&(a.scissor(0,J-x,v,x),R=!1);q=2/v;const aa=-2/x;a.uniform4f(e,E.wa[0]*q*E.La,E.wa[1]*aa*E.Ma,E.wa[2]*q*E.La,E.wa[3]*aa*E.Ma);a.uniform2f(k,E.wa[4]*q*E.La+q*(E.ib-E.$b*E.La)-1,E.wa[5]*aa*E.Ma+aa*(E.jb-E.ac*E.Ma)+1);a.vertexAttribPointer(0,2,a.FLOAT,!1,0,u);a.vertexAttribPointer(1,2,a.FLOAT,!1,0,u+4*L);a.drawElements(a.TRIANGLES,E.indices.length,a.UNSIGNED_SHORT,
369
+ K);u+=4*E.ab.length;K+=2*E.indices.length}console.assert(u==4*L);console.assert(K==2*I)}}};this.canvas=function(){return b()&&a.canvas}},ma=h.onRuntimeInitialized;
370
+ h.onRuntimeInitialized=function(){function b(l){switch(l){case n.srcOver:return"source-over";case n.screen:return"screen";case n.overlay:return"overlay";case n.darken:return"darken";case n.lighten:return"lighten";case n.colorDodge:return"color-dodge";case n.colorBurn:return"color-burn";case n.hardLight:return"hard-light";case n.softLight:return"soft-light";case n.difference:return"difference";case n.exclusion:return"exclusion";case n.multiply:return"multiply";case n.hue:return"hue";case n.saturation:return"saturation";
371
+ case n.color:return"color";case n.luminosity:return"luminosity"}}function a(l){return"rgba("+((16711680&l)>>>16)+","+((65280&l)>>>8)+","+((255&l)>>>0)+","+((4278190080&l)>>>24)/255+")"}function c(){0<R.length&&(la.Nb(K.drawWidth(),K.drawHeight(),R,X,E),R=[],E=X=0,K.reset(512,512));for(const l of u){for(const p of l.na)p();l.na=[]}u.clear()}ma&&ma();var d=h.RenderPaintStyle;const e=h.RenderPath,k=h.RenderPaint,g=h.Renderer,f=h.StrokeCap,m=h.StrokeJoin,n=h.BlendMode,r=d.fill,w=d.stroke,z=h.FillRule.evenOdd;
372
+ let v=1;var x=h.RenderImage.extend("CanvasRenderImage",{__construct:function({Ba:l,Ka:p}={}){this.__parent.__construct.call(this);this.Va=v;v=v+1&2147483647||1;this.Ba=l;this.Ka=p},__destruct:function(){this.Ta&&(la.Kb(this.Ta),URL.revokeObjectURL(this.gb));this.__parent.__destruct.call(this)},decode:function(l){var p=this;p.Ka&&p.Ka(p);var A=new Image;p.gb=URL.createObjectURL(new Blob([l],{type:"image/png"}));A.onload=function(){p.Eb=A;p.Ta=la.Jb(A);p.size(A.width,A.height);p.Ba&&p.Ba(p)};A.src=
373
+ p.gb}});class q{constructor(){this.Da=this.Ha=0;this.sa=new Path2D}clear(){this.Da=this.Ha=0;this.sa=new Path2D}Hb(l){for(0<this.Ha&&this.Da<l.length&&this.clear();this.Da<l.length;)l[this.Da++](this.sa);this.Ha++;return this.sa}release(l){l===this.sa&&this.Ha--}}var L=e.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.Ra=[];this.sa=new q;this.Qa=!1;this.za=null},rewind:function(){this.Ra.length=0;this.sa.clear();this.Qa=!1;this.za=null},addPath:function(l,
374
+ p,A,t,G,B,C){const y=l.Ab();this.ya(F=>{const H=new DOMMatrix;H.a=p;H.b=A;H.c=t;H.d=G;H.e=B;H.f=C;F.addPath(y,H)})},fillRule:function(l){this.fb=l},moveTo:function(l,p){this.Qa=!0;const A={kb:!0};this.za=A;this.ya(t=>{t.moveTo(l,p);A.kb&&t.lineTo(l,p)})},lineTo:function(l,p){this.eb();this.Oa();this.ya(A=>{A.lineTo(l,p)})},cubicTo:function(l,p,A,t,G,B){this.eb();this.Oa();this.ya(C=>{C.bezierCurveTo(l,p,A,t,G,B)})},close:function(){this.Oa();this.ya(l=>{l.closePath()})},eb:function(){this.Qa||this.moveTo(0,
375
+ 0)},Oa:function(){null!==this.za&&(this.za.kb=!1,this.za=null)},ya:function(l){this.Ra.push(l)},Na:function(){return this.sa.Hb(this.Ra)},hb:function(l){this.sa.release(l)},Ab:function(){const l=this.Na();this.sa.clear();return l}}),I=k.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.la=[];this.Pa=0;this.Sa=r;this.Wa=a(4278190080);this.Ua=1;this.Ga="miter";this.Fa="butt";this.bb=b(n.srcOver);this.va=null},color:function(l){this.la.push(()=>{this.Wa=a(l)})},
376
+ thickness:function(l){this.la.push(()=>{this.Ua=Math.abs(l)})},join:function(l){this.la.push(()=>{switch(l){case m.miter:this.Ga="miter";break;case m.round:this.Ga="round";break;case m.bevel:this.Ga="bevel"}})},cap:function(l){this.la.push(()=>{switch(l){case f.butt:this.Fa="butt";break;case f.round:this.Fa="round";break;case f.square:this.Fa="square"}})},style:function(l){this.la.push(()=>{this.Sa=l})},blendMode:function(l){this.la.push(()=>{this.bb=b(l)})},clearGradient:function(){this.la.push(()=>
377
+ {this.va=null})},linearGradient:function(l,p,A,t){this.la.push(()=>{this.va={wb:l,xb:p,mb:A,nb:t,$a:[]}})},radialGradient:function(l,p,A,t){this.la.push(()=>{this.va={wb:l,xb:p,mb:A,nb:t,$a:[],Xb:!0}})},addStop:function(l,p){this.la.push(()=>{this.va.$a.push({color:l,stop:p})})},completeGradient:function(){},Bb:function(l,p,A,t){if(this.Sa!==w||0<this.Ua){var G=this.Sa,B=this.Wa,C=this.va,y=l.globalCompositeOperation,F=l.globalAlpha;l.globalCompositeOperation=this.bb;l.globalAlpha=t;if(null!=C){B=
378
+ C.wb;const O=C.xb,Q=C.mb;var H=C.nb;t=C.$a;C.Xb?(C=Q-B,H-=O,B=l.createRadialGradient(B,O,0,B,O,Math.sqrt(C*C+H*H))):B=l.createLinearGradient(B,O,Q,H);for(let S=0,Aa=t.length;S<Aa;S++)C=t[S],B.addColorStop(C.stop,a(C.color));this.Wa=B;this.va=null}switch(G){case w:l.strokeStyle=B;l.lineWidth=this.Ua;l.lineCap=this.Fa;l.lineJoin=this.Ga;l.stroke(p);break;case r:l.fillStyle=B,l.fill(p,A)}l.globalCompositeOperation=y;l.globalAlpha=F}},Db:function(){return this.Pa+this.la.length},Cb:function(l){const p=
379
+ l-this.Pa;for(let A=0;A<p;A++)this.la[A]();this.la.splice(0,p);this.Pa=l}});const u=new Set,J=Object.prototype.hasOwnProperty;let K=null,R=[],X=0,E=0;var aa=h.CanvasRenderer=g.extend("Renderer",{__construct:function(l){this.__parent.__construct.call(this);this.ra=[1,0,0,1,0,0];this.ja=[1];this.ha=l.getContext("2d");this.cb=l;this.na=[]},save:function(){this.ra.push(...this.ra.slice(this.ra.length-6));this.ja.push(this.ja[this.ja.length-1]);this.na.push(this.ha.save.bind(this.ha))},restore:function(){const l=
380
+ this.ra.length-6;if(6>l)throw"restore() called without matching save().";this.ra.splice(l);this.ja.pop();this.na.push(this.ha.restore.bind(this.ha))},transform:function(l,p,A,t,G,B){const C=this.ra,y=C.length-6;C.splice(y,6,C[y]*l+C[y+2]*p,C[y+1]*l+C[y+3]*p,C[y]*A+C[y+2]*t,C[y+1]*A+C[y+3]*t,C[y]*G+C[y+2]*B+C[y+4],C[y+1]*G+C[y+3]*B+C[y+5]);this.na.push(this.ha.transform.bind(this.ha,l,p,A,t,G,B))},rotate:function(l){const p=Math.sin(l);l=Math.cos(l);this.transform(l,p,-p,l,0,0)},modulateOpacity:function(l){this.ja[this.ja.length-
381
+ 1]*=l},_drawPath:function(l,p){const A=l.fb===z?"evenodd":"nonzero",t=Math.max(0,this.ja[this.ja.length-1]),G=l.Na(),B=p.Db();this.na.push(()=>{p.Cb(B);p.Bb(this.ha,G,A,t);l.hb(G)})},_drawRiveImage:function(l,p,A){var t=l.Eb;if(t){var G=this.ha,B=b(p),C=Math.max(0,A*this.ja[this.ja.length-1]);this.na.push(function(){G.globalCompositeOperation=B;G.globalAlpha=C;G.drawImage(t,0,0);G.globalAlpha=1})}},_getMatrix:function(l){const p=this.ra,A=p.length-6;for(let t=0;6>t;++t)l[t]=p[A+t]},_drawImageMesh:function(l,
382
+ p,A,t,G,B,C,y,F,H,O,Q,S){let Aa,ob,pb;try{Aa=h.HEAPF32.slice(t>>2,(t>>2)+G),ob=h.HEAPF32.slice(B>>2,(B>>2)+C),pb=h.HEAPU16.slice(y>>1,(y>>1)+F)}catch(Ra){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}t=this.ha.canvas.width;B=this.ha.canvas.height;C=Q-H;y=S-O;H=Math.max(H,0);O=Math.max(O,0);Q=Math.min(Q,t);S=Math.min(S,B);const pa=Q-H,qa=S-O;console.assert(pa<=Math.min(C,t));console.assert(qa<=Math.min(y,B));if(!(0>=pa||0>=qa)){Q=
383
+ pa<C||qa<y;t=S=1;var da=Math.ceil(pa*S),ea=Math.ceil(qa*t);B=la.Zb();da>B&&(S*=B/da,da=B);ea>B&&(t*=B/ea,ea=B);K||(K=new h.DynamicRectanizer(B),K.reset(512,512));B=K.addRect(da,ea);0>B&&(c(),u.add(this),B=K.addRect(da,ea),console.assert(0<=B));var qb=B&65535,rb=B>>16;R.push({wa:this.ra.slice(this.ra.length-6),image:l,ib:qb,jb:rb,$b:H,ac:O,jc:da,pb:ea,La:S,Ma:t,ab:Aa,yb:ob,indices:pb,bc:Q,vb:l.Va<<1|(Q?1:0)});X+=G;E+=F;var ha=this.ha,cc=b(p),dc=Math.max(0,A*this.ja[this.ja.length-1]);this.na.push(function(){ha.save();
384
+ ha.resetTransform();ha.globalCompositeOperation=cc;ha.globalAlpha=dc;const Ra=la.canvas();Ra&&ha.drawImage(Ra,qb,rb,da,ea,H,O,pa,qa);ha.restore()})}},_clipPath:function(l){const p=l.fb===z?"evenodd":"nonzero",A=l.Na();this.na.push(()=>{this.ha.clip(A,p);l.hb(A)})},beginFrame:function(l=!0){u.add(this);l&&this.na.push(this.ha.clearRect.bind(this.ha,0,0,this.cb.width,this.cb.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(l,p){this.transform(1,0,0,1,l,p)}});h.makeRenderer=
385
+ function(l){const p=new aa(l),A=p.ha;let t=null,G=null;const B={attachSession:function(y){if(y&&t===y)return!0;if(!y||t||"function"!==typeof h.c2dDeferredClaim||"function"!==typeof h.c2dDeferredRenderer||!h.c2dDeferredClaim(y))return!1;const F=h.c2dDeferredRenderer(y);if(!F)return!1;t=y;G=F;return!0},detachSession:function(){t&&h.c2dDeferredDetach(t);G=t=null},deferredActive:function(){return null!==G}},C={save:function(){h.c2dDeferredSave(t)},restore:function(){h.c2dDeferredRestore(t)},transform:function(y,
386
+ F,H,O,Q,S){h.c2dDeferredTransform(t,y,F,H,O,Q,S)},translate:function(y,F){h.c2dDeferredTransform(t,1,0,0,1,y,F)},rotate:function(y){const F=Math.sin(y);y=Math.cos(y);h.c2dDeferredTransform(t,y,F,-F,y,0,0)},align:function(y,F,H,O,Q){h.c2dDeferredAlign(t,y,F,H.minX,H.minY,H.maxX,H.maxY,O.minX,O.minY,O.maxX,O.maxY,void 0===Q?1:Q)},beginFrame:function(y=!0){p.beginFrame(y);h.c2dDeferredBeginFrame(t)},clear:function(){p.beginFrame(!0);h.c2dDeferredBeginFrame(t)},flush:function(){h.c2dDeferredReplay(t,
387
+ p)}};return new Proxy(p,{get(y,F){if(J.call(B,F))return B[F];if("_deferredRecorder"===F)return G;if(null!==G&&J.call(C,F))return C[F];if("function"===typeof y[F])return function(...H){return y[F].apply(y,H)};if("function"===typeof A[F]){if(-1<ka.indexOf(F))throw Error("RiveException: Method call to '"+F+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...H){p.na.push(A[F].bind(A,...H))}}return y[F]},
388
+ set(y,F,H){if(F in A)return p.na.push(()=>{A[F]=H}),!0}})};h.decodeImage=function(l,p){(new x({Ba:p})).decode(l)};h.renderFactory={makeRenderPaint:function(){return new I},makeRenderPath:function(){return new L},makeRenderImage:function(){let l=Sa;return new x({Ka:()=>{l.total++},Ba:()=>{l.loaded++;if(l.loaded===l.total){const p=l.ready;p&&(p(),l.ready=null)}}})}};let ec=h.load,Sa=null;h.load=function(l,p,A=!0,t=null){const G=new h.FallbackFileAssetLoader;void 0!==p&&G.addLoader(p);A&&(p=new h.CDNFileAssetLoader(t),
389
+ G.addLoader(p));return new Promise(function(B){let C=null;Sa={total:0,loaded:0,ready:function(){B(C)}};C=ec(l,G,t??null);0==Sa.total&&B(C)})};const fc=h.Artboard.prototype.draw;h.Artboard.prototype.draw=function(l){fc.call(this,l._deferredRecorder||l)};let gc=h.RendererWrapper.prototype.align;h.RendererWrapper.prototype.align=function(l,p,A,t,G=1){gc.call(this,l,p,A,t,G)};d=new fa;h.requestAnimationFrame=d.requestAnimationFrame.bind(d);h.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);h.enableFPSCounter=
390
+ d.Ob.bind(d);h.disableFPSCounter=d.Lb;d.rb=c;h.resolveAnimationFrame=c;h.cleanup=function(){K&&K.delete()}};var na="./this.program";ca&&(_scriptName=self.location.href);var oa="",ra,sa;
391
+ if(ba||ca){try{oa=(new URL(".",_scriptName)).href}catch{}ca&&(sa=b=>{var a=new XMLHttpRequest;a.open("GET",b,!1);a.responseType="arraybuffer";a.send(null);return new Uint8Array(a.response)});ra=async b=>{if(ta(b))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",b,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var a=await fetch(b,{credentials:"same-origin"});if(a.ok)return a.arrayBuffer();throw Error(a.status+
392
+ " : "+a.url);}}var ua=console.log.bind(console),va=console.error.bind(console),wa,xa=!1,ya,ta=b=>b.startsWith("file://"),za,Ba,Ca,D,Da,Ea,Fa,M,Ga,Ha,Ia,Ja,Ka=!1;function La(){var b=Ma.buffer;h.HEAP8=Ca=new Int8Array(b);Da=new Int16Array(b);h.HEAPU8=D=new Uint8Array(b);h.HEAPU16=Ea=new Uint16Array(b);h.HEAP32=Fa=new Int32Array(b);h.HEAPU32=M=new Uint32Array(b);h.HEAPF32=Ga=new Float32Array(b);Ha=new Float64Array(b);Ia=new BigInt64Array(b);Ja=new BigUint64Array(b)}
393
+ function Na(b){h.onAbort?.(b);b="Aborted("+b+")";va(b);xa=!0;b=new WebAssembly.RuntimeError(b+". Build with -sASSERTIONS for more info.");Ba?.(b);throw b;}var Oa;async function Pa(b){if(!wa)try{var a=await ra(b);return new Uint8Array(a)}catch{}if(b==Oa&&wa)b=new Uint8Array(wa);else if(sa)b=sa(b);else throw"both async and sync fetching of the wasm failed";return b}
391
394
  async function Qa(b,a){try{var c=await Pa(b);return await WebAssembly.instantiate(c,a)}catch(d){va(`failed to asynchronously prepare wasm: ${d}`),Na(d)}}async function Ta(b){var a=Oa;if(!wa&&!ta(a))try{var c=fetch(a,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,b)}catch(d){va(`wasm streaming compile failed: ${d}`),va("falling back to ArrayBuffer instantiation")}return Qa(a,b)}
392
395
  class Ua{name="ExitStatus";constructor(b){this.message=`Program terminated with exit(${b})`;this.status=b}}
393
- var Va=b=>{for(;0<b.length;)b.shift()(l)},Wa=[],Xa=[],Ya=()=>{var b=l.preRun.shift();Xa.push(b)},Za=!0,$a=(b,a)=>Object.defineProperty(a,"name",{value:b}),ab=[],bb=[0,1,,1,null,1,!0,1,!1,1],K=class extends Error{constructor(b){super(b);this.name="BindingError"}},N=b=>{if(!b)throw new K(`Cannot use deleted val. handle = ${b}`);return bb[b]},P=b=>{switch(b){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const a=ab.pop()||bb.length;bb[a]=b;bb[a+1]=1;return a}};
396
+ var Va=b=>{for(;0<b.length;)b.shift()(h)},Wa=[],Xa=[],Ya=()=>{var b=h.preRun.shift();Xa.push(b)},Za=!0,$a=(b,a)=>Object.defineProperty(a,"name",{value:b}),ab=[],bb=[0,1,,1,null,1,!0,1,!1,1],N=class extends Error{constructor(b){super(b);this.name="BindingError"}},P=b=>{if(!b)throw new N(`Cannot use deleted val. handle = ${b}`);return bb[b]},T=b=>{switch(b){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const a=ab.pop()||bb.length;bb[a]=b;bb[a+1]=1;return a}};
394
397
  class cb extends Error{}
395
- var Q=b=>{for(var a="";;){var c=B[b++];if(!c)return a;a+=String.fromCharCode(c)}},db={},eb=(b,a)=>{if(void 0===a)throw new K("ptr should not be undefined");for(;b.ga;)a=b.Ca(a),b=b.ga;return a},fb={},ib=b=>{b=gb(b);var a=Q(b);hb(b);return a},jb=(b,a)=>{var c=fb[b];if(void 0===c)throw b=`${a} has unknown type ${ib(b)}`,new K(b);return c},kb=()=>{},lb=!1,mb=b=>{if(!globalThis.FinalizationRegistry)return mb=a=>a,b;lb=new FinalizationRegistry(a=>{a=a.$;--a.count.value;0===a.count.value&&(a.ia?a.oa.qa(a.ia):
396
- a.da.aa.qa(a.ca))});mb=a=>{var c=a.$;c.ia&&lb.register(a,{$:c},a);return a};kb=a=>{lb.unregister(a)};return mb(b)},nb={},sb=b=>{for(;b.length;){var a=b.pop();b.pop()(a)}};function tb(b){return this.ba(J[b>>2])}
397
- var ub={},vb={},wb=class extends Error{constructor(b){super(b);this.name="InternalError"}},V=(b,a,c)=>{function d(g){g=c(g);if(g.length!==b.length)throw new wb("Mismatched type converter count");for(var m=0;m<b.length;++m)T(b[m],g[m])}b.forEach(g=>vb[g]=a);var e=Array(a.length),f=[],h=0;for(let [g,m]of a.entries())fb.hasOwnProperty(m)?e[g]=fb[m]:(f.push(m),ub.hasOwnProperty(m)||(ub[m]=[]),ub[m].push(()=>{e[g]=fb[m];++h;h===f.length&&d(e)}));0===f.length&&d(e)};
398
- function xb(b,a,c={}){var d=a.name;if(!b)throw new K(`type "${d}" must have a positive integer typeid pointer`);if(fb.hasOwnProperty(b)){if(c.Vb)return;throw new K(`Cannot register type '${d}' twice`);}fb[b]=a;delete vb[b];ub.hasOwnProperty(b)&&(a=ub[b],delete ub[b],a.forEach(e=>e()))}function T(b,a,c={}){return xb(b,a,c)}
399
- var yb=(b,a,c)=>{switch(a){case 1:return c?d=>Ca[d]:d=>B[d];case 2:return c?d=>Da[d>>1]:d=>Ea[d>>1];case 4:return c?d=>Fa[d>>2]:d=>J[d>>2];case 8:return c?d=>Ia[d>>3]:d=>Ja[d>>3];default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},zb=b=>{throw new K(b.$.da.aa.name+" instance already deleted");},Ab=[];function Bb(){}
400
- var Cb={},Db=(b,a,c)=>{if(void 0===b[a].fa){var d=b[a];b[a]=function(...e){if(!b[a].fa.hasOwnProperty(e.length))throw new K(`Function '${c}' called with an invalid number of arguments (${e.length}) - expects one of (${b[a].fa})!`);return b[a].fa[e.length].apply(this,e)};b[a].fa=[];b[a].fa[d.ta]=d}},Eb=(b,a,c)=>{if(l.hasOwnProperty(b)){if(void 0===c||void 0!==l[b].fa&&void 0!==l[b].fa[c])throw new K(`Cannot register public name '${b}' twice`);Db(l,b,b);if(l[b].fa.hasOwnProperty(c))throw new K(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
401
- l[b].fa[c]=a}else l[b]=a,l[b].ta=c},Fb=b=>{b=b.replace(/[^a-zA-Z0-9_]/g,"$");var a=b.charCodeAt(0);return 48<=a&&57>=a?`_${b}`:b};function Gb(b,a,c,d,e,f,h,g){this.name=b;this.constructor=a;this.pa=c;this.qa=d;this.ga=e;this.Qb=f;this.Ca=h;this.Lb=g;this.sb=[]}
402
- var Hb=(b,a,c)=>{for(;a!==c;){if(!a.Ca)throw new K(`Expected null or instance of ${c.name}, got an instance of ${a.name}`);b=a.Ca(b);a=a.ga}return b},Ib=b=>{if(null===b)return"null";var a=typeof b;return"object"===a||"array"===a||"function"===a?b.toString():""+b};
403
- function Jb(b,a){if(null===a){if(this.Xa)throw new K(`null is not a valid ${this.name}`);return 0}if(!a.$)throw new K(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new K(`Cannot pass deleted object as a pointer of type ${this.name}`);return Hb(a.$.ca,a.$.da.aa,this.aa)}
404
- function Kb(b,a){if(null===a){if(this.Xa)throw new K(`null is not a valid ${this.name}`);if(this.Ja){var c=this.Za();null!==b&&b.push(this.qa,c);return c}return 0}if(!a||!a.$)throw new K(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new K(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Ia&&a.$.da.Ia)throw new K(`Cannot convert argument of type ${a.$.oa?a.$.oa.name:a.$.da.name} to parameter type ${this.name}`);c=Hb(a.$.ca,a.$.da.aa,this.aa);if(this.Ja){if(void 0===
405
- a.$.ia)throw new K("Passing raw pointer to smart pointer is illegal");switch(this.hc){case 0:if(a.$.oa===this)c=a.$.ia;else throw new K(`Cannot convert argument of type ${a.$.oa?a.$.oa.name:a.$.da.name} to parameter type ${this.name}`);break;case 1:c=a.$.ia;break;case 2:if(a.$.oa===this)c=a.$.ia;else{var d=a.clone();c=this.cc(c,P(()=>d["delete"]()));null!==b&&b.push(this.qa,c)}break;default:throw new K("Unsupported sharing policy");}}return c}
406
- function Lb(b,a){if(null===a){if(this.Xa)throw new K(`null is not a valid ${this.name}`);return 0}if(!a.$)throw new K(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new K(`Cannot pass deleted object as a pointer of type ${this.name}`);if(a.$.da.Ia)throw new K(`Cannot convert argument of type ${a.$.da.name} to parameter type ${this.name}`);return Hb(a.$.ca,a.$.da.aa,this.aa)}
407
- var Mb=(b,a,c)=>{if(a===c)return b;if(void 0===c.ga)return null;b=Mb(b,a,c.ga);return null===b?null:c.Lb(b)},Nb=(b,a)=>{a=eb(b,a);return db[a]},Ob=(b,a)=>{if(!a.da||!a.ca)throw new wb("makeClassHandle requires ptr and ptrType");if(!!a.oa!==!!a.ia)throw new wb("Both smartPtrType and smartPtr must be specified");a.count={value:1};return mb(Object.create(b,{$:{value:a,writable:!0}}))};
408
- function Pb(b,a,c,d,e,f,h,g,m,n,u){this.name=b;this.aa=a;this.Xa=c;this.Ia=d;this.Ja=e;this.bc=f;this.hc=h;this.tb=g;this.Za=m;this.cc=n;this.qa=u;e||void 0!==a.ga?this.ea=Kb:(this.ea=d?Jb:Lb,this.ka=null)}var Qb=(b,a,c)=>{if(!l.hasOwnProperty(b))throw new wb("Replacing nonexistent public symbol");void 0!==l[b].fa&&void 0!==c?l[b].fa[c]=a:(l[b]=a,l[b].ta=c)},X=(b,a)=>{b=Q(b);var c=Rb.get(a);if("function"!=typeof c)throw new K(`unknown function pointer with signature ${b}: ${a}`);return c};
409
- class Sb extends Error{}var Y=(b,a)=>{function c(f){e[f]||fb[f]||(vb[f]?vb[f].forEach(c):(d.push(f),e[f]=!0))}var d=[],e={};a.forEach(c);throw new Sb(`${b}: `+d.map(ib).join([", "]));};function Tb(b){for(var a=1;a<b.length;++a)if(null!==b[a]&&void 0===b[a].ka)return!0;return!1}
410
- function Ub(b,a,c,d,e){var f=a.length;if(2>f)throw new K("argTypes array size mismatch! Must at least get return value and 'this' types!");var h=null!==a[1]&&null!==c,g=Tb(a),m=!a[0].Xb,n=f-2,u=Array(n),A=[],x=[];return $a(b,function(...t){x.length=0;A.length=h?2:1;A[0]=e;if(h){var v=a[1].ea(x,this);A[1]=v}for(var p=0;p<n;++p)u[p]=a[p+2].ea(x,t[p]),A.push(u[p]);t=d(...A);if(g)sb(x);else for(p=h?1:2;p<a.length;p++){var I=1===p?v:u[p-2];null!==a[p].ka&&a[p].ka(I)}v=m?a[0].ba(t):void 0;return v})}
411
- var Vb=(b,a)=>{for(var c=[],d=0;d<b;d++)c.push(J[a+4*d>>2]);return c},Wb=b=>{b=b.trim();const a=b.indexOf("(");return-1===a?b:b.slice(0,a)},Xb=(b,a,c)=>{if(!(b instanceof Object))throw new K(`${c} with invalid "this": ${b}`);if(!(b instanceof a.aa.constructor))throw new K(`${c} incompatible with "this" of type ${b.constructor.name}`);if(!b.$.ca)throw new K(`cannot call emscripten binding method ${c} on deleted object`);return Hb(b.$.ca,b.$.da.aa,a.aa)},Yb=b=>{9<b&&0===--bb[b+1]&&(bb[b]=void 0,ab.push(b))},
412
- Zb={name:"emscripten::val",ba:b=>{var a=N(b);Yb(b);return a},ea:(b,a)=>P(a),ma:tb,ka:null},$b=(b,a,c)=>{switch(a){case 1:return c?function(d){return this.ba(Ca[d])}:function(d){return this.ba(B[d])};case 2:return c?function(d){return this.ba(Da[d>>1])}:function(d){return this.ba(Ea[d>>1])};case 4:return c?function(d){return this.ba(Fa[d>>2])}:function(d){return this.ba(J[d>>2])};default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},ac=(b,a)=>{switch(a){case 4:return function(c){return this.ba(Ga[c>>
413
- 2])};case 8:return function(c){return this.ba(Ha[c>>3])};default:throw new TypeError(`invalid float width (${a}): ${b}`);}},bc=(b,a,c)=>{var d=B;if(!(0<c))return 0;var e=a;c=a+c-1;for(var f=0;f<b.length;++f){var h=b.codePointAt(f);if(127>=h){if(a>=c)break;d[a++]=h}else if(2047>=h){if(a+1>=c)break;d[a++]=192|h>>6;d[a++]=128|h&63}else if(65535>=h){if(a+2>=c)break;d[a++]=224|h>>12;d[a++]=128|h>>6&63;d[a++]=128|h&63}else{if(a+3>=c)break;d[a++]=240|h>>18;d[a++]=128|h>>12&63;d[a++]=128|h>>6&63;d[a++]=128|
414
- h&63;f++}}d[a]=0;return a-e},fc=b=>{for(var a=0,c=0;c<b.length;++c){var d=b.charCodeAt(c);127>=d?a++:2047>=d?a+=2:55296<=d&&57343>=d?(a+=4,++c):a+=3}return a},gc=globalThis.TextDecoder&&new TextDecoder,hc=(b,a,c,d)=>{c=a+c;if(d)return c;for(;b[a]&&!(a>=c);)++a;return a},ic=(b,a=0,c,d)=>{c=hc(b,a,c,d);if(16<c-a&&b.buffer&&gc)return gc.decode(b.subarray(a,c));for(d="";a<c;){var e=b[a++];if(e&128){var f=b[a++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var h=b[a++]&63;e=224==(e&240)?
415
- (e&15)<<12|f<<6|h:(e&7)<<18|f<<12|h<<6|b[a++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},jc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,kc=(b,a,c)=>{b>>=1;a=hc(Ea,b,a/2,c);if(16<a-b&&jc)return jc.decode(Ea.subarray(b,a));for(c="";b<a;++b)c+=String.fromCharCode(Ea[b]);return c},lc=(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 e=0;e<c;++e)Da[a>>1]=
416
- b.charCodeAt(e),a+=2;Da[a>>1]=0;return a-d},mc=b=>2*b.length,nc=(b,a,c)=>{var d="";b>>=2;for(var e=0;!(e>=a/4);e++){var f=J[b+e];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},oc=(b,a,c)=>{c??=2147483647;if(4>c)return 0;var d=a;c=d+c-4;for(var e=0;e<b.length;++e){var f=b.codePointAt(e);65535<f&&e++;Fa[a>>2]=f;a+=4;if(a+4>c)break}Fa[a>>2]=0;return a-d},pc=b=>{for(var a=0,c=0;c<b.length;++c)65535<b.codePointAt(c)&&c++,a+=4;return a},qc=0,rc=[],sc=b=>{var a=rc.length;rc.push(b);return a},tc=(b,
417
- a)=>{for(var c=Array(b),d=0;d<b;++d)c[d]=jb(J[a+4*d>>2],`parameter ${d}`);return c},uc={},vc=b=>{var a=uc[b];return void 0===a?Q(b):a},wc={},xc=b=>{if(!(b instanceof Ua||"unwind"==b))throw b;},yc=b=>{ya=b;Za||0<qc||(l.onExit?.(b),xa=!0);throw new Ua(b);},zc=b=>{if(!xa)try{if(b(),!(Za||0<qc))try{ya=b=ya,yc(b)}catch(a){xc(a)}}catch(a){xc(a)}},Ac={},Cc=()=>{if(!Bc){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-",
418
- "_")+".UTF-8",_:na||"./this.program"},a;for(a in Ac)void 0===Ac[a]?delete b[a]:b[a]=Ac[a];var c=[];for(a in b)c.push(`${a}=${b[a]}`);Bc=c}return Bc},Bc,Dc=[null,[],[]];
419
- (()=>{let b=Bb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Bb&&c instanceof Bb))return!1;var d=this.$.da.aa,e=this.$.ca;c.$=c.$;var f=c.$.da.aa;for(c=c.$.ca;d.ga;)e=d.Ca(e),d=d.ga;for(;f.ga;)c=f.Ca(c),f=f.ga;return d===f&&e===c},clone:function(){this.$.ca||zb(this);if(this.$.xa)return this.$.count.value+=1,this;var c=mb,d=Object,e=d.create,f=Object.getPrototypeOf(this),h=this.$;c=c(e.call(d,f,{$:{value:{count:h.count,Aa:h.Aa,xa:h.xa,ca:h.ca,da:h.da,ia:h.ia,oa:h.oa}}}));c.$.count.value+=
420
- 1;c.$.Aa=!1;return c},["delete"](){this.$.ca||zb(this);if(this.$.Aa&&!this.$.xa)throw new K("Object already scheduled for deletion");kb(this);var c=this.$;--c.count.value;0===c.count.value&&(c.ia?c.oa.qa(c.ia):c.da.aa.qa(c.ca));this.$.xa||(this.$.ia=void 0,this.$.ca=void 0)},isDeleted:function(){return!this.$.ca},deleteLater:function(){this.$.ca||zb(this);if(this.$.Aa&&!this.$.xa)throw new K("Object already scheduled for deletion");Ab.push(this);this.$.Aa=!0;return this}});const a=Symbol.dispose;
398
+ var U=b=>{for(var a="";;){var c=D[b++];if(!c)return a;a+=String.fromCharCode(c)}},db={},eb=(b,a)=>{if(void 0===a)throw new N("ptr should not be undefined");for(;b.ga;)a=b.Ca(a),b=b.ga;return a},fb={},ib=b=>{b=gb(b);var a=U(b);hb(b);return a},jb=(b,a)=>{var c=fb[b];if(void 0===c)throw b=`${a} has unknown type ${ib(b)}`,new N(b);return c},kb=()=>{},lb=!1,mb=b=>{if(!globalThis.FinalizationRegistry)return mb=a=>a,b;lb=new FinalizationRegistry(a=>{a=a.$;--a.count.value;0===a.count.value&&(a.ia?a.oa.qa(a.ia):
399
+ a.da.aa.qa(a.ca))});mb=a=>{var c=a.$;c.ia&&lb.register(a,{$:c},a);return a};kb=a=>{lb.unregister(a)};return mb(b)},nb={},sb=b=>{for(;b.length;){var a=b.pop();b.pop()(a)}};function tb(b){return this.ba(M[b>>2])}
400
+ var ub={},vb={},wb=class extends Error{constructor(b){super(b);this.name="InternalError"}},W=(b,a,c)=>{function d(f){f=c(f);if(f.length!==b.length)throw new wb("Mismatched type converter count");for(var m=0;m<b.length;++m)V(b[m],f[m])}b.forEach(f=>vb[f]=a);var e=Array(a.length),k=[],g=0;for(let [f,m]of a.entries())fb.hasOwnProperty(m)?e[f]=fb[m]:(k.push(m),ub.hasOwnProperty(m)||(ub[m]=[]),ub[m].push(()=>{e[f]=fb[m];++g;g===k.length&&d(e)}));0===k.length&&d(e)};
401
+ function xb(b,a,c={}){var d=a.name;if(!b)throw new N(`type "${d}" must have a positive integer typeid pointer`);if(fb.hasOwnProperty(b)){if(c.Wb)return;throw new N(`Cannot register type '${d}' twice`);}fb[b]=a;delete vb[b];ub.hasOwnProperty(b)&&(a=ub[b],delete ub[b],a.forEach(e=>e()))}function V(b,a,c={}){return xb(b,a,c)}
402
+ var yb=(b,a,c)=>{switch(a){case 1:return c?d=>Ca[d]:d=>D[d];case 2:return c?d=>Da[d>>1]:d=>Ea[d>>1];case 4:return c?d=>Fa[d>>2]:d=>M[d>>2];case 8:return c?d=>Ia[d>>3]:d=>Ja[d>>3];default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},zb=b=>{throw new N(b.$.da.aa.name+" instance already deleted");},Ab=[];function Bb(){}
403
+ var Cb={},Db=(b,a,c)=>{if(void 0===b[a].fa){var d=b[a];b[a]=function(...e){if(!b[a].fa.hasOwnProperty(e.length))throw new N(`Function '${c}' called with an invalid number of arguments (${e.length}) - expects one of (${b[a].fa})!`);return b[a].fa[e.length].apply(this,e)};b[a].fa=[];b[a].fa[d.ta]=d}},Eb=(b,a,c)=>{if(h.hasOwnProperty(b)){if(void 0===c||void 0!==h[b].fa&&void 0!==h[b].fa[c])throw new N(`Cannot register public name '${b}' twice`);Db(h,b,b);if(h[b].fa.hasOwnProperty(c))throw new N(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
404
+ h[b].fa[c]=a}else h[b]=a,h[b].ta=c},Fb=b=>{b=b.replace(/[^a-zA-Z0-9_]/g,"$");var a=b.charCodeAt(0);return 48<=a&&57>=a?`_${b}`:b};function Gb(b,a,c,d,e,k,g,f){this.name=b;this.constructor=a;this.pa=c;this.qa=d;this.ga=e;this.Rb=k;this.Ca=g;this.Mb=f;this.sb=[]}
405
+ var Hb=(b,a,c)=>{for(;a!==c;){if(!a.Ca)throw new N(`Expected null or instance of ${c.name}, got an instance of ${a.name}`);b=a.Ca(b);a=a.ga}return b},Ib=b=>{if(null===b)return"null";var a=typeof b;return"object"===a||"array"===a||"function"===a?b.toString():""+b};
406
+ function Jb(b,a){if(null===a){if(this.Xa)throw new N(`null is not a valid ${this.name}`);return 0}if(!a.$)throw new N(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);return Hb(a.$.ca,a.$.da.aa,this.aa)}
407
+ function Kb(b,a){if(null===a){if(this.Xa)throw new N(`null is not a valid ${this.name}`);if(this.Ja){var c=this.Za();null!==b&&b.push(this.qa,c);return c}return 0}if(!a||!a.$)throw new N(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Ia&&a.$.da.Ia)throw new N(`Cannot convert argument of type ${a.$.oa?a.$.oa.name:a.$.da.name} to parameter type ${this.name}`);c=Hb(a.$.ca,a.$.da.aa,this.aa);if(this.Ja){if(void 0===
408
+ a.$.ia)throw new N("Passing raw pointer to smart pointer is illegal");switch(this.ic){case 0:if(a.$.oa===this)c=a.$.ia;else throw new N(`Cannot convert argument of type ${a.$.oa?a.$.oa.name:a.$.da.name} to parameter type ${this.name}`);break;case 1:c=a.$.ia;break;case 2:if(a.$.oa===this)c=a.$.ia;else{var d=a.clone();c=this.dc(c,T(()=>d["delete"]()));null!==b&&b.push(this.qa,c)}break;default:throw new N("Unsupported sharing policy");}}return c}
409
+ function Lb(b,a){if(null===a){if(this.Xa)throw new N(`null is not a valid ${this.name}`);return 0}if(!a.$)throw new N(`Cannot pass "${Ib(a)}" as a ${this.name}`);if(!a.$.ca)throw new N(`Cannot pass deleted object as a pointer of type ${this.name}`);if(a.$.da.Ia)throw new N(`Cannot convert argument of type ${a.$.da.name} to parameter type ${this.name}`);return Hb(a.$.ca,a.$.da.aa,this.aa)}
410
+ var Mb=(b,a,c)=>{if(a===c)return b;if(void 0===c.ga)return null;b=Mb(b,a,c.ga);return null===b?null:c.Mb(b)},Nb=(b,a)=>{a=eb(b,a);return db[a]},Ob=(b,a)=>{if(!a.da||!a.ca)throw new wb("makeClassHandle requires ptr and ptrType");if(!!a.oa!==!!a.ia)throw new wb("Both smartPtrType and smartPtr must be specified");a.count={value:1};return mb(Object.create(b,{$:{value:a,writable:!0}}))};
411
+ function Pb(b,a,c,d,e,k,g,f,m,n,r){this.name=b;this.aa=a;this.Xa=c;this.Ia=d;this.Ja=e;this.cc=k;this.ic=g;this.tb=f;this.Za=m;this.dc=n;this.qa=r;e||void 0!==a.ga?this.ea=Kb:(this.ea=d?Jb:Lb,this.ka=null)}var Qb=(b,a,c)=>{if(!h.hasOwnProperty(b))throw new wb("Replacing nonexistent public symbol");void 0!==h[b].fa&&void 0!==c?h[b].fa[c]=a:(h[b]=a,h[b].ta=c)},Y=(b,a)=>{b=U(b);var c=Rb.get(a);if("function"!=typeof c)throw new N(`unknown function pointer with signature ${b}: ${a}`);return c};
412
+ class Sb extends Error{}var Z=(b,a)=>{function c(k){e[k]||fb[k]||(vb[k]?vb[k].forEach(c):(d.push(k),e[k]=!0))}var d=[],e={};a.forEach(c);throw new Sb(`${b}: `+d.map(ib).join([", "]));};function Tb(b){for(var a=1;a<b.length;++a)if(null!==b[a]&&void 0===b[a].ka)return!0;return!1}
413
+ function Ub(b,a,c,d,e){var k=a.length;if(2>k)throw new N("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==a[1]&&null!==c,f=Tb(a),m=!a[0].Yb,n=k-2,r=Array(n),w=[],z=[];return $a(b,function(...v){z.length=0;w.length=g?2:1;w[0]=e;if(g){var x=a[1].ea(z,this);w[1]=x}for(var q=0;q<n;++q)r[q]=a[q+2].ea(z,v[q]),w.push(r[q]);v=d(...w);if(f)sb(z);else for(q=g?1:2;q<a.length;q++){var L=1===q?x:r[q-2];null!==a[q].ka&&a[q].ka(L)}x=m?a[0].ba(v):void 0;return x})}
414
+ var Vb=(b,a)=>{for(var c=[],d=0;d<b;d++)c.push(M[a+4*d>>2]);return c},Wb=b=>{b=b.trim();const a=b.indexOf("(");return-1===a?b:b.slice(0,a)},Xb=(b,a,c)=>{if(!(b instanceof Object))throw new N(`${c} with invalid "this": ${b}`);if(!(b instanceof a.aa.constructor))throw new N(`${c} incompatible with "this" of type ${b.constructor.name}`);if(!b.$.ca)throw new N(`cannot call emscripten binding method ${c} on deleted object`);return Hb(b.$.ca,b.$.da.aa,a.aa)},Yb=b=>{9<b&&0===--bb[b+1]&&(bb[b]=void 0,ab.push(b))},
415
+ Zb={name:"emscripten::val",ba:b=>{var a=P(b);Yb(b);return a},ea:(b,a)=>T(a),ma:tb,ka:null},$b=(b,a,c)=>{switch(a){case 1:return c?function(d){return this.ba(Ca[d])}:function(d){return this.ba(D[d])};case 2:return c?function(d){return this.ba(Da[d>>1])}:function(d){return this.ba(Ea[d>>1])};case 4:return c?function(d){return this.ba(Fa[d>>2])}:function(d){return this.ba(M[d>>2])};default:throw new TypeError(`invalid integer width (${a}): ${b}`);}},ac=(b,a)=>{switch(a){case 4:return function(c){return this.ba(Ga[c>>
416
+ 2])};case 8:return function(c){return this.ba(Ha[c>>3])};default:throw new TypeError(`invalid float width (${a}): ${b}`);}},bc=(b,a,c)=>{var d=D;if(!(0<c))return 0;var e=a;c=a+c-1;for(var k=0;k<b.length;++k){var g=b.codePointAt(k);if(127>=g){if(a>=c)break;d[a++]=g}else if(2047>=g){if(a+1>=c)break;d[a++]=192|g>>6;d[a++]=128|g&63}else if(65535>=g){if(a+2>=c)break;d[a++]=224|g>>12;d[a++]=128|g>>6&63;d[a++]=128|g&63}else{if(a+3>=c)break;d[a++]=240|g>>18;d[a++]=128|g>>12&63;d[a++]=128|g>>6&63;d[a++]=128|
417
+ g&63;k++}}d[a]=0;return a-e},hc=b=>{for(var a=0,c=0;c<b.length;++c){var d=b.charCodeAt(c);127>=d?a++:2047>=d?a+=2:55296<=d&&57343>=d?(a+=4,++c):a+=3}return a},ic=globalThis.TextDecoder&&new TextDecoder,jc=(b,a,c,d)=>{c=a+c;if(d)return c;for(;b[a]&&!(a>=c);)++a;return a},kc=(b,a=0,c,d)=>{c=jc(b,a,c,d);if(16<c-a&&b.buffer&&ic)return ic.decode(b.subarray(a,c));for(d="";a<c;){var e=b[a++];if(e&128){var k=b[a++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|k);else{var g=b[a++]&63;e=224==(e&240)?
418
+ (e&15)<<12|k<<6|g:(e&7)<<18|k<<12|g<<6|b[a++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},lc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,mc=(b,a,c)=>{b>>=1;a=jc(Ea,b,a/2,c);if(16<a-b&&lc)return lc.decode(Ea.subarray(b,a));for(c="";b<a;++b)c+=String.fromCharCode(Ea[b]);return c},nc=(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 e=0;e<c;++e)Da[a>>1]=
419
+ b.charCodeAt(e),a+=2;Da[a>>1]=0;return a-d},oc=b=>2*b.length,pc=(b,a,c)=>{var d="";b>>=2;for(var e=0;!(e>=a/4);e++){var k=M[b+e];if(!k&&!c)break;d+=String.fromCodePoint(k)}return d},qc=(b,a,c)=>{c??=2147483647;if(4>c)return 0;var d=a;c=d+c-4;for(var e=0;e<b.length;++e){var k=b.codePointAt(e);65535<k&&e++;Fa[a>>2]=k;a+=4;if(a+4>c)break}Fa[a>>2]=0;return a-d},rc=b=>{for(var a=0,c=0;c<b.length;++c)65535<b.codePointAt(c)&&c++,a+=4;return a},sc=0,tc=[],uc=b=>{var a=tc.length;tc.push(b);return a},vc=(b,
420
+ a)=>{for(var c=Array(b),d=0;d<b;++d)c[d]=jb(M[a+4*d>>2],`parameter ${d}`);return c},wc={},xc=b=>{var a=wc[b];return void 0===a?U(b):a},yc={},zc=b=>{if(!(b instanceof Ua||"unwind"==b))throw b;},Ac=b=>{ya=b;Za||0<sc||(h.onExit?.(b),xa=!0);throw new Ua(b);},Bc=b=>{if(!xa)try{if(b(),!(Za||0<sc))try{ya=b=ya,Ac(b)}catch(a){zc(a)}}catch(a){zc(a)}},Cc={},Ec=()=>{if(!Dc){var b={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-",
421
+ "_")+".UTF-8",_:na||"./this.program"},a;for(a in Cc)void 0===Cc[a]?delete b[a]:b[a]=Cc[a];var c=[];for(a in b)c.push(`${a}=${b[a]}`);Dc=c}return Dc},Dc,Fc=[null,[],[]];
422
+ (()=>{let b=Bb.prototype;Object.assign(b,{isAliasOf:function(c){if(!(this instanceof Bb&&c instanceof Bb))return!1;var d=this.$.da.aa,e=this.$.ca;c.$=c.$;var k=c.$.da.aa;for(c=c.$.ca;d.ga;)e=d.Ca(e),d=d.ga;for(;k.ga;)c=k.Ca(c),k=k.ga;return d===k&&e===c},clone:function(){this.$.ca||zb(this);if(this.$.xa)return this.$.count.value+=1,this;var c=mb,d=Object,e=d.create,k=Object.getPrototypeOf(this),g=this.$;c=c(e.call(d,k,{$:{value:{count:g.count,Aa:g.Aa,xa:g.xa,ca:g.ca,da:g.da,ia:g.ia,oa:g.oa}}}));c.$.count.value+=
423
+ 1;c.$.Aa=!1;return c},["delete"](){this.$.ca||zb(this);if(this.$.Aa&&!this.$.xa)throw new N("Object already scheduled for deletion");kb(this);var c=this.$;--c.count.value;0===c.count.value&&(c.ia?c.oa.qa(c.ia):c.da.aa.qa(c.ca));this.$.xa||(this.$.ia=void 0,this.$.ca=void 0)},isDeleted:function(){return!this.$.ca},deleteLater:function(){this.$.ca||zb(this);if(this.$.Aa&&!this.$.xa)throw new N("Object already scheduled for deletion");Ab.push(this);this.$.Aa=!0;return this}});const a=Symbol.dispose;
421
424
  a&&(b[a]=b["delete"])})();
422
- Object.assign(Pb.prototype,{Rb(b){this.tb&&(b=this.tb(b));return b},lb(b){this.qa?.(b)},ma:tb,ba:function(b){function a(){return this.Ja?Ob(this.aa.pa,{da:this.bc,ca:c,oa:this,ia:b}):Ob(this.aa.pa,{da:this,ca:b})}var c=this.Rb(b);if(!c)return this.lb(b),null;var d=Nb(this.aa,c);if(void 0!==d){if(0===d.$.count.value)return d.$.ca=c,d.$.ia=b,d.clone();d=d.clone();this.lb(b);return d}d=this.aa.Qb(c);d=Cb[d];if(!d)return a.call(this);d=this.Ia?d.Hb:d.pointerType;var e=Mb(c,this.aa,d.aa);return null===
423
- e?a.call(this):this.Ja?Ob(d.aa.pa,{da:d,ca:e,oa:this,ia:b}):Ob(d.aa.pa,{da:d,ca:e})}});l.noExitRuntime&&(Za=l.noExitRuntime);l.print&&(ua=l.print);l.printErr&&(va=l.printErr);l.wasmBinary&&(wa=l.wasmBinary);l.thisProgram&&(na=l.thisProgram);if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.shift()();
424
- var hb,Ec,gb,Fc,Ma,Rb,Gc={E:()=>Na(""),n:(b,a,c)=>{b=Q(b);a=jb(a,"wrapper");c=N(c);var d=a.aa,e=d.pa,f=d.ga.pa,h=d.ga.constructor;b=$a(b,function(...g){for(var m of d.ga.sb)if(this[m]===f[m])throw new cb(`Pure virtual function ${m} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:e});this.__construct(...g)});e.__construct=function(...g){if(this===e)throw new K("Pass correct 'this' to __construct");g=h.implement(this,...g);kb(g);var m=g.$;g.notifyOnDestruction();m.xa=
425
- !0;Object.defineProperties(this,{$:{value:m}});mb(this);g=m.ca;g=eb(d,g);if(db.hasOwnProperty(g))throw new K(`Tried to register registered instance: ${g}`);db[g]=this};e.__destruct=function(){if(this===e)throw new K("Pass correct 'this' to __destruct");kb(this);var g=this.$.ca;g=eb(d,g);if(db.hasOwnProperty(g))delete db[g];else throw new K(`Tried to unregister unregistered instance: ${g}`);};b.prototype=Object.create(e);Object.assign(b.prototype,c);return P(b)},N:b=>{var a=nb[b];delete nb[b];var c=
426
- a.Za,d=a.qa,e=a.ob,f=e.map(h=>h.Ub).concat(e.map(h=>h.ec));V([b],f,h=>{var g={},m,n;for([m,n]of e.entries()){const u=h[m],A=n.Sb,x=n.Tb,t=h[m+e.length],v=n.dc,p=n.fc;g[n.Ob]={read:I=>u.ba(A(x,I)),write:(I,G)=>{var r=[];v(p,I,t.ea(r,G));sb(r)},optional:u.optional}}return[{name:a.name,ba:u=>{var A={},x;for(x in g)A[x]=g[x].read(u);d(u);return A},ea:(u,A)=>{for(var x in g)if(!(x in A||g[x].optional))throw new TypeError(`Missing field: "${x}"`);var t=c();for(x in g)g[x].write(t,A[x]);null!==u&&u.push(d,
427
- t);return t},ma:tb,ka:d}]})},r:(b,a,c,d,e)=>{a=Q(a);d=0n===d;let f=h=>h;if(d){const h=8*c;f=g=>BigInt.asUintN(h,g);e=f(e)}T(b,{name:a,ba:f,ea:(h,g)=>{"number"==typeof g&&(g=BigInt(g));return g},ma:yb(a,c,!d),ka:null})},H:(b,a,c,d)=>{a=Q(a);T(b,{name:a,ba:function(e){return!!e},ea:function(e,f){return f?c:d},ma:function(e){return this.ba(B[e])},ka:null})},c:(b,a,c,d,e,f,h,g,m,n,u,A,x)=>{u=Q(u);f=X(e,f);g&&=X(h,g);n&&=X(m,n);x=X(A,x);var t=Fb(u);Eb(t,function(){Y(`Cannot construct ${u} due to unbound types`,
428
- [d])});V([b,a,c],d?[d]:[],v=>{v=v[0];if(d){var p=v.aa;var I=p.pa}else I=Bb.prototype;v=$a(u,function(...L){if(Object.getPrototypeOf(this)!==G)throw new K(`Use 'new' to construct ${u}`);if(void 0===r.ua)throw new K(`${u} has no accessible constructor`);var O=r.ua[L.length];if(void 0===O)throw new K(`Tried to invoke ctor of ${u} with invalid number of parameters (${L.length}) - expected (${Object.keys(r.ua).toString()}) parameters instead!`);return O.apply(this,L)});var G=Object.create(I,{constructor:{value:v}});
429
- v.prototype=G;var r=new Gb(u,v,G,x,p,f,g,n);if(r.ga){var E;(E=r.ga).Ea??(E.Ea=[]);r.ga.Ea.push(r)}p=new Pb(u,r,!0,!1,!1);E=new Pb(u+"*",r,!1,!1,!1);I=new Pb(u+" const*",r,!1,!0,!1);Cb[b]={pointerType:E,Hb:I};Qb(t,v);return[p,E,I]})},j:(b,a,c,d,e,f,h)=>{var g=Vb(c,d);a=Q(a);a=Wb(a);f=X(e,f);V([],[b],m=>{function n(){Y(`Cannot call ${u} due to unbound types`,g)}m=m[0];var u=`${m.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);var A=m.aa.constructor;void 0===A[a]?(n.ta=c-1,A[a]=n):(Db(A,a,
430
- u),A[a].fa[c-1]=n);V([],g,x=>{x=Ub(u,[x[0],null].concat(x.slice(1)),null,f,h);void 0===A[a].fa?(x.ta=c-1,A[a]=x):A[a].fa[c-1]=x;if(m.aa.Ea)for(const t of m.aa.Ea)t.constructor.hasOwnProperty(a)||(t.constructor[a]=x);return[]});return[]})},p:(b,a,c,d,e,f,h,g)=>{a=Q(a);f=X(e,f);V([],[b],m=>{m=m[0];var n=`${m.name}.${a}`,u={get(){Y(`Cannot access ${n} due to unbound types`,[c])},enumerable:!0,configurable:!0};u.set=g?()=>{Y(`Cannot access ${n} due to unbound types`,[c])}:()=>{throw new K(`${n} is a read-only property`);
431
- };Object.defineProperty(m.aa.constructor,a,u);V([],[c],A=>{A=A[0];var x={get(){return A.ba(f(d))},enumerable:!0};g&&(g=X(h,g),x.set=t=>{var v=[];g(d,A.ea(v,t));sb(v)});Object.defineProperty(m.aa.constructor,a,x);return[]});return[]})},m:(b,a,c,d,e,f)=>{var h=Vb(a,c);e=X(d,e);V([],[b],g=>{g=g[0];var m=`constructor ${g.name}`;void 0===g.aa.ua&&(g.aa.ua=[]);if(void 0!==g.aa.ua[a-1])throw new K(`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!`);
432
- g.aa.ua[a-1]=()=>{Y(`Cannot construct ${g.name} due to unbound types`,h)};V([],h,n=>{n.splice(1,0,null);g.aa.ua[a-1]=Ub(m,n,null,e,f);return[]});return[]})},a:(b,a,c,d,e,f,h,g)=>{var m=Vb(c,d);a=Q(a);a=Wb(a);f=X(e,f);V([],[b],n=>{function u(){Y(`Cannot call ${A} due to unbound types`,m)}n=n[0];var A=`${n.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);g&&n.aa.sb.push(a);var x=n.aa.pa,t=x[a];void 0===t||void 0===t.fa&&t.className!==n.name&&t.ta===c-2?(u.ta=c-2,u.className=n.name,x[a]=u):
433
- (Db(x,a,A),x[a].fa[c-2]=u);V([],m,v=>{v=Ub(A,v,n,f,h);void 0===x[a].fa?(v.ta=c-2,x[a]=v):x[a].fa[c-2]=v;return[]});return[]})},b:(b,a,c,d,e,f,h,g,m,n)=>{a=Q(a);e=X(d,e);V([],[b],u=>{u=u[0];var A=`${u.name}.${a}`,x={get(){Y(`Cannot access ${A} due to unbound types`,[c,h])},enumerable:!0,configurable:!0};x.set=m?()=>Y(`Cannot access ${A} due to unbound types`,[c,h]):()=>{throw new K(A+" is a read-only property");};Object.defineProperty(u.aa.pa,a,x);V([],m?[c,h]:[c],t=>{var v=t[0],p={get(){var G=Xb(this,
434
- u,A+" getter");return v.ba(e(f,G))},enumerable:!0};if(m){m=X(g,m);var I=t[1];p.set=function(G){var r=Xb(this,u,A+" setter"),E=[];m(n,r,I.ea(E,G));sb(E)}}Object.defineProperty(u.aa.pa,a,p);return[]});return[]})},F:b=>T(b,Zb),l:(b,a,c,d,e)=>{a=Q(a);e=0===e?"object":1===e?"number":"string";switch(e){case "object":function h(){}h.values={};T(b,{name:a,constructor:h,valueType:e,ba:function(g){return this.constructor.values[g]},ea:(g,m)=>m.value,ma:$b(a,c,d),ka:null});Eb(a,h);break;case "number":var f=
435
- {};T(b,{name:a,Ya:f,valueType:e,ba:g=>g,ea:(g,m)=>m,ma:$b(a,c,d),ka:null});Eb(a,f);delete l[a].ta;break;case "string":f={},T(b,{name:a,zb:{},ub:{},Ya:f,valueType:e,ba:function(g){return this.ub[g]},ea:function(g,m){return this.zb[m]},ma:$b(a,c,d),ka:null}),Eb(a,f),delete l[a].ta}},d:(b,a,c)=>{var d=jb(b,"enum");a=Q(a);switch(d.valueType){case "object":b=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:$a(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=
436
- d;break;case "number":d.Ya[a]=c;break;case "string":d.zb[a]=c,d.ub[c]=a,d.Ya[a]=a}},q:(b,a,c)=>{a=Q(a);T(b,{name:a,ba:d=>d,ea:(d,e)=>e,ma:ac(a,c),ka:null})},i:(b,a,c,d,e,f)=>{var h=Vb(a,c);b=Q(b);b=Wb(b);e=X(d,e);Eb(b,function(){Y(`Cannot call ${b} due to unbound types`,h)},a-1);V([],h,g=>{Qb(b,Ub(b,[g[0],null].concat(g.slice(1)),null,e,f),a-1);return[]})},k:(b,a,c,d,e)=>{a=Q(a);let f=g=>g;if(0===d){var h=32-8*c;f=g=>g<<h>>>h;e=f(e)}T(b,{name:a,ba:f,ea:(g,m)=>m,ma:yb(a,c,0!==d),ka:null})},h:(b,a,
437
- c)=>{function d(f){return new e(Ca.buffer,J[f+4>>2],J[f>>2])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][a];c=Q(c);T(b,{name:c,ba:d,ma:d},{Vb:!0})},G:(b,a)=>{a=Q(a);T(b,{name:a,ba(c){var d=(d=c+4)?ic(B,d,J[c>>2],!0):"";hb(c);return d},ea(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new K("Cannot pass non-string to std::string");
438
- var f=e?fc(d):d.length;var h=Ec(4+f+1),g=h+4;J[h>>2]=f;e?bc(d,g,f+1):B.set(d,g);null!==c&&c.push(hb,h);return h},ma:tb,ka(c){hb(c)}})},o:(b,a,c)=>{c=Q(c);if(2===a){var d=kc;var e=lc;var f=mc}else d=nc,e=oc,f=pc;T(b,{name:c,ba:h=>{var g=d(h+4,J[h>>2]*a,!0);hb(h);return g},ea:(h,g)=>{if("string"!=typeof g)throw new K(`Cannot pass non-string to C++ string type ${c}`);var m=f(g),n=Ec(4+m+a);J[n>>2]=m/a;e(g,n+4,m+a);null!==h&&h.push(hb,n);return n},ma:tb,ka(h){hb(h)}})},P:(b,a,c,d,e,f)=>{nb[b]={name:Q(a),
439
- Za:X(c,d),qa:X(e,f),ob:[]}},O:(b,a,c,d,e,f,h,g,m,n)=>{nb[b].ob.push({Ob:Q(a),Ub:c,Sb:X(d,e),Tb:f,ec:h,dc:X(g,m),fc:n})},I:(b,a)=>{a=Q(a);T(b,{Xb:!0,name:a,ba:()=>{},ea:()=>{}})},u:()=>{Za=!1;qc=0},f:(b,a,c)=>{var [d,...e]=tc(b,a),f=d.ea.bind(d),h=e.map(m=>m.ma.bind(m));b--;var g=Array(b);a=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return sc($a(a,(m,n,u,A)=>{for(var x=0,t=0;t<b;++t)g[t]=h[t](A+x),x+=8;switch(c){case 0:var v=N(m).apply(null,g);break;case 2:v=Reflect.construct(N(m),g);break;
440
- case 3:v=g[0];break;case 1:v=N(m)[vc(n)](...g)}m=[];v=f(m,v);m.length&&(J[u>>2]=P(m));return v}))},R:Yb,J:b=>{b=vc(b);return P(l[b])},K:(b,a)=>{b=N(b);a=N(a);return P(b[a])},L:b=>{9<b&&(bb[b+1]+=1)},e:(b,a,c,d,e)=>rc[b](a,c,d,e),M:()=>P([]),s:b=>P(vc(b)),S:()=>P({}),Q:b=>{var a=N(b);sb(a);Yb(b)},g:(b,a,c)=>{b=N(b);a=N(a);c=N(c);b[a]=c},v:(b,a)=>{wc[b]&&(clearTimeout(wc[b].id),delete wc[b]);if(!a)return 0;var c=setTimeout(()=>{delete wc[b];zc(()=>Fc(b,performance.now()))},a);wc[b]={id:c,jc:a};return 0},
441
- w:(b,a,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();J[b>>2]=60*Math.max(f,e);Fa[a>>2]=Number(f!=e);a=h=>{var g=Math.abs(h);return`UTC${0<=h?"-":"+"}${String(Math.floor(g/60)).padStart(2,"0")}${String(g%60).padStart(2,"0")}`};b=a(f);a=a(e);e<f?(bc(b,c,17),bc(a,d,17)):(bc(b,d,17),bc(a,c,17))},z:function(b,a,c){if(!(0<=b&&3>=b))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===b?Date.now():performance.now())));return 0},A:b=>{var a=
442
- B.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))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},x:(b,a)=>{var c=0,d=0,e;for(e of Cc()){var f=a+c;J[b+d>>2]=f;c+=bc(e,f,Infinity)+1;d+=4}return 0},y:(b,a)=>{var c=Cc();J[b>>2]=c.length;b=0;for(var d of c)b+=fc(d)+1;J[a>>2]=b;return 0},D:()=>52,B:function(){return 70},
443
- C:(b,a,c,d)=>{for(var e=0,f=0;f<c;f++){var h=J[a>>2],g=J[a+4>>2];a+=8;for(var m=0;m<g;m++){var n=b,u=B[h+m],A=Dc[n];0===u||10===u?((1===n?ua:va)(ic(A)),A.length=0):A.push(u)}e+=g}J[d>>2]=e;return 0},t:yc},Hc;
444
- Hc=await (async function(){function b(c){c=Hc=c.exports;hb=c.V;Ec=c.W;gb=c.X;Fc=c.Z;Ma=c.T;Rb=c.Y;La();return Hc}var a={a:Gc};if(l.instantiateWasm)return new Promise(c=>{l.instantiateWasm(a,(d,e)=>{c(b(d,e))})});Oa??=l.locateFile?l.locateFile("canvas_advanced.wasm",oa):oa+"canvas_advanced.wasm";return b((await Ta(a)).instance)}());
445
- (function(){function b(){l.calledRun=!0;if(!xa){Ka=!0;Hc.U();za?.(l);l.onRuntimeInitialized?.();if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;){var a=l.postRun.shift();Wa.push(a)}Va(Wa)}}if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)Ya();Va(Xa);l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1);b()},1)):b()})();Ka?moduleRtn=l:moduleRtn=new Promise((b,a)=>{za=b;Ba=a});
425
+ Object.assign(Pb.prototype,{Sb(b){this.tb&&(b=this.tb(b));return b},lb(b){this.qa?.(b)},ma:tb,ba:function(b){function a(){return this.Ja?Ob(this.aa.pa,{da:this.cc,ca:c,oa:this,ia:b}):Ob(this.aa.pa,{da:this,ca:b})}var c=this.Sb(b);if(!c)return this.lb(b),null;var d=Nb(this.aa,c);if(void 0!==d){if(0===d.$.count.value)return d.$.ca=c,d.$.ia=b,d.clone();d=d.clone();this.lb(b);return d}d=this.aa.Rb(c);d=Cb[d];if(!d)return a.call(this);d=this.Ia?d.Ib:d.pointerType;var e=Mb(c,this.aa,d.aa);return null===
426
+ e?a.call(this):this.Ja?Ob(d.aa.pa,{da:d,ca:e,oa:this,ia:b}):Ob(d.aa.pa,{da:d,ca:e})}});h.noExitRuntime&&(Za=h.noExitRuntime);h.print&&(ua=h.print);h.printErr&&(va=h.printErr);h.wasmBinary&&(wa=h.wasmBinary);h.thisProgram&&(na=h.thisProgram);if(h.preInit)for("function"==typeof h.preInit&&(h.preInit=[h.preInit]);0<h.preInit.length;)h.preInit.shift()();
427
+ var hb,Gc,gb,Hc,Ma,Rb,Ic={E:()=>Na(""),n:(b,a,c)=>{b=U(b);a=jb(a,"wrapper");c=P(c);var d=a.aa,e=d.pa,k=d.ga.pa,g=d.ga.constructor;b=$a(b,function(...f){for(var m of d.ga.sb)if(this[m]===k[m])throw new cb(`Pure virtual function ${m} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:e});this.__construct(...f)});e.__construct=function(...f){if(this===e)throw new N("Pass correct 'this' to __construct");f=g.implement(this,...f);kb(f);var m=f.$;f.notifyOnDestruction();m.xa=
428
+ !0;Object.defineProperties(this,{$:{value:m}});mb(this);f=m.ca;f=eb(d,f);if(db.hasOwnProperty(f))throw new N(`Tried to register registered instance: ${f}`);db[f]=this};e.__destruct=function(){if(this===e)throw new N("Pass correct 'this' to __destruct");kb(this);var f=this.$.ca;f=eb(d,f);if(db.hasOwnProperty(f))delete db[f];else throw new N(`Tried to unregister unregistered instance: ${f}`);};b.prototype=Object.create(e);Object.assign(b.prototype,c);return T(b)},N:b=>{var a=nb[b];delete nb[b];var c=
429
+ a.Za,d=a.qa,e=a.ob,k=e.map(g=>g.Vb).concat(e.map(g=>g.fc));W([b],k,g=>{var f={},m,n;for([m,n]of e.entries()){const r=g[m],w=n.Tb,z=n.Ub,v=g[m+e.length],x=n.ec,q=n.hc;f[n.Pb]={read:L=>r.ba(w(z,L)),write:(L,I)=>{var u=[];x(q,L,v.ea(u,I));sb(u)},optional:r.optional}}return[{name:a.name,ba:r=>{var w={},z;for(z in f)w[z]=f[z].read(r);d(r);return w},ea:(r,w)=>{for(var z in f)if(!(z in w||f[z].optional))throw new TypeError(`Missing field: "${z}"`);var v=c();for(z in f)f[z].write(v,w[z]);null!==r&&r.push(d,
430
+ v);return v},ma:tb,ka:d}]})},r:(b,a,c,d,e)=>{a=U(a);d=0n===d;let k=g=>g;if(d){const g=8*c;k=f=>BigInt.asUintN(g,f);e=k(e)}V(b,{name:a,ba:k,ea:(g,f)=>{"number"==typeof f&&(f=BigInt(f));return f},ma:yb(a,c,!d),ka:null})},H:(b,a,c,d)=>{a=U(a);V(b,{name:a,ba:function(e){return!!e},ea:function(e,k){return k?c:d},ma:function(e){return this.ba(D[e])},ka:null})},c:(b,a,c,d,e,k,g,f,m,n,r,w,z)=>{r=U(r);k=Y(e,k);f&&=Y(g,f);n&&=Y(m,n);z=Y(w,z);var v=Fb(r);Eb(v,function(){Z(`Cannot construct ${r} due to unbound types`,
431
+ [d])});W([b,a,c],d?[d]:[],x=>{x=x[0];if(d){var q=x.aa;var L=q.pa}else L=Bb.prototype;x=$a(r,function(...K){if(Object.getPrototypeOf(this)!==I)throw new N(`Use 'new' to construct ${r}`);if(void 0===u.ua)throw new N(`${r} has no accessible constructor`);var R=u.ua[K.length];if(void 0===R)throw new N(`Tried to invoke ctor of ${r} with invalid number of parameters (${K.length}) - expected (${Object.keys(u.ua).toString()}) parameters instead!`);return R.apply(this,K)});var I=Object.create(L,{constructor:{value:x}});
432
+ x.prototype=I;var u=new Gb(r,x,I,z,q,k,f,n);if(u.ga){var J;(J=u.ga).Ea??(J.Ea=[]);u.ga.Ea.push(u)}q=new Pb(r,u,!0,!1,!1);J=new Pb(r+"*",u,!1,!1,!1);L=new Pb(r+" const*",u,!1,!0,!1);Cb[b]={pointerType:J,Ib:L};Qb(v,x);return[q,J,L]})},j:(b,a,c,d,e,k,g)=>{var f=Vb(c,d);a=U(a);a=Wb(a);k=Y(e,k);W([],[b],m=>{function n(){Z(`Cannot call ${r} due to unbound types`,f)}m=m[0];var r=`${m.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);var w=m.aa.constructor;void 0===w[a]?(n.ta=c-1,w[a]=n):(Db(w,a,
433
+ r),w[a].fa[c-1]=n);W([],f,z=>{z=Ub(r,[z[0],null].concat(z.slice(1)),null,k,g);void 0===w[a].fa?(z.ta=c-1,w[a]=z):w[a].fa[c-1]=z;if(m.aa.Ea)for(const v of m.aa.Ea)v.constructor.hasOwnProperty(a)||(v.constructor[a]=z);return[]});return[]})},p:(b,a,c,d,e,k,g,f)=>{a=U(a);k=Y(e,k);W([],[b],m=>{m=m[0];var n=`${m.name}.${a}`,r={get(){Z(`Cannot access ${n} due to unbound types`,[c])},enumerable:!0,configurable:!0};r.set=f?()=>{Z(`Cannot access ${n} due to unbound types`,[c])}:()=>{throw new N(`${n} is a read-only property`);
434
+ };Object.defineProperty(m.aa.constructor,a,r);W([],[c],w=>{w=w[0];var z={get(){return w.ba(k(d))},enumerable:!0};f&&(f=Y(g,f),z.set=v=>{var x=[];f(d,w.ea(x,v));sb(x)});Object.defineProperty(m.aa.constructor,a,z);return[]});return[]})},m:(b,a,c,d,e,k)=>{var g=Vb(a,c);e=Y(d,e);W([],[b],f=>{f=f[0];var m=`constructor ${f.name}`;void 0===f.aa.ua&&(f.aa.ua=[]);if(void 0!==f.aa.ua[a-1])throw new N(`Cannot register multiple constructors with identical number of parameters (${a-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
435
+ f.aa.ua[a-1]=()=>{Z(`Cannot construct ${f.name} due to unbound types`,g)};W([],g,n=>{n.splice(1,0,null);f.aa.ua[a-1]=Ub(m,n,null,e,k);return[]});return[]})},a:(b,a,c,d,e,k,g,f)=>{var m=Vb(c,d);a=U(a);a=Wb(a);k=Y(e,k);W([],[b],n=>{function r(){Z(`Cannot call ${w} due to unbound types`,m)}n=n[0];var w=`${n.name}.${a}`;a.startsWith("@@")&&(a=Symbol[a.substring(2)]);f&&n.aa.sb.push(a);var z=n.aa.pa,v=z[a];void 0===v||void 0===v.fa&&v.className!==n.name&&v.ta===c-2?(r.ta=c-2,r.className=n.name,z[a]=r):
436
+ (Db(z,a,w),z[a].fa[c-2]=r);W([],m,x=>{x=Ub(w,x,n,k,g);void 0===z[a].fa?(x.ta=c-2,z[a]=x):z[a].fa[c-2]=x;return[]});return[]})},b:(b,a,c,d,e,k,g,f,m,n)=>{a=U(a);e=Y(d,e);W([],[b],r=>{r=r[0];var w=`${r.name}.${a}`,z={get(){Z(`Cannot access ${w} due to unbound types`,[c,g])},enumerable:!0,configurable:!0};z.set=m?()=>Z(`Cannot access ${w} due to unbound types`,[c,g]):()=>{throw new N(w+" is a read-only property");};Object.defineProperty(r.aa.pa,a,z);W([],m?[c,g]:[c],v=>{var x=v[0],q={get(){var I=Xb(this,
437
+ r,w+" getter");return x.ba(e(k,I))},enumerable:!0};if(m){m=Y(f,m);var L=v[1];q.set=function(I){var u=Xb(this,r,w+" setter"),J=[];m(n,u,L.ea(J,I));sb(J)}}Object.defineProperty(r.aa.pa,a,q);return[]});return[]})},F:b=>V(b,Zb),l:(b,a,c,d,e)=>{a=U(a);e=0===e?"object":1===e?"number":"string";switch(e){case "object":function g(){}g.values={};V(b,{name:a,constructor:g,valueType:e,ba:function(f){return this.constructor.values[f]},ea:(f,m)=>m.value,ma:$b(a,c,d),ka:null});Eb(a,g);break;case "number":var k=
438
+ {};V(b,{name:a,Ya:k,valueType:e,ba:f=>f,ea:(f,m)=>m,ma:$b(a,c,d),ka:null});Eb(a,k);delete h[a].ta;break;case "string":k={},V(b,{name:a,zb:{},ub:{},Ya:k,valueType:e,ba:function(f){return this.ub[f]},ea:function(f,m){return this.zb[m]},ma:$b(a,c,d),ka:null}),Eb(a,k),delete h[a].ta}},d:(b,a,c)=>{var d=jb(b,"enum");a=U(a);switch(d.valueType){case "object":b=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:$a(`${d.name}_${a}`,function(){})}});b.values[c]=d;b[a]=
439
+ d;break;case "number":d.Ya[a]=c;break;case "string":d.zb[a]=c,d.ub[c]=a,d.Ya[a]=a}},q:(b,a,c)=>{a=U(a);V(b,{name:a,ba:d=>d,ea:(d,e)=>e,ma:ac(a,c),ka:null})},h:(b,a,c,d,e,k)=>{var g=Vb(a,c);b=U(b);b=Wb(b);e=Y(d,e);Eb(b,function(){Z(`Cannot call ${b} due to unbound types`,g)},a-1);W([],g,f=>{Qb(b,Ub(b,[f[0],null].concat(f.slice(1)),null,e,k),a-1);return[]})},k:(b,a,c,d,e)=>{a=U(a);let k=f=>f;if(0===d){var g=32-8*c;k=f=>f<<g>>>g;e=k(e)}V(b,{name:a,ba:k,ea:(f,m)=>m,ma:yb(a,c,0!==d),ka:null})},i:(b,a,
440
+ c)=>{function d(k){return new e(Ca.buffer,M[k+4>>2],M[k>>2])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][a];c=U(c);V(b,{name:c,ba:d,ma:d},{Wb:!0})},G:(b,a)=>{a=U(a);V(b,{name:a,ba(c){var d=(d=c+4)?kc(D,d,M[c>>2],!0):"";hb(c);return d},ea(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new N("Cannot pass non-string to std::string");
441
+ var k=e?hc(d):d.length;var g=Gc(4+k+1),f=g+4;M[g>>2]=k;e?bc(d,f,k+1):D.set(d,f);null!==c&&c.push(hb,g);return g},ma:tb,ka(c){hb(c)}})},o:(b,a,c)=>{c=U(c);if(2===a){var d=mc;var e=nc;var k=oc}else d=pc,e=qc,k=rc;V(b,{name:c,ba:g=>{var f=d(g+4,M[g>>2]*a,!0);hb(g);return f},ea:(g,f)=>{if("string"!=typeof f)throw new N(`Cannot pass non-string to C++ string type ${c}`);var m=k(f),n=Gc(4+m+a);M[n>>2]=m/a;e(f,n+4,m+a);null!==g&&g.push(hb,n);return n},ma:tb,ka(g){hb(g)}})},P:(b,a,c,d,e,k)=>{nb[b]={name:U(a),
442
+ Za:Y(c,d),qa:Y(e,k),ob:[]}},O:(b,a,c,d,e,k,g,f,m,n)=>{nb[b].ob.push({Pb:U(a),Vb:c,Tb:Y(d,e),Ub:k,fc:g,ec:Y(f,m),hc:n})},I:(b,a)=>{a=U(a);V(b,{Yb:!0,name:a,ba:()=>{},ea:()=>{}})},u:()=>{Za=!1;sc=0},f:(b,a,c)=>{var [d,...e]=vc(b,a),k=d.ea.bind(d),g=e.map(m=>m.ma.bind(m));b--;var f=Array(b);a=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return uc($a(a,(m,n,r,w)=>{for(var z=0,v=0;v<b;++v)f[v]=g[v](w+z),z+=8;switch(c){case 0:var x=P(m).apply(null,f);break;case 2:x=Reflect.construct(P(m),f);break;
443
+ case 3:x=f[0];break;case 1:x=P(m)[xc(n)](...f)}m=[];x=k(m,x);m.length&&(M[r>>2]=T(m));return x}))},R:Yb,J:b=>{b=xc(b);return T(h[b])},K:(b,a)=>{b=P(b);a=P(a);return T(b[a])},L:b=>{9<b&&(bb[b+1]+=1)},e:(b,a,c,d,e)=>tc[b](a,c,d,e),M:()=>T([]),s:b=>T(xc(b)),S:()=>T({}),Q:b=>{var a=P(b);sb(a);Yb(b)},g:(b,a,c)=>{b=P(b);a=P(a);c=P(c);b[a]=c},v:(b,a)=>{yc[b]&&(clearTimeout(yc[b].id),delete yc[b]);if(!a)return 0;var c=setTimeout(()=>{delete yc[b];Bc(()=>Hc(b,performance.now()))},a);yc[b]={id:c,kc:a};return 0},
444
+ w:(b,a,c,d)=>{var e=(new Date).getFullYear(),k=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();M[b>>2]=60*Math.max(k,e);Fa[a>>2]=Number(k!=e);a=g=>{var f=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(f/60)).padStart(2,"0")}${String(f%60).padStart(2,"0")}`};b=a(k);a=a(e);e<k?(bc(b,c,17),bc(a,d,17)):(bc(b,d,17),bc(a,c,17))},x:function(b,a,c){if(!(0<=b&&3>=b))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===b?Date.now():performance.now())));return 0},y:b=>{var a=
445
+ D.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))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(k){}e=void 0}if(e)return!0}return!1},C:(b,a)=>{var c=0,d=0,e;for(e of Ec()){var k=a+c;M[b+d>>2]=k;c+=bc(e,k,Infinity)+1;d+=4}return 0},D:(b,a)=>{var c=Ec();M[b>>2]=c.length;b=0;for(var d of c)b+=hc(d)+1;M[a>>2]=b;return 0},B:()=>52,z:function(){return 70},
446
+ A:(b,a,c,d)=>{for(var e=0,k=0;k<c;k++){var g=M[a>>2],f=M[a+4>>2];a+=8;for(var m=0;m<f;m++){var n=b,r=D[g+m],w=Fc[n];0===r||10===r?((1===n?ua:va)(kc(w)),w.length=0):w.push(r)}e+=f}M[d>>2]=e;return 0},t:Ac},Jc;
447
+ Jc=await (async function(){function b(c){c=Jc=c.exports;hb=c.V;Gc=c.W;gb=c.X;Hc=c.Z;Ma=c.T;Rb=c.Y;La();return Jc}var a={a:Ic};if(h.instantiateWasm)return new Promise(c=>{h.instantiateWasm(a,(d,e)=>{c(b(d,e))})});Oa??=h.locateFile?h.locateFile("canvas_advanced.wasm",oa):oa+"canvas_advanced.wasm";return b((await Ta(a)).instance)}());
448
+ (function(){function b(){h.calledRun=!0;if(!xa){Ka=!0;Jc.U();za?.(h);h.onRuntimeInitialized?.();if(h.postRun)for("function"==typeof h.postRun&&(h.postRun=[h.postRun]);h.postRun.length;){var a=h.postRun.shift();Wa.push(a)}Va(Wa)}}if(h.preRun)for("function"==typeof h.preRun&&(h.preRun=[h.preRun]);h.preRun.length;)Ya();Va(Xa);h.setStatus?(h.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>h.setStatus(""),1);b()},1)):b()})();Ka?moduleRtn=h:moduleRtn=new Promise((b,a)=>{za=b;Ba=a});
446
449
  ;return moduleRtn}})();
447
450
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
448
451
 
@@ -451,7 +454,7 @@ Hc=await (async function(){function b(c){c=Hc=c.exports;hb=c.V;Ec=c.W;gb=c.X;Fc=
451
454
  /* 5 */
452
455
  /***/ ((module) => {
453
456
 
454
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.41.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}}');
457
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas-lite","version":"2.42.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}}');
455
458
 
456
459
  /***/ }),
457
460
  /* 6 */
@@ -2994,14 +2997,26 @@ var __extends = (undefined && undefined.__extends) || (function () {
2994
2997
  };
2995
2998
  })();
2996
2999
  var FileFinalizer = /** @class */ (function () {
2997
- function FileFinalizer(file) {
3000
+ function FileFinalizer(file, session) {
3001
+ if (session === void 0) { session = null; }
2998
3002
  this.selfUnref = false;
2999
3003
  this._file = file;
3004
+ this._session = session;
3000
3005
  }
3001
3006
  FileFinalizer.prototype.unref = function () {
3002
3007
  if (this._file) {
3003
3008
  this._file.unref();
3004
3009
  }
3010
+ // After the file, never before: the file's resources belong to the session.
3011
+ if (this._session) {
3012
+ this._session.delete();
3013
+ this._session = null;
3014
+ }
3015
+ };
3016
+ // Disarms the GC path for a file cleanup() already released.
3017
+ FileFinalizer.prototype.release = function () {
3018
+ this._file = null;
3019
+ this._session = null;
3005
3020
  };
3006
3021
  return FileFinalizer;
3007
3022
  }());
@@ -3085,8 +3100,10 @@ var FontWrapper = /** @class */ (function (_super) {
3085
3100
  return FontWrapper;
3086
3101
  }(AssetWrapper));
3087
3102
  var CustomFileAssetLoaderWrapper = /** @class */ (function () {
3088
- function CustomFileAssetLoaderWrapper(runtime, loaderCallback) {
3103
+ function CustomFileAssetLoaderWrapper(runtime, loaderCallback, session) {
3104
+ if (session === void 0) { session = null; }
3089
3105
  this._assetLoaderCallback = loaderCallback;
3106
+ this._session = session;
3090
3107
  this.assetLoader = new runtime.CustomFileAssetLoader({
3091
3108
  loadContents: this.loadContents.bind(this),
3092
3109
  });
@@ -3094,13 +3111,13 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
3094
3111
  CustomFileAssetLoaderWrapper.prototype.loadContents = function (asset, bytes) {
3095
3112
  var assetWrapper;
3096
3113
  if (asset.isImage) {
3097
- assetWrapper = new ImageAssetWrapper(asset);
3114
+ assetWrapper = new ImageAssetWrapper(asset, this._session);
3098
3115
  }
3099
3116
  else if (asset.isAudio) {
3100
- assetWrapper = new AudioAssetWrapper(asset);
3117
+ assetWrapper = new AudioAssetWrapper(asset, this._session);
3101
3118
  }
3102
3119
  else if (asset.isFont) {
3103
- assetWrapper = new FontAssetWrapper(asset);
3120
+ assetWrapper = new FontAssetWrapper(asset, this._session);
3104
3121
  }
3105
3122
  else {
3106
3123
  return false;
@@ -3114,11 +3131,15 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
3114
3131
  * an asset associated wtih the Rive File
3115
3132
  */
3116
3133
  var FileAssetWrapper = /** @class */ (function () {
3117
- function FileAssetWrapper(nativeAsset) {
3134
+ function FileAssetWrapper(nativeAsset, session) {
3135
+ if (session === void 0) { session = null; }
3118
3136
  this._nativeFileAsset = nativeAsset;
3137
+ this._session = session;
3119
3138
  }
3120
3139
  FileAssetWrapper.prototype.decode = function (bytes) {
3121
- this._nativeFileAsset.decode(bytes);
3140
+ // The session travels with the asset so a deferred file's assets are
3141
+ // session-typed without the caller needing to know the file's rendering mode.
3142
+ this._nativeFileAsset.decode(bytes, this._session);
3122
3143
  };
3123
3144
  Object.defineProperty(FileAssetWrapper.prototype, "name", {
3124
3145
  get: function () {
@@ -4754,8 +4775,23 @@ var RiveFile = /** @class */ (function () {
4754
4775
  this.destroyed = false;
4755
4776
  this.selfUnref = false;
4756
4777
  this.bindableArtboards = [];
4778
+ // Deferred rendering was requested; the session may still be null if this
4779
+ // build has no deferred support.
4780
+ this.deferred = false;
4781
+ // The session this file imported through, null when immediate. Owned here:
4782
+ // it has to outlive the file, so it is deleted after the file is released.
4783
+ this.session = null;
4784
+ // Attaching is once per session: a detached session can never replay again,
4785
+ // so a claimed file re-imports for the next instance implicitly. Mirrors the native
4786
+ // latch (WebGL2DeferredSession::everBound, C2DDeferredSession::claim).
4787
+ this._sessionClaimed = false;
4788
+ // Releasing this file has to be deterministic once a session owns its
4789
+ // resources, so the finalizer is disarmed rather than left to GC.
4790
+ this.fileFinalizer = null;
4791
+ this.boundElsewhereWarned = false;
4757
4792
  this.src = params.src;
4758
4793
  this.buffer = params.buffer;
4794
+ this.deferred = !!params.enableGPUCanvas;
4759
4795
  if (params.assetLoader)
4760
4796
  this.assetLoader = params.assetLoader;
4761
4797
  this.enableRiveAssetCDN =
@@ -4773,12 +4809,24 @@ var RiveFile = /** @class */ (function () {
4773
4809
  this.on(EventType.LoadError, params.onLoadError);
4774
4810
  }
4775
4811
  RiveFile.prototype.releaseFile = function () {
4776
- var _a;
4777
- if (this.selfUnref) {
4778
- (_a = this.file) === null || _a === void 0 ? void 0 : _a.unref();
4779
- }
4812
+ var _a, _b;
4813
+ // Release here rather than leaving it to the finalization registry. The
4814
+ // native file frees GL-backed resources when its last reference goes, and
4815
+ // callers reach this with the renderer's context current; a finalizer runs
4816
+ // with none, so those deletes would silently do nothing.
4817
+ (_a = this.fileFinalizer) === null || _a === void 0 ? void 0 : _a.release();
4818
+ (_b = this.file) === null || _b === void 0 ? void 0 : _b.unref();
4819
+ this.fileFinalizer = null;
4780
4820
  this.file = null;
4781
4821
  };
4822
+ RiveFile.prototype.releaseSession = function () {
4823
+ var _a;
4824
+ // Known limitation: cleanup() on a file an instance is still drawing
4825
+ // deletes the session under it. A RiveFile's creator holds no reference of
4826
+ // its own, so their cleanup() can take the count to zero.
4827
+ (_a = this.session) === null || _a === void 0 ? void 0 : _a.delete();
4828
+ this.session = null;
4829
+ };
4782
4830
  RiveFile.prototype.releaseBindableArtboards = function () {
4783
4831
  this.bindableArtboards.forEach(function (bindableArtboard) {
4784
4832
  return bindableArtboard.destroy();
@@ -4786,7 +4834,7 @@ var RiveFile = /** @class */ (function () {
4786
4834
  };
4787
4835
  RiveFile.prototype.initData = function () {
4788
4836
  return __awaiter(this, void 0, void 0, function () {
4789
- var _a, error_1, loader, loaderWrapper, _b, fileFinalizer;
4837
+ var _a, error_1, loader, loaderWrapper, _b, error_2, fileFinalizer;
4790
4838
  return __generator(this, function (_c) {
4791
4839
  switch (_c.label) {
4792
4840
  case 0:
@@ -4809,36 +4857,55 @@ var RiveFile = /** @class */ (function () {
4809
4857
  if (this.destroyed) {
4810
4858
  return [2 /*return*/];
4811
4859
  }
4860
+ if (this.deferred && this.session === null) {
4861
+ this.session = RiveFile.makeDeferredSession(this.runtime);
4862
+ }
4812
4863
  if (this.assetLoader) {
4813
- loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader);
4864
+ loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader, this.session);
4814
4865
  loader = loaderWrapper.assetLoader;
4815
4866
  }
4816
4867
  // Load the Rive file
4817
4868
  if (this.enablePerfMarks)
4818
4869
  performance.mark('rive:file-load:start');
4819
- _b = this;
4820
- return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
4870
+ _c.label = 5;
4821
4871
  case 5:
4872
+ _c.trys.push([5, 7, , 8]);
4873
+ _b = this;
4874
+ return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN, this.session)];
4875
+ case 6:
4822
4876
  _b.file = _c.sent();
4877
+ return [3 /*break*/, 8];
4878
+ case 7:
4879
+ error_2 = _c.sent();
4880
+ // The finalizer that would reclaim the session is only registered once
4881
+ // the import succeeds, so a failed load has to release it here.
4882
+ this.releaseSession();
4883
+ throw error_2;
4884
+ case 8:
4823
4885
  if (this.enablePerfMarks) {
4824
4886
  performance.mark('rive:file-load:end');
4825
4887
  performance.measure('rive:file-load', 'rive:file-load:start', 'rive:file-load:end');
4826
4888
  }
4827
- fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file);
4828
- _utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
4829
4889
  if (this.destroyed) {
4830
4890
  this.releaseFile();
4891
+ this.releaseSession();
4831
4892
  return [2 /*return*/];
4832
4893
  }
4833
- if (this.file !== null) {
4834
- this.eventManager.fire({
4835
- type: EventType.Load,
4836
- data: this,
4837
- });
4838
- }
4839
- else {
4894
+ if (this.file === null) {
4895
+ // A malformed file resolves to null rather than rejecting. Release the
4896
+ // session now: a finalizer for a file that does not exist would keep it
4897
+ // alive until GC, or for as long as the caller holds the failed RiveFile.
4898
+ this.releaseSession();
4840
4899
  this.fireLoadError(RiveFile.fileLoadErrorMessage);
4900
+ return [2 /*return*/];
4841
4901
  }
4902
+ fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file, this.session);
4903
+ this.fileFinalizer = fileFinalizer;
4904
+ _utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
4905
+ this.eventManager.fire({
4906
+ type: EventType.Load,
4907
+ data: this,
4908
+ });
4842
4909
  return [2 /*return*/];
4843
4910
  }
4844
4911
  });
@@ -4882,7 +4949,7 @@ var RiveFile = /** @class */ (function () {
4882
4949
  };
4883
4950
  RiveFile.prototype.init = function () {
4884
4951
  return __awaiter(this, void 0, void 0, function () {
4885
- var _a, bufferResolved, runtimeResolved, error_2;
4952
+ var _a, bufferResolved, runtimeResolved, error_3;
4886
4953
  return __generator(this, function (_b) {
4887
4954
  switch (_b.label) {
4888
4955
  case 0:
@@ -4914,8 +4981,8 @@ var RiveFile = /** @class */ (function () {
4914
4981
  }
4915
4982
  return [3 /*break*/, 5];
4916
4983
  case 4:
4917
- error_2 = _b.sent();
4918
- this.fireLoadError(error_2 instanceof Error ? error_2.message : RiveFile.fileLoadErrorMessage);
4984
+ error_3 = _b.sent();
4985
+ this.fireLoadError(error_3 instanceof Error ? error_3.message : RiveFile.fileLoadErrorMessage);
4919
4986
  return [3 /*break*/, 5];
4920
4987
  case 5: return [2 /*return*/];
4921
4988
  }
@@ -4957,9 +5024,99 @@ var RiveFile = /** @class */ (function () {
4957
5024
  this.removeAllRiveEventListeners();
4958
5025
  this.releaseFile();
4959
5026
  this.releaseBindableArtboards();
5027
+ // Everything imported through the session is gone; the session can go.
5028
+ this.releaseSession();
4960
5029
  this.destroyed = true;
4961
5030
  }
4962
5031
  };
5032
+ // Deferred is only compiled into some runtime builds, so feature detect it
5033
+ // and degrade to an immediate import rather than failing the load.
5034
+ RiveFile.makeDeferredSession = function (runtime) {
5035
+ var _a, _b;
5036
+ var session = (_b = (_a = runtime.makeDeferredSession) === null || _a === void 0 ? void 0 : _a.call(runtime)) !== null && _b !== void 0 ? _b : null;
5037
+ if (session === null && !RiveFile.deferredUnsupportedWarned) {
5038
+ RiveFile.deferredUnsupportedWarned = true;
5039
+ console.warn("Rive: `enableGPUCanvas: true` was ignored because this runtime build has no GPU Canvas support; importing in immediate mode. Use a @rive-app/webgl2 or @rive-app/canvas build with deferred rendering compiled in.");
5040
+ }
5041
+ return session;
5042
+ };
5043
+ Object.defineProperty(RiveFile.prototype, "deferredSession", {
5044
+ /**
5045
+ * @internal The deferred session this file imported through, or null if it
5046
+ * was imported in immediate mode.
5047
+ */
5048
+ get: function () {
5049
+ return this.session;
5050
+ },
5051
+ enumerable: false,
5052
+ configurable: true
5053
+ });
5054
+ Object.defineProperty(RiveFile.prototype, "deferredRequested", {
5055
+ /**
5056
+ * @internal Whether deferred was asked for, even when this build could not
5057
+ * honor it and imported immediate.
5058
+ */
5059
+ get: function () {
5060
+ return this.deferred;
5061
+ },
5062
+ enumerable: false,
5063
+ configurable: true
5064
+ });
5065
+ Object.defineProperty(RiveFile.prototype, "sessionClaimed", {
5066
+ /**
5067
+ * @internal Whether this file's session has ever been attached to a renderer.
5068
+ * Attaching is once per session, so a claimed file re-imports for the next
5069
+ * instance even after the renderer it was bound to is gone.
5070
+ */
5071
+ get: function () {
5072
+ return this._sessionClaimed;
5073
+ },
5074
+ enumerable: false,
5075
+ configurable: true
5076
+ });
5077
+ /**
5078
+ * @internal Marks this file's session as spent. There is no matching release:
5079
+ * a session that has been attached can never replay for another renderer.
5080
+ */
5081
+ RiveFile.prototype.claimSession = function () {
5082
+ this._sessionClaimed = true;
5083
+ };
5084
+ /**
5085
+ * @internal One warning per file however many instances collide on it.
5086
+ */
5087
+ RiveFile.prototype.warnBoundElsewhereOnce = function () {
5088
+ if (this.boundElsewhereWarned) {
5089
+ return;
5090
+ }
5091
+ this.boundElsewhereWarned = true;
5092
+ console.warn("Rive: this deferred RiveFile is already bound to another Rive instance's canvas, and a deferred session cannot span canvases. Re-importing the file for this instance (an extra parse of the retained buffer, no extra network request).");
5093
+ };
5094
+ /**
5095
+ * @internal Re-imports this file from its retained buffer into a mode of its
5096
+ * own. The copy is owned by whoever asked for it and never joins this file's
5097
+ * reference count.
5098
+ */
5099
+ RiveFile.prototype.reimport = function (deferred) {
5100
+ return __awaiter(this, void 0, void 0, function () {
5101
+ var copy;
5102
+ return __generator(this, function (_a) {
5103
+ switch (_a.label) {
5104
+ case 0:
5105
+ copy = new RiveFile({
5106
+ buffer: this.buffer,
5107
+ assetLoader: this.assetLoader,
5108
+ enableRiveAssetCDN: this.enableRiveAssetCDN,
5109
+ enablePerfMarks: this.enablePerfMarks,
5110
+ enableGPUCanvas: deferred,
5111
+ });
5112
+ return [4 /*yield*/, copy.init()];
5113
+ case 1:
5114
+ _a.sent();
5115
+ return [2 /*return*/, copy];
5116
+ }
5117
+ });
5118
+ });
5119
+ };
4963
5120
  /**
4964
5121
  * Unsubscribes all Rive listeners from an event type, or everything if no type is
4965
5122
  * given
@@ -5030,6 +5187,8 @@ var RiveFile = /** @class */ (function () {
5030
5187
  RiveFile.missingErrorMessage = "Rive source file or data buffer required";
5031
5188
  // Error message for file load error
5032
5189
  RiveFile.fileLoadErrorMessage = "The file failed to load";
5190
+ // Deferred support is per build, so the warning is per page, not per file.
5191
+ RiveFile.deferredUnsupportedWarned = false;
5033
5192
  return RiveFile;
5034
5193
  }());
5035
5194
 
@@ -5051,6 +5210,13 @@ var Rive = /** @class */ (function () {
5051
5210
  * and start.
5052
5211
  */
5053
5212
  this.readyForPlaying = false;
5213
+ // Deferred rendering was requested for this instance. The file it renders
5214
+ // has the final say, since a file's mode is fixed at import.
5215
+ this.deferredRenderer = false;
5216
+ // Whether this instance imported the file in `riveFile` (true) or the caller
5217
+ // supplied it (false). Only a file we imported may be released without a
5218
+ // matching getInstance(): a caller's file is theirs however this init ends.
5219
+ this.ownsRiveFile = false;
5054
5220
  // Runtime artboard
5055
5221
  this.artboard = null;
5056
5222
  // place to clear up pointer/touch event listeners
@@ -5185,6 +5351,7 @@ var Rive = /** @class */ (function () {
5185
5351
  _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
5186
5352
  this._focusOptions = (_c = params.focusOptions) !== null && _c !== void 0 ? _c : this._focusOptions;
5187
5353
  this._tabIndex = (_d = params.tabIndex) !== null && _d !== void 0 ? _d : null;
5354
+ this.deferredRenderer = !!params.enableGPUCanvas;
5188
5355
  // New event management system
5189
5356
  this.eventManager = new EventManager();
5190
5357
  if (params.onLoad)
@@ -5241,6 +5408,7 @@ var Rive = /** @class */ (function () {
5241
5408
  tabIndex: params.tabIndex,
5242
5409
  semanticsMode: params.semanticsMode,
5243
5410
  semanticsOptions: params.semanticsOptions,
5411
+ enableGPUCanvas: this.deferredRenderer,
5244
5412
  });
5245
5413
  }
5246
5414
  Object.defineProperty(Rive.prototype, "viewModelCount", {
@@ -5300,26 +5468,52 @@ var Rive = /** @class */ (function () {
5300
5468
  // Initializes the Rive object either from constructor or load()
5301
5469
  Rive.prototype.init = function (_a) {
5302
5470
  var _this = this;
5303
- var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c, _d = _a.autoBind, autoBind = _d === void 0 ? false : _d, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions;
5471
+ var _b, _c, _d, _e, _f;
5472
+ var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _g = _a.autoplay, autoplay = _g === void 0 ? false : _g, _h = _a.useOffscreenRenderer, useOffscreenRenderer = _h === void 0 ? false : _h, _j = _a.autoBind, autoBind = _j === void 0 ? false : _j, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions, enableGPUCanvas = _a.enableGPUCanvas;
5304
5473
  if (this.destroyed) {
5305
5474
  return;
5306
5475
  }
5476
+ // Validated before any state changes, so a call with no source leaves a
5477
+ // running instance untouched.
5478
+ if (!src && !buffer && !riveFile) {
5479
+ throw new RiveError(Rive.missingErrorMessage);
5480
+ }
5481
+ // Reload releases the outgoing file in the same order cleanup() uses:
5482
+ // artboard, then the renderer's session, then the file. The artboard goes
5483
+ // first because it holds an rcp<File> and its resources came from the
5484
+ // session about to be released. stop() has already deleted the animation
5485
+ // and state machine instances; reload deliberately skips cleanupInstances(),
5486
+ // which would also drop the event listeners load() keeps in place.
5487
+ if (this.artboard) {
5488
+ // Free GPU-backed resources with their own context current. No-op on
5489
+ // the canvas2d build.
5490
+ (_c = (_b = this.renderer) === null || _b === void 0 ? void 0 : _b.bindContext) === null || _c === void 0 ? void 0 : _c.call(_b);
5491
+ (_d = this.animator) === null || _d === void 0 ? void 0 : _d.stop();
5492
+ this.artboard.delete();
5493
+ this.artboard = null;
5494
+ }
5495
+ // Detach before the session is deleted: the handle dies with it.
5496
+ if (this.renderer) {
5497
+ (_f = (_e = this.renderer).detachSession) === null || _f === void 0 ? void 0 : _f.call(_e);
5498
+ }
5499
+ this.releaseCurrentRiveFile(/* isTeardown */ false);
5307
5500
  this.src = src;
5308
5501
  this.buffer = buffer;
5309
5502
  this.riveFile = riveFile;
5503
+ // initData flips this if it ends up importing the file itself.
5504
+ this.ownsRiveFile = false;
5505
+ // Sticky across reloads so a constructor-set flag survives; an explicit
5506
+ // `false` still turns it off.
5507
+ this.deferredRenderer = enableGPUCanvas !== null && enableGPUCanvas !== void 0 ? enableGPUCanvas : this.deferredRenderer;
5310
5508
  this._tabIndex = tabIndex !== null && tabIndex !== void 0 ? tabIndex : null;
5311
5509
  this.semanticsMode = semanticsMode !== null && semanticsMode !== void 0 ? semanticsMode : _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Disabled;
5312
5510
  this.semanticsOptions = semanticsOptions !== null && semanticsOptions !== void 0 ? semanticsOptions : this.semanticsOptions;
5313
- // If no source file url specified, it's a bust
5314
- if (!this.src && !this.buffer && !this.riveFile) {
5315
- throw new RiveError(Rive.missingErrorMessage);
5316
- }
5317
5511
  // Names of the animations and state machines that should be initialized
5318
- var _e = resolveStartingPlayback({
5512
+ var _k = resolveStartingPlayback({
5319
5513
  stateMachine: stateMachine,
5320
5514
  animations: animations,
5321
5515
  stateMachines: stateMachines,
5322
- }), startingAnimationNames = _e.startingAnimationNames, startingStateMachineNames = _e.startingStateMachineNames;
5516
+ }), startingAnimationNames = _k.startingAnimationNames, startingStateMachineNames = _k.startingStateMachineNames;
5323
5517
  // Ensure loaded is marked as false if loading new file
5324
5518
  this.loaded = false;
5325
5519
  this.readyForPlaying = false;
@@ -5339,6 +5533,8 @@ var Rive = /** @class */ (function () {
5339
5533
  if (_this.enablePerfMarks)
5340
5534
  performance.mark('rive:make-renderer:start');
5341
5535
  try {
5536
+ // Always immediate at creation; a deferred file attaches its session
5537
+ // to this renderer once the file has loaded.
5342
5538
  _this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
5343
5539
  if (!_this.renderer) {
5344
5540
  throw new Error("Renderer is null, cannot render Rive on the canvas.");
@@ -5491,32 +5687,52 @@ var Rive = /** @class */ (function () {
5491
5687
  // Returns true for successful initialization.
5492
5688
  Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
5493
5689
  return __awaiter(this, void 0, void 0, function () {
5494
- var riveFile, error_3, msg;
5495
- var _a;
5496
- return __generator(this, function (_b) {
5497
- switch (_b.label) {
5690
+ var riveFile, error_4, msg;
5691
+ var _a, _b;
5692
+ return __generator(this, function (_c) {
5693
+ switch (_c.label) {
5498
5694
  case 0:
5499
- _b.trys.push([0, 3, , 4]);
5500
- if (!(this.riveFile == null)) return [3 /*break*/, 2];
5695
+ _c.trys.push([0, 5, , 6]);
5696
+ // A caller-supplied riveFile is theirs to release; one we import here is
5697
+ // ours, which matters if a deferred fallback replaces it below.
5698
+ this.ownsRiveFile = this.riveFile == null;
5699
+ if (!this.ownsRiveFile) return [3 /*break*/, 2];
5501
5700
  riveFile = new RiveFile({
5502
5701
  src: this.src,
5503
5702
  buffer: this.buffer,
5504
5703
  enableRiveAssetCDN: this.enableRiveAssetCDN,
5505
5704
  assetLoader: this.assetLoader,
5506
5705
  enablePerfMarks: this.enablePerfMarks,
5706
+ // The instance owns this file, so its flag is the file's flag.
5707
+ enableGPUCanvas: this.deferredRenderer,
5507
5708
  });
5508
5709
  this.riveFile = riveFile;
5509
5710
  return [4 /*yield*/, riveFile.init()];
5510
5711
  case 1:
5511
- _b.sent();
5712
+ _c.sent();
5512
5713
  if (this.destroyed) {
5513
5714
  // In the very unlikely scenario where the rive file created by this Rive is shared by
5514
5715
  // another rive file, we only want to destroy it if this file is the only owner.
5515
5716
  riveFile.destroyIfUnused();
5516
5717
  return [2 /*return*/, false];
5517
5718
  }
5518
- _b.label = 2;
5719
+ _c.label = 2;
5519
5720
  case 2:
5721
+ if (!(this.riveFile.deferredSession !== null || this.deferredRenderer)) return [3 /*break*/, 4];
5722
+ return [4 /*yield*/, this.resolveDeferredRendering()];
5723
+ case 3:
5724
+ _c.sent();
5725
+ if (this.destroyed) {
5726
+ // cleanup() ran during a re-import. Taking a reference now would
5727
+ // resurrect a file this instance is never going to draw. Only ours
5728
+ // to release — a caller-supplied file stays theirs.
5729
+ if (this.ownsRiveFile) {
5730
+ (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.destroyIfUnused();
5731
+ }
5732
+ return [2 /*return*/, false];
5733
+ }
5734
+ _c.label = 4;
5735
+ case 4:
5520
5736
  this.file = this.riveFile.getInstance();
5521
5737
  // Initialize and draw frame
5522
5738
  this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay, autoBind);
@@ -5535,7 +5751,7 @@ var Rive = /** @class */ (function () {
5535
5751
  this.loaded = true;
5536
5752
  this.eventManager.fire({
5537
5753
  type: EventType.Load,
5538
- data: (_a = this.src) !== null && _a !== void 0 ? _a : "buffer",
5754
+ data: (_b = this.src) !== null && _b !== void 0 ? _b : "buffer",
5539
5755
  });
5540
5756
  }
5541
5757
  catch (e) {
@@ -5553,12 +5769,114 @@ var Rive = /** @class */ (function () {
5553
5769
  this.taskQueue.process();
5554
5770
  this.drawFrame();
5555
5771
  return [2 /*return*/, true];
5556
- case 3:
5557
- error_3 = _b.sent();
5558
- msg = resolveErrorMessage(error_3);
5772
+ case 5:
5773
+ error_4 = _c.sent();
5774
+ msg = resolveErrorMessage(error_4);
5559
5775
  this.eventManager.fire({ type: EventType.LoadError, data: msg });
5560
5776
  return [2 /*return*/, Promise.reject(msg)];
5561
- case 4: return [2 /*return*/];
5777
+ case 6: return [2 /*return*/];
5778
+ }
5779
+ });
5780
+ });
5781
+ };
5782
+ /**
5783
+ * Settles which rendering mode this Rive instance runs in. The file dictates: its rendering mode
5784
+ * is fixed at import, and an immediate renderer silently drops a deferred
5785
+ * file's resources. Every mismatch warns and degrades to something that
5786
+ * renders, so users shouldn't have a blank canvas. A fallback self-reimport replaces `this.riveFile`;
5787
+ * only a file this instance imported is released when that happens.
5788
+ */
5789
+ Rive.prototype.resolveDeferredRendering = function () {
5790
+ return __awaiter(this, void 0, void 0, function () {
5791
+ var file, ownsFile, renderer, session, attachSession, immediate, copy, copySession, fallback;
5792
+ var _a;
5793
+ return __generator(this, function (_b) {
5794
+ switch (_b.label) {
5795
+ case 0:
5796
+ file = this.riveFile;
5797
+ ownsFile = this.ownsRiveFile;
5798
+ renderer = this.renderer;
5799
+ session = file.deferredSession;
5800
+ if (session === null) {
5801
+ // No second warning when the file asked for deferred and the build
5802
+ // could not honor it; the unsupported-build warning already fired, and
5803
+ // telling the user to set a flag they set would mislead.
5804
+ if (this.deferredRenderer && !file.deferredRequested) {
5805
+ 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.");
5806
+ }
5807
+ return [2 /*return*/];
5808
+ }
5809
+ if (!this.deferredRenderer) {
5810
+ 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.");
5811
+ }
5812
+ attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
5813
+ if (!(typeof attachSession !== "function")) return [3 /*break*/, 2];
5814
+ // Offscreen renderers share one context across canvases, which a session
5815
+ // cannot record for. An immediate copy of the file still renders.
5816
+ 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.");
5817
+ return [4 /*yield*/, file.reimport(false)];
5818
+ case 1:
5819
+ immediate = _b.sent();
5820
+ if (this.destroyed) {
5821
+ // cleanup() ran while we were importing; nothing will use this copy.
5822
+ immediate.destroyIfUnused();
5823
+ return [2 /*return*/];
5824
+ }
5825
+ this.riveFile = immediate;
5826
+ this.ownsRiveFile = true;
5827
+ if (ownsFile) {
5828
+ // Nothing else can reach the deferred import we just walked away from.
5829
+ file.destroyIfUnused();
5830
+ }
5831
+ return [2 /*return*/];
5832
+ case 2:
5833
+ // Never re-offered once claimed, even if that renderer is gone: the
5834
+ // resources the session's stream refers to died with it.
5835
+ if (!file.sessionClaimed && attachSession.call(renderer, session)) {
5836
+ file.claimSession();
5837
+ return [2 /*return*/];
5838
+ }
5839
+ // Bound to another instance. Re-import from the retained buffer into a
5840
+ // session of our own.
5841
+ file.warnBoundElsewhereOnce();
5842
+ return [4 /*yield*/, file.reimport(true)];
5843
+ case 3:
5844
+ copy = _b.sent();
5845
+ if (this.destroyed) {
5846
+ // The renderer was deleted while we imported; attaching to it would hand
5847
+ // embind a deleted object.
5848
+ copy.destroyIfUnused();
5849
+ return [2 /*return*/];
5850
+ }
5851
+ this.riveFile = copy;
5852
+ this.ownsRiveFile = true;
5853
+ copySession = copy.deferredSession;
5854
+ if (copySession !== null && attachSession.call(renderer, copySession)) {
5855
+ copy.claimSession();
5856
+ return [2 /*return*/];
5857
+ }
5858
+ // The copy's session could not take this canvas either (this renderer
5859
+ // already holds one). An immediate re-import still renders; a deferred file
5860
+ // on an immediate renderer would drop its resources and draw nothing.
5861
+ console.warn("Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.");
5862
+ // If a leftover session is why the attach failed, it would keep routing
5863
+ // the immediate file's draws into its recorder, which drops them.
5864
+ (_a = renderer.detachSession) === null || _a === void 0 ? void 0 : _a.call(renderer);
5865
+ return [4 /*yield*/, file.reimport(false)];
5866
+ case 4:
5867
+ fallback = _b.sent();
5868
+ // The deferred copy was only ever ours, so it always goes.
5869
+ copy.destroyIfUnused();
5870
+ if (this.destroyed) {
5871
+ fallback.destroyIfUnused();
5872
+ return [2 /*return*/];
5873
+ }
5874
+ this.riveFile = fallback;
5875
+ this.ownsRiveFile = true;
5876
+ if (ownsFile) {
5877
+ file.destroyIfUnused();
5878
+ }
5879
+ return [2 /*return*/];
5562
5880
  }
5563
5881
  });
5564
5882
  });
@@ -5653,6 +5971,13 @@ var Rive = /** @class */ (function () {
5653
5971
  }
5654
5972
  return changed;
5655
5973
  };
5974
+ // Content the artboard's change flag cannot see: ore and GPU canvas commands
5975
+ // scripts record straight into the session. Must be read before the renderer
5976
+ // clears — clearing marks the stream, so a later read is true every frame.
5977
+ Rive.prototype._deferredWorkPending = function () {
5978
+ var _a, _b, _c;
5979
+ return (_c = (_b = (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredSession) === null || _b === void 0 ? void 0 : _b.recordedThisFrame()) !== null && _c !== void 0 ? _c : false;
5980
+ };
5656
5981
  /**
5657
5982
  * Poll focus state each frame to see if we should focus/blur the canvas in case
5658
5983
  * Rive internally updated focus outside of user interaction (e.g., via listener action)
@@ -5862,6 +6187,11 @@ var Rive = /** @class */ (function () {
5862
6187
  Rive.prototype.draw = function (time, onSecond) {
5863
6188
  // Clear the frameRequestId, as we're now rendering a fresh frame
5864
6189
  this.frameRequestId = null;
6190
+ // load() tears the artboard down and re-inits asynchronously; a frame
6191
+ // queued before that lands here with nothing to draw.
6192
+ if (!this.artboard) {
6193
+ return;
6194
+ }
5865
6195
  var before = performance.now();
5866
6196
  // Instrument the first 3 frames so the Performance timeline shows precise
5867
6197
  // per-call latency for advance, draw, and flush without polluting the trace.
@@ -5883,9 +6213,13 @@ var Rive = /** @class */ (function () {
5883
6213
  var renderer = this.renderer;
5884
6214
  // Do not draw on 0 canvas size
5885
6215
  if (!this._hasZeroSize) {
5886
- // If there was no dirt on this frame, do not clear and draw
6216
+ // If there was no dirt on this frame, do not clear and draw. The deferred
6217
+ // term has to be read here, before `clear()` below: clearing opens the
6218
+ // session's recording window and marks its stream, so a read taken after
6219
+ // it reports every frame as dirty and nothing is ever skipped.
5887
6220
  if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
5888
6221
  this.artboard.didChange() ||
6222
+ this._deferredWorkPending() ||
5889
6223
  this._needsRedraw ||
5890
6224
  this._canvasSizeChanged()) {
5891
6225
  // Canvas must be wiped to prevent artifacts
@@ -5983,7 +6317,7 @@ var Rive = /** @class */ (function () {
5983
6317
  * Rive class
5984
6318
  */
5985
6319
  Rive.prototype.cleanup = function () {
5986
- var _a, _b, _c, _d;
6320
+ var _a, _b, _c, _d, _e;
5987
6321
  this.destroyed = true;
5988
6322
  // Stop the renderer if it hasn't already been stopped.
5989
6323
  this.stopRendering();
@@ -5999,10 +6333,14 @@ var Rive = /** @class */ (function () {
5999
6333
  observers.remove(this._observed);
6000
6334
  }
6001
6335
  this.removeRiveListeners();
6002
- if (this.file) {
6003
- (_c = this.riveFile) === null || _c === void 0 ? void 0 : _c.cleanup();
6004
- this.file = null;
6005
- }
6336
+ // The file and its session go before the renderer: the session's replay
6337
+ // state lives in the renderer's context. But the renderer must let go of
6338
+ // the session first — its detach handle dies with session.delete(), and a
6339
+ // later detach would pass embind a deleted object.
6340
+ if (this.renderer) {
6341
+ (_d = (_c = this.renderer).detachSession) === null || _d === void 0 ? void 0 : _d.call(_c);
6342
+ }
6343
+ this.releaseCurrentRiveFile(/* isTeardown */ true);
6006
6344
  this.riveFile = null;
6007
6345
  this.deleteRiveRenderer();
6008
6346
  if (this._audioEventListener !== null) {
@@ -6013,21 +6351,65 @@ var Rive = /** @class */ (function () {
6013
6351
  document.removeEventListener('visibilitychange', this._pageVisibilityHandler);
6014
6352
  this._pageVisibilityHandler = null;
6015
6353
  }
6016
- (_d = this._viewModelInstance) === null || _d === void 0 ? void 0 : _d.cleanup();
6354
+ (_e = this._viewModelInstance) === null || _e === void 0 ? void 0 : _e.cleanup();
6017
6355
  this._viewModelInstance = null;
6018
6356
  this._globalViewModelInstances.forEach(function (instance) { return instance.cleanup(); });
6019
6357
  this._globalViewModelInstances.clear();
6020
6358
  this._dataEnums = null;
6021
6359
  };
6360
+ /**
6361
+ * Drops this instance's hold on `this.riveFile`. A reference taken through
6362
+ * getInstance() is given back; a file we imported but never referenced is
6363
+ * released outright so its session goes with it. A caller-supplied file we
6364
+ * never referenced is left alone.
6365
+ *
6366
+ * `isTeardown` distinguishes cleanup() from a reload. Teardown always hands
6367
+ * the reference back, as it always has. A reload must not do that for a
6368
+ * caller-supplied file: a RiveFile carries no reference for its creator, so
6369
+ * releasing here would take the last one and destroy a file the caller still
6370
+ * holds.
6371
+ */
6372
+ Rive.prototype.releaseCurrentRiveFile = function (isTeardown) {
6373
+ var _a, _b;
6374
+ if (this.file) {
6375
+ if (isTeardown || this.ownsRiveFile) {
6376
+ (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
6377
+ }
6378
+ this.file = null;
6379
+ }
6380
+ else if (this.ownsRiveFile) {
6381
+ (_b = this.riveFile) === null || _b === void 0 ? void 0 : _b.destroyIfUnused();
6382
+ }
6383
+ };
6022
6384
  /**
6023
6385
  * Cleans up the Renderer object. Only call this API if you no longer
6024
6386
  * need to render Rive content in your session.
6025
6387
  */
6026
6388
  Rive.prototype.deleteRiveRenderer = function () {
6027
- var _a;
6028
- (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.delete();
6389
+ var _a, _b;
6390
+ if (this.renderer) {
6391
+ // A session outliving this renderer has to stop pointing at it, and its
6392
+ // replay state has to drop while this context is still alive. No-op when
6393
+ // nothing was ever attached.
6394
+ (_b = (_a = this.renderer).detachSession) === null || _b === void 0 ? void 0 : _b.call(_a);
6395
+ this.renderer.delete();
6396
+ }
6029
6397
  this.renderer = null;
6030
6398
  };
6399
+ Object.defineProperty(Rive.prototype, "deferredRendererActive", {
6400
+ /**
6401
+ * @experimental This API is early and may encounter breaking behavior change without a major version bump
6402
+ *
6403
+ * Whether this instance is rendering through a deferred session. False whenever
6404
+ * a fallback ran, whatever was requested.
6405
+ */
6406
+ get: function () {
6407
+ var _a, _b, _c;
6408
+ return (_c = (_b = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.deferredActive) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : false;
6409
+ },
6410
+ enumerable: false,
6411
+ configurable: true
6412
+ });
6031
6413
  /**
6032
6414
  * Cleans up any Wasm-generated objects that need to be manually destroyed:
6033
6415
  * artboard instances, animation instances, state machine instances.
@@ -6259,7 +6641,10 @@ var Rive = /** @class */ (function () {
6259
6641
  };
6260
6642
  // Loads a new Rive file, keeping listeners in place
6261
6643
  Rive.prototype.load = function (params) {
6262
- this.file = null;
6644
+ // Before stop(), so a call with no source leaves playback running.
6645
+ if (!params.src && !params.buffer && !params.riveFile) {
6646
+ throw new RiveError(Rive.missingErrorMessage);
6647
+ }
6263
6648
  // Stop all animations
6264
6649
  this.stop();
6265
6650
  // Reinitialize
@@ -8123,7 +8508,7 @@ var decodeAudio = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
8123
8508
  case 0:
8124
8509
  decodedPromise = new Promise(function (resolve) {
8125
8510
  return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
8126
- rive.decodeAudio(bytes, resolve);
8511
+ rive.decodeAudio(bytes, resolve, null);
8127
8512
  });
8128
8513
  });
8129
8514
  return [4 /*yield*/, decodedPromise];
@@ -8148,7 +8533,7 @@ var decodeImage = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
8148
8533
  case 0:
8149
8534
  decodedPromise = new Promise(function (resolve) {
8150
8535
  return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
8151
- rive.decodeImage(bytes, resolve);
8536
+ rive.decodeImage(bytes, resolve, null);
8152
8537
  });
8153
8538
  });
8154
8539
  return [4 /*yield*/, decodedPromise];
@@ -8173,7 +8558,7 @@ var decodeFont = function (bytes) { return __awaiter(void 0, void 0, void 0, fun
8173
8558
  case 0:
8174
8559
  decodedPromise = new Promise(function (resolve) {
8175
8560
  return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
8176
- rive.decodeFont(bytes, resolve);
8561
+ rive.decodeFont(bytes, resolve, null);
8177
8562
  });
8178
8563
  });
8179
8564
  return [4 /*yield*/, decodedPromise];