@rive-app/canvas 2.40.1 → 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
@@ -444,14 +444,14 @@ c.va.count.value+=1;c.va.mb=!1;return c},["delete"](){this.va.Ba||zc(this);if(th
444
444
  const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
445
445
  Object.assign(Pc.prototype,{Qc(a){this.pc&&(a=this.pc(a));return a},ac(a){this.Va?.(a)},Ma:tc,Aa:function(a){function b(){return this.vb?Oc(this.wa.Sa,{Da:this.gd,Ba:c,Pa:this,Ja:a}):Oc(this.wa.Sa,{Da:this,Ba:a})}var c=this.Qc(a);if(!c)return this.ac(a),null;var d=Nc(this.wa,c);if(void 0!==d){if(0===d.va.count.value)return d.va.Ba=c,d.va.Ja=a,d.clone();d=d.clone();this.ac(a);return d}d=this.wa.Pc(c);d=Cc[d];if(!d)return b.call(this);d=this.ub?d.Gc:d.pointerType;var e=Mc(c,this.wa,d.wa);return null===
446
446
  e?b.call(this):this.vb?Oc(d.wa.Sa,{Da:d,Ba:e,Pa:this,Ja:a}):Oc(d.wa.Sa,{Da:d,Ba:e})}});k.noExitRuntime&&(Xa=k.noExitRuntime);k.print&&(ta=k.print);k.printErr&&(wa=k.printErr);k.wasmBinary&&(xa=k.wasmBinary);k.thisProgram&&(la=k.thisProgram);if(k.preInit)for("function"==typeof k.preInit&&(k.preInit=[k.preInit]);0<k.preInit.length;)k.preInit.shift()();
447
- var Gd={236911:(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=
447
+ var Gd={237247:(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=
448
448
  [];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",
449
- "click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Qa&&h.state===f.device_state.started&&h.Qa.resume().then(()=>{Dd(h.nc)},m=>{console.error("Failed to resume audiocontext",m)})}f.unlock_event_types.map(function(m){document.removeEventListener(m,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},239089:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
450
- window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},239393:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,239497:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},239668:(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.Qa=
449
+ "click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.Qa&&h.state===f.device_state.started&&h.Qa.resume().then(()=>{Dd(h.nc)},m=>{console.error("Failed to resume audiocontext",m)})}f.unlock_event_types.map(function(m){document.removeEventListener(m,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},239425:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
450
+ window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},239729:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,239833:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},240004:(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.Qa=
451
451
  new (window.AudioContext||window.webkitAudioContext)(h);g.Qa.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.fb=g.Qa.createScriptProcessor(d,c,b);g.fb.onaudioprocess=function(m){if(null==g.tb||0==g.tb.length)g.tb=new Float32Array(Ga.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var l=0;l<b;l+=1)for(var u=m.inputBuffer.getChannelData(l),y=g.tb,t=0;t<d;t+=1)y[t*b+l]=u[t];Ed(f,d,e)}if(a==
452
452
  window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(Fd(f,d,e),l=0;l<m.outputBuffer.numberOfChannels;++l)for(u=m.outputBuffer.getChannelData(l),y=g.tb,t=0;t<d;t+=1)u[t]=y[t*b+l];else for(l=0;l<m.outputBuffer.numberOfChannels;++l)m.outputBuffer.getChannelData(l).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(m){g.Cb=g.Qa.createMediaStreamSource(m);g.Cb.connect(g.fb);
453
- g.fb.connect(g.Qa.destination)}).catch(function(m){console.log("Failed to get user media: "+m)});a==window.miniaudio.device_type.playback&&g.fb.connect(g.Qa.destination);g.nc=f;return window.miniaudio.track_device(g)},242545:a=>window.miniaudio.get_device_by_index(a).Qa.sampleRate,242618:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.fb&&(a.fb.onaudioprocess=function(){},a.fb.disconnect(),a.fb=void 0);void 0!==a.Cb&&(a.Cb.disconnect(),a.Cb=void 0);a.Qa.close();a.Qa=void 0;a.nc=void 0},243018:a=>
454
- {window.miniaudio.untrack_device_by_index(a)},243068:a=>{a=window.miniaudio.get_device_by_index(a);a.Qa.resume();a.state=window.miniaudio.device_state.started},243207:a=>{a=window.miniaudio.get_device_by_index(a);a.Qa.suspend();a.state=window.miniaudio.device_state.stopped}},lc,Hd,kc,Dd,Ed,Fd,Id,Jd,Kd,Ld,Ma,Rc,Nd={s:function(a,b,c){Ya=c;try{var d=Lb(a);switch(b){case 0:var e=Za();if(0>e)break;for(;Ab[e];)e++;return Nb(d,e).cb;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Za(),d.flags|=
453
+ g.fb.connect(g.Qa.destination)}).catch(function(m){console.log("Failed to get user media: "+m)});a==window.miniaudio.device_type.playback&&g.fb.connect(g.Qa.destination);g.nc=f;return window.miniaudio.track_device(g)},242881:a=>window.miniaudio.get_device_by_index(a).Qa.sampleRate,242954:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.fb&&(a.fb.onaudioprocess=function(){},a.fb.disconnect(),a.fb=void 0);void 0!==a.Cb&&(a.Cb.disconnect(),a.Cb=void 0);a.Qa.close();a.Qa=void 0;a.nc=void 0},243354:a=>
454
+ {window.miniaudio.untrack_device_by_index(a)},243404:a=>{a=window.miniaudio.get_device_by_index(a);a.Qa.resume();a.state=window.miniaudio.device_state.started},243543:a=>{a=window.miniaudio.get_device_by_index(a);a.Qa.suspend();a.state=window.miniaudio.device_state.stopped}},lc,Hd,kc,Dd,Ed,Fd,Id,Jd,Kd,Ld,Ma,Rc,Nd={s:function(a,b,c){Ya=c;try{var d=Lb(a);switch(b){case 0:var e=Za();if(0>e)break;for(;Ab[e];)e++;return Nb(d,e).cb;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=Za(),d.flags|=
455
455
  e,0;case 12:return e=Za(),Ca[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof bc||"ErrnoError"!==f.name)throw f;return-f.bb}},L:function(a,b,c){Ya=c;try{var d=Lb(a);switch(b){case 21509:return d.Ca?0:-59;case 21505:if(!d.Ca)return-59;if(d.Ca.ab.Wc){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=Za();B[e>>2]=25856;B[e+4>>2]=5;B[e+8>>2]=191;B[e+12>>2]=35387;for(var f=0;32>f;f++)v[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.Ca?
456
456
  0:-59;case 21506:case 21507:case 21508:if(!d.Ca)return-59;if(d.Ca.ab.Xc)for(e=Za(),a=[],f=0;32>f;f++)a.push(v[e+f+17]);return 0;case 21519:if(!d.Ca)return-59;e=Za();return B[e>>2]=0;case 21520:return d.Ca?-28:-59;case 21537:case 21531:e=Za();if(!d.xa.Vc)throw new M(59);return d.xa.Vc(d,b,e);case 21523:if(!d.Ca)return-59;d.Ca.ab.Yc&&(f=[24,80],e=Za(),Ca[e>>1]=f[0],Ca[e+2>>1]=f[1]);return 0;case 21524:return d.Ca?0:-59;case 21515:return d.Ca?0:-59;default:return-28}}catch(g){if("undefined"==typeof bc||
457
457
  "ErrnoError"!==g.name)throw g;return-g.bb}},M:function(a,b,c,d){Ya=d;try{b=b?ib(A,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":Lb(a).path;if(0==e.length)throw new M(44);b=f+"/"+e}var g=d?Za():0;return Zb(b,c,g).cb}catch(h){if("undefined"==typeof bc||"ErrnoError"!==h.name)throw h;return-h.bb}},P:()=>Na(""),o:(a,b,c)=>{a=T(a);b=nc(b,"wrapper");c=Q(c);var d=b.wa,e=d.Sa,f=d.Ia.Sa,g=d.Ia.constructor;a=cc(a,function(...h){for(var m of d.Ia.oc)if(this[m]===f[m])throw new gc(`Pure virtual function ${m} must be implemented in JavaScript`);
@@ -471,13 +471,13 @@ $c(a);e=Y(d,e);Ec(a,function(){Tc(`Cannot call ${a} due to unbound types`,g)},b-
471
471
  U(a,{name:c,Aa:d,Ma:d},{Uc:!0})},U:(a,b)=>{b=T(b);U(a,{name:b,Aa(c){var d=(d=c+4)?ib(A,d,J[c>>2],!0):"";lc(c);return d},Ea(c,d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));var e="string"==typeof d;if(!(e||ArrayBuffer.isView(d)&&1==d.BYTES_PER_ELEMENT))throw new P("Cannot pass non-string to std::string");var f=e?kb(d):d.length;var g=Hd(4+f+1),h=g+4;J[g>>2]=f;e?lb(d,A,h,f+1):A.set(d,h);null!==c&&c.push(lc,g);return g},Ma:tc,La(c){lc(c)}})},p:(a,b,c)=>{c=T(c);if(2===b){var d=gd;var e=hd;var f=jd}else d=
472
472
  kd,e=ld,f=md;U(a,{name:c,Aa:g=>{var h=d(g+4,J[g>>2]*b,!0);lc(g);return h},Ea:(g,h)=>{if("string"!=typeof h)throw new P(`Cannot pass non-string to C++ string type ${c}`);var m=f(h),l=Hd(4+m+b);J[l>>2]=m/b;e(h,l+4,m+b);null!==g&&g.push(lc,l);return l},Ma:tc,La(g){lc(g)}})},aa:(a,b,c,d,e,f)=>{rc[a]={name:T(b),Qb:Y(c,d),Va:Y(e,f),dc:[]}},$:(a,b,c,d,e,f,g,h,m,l)=>{rc[a].dc.push({Nc:T(b),Tc:c,Rc:Y(d,e),Sc:f,kd:g,jd:Y(h,m),ld:l})},W:(a,b)=>{b=T(b);U(a,{$c:!0,name:b,Aa:()=>{},Ea:()=>{}})},A:()=>{Xa=!1;nd=
473
473
  0},y:()=>{throw Infinity;},f:(a,b,c)=>{var [d,...e]=qd(a,b),f=d.Ea.bind(d),g=e.map(m=>m.Ma.bind(m));a--;var h=Array(a);b=`methodCaller<(${e.map(m=>m.name)}) => ${d.name}>`;return pd(cc(b,(m,l,u,y)=>{for(var t=0,w=0;w<a;++w)h[w]=g[w](y+t),t+=8;switch(c){case 0:var x=Q(m).apply(null,h);break;case 2:x=Reflect.construct(Q(m),h);break;case 3:x=h[0];break;case 1:x=Q(m)[sd(l)](...h)}m=[];x=f(m,x);m.length&&(J[u>>2]=fc(m));return x}))},ca:bd,X:a=>{a=sd(a);return fc(k[a])},Y:(a,b)=>{a=Q(a);b=Q(b);return fc(a[b])},
474
- v:a=>{9<a&&(ec[a+1]+=1)},e:(a,b,c,d,e)=>od[a](b,c,d,e),Z:()=>fc([]),ba:a=>fc(sd(a)),da:()=>fc({}),w:a=>{var b=Q(a);sc(b);bd(a)},g:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},F:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);B[b>>2]=a.getUTCSeconds();B[b+4>>2]=a.getUTCMinutes();B[b+8>>2]=a.getUTCHours();B[b+12>>2]=a.getUTCDate();B[b+16>>2]=a.getUTCMonth();B[b+20>>2]=a.getUTCFullYear()-1900;B[b+24>>2]=a.getUTCDay();B[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),
475
- 0,1,0,0,0,0))/864E5|0},G:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);B[b>>2]=a.getSeconds();B[b+4>>2]=a.getMinutes();B[b+8>>2]=a.getHours();B[b+12>>2]=a.getDate();B[b+16>>2]=a.getMonth();B[b+20>>2]=a.getFullYear()-1900;B[b+24>>2]=a.getDay();var c=a.getFullYear();B[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?ud:td)[a.getMonth()]+a.getDate()-1|0;B[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
476
- 0,1)).getTimezoneOffset();B[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},B:(a,b)=>{vd[a]&&(clearTimeout(vd[a].id),delete vd[a]);if(!b)return 0;var c=setTimeout(()=>{delete vd[a];yd(()=>Id(a,performance.now()))},b);vd[a]={id:c,Kd:b};return 0},H:(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);B[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,
477
- "0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(lb(a,A,c,17),lb(b,A,d,17)):(lb(a,A,d,17),lb(b,A,c,17))},O:function(a,b,c){if(!(0<=a&&3>=a))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},j:(a,b,c)=>{zd.length=0;for(var d;d=A[b++];){var e=105!=d;e&=112!=d;c+=e&&c%8?4:0;zd.push(112==d?J[c>>2]:106==d?Ia[c>>3]:105==d?B[c>>2]:Ha[c>>3]);c+=e?8:4}return Gd[a](...zd)},N:()=>Date.now(),Q:()=>performance.now(),E:a=>{var b=A.length;a>>>=0;if(2147483648<a)return!1;
478
- 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))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},C:(a,b)=>{var c=0,d=0,e;for(e of Cd()){var f=b+c;J[a+d>>2]=f;c+=lb(e,A,f,Infinity)+1;d+=4}return 0},D:(a,b)=>{var c=Cd();J[a>>2]=c.length;a=0;for(var d of c)a+=kb(d)+1;J[b>>2]=a;return 0},r:function(a){try{var b=Lb(a);if(null===b.cb)throw new M(8);b.Mb&&(b.Mb=
474
+ v:a=>{9<a&&(ec[a+1]+=1)},e:(a,b,c,d,e)=>od[a](b,c,d,e),Z:()=>fc([]),ba:a=>fc(sd(a)),da:()=>fc({}),w:a=>{var b=Q(a);sc(b);bd(a)},g:(a,b,c)=>{a=Q(a);b=Q(b);c=Q(c);a[b]=c},D:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);B[b>>2]=a.getUTCSeconds();B[b+4>>2]=a.getUTCMinutes();B[b+8>>2]=a.getUTCHours();B[b+12>>2]=a.getUTCDate();B[b+16>>2]=a.getUTCMonth();B[b+20>>2]=a.getUTCFullYear()-1900;B[b+24>>2]=a.getUTCDay();B[b+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),
475
+ 0,1,0,0,0,0))/864E5|0},E:function(a,b){a=-9007199254740992>a||9007199254740992<a?NaN:Number(a);a=new Date(1E3*a);B[b>>2]=a.getSeconds();B[b+4>>2]=a.getMinutes();B[b+8>>2]=a.getHours();B[b+12>>2]=a.getDate();B[b+16>>2]=a.getMonth();B[b+20>>2]=a.getFullYear()-1900;B[b+24>>2]=a.getDay();var c=a.getFullYear();B[b+28>>2]=(0!==c%4||0===c%100&&0!==c%400?ud:td)[a.getMonth()]+a.getDate()-1|0;B[b+36>>2]=-(60*a.getTimezoneOffset());c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),
476
+ 0,1)).getTimezoneOffset();B[b+32>>2]=(c!=d&&a.getTimezoneOffset()==Math.min(d,c))|0},B:(a,b)=>{vd[a]&&(clearTimeout(vd[a].id),delete vd[a]);if(!b)return 0;var c=setTimeout(()=>{delete vd[a];yd(()=>Id(a,performance.now()))},b);vd[a]={id:c,Kd:b};return 0},F:(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);B[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,
477
+ "0")}${String(h%60).padStart(2,"0")}`};a=b(f);b=b(e);e<f?(lb(a,A,c,17),lb(b,A,d,17)):(lb(a,A,d,17),lb(b,A,c,17))},O:function(a,b,c){if(!(0<=a&&3>=a))return 28;Ia[c>>3]=BigInt(Math.round(1E6*(0===a?Date.now():performance.now())));return 0},j:(a,b,c)=>{zd.length=0;for(var d;d=A[b++];){var e=105!=d;e&=112!=d;c+=e&&c%8?4:0;zd.push(112==d?J[c>>2]:106==d?Ia[c>>3]:105==d?B[c>>2]:Ha[c>>3]);c+=e?8:4}return Gd[a](...zd)},N:()=>Date.now(),Q:()=>performance.now(),C:a=>{var b=A.length;a>>>=0;if(2147483648<a)return!1;
478
+ 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))-Ma.buffer.byteLength+65535)/65536|0;try{Ma.grow(d);La();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},H:(a,b)=>{var c=0,d=0,e;for(e of Cd()){var f=b+c;J[a+d>>2]=f;c+=lb(e,A,f,Infinity)+1;d+=4}return 0},I:(a,b)=>{var c=Cd();J[a>>2]=c.length;a=0;for(var d of c)a+=kb(d)+1;J[b>>2]=a;return 0},r:function(a){try{var b=Lb(a);if(null===b.cb)throw new M(8);b.Mb&&(b.Mb=
479
479
  null);try{b.xa.close&&b.xa.close(b)}catch(c){throw c;}finally{Ab[b.cb]=null}b.cb=null;return 0}catch(c){if("undefined"==typeof bc||"ErrnoError"!==c.name)throw c;return c.bb}},K:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],m=J[a+4>>2];a+=8;var l=e,u=h,y=m,t=f,w=v;if(0>y||0>t)throw new M(28);if(null===l.cb)throw new M(8);if(1===(l.flags&2097155))throw new M(8);if(16384===(l.node.mode&61440))throw new M(31);if(!l.xa.read)throw new M(28);var x="undefined"!=typeof t;
480
- if(!x)t=l.position;else if(!l.seekable)throw new M(70);var p=l.xa.read(l,w,u,y,t);x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},I:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=Lb(a);$b(e,b,c);Ia[d>>3]=BigInt(e.position);e.Mb&&0===b&&0===c&&(e.Mb=null);return 0}catch(f){if("undefined"==
480
+ if(!x)t=l.position;else if(!l.seekable)throw new M(70);var p=l.xa.read(l,w,u,y,t);x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},G:function(a,b,c,d){b=-9007199254740992>b||9007199254740992<b?NaN:Number(b);try{if(isNaN(b))return 61;var e=Lb(a);$b(e,b,c);Ia[d>>3]=BigInt(e.position);e.Mb&&0===b&&0===c&&(e.Mb=null);return 0}catch(f){if("undefined"==
481
481
  typeof bc||"ErrnoError"!==f.name)throw f;return f.bb}},J:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=J[a>>2],m=J[a+4>>2];a+=8;var l=e,u=h,y=m,t=f,w=v;if(0>y||0>t)throw new M(28);if(null===l.cb)throw new M(8);if(0===(l.flags&2097155))throw new M(8);if(16384===(l.node.mode&61440))throw new M(31);if(!l.xa.write)throw new M(28);l.seekable&&l.flags&1024&&$b(l,0,2);var x="undefined"!=typeof t;if(!x)t=l.position;else if(!l.seekable)throw new M(70);var p=l.xa.write(l,w,u,y,t,void 0);
482
482
  x||(l.position+=p);var H=p;if(0>H){var F=-1;break a}b+=H;if(H<m)break;"undefined"!=typeof f&&(f+=H)}F=b}J[d>>2]=F;return 0}catch(q){if("undefined"==typeof bc||"ErrnoError"!==q.name)throw q;return q.bb}},x:Md,R:function(){return-1<navigator.platform.indexOf("Win")},z:xd,S:function(a,b,c){b=new Uint8Array(Ma.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,
483
483
  d.width,d.height);var f=e.data.length,g=k.Cc(f);k.pd.set(e.data,g);k.rd(a,d.width,d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=k.Gd(d)+1,f=k.Cc(e);k.Jd(d,f,e);k.sd(a,f);k.qd(f)})}};function Md(a,b,c){var d=Ld();try{Rc.get(a)(b,c)}catch(e){Kd(d);if(e!==e+0)throw e;Jd(1,0)}}var Od;
@@ -493,7 +493,7 @@ if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.preRun]);k.preRun.leng
493
493
  /* 5 */
494
494
  /***/ ((module) => {
495
495
 
496
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.40.1","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
496
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.41.0","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts","runtimeLoader.d.ts","utils","semantics"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}');
497
497
 
498
498
  /***/ }),
499
499
  /* 6 */
@@ -3618,6 +3618,12 @@ var Layout = /** @class */ (function () {
3618
3618
 
3619
3619
  // #endregion
3620
3620
  // #region state machines
3621
+ /**
3622
+ * @deprecated State machine inputs are deprecated and will be removed in a
3623
+ * future major version: please use data binding properties instead. See
3624
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
3625
+ * for how to migrate.
3626
+ */
3621
3627
  var StateMachineInputType;
3622
3628
  (function (StateMachineInputType) {
3623
3629
  StateMachineInputType[StateMachineInputType["Number"] = 56] = "Number";
@@ -3626,6 +3632,10 @@ var StateMachineInputType;
3626
3632
  })(StateMachineInputType || (StateMachineInputType = {}));
3627
3633
  /**
3628
3634
  * An input for a state machine
3635
+ * @deprecated State machine inputs are deprecated and will be removed in a
3636
+ * future major version: please use data binding properties instead. See
3637
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
3638
+ * for how to migrate.
3629
3639
  */
3630
3640
  var StateMachineInput = /** @class */ (function () {
3631
3641
  function StateMachineInput(type, runtimeInput) {
@@ -3675,6 +3685,11 @@ var StateMachineInput = /** @class */ (function () {
3675
3685
  return StateMachineInput;
3676
3686
  }());
3677
3687
 
3688
+ /**
3689
+ * @deprecated Rive Events are deprecated and will be removed in a future major
3690
+ * version: please use data binding instead. See
3691
+ * {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
3692
+ */
3678
3693
  var RiveEventType;
3679
3694
  (function (RiveEventType) {
3680
3695
  RiveEventType[RiveEventType["General"] = 128] = "General";
@@ -4217,6 +4232,12 @@ var Animator = /** @class */ (function () {
4217
4232
  var instancedName;
4218
4233
  if (this.animations.length === 0 && this.stateMachines.length === 0) {
4219
4234
  if (this.artboard.animationCount() > 0) {
4235
+ // Warn only when the v3 default would actually change what plays
4236
+ if (this.artboard.stateMachineCount() > 0) {
4237
+ warnOnce("No `stateMachine` was specified, so the artboard's first linear animation is playing by default. " +
4238
+ "In the next major version, the artboard's state machine will be played by default instead when one exists. " +
4239
+ "Pass the `stateMachine` parameter to adopt that behavior now.");
4240
+ }
4220
4241
  // Add the first animation
4221
4242
  this.add([(instancedName = this.artboard.animationByIndex(0).name)], playing, fireEvent);
4222
4243
  }
@@ -4295,15 +4316,84 @@ var EventType;
4295
4316
  EventType["Play"] = "play";
4296
4317
  EventType["Pause"] = "pause";
4297
4318
  EventType["Stop"] = "stop";
4319
+ /**
4320
+ * @deprecated Loop events are deprecated and will be removed in a future
4321
+ * major version: they are only reported for linear animation playback, which
4322
+ * is deprecated. Use a state machine to control playback and data binding to
4323
+ * react to changes instead. See
4324
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
4325
+ * to migrate.
4326
+ */
4298
4327
  EventType["Loop"] = "loop";
4299
4328
  EventType["Draw"] = "draw";
4300
4329
  EventType["Advance"] = "advance";
4330
+ /**
4331
+ * @deprecated State change events are deprecated and will be removed in a
4332
+ * future major version. Use data binding (view model property observers) or
4333
+ * state machine actions to react to changes from your graphic instead. See
4334
+ * {@link https://rive.app/docs/editor/state-machine/states#actions} for more details.
4335
+ */
4301
4336
  EventType["StateChange"] = "statechange";
4337
+ /**
4338
+ * @deprecated Rive Events are deprecated and will be removed in a future
4339
+ * major version: please use data binding instead. See
4340
+ * {@link https://rive.app/docs/runtimes/web/rive-events} for how to migrate.
4341
+ */
4302
4342
  EventType["RiveEvent"] = "riveevent";
4303
4343
  EventType["AudioStatusChange"] = "audiostatuschange";
4304
4344
  })(EventType || (EventType = {}));
4345
+ var riveEventsDeprecationWarning = "Rive Events are deprecated and will be removed in a future major version: " +
4346
+ "please use data binding instead. See " +
4347
+ "https://rive.app/docs/runtimes/web/rive-events for how to migrate.";
4348
+ var stateMachineInputsDeprecationWarning = "State machine inputs are deprecated and will be removed in a future major version: " +
4349
+ "please use data binding properties instead. See " +
4350
+ "https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs for how to migrate.";
4351
+ var textRunsDeprecationWarning = "Text run APIs are deprecated and will be removed in a future major version: " +
4352
+ "please use data binding instead. See " +
4353
+ "https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime for how to migrate.";
4354
+ var loopEventsDeprecationWarning = "Loop events are deprecated and will be removed in a future major version: " +
4355
+ "they are only reported for linear animation playback, which is deprecated. " +
4356
+ "Use a state machine to control playback and data binding to react to changes instead. See " +
4357
+ "https://rive.app/docs/editor/data-binding/migration-guide for how to migrate.";
4358
+ var stateChangeEventsDeprecationWarning = "State change events are deprecated and will be removed in a future major version: " +
4359
+ "use data binding (view model property observers) or state machine actions to react to " +
4360
+ "changes from your graphic instead. See " +
4361
+ "https://rive.app/docs/editor/state-machine/states#actions for how to migrate.";
4362
+ // Deprecation warnings already emitted; each is logged at most once per page
4363
+ // session to avoid flooding the console when many instances are created.
4364
+ var emittedWarnings = new Set();
4365
+ var warnOnce = function (message) {
4366
+ if (!emittedWarnings.has(message)) {
4367
+ emittedWarnings.add(message);
4368
+ console.warn("[Rive] ".concat(message));
4369
+ }
4370
+ };
4371
+ /**
4372
+ * Warns that a playback-control method received an array of names; the next
4373
+ * major version restricts these parameters to a single string, since playing
4374
+ * multiple animations or state machines at once will not be supported.
4375
+ */
4376
+ var warnIfNamesArray = function (names, methodName) {
4377
+ if (Array.isArray(names)) {
4378
+ 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."));
4379
+ }
4380
+ };
4381
+ /**
4382
+ * Warns that a playback-control method received linear animation names;
4383
+ * name-based control remains supported for state machines only, so
4384
+ * user-specified linear animation names are going away in a future major
4385
+ * version.
4386
+ */
4387
+ var warnDeprecatedAnimationNames = function (methodName) {
4388
+ warnOnce("Passing linear animation names to `".concat(methodName, "()` is deprecated and will be removed in a future major version: ") +
4389
+ "Pass a single state machine name to control playback instead.");
4390
+ };
4305
4391
  /**
4306
4392
  * Looping types: one-shot, loop, and ping-pong
4393
+ * @deprecated Loop events are deprecated and will be removed in a future major
4394
+ * version: they are only reported for linear animation playback, which is
4395
+ * deprecated. Use a state machine to control playback and data binding to
4396
+ * react to changes instead.
4307
4397
  */
4308
4398
  var LoopType;
4309
4399
  (function (LoopType) {
@@ -4617,6 +4707,31 @@ var observers = new ObjectObservers();
4617
4707
  // #endregion
4618
4708
  // #region Rive
4619
4709
  var nextRiveInstanceId = 0;
4710
+ /**
4711
+ * Resolves which animation/state machine names playback should start with.
4712
+ * The `stateMachine` parameter takes priority; the deprecated plural
4713
+ * `animations`/`stateMachines` parameters apply only when it
4714
+ * is not provided.
4715
+ */
4716
+ var resolveStartingPlayback = function (_a) {
4717
+ var stateMachine = _a.stateMachine, animations = _a.animations, stateMachines = _a.stateMachines;
4718
+ if (animations !== undefined) {
4719
+ 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.");
4720
+ }
4721
+ if (stateMachines !== undefined) {
4722
+ warnOnce("The `stateMachines` parameter is deprecated: please use `stateMachine` with a single state machine name instead.");
4723
+ }
4724
+ if (stateMachine) {
4725
+ return {
4726
+ startingAnimationNames: [],
4727
+ startingStateMachineNames: [stateMachine],
4728
+ };
4729
+ }
4730
+ return {
4731
+ startingAnimationNames: mapToStringArray(animations),
4732
+ startingStateMachineNames: mapToStringArray(stateMachines),
4733
+ };
4734
+ };
4620
4735
  var RiveFile = /** @class */ (function () {
4621
4736
  function RiveFile(params) {
4622
4737
  // Allow the runtime to automatically load assets hosted in Rive's runtime.
@@ -5038,6 +5153,10 @@ var Rive = /** @class */ (function () {
5038
5153
  this.layout = (_a = params.layout) !== null && _a !== void 0 ? _a : new Layout();
5039
5154
  this.shouldDisableRiveListeners = !!params.shouldDisableRiveListeners;
5040
5155
  this.isTouchScrollEnabled = !!params.isTouchScrollEnabled;
5156
+ if (params.automaticallyHandleEvents) {
5157
+ warnOnce("The `automaticallyHandleEvents` parameter is deprecated. " +
5158
+ riveEventsDeprecationWarning);
5159
+ }
5041
5160
  this.automaticallyHandleEvents = !!params.automaticallyHandleEvents;
5042
5161
  this.dispatchPointerExit =
5043
5162
  params.dispatchPointerExit === false
@@ -5102,6 +5221,7 @@ var Rive = /** @class */ (function () {
5102
5221
  riveFile: this.riveFile,
5103
5222
  autoplay: params.autoplay,
5104
5223
  autoBind: params.autoBind,
5224
+ stateMachine: params.stateMachine,
5105
5225
  animations: params.animations,
5106
5226
  stateMachines: params.stateMachines,
5107
5227
  artboard: params.artboard,
@@ -5168,7 +5288,7 @@ var Rive = /** @class */ (function () {
5168
5288
  // Initializes the Rive object either from constructor or load()
5169
5289
  Rive.prototype.init = function (_a) {
5170
5290
  var _this = this;
5171
- 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;
5291
+ 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;
5172
5292
  if (this.destroyed) {
5173
5293
  return;
5174
5294
  }
@@ -5182,10 +5302,12 @@ var Rive = /** @class */ (function () {
5182
5302
  if (!this.src && !this.buffer && !this.riveFile) {
5183
5303
  throw new RiveError(Rive.missingErrorMessage);
5184
5304
  }
5185
- // List of animations that should be initialized.
5186
- var startingAnimationNames = mapToStringArray(animations);
5187
- // List of state machines that should be initialized
5188
- var startingStateMachineNames = mapToStringArray(stateMachines);
5305
+ // Names of the animations and state machines that should be initialized
5306
+ var _e = resolveStartingPlayback({
5307
+ stateMachine: stateMachine,
5308
+ animations: animations,
5309
+ stateMachines: stateMachines,
5310
+ }), startingAnimationNames = _e.startingAnimationNames, startingStateMachineNames = _e.startingStateMachineNames;
5189
5311
  // Ensure loaded is marked as false if loading new file
5190
5312
  this.loaded = false;
5191
5313
  this.readyForPlaying = false;
@@ -5902,6 +6024,7 @@ var Rive = /** @class */ (function () {
5902
6024
  * might happen.
5903
6025
  */
5904
6026
  Rive.prototype.cleanupInstances = function () {
6027
+ var _a;
5905
6028
  if (this.eventCleanup !== null) {
5906
6029
  this.eventCleanup();
5907
6030
  }
@@ -5909,8 +6032,9 @@ var Rive = /** @class */ (function () {
5909
6032
  // Tear down semantics before deleting state machines — the overlay's action
5910
6033
  // closures point at instances that stop() is about to free.
5911
6034
  this.cleanupSemantics();
5912
- // Delete all animation and state machine instances
5913
- this.stop();
6035
+ // Delete all animation and state machine instances synchronously via the
6036
+ // animator
6037
+ (_a = this.animator) === null || _a === void 0 ? void 0 : _a.stop();
5914
6038
  if (this.artboard) {
5915
6039
  this.artboard.delete();
5916
6040
  this.artboard = null;
@@ -5943,29 +6067,58 @@ var Rive = /** @class */ (function () {
5943
6067
  * Returns a string from a given text run node name, or undefined if the text run
5944
6068
  * cannot be queried.
5945
6069
  *
6070
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6071
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6072
+ * for how to migrate.
5946
6073
  * @param textRunName - Name of the text run node associated with a text object
5947
6074
  * @returns - String value of the text run node or undefined
5948
6075
  */
5949
6076
  Rive.prototype.getTextRunValue = function (textRunName) {
6077
+ warnOnce(textRunsDeprecationWarning);
5950
6078
  var textRun = this.retrieveTextRun(textRunName);
5951
6079
  return textRun ? textRun.text : undefined;
5952
6080
  };
5953
6081
  /**
5954
6082
  * Sets a text value for a given text run node name if possible
5955
6083
  *
6084
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6085
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6086
+ * for how to migrate.
5956
6087
  * @param textRunName - Name of the text run node associated with a text object
5957
6088
  * @param textRunValue - String value to set on the text run node
5958
6089
  */
5959
6090
  Rive.prototype.setTextRunValue = function (textRunName, textRunValue) {
6091
+ warnOnce(textRunsDeprecationWarning);
5960
6092
  var textRun = this.retrieveTextRun(textRunName);
5961
6093
  if (textRun) {
5962
6094
  textRun.text = textRunValue;
5963
6095
  }
5964
6096
  };
5965
- // Plays specified animations; if none specified, it unpauses everything.
6097
+ /**
6098
+ * Warns when playback-control names match linear animations in the
6099
+ * Animator's instanced context; state machine playback remain supported.
6100
+ *
6101
+ * Remove for v3 release
6102
+ */
6103
+ Rive.prototype.warnIfLinearAnimationNames = function (names, methodName) {
6104
+ if (this.animator &&
6105
+ this.animator.animations.some(function (a) { return names.includes(a.name); })) {
6106
+ warnDeprecatedAnimationNames(methodName);
6107
+ }
6108
+ };
6109
+ /**
6110
+ * Plays specified animations or state machines; if none specified, it
6111
+ * unpauses everything.
6112
+ * @param animationNames Animation or state machine name(s) to play.
6113
+ *
6114
+ * Deprecated usage: passing linear animation names (control playback with a
6115
+ * state machine instead) and passing an array of names (this parameter
6116
+ * becomes a single string in the next major version).
6117
+ */
5966
6118
  Rive.prototype.play = function (animationNames, autoplay) {
5967
6119
  var _this = this;
5968
- animationNames = mapToStringArray(animationNames);
6120
+ warnIfNamesArray(animationNames, "play");
6121
+ var names = mapToStringArray(animationNames);
5969
6122
  // If the file's not loaded, queue up the play
5970
6123
  if (!this.readyForPlaying) {
5971
6124
  this.taskQueue.add({
@@ -5973,7 +6126,8 @@ var Rive = /** @class */ (function () {
5973
6126
  });
5974
6127
  return;
5975
6128
  }
5976
- this.animator.play(animationNames);
6129
+ this.animator.play(names);
6130
+ this.warnIfLinearAnimationNames(names, "play");
5977
6131
  this.syncSemanticsOnStateMachines();
5978
6132
  if (this.eventCleanup) {
5979
6133
  this.eventCleanup();
@@ -5982,10 +6136,19 @@ var Rive = /** @class */ (function () {
5982
6136
  this.setupRiveListeners();
5983
6137
  this.startRendering();
5984
6138
  };
5985
- // Pauses specified animations; if none specified, pauses all.
6139
+ /**
6140
+ * Pauses specified animations or state machines; if none specified, pauses
6141
+ * all.
6142
+ * @param animationNames Animation or state machine name(s) to pause.
6143
+ *
6144
+ * Deprecated usage: passing linear animation names (control playback with a
6145
+ * state machine instead) and passing an array of names (this parameter
6146
+ * becomes a single string in the next major version).
6147
+ */
5986
6148
  Rive.prototype.pause = function (animationNames) {
5987
6149
  var _this = this;
5988
- animationNames = mapToStringArray(animationNames);
6150
+ warnIfNamesArray(animationNames, "pause");
6151
+ var names = mapToStringArray(animationNames);
5989
6152
  // If the file's not loaded, early out, nothing to pause
5990
6153
  if (!this.readyForPlaying) {
5991
6154
  this.taskQueue.add({
@@ -5997,11 +6160,20 @@ var Rive = /** @class */ (function () {
5997
6160
  this.eventCleanup();
5998
6161
  }
5999
6162
  this.cleanupKeyboardInteractions();
6000
- this.animator.pause(animationNames);
6163
+ this.animator.pause(names);
6164
+ this.warnIfLinearAnimationNames(names, "pause");
6001
6165
  };
6166
+ /**
6167
+ * Scrubs specified animations to the given time; if none specified, scrubs
6168
+ * all of them.
6169
+ * @deprecated `scrub()` will be removed in a future major version: use a
6170
+ * state machine to control playback instead
6171
+ */
6002
6172
  Rive.prototype.scrub = function (animationNames, value) {
6003
6173
  var _this = this;
6004
- animationNames = mapToStringArray(animationNames);
6174
+ warnOnce("`scrub()` is deprecated and will be removed in a future major version: " +
6175
+ "use a state machine to control playback instead.");
6176
+ var names = mapToStringArray(animationNames);
6005
6177
  // If the file's not loaded, early out, nothing to pause
6006
6178
  if (!this.readyForPlaying) {
6007
6179
  this.taskQueue.add({
@@ -6011,13 +6183,22 @@ var Rive = /** @class */ (function () {
6011
6183
  }
6012
6184
  // Scrub the animation time; we draw a single frame here so that if
6013
6185
  // nothing's currently playing, the scrubbed animation is still rendered/
6014
- this.animator.scrub(animationNames, value || 0);
6186
+ this.animator.scrub(names, value || 0);
6015
6187
  this.drawFrame();
6016
6188
  };
6017
- // Stops specified animations; if none specifies, stops them all.
6189
+ /**
6190
+ * Stops specified animations or state machines; if none specified, stops
6191
+ * them all.
6192
+ * @param animationNames Animation or state machine name(s) to stop.
6193
+ *
6194
+ * Deprecated usage: passing linear animation names (control playback with a
6195
+ * state machine instead) and passing an array of names (this parameter
6196
+ * becomes a single string in the next major version).
6197
+ */
6018
6198
  Rive.prototype.stop = function (animationNames) {
6019
6199
  var _this = this;
6020
- animationNames = mapToStringArray(animationNames);
6200
+ warnIfNamesArray(animationNames, "stop");
6201
+ var names = mapToStringArray(animationNames);
6021
6202
  // If the file's not loaded, early out, nothing to pause
6022
6203
  if (!this.readyForPlaying) {
6023
6204
  this.taskQueue.add({
@@ -6025,9 +6206,10 @@ var Rive = /** @class */ (function () {
6025
6206
  });
6026
6207
  return;
6027
6208
  }
6209
+ this.warnIfLinearAnimationNames(names, "stop");
6028
6210
  // If there is no artboard, this.animator will be undefined
6029
6211
  if (this.animator) {
6030
- this.animator.stop(animationNames);
6212
+ this.animator.stop(names);
6031
6213
  }
6032
6214
  if (this.eventCleanup) {
6033
6215
  this.eventCleanup();
@@ -6038,8 +6220,7 @@ var Rive = /** @class */ (function () {
6038
6220
  /**
6039
6221
  * Resets the animation
6040
6222
  * @param artboard the name of the artboard, or default if none given
6041
- * @param animations the names of animations for playback
6042
- * @param stateMachines the names of state machines for playback
6223
+ * @param stateMachine the name of the state machine for playback
6043
6224
  * @param autoplay whether to autoplay when reset, defaults to false
6044
6225
  *
6045
6226
  */
@@ -6047,15 +6228,22 @@ var Rive = /** @class */ (function () {
6047
6228
  var _a, _b;
6048
6229
  // Get the current artboard, animations, state machines, and playback states
6049
6230
  var artBoardName = params === null || params === void 0 ? void 0 : params.artboard;
6050
- var animationNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.animations);
6051
- var stateMachineNames = mapToStringArray(params === null || params === void 0 ? void 0 : params.stateMachines);
6231
+ var _c = resolveStartingPlayback({
6232
+ stateMachine: params === null || params === void 0 ? void 0 : params.stateMachine,
6233
+ animations: params === null || params === void 0 ? void 0 : params.animations,
6234
+ stateMachines: params === null || params === void 0 ? void 0 : params.stateMachines,
6235
+ }), animationNames = _c.startingAnimationNames, stateMachineNames = _c.startingStateMachineNames;
6052
6236
  var autoplay = (_a = params === null || params === void 0 ? void 0 : params.autoplay) !== null && _a !== void 0 ? _a : false;
6053
6237
  var autoBind = (_b = params === null || params === void 0 ? void 0 : params.autoBind) !== null && _b !== void 0 ? _b : false;
6054
6238
  // Stop everything and clean up
6055
6239
  this.cleanupInstances();
6056
6240
  // Reinitialize an artboard instance with the state
6057
6241
  this.initArtboard(artBoardName, animationNames, stateMachineNames, autoplay, autoBind);
6058
- this.taskQueue.process();
6242
+ // Only drain the task queue once playback commands can execute; tasks
6243
+ // queued before then re-add themselves in a loop.
6244
+ if (this.readyForPlaying) {
6245
+ this.taskQueue.process();
6246
+ }
6059
6247
  };
6060
6248
  // Loads a new Rive file, keeping listeners in place
6061
6249
  Rive.prototype.load = function (params) {
@@ -6210,11 +6398,18 @@ var Rive = /** @class */ (function () {
6210
6398
  });
6211
6399
  /**
6212
6400
  * Returns the inputs for the specified instanced state machine, or an empty
6213
- * list if the name is invalid or the state machine is not instanced
6401
+ * list if the name is invalid or the state machine is not instanced. Returns
6402
+ * undefined if the file is not loaded yet.
6403
+ *
6404
+ * @deprecated State machine inputs are deprecated: use data binding
6405
+ * properties instead. See
6406
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6407
+ * for how to migrate.
6214
6408
  * @param name the state machine name
6215
- * @returns the inputs for the named state machine
6409
+ * @returns the inputs for the named state machine or undefined
6216
6410
  */
6217
6411
  Rive.prototype.stateMachineInputs = function (name) {
6412
+ warnOnce(stateMachineInputsDeprecationWarning);
6218
6413
  // If the file's not loaded, early out, nothing to pause
6219
6414
  if (!this.loaded) {
6220
6415
  return;
@@ -6241,11 +6436,16 @@ var Rive = /** @class */ (function () {
6241
6436
  };
6242
6437
  /**
6243
6438
  * Set the boolean input with the provided name at the given path with value
6439
+ * @deprecated State machine inputs are deprecated: use data binding
6440
+ * properties instead. See
6441
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6442
+ * for how to migrate.
6244
6443
  * @param input the state machine input name
6245
6444
  * @param value the value to set the input to
6246
6445
  * @param path the path the input is located at an artboard level
6247
6446
  */
6248
6447
  Rive.prototype.setBooleanStateAtPath = function (inputName, value, path) {
6448
+ warnOnce(stateMachineInputsDeprecationWarning);
6249
6449
  var input = this.retrieveInputAtPath(inputName, path);
6250
6450
  if (!input)
6251
6451
  return;
@@ -6258,11 +6458,16 @@ var Rive = /** @class */ (function () {
6258
6458
  };
6259
6459
  /**
6260
6460
  * Set the number input with the provided name at the given path with value
6461
+ * @deprecated State machine inputs are deprecated: use data binding
6462
+ * properties instead. See
6463
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6464
+ * for how to migrate.
6261
6465
  * @param input the state machine input name
6262
6466
  * @param value the value to set the input to
6263
6467
  * @param path the path the input is located at an artboard level
6264
6468
  */
6265
6469
  Rive.prototype.setNumberStateAtPath = function (inputName, value, path) {
6470
+ warnOnce(stateMachineInputsDeprecationWarning);
6266
6471
  var input = this.retrieveInputAtPath(inputName, path);
6267
6472
  if (!input)
6268
6473
  return;
@@ -6275,10 +6480,15 @@ var Rive = /** @class */ (function () {
6275
6480
  };
6276
6481
  /**
6277
6482
  * Fire the trigger with the provided name at the given path
6483
+ * @deprecated State machine inputs are deprecated: use data binding
6484
+ * properties instead. See
6485
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs}
6486
+ * for how to migrate.
6278
6487
  * @param input the state machine input name
6279
6488
  * @param path the path the input is located at an artboard level
6280
6489
  */
6281
6490
  Rive.prototype.fireStateAtPath = function (inputName, path) {
6491
+ warnOnce(stateMachineInputsDeprecationWarning);
6282
6492
  var input = this.retrieveInputAtPath(inputName, path);
6283
6493
  if (!input)
6284
6494
  return;
@@ -6326,8 +6536,13 @@ var Rive = /** @class */ (function () {
6326
6536
  *
6327
6537
  * @remarks
6328
6538
  * If the text run cannot be found at the specified path, a warning will be logged to the console.
6539
+ *
6540
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6541
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6542
+ * for how to migrate.
6329
6543
  */
6330
6544
  Rive.prototype.getTextRunValueAtPath = function (textName, path) {
6545
+ warnOnce(textRunsDeprecationWarning);
6331
6546
  var run = this.retrieveTextAtPath(textName, path);
6332
6547
  if (!run) {
6333
6548
  console.warn("Could not get text with name: '".concat(textName, "', at path:'").concat(path, "'"));
@@ -6352,8 +6567,13 @@ var Rive = /** @class */ (function () {
6352
6567
  *
6353
6568
  * @remarks
6354
6569
  * If the text run cannot be found at the specified path, a warning will be logged to the console.
6570
+ *
6571
+ * @deprecated Text run APIs are deprecated: use data binding instead. See
6572
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime}
6573
+ * for how to migrate.
6355
6574
  */
6356
6575
  Rive.prototype.setTextRunValueAtPath = function (textName, value, path) {
6576
+ warnOnce(textRunsDeprecationWarning);
6357
6577
  var run = this.retrieveTextAtPath(textName, path);
6358
6578
  if (!run) {
6359
6579
  console.warn("Could not set text with name: '".concat(textName, "', at path:'").concat(path, "'"));
@@ -6462,10 +6682,26 @@ var Rive = /** @class */ (function () {
6462
6682
  });
6463
6683
  /**
6464
6684
  * Subscribe to Rive-generated events
6685
+ *
6686
+ * Note: subscribing to {@link EventType.RiveEvent},
6687
+ * {@link EventType.StateChange}, or {@link EventType.Loop} is deprecated;
6688
+ * use data binding instead. See
6689
+ * {@link https://rive.app/docs/runtimes/web/rive-events} (Rive Events) and
6690
+ * {@link https://rive.app/docs/editor/data-binding/migration-guide} for how
6691
+ * to migrate Rive graphics to a data binding workflow instead.
6465
6692
  * @param type the type of event to subscribe to
6466
6693
  * @param callback callback to fire when the event occurs
6467
6694
  */
6468
6695
  Rive.prototype.on = function (type, callback) {
6696
+ if (type === EventType.RiveEvent) {
6697
+ warnOnce(riveEventsDeprecationWarning);
6698
+ }
6699
+ else if (type === EventType.StateChange) {
6700
+ warnOnce(stateChangeEventsDeprecationWarning);
6701
+ }
6702
+ else if (type === EventType.Loop) {
6703
+ warnOnce(loopEventsDeprecationWarning);
6704
+ }
6469
6705
  this.eventManager.add({
6470
6706
  type: type,
6471
6707
  callback: callback,