@rive-app/webgl2 2.40.0 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rive.js CHANGED
@@ -431,14 +431,14 @@ c.ec.count.value+=1;c.ec.Xc=!1;return c},["delete"](){this.ec.lc||dc(this);if(th
431
431
  const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
432
432
  Object.assign(tc.prototype,{ye(a){this.Zd&&(a=this.Zd(a));return a},Md(a){this.Ec?.(a)},wc:Yb,kc:function(a){function b(){return this.kd?sc(this.fc.Bc,{nc:this.Me,lc:c,yc:this,sc:a}):sc(this.fc.Bc,{nc:this,lc:a})}var c=this.ye(a);if(!c)return this.Md(a),null;var d=rc(this.fc,c);if(void 0!==d){if(0===d.ec.count.value)return d.ec.lc=c,d.ec.sc=a,d.clone();d=d.clone();this.Md(a);return d}d=this.fc.xe(c);d=gc[d];if(!d)return b.call(this);d=this.jd?d.oe:d.pointerType;var e=qc(c,this.fc,d.fc);return null===
433
433
  e?b.call(this):this.kd?sc(d.fc.Bc,{nc:d,lc:e,yc:this,sc:a}):sc(d.fc.Bc,{nc:d,lc:e})}});for(let a=0;32>a;++a)od.push(Array(a));l.print&&(oa=l.print);l.printErr&&(y=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 yd={324599:(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=
434
+ var yd={325398:(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.zc&&h.state===f.device_state.started&&h.zc.resume().then(()=>{vd(h.Wd)},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},326777:()=>{"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)},327081:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,327185:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},327356:(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=
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(()=>{vd(h.Wd)},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},327576:()=>{"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)},327880:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,327984:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},328155:(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
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.Oc=g.zc.createScriptProcessor(d,c,b);g.Oc.onaudioprocess=function(k){if(null==g.hd||0==g.hd.length)g.hd=new Float32Array(ua.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var m=0;m<b;m+=1)for(var q=k.inputBuffer.getChannelData(m),v=g.hd,t=0;t<d;t+=1)v[t*b+m]=q[t];wd(f,d,e)}if(a==
439
439
  window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(xd(f,d,e),m=0;m<k.outputBuffer.numberOfChannels;++m)for(q=k.outputBuffer.getChannelData(m),v=g.hd,t=0;t<d;t+=1)q[t]=v[t*b+m];else for(m=0;m<k.outputBuffer.numberOfChannels;++m)k.outputBuffer.getChannelData(m).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.Oc);
440
- g.Oc.connect(g.zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.Oc.connect(g.zc.destination);g.Wd=f;return window.miniaudio.track_device(g)},330233:a=>window.miniaudio.get_device_by_index(a).zc.sampleRate,330306:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.Oc&&(a.Oc.onaudioprocess=function(){},a.Oc.disconnect(),a.Oc=void 0);void 0!==a.sd&&(a.sd.disconnect(),a.sd=void 0);a.zc.close();a.zc=void 0;a.Wd=void 0},330706:a=>
441
- {window.miniaudio.untrack_device_by_index(a)},330756:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.resume();a.state=window.miniaudio.device_state.started},330895:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.suspend();a.state=window.miniaudio.device_state.stopped}},Qb,rd,Pb,vd,wd,xd,zd,Ad,Bd,Aa,vc,Dd={pa:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 0:var e=K();if(0>e)break;for(;kb[e];)e++;return xb(d,e).Mc;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=K(),d.flags|=
440
+ g.Oc.connect(g.zc.destination)}).catch(function(k){console.log("Failed to get user media: "+k)});a==window.miniaudio.device_type.playback&&g.Oc.connect(g.zc.destination);g.Wd=f;return window.miniaudio.track_device(g)},331032:a=>window.miniaudio.get_device_by_index(a).zc.sampleRate,331105:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.Oc&&(a.Oc.onaudioprocess=function(){},a.Oc.disconnect(),a.Oc=void 0);void 0!==a.sd&&(a.sd.disconnect(),a.sd=void 0);a.zc.close();a.zc=void 0;a.Wd=void 0},331505:a=>
441
+ {window.miniaudio.untrack_device_by_index(a)},331555:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.resume();a.state=window.miniaudio.device_state.started},331694:a=>{a=window.miniaudio.get_device_by_index(a);a.zc.suspend();a.state=window.miniaudio.device_state.stopped}},Qb,rd,Pb,vd,wd,xd,zd,Ad,Bd,Aa,vc,Dd={pa:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 0:var e=K();if(0>e)break;for(;kb[e];)e++;return xb(d,e).Mc;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=K(),d.flags|=
442
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.Lc}},vb:function(a,b,c){Ka=c;try{var d=vb(a);switch(b){case 21509:return d.mc?0:-59;case 21505:if(!d.mc)return-59;if(d.mc.Kc.Fe){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();G[e>>2]=25856;G[e+4>>2]=5;G[e+8>>2]=191;G[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
443
  0:-59;case 21506:case 21507:case 21508:if(!d.mc)return-59;if(d.mc.Kc.Ge)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 G[e>>2]=0;case 21520:return d.mc?-28:-59;case 21537:case 21531:e=K();if(!d.hc.Ee)throw new M(59);return d.hc.Ee(d,b,e);case 21523:if(!d.mc)return-59;d.mc.Kc.He&&(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
444
  g.name)throw g;return-g.Lc}},wb: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?"/":vb(a).path;if(0==e.length)throw new M(44);b=f+"/"+e}var g=d?K():0;return Db(b,c,g).Mc}catch(h){if("undefined"==typeof Gb||"ErrnoError"!==h.name)throw h;return-h.Lc}},zb:()=>Ba(""),la:(a,b,c)=>{a=R(a);b=Sb(b,"wrapper");c=Q(c);var d=b.fc,e=d.Bc,f=d.rc.Bc,g=d.rc.constructor;a=Hb(a,function(...h){for(var k of d.rc.Xd)if(this[k]===f[k])throw new Lb(`Pure virtual function ${k} must be implemented in JavaScript`);
@@ -456,18 +456,18 @@ b,r);return[]});return[]})},$a:a=>S(a,Dc),ma:(a,b,c,d,e)=>{b=R(b);e=0===e?"objec
456
456
  oc:function(h,k){return this.fe[k]},wc:Ec(b,c,d),vc:null}),ic(b,f),delete l[b].Ic}},k:(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.Ed[b]=c;break;case "string":d.fe[b]=c,d.ae[c]=b,d.Ed[b]=b}},ha:(a,b,c)=>{b=R(b);S(a,{name:b,kc:d=>d,oc:(d,e)=>e,wc:Fc(b,c),vc:null})},j:(a,b,c,d,e,f)=>{var g=zc(b,c);a=R(a);
457
457
  a=Ac(a);e=V(d,e);ic(a,function(){W(`Cannot call ${a} due to unbound types`,g)},b-1);T([],g,h=>{uc(a,yc(a,[h[0],null].concat(h.slice(1)),null,e,f),b-1);return[]})},v:(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})},h:(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=R(c);
458
458
  S(a,{name:c,kc:d,wc:d},{Ce:!0})},ab:(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=rd(4+f+1),h=g+4;J[g>>2]=f;e?Va(d,B,h,f+1):B.set(d,h);null!==c&&c.push(Qb,g);return g},wc:Yb,vc(c){Qb(c)}})},S:(a,b,c)=>{c=R(c);if(2===b){var d=Hc;var e=Ic;var f=Jc}else d=
459
- Kc,e=Lc,f=Mc;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),m=rd(4+k+b);J[m>>2]=k/b;e(h,m+4,k+b);null!==g&&g.push(Qb,m);return m},wc:Yb,vc(g){Qb(g)}})},lb:(a,b,c,d,e,f)=>{Wb[a]={name:R(b),Gd:V(c,d),Ec:V(e,f),Od:[]}},kb:(a,b,c,d,e,f,g,h,k,m)=>{Wb[a].Od.push({ve:R(b),Be:c,ze:V(d,e),Ae:f,Pe:g,Oe:V(h,k),Qe:m})},db:(a,b)=>{b=R(b);S(a,{Ie:!0,name:b,kc:()=>{},oc:()=>{}})},ob:()=>{throw Infinity;
459
+ Kc,e=Lc,f=Mc;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),m=rd(4+k+b);J[m>>2]=k/b;e(h,m+4,k+b);null!==g&&g.push(Qb,m);return m},wc:Yb,vc(g){Qb(g)}})},lb:(a,b,c,d,e,f)=>{Wb[a]={name:R(b),Gd:V(c,d),Ec:V(e,f),Od:[]}},kb:(a,b,c,d,e,f,g,h,k,m)=>{Wb[a].Od.push({ve:R(b),Be:c,ze:V(d,e),Ae:f,Pe:g,Oe:V(h,k),Qe:m})},db:(a,b)=>{b=R(b);S(a,{Ie:!0,name:b,kc:()=>{},oc:()=>{}})},mb:()=>{throw Infinity;
460
460
  },m:(a,b,c)=>{var [d,...e]=Pc(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 Oc(Hb(b,(k,m,q,v)=>{for(var t=0,C=0;C<a;++C)h[C]=g[C](v+t),t+=8;switch(c){case 0:var p=Q(k).apply(null,h);break;case 2:p=Reflect.construct(Q(k),h);break;case 3:p=h[0];break;case 1:p=Q(k)[Rc(m)](...h)}k=[];p=f(k,p);k.length&&(J[q>>2]=Kb(k));return p}))},jb:Cc,bb:(a,b)=>{a=Q(a);b=Q(b);return Kb(a[b])},ga:a=>{9<a&&(Jb[a+1]+=1)},l:(a,b,c,d,e)=>Nc[a](b,
461
- c,d,e),gb:()=>Kb([]),ib:a=>Kb(Rc(a)),Ob:()=>Kb({}),Fa:a=>{var b=Q(a);Xb(b);Cc(a)},q:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},qb:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getUTCSeconds();G[b+4>>2]=a.getUTCMinutes();G[b+8>>2]=a.getUTCHours();G[b+12>>2]=a.getUTCDate();G[b+16>>2]=a.getUTCMonth();G[b+20>>2]=a.getUTCFullYear()-1900;G[b+24>>2]=a.getUTCDay();G[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},rb:function(a,b){a=
461
+ c,d,e),gb:()=>Kb([]),ib:a=>Kb(Rc(a)),Ob:()=>Kb({}),Fa:a=>{var b=Q(a);Xb(b);Cc(a)},q:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},ob:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getUTCSeconds();G[b+4>>2]=a.getUTCMinutes();G[b+8>>2]=a.getUTCHours();G[b+12>>2]=a.getUTCDate();G[b+16>>2]=a.getUTCMonth();G[b+20>>2]=a.getUTCFullYear()-1900;G[b+24>>2]=a.getUTCDay();G[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},pb:function(a,b){a=
462
462
  -9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);G[b>>2]=a.getSeconds();G[b+4>>2]=a.getMinutes();G[b+8>>2]=a.getHours();G[b+12>>2]=a.getDate();G[b+16>>2]=a.getMonth();G[b+20>>2]=a.getFullYear()-1900;G[b+24>>2]=a.getDay();var c=a.getFullYear();G[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?Tc:Sc)[a.getMonth()]+a.getDate()-1|0;G[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();G[b+32>>
463
- 2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},sb:(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);G[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?(Va(a,B,c,17),Va(b,B,d,17)):(Va(a,B,d,17),Va(b,B,c,17))},Ia:function(a,b,c){(a=u[a].tc.qd)&&a.beginPixelLocalStorageWEBGL(l.HEAPU32.subarray(c,
464
- c+b))},yb: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},fb: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)}},eb:function(a){var b=l.images;b&&b.get(a)&&b.delete(a)},s:(a,b,c)=>{Uc.length=0;for(var d;d=B[b++];){var e=105!=
465
- d;e&=112!=d;c+=e&&c%8?4:0;Uc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?G[c>>2]:va[c>>3]);c+=e?8:4}return yd[a](...Uc)},xb:()=>Date.now(),Xa:()=>performance.now(),pb: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=u[a];b=b?L(B,b):"";b.startsWith("GL_")&&
463
+ 2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},qb:(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);G[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?(Va(a,B,c,17),Va(b,B,d,17)):(Va(a,B,d,17),Va(b,B,c,17))},Ia:function(a,b,c){(a=u[a].tc.qd)&&a.beginPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,
464
+ 4*c,b))},yb: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},fb: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)}},eb:function(a){var b=l.images;b&&b.get(a)&&b.delete(a)},s:(a,b,c)=>{Uc.length=0;for(var d;d=B[b++];){var e=
465
+ 105!=d;e&=112!=d;c+=e&&c%8?4:0;Uc.push(112==d?J[c>>2]:106==d?wa[c>>3]:105==d?G[c>>2]:va[c>>3]);c+=e?8:4}return yd[a](...Uc)},xb:()=>Date.now(),Xa:()=>performance.now(),nb: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=u[a];b=b?L(B,b):"";b.startsWith("GL_")&&
466
466
  (b=b.slice(3));"WEBGL_draw_instanced_base_vertex_base_instance"==b&&Vc(X);"WEBGL_multi_draw_instanced_base_vertex_base_instance"==b&&Wc(X);"WEBGL_multi_draw"==b&&(X.Ke=X.getExtension("WEBGL_multi_draw"));"EXT_polygon_offset_clamp"==b&&(X.ue=X.getExtension("EXT_polygon_offset_clamp"));"EXT_clip_control"==b&&(X.te=X.getExtension("EXT_clip_control"));"WEBGL_polygon_mode"==b&&(X.Te=X.getExtension("WEBGL_polygon_mode"));return!!a.tc.getExtension(b)},f:()=>n?n.handle:0,ja:a=>ha(a)?0:-5,Ga:function(a){a=
467
- u[a].tc;a.Yd=a.getExtension("WEBGL_provoking_vertex");return!!a.Yd},La:function(a){a=u[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},Ha:function(a,b,c){(a=u[a].tc.qd)&&a.endPixelLocalStorageWEBGL(l.HEAPU32.subarray(c,c+b))},mb:(a,b)=>{var c=0,d=0,e;for(e of nd()){var f=
468
- b+c;J[a+d>>2]=f;c+=Va(e,B,f,Infinity)+1;d+=4}return 0},nb:(a,b)=>{var c=nd();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=vb(a);if(null===b.Mc)throw new M(8);b.Cd&&(b.Cd=null);try{b.hc.close&&b.hc.close(b)}catch(c){throw c;}finally{kb[b.Mc]=null}b.Mc=null;return 0}catch(c){if("undefined"==typeof Gb||"ErrnoError"!==c.name)throw c;return c.Lc}},ub:function(a,b,c,d){try{a:{var e=vb(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 m=e,q=
467
+ u[a].tc;a.Yd=a.getExtension("WEBGL_provoking_vertex");return!!a.Yd},La:function(a){a=u[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},Ha:function(a,b,c){(a=u[a].tc.qd)&&a.endPixelLocalStorageWEBGL(new Uint32Array(Aa.buffer,4*c,b))},sb:(a,b)=>{var c=0,d=0,e;for(e of nd()){var f=
468
+ b+c;J[a+d>>2]=f;c+=Va(e,B,f,Infinity)+1;d+=4}return 0},tb:(a,b)=>{var c=nd();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=vb(a);if(null===b.Mc)throw new M(8);b.Cd&&(b.Cd=null);try{b.hc.close&&b.hc.close(b)}catch(c){throw c;}finally{kb[b.Mc]=null}b.Mc=null;return 0}catch(c){if("undefined"==typeof Gb||"ErrnoError"!==c.name)throw c;return c.Lc}},ub:function(a,b,c,d){try{a:{var e=vb(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 m=e,q=
469
469
  h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(1===(m.flags&2097155))throw new M(8);if(16384===(m.node.mode&61440))throw new M(31);if(!m.hc.read)throw new M(28);var p="undefined"!=typeof t;if(!p)t=m.position;else if(!m.seekable)throw new M(70);var r=m.hc.read(m,C,q,v,t);p||(m.position+=r);var w=r;if(0>w){var x=-1;break a}b+=w;if(w<k)break;"undefined"!=typeof f&&(f+=w)}x=b}J[d>>2]=x;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.Lc}},
470
- tb:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=vb(a);Eb(e,b,c);wa[d>>3]=BigInt(e.position);e.Cd&&0===b&&0===c&&(e.Cd=null);return 0}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return f.Lc}},oa:function(a,b,c,d){try{a:{var e=vb(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 m=e,q=h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(0===(m.flags&2097155))throw new M(8);if(16384===
470
+ rb:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=vb(a);Eb(e,b,c);wa[d>>3]=BigInt(e.position);e.Cd&&0===b&&0===c&&(e.Cd=null);return 0}catch(f){if("undefined"==typeof Gb||"ErrnoError"!==f.name)throw f;return f.Lc}},oa:function(a,b,c,d){try{a:{var e=vb(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 m=e,q=h,v=k,t=f,C=A;if(0>v||0>t)throw new M(28);if(null===m.Mc)throw new M(8);if(0===(m.flags&2097155))throw new M(8);if(16384===
471
471
  (m.node.mode&61440))throw new M(31);if(!m.hc.write)throw new M(28);m.seekable&&m.flags&1024&&Eb(m,0,2);var p="undefined"!=typeof t;if(!p)t=m.position;else if(!m.seekable)throw new M(70);var r=m.hc.write(m,C,q,v,t,void 0);p||(m.position+=r);var w=r;if(0>w){var x=-1;break a}b+=w;if(w<k)break;"undefined"!=typeof f&&(f+=w)}x=b}J[d>>2]=x;return 0}catch(z){if("undefined"==typeof Gb||"ErrnoError"!==z.name)throw z;return z.Lc}},Ja:function(a,b,c,d,e,f){(a=u[a].tc.qd)&&a.framebufferPixelLocalClearValuefvWEBGL(b,
472
472
  [c,d,e,f])},Ka:function(a,b,c,d,e,f){(a=u[a].tc.qd)&&a.framebufferTexturePixelLocalStorageWEBGL(b,bd[c],d,e,f)},e:a=>X.activeTexture(a),E:(a,b)=>{X.attachShader(Y[a],cd[b])},M:(a,b)=>{35051==a?X.yd=b:35052==a&&(X.ed=b);X.bindBuffer(a,Zc[b])},va:(a,b,c,d,e)=>{X.bindBufferRange(a,b,Zc[c],d,e)},i:(a,b)=>{X.bindFramebuffer(a,$c[b])},sa:(a,b)=>{X.bindRenderbuffer(a,ad[b])},Kb:(a,b)=>{X.bindSampler(a,ed[b])},d:(a,b)=>{X.bindTexture(a,bd[b])},Na:a=>{X.bindVertexArray(dd[a])},g:a=>X.blendEquation(a),L:(a,
473
473
  b)=>X.blendFunc(a,b),Y:(a,b,c,d,e,f,g,h,k,m)=>X.blitFramebuffer(a,b,c,d,e,f,g,h,k,m),y:(a,b,c,d)=>{c&&b?X.bufferData(a,B,d,c,b):X.bufferData(a,b,d)},ya:(a,b,c,d)=>{c&&X.bufferSubData(a,b,B,d,c)},Db:a=>X.clear(a),Gb:(a,b,c)=>{X.clearBufferfv(a,b,ua,c>>2)},Fb:(a,b,c)=>{X.clearBufferuiv(a,b,J,c>>2)},Eb:(a,b,c,d)=>X.clearColor(a,b,c,d),Ua:a=>X.clearDepth(a),Ta:a=>X.clearStencil(a),fa:(a,b,c,d)=>{X.colorMask(!!a,!!b,!!c,!!d)},za:a=>{X.compileShader(cd[a])},Jb:(a,b,c,d,e,f,g,h,k)=>{X.ed||!h?X.compressedTexSubImage2D(a,
@@ -481,7 +481,7 @@ var q=c.Id;c.Id+=h;e[m]=[h,q];for(k=0;k<h;++k)d[q]=k,c.ce[q++]=m}}c=a.$c;d=0;e=b
481
481
  ud(f);g>>>=31-Math.clz32(h.BYTES_PER_ELEMENT);X.readPixels(a,b,c,d,e,f,h,g)}},ra:(a,b,c,d,e)=>X.renderbufferStorageMultisample(a,b,c,d,e),Sa:(a,b,c,d)=>X.scissor(a,b,c,d),Aa:(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}X.shaderSource(cd[a],e)},Qa:(a,b,c)=>X.stencilFunc(a,b,c),ca:(a,b,c,d)=>X.stencilFuncSeparate(a,b,c,d),da:a=>X.stencilMask(a),Pa:(a,b,c)=>X.stencilOp(a,b,c),ba:(a,b,c,d)=>X.stencilOpSeparate(a,b,c,d),p:(a,b,c)=>X.texParameteri(a,b,
482
482
  c),o:(a,b,c,d,e)=>X.texStorage2D(a,b,c,d,e),Ab:(a,b,c,d,e,f)=>X.texStorage3D(a,b,c,d,e,f),D:(a,b,c,d,e,f,g,h,k)=>{if(X.ed)X.texSubImage2D(a,b,c,d,e,f,g,h,k);else if(k){var m=ud(h);X.texSubImage2D(a,b,c,d,e,f,g,h,m,k>>>31-Math.clz32(m.BYTES_PER_ELEMENT))}else{if(k){m=ud(h);var q=f*((hd||e)*({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[g-6402]||1)*m.BYTES_PER_ELEMENT+gd-1&-gd);k=m.subarray(k>>>31-Math.clz32(m.BYTES_PER_ELEMENT),k+q>>>31-Math.clz32(m.BYTES_PER_ELEMENT))}else k=null;
483
483
  X.texSubImage2D(a,b,c,d,e,f,g,h,k)}},X:(a,b)=>{var c=X,d=c.uniform1i;var e=X.pe;if(e){var f=e.$c[a];"number"==typeof f&&(e.$c[a]=f=X.getUniformLocation(e,e.ce[a]+(0<f?`[${f}]`:"")));a=f}else Z||=1282,a=void 0;d.call(c,a,b)},J:(a,b,c)=>{a=Y[a];X.uniformBlockBinding(a,b,c)},Oa:a=>{a=Y[a];X.useProgram(a);X.pe=a},I:(a,b)=>{X.vertexAttribDivisor(a,b)},U:(a,b,c,d,e)=>{X.vertexAttribIPointer(a,b,c,d,e)},u:(a,b,c,d,e,f)=>{X.vertexAttribPointer(a,b,c,!!d,e,f)},P:(a,b,c,d)=>X.viewport(a,b,c,d),Ya:Cd,Za:function(){return-1<
484
- navigator.platform.indexOf("Win")},Ea:function(a,b){(a=u[a].tc.Yd)&&a.provokingVertexWEBGL(b)},hb:function(a,b){var c=l.images;c&&(b=c.get(b))&&(a=u[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))},_a:function(a,b,c){b=l.HEAP8.subarray(b,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");
484
+ navigator.platform.indexOf("Win")},Ea:function(a,b){(a=u[a].tc.Yd)&&a.provokingVertexWEBGL(b)},hb:function(a,b){var c=l.images;c&&(b=c.get(b))&&(a=u[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))},_a: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");
485
485
  e.drawImage(d,0,0);e=e.getImageData(0,0,d.width,d.height);var f=e.data.length,g=l.je(f);l.Ue.set(e.data,g);l.We(a,d.width,d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=l.mf(d)+1,f=l.je(e);l.tf(d,f,e);l.Xe(a,f);l.Ve(f)})}};function Cd(a,b,c){var d=Bd();try{vc.get(a)(b,c)}catch(e){Ad(d);if(e!==e+0)throw e;zd(1,0)}}var Ed;
486
486
  Ed=await (async function(){function a(c){c=Ed=c.exports;Qb=c.Sb;rd=c.Tb;l._setWebImage=c.Ub;Pb=c.Vb;l._wasm_image_decode_complete=c.Wb;l._wasm_image_decode_error=c.Xb;vd=l._ma_device__on_notification_unlocked=c.Yb;l._ma_malloc_emscripten=c.Zb;l._ma_free_emscripten=c._b;wd=l._ma_device_process_pcm_frames_capture__webaudio=c.$b;xd=l._ma_device_process_pcm_frames_playback__webaudio=c.ac;zd=c.bc;Ad=c.cc;Bd=c.dc;Aa=c.Pb;vc=c.Rb;za();return Ed}var b={a:Dd};if(l.instantiateWasm)return new Promise(c=>
487
487
  {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)}());
@@ -495,7 +495,7 @@ if(l.preRun)for("function"==typeof l.preRun&&(l.preRun=[l.preRun]);l.preRun.leng
495
495
  /* 5 */
496
496
  /***/ ((module) => {
497
497
 
498
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.40.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}}');
498
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/webgl2","version":"2.41.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
499
 
500
500
  /***/ }),
501
501
  /* 6 */
@@ -2651,21 +2651,21 @@ __webpack_require__.r(__webpack_exports__);
2651
2651
  /* harmony export */ KeyboardInteractions: () => (/* binding */ KeyboardInteractions)
2652
2652
  /* harmony export */ });
2653
2653
  /**
2654
- * Tracks the relationship between the canvas's DOM focus and Rive's internal focus for the
2655
- * current focus session.
2654
+ * Tracks the relationship between DOM focus inside this Rive focus domain (canvas or semantic overlay)
2655
+ * and Rive's internal focus for the current focus session.
2656
2656
  *
2657
- * NotFocused — the canvas is not the active DOM element, or Rive entered and then released focus
2658
- * internally this session. Either way the next Tab should move on to the next page
2659
- * element, so Tab events are ignored.
2660
- * EntryPending — the canvas has DOM focus but Rive holds no active focus node yet, and the next Tab should enter
2661
- * the focus tree. This is the resting state for pointer-driven focus (a click on the
2662
- * canvas), or an edge case for keyboard focus where initial focus action did not land on a focus node.
2663
- * RiveFocused — a Rive node currently holds focus. Tab/Shift+Tab are routed to the Rive focus
2664
- * manager and trapped inside the canvas until Rive notifies focus has ended.
2657
+ * NotFocused — DOM focus left the domain, Rive released focus internally, or Tab walked
2658
+ * off the end of the tree. Keyboard input isn't ours, so Tab is ignored and
2659
+ * reaches the next page element.
2660
+ * EntryPending — DOM focus is inside the domain but Rive holds no node yet, so the next Tab
2661
+ * enters the focus tree. Set by pointer focus on the canvas, by assistive technology (AT) focus landing
2662
+ * in the overlay, and by keyboard focus whose entry attempt found no eligible node.
2663
+ * RiveFocused — a Rive node holds focus. Tab/Shift+Tab route to the Rive focus manager and stay
2664
+ * inside the domain until either Rive reports focus ended (pollFocusState) or
2665
+ * focusNext()/focusPrevious() returns false at the edge of the tree.
2665
2666
  *
2666
- * When keyboard focus lands on the canvas, onCanvasFocus reads the direction focus came from and
2667
- * moves into the focus tree immediately, going straight to RiveFocused. EntryPending is only set via pointer focus (or keyboard focus
2668
- * where focusNext()/focusPrevious() return false but respects tabindex).
2667
+ * Keyboard focus on the canvas enters the tree immediately: onCanvasFocus infers direction from
2668
+ * where focus came from and goes straight to RiveFocused when a node accepts.
2669
2669
  */
2670
2670
  var FocusSessionState;
2671
2671
  (function (FocusSessionState) {
@@ -2674,7 +2674,9 @@ var FocusSessionState;
2674
2674
  FocusSessionState["RiveFocused"] = "riveFocused";
2675
2675
  })(FocusSessionState || (FocusSessionState = {}));
2676
2676
  /**
2677
- * Manages keyboard and DOM focus interactions for a Rive canvas.
2677
+ * Manages keyboard and DOM focus interactions for Rive's focus domain (<canvas> or semantic overlay).
2678
+ * Because keyboard events can apply on either part of the domain, we need to track what events we should
2679
+ * handle/intercept, and when to release focus back to the page outside of the domain.
2678
2680
  *
2679
2681
  * Tracks the canvas focus session state (focusSessionState) and routes
2680
2682
  * Tab/Shift+Tab to the Rive state machine's focus manager. Exposes shared
@@ -2720,17 +2722,45 @@ var KeyboardInteractions = /** @class */ (function () {
2720
2722
  _this.focusSessionState = FocusSessionState.RiveFocused;
2721
2723
  }
2722
2724
  };
2723
- this.onCanvasBlur = function (_event) {
2725
+ /**
2726
+ * Marks internal state that the canvas has lost DOM focus. Do not actually clear
2727
+ * Rive focus though if:
2728
+ * 1. DOM focus is still within Rive domain (i.e., semantic overlay)
2729
+ * 2. Document just lost focus (i.e. tab switching)
2730
+ *
2731
+ * When we're not in either of those buckets, it's safe to call `clearFocus()` on the SMI.
2732
+ */
2733
+ this.onCanvasBlur = function (event) {
2724
2734
  _this.focusSessionState = FocusSessionState.NotFocused;
2725
2735
  _this.canvasHasFocus = false;
2736
+ var movedWithinFocusDomain = _this.isInFocusDomain(event.relatedTarget);
2737
+ var documentLostFocus = event.relatedTarget === null && !document.hasFocus();
2738
+ if (movedWithinFocusDomain || documentLostFocus)
2739
+ return;
2740
+ _this.mainSm.clearFocus();
2726
2741
  };
2742
+ /**
2743
+ * Assistive technology (AT) focus landing inside the overlay is DOM focus inside the Rive focus domain, so open a
2744
+ * session even when no Rive node holds focus yet. shouldRiveHandleKeyEvent treats NotFocused
2745
+ * as authoritative, so without this the overlay's Tab keydowns reach onKeyDown and get dropped
2746
+ * at that gate — the browser would move focus out of Rive instead of to the next focus node.
2747
+ */
2727
2748
  this.onOverlayFocusIn = function (event) {
2728
- if (_this.isInOverlay(event.target)) {
2729
- _this.focusDomainReleased = false;
2730
- }
2749
+ if (!_this.isInOverlay(event.target))
2750
+ return;
2751
+ _this.focusDomainReleased = false;
2752
+ if (!_this.hasFocusNodes)
2753
+ return;
2754
+ if (_this.focusSessionState !== FocusSessionState.NotFocused)
2755
+ return;
2756
+ _this.focusSessionState = _this.mainSm.focusState().hasFocus
2757
+ ? FocusSessionState.RiveFocused
2758
+ : FocusSessionState.EntryPending;
2731
2759
  };
2732
- this.onFocusDomainHostFocusIn = function (_event) {
2760
+ /** Overlay listeners attach lazily, so the first focusin only ever lands here. */
2761
+ this.onFocusDomainHostFocusIn = function (event) {
2733
2762
  _this.syncOverlayListener();
2763
+ _this.onOverlayFocusIn(event);
2734
2764
  };
2735
2765
  this.onKeyDown = function (event) {
2736
2766
  _this.syncOverlayListener();
@@ -2743,7 +2773,7 @@ var KeyboardInteractions = /** @class */ (function () {
2743
2773
  var forward = !event.shiftKey;
2744
2774
  var focusMoved = forward ? _this.mainSm.focusNext() : _this.mainSm.focusPrevious();
2745
2775
  if (focusMoved) {
2746
- // A Rive node accepted focus — keep trapping Tab inside the canvas.
2776
+ // A Rive node accepted focus — keep trapping Tab inside Rive.
2747
2777
  _this.focusSessionState = FocusSessionState.RiveFocused;
2748
2778
  event.preventDefault();
2749
2779
  }
@@ -2779,27 +2809,34 @@ var KeyboardInteractions = /** @class */ (function () {
2779
2809
  /**
2780
2810
  * Called by pollFocusState on the Rive instance when it observes hasFocus=true. Rive acquired
2781
2811
  * focus internally (e.g. via a listener action or state transition) without a DOM focus event,
2782
- * so mark the session RiveFocused.
2812
+ * so mark the session RiveFocused. This cannot resurrect a session that a DOM blur ended,
2813
+ * because onCanvasBlur clears Rive's focus alongside it.
2783
2814
  */
2784
2815
  KeyboardInteractions.prototype.notifyRiveFocused = function () {
2785
2816
  this.focusSessionState = FocusSessionState.RiveFocused;
2786
2817
  };
2787
2818
  /**
2788
- * Whether Rive should handle this keydown — i.e. it currently owns keyboard input.
2789
- * True when focus is anywhere in the Rive focus domain (the canvas itself or the
2790
- * accessibility overlay), OR a focus session is active and the key landed on the
2791
- * canvas.
2819
+ * Determine if Rive should handle keyboard input. If session state is `NotFocused` - no.
2820
+ * DOM focus stays parked on the canvas after Rive releases focus internally, and that Tab
2821
+ * has to reach the page rather than re-enter the tree.
2822
+ *
2823
+ * Otherwise, the event still has to belong to Rive:
2824
+ * 1. If the current DOM focus is in Rive domain (canvas or semantic overlay)
2825
+ * 2. If the target for the key input is for the semantic overlay, or the canvas
2792
2826
  */
2793
2827
  KeyboardInteractions.prototype.shouldRiveHandleKeyEvent = function (event) {
2828
+ if (this.focusSessionState === FocusSessionState.NotFocused)
2829
+ return false;
2794
2830
  var inFocusDomain = this.isInFocusDomain(document.activeElement) ||
2795
2831
  this.isInOverlay(event.target);
2796
- if (inFocusDomain)
2797
- return true;
2798
- var sessionActive = this.focusSessionState !== FocusSessionState.NotFocused;
2799
2832
  var eventOnCanvas = event.target === this.canvas;
2800
- return sessionActive && (this.canvasHasFocus || eventOnCanvas);
2833
+ return inFocusDomain || this.canvasHasFocus || eventOnCanvas;
2801
2834
  };
2802
- /** Rive focus domain = the canvas itself OR the accessibility overlay. */
2835
+ /**
2836
+ * The Rive focus domain: the DOM that counts as "inside" Rive for focus purposes — today the
2837
+ * canvas itself OR the accessibility overlay subtree. Anything added later belongs here, so
2838
+ * session bookkeeping and keydown routing pick it up for free.
2839
+ */
2803
2840
  KeyboardInteractions.prototype.isInFocusDomain = function (target) {
2804
2841
  if (target === this.canvas)
2805
2842
  return true;
@@ -3583,6 +3620,12 @@ var Layout = /** @class */ (function () {
3583
3620
 
3584
3621
  // #endregion
3585
3622
  // #region state machines
3623
+ /**
3624
+ * @deprecated State machine inputs are deprecated and will be removed in a
3625
+ * future major version: please use data binding properties instead. See
3626
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
3627
+ * for how to migrate.
3628
+ */
3586
3629
  var StateMachineInputType;
3587
3630
  (function (StateMachineInputType) {
3588
3631
  StateMachineInputType[StateMachineInputType["Number"] = 56] = "Number";
@@ -3591,6 +3634,10 @@ var StateMachineInputType;
3591
3634
  })(StateMachineInputType || (StateMachineInputType = {}));
3592
3635
  /**
3593
3636
  * An input for a state machine
3637
+ * @deprecated State machine inputs are deprecated and will be removed in a
3638
+ * future major version: please use data binding properties instead. See
3639
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
3640
+ * for how to migrate.
3594
3641
  */
3595
3642
  var StateMachineInput = /** @class */ (function () {
3596
3643
  function StateMachineInput(type, runtimeInput) {
@@ -3640,6 +3687,11 @@ var StateMachineInput = /** @class */ (function () {
3640
3687
  return StateMachineInput;
3641
3688
  }());
3642
3689
 
3690
+ /**
3691
+ * @deprecated Rive Events are deprecated and will be removed in a future major
3692
+ * version: please use data binding instead. See
3693
+ * {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
3694
+ */
3643
3695
  var RiveEventType;
3644
3696
  (function (RiveEventType) {
3645
3697
  RiveEventType[RiveEventType["General"] = 128] = "General";
@@ -4182,6 +4234,12 @@ var Animator = /** @class */ (function () {
4182
4234
  var instancedName;
4183
4235
  if (this.animations.length === 0 && this.stateMachines.length === 0) {
4184
4236
  if (this.artboard.animationCount() > 0) {
4237
+ // Warn only when the v3 default would actually change what plays
4238
+ if (this.artboard.stateMachineCount() > 0) {
4239
+ warnOnce("No `stateMachine` was specified, so the artboard's first linear animation is playing by default. " +
4240
+ "In the next major version, the artboard's state machine will be played by default instead when one exists. " +
4241
+ "Pass the `stateMachine` parameter to adopt that behavior now.");
4242
+ }
4185
4243
  // Add the first animation
4186
4244
  this.add([(instancedName = this.artboard.animationByIndex(0).name)], playing, fireEvent);
4187
4245
  }
@@ -4260,15 +4318,84 @@ var EventType;
4260
4318
  EventType["Play"] = "play";
4261
4319
  EventType["Pause"] = "pause";
4262
4320
  EventType["Stop"] = "stop";
4321
+ /**
4322
+ * @deprecated Loop events are deprecated and will be removed in a future
4323
+ * major version: they are only reported for linear animation playback, which
4324
+ * is deprecated. Use a state machine to control playback and data binding to
4325
+ * react to changes instead. See
4326
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
4327
+ * to migrate.
4328
+ */
4263
4329
  EventType["Loop"] = "loop";
4264
4330
  EventType["Draw"] = "draw";
4265
4331
  EventType["Advance"] = "advance";
4332
+ /**
4333
+ * @deprecated State change events are deprecated and will be removed in a
4334
+ * future major version. Use data binding (view model property observers) or
4335
+ * state machine actions to react to changes from your graphic instead. See
4336
+ * {@link https://rive.app/docs/editor/state-machine/states#actions} for more details.
4337
+ */
4266
4338
  EventType["StateChange"] = "statechange";
4339
+ /**
4340
+ * @deprecated Rive Events are deprecated and will be removed in a future
4341
+ * major version: please use data binding instead. See
4342
+ * {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
4343
+ */
4267
4344
  EventType["RiveEvent"] = "riveevent";
4268
4345
  EventType["AudioStatusChange"] = "audiostatuschange";
4269
4346
  })(EventType || (EventType = {}));
4347
+ var riveEventsDeprecationWarning = "Rive Events are deprecated and will be removed in a future major version: " +
4348
+ "please use data binding instead. See " +
4349
+ "https://rive.app/docs/runtimes/web/rive-events for how to migrate.";
4350
+ var stateMachineInputsDeprecationWarning = "State machine inputs are deprecated and will be removed in a future major version: " +
4351
+ "please use data binding properties instead. See " +
4352
+ "https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs for how to migrate.";
4353
+ var textRunsDeprecationWarning = "Text run APIs are deprecated and will be removed in a future major version: " +
4354
+ "please use data binding instead. See " +
4355
+ "https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime for how to migrate.";
4356
+ var loopEventsDeprecationWarning = "Loop events are deprecated and will be removed in a future major version: " +
4357
+ "they are only reported for linear animation playback, which is deprecated. " +
4358
+ "Use a state machine to control playback and data binding to react to changes instead. See " +
4359
+ "https://rive.app/docs/editor/data-binding/migration-guide for how to migrate.";
4360
+ var stateChangeEventsDeprecationWarning = "State change events are deprecated and will be removed in a future major version: " +
4361
+ "use data binding (view model property observers) or state machine actions to react to " +
4362
+ "changes from your graphic instead. See " +
4363
+ "https://rive.app/docs/editor/state-machine/states#actions for how to migrate.";
4364
+ // Deprecation warnings already emitted; each is logged at most once per page
4365
+ // session to avoid flooding the console when many instances are created.
4366
+ var emittedWarnings = new Set();
4367
+ var warnOnce = function (message) {
4368
+ if (!emittedWarnings.has(message)) {
4369
+ emittedWarnings.add(message);
4370
+ console.warn("[Rive] ".concat(message));
4371
+ }
4372
+ };
4373
+ /**
4374
+ * Warns that a playback-control method received an array of names; the next
4375
+ * major version restricts these parameters to a single string, since playing
4376
+ * multiple animations or state machines at once will not be supported.
4377
+ */
4378
+ var warnIfNamesArray = function (names, methodName) {
4379
+ if (Array.isArray(names)) {
4380
+ warnOnce("Passing an array of names to `".concat(methodName, "()` is deprecated: in the next major version this parameter will be a single string, and playing multiple animations or state machines at once will not be supported."));
4381
+ }
4382
+ };
4383
+ /**
4384
+ * Warns that a playback-control method received linear animation names;
4385
+ * name-based control remains supported for state machines only, so
4386
+ * user-specified linear animation names are going away in a future major
4387
+ * version.
4388
+ */
4389
+ var warnDeprecatedAnimationNames = function (methodName) {
4390
+ warnOnce("Passing linear animation names to `".concat(methodName, "()` is deprecated and will be removed in a future major version: ") +
4391
+ "Pass a single state machine name to control playback instead.");
4392
+ };
4270
4393
  /**
4271
4394
  * Looping types: one-shot, loop, and ping-pong
4395
+ * @deprecated Loop events are deprecated and will be removed in a future major
4396
+ * version: they are only reported for linear animation playback, which is
4397
+ * deprecated. Use a state machine to control playback and data binding to
4398
+ * react to changes instead.
4272
4399
  */
4273
4400
  var LoopType;
4274
4401
  (function (LoopType) {
@@ -4582,6 +4709,31 @@ var observers = new ObjectObservers();
4582
4709
  // #endregion
4583
4710
  // #region Rive
4584
4711
  var nextRiveInstanceId = 0;
4712
+ /**
4713
+ * Resolves which animation/state machine names playback should start with.
4714
+ * The `stateMachine` parameter takes priority; the deprecated plural
4715
+ * `animations`/`stateMachines` parameters apply only when it
4716
+ * is not provided.
4717
+ */
4718
+ var resolveStartingPlayback = function (_a) {
4719
+ var stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines;
4720
+ if (animations !== undefined) {
4721
+ warnOnce("The `animations` parameter is deprecated and will be removed in a future major version: please use the `stateMachine` parameter to play a state machine instead.");
4722
+ }
4723
+ if (stateMachines !== undefined) {
4724
+ warnOnce("The `stateMachines` parameter is deprecated: please use `stateMachine` with a single state machine name instead.");
4725
+ }
4726
+ if (stateMachine) {
4727
+ return {
4728
+ startingAnimationNames: [],
4729
+ startingStateMachineNames: [stateMachine],
4730
+ };
4731
+ }
4732
+ return {
4733
+ startingAnimationNames: mapToStringArray(animations),
4734
+ startingStateMachineNames: mapToStringArray(stateMachines),
4735
+ };
4736
+ };
4585
4737
  var RiveFile = /** @class */ (function () {
4586
4738
  function RiveFile(params) {
4587
4739
  // Allow the runtime to automatically load assets hosted in Rive's runtime.
@@ -5003,6 +5155,10 @@ var Rive = /** @class */ (function () {
5003
5155
  this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
5004
5156
  this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
5005
5157
  this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
5158
+ if (params.automaticallyHandleEvents) {
5159
+ warnOnce("The `automaticallyHandleEvents` parameter is deprecated. " +
5160
+ riveEventsDeprecationWarning);
5161
+ }
5006
5162
  this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
5007
5163
  this.dispatchPointerExit =
5008
5164
  params.dispatchPointerExit === false
@@ -5067,6 +5223,7 @@ var Rive = /** @class */ (function () {
5067
5223
  riveFile: this.riveFile,
5068
5224
  autoplay: params.autoplay,
5069
5225
  autoBind: params.autoBind,
5226
+ stateMachine: params.stateMachine,
5070
5227
  animations: params.animations,
5071
5228
  stateMachines: params.stateMachines,
5072
5229
  artboard: params.artboard,
@@ -5133,7 +5290,7 @@ var Rive = /** @class */ (function () {
5133
5290
  // Initializes the Rive object either from constructor or load()
5134
5291
  Rive.prototype.init = function (_a) {
5135
5292
  var _this = this;
5136
- var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c, _d = _a.autoBind, autoBind = _d === void 0 ? false : _d, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions;
5293
+ var src = _a.src, buffer = _a.buffer, riveFile = _a.riveFile, stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines, artboard = _a.artboard, _b = _a.autoplay, autoplay = _b === void 0 ? false : _b, _c = _a.useOffscreenRenderer, useOffscreenRenderer = _c === void 0 ? false : _c, _d = _a.autoBind, autoBind = _d === void 0 ? false : _d, tabIndex = _a.tabIndex, semanticsMode = _a.semanticsMode, semanticsOptions = _a.semanticsOptions;
5137
5294
  if (this.destroyed) {
5138
5295
  return;
5139
5296
  }
@@ -5147,10 +5304,12 @@ var Rive = /** @class */ (function () {
5147
5304
  if (!this.src && !this.buffer && !this.riveFile) {
5148
5305
  throw new RiveError(Rive.missingErrorMessage);
5149
5306
  }
5150
- // List of animations that should be initialized.
5151
- var startingAnimationNames = mapToStringArray(animations);
5152
- // List of state machines that should be initialized
5153
- var startingStateMachineNames = mapToStringArray(stateMachines);
5307
+ // Names of the animations and state machines that should be initialized
5308
+ var _e = resolveStartingPlayback({
5309
+ stateMachine: stateMachine,
5310
+ animations: animations,
5311
+ stateMachines: stateMachines,
5312
+ }), startingAnimationNames = _e.startingAnimationNames, startingStateMachineNames = _e.startingStateMachineNames;
5154
5313
  // Ensure loaded is marked as false if loading new file
5155
5314
  this.loaded = false;
5156
5315
  this.readyForPlaying = false;
@@ -5506,8 +5665,9 @@ var Rive = /** @class */ (function () {
5506
5665
  // Rive has an active focus node. Mark the session RiveFocused so Tab stays
5507
5666
  // trapped and a later internal release (hasFocus true → false) is detected.
5508
5667
  this._keyboardInteractions.notifyRiveFocused();
5509
- // Only steal DOM focus on the false→true transition. If hasFocus stays
5510
- // true across frames and the user clicks away, do not re-focus the canvas again.
5668
+ // Only steal DOM focus on the false→true transition. Rive can hold focus across
5669
+ // frames while DOM focus sits elsewhere — a window switch preserves runtime focus
5670
+ // by design — and that must not re-focus the canvas again.
5511
5671
  if (!this._prevHasFocus) {
5512
5672
  // Steal DOM focus to the canvas only when focus isn't already held
5513
5673
  // somewhere inside this instance's focus scope. When the accessibility
@@ -5528,8 +5688,9 @@ var Rive = /** @class */ (function () {
5528
5688
  this._prevHasFocus = false;
5529
5689
  // hasFocus is false — only act when Rive previously held focus and released it internally
5530
5690
  // (state change clears focus). Release the DOM Tab trap so the next Tab moves to the next
5531
- // page element. EntryPending and NotFocused cases are intentional no-ops — EntryPending in
5532
- // particular must stay in its state (a click awaiting its first Tab) rather than be reset here.
5691
+ // page element. A DOM blur reaches here too now that onCanvasBlur clears Rive focus, but it
5692
+ // has already set NotFocused, so this is a no-op. EntryPending and NotFocused are likewise
5693
+ // intentional no-ops — EntryPending must stay put (a click awaiting its first Tab).
5533
5694
  if (this._keyboardInteractions.focusSessionState === _utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.RiveFocused) {
5534
5695
  this._keyboardInteractions.setFocusSessionState(_utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.NotFocused);
5535
5696
  }
@@ -5865,6 +6026,7 @@ var Rive = /** @class */ (function () {
5865
6026
  * might happen.
5866
6027
  */
5867
6028
  Rive.prototype.cleanupInstances = function () {
6029
+ var _a;
5868
6030
  if (this.eventCleanup !== null) {
5869
6031
  this.eventCleanup();
5870
6032
  }
@@ -5872,8 +6034,9 @@ var Rive = /** @class */ (function () {
5872
6034
  // Tear down semantics before deleting state machines — the overlay's action
5873
6035
  // closures point at instances that stop() is about to free.
5874
6036
  this.cleanupSemantics();
5875
- // Delete all animation and state machine instances
5876
- this.stop();
6037
+ // Delete all animation and state machine instances synchronously via the
6038
+ // animator
6039
+ (_a = this.animator) === null || _a === void 0 ? void 0 : _a.stop();
5877
6040
  if (this.artboard) {
5878
6041
  this.artboard.delete();
5879
6042
  this.artboard = null;
@@ -5906,29 +6069,58 @@ var Rive = /** @class */ (function () {
5906
6069
  * Returns a string from a given text run node name, or undefined if the text run
5907
6070
  * cannot be queried.
5908
6071
  *
6072
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6073
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6074
+ * for how to migrate.
5909
6075
  * @param textRunName - Name of the text run node associated with a text object
5910
6076
  * @returns - String value of the text run node or undefined
5911
6077
  */
5912
6078
  Rive.prototype.getTextRunValue = function (textRunName) {
6079
+ warnOnce(textRunsDeprecationWarning);
5913
6080
  var textRun = this.retrieveTextRun(textRunName);
5914
6081
  return textRun ? textRun.text : undefined;
5915
6082
  };
5916
6083
  /**
5917
6084
  * Sets a text value for a given text run node name if possible
5918
6085
  *
6086
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6087
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6088
+ * for how to migrate.
5919
6089
  * @param textRunName - Name of the text run node associated with a text object
5920
6090
  * @param textRunValue - String value to set on the text run node
5921
6091
  */
5922
6092
  Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {
6093
+ warnOnce(textRunsDeprecationWarning);
5923
6094
  var textRun = this.retrieveTextRun(textRunName);
5924
6095
  if (textRun) {
5925
6096
  textRun.text = textRunValue;
5926
6097
  }
5927
6098
  };
5928
- // Plays specified animations; if none specified, it unpauses everything.
6099
+ /**
6100
+ * Warns when playback-control names match linear animations in the
6101
+ * Animator's instanced context; state machine playback remain supported.
6102
+ *
6103
+ * Remove for v3 release
6104
+ */
6105
+ Rive.prototype.warnIfLinearAnimationNames = function (names, methodName) {
6106
+ if (this.animator &&
6107
+ this.animator.animations.some(function (a) { return names.includes(a.name); })) {
6108
+ warnDeprecatedAnimationNames(methodName);
6109
+ }
6110
+ };
6111
+ /**
6112
+ * Plays specified animations or state machines; if none specified, it
6113
+ * unpauses everything.
6114
+ * @param animationNames Animation or state machine name(s) to play.
6115
+ *
6116
+ * Deprecated usage: passing linear animation names (control playback with a
6117
+ * state machine instead) and passing an array of names (this parameter
6118
+ * becomes a single string in the next major version).
6119
+ */
5929
6120
  Rive.prototype.play = function (animationNames, autoplay) {
5930
6121
  var _this = this;
5931
- animationNames = mapToStringArray(animationNames);
6122
+ warnIfNamesArray(animationNames, "play");
6123
+ var names = mapToStringArray(animationNames);
5932
6124
  // If the file's not loaded, queue up the play
5933
6125
  if (!this.readyForPlaying) {
5934
6126
  this.taskQueue.add({
@@ -5936,7 +6128,8 @@ var Rive = /** @class */ (function () {
5936
6128
  });
5937
6129
  return;
5938
6130
  }
5939
- this.animator.play(animationNames);
6131
+ this.animator.play(names);
6132
+ this.warnIfLinearAnimationNames(names, "play");
5940
6133
  this.syncSemanticsOnStateMachines();
5941
6134
  if (this.eventCleanup) {
5942
6135
  this.eventCleanup();
@@ -5945,10 +6138,19 @@ var Rive = /** @class */ (function () {
5945
6138
  this.setupRiveListeners();
5946
6139
  this.startRendering();
5947
6140
  };
5948
- // Pauses specified animations; if none specified, pauses all.
6141
+ /**
6142
+ * Pauses specified animations or state machines; if none specified, pauses
6143
+ * all.
6144
+ * @param animationNames Animation or state machine name(s) to pause.
6145
+ *
6146
+ * Deprecated usage: passing linear animation names (control playback with a
6147
+ * state machine instead) and passing an array of names (this parameter
6148
+ * becomes a single string in the next major version).
6149
+ */
5949
6150
  Rive.prototype.pause = function (animationNames) {
5950
6151
  var _this = this;
5951
- animationNames = mapToStringArray(animationNames);
6152
+ warnIfNamesArray(animationNames, "pause");
6153
+ var names = mapToStringArray(animationNames);
5952
6154
  // If the file's not loaded, early out, nothing to pause
5953
6155
  if (!this.readyForPlaying) {
5954
6156
  this.taskQueue.add({
@@ -5960,11 +6162,20 @@ var Rive = /** @class */ (function () {
5960
6162
  this.eventCleanup();
5961
6163
  }
5962
6164
  this.cleanupKeyboardInteractions();
5963
- this.animator.pause(animationNames);
6165
+ this.animator.pause(names);
6166
+ this.warnIfLinearAnimationNames(names, "pause");
5964
6167
  };
6168
+ /**
6169
+ * Scrubs specified animations to the given time; if none specified, scrubs
6170
+ * all of them.
6171
+ * @deprecated `scrub()` will be removed in a future major version: use a
6172
+ * state machine to control playback instead
6173
+ */
5965
6174
  Rive.prototype.scrub = function (animationNames, value) {
5966
6175
  var _this = this;
5967
- animationNames = mapToStringArray(animationNames);
6176
+ warnOnce("`scrub()` is deprecated and will be removed in a future major version: " +
6177
+ "use a state machine to control playback instead.");
6178
+ var names = mapToStringArray(animationNames);
5968
6179
  // If the file's not loaded, early out, nothing to pause
5969
6180
  if (!this.readyForPlaying) {
5970
6181
  this.taskQueue.add({
@@ -5974,13 +6185,22 @@ var Rive = /** @class */ (function () {
5974
6185
  }
5975
6186
  // Scrub the animation time; we draw a single frame here so that if
5976
6187
  // nothing's currently playing, the scrubbed animation is still rendered/
5977
- this.animator.scrub(animationNames, value || 0);
6188
+ this.animator.scrub(names, value || 0);
5978
6189
  this.drawFrame();
5979
6190
  };
5980
- // Stops specified animations; if none specifies, stops them all.
6191
+ /**
6192
+ * Stops specified animations or state machines; if none specified, stops
6193
+ * them all.
6194
+ * @param animationNames Animation or state machine name(s) to stop.
6195
+ *
6196
+ * Deprecated usage: passing linear animation names (control playback with a
6197
+ * state machine instead) and passing an array of names (this parameter
6198
+ * becomes a single string in the next major version).
6199
+ */
5981
6200
  Rive.prototype.stop = function (animationNames) {
5982
6201
  var _this = this;
5983
- animationNames = mapToStringArray(animationNames);
6202
+ warnIfNamesArray(animationNames, "stop");
6203
+ var names = mapToStringArray(animationNames);
5984
6204
  // If the file's not loaded, early out, nothing to pause
5985
6205
  if (!this.readyForPlaying) {
5986
6206
  this.taskQueue.add({
@@ -5988,9 +6208,10 @@ var Rive = /** @class */ (function () {
5988
6208
  });
5989
6209
  return;
5990
6210
  }
6211
+ this.warnIfLinearAnimationNames(names, "stop");
5991
6212
  // If there is no artboard, this.animator will be undefined
5992
6213
  if (this.animator) {
5993
- this.animator.stop(animationNames);
6214
+ this.animator.stop(names);
5994
6215
  }
5995
6216
  if (this.eventCleanup) {
5996
6217
  this.eventCleanup();
@@ -6001,8 +6222,7 @@ var Rive = /** @class */ (function () {
6001
6222
  /**
6002
6223
  * Resets the animation
6003
6224
  * @param artboard the name of the artboard, or default if none given
6004
- * @param animations the names of animations for playback
6005
- * @param stateMachines the names of state machines for playback
6225
+ * @param stateMachine the name of the state machine for playback
6006
6226
  * @param autoplay whether to autoplay when reset, defaults to false
6007
6227
  *
6008
6228
  */
@@ -6010,15 +6230,22 @@ var Rive = /** @class */ (function () {
6010
6230
  var _a, _b;
6011
6231
  // Get the current artboard, animations, state machines, and playback states
6012
6232
  var artBoardName = params === null || params === void 0 ? void 0 : params.artboard;
6013
- var animationNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.animations);
6014
- var stateMachineNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.stateMachines);
6233
+ var _c = resolveStartingPlayback({
6234
+ stateMachine: params === null || params === void 0 ? void 0 : params.stateMachine,
6235
+ animations: params === null || params === void 0 ? void 0 : params.animations,
6236
+ stateMachines: params === null || params === void 0 ? void 0 : params.stateMachines,
6237
+ }), animationNames = _c.startingAnimationNames, stateMachineNames = _c.startingStateMachineNames;
6015
6238
  var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;
6016
6239
  var autoBind = (_b = params === null || params === void 0 ? void 0 : params.autoBind) !== null && _b !== void 0 ? _b : false;
6017
6240
  // Stop everything and clean up
6018
6241
  this.cleanupInstances();
6019
6242
  // Reinitialize an artboard instance with the state
6020
6243
  this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay, autoBind);
6021
- this.taskQueue.process();
6244
+ // Only drain the task queue once playback commands can execute; tasks
6245
+ // queued before then re-add themselves in a loop.
6246
+ if (this.readyForPlaying) {
6247
+ this.taskQueue.process();
6248
+ }
6022
6249
  };
6023
6250
  // Loads a new Rive file, keeping listeners in place
6024
6251
  Rive.prototype.load = function (params) {
@@ -6173,11 +6400,18 @@ var Rive = /** @class */ (function () {
6173
6400
  });
6174
6401
  /**
6175
6402
  * Returns the inputs for the specified instanced state machine, or an empty
6176
- * list if the name is invalid or the state machine is not instanced
6403
+ * list if the name is invalid or the state machine is not instanced. Returns
6404
+ * undefined if the file is not loaded yet.
6405
+ *
6406
+ * @deprecated State machine inputs are deprecated: use data binding
6407
+ * properties instead. See
6408
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6409
+ * for how to migrate.
6177
6410
  * @param name the state machine name
6178
- * @returns the inputs for the named state machine
6411
+ * @returns the inputs for the named state machine or undefined
6179
6412
  */
6180
6413
  Rive.prototype.stateMachineInputs = function (name) {
6414
+ warnOnce(stateMachineInputsDeprecationWarning);
6181
6415
  // If the file's not loaded, early out, nothing to pause
6182
6416
  if (!this.loaded) {
6183
6417
  return;
@@ -6204,11 +6438,16 @@ var Rive = /** @class */ (function () {
6204
6438
  };
6205
6439
  /**
6206
6440
  * Set the boolean input with the provided name at the given path with value
6441
+ * @deprecated State machine inputs are deprecated: use data binding
6442
+ * properties instead. See
6443
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6444
+ * for how to migrate.
6207
6445
  * @param input the state machine input name
6208
6446
  * @param value the value to set the input to
6209
6447
  * @param path the path the input is located at an artboard level
6210
6448
  */
6211
6449
  Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
6450
+ warnOnce(stateMachineInputsDeprecationWarning);
6212
6451
  var input = this.retrieveInputAtPath(inputName, path);
6213
6452
  if (!input)
6214
6453
  return;
@@ -6221,11 +6460,16 @@ var Rive = /** @class */ (function () {
6221
6460
  };
6222
6461
  /**
6223
6462
  * Set the number input with the provided name at the given path with value
6463
+ * @deprecated State machine inputs are deprecated: use data binding
6464
+ * properties instead. See
6465
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6466
+ * for how to migrate.
6224
6467
  * @param input the state machine input name
6225
6468
  * @param value the value to set the input to
6226
6469
  * @param path the path the input is located at an artboard level
6227
6470
  */
6228
6471
  Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
6472
+ warnOnce(stateMachineInputsDeprecationWarning);
6229
6473
  var input = this.retrieveInputAtPath(inputName, path);
6230
6474
  if (!input)
6231
6475
  return;
@@ -6238,10 +6482,15 @@ var Rive = /** @class */ (function () {
6238
6482
  };
6239
6483
  /**
6240
6484
  * Fire the trigger with the provided name at the given path
6485
+ * @deprecated State machine inputs are deprecated: use data binding
6486
+ * properties instead. See
6487
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6488
+ * for how to migrate.
6241
6489
  * @param input the state machine input name
6242
6490
  * @param path the path the input is located at an artboard level
6243
6491
  */
6244
6492
  Rive.prototype.fireStateAtPath = function (inputName, path) {
6493
+ warnOnce(stateMachineInputsDeprecationWarning);
6245
6494
  var input = this.retrieveInputAtPath(inputName, path);
6246
6495
  if (!input)
6247
6496
  return;
@@ -6289,8 +6538,13 @@ var Rive = /** @class */ (function () {
6289
6538
  *
6290
6539
  * @remarks
6291
6540
  * If the text run cannot be found at the specified path, a warning will be logged to the console.
6541
+ *
6542
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6543
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6544
+ * for how to migrate.
6292
6545
  */
6293
6546
  Rive.prototype.getTextRunValueAtPath = function (textName, path) {
6547
+ warnOnce(textRunsDeprecationWarning);
6294
6548
  var run = this.retrieveTextAtPath(textName, path);
6295
6549
  if (!run) {
6296
6550
  console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
@@ -6315,8 +6569,13 @@ var Rive = /** @class */ (function () {
6315
6569
  *
6316
6570
  * @remarks
6317
6571
  * If the text run cannot be found at the specified path, a warning will be logged to the console.
6572
+ *
6573
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6574
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6575
+ * for how to migrate.
6318
6576
  */
6319
6577
  Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
6578
+ warnOnce(textRunsDeprecationWarning);
6320
6579
  var run = this.retrieveTextAtPath(textName, path);
6321
6580
  if (!run) {
6322
6581
  console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
@@ -6425,10 +6684,26 @@ var Rive = /** @class */ (function () {
6425
6684
  });
6426
6685
  /**
6427
6686
  * Subscribe to Rive-generated events
6687
+ *
6688
+ * Note: subscribing to {@link EventType.RiveEvent},
6689
+ * {@link EventType.StateChange}, or {@link EventType.Loop} is deprecated;
6690
+ * use data binding instead. See
6691
+ * {@link https://rive.app/docs/runtimes/web/rive-events} (Rive Events) and
6692
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
6693
+ * to migrate Rive graphics to a data binding workflow instead.
6428
6694
  * @param type the type of event to subscribe to
6429
6695
  * @param callback callback to fire when the event occurs
6430
6696
  */
6431
6697
  Rive.prototype.on = function (type, callback) {
6698
+ if (type === EventType.RiveEvent) {
6699
+ warnOnce(riveEventsDeprecationWarning);
6700
+ }
6701
+ else if (type === EventType.StateChange) {
6702
+ warnOnce(stateChangeEventsDeprecationWarning);
6703
+ }
6704
+ else if (type === EventType.Loop) {
6705
+ warnOnce(loopEventsDeprecationWarning);
6706
+ }
6432
6707
  this.eventManager.add({
6433
6708
  type: type,
6434
6709
  callback: callback,