@rive-app/webgl2 2.41.0 → 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/package.json +1 -1
- package/rive.d.ts +102 -0
- package/rive.js +634 -194
- package/rive.js.map +1 -1
- package/rive.wasm +0 -0
- package/rive_advanced.mjs.d.ts +114 -17
- package/rive_fallback.wasm +0 -0
- package/semantics/index.d.ts +1 -1
- package/semantics/types.d.ts +15 -2
- package/utils/finalizationRegistry.d.ts +7 -3
package/rive.js
CHANGED
|
@@ -350,142 +350,146 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
350
350
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
351
351
|
/* harmony export */ });
|
|
352
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 ca(){function a(g){const h=d;c=b=0;d=new Map;h.forEach(k=>{try{k(g)}catch(
|
|
354
|
-
"fixed",f.style.right=0,f.style.top=0,f.style.color="white",f.style.padding="4px",f.innerHTML="RIVE FPS",g=function(h){f.innerHTML="RIVE FPS "+h.toFixed(1)},document.body.appendChild(f));e=new function(){let h=0,k=0;this.
|
|
353
|
+
function ca(){function a(g){const h=d;c=b=0;d=new Map;h.forEach(k=>{try{k(g)}catch(n){console.error(n)}});this.ue();e&&e.Xe()}let b=0,c=0,d=new Map,e=null,f=null;this.requestAnimationFrame=function(g){b||=requestAnimationFrame(a.bind(this));const h=++c;d.set(h,g);return h};this.cancelAnimationFrame=function(g){d.delete(g);b&&0==d.size&&(cancelAnimationFrame(b),b=0)};this.Te=function(g){f&&(document.body.remove(f),f=null);g||(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",g=function(h){f.innerHTML="RIVE FPS "+h.toFixed(1)},document.body.appendChild(f));e=new function(){let h=0,k=0;this.Xe=function(){var n=performance.now();k?(++h,n-=k,1E3<n&&(g(1E3*h/n),h=k=0)):(k=n,h=0)}}};this.ue=function(){}}
|
|
355
355
|
function da(){console.assert(!0);const a=new Map;let b=-Infinity;this.push=function(c){c=c+255>>8;a.has(c)&&clearTimeout(a.get(c));a.set(c,setTimeout(function(){a.delete(c);0==a.length?b=-Infinity:c==b&&(b=Math.max(...a.keys()),console.assert(b<c))},1E3));b=Math.max(c,b);return b<<8}}const ea=l.onRuntimeInitialized;
|
|
356
|
-
l.onRuntimeInitialized=function(){ea&&ea();let a=l.decodeAudio;l.decodeAudio=function(
|
|
357
|
-
g.isAudio?l.ptrToAudioAsset(
|
|
358
|
-
|
|
359
|
-
k,
|
|
360
|
-
l.onRuntimeInitialized=function(){function a(
|
|
361
|
-
this.
|
|
362
|
-
|
|
363
|
-
H;e.clear();if(!(0>=
|
|
364
|
-
|
|
365
|
-
l.makeRenderer=function(
|
|
366
|
-
(d.
|
|
367
|
-
|
|
368
|
-
|
|
356
|
+
l.onRuntimeInitialized=function(){ea&&ea();let a=l.decodeAudio;l.decodeAudio=function(g,h,k=null){g=a(g,k??null);h(g)};let b=l.decodeFont;l.decodeFont=function(g,h,k=null){g=b(g,k??null);h(g)};const c=l.FileAsset.prototype.decode;l.FileAsset.prototype.decode=function(g,h){return c.call(this,g,h??null)};let d=l.setFallbackFontCb;l.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=l.FileAssetLoader;l.ptrToAsset=g=>{let h=l.ptrToFileAsset(g);return h.isImage?l.ptrToImageAsset(g):h.isFont?l.ptrToFontAsset(g):h.isAudio?l.ptrToAudioAsset(g):h};l.CustomFileAssetLoader=e.extend("CustomFileAssetLoader",{__construct:function({loadContents:g}){this.__parent.__construct.call(this);this.Ie=g},loadContents:function(g,h){g=l.ptrToAsset(g);return this.Ie(g,h)}});l.CDNFileAssetLoader=e.extend("CDNFileAssetLoader",{__construct:function(g){this.__parent.__construct.call(this);this.Le=
|
|
358
|
+
g??null},loadContents:function(g){let h=l.ptrToAsset(g);g=h.cdnUuid;if(""===g)return!1;const k=this.Le??null;(function(n,p){var u=new XMLHttpRequest;u.responseType="arraybuffer";u.onreadystatechange=function(){4==u.readyState&&200==u.status&&p(u)};u.open("GET",n,!0);u.send(null)})(h.cdnBaseUrl+"/"+g,n=>{h.decode(new Uint8Array(n.response),k)});return!0}});l.FallbackFileAssetLoader=e.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this);this.pe=[]},addLoader:function(g){this.pe.push(g)},
|
|
359
|
+
loadContents:function(g,h){for(let k of this.pe)if(k.loadContents(g,h))return!0;return!1}});let f=l.computeAlignment;l.computeAlignment=function(g,h,k,n,p=1){return f.call(this,g,h,k,n,p)}};const fa=l.onRuntimeInitialized;
|
|
360
|
+
l.onRuntimeInitialized=function(){function a(q){this.Uc=q;this.He=q.getContext("2d");this.je=d;this.fd=[];this.xd=0;this.clear=function(){console.assert(0==this.xd);this.fd=[];e.delete(this)};this.save=function(){++this.xd;this.fd.push(d.save.bind(d))};this.restore=function(){0<this.xd&&(this.fd.push(d.restore.bind(d)),--this.xd)};this.transform=function(r){this.fd.push(d.transform.bind(d,r))};this.align=function(r,x,y,z,F=1){this.fd.push(d.align.bind(d,r,x,y,z,F))};this.flush=function(){console.assert(0==
|
|
361
|
+
this.xd);e.add(this);d.ie||c()};this.bindContext=function(){const r=this.je;r&&r.pd&&ha(r.pd)};this["delete"]=function(){}}function b(q,r=!1){var x={alpha:!0,depth:r,stencil:r,antialias:r,premultipliedAlpha:!0,preserveDrawingBuffer:0,powerPreference:"high-performance",failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:!1,explicitSwapControl:0,renderViaOffscreenBackBuffer:0};r=q.getContext("webgl2",x);if(!r)return null;x=ia(r,x);ha(x);const y=f(q.width,q.height);y.pd=x;y.Uc=q;y.Xd=q.width;y.Wd=
|
|
362
|
+
q.height;y.gd=r;y.Ne=function(){this.pd&&ha(this.pd)};var z=y.delete;y.delete=function(){this.Ne();z.call(this);var F=this.pd;m===v[F]&&(m=null);"object"==typeof JSEvents&&JSEvents.Tf(v[F].Tc.canvas);v[F]?.Tc.canvas&&(v[F].Tc.canvas.Ge=void 0);this.pd=this.Uc=this.Xd=this.Wd=this.gd=v[F]=null};return y}function c(){if(d){var q=d.Ke,r=0,x=0,y=0,z=Array(e.size),F=0;for(var H of e)H.td=Math.min(H.Uc.width,q),H.sd=Math.min(H.Uc.height,q),H.Ud=H.sd*H.td,r=Math.max(r,H.td),x=Math.max(x,H.sd),y+=H.Ud,z[F++]=
|
|
363
|
+
H;e.clear();if(!(0>=y)){r=1<<(0>=r?0:32-Math.clz32(r-1));for(x=1<<(0>=x?0:32-Math.clz32(x-1));x*r<y;)r<=x?r*=2:x*=2;r=Math.min(r,q);r=Math.min(x,q);z.sort((W,cb)=>cb.Ud-W.Ud);y=new l.DynamicRectanizer(q);for(H=0;H<z.length;){y.reset(r,x);for(F=H;F<z.length;++F){var I=z[F],G=y.addRect(I.td,I.sd);if(0>G){console.assert(F>H);break}I.Fd=G&65535;I.Gd=G>>16}I=k.push(y.drawWidth());G=n.push(y.drawHeight());console.assert(I>=y.drawWidth());console.assert(G>=y.drawHeight());console.assert(I<=q);console.assert(G<=
|
|
364
|
+
q);d.Uc.width!=I&&(d.Uc.width=I);d.Uc.height!=G&&(d.Uc.height=G);d.clear();for(I=H;I<F;++I){G=z[I];d.saveClipRect(G.Fd,G.Gd,G.Fd+G.td,G.Gd+G.sd);let W=new l.Mat2D;W.xx=G.td/G.Uc.width;W.yy=G.sd/G.Uc.height;W.xy=W.yx=0;W.tx=G.Fd;W.ty=G.Gd;d.transform(W);for(const cb of G.fd)cb();d.restoreClipRect();G.fd=[]}for(d.flush();H<F;++H)I=z[H],G=I.He,G.globalCompositeOperation="copy",G.drawImage(d.Uc,I.Fd,I.Gd,I.td,I.sd,0,0,I.Uc.width,I.Uc.height);H=F}}}}fa&&fa();let d=null;const e=new Set,f=l.makeRenderer;
|
|
365
|
+
l.makeRenderer=function(q,r){if(!d){function x(y){var z=document.createElement("canvas");z.width=1;z.height=1;d=b(z,y);if(!d)return null;d.ie=!!d.gd.getExtension("WEBGL_shader_pixel_local_storage");d.Ke=Math.min(d.gd.getParameter(d.gd.MAX_RENDERBUFFER_SIZE),d.gd.getParameter(d.gd.MAX_TEXTURE_SIZE));d.Vd=!d.ie;if(y=d.gd.getExtension("WEBGL_debug_renderer_info"))z=d.gd.getParameter(y.UNMASKED_RENDERER_WEBGL),d.gd.getParameter(y.UNMASKED_VENDOR_WEBGL).includes("Google")&&z.includes("ANGLE Metal Renderer")&&
|
|
366
|
+
(d.Vd=!1);return d}d=x(!0);if(!d)throw"Unable to create WebGL context, your environment may not support WebGL. Try out @rive-app/canvas as an alternative.";d.Vd||(d=x(!1))}return r?new a(q):b(q,d.Vd)};const g=l.Artboard.prototype["delete"];l.Artboard.prototype["delete"]=function(){this.Me=!0;g.call(this)};const h=l.Artboard.prototype.draw;l.Artboard.prototype.draw=function(q){q.fd?q.fd.push(()=>{this.Me||h.call(this,q.je)}):h.call(this,q)};const k=new da,n=new da,p=new ca;l.requestAnimationFrame=
|
|
367
|
+
p.requestAnimationFrame.bind(p);l.cancelAnimationFrame=p.cancelAnimationFrame.bind(p);l.enableFPSCounter=p.Te.bind(p);p.ue=c;l.resolveAnimationFrame=c;let u=l.load;l.load=function(q,r,x=!0,y=null){const z=new l.FallbackFileAssetLoader;void 0!==r&&z.addLoader(r);x&&(r=new l.CDNFileAssetLoader(y),z.addLoader(r));return Promise.resolve(u(q,z,y??null))};const t=l.WebGL2Renderer.prototype.clear;l.WebGL2Renderer.prototype.clear=function(){ha(this.pd);const q=this.Uc;if(this.Xd!=q.width||this.Wd!=q.height)this.resize(q.width,
|
|
368
|
+
q.height),this.Xd=q.width,this.Wd=q.height;t.call(this)};l.decodeImage=function(q,r,x=null){q=l.decodeWebGL2Image(q,x??null);r(q)};let C=l.Renderer.prototype.align;l.Renderer.prototype.align=function(q,r,x,y,z=1){C.call(this,q,r,x,y,z)}};var ja="./this.program";ba&&(_scriptName=self.location.href);var ka="",la,ma;
|
|
369
369
|
if(aa||ba){try{ka=(new URL(".",_scriptName)).href}catch{}ba&&(ma=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});la=async a=>{if(na(a))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!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 b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+
|
|
370
|
-
" : "+b.url);}}var oa=console.log.bind(console),
|
|
371
|
-
function Ba(a){l.onAbort?.(a);a="Aborted("+a+")";
|
|
372
|
-
async function Ea(a,b){try{var c=await Da(a);return await WebAssembly.instantiate(c,b)}catch(d){
|
|
373
|
-
var Ga=a=>{for(;0<a.length;)a.shift()(l)},Ha=[],Ia=[],Ja=()=>{var a=l.preRun.shift();Ia.push(a)},K=()=>{var a=
|
|
370
|
+
" : "+b.url);}}var oa=console.log.bind(console),w=console.error.bind(console),pa,qa=!1,na=a=>a.startsWith("file://"),ra,sa,A,B,D,ta,E,J,ua,va,wa,xa,ya=!1;function za(){var a=Aa.buffer;l.HEAP8=A=new Int8Array(a);D=new Int16Array(a);l.HEAPU8=B=new Uint8Array(a);l.HEAPU16=ta=new Uint16Array(a);l.HEAP32=E=new Int32Array(a);l.HEAPU32=J=new Uint32Array(a);l.HEAPF32=ua=new Float32Array(a);va=new Float64Array(a);wa=new BigInt64Array(a);xa=new BigUint64Array(a)}
|
|
371
|
+
function Ba(a){l.onAbort?.(a);a="Aborted("+a+")";w(a);qa=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");sa?.(a);throw a;}var Ca;async function Da(a){if(!pa)try{var b=await la(a);return new Uint8Array(b)}catch{}if(a==Ca&&pa)a=new Uint8Array(pa);else if(ma)a=ma(a);else throw"both async and sync fetching of the wasm failed";return a}
|
|
372
|
+
async function Ea(a,b){try{var c=await Da(a);return await WebAssembly.instantiate(c,b)}catch(d){w(`failed to asynchronously prepare wasm: ${d}`),Ba(d)}}async function Fa(a){var b=Ca;if(!pa&&!na(b))try{var c=fetch(b,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(c,a)}catch(d){w(`wasm streaming compile failed: ${d}`),w("falling back to ArrayBuffer instantiation")}return Ea(b,a)}
|
|
373
|
+
var Ga=a=>{for(;0<a.length;)a.shift()(l)},Ha=[],Ia=[],Ja=()=>{var a=l.preRun.shift();Ia.push(a)},K=()=>{var a=E[+Ka>>2];Ka+=4;return a},La=(a,b)=>{for(var c=0,d=a.length-1;0<=d;d--){var e=a[d];"."===e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a},Ma=a=>{var b="/"===a.charAt(0),c="/"===a.slice(-1);(a=La(a.split("/").filter(d=>!!d),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a},Na=a=>{var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);
|
|
374
374
|
a=b[0];b=b[1];if(!a&&!b)return".";b&&=b.slice(0,-1);return a+b},Oa=()=>a=>crypto.getRandomValues(a),Pa=a=>{(Pa=Oa())(a)},Qa=(...a)=>{for(var b="",c=!1,d=a.length-1;-1<=d&&!c;d--){c=0<=d?a[d]:"/";if("string"!=typeof c)throw new TypeError("Arguments to path.resolve must be strings");if(!c)return"";b=c+"/"+b;c="/"===c.charAt(0)}b=La(b.split("/").filter(e=>!!e),!c).join("/");return(c?"/":"")+b||"."},Ra=globalThis.TextDecoder&&new TextDecoder,Sa=(a,b,c,d)=>{c=b+c;if(d)return c;for(;a[b]&&!(b>=c);)++b;
|
|
375
375
|
return b},L=(a,b=0,c,d)=>{c=Sa(a,b,c,d);if(16<c-b&&a.buffer&&Ra)return Ra.decode(a.subarray(b,c));for(d="";b<c;){var e=a[b++];if(e&128){var f=a[b++]&63;if(192==(e&224))d+=String.fromCharCode((e&31)<<6|f);else{var g=a[b++]&63;e=224==(e&240)?(e&15)<<12|f<<6|g:(e&7)<<18|f<<12|g<<6|a[b++]&63;65536>e?d+=String.fromCharCode(e):(e-=65536,d+=String.fromCharCode(55296|e>>10,56320|e&1023))}}else d+=String.fromCharCode(e)}return d},Ta=[],Ua=a=>{for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);127>=d?b++:
|
|
376
|
-
2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b},
|
|
377
|
-
function
|
|
378
|
-
var
|
|
379
|
-
}d&&(a.node
|
|
380
|
-
0,0,0,0,0,0,0,0,0,0]}},
|
|
381
|
-
stream:{
|
|
382
|
-
a&&(a.
|
|
383
|
-
"atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.
|
|
384
|
-
d){e.
|
|
385
|
-
e,d);if(8<a&&f.subarray)b.set(f.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=f[e+d];return a},write(a,b,c,d,e,f){b.buffer===A.buffer&&(f=!1);if(!d)return 0;a=a.node;a
|
|
386
|
-
0<a.
|
|
387
|
-
c,c+b);A.set(a,e)}}else d=!1,e=a.byteOffset;return{
|
|
388
|
-
a;this.
|
|
389
|
-
function
|
|
390
|
-
d=d.
|
|
391
|
-
function
|
|
392
|
-
function
|
|
393
|
-
function
|
|
394
|
-
function
|
|
395
|
-
function Db(a,b,c=438){if(""===a)throw new
|
|
396
|
-
61440))throw new
|
|
397
|
-
|
|
398
|
-
function Fb(a,b,c){a=Ma("/dev/"+a);var d=
|
|
376
|
+
2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b},M=(a,b,c,d)=>{if(!(0<d))return 0;var e=c;d=c+d-1;for(var f=0;f<a.length;++f){var g=a.codePointAt(f);if(127>=g){if(c>=d)break;b[c++]=g}else if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6;b[c++]=128|g&63}else if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12;b[c++]=128|g>>6&63;b[c++]=128|g&63}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63;b[c++]=128|g>>6&63;b[c++]=128|g&63;f++}}b[c]=0;return c-e},Va=[];
|
|
377
|
+
function Wa(a,b){Va[a]={input:[],output:[],kd:b};Xa(a,Ya)}
|
|
378
|
+
var Ya={open(a){var b=Va[a.node.Rd];if(!b)throw new N(43);a.Mc=b;a.seekable=!1},close(a){a.Mc.kd.Hd(a.Mc)},Hd(a){a.Mc.kd.Hd(a.Mc)},read(a,b,c,d){if(!a.Mc||!a.Mc.kd.oe)throw new N(60);for(var e=0,f=0;f<d;f++){try{var g=a.Mc.kd.oe(a.Mc)}catch(h){throw new N(29);}if(void 0===g&&0===e)throw new N(6);if(null===g||void 0===g)break;e++;b[c+f]=g}e&&(a.node.qd=Date.now());return e},write(a,b,c,d){if(!a.Mc||!a.Mc.kd.ee)throw new N(60);try{for(var e=0;e<d;e++)a.Mc.kd.ee(a.Mc,b[c+e])}catch(f){throw new N(29);
|
|
379
|
+
}d&&(a.node.$c=a.node.Xc=Date.now());return e}},Za={oe(){a:{if(!Ta.length){var a=null;globalThis.window?.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){var b=null;break a}b=Array(Ua(a)+1);a=M(a,b,0,b.length);b.length=a;Ta=b}b=Ta.shift()}return b},ee(a,b){null===b||10===b?(oa(L(a.output)),a.output=[]):0!=b&&a.output.push(b)},Hd(a){0<a.output?.length&&(oa(L(a.output)),a.output=[])},ff(){return{Ef:25856,Gf:5,Df:191,Ff:35387,Cf:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,
|
|
380
|
+
0,0,0,0,0,0,0,0,0,0]}},gf(){return 0},hf(){return[24,80]}},$a={ee(a,b){null===b||10===b?(w(L(a.output)),a.output=[]):0!=b&&a.output.push(b)},Hd(a){0<a.output?.length&&(w(L(a.output)),a.output=[])}},O={cd:null,jd(){return O.createNode(null,"/",16895,0)},createNode(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new N(63);O.cd||(O.cd={dir:{node:{nd:O.Jc.nd,ed:O.Jc.ed,zd:O.Jc.zd,Od:O.Jc.Od,ze:O.Jc.ze,Ee:O.Jc.Ee,Be:O.Jc.Be,ge:O.Jc.ge,Td:O.Jc.Td},stream:{bd:O.Hc.bd}},file:{node:{nd:O.Jc.nd,ed:O.Jc.ed},
|
|
381
|
+
stream:{bd:O.Hc.bd,read:O.Hc.read,write:O.Hc.write,re:O.Hc.re,te:O.Hc.te}},link:{node:{nd:O.Jc.nd,ed:O.Jc.ed,Ad:O.Jc.Ad},stream:{}},ke:{node:{nd:O.Jc.nd,ed:O.Jc.ed},stream:ab}});c=bb(a,b,c,d);16384===(c.mode&61440)?(c.Jc=O.cd.dir.node,c.Hc=O.cd.dir.stream,c.Ic={}):32768===(c.mode&61440)?(c.Jc=O.cd.file.node,c.Hc=O.cd.file.stream,c.Qc=0,c.Ic=null):40960===(c.mode&61440)?(c.Jc=O.cd.link.node,c.Hc=O.cd.link.stream):8192===(c.mode&61440)&&(c.Jc=O.cd.ke.node,c.Hc=O.cd.ke.stream);c.qd=c.$c=c.Xc=Date.now();
|
|
382
|
+
a&&(a.Ic[b]=c,a.qd=a.$c=a.Xc=c.qd);return c},Lf(a){return a.Ic?a.Ic.subarray?a.Ic.subarray(0,a.Qc):new Uint8Array(a.Ic):new Uint8Array(0)},Jc:{nd(a){var b={};b.Hf=8192===(a.mode&61440)?a.id:1;b.Nf=a.id;b.mode=a.mode;b.Rf=1;b.uid=0;b.Mf=0;b.Rd=a.Rd;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.Qc:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.qd=new Date(a.qd);b.$c=new Date(a.$c);b.Xc=new Date(a.Xc);b.Oe=4096;b.Bf=Math.ceil(b.size/b.Oe);return b},ed(a,b){for(var c of["mode",
|
|
383
|
+
"atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.Qc!=b&&(0==b?(a.Ic=null,a.Qc=0):(c=a.Ic,a.Ic=new Uint8Array(b),c&&a.Ic.set(c.subarray(0,Math.min(b,a.Qc))),a.Qc=b)))},zd(){O.Zd||(O.Zd=new N(44),O.Zd.stack="<generic error, no stack>");throw O.Zd;},Od(a,b,c,d){return O.createNode(a,b,c,d)},ze(a,b,c){try{var d=db(b,c)}catch(f){}if(d){if(16384===(a.mode&61440))for(var e in d.Ic)throw new N(55);e=eb(d.parent.id,d.name);if(fb[e]===d)fb[e]=d.vd;else for(e=fb[e];e;){if(e.vd===
|
|
384
|
+
d){e.vd=d.vd;break}e=e.vd}}delete a.parent.Ic[a.name];b.Ic[c]=a;a.name=c;b.Xc=b.$c=a.parent.Xc=a.parent.$c=Date.now()},Ee(a,b){delete a.Ic[b];a.Xc=a.$c=Date.now()},Be(a,b){var c=db(a,b),d;for(d in c.Ic)throw new N(55);delete a.Ic[b];a.Xc=a.$c=Date.now()},ge(a){return[".","..",...Object.keys(a.Ic)]},Td(a,b,c){a=O.createNode(a,b,41471,0);a.link=c;return a},Ad(a){if(40960!==(a.mode&61440))throw new N(28);return a.link}},Hc:{read(a,b,c,d,e){var f=a.node.Ic;if(e>=a.node.Qc)return 0;a=Math.min(a.node.Qc-
|
|
385
|
+
e,d);if(8<a&&f.subarray)b.set(f.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=f[e+d];return a},write(a,b,c,d,e,f){b.buffer===A.buffer&&(f=!1);if(!d)return 0;a=a.node;a.$c=a.Xc=Date.now();if(b.subarray&&(!a.Ic||a.Ic.subarray)){if(f)return a.Ic=b.subarray(c,c+d),a.Qc=d;if(0===a.Qc&&0===e)return a.Ic=b.slice(c,c+d),a.Qc=d;if(e+d<=a.Qc)return a.Ic.set(b.subarray(c,c+d),e),d}f=e+d;var g=a.Ic?a.Ic.length:0;g>=f||(f=Math.max(f,g*(1048576>g?2:1.125)>>>0),0!=g&&(f=Math.max(f,256)),g=a.Ic,a.Ic=new Uint8Array(f),
|
|
386
|
+
0<a.Qc&&a.Ic.set(g.subarray(0,a.Qc),0));if(a.Ic.subarray&&b.subarray)a.Ic.set(b.subarray(c,c+d),e);else for(f=0;f<d;f++)a.Ic[e+f]=b[c+f];a.Qc=Math.max(a.Qc,e+d);return d},bd(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Qc);if(0>b)throw new N(28);return b},re(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new N(43);a=a.node.Ic;if(e&2||!a||a.buffer!==A.buffer){d=!0;Ba();e=void 0;if(!e)throw new N(48);if(a){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,
|
|
387
|
+
c,c+b);A.set(a,e)}}else d=!1,e=a.byteOffset;return{Lc:e,Af:d}},te(a,b,c,d){O.Hc.write(a,b,0,d,c,!1);return 0}}},gb=(a,b)=>{var c=0;a&&(c|=365);b&&(c|=146);return c},hb=null,ib={},jb=[],kb=1,fb=null,lb=!1,mb=!0,nb={},N=class{name="ErrnoError";constructor(a){this.ld=a}},ob=class{Dd={};node=null;get flags(){return this.Dd.flags}set flags(a){this.Dd.flags=a}get position(){return this.Dd.position}set position(a){this.Dd.position=a}},pb=class{Jc={};Hc={};Pd=null;constructor(a,b,c,d){a||=this;this.parent=
|
|
388
|
+
a;this.jd=a.jd;this.id=kb++;this.name=b;this.mode=c;this.Rd=d;this.qd=this.$c=this.Xc=Date.now()}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}};
|
|
389
|
+
function qb(a,b={}){if(!a)throw new N(44);b.ae??(b.ae=!0);"/"===a.charAt(0)||(a="//"+a);var c=0;a:for(;40>c;c++){a=a.split("/").filter(h=>!!h);for(var d=hb,e="/",f=0;f<a.length;f++){var g=f===a.length-1;if(g&&b.parent)break;if("."!==a[f])if(".."===a[f])if(e=Na(e),d===d.parent){a=e+"/"+a.slice(f+1).join("/");c--;continue a}else d=d.parent;else{e=Ma(e+"/"+a[f]);try{d=db(d,a[f])}catch(h){if(44===h?.ld&&g&&b.mf)return{path:e};throw h;}!d.Pd||g&&!b.ae||(d=d.Pd.root);if(40960===(d.mode&61440)&&(!g||b.$d)){if(!d.Jc.Ad)throw new N(52);
|
|
390
|
+
d=d.Jc.Ad(d);"/"===d.charAt(0)||(d=Na(e)+"/"+d);a=d+"/"+a.slice(f+1).join("/");continue a}}}return{path:e,node:d}}throw new N(32);}function eb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%fb.length}function db(a,b){var c=16384===(a.mode&61440)?(c=rb(a,"x"))?c:a.Jc.zd?0:2:54;if(c)throw new N(c);for(c=fb[eb(a.id,b)];c;c=c.vd){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Jc.zd(a,b)}
|
|
391
|
+
function bb(a,b,c,d){a=new pb(a,b,c,d);b=eb(a.parent.id,a.name);a.vd=fb[b];return fb[b]=a}function sb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function rb(a,b){if(mb)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function tb(a,b){if(16384!==(a.mode&61440))return 54;try{return db(a,b),20}catch(c){}return rb(a,"wx")}function ub(a){a=jb[a];if(!a)throw new N(8);return a}
|
|
392
|
+
function vb(a,b=-1){a=Object.assign(new ob,a);if(-1==b)a:{for(b=0;4096>=b;b++)if(!jb[b])break a;throw new N(33);}a.md=b;return jb[b]=a}function wb(a,b=-1){a=vb(a,b);a.Hc?.Kf?.(a);return a}function xb(a,b){var c= undefined,d=c?null:a;c??=a.Jc.ed;if(!c)throw new N(63);c(d,b)}var ab={open(a){a.Hc=ib[a.node.Rd].Hc;a.Hc.open?.(a)},bd(){throw new N(70);}};function Xa(a,b){ib[a]={Hc:b}}
|
|
393
|
+
function yb(a,b){var c="/"===b;if(c&&hb)throw new N(10);if(!c&&b){var d=qb(b,{ae:!1});b=d.path;d=d.node;if(d.Pd)throw new N(10);if(16384!==(d.mode&61440))throw new N(54);}b={type:a,Sf:{},se:b,kf:[]};a=a.jd(b);a.jd=b;b.root=a;c?hb=a:d&&(d.Pd=b,d.jd&&d.jd.kf.push(b))}function zb(a,b,c){var d=qb(a,{parent:!0}).node;a=a&&a.match(/([^\/]+|\/)\/*$/)[1];if(!a)throw new N(28);if("."===a||".."===a)throw new N(20);var e=tb(d,a);if(e)throw new N(e);if(!d.Jc.Od)throw new N(63);return d.Jc.Od(d,a,b,c)}
|
|
394
|
+
function Ab(a){return zb(a,16895,0)}function Bb(a,b,c){"undefined"==typeof c&&(c=b,b=438);zb(a,b|8192,c)}function Cb(a,b){if(!Qa(a))throw new N(44);var c=qb(b,{parent:!0}).node;if(!c)throw new N(44);b=b&&b.match(/([^\/]+|\/)\/*$/)[1];var d=tb(c,b);if(d)throw new N(d);if(!c.Jc.Td)throw new N(63);c.Jc.Td(c,b,a)}
|
|
395
|
+
function Db(a,b,c=438){if(""===a)throw new N(44);if("string"==typeof b){var d={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof d)throw Error(`Unknown file open mode: ${b}`);b=d}c=b&64?c&4095|32768:0;if("object"==typeof a)d=a;else{var e=a.endsWith("/");a=qb(a,{$d:!(b&131072),mf:!0});d=a.node;a=a.path}var f=!1;if(b&64)if(d){if(b&128)throw new N(20);}else{if(e)throw new N(31);d=zb(a,c|511,0);f=!0}if(!d)throw new N(44);8192===(d.mode&61440)&&(b&=-513);if(b&65536&&16384!==(d.mode&
|
|
396
|
+
61440))throw new N(54);if(!f&&(e=d?40960===(d.mode&61440)?32:16384===(d.mode&61440)&&("r"!==sb(b)||b&576)?31:rb(d,sb(b)):44))throw new N(e);if(b&512&&!f){e=d;e="string"==typeof e?qb(e,{$d:!0}).node:e;if(16384===(e.mode&61440))throw new N(31);if(32768!==(e.mode&61440))throw new N(28);var g=rb(e,"w");if(g)throw new N(g);xb(e,{size:0,timestamp:Date.now()})}b&=-131713;a:for(e=d;;){if(e===e.parent){e=e.jd.se;var h=h?"/"!==e[e.length-1]?`${e}/${h}`:e+h:e;break a}h=h?`${e.name}/${h}`:e.name;e=e.parent}h=
|
|
397
|
+
vb({node:d,path:h,flags:b,seekable:!0,position:0,Hc:d.Hc,uf:[],error:!1});h.Hc.open&&h.Hc.open(h);f&&(c&=511,d="string"==typeof d?qb(d,{$d:!0}).node:d,xb(d,{mode:c&4095|d.mode&-4096,Xc:Date.now(),Jf:void 0}));!l.logReadFiles||b&1||a in nb||(nb[a]=1);return h}function Eb(a,b,c){if(null===a.md)throw new N(8);if(!a.seekable||!a.Hc.bd)throw new N(70);if(0!=c&&1!=c&&2!=c)throw new N(28);a.position=a.Hc.bd(a,b,c);a.uf=[]}
|
|
398
|
+
function Fb(a,b,c){a=Ma("/dev/"+a);var d=gb(!!b,!!c);Fb.qe??(Fb.qe=64);var e=Fb.qe++<<8|0;Xa(e,{open(f){f.seekable=!1},close(){c?.buffer?.length&&c(10)},read(f,g,h,k){for(var n=0,p=0;p<k;p++){try{var u=b()}catch(t){throw new N(29);}if(void 0===u&&0===n)throw new N(6);if(null===u||void 0===u)break;n++;g[h+p]=u}n&&(f.node.qd=Date.now());return n},write(f,g,h,k){for(var n=0;n<k;n++)try{c(g[h+n])}catch(p){throw new N(29);}k&&(f.node.$c=f.node.Xc=Date.now());return n}});Bb(a,d,e)}
|
|
399
399
|
var Gb={},Ka=void 0,Hb=(a,b)=>Object.defineProperty(b,"name",{value:a}),Ib=[],Jb=[0,1,,1,null,1,!0,1,!1,1],P=class extends Error{constructor(a){super(a);this.name="BindingError"}},Q=a=>{if(!a)throw new P(`Cannot use deleted val. handle = ${a}`);return Jb[a]},Kb=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=Ib.pop()||Jb.length;Jb[b]=a;Jb[b+1]=1;return b}};class Lb extends Error{}
|
|
400
|
-
var R=a=>{for(var b="";;){var c=B[a++];if(!c)return b;b+=String.fromCharCode(c)}},Mb={},Nb=(a,b)=>{if(void 0===b)throw new P("ptr should not be undefined");for(;a.
|
|
401
|
-
b.
|
|
400
|
+
var R=a=>{for(var b="";;){var c=B[a++];if(!c)return b;b+=String.fromCharCode(c)}},Mb={},Nb=(a,b)=>{if(void 0===b)throw new P("ptr should not be undefined");for(;a.Rc;)b=a.Cd(b),a=a.Rc;return b},Ob={},Rb=a=>{a=Pb(a);var b=R(a);Qb(a);return b},Sb=(a,b)=>{var c=Ob[a];if(void 0===c)throw a=`${b} has unknown type ${Rb(a)}`,new P(a);return c},Tb=()=>{},Ub=!1,Vb=a=>{if(!globalThis.FinalizationRegistry)return Vb=b=>b,a;Ub=new FinalizationRegistry(b=>{b=b.Fc;--b.count.value;0===b.count.value&&(b.Sc?b.Yc.dd(b.Sc):
|
|
401
|
+
b.Nc.Gc.dd(b.Lc))});Vb=b=>{var c=b.Fc;c.Sc&&Ub.register(b,{Fc:c},b);return b};Tb=b=>{Ub.unregister(b)};return Vb(a)},Wb={},Xb=a=>{for(;a.length;){var b=a.pop();a.pop()(b)}};function Yb(a){return this.Kc(J[a>>2])}
|
|
402
402
|
var Zb={},$b={},ac=class extends Error{constructor(a){super(a);this.name="InternalError"}},T=(a,b,c)=>{function d(h){h=c(h);if(h.length!==a.length)throw new ac("Mismatched type converter count");for(var k=0;k<a.length;++k)S(a[k],h[k])}a.forEach(h=>$b[h]=b);var e=Array(b.length),f=[],g=0;for(let [h,k]of b.entries())Ob.hasOwnProperty(k)?e[h]=Ob[k]:(f.push(k),Zb.hasOwnProperty(k)||(Zb[k]=[]),Zb[k].push(()=>{e[h]=Ob[k];++g;g===f.length&&d(e)}));0===f.length&&d(e)};
|
|
403
|
-
function bc(a,b,c={}){var d=b.name;if(!a)throw new P(`type "${d}" must have a positive integer typeid pointer`);if(Ob.hasOwnProperty(a)){if(c.
|
|
404
|
-
var cc=(a,b,c)=>{switch(b){case 1:return c?d=>A[d]:d=>B[d];case 2:return c?d=>D[d>>1]:d=>ta[d>>1];case 4:return c?d=>
|
|
405
|
-
var gc={},hc=(a,b,c)=>{if(void 0===a[b].
|
|
406
|
-
l[a].
|
|
407
|
-
var lc=(a,b,c)=>{for(;b!==c;){if(!b.
|
|
408
|
-
function nc(a,b){if(null===b){if(this.
|
|
409
|
-
function oc(a,b){if(null===b){if(this.
|
|
410
|
-
b.
|
|
411
|
-
function pc(a,b){if(null===b){if(this.
|
|
412
|
-
var qc=(a,b,c)=>{if(b===c)return a;if(void 0===c.
|
|
413
|
-
function tc(a,b,c,d,e,f,g,h,k,
|
|
414
|
-
class wc extends Error{}var
|
|
415
|
-
function
|
|
416
|
-
var
|
|
417
|
-
Ib.push(a))},
|
|
418
|
-
2])};case 8:return function(c){return this.
|
|
419
|
-
(a,b,c)=>{var d="";a>>=2;for(var e=0;!(e>=b/4);e++){var f=J[a+e];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},
|
|
420
|
-
return c},
|
|
421
|
-
return(a.getSupportedExtensions()||[]).filter(c=>b.includes(c))},
|
|
422
|
-
b.
|
|
423
|
-
HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:ja||"./this.program"},b;for(b in
|
|
424
|
-
|
|
425
|
-
Float32Array||
|
|
426
|
-
td=a=>"]"==a.slice(-1)&&a.lastIndexOf("["),
|
|
427
|
-
(function(){
|
|
428
|
-
(function(){
|
|
429
|
-
(()=>{let a=fc.prototype;Object.assign(a,{isAliasOf:function(c){if(!(this instanceof fc&&c instanceof fc))return!1;var d=this.
|
|
430
|
-
c.
|
|
403
|
+
function bc(a,b,c={}){var d=b.name;if(!a)throw new P(`type "${d}" must have a positive integer typeid pointer`);if(Ob.hasOwnProperty(a)){if(c.cf)return;throw new P(`Cannot register type '${d}' twice`);}Ob[a]=b;delete $b[a];Zb.hasOwnProperty(a)&&(b=Zb[a],delete Zb[a],b.forEach(e=>e()))}function S(a,b,c={}){return bc(a,b,c)}
|
|
404
|
+
var cc=(a,b,c)=>{switch(b){case 1:return c?d=>A[d]:d=>B[d];case 2:return c?d=>D[d>>1]:d=>ta[d>>1];case 4:return c?d=>E[d>>2]:d=>J[d>>2];case 8:return c?d=>wa[d>>3]:d=>xa[d>>3];default:throw new TypeError(`invalid integer width (${b}): ${a}`);}},dc=a=>{throw new P(a.Fc.Nc.Gc.name+" instance already deleted");},ec=[];function fc(){}
|
|
405
|
+
var gc={},hc=(a,b,c)=>{if(void 0===a[b].Pc){var d=a[b];a[b]=function(...e){if(!a[b].Pc.hasOwnProperty(e.length))throw new P(`Function '${c}' called with an invalid number of arguments (${e.length}) - expects one of (${a[b].Pc})!`);return a[b].Pc[e.length].apply(this,e)};a[b].Pc=[];a[b].Pc[d.hd]=d}},ic=(a,b,c)=>{if(l.hasOwnProperty(a)){if(void 0===c||void 0!==l[a].Pc&&void 0!==l[a].Pc[c])throw new P(`Cannot register public name '${a}' twice`);hc(l,a,a);if(l[a].Pc.hasOwnProperty(c))throw new P(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`);
|
|
406
|
+
l[a].Pc[c]=b}else l[a]=b,l[a].hd=c},jc=a=>{a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?`_${a}`:a};function kc(a,b,c,d,e,f,g,h){this.name=a;this.constructor=b;this.ad=c;this.dd=d;this.Rc=e;this.Ye=f;this.Cd=g;this.Re=h;this.we=[]}
|
|
407
|
+
var lc=(a,b,c)=>{for(;b!==c;){if(!b.Cd)throw new P(`Expected null or instance of ${c.name}, got an instance of ${b.name}`);a=b.Cd(a);b=b.Rc}return a},mc=a=>{if(null===a)return"null";var b=typeof a;return"object"===b||"array"===b||"function"===b?a.toString():""+a};
|
|
408
|
+
function nc(a,b){if(null===b){if(this.ce)throw new P(`null is not a valid ${this.name}`);return 0}if(!b.Fc)throw new P(`Cannot pass "${mc(b)}" as a ${this.name}`);if(!b.Fc.Lc)throw new P(`Cannot pass deleted object as a pointer of type ${this.name}`);return lc(b.Fc.Lc,b.Fc.Nc.Gc,this.Gc)}
|
|
409
|
+
function oc(a,b){if(null===b){if(this.ce)throw new P(`null is not a valid ${this.name}`);if(this.Kd){var c=this.fe();null!==a&&a.push(this.dd,c);return c}return 0}if(!b||!b.Fc)throw new P(`Cannot pass "${mc(b)}" as a ${this.name}`);if(!b.Fc.Lc)throw new P(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Jd&&b.Fc.Nc.Jd)throw new P(`Cannot convert argument of type ${b.Fc.Yc?b.Fc.Yc.name:b.Fc.Nc.name} to parameter type ${this.name}`);c=lc(b.Fc.Lc,b.Fc.Nc.Gc,this.Gc);if(this.Kd){if(void 0===
|
|
410
|
+
b.Fc.Sc)throw new P("Passing raw pointer to smart pointer is illegal");switch(this.tf){case 0:if(b.Fc.Yc===this)c=b.Fc.Sc;else throw new P(`Cannot convert argument of type ${b.Fc.Yc?b.Fc.Yc.name:b.Fc.Nc.name} to parameter type ${this.name}`);break;case 1:c=b.Fc.Sc;break;case 2:if(b.Fc.Yc===this)c=b.Fc.Sc;else{var d=b.clone();c=this.pf(c,Kb(()=>d["delete"]()));null!==a&&a.push(this.dd,c)}break;default:throw new P("Unsupported sharing policy");}}return c}
|
|
411
|
+
function pc(a,b){if(null===b){if(this.ce)throw new P(`null is not a valid ${this.name}`);return 0}if(!b.Fc)throw new P(`Cannot pass "${mc(b)}" as a ${this.name}`);if(!b.Fc.Lc)throw new P(`Cannot pass deleted object as a pointer of type ${this.name}`);if(b.Fc.Nc.Jd)throw new P(`Cannot convert argument of type ${b.Fc.Nc.name} to parameter type ${this.name}`);return lc(b.Fc.Lc,b.Fc.Nc.Gc,this.Gc)}
|
|
412
|
+
var qc=(a,b,c)=>{if(b===c)return a;if(void 0===c.Rc)return null;a=qc(a,b,c.Rc);return null===a?null:c.Re(a)},rc=(a,b)=>{b=Nb(a,b);return Mb[b]},sc=(a,b)=>{if(!b.Nc||!b.Lc)throw new ac("makeClassHandle requires ptr and ptrType");if(!!b.Yc!==!!b.Sc)throw new ac("Both smartPtrType and smartPtr must be specified");b.count={value:1};return Vb(Object.create(a,{Fc:{value:b,writable:!0}}))};
|
|
413
|
+
function tc(a,b,c,d,e,f,g,h,k,n,p){this.name=a;this.Gc=b;this.ce=c;this.Jd=d;this.Kd=e;this.nf=f;this.tf=g;this.ye=h;this.fe=k;this.pf=n;this.dd=p;e||void 0!==b.Rc?this.Oc=oc:(this.Oc=d?nc:pc,this.Vc=null)}var uc=(a,b,c)=>{if(!l.hasOwnProperty(a))throw new ac("Replacing nonexistent public symbol");void 0!==l[a].Pc&&void 0!==c?l[a].Pc[c]=b:(l[a]=b,l[a].hd=c)},U=(a,b)=>{a=R(a);var c=vc.get(b);if("function"!=typeof c)throw new P(`unknown function pointer with signature ${a}: ${b}`);return c};
|
|
414
|
+
class wc extends Error{}var xc=(a,b)=>{function c(f){e[f]||Ob[f]||($b[f]?$b[f].forEach(c):(d.push(f),e[f]=!0))}var d=[],e={};b.forEach(c);throw new wc(`${a}: `+d.map(Rb).join([", "]));};function yc(a){for(var b=1;b<a.length;++b)if(null!==a[b]&&void 0===a[b].Vc)return!0;return!1}
|
|
415
|
+
function zc(a,b,c,d,e){var f=b.length;if(2>f)throw new P("argTypes array size mismatch! Must at least get return value and 'this' types!");var g=null!==b[1]&&null!==c,h=yc(b),k=!b[0].jf,n=f-2,p=Array(n),u=[],t=[];return Hb(a,function(...C){t.length=0;u.length=g?2:1;u[0]=e;if(g){var q=b[1].Oc(t,this);u[1]=q}for(var r=0;r<n;++r)p[r]=b[r+2].Oc(t,C[r]),u.push(p[r]);C=d(...u);if(h)Xb(t);else for(r=g?1:2;r<b.length;r++){var x=1===r?q:p[r-2];null!==b[r].Vc&&b[r].Vc(x)}q=k?b[0].Kc(C):void 0;return q})}
|
|
416
|
+
var Ac=(a,b)=>{for(var c=[],d=0;d<a;d++)c.push(J[b+4*d>>2]);return c},Bc=a=>{a=a.trim();const b=a.indexOf("(");return-1===b?a:a.slice(0,b)},Cc=(a,b,c)=>{if(!(a instanceof Object))throw new P(`${c} with invalid "this": ${a}`);if(!(a instanceof b.Gc.constructor))throw new P(`${c} incompatible with "this" of type ${a.constructor.name}`);if(!a.Fc.Lc)throw new P(`cannot call emscripten binding method ${c} on deleted object`);return lc(a.Fc.Lc,a.Fc.Nc.Gc,b.Gc)},Dc=a=>{9<a&&0===--Jb[a+1]&&(Jb[a]=void 0,
|
|
417
|
+
Ib.push(a))},Ec={name:"emscripten::val",Kc:a=>{var b=Q(a);Dc(a);return b},Oc:(a,b)=>Kb(b),Wc:Yb,Vc:null},Fc=(a,b,c)=>{switch(b){case 1:return c?function(d){return this.Kc(A[d])}:function(d){return this.Kc(B[d])};case 2:return c?function(d){return this.Kc(D[d>>1])}:function(d){return this.Kc(ta[d>>1])};case 4:return c?function(d){return this.Kc(E[d>>2])}:function(d){return this.Kc(J[d>>2])};default:throw new TypeError(`invalid integer width (${b}): ${a}`);}},Gc=(a,b)=>{switch(b){case 4:return function(c){return this.Kc(ua[c>>
|
|
418
|
+
2])};case 8:return function(c){return this.Kc(va[c>>3])};default:throw new TypeError(`invalid float width (${b}): ${a}`);}},Hc=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ic=(a,b,c)=>{a>>=1;b=Sa(ta,a,b/2,c);if(16<b-a&&Hc)return Hc.decode(ta.subarray(a,b));for(c="";a<b;++a)c+=String.fromCharCode(ta[a]);return c},Jc=(a,b,c)=>{c??=2147483647;if(2>c)return 0;c-=2;var d=b;c=c<2*a.length?c/2:a.length;for(var e=0;e<c;++e)D[b>>1]=a.charCodeAt(e),b+=2;D[b>>1]=0;return b-d},Kc=a=>2*a.length,Lc=
|
|
419
|
+
(a,b,c)=>{var d="";a>>=2;for(var e=0;!(e>=b/4);e++){var f=J[a+e];if(!f&&!c)break;d+=String.fromCodePoint(f)}return d},Mc=(a,b,c)=>{c??=2147483647;if(4>c)return 0;var d=b;c=d+c-4;for(var e=0;e<a.length;++e){var f=a.codePointAt(e);65535<f&&e++;E[b>>2]=f;b+=4;if(b+4>c)break}E[b>>2]=0;return b-d},Nc=a=>{for(var b=0,c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b},Oc=[],Pc=a=>{var b=Oc.length;Oc.push(a);return b},Qc=(a,b)=>{for(var c=Array(a),d=0;d<a;++d)c[d]=Sb(J[b+4*d>>2],`parameter ${d}`);
|
|
420
|
+
return c},Rc={},Sc=a=>{var b=Rc[a];return void 0===b?R(a):b},Tc=[0,31,60,91,121,152,182,213,244,274,305,335],Uc=[0,31,59,90,120,151,181,212,243,273,304,334],Vc=[],Wc=a=>{a.If=a.getExtension("WEBGL_draw_instanced_base_vertex_base_instance")},Xc=a=>{a.Qf=a.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance")},V,Yc=a=>{var b="EXT_color_buffer_float EXT_conservative_depth EXT_disjoint_timer_query_webgl2 EXT_texture_norm16 NV_shader_noperspective_interpolation WEBGL_clip_cull_distance EXT_clip_control EXT_color_buffer_half_float EXT_depth_clamp EXT_float_blend EXT_polygon_offset_clamp EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_texture_float_linear WEBGL_blend_func_extended WEBGL_compressed_texture_astc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode".split(" ");
|
|
421
|
+
return(a.getSupportedExtensions()||[]).filter(c=>b.includes(c))},Zc=1,$c=[],X=[],ad=[],bd=[],cd=[],Y=[],dd=[],v=[],ed=[],fd={},gd={},hd=4,jd=0,kd=a=>{for(var b=Zc++,c=a.length;c<b;c++)a[c]=null;return b},ld=(a,b,c,d)=>{for(var e=0;e<a;e++){var f=V[c](),g=f&&kd(d);f?(f.name=g,d[g]=f):Z||=1282;E[b+4*e>>2]=g}},ia=(a,b)=>{var c=kd(v),d={handle:c,attributes:b,version:b.Pf,Tc:a};a.canvas&&(a.canvas.Ge=d);v[c]=d;if("undefined"==typeof b.Se||b.Se)if((a=d)||(a=m),!a.df){a.df=!0;b=a.Tc;b.lf=b.getExtension("WEBGL_multi_draw");
|
|
422
|
+
b.Ve=b.getExtension("EXT_polygon_offset_clamp");b.Ue=b.getExtension("EXT_clip_control");b.vf=b.getExtension("WEBGL_polygon_mode");Wc(b);Xc(b);2<=a.version&&(b.me=b.getExtension("EXT_disjoint_timer_query_webgl2"));if(2>a.version||!b.me)b.me=b.getExtension("EXT_disjoint_timer_query");for(var e of Yc(b))e.includes("lose_context")||e.includes("debug")||b.getExtension(e)}return c},ha=a=>{m=v[a];l.ctx=V=m?.Tc;return!(a&&!V)},Z,m,md={},od=()=>{if(!nd){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",
|
|
423
|
+
HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:ja||"./this.program"},b;for(b in md)void 0===md[b]?delete a[b]:a[b]=md[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);nd=c}return nd},nd,pd=[],qd=()=>{var a=Yc(V);return a=a.concat(a.map(b=>"GL_"+b))},rd=(a,b,c)=>{if(b){var d=void 0;switch(a){case 36346:d=1;break;case 36344:0!=c&&1!=c&&(Z||=1280);return;case 34814:case 36345:d=0;break;case 34466:var e=V.getParameter(34467);d=e?e.length:0;break;case 33309:if(2>
|
|
424
|
+
m.version){Z||=1282;return}d=qd().length;break;case 33307:case 33308:if(2>m.version){Z||=1280;return}d=33307==a?3:0}if(void 0===d)switch(e=V.getParameter(a),typeof e){case "number":d=e;break;case "boolean":d=e?1:0;break;case "string":Z||=1280;return;case "object":if(null===e)switch(a){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:d=0;break;
|
|
425
|
+
default:Z||=1280;return}else{if(e instanceof Float32Array||e instanceof Uint32Array||e instanceof Int32Array||e instanceof Array){for(a=0;a<e.length;++a)switch(c){case 0:E[b+4*a>>2]=e[a];break;case 2:ua[b+4*a>>2]=e[a];break;case 4:A[b+a]=e[a]?1:0}return}try{d=e.name|0}catch(f){Z||=1280;w(`GL_INVALID_ENUM in glGet${c}v: Unknown object returned from WebGL getParameter(${a})! (error: ${f})`);return}}break;default:Z||=1280;w(`GL_INVALID_ENUM in glGet${c}v: Native code calling glGet${c}v(${a}) and it returns ${e} of type ${typeof e}!`);
|
|
426
|
+
return}switch(c){case 1:c=d;J[b>>2]=c;J[b+4>>2]=(c-J[b>>2])/4294967296;break;case 0:E[b>>2]=d;break;case 2:ua[b>>2]=d;break;case 4:A[b]=d?1:0}}else Z||=1281},td=a=>{var b=Ua(a)+1,c=sd(b);c&&M(a,B,c,b);return c},ud=a=>"]"==a.slice(-1)&&a.lastIndexOf("["),vd=a=>{a-=5120;return 0==a?A:1==a?B:2==a?D:4==a?E:6==a?ua:5==a||28922==a||28520==a||30779==a||30782==a?J:ta};fb=Array(4096);yb(O,"/");Ab("/tmp");Ab("/home");Ab("/home/web_user");
|
|
427
|
+
(function(){Ab("/dev");Xa(259,{read:()=>0,write:(d,e,f,g)=>g,bd:()=>0});Bb("/dev/null",259);Wa(1280,Za);Wa(1536,$a);Bb("/dev/tty",1280);Bb("/dev/tty1",1536);var a=new Uint8Array(1024),b=0,c=()=>{0===b&&(Pa(a),b=a.byteLength);return a[--b]};Fb("random",c);Fb("urandom",c);Ab("/dev/shm");Ab("/dev/shm/tmp")})();
|
|
428
|
+
(function(){Ab("/proc");var a=Ab("/proc/self");Ab("/proc/self/fd");yb({jd(){var b=bb(a,"fd",16895,73);b.Hc={bd:O.Hc.bd};b.Jc={zd(c,d){c=+d;var e=ub(c);c={parent:null,jd:{se:"fake"},Jc:{Ad:()=>e.path},id:c+1};return c.parent=c},ge(){return Array.from(jb.entries()).filter(([,c])=>c).map(([c])=>c.toString())}};return b}},"/proc/self/fd")})();
|
|
429
|
+
(()=>{let a=fc.prototype;Object.assign(a,{isAliasOf:function(c){if(!(this instanceof fc&&c instanceof fc))return!1;var d=this.Fc.Nc.Gc,e=this.Fc.Lc;c.Fc=c.Fc;var f=c.Fc.Nc.Gc;for(c=c.Fc.Lc;d.Rc;)e=d.Cd(e),d=d.Rc;for(;f.Rc;)c=f.Cd(c),f=f.Rc;return d===f&&e===c},clone:function(){this.Fc.Lc||dc(this);if(this.Fc.wd)return this.Fc.count.value+=1,this;var c=Vb,d=Object,e=d.create,f=Object.getPrototypeOf(this),g=this.Fc;c=c(e.call(d,f,{Fc:{value:{count:g.count,yd:g.yd,wd:g.wd,Lc:g.Lc,Nc:g.Nc,Sc:g.Sc,Yc:g.Yc}}}));
|
|
430
|
+
c.Fc.count.value+=1;c.Fc.yd=!1;return c},["delete"](){this.Fc.Lc||dc(this);if(this.Fc.yd&&!this.Fc.wd)throw new P("Object already scheduled for deletion");Tb(this);var c=this.Fc;--c.count.value;0===c.count.value&&(c.Sc?c.Yc.dd(c.Sc):c.Nc.Gc.dd(c.Lc));this.Fc.wd||(this.Fc.Sc=void 0,this.Fc.Lc=void 0)},isDeleted:function(){return!this.Fc.Lc},deleteLater:function(){this.Fc.Lc||dc(this);if(this.Fc.yd&&!this.Fc.wd)throw new P("Object already scheduled for deletion");ec.push(this);this.Fc.yd=!0;return this}});
|
|
431
431
|
const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
|
|
432
|
-
Object.assign(tc.prototype,{
|
|
433
|
-
e?b.call(this):this.
|
|
434
|
-
var
|
|
432
|
+
Object.assign(tc.prototype,{Ze(a){this.ye&&(a=this.ye(a));return a},le(a){this.dd?.(a)},Wc:Yb,Kc:function(a){function b(){return this.Kd?sc(this.Gc.ad,{Nc:this.nf,Lc:c,Yc:this,Sc:a}):sc(this.Gc.ad,{Nc:this,Lc:a})}var c=this.Ze(a);if(!c)return this.le(a),null;var d=rc(this.Gc,c);if(void 0!==d){if(0===d.Fc.count.value)return d.Fc.Lc=c,d.Fc.Sc=a,d.clone();d=d.clone();this.le(a);return d}d=this.Gc.Ye(c);d=gc[d];if(!d)return b.call(this);d=this.Jd?d.Pe:d.pointerType;var e=qc(c,this.Gc,d.Gc);return null===
|
|
433
|
+
e?b.call(this):this.Kd?sc(d.Gc.ad,{Nc:d,Lc:e,Yc:this,Sc:a}):sc(d.Gc.ad,{Nc:d,Lc:e})}});for(let a=0;32>a;++a)pd.push(Array(a));l.print&&(oa=l.print);l.printErr&&(w=l.printErr);l.wasmBinary&&(pa=l.wasmBinary);l.thisProgram&&(ja=l.thisProgram);if(l.preInit)for("function"==typeof l.preInit&&(l.preInit=[l.preInit]);0<l.preInit.length;)l.preInit.shift()();
|
|
434
|
+
var zd={342006:(a,b,c,d,e)=>{if("undefined"===typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if("undefined"===typeof window.miniaudio){window.miniaudio={referenceCount:0};window.miniaudio.device_type={};window.miniaudio.device_type.playback=a;window.miniaudio.device_type.capture=b;window.miniaudio.device_type.duplex=c;window.miniaudio.device_state={};window.miniaudio.device_state.stopped=d;window.miniaudio.device_state.started=e;let f=window.miniaudio;f.devices=
|
|
435
435
|
[];f.track_device=function(g){for(var h=0;h<f.devices.length;++h)if(null==f.devices[h])return f.devices[h]=g,h;f.devices.push(g);return f.devices.length-1};f.untrack_device_by_index=function(g){for(f.devices[g]=null;0<f.devices.length;)if(null==f.devices[f.devices.length-1])f.devices.pop();else break};f.untrack_device=function(g){for(var h=0;h<f.devices.length;++h)if(f.devices[h]==g)return f.untrack_device_by_index(h)};f.get_device_by_index=function(g){return f.devices[g]};f.unlock_event_types=["touchend",
|
|
436
|
-
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.
|
|
437
|
-
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},
|
|
438
|
-
new (window.AudioContext||window.webkitAudioContext)(h);g.
|
|
439
|
-
window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(
|
|
440
|
-
g.
|
|
441
|
-
{window.miniaudio.untrack_device_by_index(a)},
|
|
442
|
-
e,0;case 12:return e=K(),D[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return-f.
|
|
443
|
-
0:-59;case 21506:case 21507:case 21508:if(!d.
|
|
444
|
-
g.name)throw g;return-g.
|
|
445
|
-
Object.defineProperty(this,"__parent",{value:e});this.__construct(...h)});e.__construct=function(...h){if(this===e)throw new P("Pass correct 'this' to __construct");h=g.implement(this,...h);Tb(h);var k=h.
|
|
446
|
-
this.
|
|
447
|
-
|
|
448
|
-
f){return f?c:d},
|
|
449
|
-
I)throw new P(`Tried to invoke ctor of ${
|
|
450
|
-
b=
|
|
451
|
-
f);T([],[a],k=>{k=k[0];var
|
|
452
|
-
|
|
453
|
-
b,c,d,e,f,g,h)=>{var k=
|
|
454
|
-
|
|
455
|
-
b,r);return[]});return[]})}
|
|
456
|
-
|
|
457
|
-
a=
|
|
458
|
-
S(a,{name:c,
|
|
459
|
-
Kc,e=
|
|
460
|
-
},
|
|
461
|
-
c,d,e),
|
|
462
|
-
|
|
463
|
-
2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},
|
|
464
|
-
4*c,b))},
|
|
465
|
-
105!=d;e&=112!=d;c+=e&&c%8?4:0;
|
|
466
|
-
(b=b.slice(3));"WEBGL_draw_instanced_base_vertex_base_instance"==b&&
|
|
467
|
-
|
|
468
|
-
b+c;J[a+d>>2]=f;c+=
|
|
469
|
-
h,
|
|
470
|
-
|
|
471
|
-
(
|
|
472
|
-
[c,d,e,f])},
|
|
473
|
-
b)=>
|
|
474
|
-
b,c,
|
|
475
|
-
b
|
|
476
|
-
|
|
477
|
-
{
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
c
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
436
|
+
"click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Zc&&h.state===f.device_state.started&&h.Zc.resume().then(()=>{wd(h.ve)},k=>{console.error("Failed to resume audiocontext",k)})}f.unlock_event_types.map(function(k){document.removeEventListener(k,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},344184:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
|
|
437
|
+
window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},344488:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,344592:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},344763:(a,b,c,d,e,f)=>{if("undefined"===typeof window.miniaudio)return-1;var g={},h={};a==window.miniaudio.device_type.playback&&0!=c&&(h.sampleRate=c);g.Zc=
|
|
438
|
+
new (window.AudioContext||window.webkitAudioContext)(h);g.Zc.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.od=g.Zc.createScriptProcessor(d,c,b);g.od.onaudioprocess=function(k){if(null==g.Id||0==g.Id.length)g.Id=new Float32Array(ua.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var n=0;n<b;n+=1)for(var p=k.inputBuffer.getChannelData(n),u=g.Id,t=0;t<d;t+=1)u[t*b+n]=p[t];xd(f,d,e)}if(a==
|
|
439
|
+
window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(yd(f,d,e),n=0;n<k.outputBuffer.numberOfChannels;++n)for(p=k.outputBuffer.getChannelData(n),u=g.Id,t=0;t<d;t+=1)p[t]=u[t*b+n];else for(n=0;n<k.outputBuffer.numberOfChannels;++n)k.outputBuffer.getChannelData(n).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(k){g.Sd=g.Zc.createMediaStreamSource(k);g.Sd.connect(g.od);
|
|
440
|
+
g.od.connect(g.Zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.od.connect(g.Zc.destination);g.ve=f;return window.miniaudio.track_device(g)},347640:a=>window.miniaudio.get_device_by_index(a).Zc.sampleRate,347713:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.od&&(a.od.onaudioprocess=function(){},a.od.disconnect(),a.od=void 0);void 0!==a.Sd&&(a.Sd.disconnect(),a.Sd=void 0);a.Zc.close();a.Zc=void 0;a.ve=void 0},348113:a=>
|
|
441
|
+
{window.miniaudio.untrack_device_by_index(a)},348163:a=>{a=window.miniaudio.get_device_by_index(a);a.Zc.resume();a.state=window.miniaudio.device_state.started},348302:a=>{a=window.miniaudio.get_device_by_index(a);a.Zc.suspend();a.state=window.miniaudio.device_state.stopped}},Qb,sd,Pb,wd,xd,yd,Ad,Bd,Cd,Aa,vc,Ed={Pa:function(a,b,c){Ka=c;try{var d=ub(a);switch(b){case 0:var e=K();if(0>e)break;for(;jb[e];)e++;return wb(d,e).md;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=K(),d.flags|=
|
|
442
|
+
e,0;case 12:return e=K(),D[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return-f.ld}},Jb:function(a,b,c){Ka=c;try{var d=ub(a);switch(b){case 21509:return d.Mc?0:-59;case 21505:if(!d.Mc)return-59;if(d.Mc.kd.ff){a=[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var e=K();E[e>>2]=25856;E[e+4>>2]=5;E[e+8>>2]=191;E[e+12>>2]=35387;for(var f=0;32>f;f++)A[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.Mc?
|
|
443
|
+
0:-59;case 21506:case 21507:case 21508:if(!d.Mc)return-59;if(d.Mc.kd.gf)for(e=K(),a=[],f=0;32>f;f++)a.push(A[e+f+17]);return 0;case 21519:if(!d.Mc)return-59;e=K();return E[e>>2]=0;case 21520:return d.Mc?-28:-59;case 21537:case 21531:e=K();if(!d.Hc.ef)throw new N(59);return d.Hc.ef(d,b,e);case 21523:if(!d.Mc)return-59;d.Mc.kd.hf&&(f=[24,80],e=K(),D[e>>1]=f[0],D[e+2>>1]=f[1]);return 0;case 21524:return d.Mc?0:-59;case 21515:return d.Mc?0:-59;default:return-28}}catch(g){if("undefined"==typeof Gb||"ErrnoError"!==
|
|
444
|
+
g.name)throw g;return-g.ld}},Kb:function(a,b,c,d){Ka=d;try{b=b?L(B,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":ub(a).path;if(0==e.length)throw new N(44);b=f+"/"+e}var g=d?K():0;return Db(b,c,g).md}catch(h){if("undefined"==typeof Gb||"ErrnoError"!==h.name)throw h;return-h.ld}},Nb:()=>Ba(""),Ma:(a,b,c)=>{a=R(a);b=Sb(b,"wrapper");c=Q(c);var d=b.Gc,e=d.ad,f=d.Rc.ad,g=d.Rc.constructor;a=Hb(a,function(...h){for(var k of d.Rc.we)if(this[k]===f[k])throw new Lb(`Pure virtual function ${k} must be implemented in JavaScript`);
|
|
445
|
+
Object.defineProperty(this,"__parent",{value:e});this.__construct(...h)});e.__construct=function(...h){if(this===e)throw new P("Pass correct 'this' to __construct");h=g.implement(this,...h);Tb(h);var k=h.Fc;h.notifyOnDestruction();k.wd=!0;Object.defineProperties(this,{Fc:{value:k}});Vb(this);h=k.Lc;h=Nb(d,h);if(Mb.hasOwnProperty(h))throw new P(`Tried to register registered instance: ${h}`);Mb[h]=this};e.__destruct=function(){if(this===e)throw new P("Pass correct 'this' to __destruct");Tb(this);var h=
|
|
446
|
+
this.Fc.Lc;h=Nb(d,h);if(Mb.hasOwnProperty(h))delete Mb[h];else throw new P(`Tried to unregister unregistered instance: ${h}`);};a.prototype=Object.create(e);Object.assign(a.prototype,c);return Kb(a)},bc:a=>{var b=Wb[a];delete Wb[a];var c=b.fe,d=b.dd,e=b.ne,f=e.map(g=>g.bf).concat(e.map(g=>g.rf));T([a],f,g=>{var h={},k,n;for([k,n]of e.entries()){const p=g[k],u=n.$e,t=n.af,C=g[k+e.length],q=n.qf,r=n.sf;h[n.We]={read:x=>p.Kc(u(t,x)),write:(x,y)=>{var z=[];q(r,x,C.Oc(z,y));Xb(z)},optional:p.optional}}return[{name:b.name,
|
|
447
|
+
Kc:p=>{var u={},t;for(t in h)u[t]=h[t].read(p);d(p);return u},Oc:(p,u)=>{for(var t in h)if(!(t in u||h[t].optional))throw new TypeError(`Missing field: "${t}"`);var C=c();for(t in h)h[t].write(C,u[t]);null!==p&&p.push(d,C);return C},Wc:Yb,Vc:d}]})},Ja:(a,b,c,d,e)=>{b=R(b);d=0n===d;let f=g=>g;if(d){const g=8*c;f=h=>BigInt.asUintN(g,h);e=f(e)}S(a,{name:b,Kc:f,Oc:(g,h)=>{"number"==typeof h&&(h=BigInt(h));return h},Wc:cc(b,c,!d),Vc:null})},qb:(a,b,c,d)=>{b=R(b);S(a,{name:b,Kc:function(e){return!!e},Oc:function(e,
|
|
448
|
+
f){return f?c:d},Wc:function(e){return this.Kc(B[e])},Vc:null})},c:(a,b,c,d,e,f,g,h,k,n,p,u,t)=>{p=R(p);f=U(e,f);h&&=U(g,h);n&&=U(k,n);t=U(u,t);var C=jc(p);ic(C,function(){xc(`Cannot construct ${p} due to unbound types`,[d])});T([a,b,c],d?[d]:[],q=>{q=q[0];if(d){var r=q.Gc;var x=r.ad}else x=fc.prototype;q=Hb(p,function(...H){if(Object.getPrototypeOf(this)!==y)throw new P(`Use 'new' to construct ${p}`);if(void 0===z.rd)throw new P(`${p} has no accessible constructor`);var I=z.rd[H.length];if(void 0===
|
|
449
|
+
I)throw new P(`Tried to invoke ctor of ${p} with invalid number of parameters (${H.length}) - expected (${Object.keys(z.rd).toString()}) parameters instead!`);return I.apply(this,H)});var y=Object.create(x,{constructor:{value:q}});q.prototype=y;var z=new kc(p,q,y,t,r,f,h,n);if(z.Rc){var F;(F=z.Rc).Ed??(F.Ed=[]);z.Rc.Ed.push(z)}r=new tc(p,z,!0,!1,!1);F=new tc(p+"*",z,!1,!1,!1);x=new tc(p+" const*",z,!1,!0,!1);gc[a]={pointerType:F,Pe:x};uc(C,q);return[r,F,x]})},da:(a,b,c,d,e,f,g)=>{var h=Ac(c,d);b=
|
|
450
|
+
R(b);b=Bc(b);f=U(e,f);T([],[a],k=>{function n(){xc(`Cannot call ${p} due to unbound types`,h)}k=k[0];var p=`${k.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var u=k.Gc.constructor;void 0===u[b]?(n.hd=c-1,u[b]=n):(hc(u,b,p),u[b].Pc[c-1]=n);T([],h,t=>{t=zc(p,[t[0],null].concat(t.slice(1)),null,f,g);void 0===u[b].Pc?(t.hd=c-1,u[b]=t):u[b].Pc[c-1]=t;if(k.Gc.Ed)for(const C of k.Gc.Ed)C.constructor.hasOwnProperty(b)||(C.constructor[b]=t);return[]});return[]})},ya:(a,b,c,d,e,f,g,h)=>{b=R(b);
|
|
451
|
+
f=U(e,f);T([],[a],k=>{k=k[0];var n=`${k.name}.${b}`,p={get(){xc(`Cannot access ${n} due to unbound types`,[c])},enumerable:!0,configurable:!0};p.set=h?()=>{xc(`Cannot access ${n} due to unbound types`,[c])}:()=>{throw new P(`${n} is a read-only property`);};Object.defineProperty(k.Gc.constructor,b,p);T([],[c],u=>{u=u[0];var t={get(){return u.Kc(f(d))},enumerable:!0};h&&(h=U(g,h),t.set=C=>{var q=[];h(d,u.Oc(q,C));Xb(q)});Object.defineProperty(k.Gc.constructor,b,t);return[]});return[]})},U:(a,b,c,d,
|
|
452
|
+
e,f)=>{var g=Ac(b,c);e=U(d,e);T([],[a],h=>{h=h[0];var k=`constructor ${h.name}`;void 0===h.Gc.rd&&(h.Gc.rd=[]);if(void 0!==h.Gc.rd[b-1])throw new P(`Cannot register multiple constructors with identical number of parameters (${b-1}) for class '${h.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);h.Gc.rd[b-1]=()=>{xc(`Cannot construct ${h.name} due to unbound types`,g)};T([],g,n=>{n.splice(1,0,null);h.Gc.rd[b-1]=zc(k,n,null,e,f);return[]});return[]})},
|
|
453
|
+
a:(a,b,c,d,e,f,g,h)=>{var k=Ac(c,d);b=R(b);b=Bc(b);f=U(e,f);T([],[a],n=>{function p(){xc(`Cannot call ${u} due to unbound types`,k)}n=n[0];var u=`${n.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);h&&n.Gc.we.push(b);var t=n.Gc.ad,C=t[b];void 0===C||void 0===C.Pc&&C.className!==n.name&&C.hd===c-2?(p.hd=c-2,p.className=n.name,t[b]=p):(hc(t,b,u),t[b].Pc[c-2]=p);T([],k,q=>{q=zc(u,q,n,f,g);void 0===t[b].Pc?(q.hd=c-2,t[b]=q):t[b].Pc[c-2]=q;return[]});return[]})},b:(a,b,c,d,e,f,g,h,k,n)=>{b=
|
|
454
|
+
R(b);e=U(d,e);T([],[a],p=>{p=p[0];var u=`${p.name}.${b}`,t={get(){xc(`Cannot access ${u} due to unbound types`,[c,g])},enumerable:!0,configurable:!0};t.set=k?()=>xc(`Cannot access ${u} due to unbound types`,[c,g]):()=>{throw new P(u+" is a read-only property");};Object.defineProperty(p.Gc.ad,b,t);T([],k?[c,g]:[c],C=>{var q=C[0],r={get(){var y=Cc(this,p,u+" getter");return q.Kc(e(f,y))},enumerable:!0};if(k){k=U(h,k);var x=C[1];r.set=function(y){var z=Cc(this,p,u+" setter"),F=[];k(n,z,x.Oc(F,y));Xb(F)}}Object.defineProperty(p.Gc.ad,
|
|
455
|
+
b,r);return[]});return[]})},nb:a=>S(a,Ec),Qa:(a,b,c,d,e)=>{b=R(b);e=0===e?"object":1===e?"number":"string";switch(e){case "object":function g(){}g.values={};S(a,{name:b,constructor:g,valueType:e,Kc:function(h){return this.constructor.values[h]},Oc:(h,k)=>k.value,Wc:Fc(b,c,d),Vc:null});ic(b,g);break;case "number":var f={};S(a,{name:b,de:f,valueType:e,Kc:h=>h,Oc:(h,k)=>k,Wc:Fc(b,c,d),Vc:null});ic(b,f);delete l[b].hd;break;case "string":f={},S(a,{name:b,Fe:{},Ae:{},de:f,valueType:e,Kc:function(h){return this.Ae[h]},
|
|
456
|
+
Oc:function(h,k){return this.Fe[k]},Wc:Fc(b,c,d),Vc:null}),ic(b,f),delete l[b].hd}},r:(a,b,c)=>{var d=Sb(a,"enum");b=R(b);switch(d.valueType){case "object":a=d.constructor;d=Object.create(d.constructor.prototype,{value:{value:c},constructor:{value:Hb(`${d.name}_${b}`,function(){})}});a.values[c]=d;a[b]=d;break;case "number":d.de[b]=c;break;case "string":d.Fe[b]=c,d.Ae[c]=b,d.de[b]=b}},Ia:(a,b,c)=>{b=R(b);S(a,{name:b,Kc:d=>d,Oc:(d,e)=>e,Wc:Gc(b,c),Vc:null})},l:(a,b,c,d,e,f)=>{var g=Ac(b,c);a=R(a);
|
|
457
|
+
a=Bc(a);e=U(d,e);ic(a,function(){xc(`Cannot call ${a} due to unbound types`,g)},b-1);T([],g,h=>{uc(a,zc(a,[h[0],null].concat(h.slice(1)),null,e,f),b-1);return[]})},C:(a,b,c,d,e)=>{b=R(b);let f=h=>h;if(0===d){var g=32-8*c;f=h=>h<<g>>>g;e=f(e)}S(a,{name:b,Kc:f,Oc:(h,k)=>k,Wc:cc(b,c,0!==d),Vc:null})},k:(a,b,c)=>{function d(f){return new e(A.buffer,J[f+4>>2],J[f>>2])}var e=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][b];c=
|
|
458
|
+
R(c);S(a,{name:c,Kc:d,Wc:d},{cf:!0})},ob:(a,b)=>{b=R(b);S(a,{name:b,Kc(c){var d=(d=c+4)?L(B,d,J[c>>2],!0):"";Qb(c);return d},Oc(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 P("Cannot pass non-string to std::string");var f=e?Ua(d):d.length;var g=sd(4+f+1),h=g+4;J[g>>2]=f;e?M(d,B,h,f+1):B.set(d,h);null!==c&&c.push(Qb,g);return g},Wc:Yb,Vc(c){Qb(c)}})},sa:(a,b,c)=>{c=R(c);if(2===b){var d=Ic;var e=Jc;var f=
|
|
459
|
+
Kc}else d=Lc,e=Mc,f=Nc;S(a,{name:c,Kc:g=>{var h=d(g+4,J[g>>2]*b,!0);Qb(g);return h},Oc:(g,h)=>{if("string"!=typeof h)throw new P(`Cannot pass non-string to C++ string type ${c}`);var k=f(h),n=sd(4+k+b);J[n>>2]=k/b;e(h,n+4,k+b);null!==g&&g.push(Qb,n);return n},Wc:Yb,Vc(g){Qb(g)}})},Fb:(a,b,c,d,e,f)=>{Wb[a]={name:R(b),fe:U(c,d),dd:U(e,f),ne:[]}},yb:(a,b,c,d,e,f,g,h,k,n)=>{Wb[a].ne.push({We:R(b),bf:c,$e:U(d,e),af:f,rf:g,qf:U(h,k),sf:n})},rb:(a,b)=>{b=R(b);S(a,{jf:!0,name:b,Kc:()=>{},Oc:()=>{}})},zb:()=>
|
|
460
|
+
{throw Infinity;},q:(a,b,c)=>{var [d,...e]=Qc(a,b),f=d.Oc.bind(d),g=e.map(k=>k.Wc.bind(k));a--;var h=Array(a);b=`methodCaller<(${e.map(k=>k.name)}) => ${d.name}>`;return Pc(Hb(b,(k,n,p,u)=>{for(var t=0,C=0;C<a;++C)h[C]=g[C](u+t),t+=8;switch(c){case 0:var q=Q(k).apply(null,h);break;case 2:q=Reflect.construct(Q(k),h);break;case 3:q=h[0];break;case 1:q=Q(k)[Sc(n)](...h)}k=[];q=f(k,q);k.length&&(J[p>>2]=Kb(k));return q}))},xb:Dc,pb:(a,b)=>{a=Q(a);b=Q(b);return Kb(a[b])},Ha:a=>{9<a&&(Jb[a+1]+=1)},p:(a,
|
|
461
|
+
b,c,d,e)=>Oc[a](b,c,d,e),ub:()=>Kb([]),wb:a=>Kb(Sc(a)),nc:()=>Kb({}),_a:a=>{var b=Q(a);Xb(b);Dc(a)},w:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},Bb:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);E[b>>2]=a.getUTCSeconds();E[b+4>>2]=a.getUTCMinutes();E[b+8>>2]=a.getUTCHours();E[b+12>>2]=a.getUTCDate();E[b+16>>2]=a.getUTCMonth();E[b+20>>2]=a.getUTCFullYear()-1900;E[b+24>>2]=a.getUTCDay();E[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},Cb:function(a,
|
|
462
|
+
b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);E[b>>2]=a.getSeconds();E[b+4>>2]=a.getMinutes();E[b+8>>2]=a.getHours();E[b+12>>2]=a.getDate();E[b+16>>2]=a.getMonth();E[b+20>>2]=a.getFullYear()-1900;E[b+24>>2]=a.getDay();var c=a.getFullYear();E[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?Uc:Tc)[a.getMonth()]+a.getDate()-1|0;E[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();
|
|
463
|
+
E[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},Db:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();J[a>>2]=60*Math.max(f,e);E[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,"0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(M(a,B,c,17),M(b,B,d,17)):(M(a,B,d,17),M(b,B,c,17))},bb:function(a,b,c){(a=v[a].Tc.Qd)&&a.beginPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,
|
|
464
|
+
4*c,b))},Mb:function(a,b,c){if(!(0<=a&&3>=a))return 28;wa[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},tb:function(a,b,c){var d=l.images;d||(d=new Map,l.images=d);var e=new Image;d.set(a,e);b=l.HEAP8.subarray(b,b+c);c=new Uint8Array(c);c.set(b);e.src=URL.createObjectURL(new Blob([c],{type:"image/png"}));e.onload=function(){l._setWebImage(a,e.width,e.height)}},sb:function(a){var b=l.images;b&&b.get(a)&&b.delete(a)},y:(a,b,c)=>{Vc.length=0;for(var d;d=B[b++];){var e=
|
|
465
|
+
105!=d;e&=112!=d;c+=e&&c%8?4:0;Vc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?E[c>>2]:va[c>>3]);c+=e?8:4}return zd[a](...Vc)},Lb:()=>Date.now(),jb:()=>performance.now(),Ab:a=>{var b=B.length;a>>>=0;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);a:{d=(Math.min(2147483648,65536*Math.ceil(Math.max(a,d)/65536))-Aa.buffer.byteLength+65535)/65536|0;try{Aa.grow(d);za();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},t:(a,b)=>{a=v[a];b=b?L(B,b):"";b.startsWith("GL_")&&
|
|
466
|
+
(b=b.slice(3));"WEBGL_draw_instanced_base_vertex_base_instance"==b&&Wc(V);"WEBGL_multi_draw_instanced_base_vertex_base_instance"==b&&Xc(V);"WEBGL_multi_draw"==b&&(V.lf=V.getExtension("WEBGL_multi_draw"));"EXT_polygon_offset_clamp"==b&&(V.Ve=V.getExtension("EXT_polygon_offset_clamp"));"EXT_clip_control"==b&&(V.Ue=V.getExtension("EXT_clip_control"));"WEBGL_polygon_mode"==b&&(V.vf=V.getExtension("WEBGL_polygon_mode"));return!!a.Tc.getExtension(b)},i:()=>m?m.handle:0,Ka:a=>ha(a)?0:-5,$a:function(a){a=
|
|
467
|
+
v[a].Tc;a.xe=a.getExtension("WEBGL_provoking_vertex");return!!a.xe},eb:function(a){a=v[a].Tc;const b=a.getExtension("WEBGL_shader_pixel_local_storage");if(b&&b.isCoherent()){if(5==b.framebufferTexturePixelLocalStorageWEBGL.length)return a.Qd=b,!0;console.warn("WEBGL_shader_pixel_local_storage is advertised, but a deprecated version has been detected. Disabling.")}return!1},ab:function(a,b,c){(a=v[a].Tc.Qd)&&a.endPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,4*c,b))},Gb:(a,b)=>{var c=0,d=0,e;for(e of od()){var f=
|
|
468
|
+
b+c;J[a+d>>2]=f;c+=M(e,B,f,Infinity)+1;d+=4}return 0},Hb:(a,b)=>{var c=od();J[a>>2]=c.length;a=0;for(var d of c)a+=Ua(d)+1;J[b>>2]=a;return 0},Na:function(a){try{var b=ub(a);if(null===b.md)throw new N(8);b.be&&(b.be=null);try{b.Hc.close&&b.Hc.close(b)}catch(c){throw c;}finally{jb[b.md]=null}b.md=null;return 0}catch(c){if("undefined"==typeof Gb||"ErrnoError"!==c.name)throw c;return c.ld}},Ib:function(a,b,c,d){try{a:{var e=ub(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],k=J[a+4>>2];a+=8;var n=e,p=
|
|
469
|
+
h,u=k,t=f,C=A;if(0>u||0>t)throw new N(28);if(null===n.md)throw new N(8);if(1===(n.flags&2097155))throw new N(8);if(16384===(n.node.mode&61440))throw new N(31);if(!n.Hc.read)throw new N(28);var q="undefined"!=typeof t;if(!q)t=n.position;else if(!n.seekable)throw new N(70);var r=n.Hc.read(n,C,p,u,t);q||(n.position+=r);var x=r;if(0>x){var y=-1;break a}b+=x;if(x<k)break;"undefined"!=typeof f&&(f+=x)}y=b}J[d>>2]=y;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.ld}},
|
|
470
|
+
Eb:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=ub(a);Eb(e,b,c);wa[d>>3]=BigInt(e.position);e.be&&0===b&&0===c&&(e.be=null);return 0}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return f.ld}},Oa:function(a,b,c,d){try{a:{var e=ub(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],k=J[a+4>>2];a+=8;var n=e,p=h,u=k,t=f,C=A;if(0>u||0>t)throw new N(28);if(null===n.md)throw new N(8);if(0===(n.flags&2097155))throw new N(8);if(16384===
|
|
471
|
+
(n.node.mode&61440))throw new N(31);if(!n.Hc.write)throw new N(28);n.seekable&&n.flags&1024&&Eb(n,0,2);var q="undefined"!=typeof t;if(!q)t=n.position;else if(!n.seekable)throw new N(70);var r=n.Hc.write(n,C,p,u,t,void 0);q||(n.position+=r);var x=r;if(0>x){var y=-1;break a}b+=x;if(x<k)break;"undefined"!=typeof f&&(f+=x)}y=b}J[d>>2]=y;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.ld}},cb:function(a,b,c,d,e,f){(a=v[a].Tc.Qd)&&a.framebufferPixelLocalClearValuefvWEBGL(b,
|
|
472
|
+
[c,d,e,f])},db:function(a,b,c,d,e,f){(a=v[a].Tc.Qd)&&a.framebufferTexturePixelLocalStorageWEBGL(b,cd[c],d,e,f)},f:a=>V.activeTexture(a),E:(a,b)=>{V.attachShader(X[a],Y[b])},$b:(a,b,c)=>{V.bindAttribLocation(X[a],b,c?L(B,c):"")},m:(a,b)=>{35051==a?V.Yd=b:35052==a&&(V.ud=b);V.bindBuffer(a,$c[b])},ta:(a,b,c,d,e)=>{V.bindBufferRange(a,b,$c[c],d,e)},e:(a,b)=>{V.bindFramebuffer(a,ad[b])},ha:(a,b)=>{V.bindRenderbuffer(a,bd[b])},Aa:(a,b)=>{V.bindSampler(a,ed[b])},d:(a,b)=>{V.bindTexture(a,cd[b])},Z:a=>{V.bindVertexArray(dd[a])},
|
|
473
|
+
Ub:(a,b,c,d)=>V.blendColor(a,b,c,d),j:a=>V.blendEquation(a),Vb:(a,b)=>V.blendEquationSeparate(a,b),ba:(a,b)=>V.blendFunc(a,b),Wb:(a,b,c,d)=>V.blendFuncSeparate(a,b,c,d),Y:(a,b,c,d,e,f,g,h,k,n)=>V.blitFramebuffer(a,b,c,d,e,f,g,h,k,n),A:(a,b,c,d)=>{c&&b?V.bufferData(a,B,d,c,b):V.bufferData(a,b,d)},ia:(a,b,c,d)=>{c&&V.bufferSubData(a,b,B,d,c)},Ob:a=>V.clear(a),Zb:(a,b,c,d)=>V.clearBufferfi(a,b,c,d),ua:(a,b,c)=>{V.clearBufferfv(a,b,ua,c>>2)},Yb:(a,b,c)=>{V.clearBufferiv(a,b,E,c>>2)},Qb:(a,b,c)=>{V.clearBufferuiv(a,
|
|
474
|
+
b,J,c>>2)},Pb:(a,b,c,d)=>V.clearColor(a,b,c,d),ib:a=>V.clearDepth(a),hb:a=>V.clearStencil(a),aa:(a,b,c,d)=>{V.colorMask(!!a,!!b,!!c,!!d)},ma:a=>{V.compileShader(Y[a])},za:(a,b,c,d,e,f,g,h,k)=>{V.ud||!h?V.compressedTexSubImage2D(a,b,c,d,e,f,g,h,k):V.compressedTexSubImage2D(a,b,c,d,e,f,g,B,k,h)},hc:(a,b,c,d,e,f,g,h,k,n,p)=>{V.ud?V.compressedTexSubImage3D(a,b,c,d,e,f,g,h,k,n,p):V.compressedTexSubImage3D(a,b,c,d,e,f,g,h,k,B,p,n)},O:()=>{var a=kd(X),b=V.createProgram();b.name=a;b.Nd=b.Ld=b.Md=0;b.he=1;
|
|
475
|
+
X[a]=b;return a},oa:a=>{var b=kd(Y);Y[b]=V.createShader(a);return b},Da:a=>V.cullFace(a),pa:(a,b)=>{for(var c=0;c<a;c++){var d=E[b+4*c>>2],e=$c[d];e&&(V.deleteBuffer(e),e.name=0,$c[d]=null,d==V.Yd&&(V.Yd=0),d==V.ud&&(V.ud=0))}},G:(a,b)=>{for(var c=0;c<a;++c){var d=E[b+4*c>>2],e=ad[d];e&&(V.deleteFramebuffer(e),e.name=0,ad[d]=null)}},ra:a=>{if(a){var b=X[a];b?(V.deleteProgram(b),b.name=0,X[a]=null):Z||=1281}},Ca:(a,b)=>{for(var c=0;c<a;c++){var d=E[b+4*c>>2],e=bd[d];e&&(V.deleteRenderbuffer(e),e.name=
|
|
476
|
+
0,bd[d]=null)}},dc:(a,b)=>{for(var c=0;c<a;c++){var d=E[b+4*c>>2],e=ed[d];e&&(V.deleteSampler(e),e.name=0,ed[d]=null)}},S:a=>{if(a){var b=Y[a];b?(V.deleteShader(b),Y[a]=null):Z||=1281}},B:(a,b)=>{for(var c=0;c<a;c++){var d=E[b+4*c>>2],e=cd[d];e&&(V.deleteTexture(e),e.name=0,cd[d]=null)}},qa:(a,b)=>{for(var c=0;c<a;c++){var d=E[b+4*c>>2];V.deleteVertexArray(dd[d]);dd[d]=null}},Fa:a=>V.depthFunc(a),K:a=>{V.depthMask(!!a)},Ga:(a,b)=>V.depthRange(a,b),g:a=>V.disable(a),Sb:a=>{V.disableVertexAttribArray(a)},
|
|
477
|
+
M:(a,b,c)=>{V.drawArrays(a,b,c)},Ta:(a,b,c,d)=>{V.drawArraysInstanced(a,b,c,d)},fa:(a,b)=>{for(var c=pd[a],d=0;d<a;d++)c[d]=E[b+4*d>>2];V.drawBuffers(c)},Tb:(a,b,c,d)=>{V.drawElements(a,b,c,d)},V:(a,b,c,d,e)=>{V.drawElementsInstanced(a,b,c,d,e)},u:a=>V.enable(a),x:a=>{V.enableVertexAttribArray(a)},mc:()=>V.finish(),Sa:()=>V.flush(),ea:(a,b,c,d)=>{V.framebufferRenderbuffer(a,b,c,bd[d])},n:(a,b,c,d,e)=>{V.framebufferTexture2D(a,b,c,cd[d],e)},_b:(a,b,c,d,e)=>{V.framebufferTextureLayer(a,b,cd[c],d,e)},
|
|
478
|
+
ca:a=>V.frontFace(a),ja:(a,b)=>{ld(a,b,"createBuffer",$c)},I:(a,b)=>{ld(a,b,"createFramebuffer",ad)},Wa:(a,b)=>{ld(a,b,"createRenderbuffer",bd)},fc:(a,b)=>{ld(a,b,"createSampler",ed)},D:(a,b)=>{ld(a,b,"createTexture",cd)},Ba:(a,b)=>{ld(a,b,"createVertexArray",dd)},La:a=>V.generateMipmap(a),ec:(a,b)=>rd(a,b,2),h:(a,b)=>rd(a,b,0),ac:(a,b,c,d)=>{a=V.getProgramInfoLog(X[a]);null===a&&(a="(unknown error)");b=0<b&&d?M(a,B,d,b):0;c&&(E[c>>2]=b)},ga:(a,b,c)=>{if(c)if(a>=Zc)Z||=1281;else if(a=X[a],35716==
|
|
479
|
+
b)a=V.getProgramInfoLog(a),null===a&&(a="(unknown error)"),E[c>>2]=a.length+1;else if(35719==b){if(!a.Nd){var d=V.getProgramParameter(a,35718);for(b=0;b<d;++b)a.Nd=Math.max(a.Nd,V.getActiveUniform(a,b).name.length+1)}E[c>>2]=a.Nd}else if(35722==b){if(!a.Ld)for(d=V.getProgramParameter(a,35721),b=0;b<d;++b)a.Ld=Math.max(a.Ld,V.getActiveAttrib(a,b).name.length+1);E[c>>2]=a.Ld}else if(35381==b){if(!a.Md)for(d=V.getProgramParameter(a,35382),b=0;b<d;++b)a.Md=Math.max(a.Md,V.getActiveUniformBlockName(a,
|
|
480
|
+
b).length+1);E[c>>2]=a.Md}else E[c>>2]=V.getProgramParameter(a,b);else Z||=1281},cc:(a,b,c,d)=>{a=V.getShaderInfoLog(Y[a]);null===a&&(a="(unknown error)");b=0<b&&d?M(a,B,d,b):0;c&&(E[c>>2]=b)},Va:(a,b,c)=>{c?35716==b?(a=V.getShaderInfoLog(Y[a]),null===a&&(a="(unknown error)"),E[c>>2]=a?a.length+1:0):35720==b?(a=V.getShaderSource(Y[a]),E[c>>2]=a?a.length+1:0):E[c>>2]=V.getShaderParameter(Y[a],b):Z||=1281},Ra:a=>{var b=fd[a];if(!b){switch(a){case 7939:b=td(qd().join(" "));break;case 7936:case 7937:case 37445:case 37446:(b=
|
|
481
|
+
V.getParameter(a))||(Z||=1280);b=b?td(b):0;break;case 7938:b=td(`OpenGL ES 3.0 (${V.getParameter(7938)})`);break;case 35724:b=V.getParameter(35724);var c=b.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==c&&(3==c[1].length&&(c[1]+="0"),b=`OpenGL ES GLSL ES ${c[1]} (${b})`);b=td(b);break;default:Z||=1280}fd[a]=b}return b},lc:(a,b)=>{if(2>m.version)return Z||=1282,0;var c=gd[a];if(c)return 0>b||b>=c.length?(Z||=1281,0):c[b];switch(a){case 7939:return c=qd().map(td),c=gd[a]=c,0>b||b>=c.length?
|
|
482
|
+
(Z||=1281,0):c[b];default:return Z||=1280,0}},R:(a,b)=>V.getUniformBlockIndex(X[a],b?L(B,b):""),X:(a,b)=>{b=b?L(B,b):"";if(a=X[a]){var c=a,d=c.Bd,e=c.De,f;if(!d){c.Bd=d={};c.Ce={};var g=V.getProgramParameter(c,35718);for(f=0;f<g;++f){var h=V.getActiveUniform(c,f);var k=h.name;h=h.size;var n=ud(k);n=0<n?k.slice(0,n):k;var p=c.he;c.he+=h;e[n]=[h,p];for(k=0;k<h;++k)d[p]=k,c.Ce[p++]=n}}c=a.Bd;d=0;e=b;f=ud(b);0<f&&(d=parseInt(b.slice(f+1))>>>0,e=b.slice(0,f));if((e=a.De[e])&&d<e[0]&&(d+=e[1],c[d]=c[d]||
|
|
483
|
+
V.getUniformLocation(a,b)))return d}else Z||=1281;return-1},L:(a,b,c)=>{for(var d=pd[b],e=0;e<b;e++)d[e]=E[c+4*e>>2];V.invalidateFramebuffer(a,d)},Xa:a=>(a=$c[a])?V.isBuffer(a):0,ic:a=>(a=ad[a])?V.isFramebuffer(a):0,kc:a=>(a=X[a])?V.isProgram(a):0,jc:a=>(a=dd[a])?V.isVertexArray(a):0,la:a=>{a=X[a];V.linkProgram(a);a.Bd=0;a.De={}},v:(a,b)=>{3317==a?hd=b:3314==a&&(jd=b);V.pixelStorei(a,b)},Xb:(a,b)=>V.polygonOffset(a,b),Ya:a=>V.readBuffer(a),Rb:(a,b,c,d,e,f,g)=>{if(V.Yd)V.readPixels(a,b,c,d,e,f,g);
|
|
484
|
+
else{var h=vd(f);g>>>=31-Math.clz32(h.BYTES_PER_ELEMENT);V.readPixels(a,b,c,d,e,f,h,g)}},xa:(a,b,c,d,e)=>V.renderbufferStorageMultisample(a,b,c,d,e),va:(a,b,c)=>{V.samplerParameterf(ed[a],b,c)},H:(a,b,c)=>{V.samplerParameteri(ed[a],b,c)},Ea:(a,b,c,d)=>V.scissor(a,b,c,d),na:(a,b,c,d)=>{for(var e="",f=0;f<b;++f){var g=(g=J[c+4*f>>2])?L(B,g,d?J[d+4*f>>2]:void 0):"";e+=g}V.shaderSource(Y[a],e)},gb:(a,b,c)=>V.stencilFunc(a,b,c),J:(a,b,c,d)=>V.stencilFuncSeparate(a,b,c,d),$:a=>V.stencilMask(a),Ua:(a,b)=>
|
|
485
|
+
V.stencilMaskSeparate(a,b),fb:(a,b,c)=>V.stencilOp(a,b,c),_:(a,b,c,d)=>V.stencilOpSeparate(a,b,c,d),s:(a,b,c)=>V.texParameteri(a,b,c),o:(a,b,c,d,e)=>V.texStorage2D(a,b,c,d,e),wa:(a,b,c,d,e,f)=>V.texStorage3D(a,b,c,d,e,f),F:(a,b,c,d,e,f,g,h,k)=>{if(V.ud)V.texSubImage2D(a,b,c,d,e,f,g,h,k);else if(k){var n=vd(h);V.texSubImage2D(a,b,c,d,e,f,g,h,n,k>>>31-Math.clz32(n.BYTES_PER_ELEMENT))}else{if(k){n=vd(h);var p=f*((jd||e)*({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[g-6402]||1)*n.BYTES_PER_ELEMENT+
|
|
486
|
+
hd-1&-hd);k=n.subarray(k>>>31-Math.clz32(n.BYTES_PER_ELEMENT),k+p>>>31-Math.clz32(n.BYTES_PER_ELEMENT))}else k=null;V.texSubImage2D(a,b,c,d,e,f,g,h,k)}},gc:(a,b,c,d,e,f,g,h,k,n,p)=>{if(V.ud)V.texSubImage3D(a,b,c,d,e,f,g,h,k,n,p);else if(p){var u=vd(n);V.texSubImage3D(a,b,c,d,e,f,g,h,k,n,u,p>>>31-Math.clz32(u.BYTES_PER_ELEMENT))}else V.texSubImage3D(a,b,c,d,e,f,g,h,k,n,null)},ka:(a,b)=>{var c=V,d=c.uniform1i;var e=V.Qe;if(e){var f=e.Bd[a];"number"==typeof f&&(e.Bd[a]=f=V.getUniformLocation(e,e.Ce[a]+
|
|
487
|
+
(0<f?`[${f}]`:"")));a=f}else Z||=1282,a=void 0;d.call(c,a,b)},Q:(a,b,c)=>{a=X[a];V.uniformBlockBinding(a,b,c)},T:a=>{a=X[a];V.useProgram(a);V.Qe=a},P:(a,b)=>{V.vertexAttribDivisor(a,b)},W:(a,b,c,d,e)=>{V.vertexAttribIPointer(a,b,c,d,e)},z:(a,b,c,d,e,f)=>{V.vertexAttribPointer(a,b,c,!!d,e,f)},N:(a,b,c,d)=>V.viewport(a,b,c,d),kb:Dd,lb:function(){return-1<navigator.platform.indexOf("Win")},Za:function(a,b){(a=v[a].Tc.xe)&&a.provokingVertexWEBGL(b)},vb:function(a,b){var c=l.images;c&&(b=c.get(b))&&(a=
|
|
488
|
+
v[a].Tc,a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,b),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1))},mb:function(a,b,c){b=new Uint8Array(Aa.buffer,b,c);c=new Uint8Array(c);c.set(b);createImageBitmap(new Blob([c])).then(function(d){var e=(new OffscreenCanvas(d.width,d.height)).getContext("2d");e.drawImage(d,0,0);e=e.getImageData(0,0,d.width,d.height);var f=e.data.length,g=l.Je(f);l.wf.set(e.data,g);l.yf(a,d.width,d.height,g,f)}).catch(function(d){d=
|
|
489
|
+
d.message||"decode failed";var e=l.Of(d)+1,f=l.Je(e);l.Uf(d,f,e);l.zf(a,f);l.xf(f)})}};function Dd(a,b,c){var d=Cd();try{vc.get(a)(b,c)}catch(e){Bd(d);if(e!==e+0)throw e;Ad(1,0)}}var Fd;
|
|
490
|
+
Fd=await (async function(){function a(c){c=Fd=c.exports;Qb=c.rc;sd=c.sc;l._setWebImage=c.tc;Pb=c.uc;l._wasm_image_decode_complete=c.vc;l._wasm_image_decode_error=c.wc;wd=l._ma_device__on_notification_unlocked=c.xc;l._ma_malloc_emscripten=c.yc;l._ma_free_emscripten=c.zc;xd=l._ma_device_process_pcm_frames_capture__webaudio=c.Ac;yd=l._ma_device_process_pcm_frames_playback__webaudio=c.Bc;Ad=c.Cc;Bd=c.Dc;Cd=c.Ec;Aa=c.oc;vc=c.qc;za();return Fd}var b={a:Ed};if(l.instantiateWasm)return new Promise(c=>
|
|
487
491
|
{l.instantiateWasm(b,(d,e)=>{c(a(d,e))})});Ca??=l.locateFile?l.locateFile("webgl2_advanced.wasm",ka):ka+"webgl2_advanced.wasm";return a((await Fa(b)).instance)}());
|
|
488
|
-
(function(){function a(){l.calledRun=!0;if(!qa){ya=!0;if(!l.noFSInit&&!
|
|
492
|
+
(function(){function a(){l.calledRun=!0;if(!qa){ya=!0;if(!l.noFSInit&&!lb){var b,c;lb=!0;b??=l.stdin;c??=l.stdout;d??=l.stderr;b?Fb("stdin",b):Cb("/dev/tty","/dev/stdin");c?Fb("stdout",null,c):Cb("/dev/tty","/dev/stdout");d?Fb("stderr",null,d):Cb("/dev/tty1","/dev/stderr");Db("/dev/stdin",0);Db("/dev/stdout",1);Db("/dev/stderr",1)}Fd.pc();mb=!1;ra?.(l);l.onRuntimeInitialized?.();if(l.postRun)for("function"==typeof l.postRun&&(l.postRun=[l.postRun]);l.postRun.length;){var d=l.postRun.shift();Ha.push(d)}Ga(Ha)}}
|
|
489
493
|
if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.length;)Ja();Ga(Ia);l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1);a()},1)):a()})();ya?moduleRtn=l:moduleRtn=new Promise((a,b)=>{ra=a;sa=b});
|
|
490
494
|
;return moduleRtn}})();
|
|
491
495
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Rive);
|
|
@@ -495,7 +499,7 @@ if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.leng
|
|
|
495
499
|
/* 5 */
|
|
496
500
|
/***/ ((module) => {
|
|
497
501
|
|
|
498
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.
|
|
502
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.42.0","description":"Rive\'s webgl2 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)","Chris Dalton <chris@rive.app> (https://rive.app)"],"license":"MIT","files":["rive.js","rive.wasm","rive_fallback.wasm","rive.js.map","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
|
|
499
503
|
|
|
500
504
|
/***/ }),
|
|
501
505
|
/* 6 */
|
|
@@ -504,12 +508,16 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"
|
|
|
504
508
|
__webpack_require__.r(__webpack_exports__);
|
|
505
509
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
506
510
|
/* harmony export */ AccessibilityOverlay: () => (/* reexport safe */ _accessibilityOverlay__WEBPACK_IMPORTED_MODULE_1__.AccessibilityOverlay),
|
|
511
|
+
/* harmony export */ CHECK_STATE_MASK: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.CHECK_STATE_MASK),
|
|
512
|
+
/* harmony export */ CHECK_STATE_OFFSET: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.CHECK_STATE_OFFSET),
|
|
507
513
|
/* harmony export */ SemanticActionType: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType),
|
|
514
|
+
/* harmony export */ SemanticCheckState: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticCheckState),
|
|
508
515
|
/* harmony export */ SemanticMode: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticMode),
|
|
509
516
|
/* harmony export */ SemanticRole: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole),
|
|
510
517
|
/* harmony export */ SemanticState: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState),
|
|
511
518
|
/* harmony export */ SemanticTrait: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait),
|
|
512
519
|
/* harmony export */ SemanticTreeModel: () => (/* reexport safe */ _semanticTreeModel__WEBPACK_IMPORTED_MODULE_0__.SemanticTreeModel),
|
|
520
|
+
/* harmony export */ checkStateOf: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.checkStateOf),
|
|
513
521
|
/* harmony export */ hasState: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.hasState),
|
|
514
522
|
/* harmony export */ hasTrait: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.hasTrait),
|
|
515
523
|
/* harmony export */ roleName: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_2__.roleName),
|
|
@@ -974,11 +982,15 @@ function applyGeometry(target, src) {
|
|
|
974
982
|
|
|
975
983
|
__webpack_require__.r(__webpack_exports__);
|
|
976
984
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
985
|
+
/* harmony export */ CHECK_STATE_MASK: () => (/* binding */ CHECK_STATE_MASK),
|
|
986
|
+
/* harmony export */ CHECK_STATE_OFFSET: () => (/* binding */ CHECK_STATE_OFFSET),
|
|
977
987
|
/* harmony export */ SemanticActionType: () => (/* binding */ SemanticActionType),
|
|
988
|
+
/* harmony export */ SemanticCheckState: () => (/* binding */ SemanticCheckState),
|
|
978
989
|
/* harmony export */ SemanticMode: () => (/* binding */ SemanticMode),
|
|
979
990
|
/* harmony export */ SemanticRole: () => (/* binding */ SemanticRole),
|
|
980
991
|
/* harmony export */ SemanticState: () => (/* binding */ SemanticState),
|
|
981
992
|
/* harmony export */ SemanticTrait: () => (/* binding */ SemanticTrait),
|
|
993
|
+
/* harmony export */ checkStateOf: () => (/* binding */ checkStateOf),
|
|
982
994
|
/* harmony export */ hasState: () => (/* binding */ hasState),
|
|
983
995
|
/* harmony export */ hasTrait: () => (/* binding */ hasTrait),
|
|
984
996
|
/* harmony export */ roleName: () => (/* binding */ roleName),
|
|
@@ -1013,14 +1025,17 @@ var SemanticRole = {
|
|
|
1013
1025
|
//
|
|
1014
1026
|
// Bits 0-7 are trait-gated (only meaningful when the corresponding
|
|
1015
1027
|
// SemanticTrait is set). Bits 8-13 are non-trait states.
|
|
1028
|
+
//
|
|
1029
|
+
// Check state is the exception: it is a two-bit *field* at bits 2-3 rather
|
|
1030
|
+
// than a flag, because a checkbox is tri-state. It is not a member of this
|
|
1031
|
+
// table — read it with checkStateOf().
|
|
1016
1032
|
// ---------------------------------------------------------------------------
|
|
1017
1033
|
var SemanticState = {
|
|
1018
1034
|
None: 0,
|
|
1019
1035
|
// Trait-gated
|
|
1020
1036
|
Expanded: 1 << 0, // requires Expandable
|
|
1021
1037
|
Selected: 1 << 1, // requires Selectable
|
|
1022
|
-
|
|
1023
|
-
Mixed: 1 << 3, // requires Checkable; wins over Checked
|
|
1038
|
+
// Bits 2-3 are the check state field, not independent flags -- see SemanticCheckState.
|
|
1024
1039
|
Toggled: 1 << 4, // requires Toggleable
|
|
1025
1040
|
Required: 1 << 5, // requires Requirable
|
|
1026
1041
|
Disabled: 1 << 6, // requires Enablable
|
|
@@ -1036,6 +1051,30 @@ var SemanticState = {
|
|
|
1036
1051
|
function hasState(flags, state) {
|
|
1037
1052
|
return (flags & state) !== 0;
|
|
1038
1053
|
}
|
|
1054
|
+
// SemanticCheckState — mirrors rive::SemanticCheckState
|
|
1055
|
+
//
|
|
1056
|
+
// The tri-state of a checkable node. Occupies two bits of stateFlags at
|
|
1057
|
+
// CHECK_STATE_OFFSET, so it is read as a value rather than tested as a flag.
|
|
1058
|
+
// Only meaningful when the Checkable trait is set.
|
|
1059
|
+
var SemanticCheckState = {
|
|
1060
|
+
Unchecked: 0,
|
|
1061
|
+
Checked: 1,
|
|
1062
|
+
Mixed: 2,
|
|
1063
|
+
};
|
|
1064
|
+
/** Bit offset of the check field within stateFlags. */
|
|
1065
|
+
var CHECK_STATE_OFFSET = 2;
|
|
1066
|
+
/** Mask of the check field within stateFlags. */
|
|
1067
|
+
var CHECK_STATE_MASK = 3 << CHECK_STATE_OFFSET;
|
|
1068
|
+
/**
|
|
1069
|
+
* Decodes the check field out of `flags`. The field is two bits. Returns 0, 1, or 2
|
|
1070
|
+
* per the mapping in SemanticCheckState.
|
|
1071
|
+
*/
|
|
1072
|
+
function checkStateOf(flags) {
|
|
1073
|
+
var value = (flags & CHECK_STATE_MASK) >> CHECK_STATE_OFFSET;
|
|
1074
|
+
return value >= SemanticCheckState.Mixed
|
|
1075
|
+
? SemanticCheckState.Mixed
|
|
1076
|
+
: value;
|
|
1077
|
+
}
|
|
1039
1078
|
/**
|
|
1040
1079
|
* Controls when the instance builds semantic trees and accessibility overlays.
|
|
1041
1080
|
*
|
|
@@ -1102,6 +1141,14 @@ function stateNames(flags) {
|
|
|
1102
1141
|
if (flags & bit)
|
|
1103
1142
|
active.push(name_2);
|
|
1104
1143
|
}
|
|
1144
|
+
switch (checkStateOf(flags)) {
|
|
1145
|
+
case SemanticCheckState.Checked:
|
|
1146
|
+
active.push("Checked");
|
|
1147
|
+
break;
|
|
1148
|
+
case SemanticCheckState.Mixed:
|
|
1149
|
+
active.push("Mixed");
|
|
1150
|
+
break;
|
|
1151
|
+
}
|
|
1105
1152
|
return active.join(", ") || "none";
|
|
1106
1153
|
}
|
|
1107
1154
|
function traitNames(flags) {
|
|
@@ -1870,13 +1917,15 @@ var AccessibilityOverlay = /** @class */ (function () {
|
|
|
1870
1917
|
removeAttr(el, "aria-selected");
|
|
1871
1918
|
}
|
|
1872
1919
|
if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Checkable) && ARIA_CHECKED_ROLES.has(role)) {
|
|
1873
|
-
//
|
|
1874
|
-
//
|
|
1875
|
-
|
|
1920
|
+
// Check state is a tri-state field, but not every checkable role
|
|
1921
|
+
// accepts all three values — see ARIA_MIXED_ROLES.
|
|
1922
|
+
var checkState = (0,_types__WEBPACK_IMPORTED_MODULE_0__.checkStateOf)(flags);
|
|
1923
|
+
if (checkState === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticCheckState.Mixed &&
|
|
1924
|
+
ARIA_MIXED_ROLES.has(role)) {
|
|
1876
1925
|
setAttr(el, "aria-checked", "mixed");
|
|
1877
1926
|
}
|
|
1878
1927
|
else {
|
|
1879
|
-
setBoolAttr(el, "aria-checked",
|
|
1928
|
+
setBoolAttr(el, "aria-checked", checkState === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticCheckState.Checked);
|
|
1880
1929
|
}
|
|
1881
1930
|
}
|
|
1882
1931
|
else {
|
|
@@ -2136,6 +2185,15 @@ var ARIA_CHECKED_ROLES = new Set([
|
|
|
2136
2185
|
_types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton,
|
|
2137
2186
|
_types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl,
|
|
2138
2187
|
]);
|
|
2188
|
+
/**
|
|
2189
|
+
* aria-checked="mixed": checkbox only. ARIA defines checkbox as three-valued
|
|
2190
|
+
* (true/false/mixed) but radio and switch as two-valued (true/false), so an
|
|
2191
|
+
* indeterminate check state degrades to false for those roles rather than
|
|
2192
|
+
* emitting a value they do not support.
|
|
2193
|
+
*/
|
|
2194
|
+
var ARIA_MIXED_ROLES = new Set([
|
|
2195
|
+
_types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox,
|
|
2196
|
+
]);
|
|
2139
2197
|
/**
|
|
2140
2198
|
* aria-pressed: button only. switch is a button subclass in ARIA but uses
|
|
2141
2199
|
* aria-checked (not aria-pressed) for its on/off state — it is intentionally
|
|
@@ -2984,14 +3042,26 @@ var __extends = (undefined && undefined.__extends) || (function () {
|
|
|
2984
3042
|
};
|
|
2985
3043
|
})();
|
|
2986
3044
|
var FileFinalizer = /** @class */ (function () {
|
|
2987
|
-
function FileFinalizer(file) {
|
|
3045
|
+
function FileFinalizer(file, session) {
|
|
3046
|
+
if (session === void 0) { session = null; }
|
|
2988
3047
|
this.selfUnref = false;
|
|
2989
3048
|
this._file = file;
|
|
3049
|
+
this._session = session;
|
|
2990
3050
|
}
|
|
2991
3051
|
FileFinalizer.prototype.unref = function () {
|
|
2992
3052
|
if (this._file) {
|
|
2993
3053
|
this._file.unref();
|
|
2994
3054
|
}
|
|
3055
|
+
// After the file, never before: the file's resources belong to the session.
|
|
3056
|
+
if (this._session) {
|
|
3057
|
+
this._session.delete();
|
|
3058
|
+
this._session = null;
|
|
3059
|
+
}
|
|
3060
|
+
};
|
|
3061
|
+
// Disarms the GC path for a file cleanup() already released.
|
|
3062
|
+
FileFinalizer.prototype.release = function () {
|
|
3063
|
+
this._file = null;
|
|
3064
|
+
this._session = null;
|
|
2995
3065
|
};
|
|
2996
3066
|
return FileFinalizer;
|
|
2997
3067
|
}());
|
|
@@ -3075,8 +3145,10 @@ var FontWrapper = /** @class */ (function (_super) {
|
|
|
3075
3145
|
return FontWrapper;
|
|
3076
3146
|
}(AssetWrapper));
|
|
3077
3147
|
var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
3078
|
-
function CustomFileAssetLoaderWrapper(runtime, loaderCallback) {
|
|
3148
|
+
function CustomFileAssetLoaderWrapper(runtime, loaderCallback, session) {
|
|
3149
|
+
if (session === void 0) { session = null; }
|
|
3079
3150
|
this._assetLoaderCallback = loaderCallback;
|
|
3151
|
+
this._session = session;
|
|
3080
3152
|
this.assetLoader = new runtime.CustomFileAssetLoader({
|
|
3081
3153
|
loadContents: this.loadContents.bind(this),
|
|
3082
3154
|
});
|
|
@@ -3084,13 +3156,13 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
|
3084
3156
|
CustomFileAssetLoaderWrapper.prototype.loadContents = function (asset, bytes) {
|
|
3085
3157
|
var assetWrapper;
|
|
3086
3158
|
if (asset.isImage) {
|
|
3087
|
-
assetWrapper = new ImageAssetWrapper(asset);
|
|
3159
|
+
assetWrapper = new ImageAssetWrapper(asset, this._session);
|
|
3088
3160
|
}
|
|
3089
3161
|
else if (asset.isAudio) {
|
|
3090
|
-
assetWrapper = new AudioAssetWrapper(asset);
|
|
3162
|
+
assetWrapper = new AudioAssetWrapper(asset, this._session);
|
|
3091
3163
|
}
|
|
3092
3164
|
else if (asset.isFont) {
|
|
3093
|
-
assetWrapper = new FontAssetWrapper(asset);
|
|
3165
|
+
assetWrapper = new FontAssetWrapper(asset, this._session);
|
|
3094
3166
|
}
|
|
3095
3167
|
else {
|
|
3096
3168
|
return false;
|
|
@@ -3104,11 +3176,15 @@ var CustomFileAssetLoaderWrapper = /** @class */ (function () {
|
|
|
3104
3176
|
* an asset associated wtih the Rive File
|
|
3105
3177
|
*/
|
|
3106
3178
|
var FileAssetWrapper = /** @class */ (function () {
|
|
3107
|
-
function FileAssetWrapper(nativeAsset) {
|
|
3179
|
+
function FileAssetWrapper(nativeAsset, session) {
|
|
3180
|
+
if (session === void 0) { session = null; }
|
|
3108
3181
|
this._nativeFileAsset = nativeAsset;
|
|
3182
|
+
this._session = session;
|
|
3109
3183
|
}
|
|
3110
3184
|
FileAssetWrapper.prototype.decode = function (bytes) {
|
|
3111
|
-
|
|
3185
|
+
// The session travels with the asset so a deferred file's assets are
|
|
3186
|
+
// session-typed without the caller needing to know the file's rendering mode.
|
|
3187
|
+
this._nativeFileAsset.decode(bytes, this._session);
|
|
3112
3188
|
};
|
|
3113
3189
|
Object.defineProperty(FileAssetWrapper.prototype, "name", {
|
|
3114
3190
|
get: function () {
|
|
@@ -4744,8 +4820,23 @@ var RiveFile = /** @class */ (function () {
|
|
|
4744
4820
|
this.destroyed = false;
|
|
4745
4821
|
this.selfUnref = false;
|
|
4746
4822
|
this.bindableArtboards = [];
|
|
4823
|
+
// Deferred rendering was requested; the session may still be null if this
|
|
4824
|
+
// build has no deferred support.
|
|
4825
|
+
this.deferred = false;
|
|
4826
|
+
// The session this file imported through, null when immediate. Owned here:
|
|
4827
|
+
// it has to outlive the file, so it is deleted after the file is released.
|
|
4828
|
+
this.session = null;
|
|
4829
|
+
// Attaching is once per session: a detached session can never replay again,
|
|
4830
|
+
// so a claimed file re-imports for the next instance implicitly. Mirrors the native
|
|
4831
|
+
// latch (WebGL2DeferredSession::everBound, C2DDeferredSession::claim).
|
|
4832
|
+
this._sessionClaimed = false;
|
|
4833
|
+
// Releasing this file has to be deterministic once a session owns its
|
|
4834
|
+
// resources, so the finalizer is disarmed rather than left to GC.
|
|
4835
|
+
this.fileFinalizer = null;
|
|
4836
|
+
this.boundElsewhereWarned = false;
|
|
4747
4837
|
this.src = params.src;
|
|
4748
4838
|
this.buffer = params.buffer;
|
|
4839
|
+
this.deferred = !!params.enableGPUCanvas;
|
|
4749
4840
|
if (params.assetLoader)
|
|
4750
4841
|
this.assetLoader = params.assetLoader;
|
|
4751
4842
|
this.enableRiveAssetCDN =
|
|
@@ -4763,12 +4854,24 @@ var RiveFile = /** @class */ (function () {
|
|
|
4763
4854
|
this.on(EventType.LoadError, params.onLoadError);
|
|
4764
4855
|
}
|
|
4765
4856
|
RiveFile.prototype.releaseFile = function () {
|
|
4766
|
-
var _a;
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4857
|
+
var _a, _b;
|
|
4858
|
+
// Release here rather than leaving it to the finalization registry. The
|
|
4859
|
+
// native file frees GL-backed resources when its last reference goes, and
|
|
4860
|
+
// callers reach this with the renderer's context current; a finalizer runs
|
|
4861
|
+
// with none, so those deletes would silently do nothing.
|
|
4862
|
+
(_a = this.fileFinalizer) === null || _a === void 0 ? void 0 : _a.release();
|
|
4863
|
+
(_b = this.file) === null || _b === void 0 ? void 0 : _b.unref();
|
|
4864
|
+
this.fileFinalizer = null;
|
|
4770
4865
|
this.file = null;
|
|
4771
4866
|
};
|
|
4867
|
+
RiveFile.prototype.releaseSession = function () {
|
|
4868
|
+
var _a;
|
|
4869
|
+
// Known limitation: cleanup() on a file an instance is still drawing
|
|
4870
|
+
// deletes the session under it. A RiveFile's creator holds no reference of
|
|
4871
|
+
// its own, so their cleanup() can take the count to zero.
|
|
4872
|
+
(_a = this.session) === null || _a === void 0 ? void 0 : _a.delete();
|
|
4873
|
+
this.session = null;
|
|
4874
|
+
};
|
|
4772
4875
|
RiveFile.prototype.releaseBindableArtboards = function () {
|
|
4773
4876
|
this.bindableArtboards.forEach(function (bindableArtboard) {
|
|
4774
4877
|
return bindableArtboard.destroy();
|
|
@@ -4776,7 +4879,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4776
4879
|
};
|
|
4777
4880
|
RiveFile.prototype.initData = function () {
|
|
4778
4881
|
return __awaiter(this, void 0, void 0, function () {
|
|
4779
|
-
var _a, error_1, loader, loaderWrapper, _b, fileFinalizer;
|
|
4882
|
+
var _a, error_1, loader, loaderWrapper, _b, error_2, fileFinalizer;
|
|
4780
4883
|
return __generator(this, function (_c) {
|
|
4781
4884
|
switch (_c.label) {
|
|
4782
4885
|
case 0:
|
|
@@ -4799,36 +4902,55 @@ var RiveFile = /** @class */ (function () {
|
|
|
4799
4902
|
if (this.destroyed) {
|
|
4800
4903
|
return [2 /*return*/];
|
|
4801
4904
|
}
|
|
4905
|
+
if (this.deferred && this.session === null) {
|
|
4906
|
+
this.session = RiveFile.makeDeferredSession(this.runtime);
|
|
4907
|
+
}
|
|
4802
4908
|
if (this.assetLoader) {
|
|
4803
|
-
loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader);
|
|
4909
|
+
loaderWrapper = new _utils__WEBPACK_IMPORTED_MODULE_3__.CustomFileAssetLoaderWrapper(this.runtime, this.assetLoader, this.session);
|
|
4804
4910
|
loader = loaderWrapper.assetLoader;
|
|
4805
4911
|
}
|
|
4806
4912
|
// Load the Rive file
|
|
4807
4913
|
if (this.enablePerfMarks)
|
|
4808
4914
|
performance.mark('rive:file-load:start');
|
|
4809
|
-
|
|
4810
|
-
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN)];
|
|
4915
|
+
_c.label = 5;
|
|
4811
4916
|
case 5:
|
|
4917
|
+
_c.trys.push([5, 7, , 8]);
|
|
4918
|
+
_b = this;
|
|
4919
|
+
return [4 /*yield*/, this.runtime.load(new Uint8Array(this.buffer), loader, this.enableRiveAssetCDN, this.session)];
|
|
4920
|
+
case 6:
|
|
4812
4921
|
_b.file = _c.sent();
|
|
4922
|
+
return [3 /*break*/, 8];
|
|
4923
|
+
case 7:
|
|
4924
|
+
error_2 = _c.sent();
|
|
4925
|
+
// The finalizer that would reclaim the session is only registered once
|
|
4926
|
+
// the import succeeds, so a failed load has to release it here.
|
|
4927
|
+
this.releaseSession();
|
|
4928
|
+
throw error_2;
|
|
4929
|
+
case 8:
|
|
4813
4930
|
if (this.enablePerfMarks) {
|
|
4814
4931
|
performance.mark('rive:file-load:end');
|
|
4815
4932
|
performance.measure('rive:file-load', 'rive:file-load:start', 'rive:file-load:end');
|
|
4816
4933
|
}
|
|
4817
|
-
fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file);
|
|
4818
|
-
_utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
|
|
4819
4934
|
if (this.destroyed) {
|
|
4820
4935
|
this.releaseFile();
|
|
4936
|
+
this.releaseSession();
|
|
4821
4937
|
return [2 /*return*/];
|
|
4822
4938
|
}
|
|
4823
|
-
if (this.file
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
}
|
|
4829
|
-
else {
|
|
4939
|
+
if (this.file === null) {
|
|
4940
|
+
// A malformed file resolves to null rather than rejecting. Release the
|
|
4941
|
+
// session now: a finalizer for a file that does not exist would keep it
|
|
4942
|
+
// alive until GC, or for as long as the caller holds the failed RiveFile.
|
|
4943
|
+
this.releaseSession();
|
|
4830
4944
|
this.fireLoadError(RiveFile.fileLoadErrorMessage);
|
|
4945
|
+
return [2 /*return*/];
|
|
4831
4946
|
}
|
|
4947
|
+
fileFinalizer = new _utils__WEBPACK_IMPORTED_MODULE_3__.FileFinalizer(this.file, this.session);
|
|
4948
|
+
this.fileFinalizer = fileFinalizer;
|
|
4949
|
+
_utils__WEBPACK_IMPORTED_MODULE_3__.finalizationRegistry.register(this, fileFinalizer);
|
|
4950
|
+
this.eventManager.fire({
|
|
4951
|
+
type: EventType.Load,
|
|
4952
|
+
data: this,
|
|
4953
|
+
});
|
|
4832
4954
|
return [2 /*return*/];
|
|
4833
4955
|
}
|
|
4834
4956
|
});
|
|
@@ -4872,7 +4994,7 @@ var RiveFile = /** @class */ (function () {
|
|
|
4872
4994
|
};
|
|
4873
4995
|
RiveFile.prototype.init = function () {
|
|
4874
4996
|
return __awaiter(this, void 0, void 0, function () {
|
|
4875
|
-
var _a, bufferResolved, runtimeResolved,
|
|
4997
|
+
var _a, bufferResolved, runtimeResolved, error_3;
|
|
4876
4998
|
return __generator(this, function (_b) {
|
|
4877
4999
|
switch (_b.label) {
|
|
4878
5000
|
case 0:
|
|
@@ -4904,8 +5026,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
4904
5026
|
}
|
|
4905
5027
|
return [3 /*break*/, 5];
|
|
4906
5028
|
case 4:
|
|
4907
|
-
|
|
4908
|
-
this.fireLoadError(
|
|
5029
|
+
error_3 = _b.sent();
|
|
5030
|
+
this.fireLoadError(error_3 instanceof Error ? error_3.message : RiveFile.fileLoadErrorMessage);
|
|
4909
5031
|
return [3 /*break*/, 5];
|
|
4910
5032
|
case 5: return [2 /*return*/];
|
|
4911
5033
|
}
|
|
@@ -4947,9 +5069,99 @@ var RiveFile = /** @class */ (function () {
|
|
|
4947
5069
|
this.removeAllRiveEventListeners();
|
|
4948
5070
|
this.releaseFile();
|
|
4949
5071
|
this.releaseBindableArtboards();
|
|
5072
|
+
// Everything imported through the session is gone; the session can go.
|
|
5073
|
+
this.releaseSession();
|
|
4950
5074
|
this.destroyed = true;
|
|
4951
5075
|
}
|
|
4952
5076
|
};
|
|
5077
|
+
// Deferred is only compiled into some runtime builds, so feature detect it
|
|
5078
|
+
// and degrade to an immediate import rather than failing the load.
|
|
5079
|
+
RiveFile.makeDeferredSession = function (runtime) {
|
|
5080
|
+
var _a, _b;
|
|
5081
|
+
var session = (_b = (_a = runtime.makeDeferredSession) === null || _a === void 0 ? void 0 : _a.call(runtime)) !== null && _b !== void 0 ? _b : null;
|
|
5082
|
+
if (session === null && !RiveFile.deferredUnsupportedWarned) {
|
|
5083
|
+
RiveFile.deferredUnsupportedWarned = true;
|
|
5084
|
+
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.");
|
|
5085
|
+
}
|
|
5086
|
+
return session;
|
|
5087
|
+
};
|
|
5088
|
+
Object.defineProperty(RiveFile.prototype, "deferredSession", {
|
|
5089
|
+
/**
|
|
5090
|
+
* @internal The deferred session this file imported through, or null if it
|
|
5091
|
+
* was imported in immediate mode.
|
|
5092
|
+
*/
|
|
5093
|
+
get: function () {
|
|
5094
|
+
return this.session;
|
|
5095
|
+
},
|
|
5096
|
+
enumerable: false,
|
|
5097
|
+
configurable: true
|
|
5098
|
+
});
|
|
5099
|
+
Object.defineProperty(RiveFile.prototype, "deferredRequested", {
|
|
5100
|
+
/**
|
|
5101
|
+
* @internal Whether deferred was asked for, even when this build could not
|
|
5102
|
+
* honor it and imported immediate.
|
|
5103
|
+
*/
|
|
5104
|
+
get: function () {
|
|
5105
|
+
return this.deferred;
|
|
5106
|
+
},
|
|
5107
|
+
enumerable: false,
|
|
5108
|
+
configurable: true
|
|
5109
|
+
});
|
|
5110
|
+
Object.defineProperty(RiveFile.prototype, "sessionClaimed", {
|
|
5111
|
+
/**
|
|
5112
|
+
* @internal Whether this file's session has ever been attached to a renderer.
|
|
5113
|
+
* Attaching is once per session, so a claimed file re-imports for the next
|
|
5114
|
+
* instance even after the renderer it was bound to is gone.
|
|
5115
|
+
*/
|
|
5116
|
+
get: function () {
|
|
5117
|
+
return this._sessionClaimed;
|
|
5118
|
+
},
|
|
5119
|
+
enumerable: false,
|
|
5120
|
+
configurable: true
|
|
5121
|
+
});
|
|
5122
|
+
/**
|
|
5123
|
+
* @internal Marks this file's session as spent. There is no matching release:
|
|
5124
|
+
* a session that has been attached can never replay for another renderer.
|
|
5125
|
+
*/
|
|
5126
|
+
RiveFile.prototype.claimSession = function () {
|
|
5127
|
+
this._sessionClaimed = true;
|
|
5128
|
+
};
|
|
5129
|
+
/**
|
|
5130
|
+
* @internal One warning per file however many instances collide on it.
|
|
5131
|
+
*/
|
|
5132
|
+
RiveFile.prototype.warnBoundElsewhereOnce = function () {
|
|
5133
|
+
if (this.boundElsewhereWarned) {
|
|
5134
|
+
return;
|
|
5135
|
+
}
|
|
5136
|
+
this.boundElsewhereWarned = true;
|
|
5137
|
+
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).");
|
|
5138
|
+
};
|
|
5139
|
+
/**
|
|
5140
|
+
* @internal Re-imports this file from its retained buffer into a mode of its
|
|
5141
|
+
* own. The copy is owned by whoever asked for it and never joins this file's
|
|
5142
|
+
* reference count.
|
|
5143
|
+
*/
|
|
5144
|
+
RiveFile.prototype.reimport = function (deferred) {
|
|
5145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5146
|
+
var copy;
|
|
5147
|
+
return __generator(this, function (_a) {
|
|
5148
|
+
switch (_a.label) {
|
|
5149
|
+
case 0:
|
|
5150
|
+
copy = new RiveFile({
|
|
5151
|
+
buffer: this.buffer,
|
|
5152
|
+
assetLoader: this.assetLoader,
|
|
5153
|
+
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
5154
|
+
enablePerfMarks: this.enablePerfMarks,
|
|
5155
|
+
enableGPUCanvas: deferred,
|
|
5156
|
+
});
|
|
5157
|
+
return [4 /*yield*/, copy.init()];
|
|
5158
|
+
case 1:
|
|
5159
|
+
_a.sent();
|
|
5160
|
+
return [2 /*return*/, copy];
|
|
5161
|
+
}
|
|
5162
|
+
});
|
|
5163
|
+
});
|
|
5164
|
+
};
|
|
4953
5165
|
/**
|
|
4954
5166
|
* Unsubscribes all Rive listeners from an event type, or everything if no type is
|
|
4955
5167
|
* given
|
|
@@ -5020,6 +5232,8 @@ var RiveFile = /** @class */ (function () {
|
|
|
5020
5232
|
RiveFile.missingErrorMessage = "Rive source file or data buffer required";
|
|
5021
5233
|
// Error message for file load error
|
|
5022
5234
|
RiveFile.fileLoadErrorMessage = "The file failed to load";
|
|
5235
|
+
// Deferred support is per build, so the warning is per page, not per file.
|
|
5236
|
+
RiveFile.deferredUnsupportedWarned = false;
|
|
5023
5237
|
return RiveFile;
|
|
5024
5238
|
}());
|
|
5025
5239
|
|
|
@@ -5041,6 +5255,13 @@ var Rive = /** @class */ (function () {
|
|
|
5041
5255
|
* and start.
|
|
5042
5256
|
*/
|
|
5043
5257
|
this.readyForPlaying = false;
|
|
5258
|
+
// Deferred rendering was requested for this instance. The file it renders
|
|
5259
|
+
// has the final say, since a file's mode is fixed at import.
|
|
5260
|
+
this.deferredRenderer = false;
|
|
5261
|
+
// Whether this instance imported the file in `riveFile` (true) or the caller
|
|
5262
|
+
// supplied it (false). Only a file we imported may be released without a
|
|
5263
|
+
// matching getInstance(): a caller's file is theirs however this init ends.
|
|
5264
|
+
this.ownsRiveFile = false;
|
|
5044
5265
|
// Runtime artboard
|
|
5045
5266
|
this.artboard = null;
|
|
5046
5267
|
// place to clear up pointer/touch event listeners
|
|
@@ -5175,6 +5396,7 @@ var Rive = /** @class */ (function () {
|
|
|
5175
5396
|
_runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.enablePerfMarks = true;
|
|
5176
5397
|
this._focusOptions = (_c = params.focusOptions) !== null && _c !== void 0 ? _c : this._focusOptions;
|
|
5177
5398
|
this._tabIndex = (_d = params.tabIndex) !== null && _d !== void 0 ? _d : null;
|
|
5399
|
+
this.deferredRenderer = !!params.enableGPUCanvas;
|
|
5178
5400
|
// New event management system
|
|
5179
5401
|
this.eventManager = new EventManager();
|
|
5180
5402
|
if (params.onLoad)
|
|
@@ -5231,6 +5453,7 @@ var Rive = /** @class */ (function () {
|
|
|
5231
5453
|
tabIndex: params.tabIndex,
|
|
5232
5454
|
semanticsMode: params.semanticsMode,
|
|
5233
5455
|
semanticsOptions: params.semanticsOptions,
|
|
5456
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
5234
5457
|
});
|
|
5235
5458
|
}
|
|
5236
5459
|
Object.defineProperty(Rive.prototype, "viewModelCount", {
|
|
@@ -5290,26 +5513,52 @@ var Rive = /** @class */ (function () {
|
|
|
5290
5513
|
// Initializes the Rive object either from constructor or load()
|
|
5291
5514
|
Rive.prototype.init = function (_a) {
|
|
5292
5515
|
var _this = this;
|
|
5293
|
-
var
|
|
5516
|
+
var _b, _c, _d, _e, _f;
|
|
5517
|
+
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;
|
|
5294
5518
|
if (this.destroyed) {
|
|
5295
5519
|
return;
|
|
5296
5520
|
}
|
|
5521
|
+
// Validated before any state changes, so a call with no source leaves a
|
|
5522
|
+
// running instance untouched.
|
|
5523
|
+
if (!src && !buffer && !riveFile) {
|
|
5524
|
+
throw new RiveError(Rive.missingErrorMessage);
|
|
5525
|
+
}
|
|
5526
|
+
// Reload releases the outgoing file in the same order cleanup() uses:
|
|
5527
|
+
// artboard, then the renderer's session, then the file. The artboard goes
|
|
5528
|
+
// first because it holds an rcp<File> and its resources came from the
|
|
5529
|
+
// session about to be released. stop() has already deleted the animation
|
|
5530
|
+
// and state machine instances; reload deliberately skips cleanupInstances(),
|
|
5531
|
+
// which would also drop the event listeners load() keeps in place.
|
|
5532
|
+
if (this.artboard) {
|
|
5533
|
+
// Free GPU-backed resources with their own context current. No-op on
|
|
5534
|
+
// the canvas2d build.
|
|
5535
|
+
(_c = (_b = this.renderer) === null || _b === void 0 ? void 0 : _b.bindContext) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
5536
|
+
(_d = this.animator) === null || _d === void 0 ? void 0 : _d.stop();
|
|
5537
|
+
this.artboard.delete();
|
|
5538
|
+
this.artboard = null;
|
|
5539
|
+
}
|
|
5540
|
+
// Detach before the session is deleted: the handle dies with it.
|
|
5541
|
+
if (this.renderer) {
|
|
5542
|
+
(_f = (_e = this.renderer).detachSession) === null || _f === void 0 ? void 0 : _f.call(_e);
|
|
5543
|
+
}
|
|
5544
|
+
this.releaseCurrentRiveFile(/* isTeardown */ false);
|
|
5297
5545
|
this.src = src;
|
|
5298
5546
|
this.buffer = buffer;
|
|
5299
5547
|
this.riveFile = riveFile;
|
|
5548
|
+
// initData flips this if it ends up importing the file itself.
|
|
5549
|
+
this.ownsRiveFile = false;
|
|
5550
|
+
// Sticky across reloads so a constructor-set flag survives; an explicit
|
|
5551
|
+
// `false` still turns it off.
|
|
5552
|
+
this.deferredRenderer = enableGPUCanvas !== null && enableGPUCanvas !== void 0 ? enableGPUCanvas : this.deferredRenderer;
|
|
5300
5553
|
this._tabIndex = tabIndex !== null && tabIndex !== void 0 ? tabIndex : null;
|
|
5301
5554
|
this.semanticsMode = semanticsMode !== null && semanticsMode !== void 0 ? semanticsMode : _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticMode.Disabled;
|
|
5302
5555
|
this.semanticsOptions = semanticsOptions !== null && semanticsOptions !== void 0 ? semanticsOptions : this.semanticsOptions;
|
|
5303
|
-
// If no source file url specified, it's a bust
|
|
5304
|
-
if (!this.src && !this.buffer && !this.riveFile) {
|
|
5305
|
-
throw new RiveError(Rive.missingErrorMessage);
|
|
5306
|
-
}
|
|
5307
5556
|
// Names of the animations and state machines that should be initialized
|
|
5308
|
-
var
|
|
5557
|
+
var _k = resolveStartingPlayback({
|
|
5309
5558
|
stateMachine: stateMachine,
|
|
5310
5559
|
animations: animations,
|
|
5311
5560
|
stateMachines: stateMachines,
|
|
5312
|
-
}), startingAnimationNames =
|
|
5561
|
+
}), startingAnimationNames = _k.startingAnimationNames, startingStateMachineNames = _k.startingStateMachineNames;
|
|
5313
5562
|
// Ensure loaded is marked as false if loading new file
|
|
5314
5563
|
this.loaded = false;
|
|
5315
5564
|
this.readyForPlaying = false;
|
|
@@ -5329,6 +5578,8 @@ var Rive = /** @class */ (function () {
|
|
|
5329
5578
|
if (_this.enablePerfMarks)
|
|
5330
5579
|
performance.mark('rive:make-renderer:start');
|
|
5331
5580
|
try {
|
|
5581
|
+
// Always immediate at creation; a deferred file attaches its session
|
|
5582
|
+
// to this renderer once the file has loaded.
|
|
5332
5583
|
_this.renderer = _this.runtime.makeRenderer(_this.canvas, useOffscreenRenderer);
|
|
5333
5584
|
if (!_this.renderer) {
|
|
5334
5585
|
throw new Error("Renderer is null, cannot render Rive on the canvas.");
|
|
@@ -5481,32 +5732,52 @@ var Rive = /** @class */ (function () {
|
|
|
5481
5732
|
// Returns true for successful initialization.
|
|
5482
5733
|
Rive.prototype.initData = function (artboardName, animationNames, stateMachineNames, autoplay, autoBind) {
|
|
5483
5734
|
return __awaiter(this, void 0, void 0, function () {
|
|
5484
|
-
var riveFile,
|
|
5485
|
-
var _a;
|
|
5486
|
-
return __generator(this, function (
|
|
5487
|
-
switch (
|
|
5735
|
+
var riveFile, error_4, msg;
|
|
5736
|
+
var _a, _b;
|
|
5737
|
+
return __generator(this, function (_c) {
|
|
5738
|
+
switch (_c.label) {
|
|
5488
5739
|
case 0:
|
|
5489
|
-
|
|
5490
|
-
|
|
5740
|
+
_c.trys.push([0, 5, , 6]);
|
|
5741
|
+
// A caller-supplied riveFile is theirs to release; one we import here is
|
|
5742
|
+
// ours, which matters if a deferred fallback replaces it below.
|
|
5743
|
+
this.ownsRiveFile = this.riveFile == null;
|
|
5744
|
+
if (!this.ownsRiveFile) return [3 /*break*/, 2];
|
|
5491
5745
|
riveFile = new RiveFile({
|
|
5492
5746
|
src: this.src,
|
|
5493
5747
|
buffer: this.buffer,
|
|
5494
5748
|
enableRiveAssetCDN: this.enableRiveAssetCDN,
|
|
5495
5749
|
assetLoader: this.assetLoader,
|
|
5496
5750
|
enablePerfMarks: this.enablePerfMarks,
|
|
5751
|
+
// The instance owns this file, so its flag is the file's flag.
|
|
5752
|
+
enableGPUCanvas: this.deferredRenderer,
|
|
5497
5753
|
});
|
|
5498
5754
|
this.riveFile = riveFile;
|
|
5499
5755
|
return [4 /*yield*/, riveFile.init()];
|
|
5500
5756
|
case 1:
|
|
5501
|
-
|
|
5757
|
+
_c.sent();
|
|
5502
5758
|
if (this.destroyed) {
|
|
5503
5759
|
// In the very unlikely scenario where the rive file created by this Rive is shared by
|
|
5504
5760
|
// another rive file, we only want to destroy it if this file is the only owner.
|
|
5505
5761
|
riveFile.destroyIfUnused();
|
|
5506
5762
|
return [2 /*return*/, false];
|
|
5507
5763
|
}
|
|
5508
|
-
|
|
5764
|
+
_c.label = 2;
|
|
5509
5765
|
case 2:
|
|
5766
|
+
if (!(this.riveFile.deferredSession !== null || this.deferredRenderer)) return [3 /*break*/, 4];
|
|
5767
|
+
return [4 /*yield*/, this.resolveDeferredRendering()];
|
|
5768
|
+
case 3:
|
|
5769
|
+
_c.sent();
|
|
5770
|
+
if (this.destroyed) {
|
|
5771
|
+
// cleanup() ran during a re-import. Taking a reference now would
|
|
5772
|
+
// resurrect a file this instance is never going to draw. Only ours
|
|
5773
|
+
// to release — a caller-supplied file stays theirs.
|
|
5774
|
+
if (this.ownsRiveFile) {
|
|
5775
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.destroyIfUnused();
|
|
5776
|
+
}
|
|
5777
|
+
return [2 /*return*/, false];
|
|
5778
|
+
}
|
|
5779
|
+
_c.label = 4;
|
|
5780
|
+
case 4:
|
|
5510
5781
|
this.file = this.riveFile.getInstance();
|
|
5511
5782
|
// Initialize and draw frame
|
|
5512
5783
|
this.initArtboard(artboardName, animationNames, stateMachineNames, autoplay, autoBind);
|
|
@@ -5525,7 +5796,7 @@ var Rive = /** @class */ (function () {
|
|
|
5525
5796
|
this.loaded = true;
|
|
5526
5797
|
this.eventManager.fire({
|
|
5527
5798
|
type: EventType.Load,
|
|
5528
|
-
data: (
|
|
5799
|
+
data: (_b = this.src) !== null && _b !== void 0 ? _b : "buffer",
|
|
5529
5800
|
});
|
|
5530
5801
|
}
|
|
5531
5802
|
catch (e) {
|
|
@@ -5543,12 +5814,114 @@ var Rive = /** @class */ (function () {
|
|
|
5543
5814
|
this.taskQueue.process();
|
|
5544
5815
|
this.drawFrame();
|
|
5545
5816
|
return [2 /*return*/, true];
|
|
5546
|
-
case
|
|
5547
|
-
|
|
5548
|
-
msg = resolveErrorMessage(
|
|
5817
|
+
case 5:
|
|
5818
|
+
error_4 = _c.sent();
|
|
5819
|
+
msg = resolveErrorMessage(error_4);
|
|
5549
5820
|
this.eventManager.fire({ type: EventType.LoadError, data: msg });
|
|
5550
5821
|
return [2 /*return*/, Promise.reject(msg)];
|
|
5551
|
-
case
|
|
5822
|
+
case 6: return [2 /*return*/];
|
|
5823
|
+
}
|
|
5824
|
+
});
|
|
5825
|
+
});
|
|
5826
|
+
};
|
|
5827
|
+
/**
|
|
5828
|
+
* Settles which rendering mode this Rive instance runs in. The file dictates: its rendering mode
|
|
5829
|
+
* is fixed at import, and an immediate renderer silently drops a deferred
|
|
5830
|
+
* file's resources. Every mismatch warns and degrades to something that
|
|
5831
|
+
* renders, so users shouldn't have a blank canvas. A fallback self-reimport replaces `this.riveFile`;
|
|
5832
|
+
* only a file this instance imported is released when that happens.
|
|
5833
|
+
*/
|
|
5834
|
+
Rive.prototype.resolveDeferredRendering = function () {
|
|
5835
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
5836
|
+
var file, ownsFile, renderer, session, attachSession, immediate, copy, copySession, fallback;
|
|
5837
|
+
var _a;
|
|
5838
|
+
return __generator(this, function (_b) {
|
|
5839
|
+
switch (_b.label) {
|
|
5840
|
+
case 0:
|
|
5841
|
+
file = this.riveFile;
|
|
5842
|
+
ownsFile = this.ownsRiveFile;
|
|
5843
|
+
renderer = this.renderer;
|
|
5844
|
+
session = file.deferredSession;
|
|
5845
|
+
if (session === null) {
|
|
5846
|
+
// No second warning when the file asked for deferred and the build
|
|
5847
|
+
// could not honor it; the unsupported-build warning already fired, and
|
|
5848
|
+
// telling the user to set a flag they set would mislead.
|
|
5849
|
+
if (this.deferredRenderer && !file.deferredRequested) {
|
|
5850
|
+
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.");
|
|
5851
|
+
}
|
|
5852
|
+
return [2 /*return*/];
|
|
5853
|
+
}
|
|
5854
|
+
if (!this.deferredRenderer) {
|
|
5855
|
+
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.");
|
|
5856
|
+
}
|
|
5857
|
+
attachSession = renderer === null || renderer === void 0 ? void 0 : renderer.attachSession;
|
|
5858
|
+
if (!(typeof attachSession !== "function")) return [3 /*break*/, 2];
|
|
5859
|
+
// Offscreen renderers share one context across canvases, which a session
|
|
5860
|
+
// cannot record for. An immediate copy of the file still renders.
|
|
5861
|
+
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.");
|
|
5862
|
+
return [4 /*yield*/, file.reimport(false)];
|
|
5863
|
+
case 1:
|
|
5864
|
+
immediate = _b.sent();
|
|
5865
|
+
if (this.destroyed) {
|
|
5866
|
+
// cleanup() ran while we were importing; nothing will use this copy.
|
|
5867
|
+
immediate.destroyIfUnused();
|
|
5868
|
+
return [2 /*return*/];
|
|
5869
|
+
}
|
|
5870
|
+
this.riveFile = immediate;
|
|
5871
|
+
this.ownsRiveFile = true;
|
|
5872
|
+
if (ownsFile) {
|
|
5873
|
+
// Nothing else can reach the deferred import we just walked away from.
|
|
5874
|
+
file.destroyIfUnused();
|
|
5875
|
+
}
|
|
5876
|
+
return [2 /*return*/];
|
|
5877
|
+
case 2:
|
|
5878
|
+
// Never re-offered once claimed, even if that renderer is gone: the
|
|
5879
|
+
// resources the session's stream refers to died with it.
|
|
5880
|
+
if (!file.sessionClaimed && attachSession.call(renderer, session)) {
|
|
5881
|
+
file.claimSession();
|
|
5882
|
+
return [2 /*return*/];
|
|
5883
|
+
}
|
|
5884
|
+
// Bound to another instance. Re-import from the retained buffer into a
|
|
5885
|
+
// session of our own.
|
|
5886
|
+
file.warnBoundElsewhereOnce();
|
|
5887
|
+
return [4 /*yield*/, file.reimport(true)];
|
|
5888
|
+
case 3:
|
|
5889
|
+
copy = _b.sent();
|
|
5890
|
+
if (this.destroyed) {
|
|
5891
|
+
// The renderer was deleted while we imported; attaching to it would hand
|
|
5892
|
+
// embind a deleted object.
|
|
5893
|
+
copy.destroyIfUnused();
|
|
5894
|
+
return [2 /*return*/];
|
|
5895
|
+
}
|
|
5896
|
+
this.riveFile = copy;
|
|
5897
|
+
this.ownsRiveFile = true;
|
|
5898
|
+
copySession = copy.deferredSession;
|
|
5899
|
+
if (copySession !== null && attachSession.call(renderer, copySession)) {
|
|
5900
|
+
copy.claimSession();
|
|
5901
|
+
return [2 /*return*/];
|
|
5902
|
+
}
|
|
5903
|
+
// The copy's session could not take this canvas either (this renderer
|
|
5904
|
+
// already holds one). An immediate re-import still renders; a deferred file
|
|
5905
|
+
// on an immediate renderer would drop its resources and draw nothing.
|
|
5906
|
+
console.warn("Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.");
|
|
5907
|
+
// If a leftover session is why the attach failed, it would keep routing
|
|
5908
|
+
// the immediate file's draws into its recorder, which drops them.
|
|
5909
|
+
(_a = renderer.detachSession) === null || _a === void 0 ? void 0 : _a.call(renderer);
|
|
5910
|
+
return [4 /*yield*/, file.reimport(false)];
|
|
5911
|
+
case 4:
|
|
5912
|
+
fallback = _b.sent();
|
|
5913
|
+
// The deferred copy was only ever ours, so it always goes.
|
|
5914
|
+
copy.destroyIfUnused();
|
|
5915
|
+
if (this.destroyed) {
|
|
5916
|
+
fallback.destroyIfUnused();
|
|
5917
|
+
return [2 /*return*/];
|
|
5918
|
+
}
|
|
5919
|
+
this.riveFile = fallback;
|
|
5920
|
+
this.ownsRiveFile = true;
|
|
5921
|
+
if (ownsFile) {
|
|
5922
|
+
file.destroyIfUnused();
|
|
5923
|
+
}
|
|
5924
|
+
return [2 /*return*/];
|
|
5552
5925
|
}
|
|
5553
5926
|
});
|
|
5554
5927
|
});
|
|
@@ -5643,6 +6016,13 @@ var Rive = /** @class */ (function () {
|
|
|
5643
6016
|
}
|
|
5644
6017
|
return changed;
|
|
5645
6018
|
};
|
|
6019
|
+
// Content the artboard's change flag cannot see: ore and GPU canvas commands
|
|
6020
|
+
// scripts record straight into the session. Must be read before the renderer
|
|
6021
|
+
// clears — clearing marks the stream, so a later read is true every frame.
|
|
6022
|
+
Rive.prototype._deferredWorkPending = function () {
|
|
6023
|
+
var _a, _b, _c;
|
|
6024
|
+
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;
|
|
6025
|
+
};
|
|
5646
6026
|
/**
|
|
5647
6027
|
* Poll focus state each frame to see if we should focus/blur the canvas in case
|
|
5648
6028
|
* Rive internally updated focus outside of user interaction (e.g., via listener action)
|
|
@@ -5852,6 +6232,11 @@ var Rive = /** @class */ (function () {
|
|
|
5852
6232
|
Rive.prototype.draw = function (time, onSecond) {
|
|
5853
6233
|
// Clear the frameRequestId, as we're now rendering a fresh frame
|
|
5854
6234
|
this.frameRequestId = null;
|
|
6235
|
+
// load() tears the artboard down and re-inits asynchronously; a frame
|
|
6236
|
+
// queued before that lands here with nothing to draw.
|
|
6237
|
+
if (!this.artboard) {
|
|
6238
|
+
return;
|
|
6239
|
+
}
|
|
5855
6240
|
var before = performance.now();
|
|
5856
6241
|
// Instrument the first 3 frames so the Performance timeline shows precise
|
|
5857
6242
|
// per-call latency for advance, draw, and flush without polluting the trace.
|
|
@@ -5873,9 +6258,13 @@ var Rive = /** @class */ (function () {
|
|
|
5873
6258
|
var renderer = this.renderer;
|
|
5874
6259
|
// Do not draw on 0 canvas size
|
|
5875
6260
|
if (!this._hasZeroSize) {
|
|
5876
|
-
// If there was no dirt on this frame, do not clear and draw
|
|
6261
|
+
// If there was no dirt on this frame, do not clear and draw. The deferred
|
|
6262
|
+
// term has to be read here, before `clear()` below: clearing opens the
|
|
6263
|
+
// session's recording window and marks its stream, so a read taken after
|
|
6264
|
+
// it reports every frame as dirty and nothing is ever skipped.
|
|
5877
6265
|
if (this.drawOptimization == DrawOptimizationOptions.AlwaysDraw ||
|
|
5878
6266
|
this.artboard.didChange() ||
|
|
6267
|
+
this._deferredWorkPending() ||
|
|
5879
6268
|
this._needsRedraw ||
|
|
5880
6269
|
this._canvasSizeChanged()) {
|
|
5881
6270
|
// Canvas must be wiped to prevent artifacts
|
|
@@ -5973,7 +6362,7 @@ var Rive = /** @class */ (function () {
|
|
|
5973
6362
|
* Rive class
|
|
5974
6363
|
*/
|
|
5975
6364
|
Rive.prototype.cleanup = function () {
|
|
5976
|
-
var _a, _b, _c, _d;
|
|
6365
|
+
var _a, _b, _c, _d, _e;
|
|
5977
6366
|
this.destroyed = true;
|
|
5978
6367
|
// Stop the renderer if it hasn't already been stopped.
|
|
5979
6368
|
this.stopRendering();
|
|
@@ -5989,10 +6378,14 @@ var Rive = /** @class */ (function () {
|
|
|
5989
6378
|
observers.remove(this._observed);
|
|
5990
6379
|
}
|
|
5991
6380
|
this.removeRiveListeners();
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
6381
|
+
// The file and its session go before the renderer: the session's replay
|
|
6382
|
+
// state lives in the renderer's context. But the renderer must let go of
|
|
6383
|
+
// the session first — its detach handle dies with session.delete(), and a
|
|
6384
|
+
// later detach would pass embind a deleted object.
|
|
6385
|
+
if (this.renderer) {
|
|
6386
|
+
(_d = (_c = this.renderer).detachSession) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
6387
|
+
}
|
|
6388
|
+
this.releaseCurrentRiveFile(/* isTeardown */ true);
|
|
5996
6389
|
this.riveFile = null;
|
|
5997
6390
|
this.deleteRiveRenderer();
|
|
5998
6391
|
if (this._audioEventListener !== null) {
|
|
@@ -6003,21 +6396,65 @@ var Rive = /** @class */ (function () {
|
|
|
6003
6396
|
document.removeEventListener('visibilitychange', this._pageVisibilityHandler);
|
|
6004
6397
|
this._pageVisibilityHandler = null;
|
|
6005
6398
|
}
|
|
6006
|
-
(
|
|
6399
|
+
(_e = this._viewModelInstance) === null || _e === void 0 ? void 0 : _e.cleanup();
|
|
6007
6400
|
this._viewModelInstance = null;
|
|
6008
6401
|
this._globalViewModelInstances.forEach(function (instance) { return instance.cleanup(); });
|
|
6009
6402
|
this._globalViewModelInstances.clear();
|
|
6010
6403
|
this._dataEnums = null;
|
|
6011
6404
|
};
|
|
6405
|
+
/**
|
|
6406
|
+
* Drops this instance's hold on `this.riveFile`. A reference taken through
|
|
6407
|
+
* getInstance() is given back; a file we imported but never referenced is
|
|
6408
|
+
* released outright so its session goes with it. A caller-supplied file we
|
|
6409
|
+
* never referenced is left alone.
|
|
6410
|
+
*
|
|
6411
|
+
* `isTeardown` distinguishes cleanup() from a reload. Teardown always hands
|
|
6412
|
+
* the reference back, as it always has. A reload must not do that for a
|
|
6413
|
+
* caller-supplied file: a RiveFile carries no reference for its creator, so
|
|
6414
|
+
* releasing here would take the last one and destroy a file the caller still
|
|
6415
|
+
* holds.
|
|
6416
|
+
*/
|
|
6417
|
+
Rive.prototype.releaseCurrentRiveFile = function (isTeardown) {
|
|
6418
|
+
var _a, _b;
|
|
6419
|
+
if (this.file) {
|
|
6420
|
+
if (isTeardown || this.ownsRiveFile) {
|
|
6421
|
+
(_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.cleanup();
|
|
6422
|
+
}
|
|
6423
|
+
this.file = null;
|
|
6424
|
+
}
|
|
6425
|
+
else if (this.ownsRiveFile) {
|
|
6426
|
+
(_b = this.riveFile) === null || _b === void 0 ? void 0 : _b.destroyIfUnused();
|
|
6427
|
+
}
|
|
6428
|
+
};
|
|
6012
6429
|
/**
|
|
6013
6430
|
* Cleans up the Renderer object. Only call this API if you no longer
|
|
6014
6431
|
* need to render Rive content in your session.
|
|
6015
6432
|
*/
|
|
6016
6433
|
Rive.prototype.deleteRiveRenderer = function () {
|
|
6017
|
-
var _a;
|
|
6018
|
-
(
|
|
6434
|
+
var _a, _b;
|
|
6435
|
+
if (this.renderer) {
|
|
6436
|
+
// A session outliving this renderer has to stop pointing at it, and its
|
|
6437
|
+
// replay state has to drop while this context is still alive. No-op when
|
|
6438
|
+
// nothing was ever attached.
|
|
6439
|
+
(_b = (_a = this.renderer).detachSession) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
6440
|
+
this.renderer.delete();
|
|
6441
|
+
}
|
|
6019
6442
|
this.renderer = null;
|
|
6020
6443
|
};
|
|
6444
|
+
Object.defineProperty(Rive.prototype, "deferredRendererActive", {
|
|
6445
|
+
/**
|
|
6446
|
+
* @experimental This API is early and may encounter breaking behavior change without a major version bump
|
|
6447
|
+
*
|
|
6448
|
+
* Whether this instance is rendering through a deferred session. False whenever
|
|
6449
|
+
* a fallback ran, whatever was requested.
|
|
6450
|
+
*/
|
|
6451
|
+
get: function () {
|
|
6452
|
+
var _a, _b, _c;
|
|
6453
|
+
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;
|
|
6454
|
+
},
|
|
6455
|
+
enumerable: false,
|
|
6456
|
+
configurable: true
|
|
6457
|
+
});
|
|
6021
6458
|
/**
|
|
6022
6459
|
* Cleans up any Wasm-generated objects that need to be manually destroyed:
|
|
6023
6460
|
* artboard instances, animation instances, state machine instances.
|
|
@@ -6249,7 +6686,10 @@ var Rive = /** @class */ (function () {
|
|
|
6249
6686
|
};
|
|
6250
6687
|
// Loads a new Rive file, keeping listeners in place
|
|
6251
6688
|
Rive.prototype.load = function (params) {
|
|
6252
|
-
|
|
6689
|
+
// Before stop(), so a call with no source leaves playback running.
|
|
6690
|
+
if (!params.src && !params.buffer && !params.riveFile) {
|
|
6691
|
+
throw new RiveError(Rive.missingErrorMessage);
|
|
6692
|
+
}
|
|
6253
6693
|
// Stop all animations
|
|
6254
6694
|
this.stop();
|
|
6255
6695
|
// Reinitialize
|
|
@@ -8113,7 +8553,7 @@ var decodeAudio = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
8113
8553
|
case 0:
|
|
8114
8554
|
decodedPromise = new Promise(function (resolve) {
|
|
8115
8555
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8116
|
-
rive.decodeAudio(bytes, resolve);
|
|
8556
|
+
rive.decodeAudio(bytes, resolve, null);
|
|
8117
8557
|
});
|
|
8118
8558
|
});
|
|
8119
8559
|
return [4 /*yield*/, decodedPromise];
|
|
@@ -8138,7 +8578,7 @@ var decodeImage = function (bytes) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
8138
8578
|
case 0:
|
|
8139
8579
|
decodedPromise = new Promise(function (resolve) {
|
|
8140
8580
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8141
|
-
rive.decodeImage(bytes, resolve);
|
|
8581
|
+
rive.decodeImage(bytes, resolve, null);
|
|
8142
8582
|
});
|
|
8143
8583
|
});
|
|
8144
8584
|
return [4 /*yield*/, decodedPromise];
|
|
@@ -8163,7 +8603,7 @@ var decodeFont = function (bytes) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
8163
8603
|
case 0:
|
|
8164
8604
|
decodedPromise = new Promise(function (resolve) {
|
|
8165
8605
|
return _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__.RuntimeLoader.getInstance(function (rive) {
|
|
8166
|
-
rive.decodeFont(bytes, resolve);
|
|
8606
|
+
rive.decodeFont(bytes, resolve, null);
|
|
8167
8607
|
});
|
|
8168
8608
|
});
|
|
8169
8609
|
return [4 /*yield*/, decodedPromise];
|