@rive-app/canvas 2.43.0 → 2.44.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
@@ -367,27 +367,27 @@ c?(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR),b.g
367
367
  p.sort((G,ja)=>ja.Eb-G.Eb);v=u.push(I);g!=v&&(b.bufferData(b.ARRAY_BUFFER,8*v,b.DYNAMIC_DRAW),g=v);v=0;for(var O of p)b.bufferSubData(b.ARRAY_BUFFER,v,O.ab),v+=4*O.ab.length;console.assert(v==4*I);for(var V of p)b.bufferSubData(b.ARRAY_BUFFER,v,V.Ib),v+=4*V.Ib.length;console.assert(v==8*I);v=r.push(K);h!=v&&(b.bufferData(b.ELEMENT_ARRAY_BUFFER,2*v,b.DYNAMIC_DRAW),h=v);O=0;for(var da of p)b.bufferSubData(b.ELEMENT_ARRAY_BUFFER,O,da.indices),O+=2*da.indices.length;console.assert(O==2*K);da=0;V=!0;v=
368
368
  O=0;for(const G of p){G.image.Pa!=da&&(b.bindTexture(b.TEXTURE_2D,G.image.Na||null),da=G.image.Pa);G.tc?(b.scissor(G.ib,N-G.jb-G.rb,G.Cc,G.rb),V=!0):V&&(b.scissor(0,N-y,x,y),V=!1);p=2/x;const ja=-2/y;b.uniform4f(e,G.ha[0]*p*G.Da,G.ha[1]*ja*G.Ea,G.ha[2]*p*G.Da,G.ha[3]*ja*G.Ea);b.uniform2f(f,G.ha[4]*p*G.Da+p*(G.ib-G.qc*G.Da)-1,G.ha[5]*ja*G.Ea+ja*(G.jb-G.rc*G.Ea)+1);b.vertexAttribPointer(0,2,b.FLOAT,!1,0,v);b.vertexAttribPointer(1,2,b.FLOAT,!1,0,v+4*I);b.drawElements(b.TRIANGLES,G.indices.length,b.UNSIGNED_SHORT,
369
369
  O);v+=4*G.ab.length;O+=2*G.indices.length}console.assert(v==4*I);console.assert(O==2*K)}}};this.canvas=function(){return a()&&b.canvas}},ka=k.onRuntimeInitialized;
370
- k.onRuntimeInitialized=function(){function a(m){switch(m){case n.srcOver:return"source-over";case n.screen:return"screen";case n.overlay:return"overlay";case n.darken:return"darken";case n.lighten:return"lighten";case n.colorDodge:return"color-dodge";case n.colorBurn:return"color-burn";case n.hardLight:return"hard-light";case n.softLight:return"soft-light";case n.difference:return"difference";case n.exclusion:return"exclusion";case n.multiply:return"multiply";case n.hue:return"hue";case n.saturation:return"saturation";
371
- case n.color:return"color";case n.luminosity:return"luminosity"}}function b(m){return"rgba("+((16711680&m)>>>16)+","+((65280&m)>>>8)+","+((255&m)>>>0)+","+((4278190080&m)>>>24)/255+")"}function c(){0<V.length&&(ia.Zb(O.drawWidth(),O.drawHeight(),V,da,G),V=[],G=da=0,O.reset(512,512));for(const m of v){for(const q of m.J)q();m.J=[]}v.clear()}ka&&ka();var d=k.RenderPaintStyle;const e=k.RenderPath,f=k.RenderPaint,g=k.Renderer,h=k.StrokeCap,l=k.StrokeJoin,n=k.BlendMode,t=d.fill,u=d.stroke,r=k.FillRule.evenOdd;
372
- let x=1;var y=k.RenderImage.extend("CanvasRenderImage",{__construct:function({oa:m,Ba:q}={}){this.__parent.__construct.call(this);this.Pa=x;x=x+1&2147483647||1;this.oa=m;this.Ba=q},__destruct:function(){this.Na&&(ia.Wb(this.Na),URL.revokeObjectURL(this.gb));this.__parent.__destruct.call(this)},decode:function(m){var q=this;q.Ba&&q.Ba(q);var B=new Image;q.gb=URL.createObjectURL(new Blob([m],{type:"image/png"}));B.onload=function(){q.Ob=B;q.Na=ia.Vb(B);q.size(B.width,B.height);q.oa&&q.oa(q)};B.src=
373
- q.gb}});class p{constructor(){this.Y=this.va=0;this.W=new Path2D}clear(){this.Y=this.va=0;this.W=new Path2D}Sb(m){for(0<this.va&&this.Y<m.length&&this.clear();this.Y<m.length;)m[this.Y++](this.W);this.va++;return this.W}release(m){m===this.W&&this.va--}}var I=e.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.La=[];this.W=new p;this.Ka=!1;this.la=null},rewind:function(){this.La.length=0;this.W.clear();this.Ka=!1;this.la=null},addPath:function(m,q,B,z,L,C,
374
- D){const A=m.Kb();this.ka(J=>{const M=new DOMMatrix;M.a=q;M.b=B;M.c=z;M.d=L;M.e=C;M.f=D;J.addPath(A,M)})},fillRule:function(m){this.fb=m},moveTo:function(m,q){this.Ka=!0;const B={lb:!0};this.la=B;this.ka(z=>{z.moveTo(m,q);B.lb&&z.lineTo(m,q)})},lineTo:function(m,q){this.eb();this.Ia();this.ka(B=>{B.lineTo(m,q)})},cubicTo:function(m,q,B,z,L,C){this.eb();this.Ia();this.ka(D=>{D.bezierCurveTo(m,q,B,z,L,C)})},close:function(){this.Ia();this.ka(m=>{m.closePath()})},eb:function(){this.Ka||this.moveTo(0,
375
- 0)},Ia:function(){null!==this.la&&(this.la.lb=!1,this.la=null)},ka:function(m){this.La.push(m)},Ha:function(){return this.W.Sb(this.La)},hb:function(m){this.W.release(m)},Kb:function(){const m=this.Ha();this.W.clear();return m}}),K=f.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.H=[];this.Ja=0;this.Ma=t;this.Qa=b(4278190080);this.Oa=1;this.ta="miter";this.sa="butt";this.bb=a(n.srcOver);this.ga=null},color:function(m){this.H.push(()=>{this.Qa=b(m)})},
376
- thickness:function(m){this.H.push(()=>{this.Oa=Math.abs(m)})},join:function(m){this.H.push(()=>{switch(m){case l.miter:this.ta="miter";break;case l.round:this.ta="round";break;case l.bevel:this.ta="bevel"}})},cap:function(m){this.H.push(()=>{switch(m){case h.butt:this.sa="butt";break;case h.round:this.sa="round";break;case h.square:this.sa="square"}})},style:function(m){this.H.push(()=>{this.Ma=m})},blendMode:function(m){this.H.push(()=>{this.bb=a(m)})},clearGradient:function(){this.H.push(()=>{this.ga=
377
- null})},linearGradient:function(m,q,B,z){this.H.push(()=>{this.ga={Fb:m,Gb:q,nb:B,ob:z,$a:[]}})},radialGradient:function(m,q,B,z){this.H.push(()=>{this.ga={Fb:m,Gb:q,nb:B,ob:z,$a:[],nc:!0}})},addStop:function(m,q){this.H.push(()=>{this.ga.$a.push({color:m,stop:q})})},completeGradient:function(){},Lb:function(m,q,B,z){if(this.Ma!==u||0<this.Oa){var L=this.Ma,C=this.Qa,D=this.ga,A=m.globalCompositeOperation,J=m.globalAlpha;m.globalCompositeOperation=this.bb;m.globalAlpha=z;if(null!=D){C=D.Fb;const R=
378
- D.Gb,U=D.nb;var M=D.ob;z=D.$a;D.nc?(D=U-C,M-=R,C=m.createRadialGradient(C,R,0,C,R,Math.sqrt(D*D+M*M))):C=m.createLinearGradient(C,R,U,M);for(let W=0,Ra=z.length;W<Ra;W++)D=z[W],C.addColorStop(D.stop,b(D.color));this.Qa=C;this.ga=null}switch(L){case u:m.strokeStyle=C;m.lineWidth=this.Oa;m.lineCap=this.sa;m.lineJoin=this.ta;m.stroke(q);break;case t:m.fillStyle=C,m.fill(q,B)}m.globalCompositeOperation=A;m.globalAlpha=J}},Nb:function(){return this.Ja+this.H.length},Mb:function(m){const q=m-this.Ja;for(let B=
379
- 0;B<q;B++)this.H[B]();this.H.splice(0,q);this.Ja=m}});const v=new Set,N=Object.prototype.hasOwnProperty;let O=null,V=[],da=0,G=0;var ja=k.CanvasRenderer=g.extend("Renderer",{__construct:function(m){this.__parent.__construct.call(this);this.V=[1,0,0,1,0,0];this.G=[1];this.D=m.getContext("2d");this.cb=m;this.J=[]},save:function(){this.V.push(...this.V.slice(this.V.length-6));this.G.push(this.G[this.G.length-1]);this.J.push(this.D.save.bind(this.D))},restore:function(){const m=this.V.length-6;if(6>m)throw"restore() called without matching save().";
380
- this.V.splice(m);this.G.pop();this.J.push(this.D.restore.bind(this.D))},transform:function(m,q,B,z,L,C){const D=this.V,A=D.length-6;D.splice(A,6,D[A]*m+D[A+2]*q,D[A+1]*m+D[A+3]*q,D[A]*B+D[A+2]*z,D[A+1]*B+D[A+3]*z,D[A]*L+D[A+2]*C+D[A+4],D[A+1]*L+D[A+3]*C+D[A+5]);this.J.push(this.D.transform.bind(this.D,m,q,B,z,L,C))},rotate:function(m){const q=Math.sin(m);m=Math.cos(m);this.transform(m,q,-q,m,0,0)},modulateOpacity:function(m){this.G[this.G.length-1]*=m},_drawPath:function(m,q){const B=m.fb===r?"evenodd":
381
- "nonzero",z=Math.max(0,this.G[this.G.length-1]),L=m.Ha(),C=q.Nb();this.J.push(()=>{q.Mb(C);q.Lb(this.D,L,B,z);m.hb(L)})},_drawRiveImage:function(m,q,B){var z=m.Ob;if(z){var L=this.D,C=a(q),D=Math.max(0,B*this.G[this.G.length-1]);this.J.push(function(){L.globalCompositeOperation=C;L.globalAlpha=D;L.drawImage(z,0,0);L.globalAlpha=1})}},_getMatrix:function(m){const q=this.V,B=q.length-6;for(let z=0;6>z;++z)m[z]=q[B+z]},_drawImageMesh:function(m,q,B,z,L,C,D,A,J,M,R,U,W){let Ra,Tb,Ub;try{Ra=k.HEAPF32.slice(z>>
382
- 2,(z>>2)+L),Tb=k.HEAPF32.slice(C>>2,(C>>2)+D),Ub=k.HEAPU16.slice(A>>1,(A>>1)+J)}catch(kb){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}z=this.D.canvas.width;C=this.D.canvas.height;D=U-M;A=W-R;M=Math.max(M,0);R=Math.max(R,0);U=Math.min(U,z);W=Math.min(W,C);const Ga=U-M,Ha=W-R;console.assert(Ga<=Math.min(D,z));console.assert(Ha<=Math.min(A,C));if(!(0>=Ga||0>=Ha)){U=Ga<D||Ha<A;z=W=1;var qa=Math.ceil(Ga*W),ra=Math.ceil(Ha*z);C=ia.pc();
383
- qa>C&&(W*=C/qa,qa=C);ra>C&&(z*=C/ra,ra=C);O||(O=new k.DynamicRectanizer(C),O.reset(512,512));C=O.addRect(qa,ra);0>C&&(c(),v.add(this),C=O.addRect(qa,ra),console.assert(0<=C));var Vb=C&65535,Wb=C>>16;V.push({ha:this.V.slice(this.V.length-6),image:m,ib:Vb,jb:Wb,qc:M,rc:R,Cc:qa,rb:ra,Da:W,Ea:z,ab:Ra,Ib:Tb,indices:Ub,tc:U,Eb:m.Pa<<1|(U?1:0)});da+=L;G+=J;var wa=this.D,Wc=a(q),Xc=Math.max(0,B*this.G[this.G.length-1]);this.J.push(function(){wa.save();wa.resetTransform();wa.globalCompositeOperation=Wc;wa.globalAlpha=
384
- Xc;const kb=ia.canvas();kb&&wa.drawImage(kb,Vb,Wb,qa,ra,M,R,Ga,Ha);wa.restore()})}},_clipPath:function(m){const q=m.fb===r?"evenodd":"nonzero",B=m.Ha();this.J.push(()=>{this.D.clip(B,q);m.hb(B)})},beginFrame:function(m=!0){v.add(this);m&&this.J.push(this.D.clearRect.bind(this.D,0,0,this.cb.width,this.cb.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(m,q){this.transform(1,0,0,1,m,q)}});k.makeRenderer=function(m){const q=new ja(m),B=q.D;let z=null,L=null;const C=
385
- {attachSession:function(A){if(A&&z===A)return!0;if(!A||z||"function"!==typeof k.c2dDeferredClaim||"function"!==typeof k.c2dDeferredRenderer||!k.c2dDeferredClaim(A))return!1;const J=k.c2dDeferredRenderer(A);if(!J)return!1;z=A;L=J;return!0},detachSession:function(){z&&k.c2dDeferredDetach(z);L=z=null},deferredActive:function(){return null!==L}},D={save:function(){k.c2dDeferredSave(z)},restore:function(){k.c2dDeferredRestore(z)},transform:function(A,J,M,R,U,W){k.c2dDeferredTransform(z,A,J,M,R,U,W)},translate:function(A,
386
- J){k.c2dDeferredTransform(z,1,0,0,1,A,J)},rotate:function(A){const J=Math.sin(A);A=Math.cos(A);k.c2dDeferredTransform(z,A,J,-J,A,0,0)},align:function(A,J,M,R,U){k.c2dDeferredAlign(z,A,J,M.minX,M.minY,M.maxX,M.maxY,R.minX,R.minY,R.maxX,R.maxY,void 0===U?1:U)},beginFrame:function(A=!0){q.beginFrame(A);k.c2dDeferredBeginFrame(z)},clear:function(){q.beginFrame(!0);k.c2dDeferredBeginFrame(z)},flush:function(){k.c2dDeferredReplay(z,q)}};return new Proxy(q,{get(A,J){if(N.call(C,J))return C[J];if("_deferredRecorder"===
387
- J)return L;if(null!==L&&N.call(D,J))return D[J];if("function"===typeof A[J])return function(...M){return A[J].apply(A,M)};if("function"===typeof B[J]){if(-1<ha.indexOf(J))throw Error("RiveException: Method call to '"+J+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...M){q.J.push(B[J].bind(B,...M))}}return A[J]},set(A,J,M){if(J in B)return q.J.push(()=>{B[J]=M}),!0}})};k.decodeImage=function(m,
388
- q){(new y({oa:q})).decode(m)};k.renderFactory={makeRenderPaint:function(){return new K},makeRenderPath:function(){return new I},makeRenderImage:function(){let m=lb;return new y({Ba:()=>{m.total++},oa:()=>{m.loaded++;if(m.loaded===m.total){const q=m.ready;q&&(q(),m.ready=null)}}})}};let Yc=k.load,lb=null;k.load=function(m,q,B=!0,z=null){const L=new k.FallbackFileAssetLoader;void 0!==q&&L.addLoader(q);B&&(q=new k.CDNFileAssetLoader(z),L.addLoader(q));return new Promise(function(C){let D=null;lb={total:0,
389
- loaded:0,ready:function(){C(D)}};D=Yc(m,L,z??null);0==lb.total&&C(D)})};const Zc=k.Artboard.prototype.draw;k.Artboard.prototype.draw=function(m){Zc.call(this,m._deferredRecorder||m)};let $c=k.RendererWrapper.prototype.align;k.RendererWrapper.prototype.align=function(m,q,B,z,L=1){$c.call(this,m,q,B,z,L)};d=new ca;k.requestAnimationFrame=d.requestAnimationFrame.bind(d);k.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);k.enableFPSCounter=d.$b.bind(d);k.disableFPSCounter=d.Xb;d.xb=c;k.resolveAnimationFrame=
390
- c;k.cleanup=function(){O&&O.delete()}};var la="./this.program";ba&&(_scriptName=self.location.href);var ma="",na,oa;
370
+ k.onRuntimeInitialized=function(){function a(m){switch(m){case n.srcOver:return"source-over";case n.Gc:return"plus-lighter";case n.screen:return"screen";case n.overlay:return"overlay";case n.darken:return"darken";case n.lighten:return"lighten";case n.colorDodge:return"color-dodge";case n.colorBurn:return"color-burn";case n.hardLight:return"hard-light";case n.softLight:return"soft-light";case n.difference:return"difference";case n.exclusion:return"exclusion";case n.multiply:return"multiply";case n.hue:return"hue";
371
+ case n.saturation:return"saturation";case n.color:return"color";case n.luminosity:return"luminosity"}}function b(m){return"rgba("+((16711680&m)>>>16)+","+((65280&m)>>>8)+","+((255&m)>>>0)+","+((4278190080&m)>>>24)/255+")"}function c(){0<V.length&&(ia.Zb(O.drawWidth(),O.drawHeight(),V,da,G),V=[],G=da=0,O.reset(512,512));for(const m of v){for(const q of m.J)q();m.J=[]}v.clear()}ka&&ka();var d=k.RenderPaintStyle;const e=k.RenderPath,f=k.RenderPaint,g=k.Renderer,h=k.StrokeCap,l=k.StrokeJoin,n=k.BlendMode,
372
+ t=d.fill,u=d.stroke,r=k.FillRule.evenOdd;let x=1;var y=k.RenderImage.extend("CanvasRenderImage",{__construct:function({oa:m,Ba:q}={}){this.__parent.__construct.call(this);this.Pa=x;x=x+1&2147483647||1;this.oa=m;this.Ba=q},__destruct:function(){this.Na&&(ia.Wb(this.Na),URL.revokeObjectURL(this.gb));this.__parent.__destruct.call(this)},decode:function(m){var q=this;q.Ba&&q.Ba(q);var B=new Image;q.gb=URL.createObjectURL(new Blob([m],{type:"image/png"}));B.onload=function(){q.Ob=B;q.Na=ia.Vb(B);q.size(B.width,
373
+ B.height);q.oa&&q.oa(q)};B.src=q.gb}});class p{constructor(){this.Y=this.va=0;this.W=new Path2D}clear(){this.Y=this.va=0;this.W=new Path2D}Sb(m){for(0<this.va&&this.Y<m.length&&this.clear();this.Y<m.length;)m[this.Y++](this.W);this.va++;return this.W}release(m){m===this.W&&this.va--}}var I=e.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this);this.La=[];this.W=new p;this.Ka=!1;this.la=null},rewind:function(){this.La.length=0;this.W.clear();this.Ka=!1;this.la=null},
374
+ addPath:function(m,q,B,z,L,C,D){const A=m.Kb();this.ka(J=>{const M=new DOMMatrix;M.a=q;M.b=B;M.c=z;M.d=L;M.e=C;M.f=D;J.addPath(A,M)})},fillRule:function(m){this.fb=m},moveTo:function(m,q){this.Ka=!0;const B={lb:!0};this.la=B;this.ka(z=>{z.moveTo(m,q);B.lb&&z.lineTo(m,q)})},lineTo:function(m,q){this.eb();this.Ia();this.ka(B=>{B.lineTo(m,q)})},cubicTo:function(m,q,B,z,L,C){this.eb();this.Ia();this.ka(D=>{D.bezierCurveTo(m,q,B,z,L,C)})},close:function(){this.Ia();this.ka(m=>{m.closePath()})},eb:function(){this.Ka||
375
+ this.moveTo(0,0)},Ia:function(){null!==this.la&&(this.la.lb=!1,this.la=null)},ka:function(m){this.La.push(m)},Ha:function(){return this.W.Sb(this.La)},hb:function(m){this.W.release(m)},Kb:function(){const m=this.Ha();this.W.clear();return m}}),K=f.extend("CanvasRenderPaint",{__construct:function(){this.__parent.__construct.call(this);this.H=[];this.Ja=0;this.Ma=t;this.Qa=b(4278190080);this.Oa=1;this.ta="miter";this.sa="butt";this.bb=a(n.srcOver);this.ga=null},color:function(m){this.H.push(()=>{this.Qa=
376
+ b(m)})},thickness:function(m){this.H.push(()=>{this.Oa=Math.abs(m)})},join:function(m){this.H.push(()=>{switch(m){case l.miter:this.ta="miter";break;case l.round:this.ta="round";break;case l.bevel:this.ta="bevel"}})},cap:function(m){this.H.push(()=>{switch(m){case h.butt:this.sa="butt";break;case h.round:this.sa="round";break;case h.square:this.sa="square"}})},style:function(m){this.H.push(()=>{this.Ma=m})},blendMode:function(m){this.H.push(()=>{this.bb=a(m)})},clearGradient:function(){this.H.push(()=>
377
+ {this.ga=null})},linearGradient:function(m,q,B,z){this.H.push(()=>{this.ga={Fb:m,Gb:q,nb:B,ob:z,$a:[]}})},radialGradient:function(m,q,B,z){this.H.push(()=>{this.ga={Fb:m,Gb:q,nb:B,ob:z,$a:[],nc:!0}})},addStop:function(m,q){this.H.push(()=>{this.ga.$a.push({color:m,stop:q})})},completeGradient:function(){},Lb:function(m,q,B,z){if(this.Ma!==u||0<this.Oa){var L=this.Ma,C=this.Qa,D=this.ga,A=m.globalCompositeOperation,J=m.globalAlpha;m.globalCompositeOperation=this.bb;m.globalAlpha=z;if(null!=D){C=D.Fb;
378
+ const R=D.Gb,U=D.nb;var M=D.ob;z=D.$a;D.nc?(D=U-C,M-=R,C=m.createRadialGradient(C,R,0,C,R,Math.sqrt(D*D+M*M))):C=m.createLinearGradient(C,R,U,M);for(let W=0,Ra=z.length;W<Ra;W++)D=z[W],C.addColorStop(D.stop,b(D.color));this.Qa=C;this.ga=null}switch(L){case u:m.strokeStyle=C;m.lineWidth=this.Oa;m.lineCap=this.sa;m.lineJoin=this.ta;m.stroke(q);break;case t:m.fillStyle=C,m.fill(q,B)}m.globalCompositeOperation=A;m.globalAlpha=J}},Nb:function(){return this.Ja+this.H.length},Mb:function(m){const q=m-this.Ja;
379
+ for(let B=0;B<q;B++)this.H[B]();this.H.splice(0,q);this.Ja=m}});const v=new Set,N=Object.prototype.hasOwnProperty;let O=null,V=[],da=0,G=0;var ja=k.CanvasRenderer=g.extend("Renderer",{__construct:function(m){this.__parent.__construct.call(this);this.V=[1,0,0,1,0,0];this.G=[1];this.D=m.getContext("2d");this.cb=m;this.J=[]},save:function(){this.V.push(...this.V.slice(this.V.length-6));this.G.push(this.G[this.G.length-1]);this.J.push(this.D.save.bind(this.D))},restore:function(){const m=this.V.length-
380
+ 6;if(6>m)throw"restore() called without matching save().";this.V.splice(m);this.G.pop();this.J.push(this.D.restore.bind(this.D))},transform:function(m,q,B,z,L,C){const D=this.V,A=D.length-6;D.splice(A,6,D[A]*m+D[A+2]*q,D[A+1]*m+D[A+3]*q,D[A]*B+D[A+2]*z,D[A+1]*B+D[A+3]*z,D[A]*L+D[A+2]*C+D[A+4],D[A+1]*L+D[A+3]*C+D[A+5]);this.J.push(this.D.transform.bind(this.D,m,q,B,z,L,C))},rotate:function(m){const q=Math.sin(m);m=Math.cos(m);this.transform(m,q,-q,m,0,0)},modulateOpacity:function(m){this.G[this.G.length-
381
+ 1]*=m},_drawPath:function(m,q){const B=m.fb===r?"evenodd":"nonzero",z=Math.max(0,this.G[this.G.length-1]),L=m.Ha(),C=q.Nb();this.J.push(()=>{q.Mb(C);q.Lb(this.D,L,B,z);m.hb(L)})},_drawRiveImage:function(m,q,B){var z=m.Ob;if(z){var L=this.D,C=a(q),D=Math.max(0,B*this.G[this.G.length-1]);this.J.push(function(){L.globalCompositeOperation=C;L.globalAlpha=D;L.drawImage(z,0,0);L.globalAlpha=1})}},_getMatrix:function(m){const q=this.V,B=q.length-6;for(let z=0;6>z;++z)m[z]=q[B+z]},_drawImageMesh:function(m,
382
+ q,B,z,L,C,D,A,J,M,R,U,W){let Ra,Tb,Ub;try{Ra=k.HEAPF32.slice(z>>2,(z>>2)+L),Tb=k.HEAPF32.slice(C>>2,(C>>2)+D),Ub=k.HEAPU16.slice(A>>1,(A>>1)+J)}catch(kb){console.error("[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.");return}z=this.D.canvas.width;C=this.D.canvas.height;D=U-M;A=W-R;M=Math.max(M,0);R=Math.max(R,0);U=Math.min(U,z);W=Math.min(W,C);const Ga=U-M,Ha=W-R;console.assert(Ga<=Math.min(D,z));console.assert(Ha<=Math.min(A,C));if(!(0>=Ga||0>=Ha)){U=
383
+ Ga<D||Ha<A;z=W=1;var qa=Math.ceil(Ga*W),ra=Math.ceil(Ha*z);C=ia.pc();qa>C&&(W*=C/qa,qa=C);ra>C&&(z*=C/ra,ra=C);O||(O=new k.DynamicRectanizer(C),O.reset(512,512));C=O.addRect(qa,ra);0>C&&(c(),v.add(this),C=O.addRect(qa,ra),console.assert(0<=C));var Vb=C&65535,Wb=C>>16;V.push({ha:this.V.slice(this.V.length-6),image:m,ib:Vb,jb:Wb,qc:M,rc:R,Cc:qa,rb:ra,Da:W,Ea:z,ab:Ra,Ib:Tb,indices:Ub,tc:U,Eb:m.Pa<<1|(U?1:0)});da+=L;G+=J;var wa=this.D,Wc=a(q),Xc=Math.max(0,B*this.G[this.G.length-1]);this.J.push(function(){wa.save();
384
+ wa.resetTransform();wa.globalCompositeOperation=Wc;wa.globalAlpha=Xc;const kb=ia.canvas();kb&&wa.drawImage(kb,Vb,Wb,qa,ra,M,R,Ga,Ha);wa.restore()})}},_clipPath:function(m){const q=m.fb===r?"evenodd":"nonzero",B=m.Ha();this.J.push(()=>{this.D.clip(B,q);m.hb(B)})},beginFrame:function(m=!0){v.add(this);m&&this.J.push(this.D.clearRect.bind(this.D,0,0,this.cb.width,this.cb.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(m,q){this.transform(1,0,0,1,m,q)}});k.makeRenderer=
385
+ function(m){const q=new ja(m),B=q.D;let z=null,L=null;const C={attachSession:function(A){if(A&&z===A)return!0;if(!A||z||"function"!==typeof k.c2dDeferredClaim||"function"!==typeof k.c2dDeferredRenderer||!k.c2dDeferredClaim(A))return!1;const J=k.c2dDeferredRenderer(A);if(!J)return!1;z=A;L=J;return!0},detachSession:function(){z&&k.c2dDeferredDetach(z);L=z=null},deferredActive:function(){return null!==L}},D={save:function(){k.c2dDeferredSave(z)},restore:function(){k.c2dDeferredRestore(z)},transform:function(A,
386
+ J,M,R,U,W){k.c2dDeferredTransform(z,A,J,M,R,U,W)},translate:function(A,J){k.c2dDeferredTransform(z,1,0,0,1,A,J)},rotate:function(A){const J=Math.sin(A);A=Math.cos(A);k.c2dDeferredTransform(z,A,J,-J,A,0,0)},align:function(A,J,M,R,U){k.c2dDeferredAlign(z,A,J,M.minX,M.minY,M.maxX,M.maxY,R.minX,R.minY,R.maxX,R.maxY,void 0===U?1:U)},beginFrame:function(A=!0){q.beginFrame(A);k.c2dDeferredBeginFrame(z)},clear:function(){q.beginFrame(!0);k.c2dDeferredBeginFrame(z)},flush:function(){k.c2dDeferredReplay(z,
387
+ q)}};return new Proxy(q,{get(A,J){if(N.call(C,J))return C[J];if("_deferredRecorder"===J)return L;if(null!==L&&N.call(D,J))return D[J];if("function"===typeof A[J])return function(...M){return A[J].apply(A,M)};if("function"===typeof B[J]){if(-1<ha.indexOf(J))throw Error("RiveException: Method call to '"+J+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...M){q.J.push(B[J].bind(B,...M))}}return A[J]},
388
+ set(A,J,M){if(J in B)return q.J.push(()=>{B[J]=M}),!0}})};k.decodeImage=function(m,q){(new y({oa:q})).decode(m)};k.renderFactory={makeRenderPaint:function(){return new K},makeRenderPath:function(){return new I},makeRenderImage:function(){let m=lb;return new y({Ba:()=>{m.total++},oa:()=>{m.loaded++;if(m.loaded===m.total){const q=m.ready;q&&(q(),m.ready=null)}}})}};let Yc=k.load,lb=null;k.load=function(m,q,B=!0,z=null){const L=new k.FallbackFileAssetLoader;void 0!==q&&L.addLoader(q);B&&(q=new k.CDNFileAssetLoader(z),
389
+ L.addLoader(q));return new Promise(function(C){let D=null;lb={total:0,loaded:0,ready:function(){C(D)}};D=Yc(m,L,z??null);0==lb.total&&C(D)})};const Zc=k.Artboard.prototype.draw;k.Artboard.prototype.draw=function(m){Zc.call(this,m._deferredRecorder||m)};let $c=k.RendererWrapper.prototype.align;k.RendererWrapper.prototype.align=function(m,q,B,z,L=1){$c.call(this,m,q,B,z,L)};d=new ca;k.requestAnimationFrame=d.requestAnimationFrame.bind(d);k.cancelAnimationFrame=d.cancelAnimationFrame.bind(d);k.enableFPSCounter=
390
+ d.$b.bind(d);k.disableFPSCounter=d.Xb;d.xb=c;k.resolveAnimationFrame=c;k.cleanup=function(){O&&O.delete()}};var la="./this.program";ba&&(_scriptName=self.location.href);var ma="",na,oa;
391
391
  if(aa||ba){try{ma=(new URL(".",_scriptName)).href}catch{}ba&&(oa=a=>{var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});na=async a=>{if(pa(a))return new Promise((c,d)=>{var e=new XMLHttpRequest;e.open("GET",a,!0);e.responseType="arraybuffer";e.onload=()=>{200==e.status||0==e.status&&e.response?c(e.response):d(e.status)};e.onerror=d;e.send(null)});var b=await fetch(a,{credentials:"same-origin"});if(b.ok)return b.arrayBuffer();throw Error(b.status+
392
392
  " : "+b.url);}}var sa=console.log.bind(console),ta=console.error.bind(console),ua,va=!1,xa,pa=a=>a.startsWith("file://"),ya,za,Aa,w,Ba,Ca,E,F,Da,Ea,Fa=!1;function Ia(){var a=Ja.buffer;k.HEAP8=Aa=new Int8Array(a);Ba=new Int16Array(a);k.HEAPU8=w=new Uint8Array(a);k.HEAPU16=Ca=new Uint16Array(a);k.HEAP32=E=new Int32Array(a);k.HEAPU32=F=new Uint32Array(a);k.HEAPF32=Da=new Float32Array(a);Ea=new Float64Array(a)}
393
393
  function Ka(a){k.onAbort?.(a);a="Aborted("+a+")";ta(a);va=!0;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");za?.(a);throw a;}var La;async function Ma(a){if(!ua)try{var b=await na(a);return new Uint8Array(b)}catch{}if(a==La&&ua)a=new Uint8Array(ua);else if(oa)a=oa(a);else throw"both async and sync fetching of the wasm failed";return a}
@@ -399,25 +399,25 @@ return b},gb=(a,b=0,c,d)=>{c=fb(a,b,c,d);if(16<c-b&&a.buffer&&eb)return eb.decod
399
399
  2047>=d?b+=2:55296<=d&&57343>=d?(b+=4,++c):b+=3}return b},jb=(a,b,c,d)=>{if(!(0<d))return 0;var e=c;d=c+d-1;for(var f=0;f<a.length;++f){var g=a.codePointAt(f);if(127>=g){if(c>=d)break;b[c++]=g}else if(2047>=g){if(c+1>=d)break;b[c++]=192|g>>6;b[c++]=128|g&63}else if(65535>=g){if(c+2>=d)break;b[c++]=224|g>>12;b[c++]=128|g>>6&63;b[c++]=128|g&63}else{if(c+3>=d)break;b[c++]=240|g>>18;b[c++]=128|g>>12&63;b[c++]=128|g>>6&63;b[c++]=128|g&63;f++}}b[c]=0;return c-e},mb=[];
400
400
  function nb(a,b){mb[a]={input:[],output:[],$:b};ob(a,pb)}
401
401
  var pb={open(a){var b=mb[a.node.Ca];if(!b)throw new P(43);a.s=b;a.seekable=!1},close(a){a.s.$.ua(a.s)},ua(a){a.s.$.ua(a.s)},read(a,b,c,d){if(!a.s||!a.s.$.qb)throw new P(60);for(var e=0,f=0;f<d;f++){try{var g=a.s.$.qb(a.s)}catch(h){throw new P(29);}if(void 0===g&&0===e)throw new P(6);if(null===g||void 0===g)break;e++;b[c+f]=g}e&&(a.node.ea=Date.now());return e},write(a,b,c,d){if(!a.s||!a.s.$.Xa)throw new P(60);try{for(var e=0;e<d;e++)a.s.$.Xa(a.s,b[c+e])}catch(f){throw new P(29);}d&&(a.node.O=a.node.K=
402
- Date.now());return e}},qb={qb(){a:{if(!hb.length){var a=null;globalThis.window?.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){var b=null;break a}b=Array(ib(a)+1);a=jb(a,b,0,b.length);b.length=a;hb=b}b=hb.shift()}return b},Xa(a,b){null===b||10===b?(sa(gb(a.output)),a.output=[]):0!=b&&a.output.push(b)},ua(a){0<a.output?.length&&(sa(gb(a.output)),a.output=[])},kc(){return{Kc:25856,Mc:5,Jc:191,Lc:35387,Ic:[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]}},
402
+ Date.now());return e}},qb={qb(){a:{if(!hb.length){var a=null;globalThis.window?.prompt&&(a=window.prompt("Input: "),null!==a&&(a+="\n"));if(!a){var b=null;break a}b=Array(ib(a)+1);a=jb(a,b,0,b.length);b.length=a;hb=b}b=hb.shift()}return b},Xa(a,b){null===b||10===b?(sa(gb(a.output)),a.output=[]):0!=b&&a.output.push(b)},ua(a){0<a.output?.length&&(sa(gb(a.output)),a.output=[])},kc(){return{Lc:25856,Nc:5,Kc:191,Mc:35387,Jc:[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]}},
403
403
  lc(){return 0},mc(){return[24,80]}},rb={Xa(a,b){null===b||10===b?(ta(gb(a.output)),a.output=[]):0!=b&&a.output.push(b)},ua(a){0<a.output?.length&&(ta(gb(a.output)),a.output=[])}},Q={S:null,Z(){return Q.createNode(null,"/",16895,0)},createNode(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new P(63);Q.S||(Q.S={dir:{node:{ca:Q.l.ca,U:Q.l.U,na:Q.l.na,za:Q.l.za,Bb:Q.l.Bb,Hb:Q.l.Hb,Db:Q.l.Db,Za:Q.l.Za,Ga:Q.l.Ga},stream:{R:Q.i.R}},file:{node:{ca:Q.l.ca,U:Q.l.U},stream:{R:Q.i.R,read:Q.i.read,write:Q.i.write,
404
- ub:Q.i.ub,wb:Q.i.wb}},link:{node:{ca:Q.l.ca,U:Q.l.U,pa:Q.l.pa},stream:{}},kb:{node:{ca:Q.l.ca,U:Q.l.U},stream:sb}});c=tb(a,b,c,d);16384===(c.mode&61440)?(c.l=Q.S.dir.node,c.i=Q.S.dir.stream,c.j={}):32768===(c.mode&61440)?(c.l=Q.S.file.node,c.i=Q.S.file.stream,c.B=0,c.j=null):40960===(c.mode&61440)?(c.l=Q.S.link.node,c.i=Q.S.link.stream):8192===(c.mode&61440)&&(c.l=Q.S.kb.node,c.i=Q.S.kb.stream);c.ea=c.O=c.K=Date.now();a&&(a.j[b]=c,a.ea=a.O=a.K=c.ea);return c},Qc(a){return a.j?a.j.subarray?a.j.subarray(0,
405
- a.B):new Uint8Array(a.j):new Uint8Array(0)},l:{ca(a){var b={};b.Nc=8192===(a.mode&61440)?a.id:1;b.Sc=a.id;b.mode=a.mode;b.Uc=1;b.uid=0;b.Rc=0;b.Ca=a.Ca;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.B:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.ea=new Date(a.ea);b.O=new Date(a.O);b.K=new Date(a.K);b.Tb=4096;b.Hc=Math.ceil(b.size/b.Tb);return b},U(a,b){for(var c of["mode","atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.B!=b&&(0==b?(a.j=null,
404
+ ub:Q.i.ub,wb:Q.i.wb}},link:{node:{ca:Q.l.ca,U:Q.l.U,pa:Q.l.pa},stream:{}},kb:{node:{ca:Q.l.ca,U:Q.l.U},stream:sb}});c=tb(a,b,c,d);16384===(c.mode&61440)?(c.l=Q.S.dir.node,c.i=Q.S.dir.stream,c.j={}):32768===(c.mode&61440)?(c.l=Q.S.file.node,c.i=Q.S.file.stream,c.B=0,c.j=null):40960===(c.mode&61440)?(c.l=Q.S.link.node,c.i=Q.S.link.stream):8192===(c.mode&61440)&&(c.l=Q.S.kb.node,c.i=Q.S.kb.stream);c.ea=c.O=c.K=Date.now();a&&(a.j[b]=c,a.ea=a.O=a.K=c.ea);return c},Rc(a){return a.j?a.j.subarray?a.j.subarray(0,
405
+ a.B):new Uint8Array(a.j):new Uint8Array(0)},l:{ca(a){var b={};b.Oc=8192===(a.mode&61440)?a.id:1;b.Tc=a.id;b.mode=a.mode;b.Vc=1;b.uid=0;b.Sc=0;b.Ca=a.Ca;16384===(a.mode&61440)?b.size=4096:32768===(a.mode&61440)?b.size=a.B:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.ea=new Date(a.ea);b.O=new Date(a.O);b.K=new Date(a.K);b.Tb=4096;b.Ic=Math.ceil(b.size/b.Tb);return b},U(a,b){for(var c of["mode","atime","mtime","ctime"])null!=b[c]&&(a[c]=b[c]);void 0!==b.size&&(b=b.size,a.B!=b&&(0==b?(a.j=null,
406
406
  a.B=0):(c=a.j,a.j=new Uint8Array(b),c&&a.j.set(c.subarray(0,Math.min(b,a.B))),a.B=b)))},na(){Q.Ra||(Q.Ra=new P(44),Q.Ra.stack="<generic error, no stack>");throw Q.Ra;},za(a,b,c,d){return Q.createNode(a,b,c,d)},Bb(a,b,c){try{var d=ub(b,c)}catch(f){}if(d){if(16384===(a.mode&61440))for(var e in d.j)throw new P(55);e=vb(d.parent.id,d.name);if(wb[e]===d)wb[e]=d.ia;else for(e=wb[e];e;){if(e.ia===d){e.ia=d.ia;break}e=e.ia}}delete a.parent.j[a.name];b.j[c]=a;a.name=c;b.K=b.O=a.parent.K=a.parent.O=Date.now()},
407
407
  Hb(a,b){delete a.j[b];a.K=a.O=Date.now()},Db(a,b){var c=ub(a,b),d;for(d in c.j)throw new P(55);delete a.j[b];a.K=a.O=Date.now()},Za(a){return[".","..",...Object.keys(a.j)]},Ga(a,b,c){a=Q.createNode(a,b,41471,0);a.link=c;return a},pa(a){if(40960!==(a.mode&61440))throw new P(28);return a.link}},i:{read(a,b,c,d,e){var f=a.node.j;if(e>=a.node.B)return 0;a=Math.min(a.node.B-e,d);if(8<a&&f.subarray)b.set(f.subarray(e,e+a),c);else for(d=0;d<a;d++)b[c+d]=f[e+d];return a},write(a,b,c,d,e,f){b.buffer===Aa.buffer&&
408
408
  (f=!1);if(!d)return 0;a=a.node;a.O=a.K=Date.now();if(b.subarray&&(!a.j||a.j.subarray)){if(f)return a.j=b.subarray(c,c+d),a.B=d;if(0===a.B&&0===e)return a.j=b.slice(c,c+d),a.B=d;if(e+d<=a.B)return a.j.set(b.subarray(c,c+d),e),d}f=e+d;var g=a.j?a.j.length:0;g>=f||(f=Math.max(f,g*(1048576>g?2:1.125)>>>0),0!=g&&(f=Math.max(f,256)),g=a.j,a.j=new Uint8Array(f),0<a.B&&a.j.set(g.subarray(0,a.B),0));if(a.j.subarray&&b.subarray)a.j.set(b.subarray(c,c+d),e);else for(f=0;f<d;f++)a.j[e+f]=b[c+f];a.B=Math.max(a.B,
409
- e+d);return d},R(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.B);if(0>b)throw new P(28);return b},ub(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.j;if(e&2||!a||a.buffer!==Aa.buffer){d=!0;Ka();e=void 0;if(!e)throw new P(48);if(a){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);Aa.set(a,e)}}else d=!1,e=a.byteOffset;return{m:e,Gc:d}},wb(a,b,c,d){Q.i.write(a,b,0,d,c,!1);return 0}}},xb=(a,b)=>{var c=0;a&&(c|=365);
409
+ e+d);return d},R(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.B);if(0>b)throw new P(28);return b},ub(a,b,c,d,e){if(32768!==(a.node.mode&61440))throw new P(43);a=a.node.j;if(e&2||!a||a.buffer!==Aa.buffer){d=!0;Ka();e=void 0;if(!e)throw new P(48);if(a){if(0<c||c+b<a.length)a.subarray?a=a.subarray(c,c+b):a=Array.prototype.slice.call(a,c,c+b);Aa.set(a,e)}}else d=!1,e=a.byteOffset;return{m:e,Hc:d}},wb(a,b,c,d){Q.i.write(a,b,0,d,c,!1);return 0}}},xb=(a,b)=>{var c=0;a&&(c|=365);
410
410
  b&&(c|=146);return c},yb=null,zb={},Ab=[],Bb=1,wb=null,Cb=!1,Db=!0,Eb={},P=class{name="ErrnoError";constructor(a){this.aa=a}},Fb=class{Y={};node=null;get flags(){return this.Y.flags}set flags(a){this.Y.flags=a}get position(){return this.Y.position}set position(a){this.Y.position=a}},Gb=class{l={};i={};Aa=null;constructor(a,b,c,d){a||=this;this.parent=a;this.Z=a.Z;this.id=Bb++;this.name=b;this.mode=c;this.Ca=d;this.ea=this.O=this.K=Date.now()}get read(){return 365===(this.mode&365)}set read(a){a?this.mode|=
411
411
  365:this.mode&=-366}get write(){return 146===(this.mode&146)}set write(a){a?this.mode|=146:this.mode&=-147}};
412
412
  function Hb(a,b={}){if(!a)throw new P(44);b.Ta??(b.Ta=!0);"/"===a.charAt(0)||(a="//"+a);var c=0;a:for(;40>c;c++){a=a.split("/").filter(h=>!!h);for(var d=yb,e="/",f=0;f<a.length;f++){var g=f===a.length-1;if(g&&b.parent)break;if("."!==a[f])if(".."===a[f])if(e=ab(e),d===d.parent){a=e+"/"+a.slice(f+1).join("/");c--;continue a}else d=d.parent;else{e=$a(e+"/"+a[f]);try{d=ub(d,a[f])}catch(h){if(44===h?.aa&&g&&b.uc)return{path:e};throw h;}!d.Aa||g&&!b.Ta||(d=d.Aa.root);if(40960===(d.mode&61440)&&(!g||b.Sa)){if(!d.l.pa)throw new P(52);
413
413
  d=d.l.pa(d);"/"===d.charAt(0)||(d=ab(e)+"/"+d);a=d+"/"+a.slice(f+1).join("/");continue a}}}return{path:e,node:d}}throw new P(32);}function vb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%wb.length}function ub(a,b){var c=16384===(a.mode&61440)?(c=Ib(a,"x"))?c:a.l.na?0:2:54;if(c)throw new P(c);for(c=wb[vb(a.id,b)];c;c=c.ia){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.l.na(a,b)}
414
414
  function tb(a,b,c,d){a=new Gb(a,b,c,d);b=vb(a.parent.id,a.name);a.ia=wb[b];return wb[b]=a}function Jb(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function Ib(a,b){if(Db)return 0;if(!b.includes("r")||a.mode&292){if(b.includes("w")&&!(a.mode&146)||b.includes("x")&&!(a.mode&73))return 2}else return 2;return 0}function Kb(a,b){if(16384!==(a.mode&61440))return 54;try{return ub(a,b),20}catch(c){}return Ib(a,"wx")}function Lb(a){a=Ab[a];if(!a)throw new P(8);return a}
415
- function Mb(a,b=-1){a=Object.assign(new Fb,a);if(-1==b)a:{for(b=0;4096>=b;b++)if(!Ab[b])break a;throw new P(33);}a.ba=b;return Ab[b]=a}function Nb(a,b=-1){a=Mb(a,b);a.i?.Pc?.(a);return a}function Ob(a,b){var c= undefined,d=c?null:a;c??=a.l.U;if(!c)throw new P(63);c(d,b)}var sb={open(a){a.i=zb[a.node.Ca].i;a.i.open?.(a)},R(){throw new P(70);}};function ob(a,b){zb[a]={i:b}}
416
- function Pb(a,b){var c="/"===b;if(c&&yb)throw new P(10);if(!c&&b){var d=Hb(b,{Ta:!1});b=d.path;d=d.node;if(d.Aa)throw new P(10);if(16384!==(d.mode&61440))throw new P(54);}b={type:a,Vc:{},vb:b,sc:[]};a=a.Z(b);a.Z=b;b.root=a;c?yb=a:d&&(d.Aa=b,d.Z&&d.Z.sc.push(b))}function Qb(a,b,c){var d=Hb(a,{parent:!0}).node;a=a&&a.match(/([^\/]+|\/)\/*$/)[1];if(!a)throw new P(28);if("."===a||".."===a)throw new P(20);var e=Kb(d,a);if(e)throw new P(e);if(!d.l.za)throw new P(63);return d.l.za(d,a,b,c)}
415
+ function Mb(a,b=-1){a=Object.assign(new Fb,a);if(-1==b)a:{for(b=0;4096>=b;b++)if(!Ab[b])break a;throw new P(33);}a.ba=b;return Ab[b]=a}function Nb(a,b=-1){a=Mb(a,b);a.i?.Qc?.(a);return a}function Ob(a,b){var c= undefined,d=c?null:a;c??=a.l.U;if(!c)throw new P(63);c(d,b)}var sb={open(a){a.i=zb[a.node.Ca].i;a.i.open?.(a)},R(){throw new P(70);}};function ob(a,b){zb[a]={i:b}}
416
+ function Pb(a,b){var c="/"===b;if(c&&yb)throw new P(10);if(!c&&b){var d=Hb(b,{Ta:!1});b=d.path;d=d.node;if(d.Aa)throw new P(10);if(16384!==(d.mode&61440))throw new P(54);}b={type:a,Wc:{},vb:b,sc:[]};a=a.Z(b);a.Z=b;b.root=a;c?yb=a:d&&(d.Aa=b,d.Z&&d.Z.sc.push(b))}function Qb(a,b,c){var d=Hb(a,{parent:!0}).node;a=a&&a.match(/([^\/]+|\/)\/*$/)[1];if(!a)throw new P(28);if("."===a||".."===a)throw new P(20);var e=Kb(d,a);if(e)throw new P(e);if(!d.l.za)throw new P(63);return d.l.za(d,a,b,c)}
417
417
  function Rb(a){return Qb(a,16895,0)}function Sb(a,b,c){"undefined"==typeof c&&(c=b,b=438);Qb(a,b|8192,c)}function Xb(a,b){if(!db(a))throw new P(44);var c=Hb(b,{parent:!0}).node;if(!c)throw new P(44);b=b&&b.match(/([^\/]+|\/)\/*$/)[1];var d=Kb(c,b);if(d)throw new P(d);if(!c.l.Ga)throw new P(63);c.l.Ga(c,b,a)}
418
418
  function Yb(a,b,c=438){if(""===a)throw new P(44);if("string"==typeof b){var d={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[b];if("undefined"==typeof d)throw Error(`Unknown file open mode: ${b}`);b=d}c=b&64?c&4095|32768:0;if("object"==typeof a)d=a;else{var e=a.endsWith("/");a=Hb(a,{Sa:!(b&131072),uc:!0});d=a.node;a=a.path}var f=!1;if(b&64)if(d){if(b&128)throw new P(20);}else{if(e)throw new P(31);d=Qb(a,c|511,0);f=!0}if(!d)throw new P(44);8192===(d.mode&61440)&&(b&=-513);if(b&65536&&16384!==(d.mode&
419
419
  61440))throw new P(54);if(!f&&(e=d?40960===(d.mode&61440)?32:16384===(d.mode&61440)&&("r"!==Jb(b)||b&576)?31:Ib(d,Jb(b)):44))throw new P(e);if(b&512&&!f){e=d;e="string"==typeof e?Hb(e,{Sa:!0}).node:e;if(16384===(e.mode&61440))throw new P(31);if(32768!==(e.mode&61440))throw new P(28);var g=Ib(e,"w");if(g)throw new P(g);Ob(e,{size:0,timestamp:Date.now()})}b&=-131713;a:for(e=d;;){if(e===e.parent){e=e.Z.vb;var h=h?"/"!==e[e.length-1]?`${e}/${h}`:e+h:e;break a}h=h?`${e.name}/${h}`:e.name;e=e.parent}h=
420
- Mb({node:d,path:h,flags:b,seekable:!0,position:0,i:d.i,Bc:[],error:!1});h.i.open&&h.i.open(h);f&&(c&=511,d="string"==typeof d?Hb(d,{Sa:!0}).node:d,Ob(d,{mode:c&4095|d.mode&-4096,K:Date.now(),Oc:void 0}));!k.logReadFiles||b&1||a in Eb||(Eb[a]=1);return h}function Zb(a,b,c){if(null===a.ba)throw new P(8);if(!a.seekable||!a.i.R)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.i.R(a,b,c);a.Bc=[]}
420
+ Mb({node:d,path:h,flags:b,seekable:!0,position:0,i:d.i,Bc:[],error:!1});h.i.open&&h.i.open(h);f&&(c&=511,d="string"==typeof d?Hb(d,{Sa:!0}).node:d,Ob(d,{mode:c&4095|d.mode&-4096,K:Date.now(),Pc:void 0}));!k.logReadFiles||b&1||a in Eb||(Eb[a]=1);return h}function Zb(a,b,c){if(null===a.ba)throw new P(8);if(!a.seekable||!a.i.R)throw new P(70);if(0!=c&&1!=c&&2!=c)throw new P(28);a.position=a.i.R(a,b,c);a.Bc=[]}
421
421
  function $b(a,b,c){a=$a("/dev/"+a);var d=xb(!!b,!!c);$b.tb??($b.tb=64);var e=$b.tb++<<8|0;ob(e,{open(f){f.seekable=!1},close(){c?.buffer?.length&&c(10)},read(f,g,h,l){for(var n=0,t=0;t<l;t++){try{var u=b()}catch(r){throw new P(29);}if(void 0===u&&0===n)throw new P(6);if(null===u||void 0===u)break;n++;g[h+t]=u}n&&(f.node.ea=Date.now());return n},write(f,g,h,l){for(var n=0;n<l;n++)try{c(g[h+n])}catch(t){throw new P(29);}l&&(f.node.O=f.node.K=Date.now());return n}});Sb(a,d,e)}
422
422
  var ac={},Xa=void 0,bc=(a,b)=>Object.defineProperty(b,"name",{value:a}),cc=[],dc=[0,1,,1,null,1,!0,1,!1,1],S=class extends Error{constructor(a){super(a);this.name="BindingError"}},ec=a=>{if(!a)throw new S(`Cannot use deleted val. handle = ${a}`);return dc[a]},fc=a=>{switch(a){case void 0:return 2;case null:return 4;case !0:return 6;case !1:return 8;default:const b=cc.pop()||dc.length;dc[b]=a;dc[b+1]=1;return b}};class gc extends Error{}
423
423
  var T=a=>{for(var b="";;){var c=w[a++];if(!c)return b;b+=String.fromCharCode(c)}},hc={},ic=(a,b)=>{if(void 0===b)throw new S("ptr should not be undefined");for(;a.C;)b=a.qa(b),a=a.C;return b},jc={},mc=a=>{a=kc(a);var b=T(a);lc(a);return b},nc=(a,b)=>{var c=jc[a];if(void 0===c)throw a=`${b} has unknown type ${mc(a)}`,new S(a);return c},oc=()=>{},pc=!1,qc=a=>{if(!globalThis.FinalizationRegistry)return qc=b=>b,a;pc=new FinalizationRegistry(b=>{b=b.g;--b.count.value;0===b.count.value&&(b.F?b.M.T(b.F):
@@ -448,14 +448,14 @@ c=0;c<a.length;++c)65535<a.codePointAt(c)&&c++,b+=4;return b},sd=0,td=[],ud=a=>{
448
448
  !1;return c},["delete"](){this.g.m||yc(this);if(this.g.ma&&!this.g.ja)throw new S("Object already scheduled for deletion");oc(this);var c=this.g;--c.count.value;0===c.count.value&&(c.F?c.M.T(c.F):c.u.h.T(c.m));this.g.ja||(this.g.F=void 0,this.g.m=void 0)},isDeleted:function(){return!this.g.m},deleteLater:function(){this.g.m||yc(this);if(this.g.ma&&!this.g.ja)throw new S("Object already scheduled for deletion");zc.push(this);this.g.ma=!0;return this}});const b=Symbol.dispose;b&&(a[b]=a["delete"])})();
449
449
  Object.assign(Oc.prototype,{dc(a){this.Ab&&(a=this.Ab(a));return a},mb(a){this.T?.(a)},L:tc,o:function(a){function b(){return this.ya?Nc(this.h.P,{u:this.vc,m:c,M:this,F:a}):Nc(this.h.P,{u:this,m:a})}var c=this.dc(a);if(!c)return this.mb(a),null;var d=Mc(this.h,c);if(void 0!==d){if(0===d.g.count.value)return d.g.m=c,d.g.F=a,d.clone();d=d.clone();this.mb(a);return d}d=this.h.cc(c);d=Bc[d];if(!d)return b.call(this);d=this.xa?d.Ub:d.pointerType;var e=Lc(c,this.h,d.h);return null===e?b.call(this):this.ya?
450
450
  Nc(d.h.P,{u:d,m:e,M:this,F:a}):Nc(d.h.P,{u:d,m:e})}});k.noExitRuntime&&(Wa=k.noExitRuntime);k.print&&(sa=k.print);k.printErr&&(ta=k.printErr);k.wasmBinary&&(ua=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()();
451
- var Ld={258990:(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=
451
+ var Ld={262254:(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=
452
452
  [];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",
453
- "click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.N&&h.state===f.device_state.started&&h.N.resume().then(()=>{Id(h.yb)},l=>{console.error("Failed to resume audiocontext",l)})}f.unlock_event_types.map(function(l){document.removeEventListener(l,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},261168:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
454
- window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},261472:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,261576:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},261747:(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.N=
453
+ "click"];f.unlock=function(){for(var g=0;g<f.devices.length;++g){var h=f.devices[g];null!=h&&null!=h.N&&h.state===f.device_state.started&&h.N.resume().then(()=>{Id(h.yb)},l=>{console.error("Failed to resume audiocontext",l)})}f.unlock_event_types.map(function(l){document.removeEventListener(l,f.unlock,!0)})};f.unlock_event_types.map(function(g){document.addEventListener(g,f.unlock,!0)})}window.miniaudio.referenceCount+=1;return 1},264432:()=>{"undefined"!==typeof window.miniaudio&&(window.miniaudio.unlock_event_types.map(function(a){document.removeEventListener(a,
454
+ window.miniaudio.unlock,!0)}),--window.miniaudio.referenceCount,0===window.miniaudio.referenceCount&&delete window.miniaudio)},264736:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,264840:()=>{try{var a=new (window.AudioContext||window.webkitAudioContext),b=a.sampleRate;a.close();return b}catch(c){return 0}},265011:(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.N=
455
455
  new (window.AudioContext||window.webkitAudioContext)(h);g.N.suspend();g.state=window.miniaudio.device_state.stopped;c=0;a!=window.miniaudio.device_type.playback&&(c=b);g.da=g.N.createScriptProcessor(d,c,b);g.da.onaudioprocess=function(l){if(null==g.wa||0==g.wa.length)g.wa=new Float32Array(Da.buffer,e,d*b);if(a==window.miniaudio.device_type.capture||a==window.miniaudio.device_type.duplex){for(var n=0;n<b;n+=1)for(var t=l.inputBuffer.getChannelData(n),u=g.wa,r=0;r<d;r+=1)u[r*b+n]=t[r];Jd(f,d,e)}if(a==
456
456
  window.miniaudio.device_type.playback||a==window.miniaudio.device_type.duplex)for(Kd(f,d,e),n=0;n<l.outputBuffer.numberOfChannels;++n)for(t=l.outputBuffer.getChannelData(n),u=g.wa,r=0;r<d;r+=1)t[r]=u[r*b+n];else for(n=0;n<l.outputBuffer.numberOfChannels;++n)l.outputBuffer.getChannelData(n).fill(0)};a!=window.miniaudio.device_type.capture&&a!=window.miniaudio.device_type.duplex||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(l){g.Fa=g.N.createMediaStreamSource(l);g.Fa.connect(g.da);
457
- g.da.connect(g.N.destination)}).catch(function(l){console.log("Failed to get user media: "+l)});a==window.miniaudio.device_type.playback&&g.da.connect(g.N.destination);g.yb=f;return window.miniaudio.track_device(g)},264624:a=>window.miniaudio.get_device_by_index(a).N.sampleRate,264697:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.da&&(a.da.onaudioprocess=function(){},a.da.disconnect(),a.da=void 0);void 0!==a.Fa&&(a.Fa.disconnect(),a.Fa=void 0);a.N.close();a.N=void 0;a.yb=void 0},265097:a=>
458
- {window.miniaudio.untrack_device_by_index(a)},265147:a=>{a=window.miniaudio.get_device_by_index(a);a.N.resume();a.state=window.miniaudio.device_state.started},265286:a=>{a=window.miniaudio.get_device_by_index(a);a.N.suspend();a.state=window.miniaudio.device_state.stopped}},lc,Md,kc,Id,Jd,Kd,Nd,Od,Pd,Qd,Ja,Rc,Sd={__syscall_fcntl64:function(a,b,c){Xa=c;try{var d=Lb(a);switch(b){case 0:var e=Ya();if(0>e)break;for(;Ab[e];)e++;return Nb(d,e).ba;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=
457
+ g.da.connect(g.N.destination)}).catch(function(l){console.log("Failed to get user media: "+l)});a==window.miniaudio.device_type.playback&&g.da.connect(g.N.destination);g.yb=f;return window.miniaudio.track_device(g)},267888:a=>window.miniaudio.get_device_by_index(a).N.sampleRate,267961:a=>{a=window.miniaudio.get_device_by_index(a);void 0!==a.da&&(a.da.onaudioprocess=function(){},a.da.disconnect(),a.da=void 0);void 0!==a.Fa&&(a.Fa.disconnect(),a.Fa=void 0);a.N.close();a.N=void 0;a.yb=void 0},268361:a=>
458
+ {window.miniaudio.untrack_device_by_index(a)},268411:a=>{a=window.miniaudio.get_device_by_index(a);a.N.resume();a.state=window.miniaudio.device_state.started},268550:a=>{a=window.miniaudio.get_device_by_index(a);a.N.suspend();a.state=window.miniaudio.device_state.stopped}},lc,Md,kc,Id,Jd,Kd,Nd,Od,Pd,Qd,Ja,Rc,Sd={__syscall_fcntl64:function(a,b,c){Xa=c;try{var d=Lb(a);switch(b){case 0:var e=Ya();if(0>e)break;for(;Ab[e];)e++;return Nb(d,e).ba;case 1:case 2:return 0;case 3:return d.flags;case 4:return e=
459
459
  Ya(),d.flags|=e,0;case 12:return e=Ya(),Ba[e+0>>1]=2,0;case 13:case 14:return 0}return-28}catch(f){if("undefined"==typeof ac||"ErrnoError"!==f.name)throw f;return-f.aa}},__syscall_ioctl:function(a,b,c){Xa=c;try{var d=Lb(a);switch(b){case 21509:return d.s?0:-59;case 21505:if(!d.s)return-59;if(d.s.$.kc){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=Ya();E[e>>2]=25856;E[e+4>>2]=5;E[e+8>>2]=191;E[e+12>>2]=35387;for(var f=0;32>f;f++)Aa[e+f+17]=a[f]||0}return 0;case 21510:case 21511:case 21512:return d.s?
460
460
  0:-59;case 21506:case 21507:case 21508:if(!d.s)return-59;if(d.s.$.lc)for(e=Ya(),a=[],f=0;32>f;f++)a.push(Aa[e+f+17]);return 0;case 21519:if(!d.s)return-59;e=Ya();return E[e>>2]=0;case 21520:return d.s?-28:-59;case 21537:case 21531:e=Ya();if(!d.i.jc)throw new P(59);return d.i.jc(d,b,e);case 21523:if(!d.s)return-59;d.s.$.mc&&(f=[24,80],e=Ya(),Ba[e>>1]=f[0],Ba[e+2>>1]=f[1]);return 0;case 21524:return d.s?0:-59;case 21515:return d.s?0:-59;default:return-28}}catch(g){if("undefined"==typeof ac||"ErrnoError"!==
461
461
  g.name)throw g;return-g.aa}},__syscall_openat:function(a,b,c,d){Xa=d;try{b=b?gb(w,b):"";var e=b;if("/"===e.charAt(0))b=e;else{var f=-100===a?"/":Lb(a).path;if(0==e.length)throw new P(44);b=f+"/"+e}var g=d?Ya():0;return Yb(b,c,g).ba}catch(h){if("undefined"==typeof ac||"ErrnoError"!==h.name)throw h;return-h.aa}},_abort_js:()=>Ka(""),_embind_create_inheriting_constructor:(a,b,c)=>{a=T(a);b=nc(b,"wrapper");c=ec(c);var d=b.h,e=d.P,f=d.C.P,g=d.C.constructor;a=bc(a,function(...h){for(var l of d.C.zb)if(this[l]===
@@ -478,7 +478,7 @@ l,n)=>{rc[a].pb.push({ac:T(b),hc:c,ec:Z(d,e),fc:f,yc:g,xc:Z(h,l),zc:n})},_embind
478
478
  ec(l).apply(null,h);break;case 2:y=Reflect.construct(ec(l),h);break;case 3:y=h[0];break;case 1:y=ec(l)[xd(n)](...h)}l=[];y=f(l,y);l.length&&(F[t>>2]=fc(l));return y}))},_emval_decref:fd,_emval_get_module_property:a=>{a=xd(a);return fc(k[a])},_emval_get_property:(a,b)=>{a=ec(a);b=ec(b);return fc(a[b])},_emval_incref:a=>{9<a&&(dc[a+1]+=1)},_emval_invoke:(a,b,c,d,e)=>td[a](b,c,d,e),_emval_new_array:()=>fc([]),_emval_new_cstring:a=>fc(xd(a)),_emval_new_object:()=>fc({}),_emval_run_destructors:a=>{var b=
479
479
  ec(a);sc(b);fd(a)},_emval_set_property:(a,b,c)=>{a=ec(a);b=ec(b);c=ec(c);a[b]=c},_gmtime_js:function(a,b,c){a=new Date(1E3*(b+2097152>>>0<4194305-!!a?(a>>>0)+4294967296*b:NaN));E[c>>2]=a.getUTCSeconds();E[c+4>>2]=a.getUTCMinutes();E[c+8>>2]=a.getUTCHours();E[c+12>>2]=a.getUTCDate();E[c+16>>2]=a.getUTCMonth();E[c+20>>2]=a.getUTCFullYear()-1900;E[c+24>>2]=a.getUTCDay();E[c+28>>2]=(a.getTime()-Date.UTC(a.getUTCFullYear(),0,1,0,0,0,0))/864E5|0},_localtime_js:function(a,b,c){a=new Date(1E3*(b+2097152>>>
480
480
  0<4194305-!!a?(a>>>0)+4294967296*b:NaN));E[c>>2]=a.getSeconds();E[c+4>>2]=a.getMinutes();E[c+8>>2]=a.getHours();E[c+12>>2]=a.getDate();E[c+16>>2]=a.getMonth();E[c+20>>2]=a.getFullYear()-1900;E[c+24>>2]=a.getDay();b=a.getFullYear();E[c+28>>2]=(0!==b%4||0===b%100&&0!==b%400?zd:yd)[a.getMonth()]+a.getDate()-1|0;E[c+36>>2]=-(60*a.getTimezoneOffset());b=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();var d=(new Date(a.getFullYear(),0,1)).getTimezoneOffset();E[c+32>>2]=(b!=d&&a.getTimezoneOffset()==
481
- Math.min(d,b))|0},_setitimer_js:(a,b)=>{Ad[a]&&(clearTimeout(Ad[a].id),delete Ad[a]);if(!b)return 0;var c=setTimeout(()=>{delete Ad[a];Dd(()=>Nd(a,performance.now()))},b);Ad[a]={id:c,Xc:b};return 0},_tzset_js:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();F[a>>2]=60*Math.max(f,e);E[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,"0")}${String(h%60).padStart(2,"0")}`};
481
+ Math.min(d,b))|0},_setitimer_js:(a,b)=>{Ad[a]&&(clearTimeout(Ad[a].id),delete Ad[a]);if(!b)return 0;var c=setTimeout(()=>{delete Ad[a];Dd(()=>Nd(a,performance.now()))},b);Ad[a]={id:c,Yc:b};return 0},_tzset_js:(a,b,c,d)=>{var e=(new Date).getFullYear(),f=(new Date(e,0,1)).getTimezoneOffset();e=(new Date(e,6,1)).getTimezoneOffset();F[a>>2]=60*Math.max(f,e);E[b>>2]=Number(f!=e);b=g=>{var h=Math.abs(g);return`UTC${0<=g?"-":"+"}${String(Math.floor(h/60)).padStart(2,"0")}${String(h%60).padStart(2,"0")}`};
482
482
  a=b(f);b=b(e);e<f?(jb(a,w,c,17),jb(b,w,d,17)):(jb(a,w,d,17),jb(b,w,c,17))},clock_time_get:function(a,b,c,d){if(!(0<=a&&3>=a))return 28;a=Math.round(1E6*(0===a?Date.now():performance.now()));Pa=[a>>>0,(H=a,1<=+Math.abs(H)?0<H?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)];E[d>>2]=Pa[0];E[d+4>>2]=Pa[1];return 0},emscripten_asm_const_int:(a,b,c)=>{Ed.length=0;for(var d;d=w[b++];){var e=105!=d;e&=112!=d;c+=e&&c%8?4:0;Ed.push(112==d?F[c>>2]:105==d?E[c>>2]:Ea[c>>3]);c+=e?
483
483
  8:4}return Ld[a](...Ed)},emscripten_date_now:()=>Date.now(),emscripten_get_now:()=>performance.now(),emscripten_resize_heap:a=>{var b=w.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))-Ja.buffer.byteLength+65535)/65536|0;try{Ja.grow(d);Ia();var e=1;break a}catch(f){}e=void 0}if(e)return!0}return!1},environ_get:(a,b)=>{var c=0,d=0,e;for(e of Hd()){var f=b+c;F[a+d>>2]=f;c+=jb(e,w,
484
484
  f,Infinity)+1;d+=4}return 0},environ_sizes_get:(a,b)=>{var c=Hd();F[a>>2]=c.length;a=0;for(var d of c)a+=ib(d)+1;F[b>>2]=a;return 0},fd_close:function(a){try{var b=Lb(a);if(null===b.ba)throw new P(8);b.Ua&&(b.Ua=null);try{b.i.close&&b.i.close(b)}catch(c){throw c;}finally{Ab[b.ba]=null}b.ba=null;return 0}catch(c){if("undefined"==typeof ac||"ErrnoError"!==c.name)throw c;return c.aa}},fd_read:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=F[a>>2],l=F[a+4>>2];a+=8;var n=e,t=h,
@@ -486,7 +486,7 @@ u=l,r=f,x=Aa;if(0>u||0>r)throw new P(28);if(null===n.ba)throw new P(8);if(1===(n
486
486
  b,c,d,e){b=c+2097152>>>0<4194305-!!b?(b>>>0)+4294967296*c:NaN;try{if(isNaN(b))return 61;var f=Lb(a);Zb(f,b,d);Pa=[f.position>>>0,(H=f.position,1<=+Math.abs(H)?0<H?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)];E[e>>2]=Pa[0];E[e+4>>2]=Pa[1];f.Ua&&0===b&&0===d&&(f.Ua=null);return 0}catch(g){if("undefined"==typeof ac||"ErrnoError"!==g.name)throw g;return g.aa}},fd_write:function(a,b,c,d){try{a:{var e=Lb(a);a=b;for(var f,g=b=0;g<c;g++){var h=F[a>>2],l=F[a+4>>2];a+=8;var n=
487
487
  e,t=h,u=l,r=f,x=Aa;if(0>u||0>r)throw new P(28);if(null===n.ba)throw new P(8);if(0===(n.flags&2097155))throw new P(8);if(16384===(n.node.mode&61440))throw new P(31);if(!n.i.write)throw new P(28);n.seekable&&n.flags&1024&&Zb(n,0,2);var y="undefined"!=typeof r;if(!y)r=n.position;else if(!n.seekable)throw new P(70);var p=n.i.write(n,x,t,u,r,void 0);y||(n.position+=p);var I=p;if(0>I){var K=-1;break a}b+=I;if(I<l)break;"undefined"!=typeof f&&(f+=I)}K=b}F[d>>2]=K;return 0}catch(v){if("undefined"==typeof ac||
488
488
  "ErrnoError"!==v.name)throw v;return v.aa}},invoke_vii:Rd,isWindowsBrowser:function(){return-1<navigator.platform.indexOf("Win")},proc_exit:Cd,wasm_start_image_decode:function(a,b,c){b=new Uint8Array(Ja.buffer,b,c);c=new Uint8Array(c);c.set(b);createImageBitmap(new Blob([c])).then(function(d){var e=(new OffscreenCanvas(d.width,d.height)).getContext("2d");e.drawImage(d,0,0);e=e.getImageData(0,0,d.width,d.height);var f=e.data.length,g=k.Qb(f);(new Uint8Array(Ja.buffer,g,f)).set(e.data);k.Ec(a,d.width,
489
- d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=k.Tc(d)+1,f=k.Qb(e);k.Wc(d,f,e);k.Fc(a,f);k.Dc(f)})}};function Rd(a,b,c){var d=Qd();try{Rc.get(a)(b,c)}catch(e){Pd(d);if(e!==e+0)throw e;Od(1,0)}}var Td;
489
+ d.height,g,f)}).catch(function(d){d=d.message||"decode failed";var e=k.Uc(d)+1,f=k.Qb(e);k.Xc(d,f,e);k.Fc(a,f);k.Dc(f)})}};function Rd(a,b,c){var d=Qd();try{Rc.get(a)(b,c)}catch(e){Pd(d);if(e!==e+0)throw e;Od(1,0)}}var Td;
490
490
  Td=await (async function(){function a(c){c=Td=c.exports;lc=c.free;Md=c.malloc;kc=c.__getTypeName;k._wasm_image_decode_complete=c.wasm_image_decode_complete;k._wasm_image_decode_error=c.wasm_image_decode_error;Id=k._ma_device__on_notification_unlocked=c.ma_device__on_notification_unlocked;k._ma_malloc_emscripten=c.ma_malloc_emscripten;k._ma_free_emscripten=c.ma_free_emscripten;Jd=k._ma_device_process_pcm_frames_capture__webaudio=c.ma_device_process_pcm_frames_capture__webaudio;Kd=k._ma_device_process_pcm_frames_playback__webaudio=
491
491
  c.ma_device_process_pcm_frames_playback__webaudio;Nd=c._emscripten_timeout;Od=c.setThrew;Pd=c._emscripten_stack_restore;Qd=c.emscripten_stack_get_current;Qc.iiji=c.dynCall_iiji;Qc.jiji=c.dynCall_jiji;Qc.vij=c.dynCall_vij;Qc.iij=c.dynCall_iij;Qc.ji=c.dynCall_ji;Qc.iiiji=c.dynCall_iiiji;Qc.jii=c.dynCall_jii;Qc.viijii=c.dynCall_viijii;Qc.iiiiij=c.dynCall_iiiiij;Qc.iiiiijj=c.dynCall_iiiiijj;Qc.iiiiiijj=c.dynCall_iiiiiijj;Ja=c.memory;Rc=c.__indirect_function_table;Ia();return Td}var b={env:Sd,wasi_snapshot_preview1:Sd};
492
492
  if(k.instantiateWasm)return new Promise(c=>{k.instantiateWasm(b,(d,e)=>{c(a(d,e))})});La??=k.locateFile?k.locateFile("canvas_advanced.wasm",ma):ma+"canvas_advanced.wasm";return a((await Oa(b)).instance)}());
@@ -500,7 +500,7 @@ Ta.push(d)}Sa(Ta)}}if(k.preRun)for("function"==typeof k.preRun&&(k.preRun=[k.pre
500
500
  /* 5 */
501
501
  /***/ ((module) => {
502
502
 
503
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.43.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}}');
503
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@rive-app/canvas","version":"2.44.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}}');
504
504
 
505
505
  /***/ }),
506
506
  /* 6 */
@@ -626,6 +626,17 @@ var SemanticTreeModel = /** @class */ (function () {
626
626
  SemanticTreeModel.prototype.nodeById = function (id) {
627
627
  return this._nodesById.get(id);
628
628
  };
629
+ /** The node with SemanticState.Focused, or undefined. */
630
+ SemanticTreeModel.prototype.focusedNode = function () {
631
+ // Manual iteration: runs every frame and must stop at the first hit (the
632
+ // TS target forbids for-of over Map iterators).
633
+ var it = this._nodesById.values();
634
+ for (var r = it.next(); !r.done; r = it.next()) {
635
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(r.value.stateFlags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Focused))
636
+ return r.value;
637
+ }
638
+ return;
639
+ };
629
640
  /** Current index of a node among its siblings (or roots), or -1 if absent. */
630
641
  SemanticTreeModel.prototype.siblingIndexOf = function (id) {
631
642
  var node = this._nodesById.get(id);
@@ -1173,8 +1184,42 @@ __webpack_require__.r(__webpack_exports__);
1173
1184
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1174
1185
  /* harmony export */ AccessibilityOverlay: () => (/* binding */ AccessibilityOverlay)
1175
1186
  /* harmony export */ });
1176
- /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
1187
+ /* harmony import */ var _claimedKeyEvents__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
1188
+ /* harmony import */ var _utils_canvasOffset__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(11);
1189
+ /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8);
1177
1190
 
1191
+
1192
+
1193
+ var warnedUnpositionedWrapper = false;
1194
+ /**
1195
+ * Warns once per page when no positioned element sits at or inside the canvas's
1196
+ * nearest scroll container: the overlay then can't scroll with the canvas. Reads only.
1197
+ */
1198
+ function warnIfWrapperUnpositioned(canvas) {
1199
+ if (warnedUnpositionedWrapper)
1200
+ return;
1201
+ // Null when detached (or display:none / fixed); nothing to judge yet.
1202
+ var offsetParent = canvas.offsetParent;
1203
+ if (!offsetParent)
1204
+ return;
1205
+ var scrolls = function (v) { return v === "auto" || v === "scroll" || v === "overlay"; };
1206
+ var scroller = null;
1207
+ var el = canvas.parentElement;
1208
+ // Bounds pathological nesting.
1209
+ var MAX_ANCESTOR_WALK = 32;
1210
+ for (var i = 0; el && el !== document.documentElement && i < MAX_ANCESTOR_WALK; i++, el = el.parentElement) {
1211
+ var style = getComputedStyle(el);
1212
+ if (scrolls(style.overflowX) || scrolls(style.overflowY)) {
1213
+ scroller = el;
1214
+ break;
1215
+ }
1216
+ }
1217
+ // Only the viewport scrolls: any offsetParent scrolls with the page.
1218
+ if (!scroller || scroller.contains(offsetParent))
1219
+ return;
1220
+ warnedUnpositionedWrapper = true;
1221
+ console.warn('[Rive] Semantics: give the element wrapping the <canvas> "position: relative" (or another positioned value) so the semantic overlay scrolls with the canvas. Without it, screen readers may scroll to stale positions when the canvas is inside a scrolling container.');
1222
+ }
1178
1223
  /**
1179
1224
  * Creates and manages an invisible DOM tree overlaying a Rive canvas. This is for
1180
1225
  * screen readers to discover and interact with the Rive content.
@@ -1192,7 +1237,7 @@ __webpack_require__.r(__webpack_exports__);
1192
1237
  var AccessibilityOverlay = /** @class */ (function () {
1193
1238
  function AccessibilityOverlay(options) {
1194
1239
  var _this = this;
1195
- var _a;
1240
+ var _a, _b;
1196
1241
  this.elements = new Map();
1197
1242
  /** Visually-hidden description spans keyed by node ID, referenced by aria-describedby. */
1198
1243
  this.descElements = new Map();
@@ -1202,6 +1247,8 @@ var AccessibilityOverlay = /** @class */ (function () {
1202
1247
  this.pendingTextGeometry = [];
1203
1248
  /** Last measured box-size|text key per text element, to skip redundant re-measures. */
1204
1249
  this.textGeometryKeys = new WeakMap();
1250
+ /** Node data last passed to applyAttributes per element; see {@link setEditingHostNode}. */
1251
+ this.appliedNodes = new WeakMap();
1205
1252
  this.lastCanvasPositioning = {
1206
1253
  width: -1, height: -1, offsetTop: -1, offsetLeft: -1,
1207
1254
  };
@@ -1214,6 +1261,10 @@ var AccessibilityOverlay = /** @class */ (function () {
1214
1261
  this._geometryDirty = true;
1215
1262
  /** True while reconciling the DOM (reserved for future focus-sync guards). */
1216
1263
  this.isUpdating = false;
1264
+ /** Node whose element the editing host stands in for, or null. */
1265
+ this.editingHostNodeId = null;
1266
+ /** Semantic version last folded into the editing host's decoration. */
1267
+ this.editingHostSemanticVersion = -1;
1217
1268
  /**
1218
1269
  * Single child div of the overlay container that carries the artboard→CSS
1219
1270
  * transform. All semantic node elements are children of this div and express
@@ -1238,9 +1289,116 @@ var AccessibilityOverlay = /** @class */ (function () {
1238
1289
  this.canvas = options.canvas;
1239
1290
  this.semanticsOptions = options.semanticsOptions;
1240
1291
  this.allowFocusInterrupt = (_a = options.allowFocusInterrupt) !== null && _a !== void 0 ? _a : false;
1292
+ this.isEditingHostFocused = (_b = options.isEditingHostFocused) !== null && _b !== void 0 ? _b : (function () { return false; });
1241
1293
  this.container = this.createContainer(options.canvas);
1242
1294
  this.attachPositionObservers();
1295
+ warnIfWrapperUnpositioned(options.canvas);
1243
1296
  }
1297
+ /**
1298
+ * Hide the stood-in node's element (no duplicate textbox for AT); re-derive the previous
1299
+ * one's aria-hidden.
1300
+ */
1301
+ AccessibilityOverlay.prototype.setEditingHostNode = function (nodeId) {
1302
+ if (this.editingHostNodeId === nodeId)
1303
+ return;
1304
+ var previous = this.editingHostNodeId;
1305
+ this.editingHostNodeId = nodeId;
1306
+ if (previous !== null) {
1307
+ var previousEl = this.elements.get(previous);
1308
+ // Re-derive rather than un-hide: the node may have become Hidden mid-session.
1309
+ if (previousEl) {
1310
+ var previousNode = this.appliedNodes.get(previousEl);
1311
+ if (previousNode && this.isAriaHidden(previousNode)) {
1312
+ setAttr(previousEl, "aria-hidden", "true");
1313
+ }
1314
+ else {
1315
+ removeAttr(previousEl, "aria-hidden");
1316
+ }
1317
+ }
1318
+ }
1319
+ if (nodeId !== null) {
1320
+ var el = this.elements.get(nodeId);
1321
+ if (el)
1322
+ setAttr(el, "aria-hidden", "true");
1323
+ }
1324
+ };
1325
+ /**
1326
+ * Describe the focused text field on the host and hide its element; no-op unless
1327
+ * semantics changed.
1328
+ * @param force - apply even if semantics are unchanged (session start).
1329
+ */
1330
+ AccessibilityOverlay.prototype.syncEditingHost = function (tree, host, force) {
1331
+ var _a;
1332
+ if (!force && tree.semanticVersion === this.editingHostSemanticVersion)
1333
+ return;
1334
+ this.editingHostSemanticVersion = tree.semanticVersion;
1335
+ var node = tree.focusedNode();
1336
+ if (node === undefined || node.role !== _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField) {
1337
+ // Nothing to describe; drop the stale description rather than misname the host.
1338
+ if (this.editingHostNodeId !== null) {
1339
+ host.resetDecoration();
1340
+ this.setEditingHostNode(null);
1341
+ }
1342
+ return;
1343
+ }
1344
+ // Every key is passed on every call, nulls included, so nothing survives from
1345
+ // the previously described field.
1346
+ host.setSecure((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(node.stateFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Obscured));
1347
+ host.decorate({
1348
+ "aria-label": node.label || null,
1349
+ "aria-readonly": (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(node.stateFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.ReadOnly) ? "true" : null,
1350
+ "aria-multiline": (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(node.stateFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Multiline) ? "true" : null,
1351
+ // Trait-gated to match applyAttributes.
1352
+ "aria-required": (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(node.traitFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Requirable) &&
1353
+ (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(node.stateFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Required)
1354
+ ? "true"
1355
+ : null,
1356
+ // The hint span applyAttributes maintains (update() runs earlier in the frame).
1357
+ "aria-describedby": (node.hint && ((_a = this.descElements.get(node.id)) === null || _a === void 0 ? void 0 : _a.id)) || null,
1358
+ });
1359
+ this.setEditingHostNode(node.id);
1360
+ };
1361
+ /** True while the editing host stands in for a node's element. */
1362
+ AccessibilityOverlay.prototype.hasEditingHost = function () {
1363
+ return this.editingHostNodeId !== null;
1364
+ };
1365
+ /**
1366
+ * Undo the stand-in; if the host still has DOM focus, move it to the focused node's
1367
+ * element so AT announces it.
1368
+ */
1369
+ AccessibilityOverlay.prototype.releaseEditingHost = function (tree, host) {
1370
+ var _a;
1371
+ host === null || host === void 0 ? void 0 : host.resetDecoration();
1372
+ this.setEditingHostNode(null);
1373
+ this.editingHostSemanticVersion = -1;
1374
+ if (!(host === null || host === void 0 ? void 0 : host.hasDomFocus()))
1375
+ return;
1376
+ var focusedNodeId = (_a = tree === null || tree === void 0 ? void 0 : tree.focusedNode()) === null || _a === void 0 ? void 0 : _a.id;
1377
+ if (focusedNodeId !== undefined)
1378
+ this.focusNodeElement(focusedNodeId);
1379
+ };
1380
+ /** Move DOM focus onto a node's element. No-op for a node with no element. */
1381
+ AccessibilityOverlay.prototype.focusNodeElement = function (nodeId) {
1382
+ var el = this.elements.get(nodeId);
1383
+ if (!el)
1384
+ return;
1385
+ this.focusElementInPlace(el);
1386
+ };
1387
+ // The overlay is positioned outside the canvas's scroll chain, so a plain focus()
1388
+ // would scroll the root instead; scroll the canvas into view through its real ancestors.
1389
+ AccessibilityOverlay.prototype.focusElementInPlace = function (el) {
1390
+ var _a, _b;
1391
+ this.syncContainerBeforeFocus();
1392
+ el.focus({ preventScroll: true });
1393
+ (_b = (_a = this.canvas).scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, {
1394
+ block: "nearest",
1395
+ inline: "nearest",
1396
+ behavior: "instant",
1397
+ });
1398
+ // The scroll moved the canvas; re-align now rather than after the observer throttle.
1399
+ this.syncContainerGeometry();
1400
+ this.observePosition();
1401
+ };
1244
1402
  AccessibilityOverlay.prototype.getSemanticOverlayContainer = function () {
1245
1403
  return this.container;
1246
1404
  };
@@ -1318,15 +1476,16 @@ var AccessibilityOverlay = /** @class */ (function () {
1318
1476
  _this.observePosition();
1319
1477
  }, 500); // Throttle to avoid rapid style recalculations
1320
1478
  };
1479
+ /** Returns true when the container's size changed (node transforms need recomputing). */
1321
1480
  AccessibilityOverlay.prototype.syncContainerGeometry = function () {
1322
1481
  var rect = this.canvas.getBoundingClientRect();
1323
- var top = this.canvas.offsetTop;
1324
- var left = this.canvas.offsetLeft;
1325
- if (rect.width === this.lastCanvasPositioning.width &&
1326
- rect.height === this.lastCanvasPositioning.height &&
1482
+ var _a = (0,_utils_canvasOffset__WEBPACK_IMPORTED_MODULE_1__.canvasOffset)(this.canvas), top = _a.top, left = _a.left;
1483
+ var sizeChanged = rect.width !== this.lastCanvasPositioning.width ||
1484
+ rect.height !== this.lastCanvasPositioning.height;
1485
+ if (!sizeChanged &&
1327
1486
  top === this.lastCanvasPositioning.offsetTop &&
1328
1487
  left === this.lastCanvasPositioning.offsetLeft)
1329
- return;
1488
+ return false;
1330
1489
  this.container.style.top = top + "px";
1331
1490
  this.container.style.left = left + "px";
1332
1491
  this.container.style.width = rect.width + "px";
@@ -1336,6 +1495,16 @@ var AccessibilityOverlay = /** @class */ (function () {
1336
1495
  this.lastCanvasPositioning.height = rect.height;
1337
1496
  this.lastCanvasPositioning.offsetTop = top;
1338
1497
  this.lastCanvasPositioning.offsetLeft = left;
1498
+ return sizeChanged;
1499
+ };
1500
+ /**
1501
+ * Re-align the container right before focusing one of its elements. The position
1502
+ * observer re-syncs after scrolling on a throttle; focusing an element while the
1503
+ * container is stale would make the browser scroll the page to where it sits.
1504
+ */
1505
+ AccessibilityOverlay.prototype.syncContainerBeforeFocus = function () {
1506
+ if (this.syncContainerGeometry())
1507
+ this._geometryDirty = true;
1339
1508
  };
1340
1509
  AccessibilityOverlay.prototype.createContainer = function (canvas) {
1341
1510
  var _a, _b;
@@ -1345,10 +1514,13 @@ var AccessibilityOverlay = /** @class */ (function () {
1345
1514
  container.setAttribute("aria-label", (_b = (_a = this.semanticsOptions) === null || _a === void 0 ? void 0 : _a.riveCanvasLabel) !== null && _b !== void 0 ? _b : "Rive animation");
1346
1515
  // Size to the canvas's CSS layout box, not the parent container.
1347
1516
  var rect = canvas.getBoundingClientRect();
1517
+ var _c = (0,_utils_canvasOffset__WEBPACK_IMPORTED_MODULE_1__.canvasOffset)(this.canvas), top = _c.top, left = _c.left;
1348
1518
  container.style.cssText = [
1349
1519
  "position:absolute",
1350
- "top:".concat(canvas.offsetTop, "px"),
1351
- "left:".concat(canvas.offsetLeft, "px"),
1520
+ "top:".concat(top, "px"),
1521
+ "left:".concat(left, "px"),
1522
+ "line-height:normal",
1523
+ "font-size:16px",
1352
1524
  "width:".concat(rect.width, "px"),
1353
1525
  "height:".concat(rect.height, "px"),
1354
1526
  "overflow:hidden",
@@ -1525,8 +1697,8 @@ var AccessibilityOverlay = /** @class */ (function () {
1525
1697
  // The cheap trait/state flag checks gate the (per-node) DOM queries below,
1526
1698
  // so the activeElement/closest/contains walks only run for a node that is
1527
1699
  // actually focusable + focused — not for every node on every frame.
1528
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(nodeData.traitFlags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Focusable) &&
1529
- (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(nodeData.stateFlags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Focused)) {
1700
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(nodeData.traitFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Focusable) &&
1701
+ (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(nodeData.stateFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Focused)) {
1530
1702
  var active = document.activeElement;
1531
1703
  // While focus is inside one of our modal dialogs, don't pull it back
1532
1704
  // out to a background node.
@@ -1534,8 +1706,16 @@ var AccessibilityOverlay = /** @class */ (function () {
1534
1706
  var trappedByModal = !!focusedModal &&
1535
1707
  this.container.contains(focusedModal) &&
1536
1708
  !focusedModal.contains(el);
1537
- if (active !== el && !trappedByModal && this.canMoveFocus()) {
1538
- el.focus();
1709
+ // Not while the proxy has focus (would steal the caret, drop the keyboard) nor onto
1710
+ // its aria-hidden stand-in.
1711
+ if (nodeId !== this.editingHostNodeId &&
1712
+ active !== el &&
1713
+ !trappedByModal &&
1714
+ !this.isEditingHostFocused() &&
1715
+ this.canMoveFocus()) {
1716
+ // No scrollIntoView: this runs on semantic diffs and must not drag the page.
1717
+ this.syncContainerBeforeFocus();
1718
+ el.focus({ preventScroll: true });
1539
1719
  }
1540
1720
  }
1541
1721
  // Recurse into children with this node's absolute artboard position.
@@ -1674,7 +1854,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1674
1854
  var el = document.createElement(tag);
1675
1855
  el.id = "".concat(this.nodeIdPrefix).concat(node.id);
1676
1856
  el.style.cssText = BASE_NODE_STYLE;
1677
- if (node.role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.text) {
1857
+ if (node.role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.text) {
1678
1858
  // The positioned outer div is the AX element
1679
1859
  // VoiceOver uses for its highlight box; an inner <span> carries the text
1680
1860
  // without position:absolute (which would strip the span from VoiceOver's
@@ -1706,7 +1886,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1706
1886
  target = "last";
1707
1887
  if (!target)
1708
1888
  return;
1709
- e.preventDefault();
1889
+ (0,_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_0__.claimKeyEvent)(e);
1710
1890
  var members = opts.members();
1711
1891
  var idx = members.indexOf(el);
1712
1892
  if (idx < 0)
@@ -1717,10 +1897,10 @@ var AccessibilityOverlay = /** @class */ (function () {
1717
1897
  : target === "first" ? members[0]
1718
1898
  : members[n - 1];
1719
1899
  if (next && next !== el) {
1720
- next.focus();
1900
+ _this.focusElementInPlace(next);
1721
1901
  var nextId = _this.nodeIdFromElement(next);
1722
1902
  if (nextId !== null)
1723
- _this.fireAction(nextId, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticActionType.tap);
1903
+ _this.fireAction(nextId, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType.tap);
1724
1904
  }
1725
1905
  });
1726
1906
  };
@@ -1730,31 +1910,31 @@ var AccessibilityOverlay = /** @class */ (function () {
1730
1910
  var nodeId = node.id;
1731
1911
  if (isClickableRole(role)) {
1732
1912
  el.addEventListener("click", function () {
1733
- _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticActionType.tap);
1913
+ _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType.tap);
1734
1914
  });
1735
1915
  // Links activate on Enter only (Space scrolls the page per browser
1736
1916
  // convention). All other clickable roles accept both Enter and Space.
1737
- var activationKeys_1 = role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link ? ["Enter"] : ["Enter", " "];
1917
+ var activationKeys_1 = role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link ? ["Enter"] : ["Enter", " "];
1738
1918
  el.addEventListener("keydown", function (e) {
1739
1919
  if (activationKeys_1.includes(e.key)) {
1740
- e.preventDefault();
1741
- _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticActionType.tap);
1920
+ (0,_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_0__.claimKeyEvent)(e);
1921
+ _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType.tap);
1742
1922
  }
1743
1923
  });
1744
1924
  }
1745
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.slider) {
1925
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.slider) {
1746
1926
  el.addEventListener("keydown", function (e) {
1747
1927
  if (e.key === "ArrowRight" || e.key === "ArrowUp") {
1748
- e.preventDefault();
1749
- _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticActionType.increase);
1928
+ (0,_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_0__.claimKeyEvent)(e);
1929
+ _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType.increase);
1750
1930
  }
1751
1931
  else if (e.key === "ArrowLeft" || e.key === "ArrowDown") {
1752
- e.preventDefault();
1753
- _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticActionType.decrease);
1932
+ (0,_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_0__.claimKeyEvent)(e);
1933
+ _this.fireAction(nodeId, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticActionType.decrease);
1754
1934
  }
1755
1935
  });
1756
1936
  }
1757
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab) {
1937
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab) {
1758
1938
  this.attachRovingNav(el, {
1759
1939
  includeHomeEnd: true,
1760
1940
  members: function () {
@@ -1767,7 +1947,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1767
1947
  },
1768
1948
  });
1769
1949
  }
1770
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton) {
1950
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioButton) {
1771
1951
  this.attachRovingNav(el, {
1772
1952
  includeHomeEnd: false,
1773
1953
  members: function () {
@@ -1782,15 +1962,31 @@ var AccessibilityOverlay = /** @class */ (function () {
1782
1962
  // Focus handler for nodes with the Focusable trait. When AT focuses an
1783
1963
  // element, notify the C++ runtime so it can update internal focus state
1784
1964
  // (visual focus rings, etc.). Gated on Focusable trait
1785
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(node.traitFlags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Focusable)) {
1965
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(node.traitFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Focusable)) {
1786
1966
  el.addEventListener("focus", function () {
1787
1967
  _this.requestFocus(nodeId);
1788
1968
  });
1789
1969
  }
1790
1970
  };
1791
1971
  // ---- Attribute application ----
1972
+ AccessibilityOverlay.prototype.isAriaHidden = function (node) {
1973
+ var role = node.role;
1974
+ var flags = node.stateFlags;
1975
+ // Hide from AT when explicitly hidden, or when an image has no accessible
1976
+ // name — a nameless role="img" is a WCAG 1.1.1 violation; treat it as
1977
+ // decorative instead.
1978
+ var isDecorativeImage = role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.image && !node.label;
1979
+ // The <input> proxy is the accessible element for the node it stands in for.
1980
+ var isEditingHostStandIn = node.id === this.editingHostNodeId;
1981
+ return ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Hidden) ||
1982
+ // Obscured text fields stay reachable (value withheld, like a native password input).
1983
+ ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Obscured) && role !== _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField) ||
1984
+ isDecorativeImage ||
1985
+ isEditingHostStandIn);
1986
+ };
1792
1987
  AccessibilityOverlay.prototype.applyAttributes = function (el, node) {
1793
1988
  var _a, _b, _c;
1989
+ this.appliedNodes.set(el, node);
1794
1990
  var role = node.role;
1795
1991
  var flags = node.stateFlags;
1796
1992
  var traits = node.traitFlags;
@@ -1804,7 +2000,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1804
2000
  }
1805
2001
  // Links: a bare <a> with no href has no link semantics, so set the role
1806
2002
  // explicitly (ariaRoleForSemantic returns null for link → native <a>).
1807
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link) {
2003
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link) {
1808
2004
  setAttr(el, "role", "link");
1809
2005
  }
1810
2006
  // Tabindex — keep the screen-reader overlay out of the browser's sequential
@@ -1812,8 +2008,8 @@ var AccessibilityOverlay = /** @class */ (function () {
1812
2008
  // so AT/runtime focus sync can still target them when needed. List items are
1813
2009
  // included because Mobile Safari won't iterate them otherwise.
1814
2010
  if (isInteractiveRole(role) ||
1815
- (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Focusable) ||
1816
- role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.listItem) {
2011
+ (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Focusable) ||
2012
+ role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.listItem) {
1817
2013
  setAttr(el, "tabindex", "-1");
1818
2014
  }
1819
2015
  else {
@@ -1826,7 +2022,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1826
2022
  else {
1827
2023
  removeAttr(el, "aria-label");
1828
2024
  }
1829
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.slider) {
2025
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.slider) {
1830
2026
  if (node.value) {
1831
2027
  // aria-valuenow must be numeric; keep the display string (e.g. "75%")
1832
2028
  // in aria-valuetext only.
@@ -1846,7 +2042,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1846
2042
  // TODO: aria-valuemin / aria-valuemax are required by ARIA.
1847
2043
  // Defaulting to horizontal; vertical sliders need orientation data from C++.
1848
2044
  setAttr(el, "aria-orientation", "horizontal");
1849
- setBoolAttr(el, "aria-readonly", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.ReadOnly));
2045
+ setBoolAttr(el, "aria-readonly", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.ReadOnly));
1850
2046
  }
1851
2047
  else {
1852
2048
  removeAttr(el, "aria-valuenow");
@@ -1880,7 +2076,7 @@ var AccessibilityOverlay = /** @class */ (function () {
1880
2076
  // Text nodes: use textContent rather than aria-label so screen readers
1881
2077
  // announce the text in virtual/browse mode (aria-label on a bare <span>
1882
2078
  // with no widget role is ignored by some AT in document browse mode).
1883
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.text) {
2079
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.text) {
1884
2080
  var textSpan = (_a = el.querySelector(":scope > span")) !== null && _a !== void 0 ? _a : el;
1885
2081
  var text = (_b = node.label) !== null && _b !== void 0 ? _b : "";
1886
2082
  if (textSpan.textContent !== text)
@@ -1900,77 +2096,73 @@ var AccessibilityOverlay = /** @class */ (function () {
1900
2096
  // Only set the ARIA property when the trait is present. When the trait
1901
2097
  // is absent, remove the attribute so AT sees "not applicable" rather
1902
2098
  // than "false".
1903
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Expandable) && ARIA_EXPANDED_ROLES.has(role)) {
1904
- setBoolAttr(el, "aria-expanded", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Expanded));
2099
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Expandable) && ARIA_EXPANDED_ROLES.has(role)) {
2100
+ setBoolAttr(el, "aria-expanded", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Expanded));
1905
2101
  }
1906
2102
  else {
1907
2103
  removeAttr(el, "aria-expanded");
1908
2104
  }
1909
2105
  // aria-selected is required on ALL tabs per ARIA spec regardless of trait;
1910
2106
  // for other roles it is trait-gated and guarded to ARIA_SELECTED_ROLES.
1911
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab) {
1912
- setBoolAttr(el, "aria-selected", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Selected));
2107
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab) {
2108
+ setBoolAttr(el, "aria-selected", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Selected));
1913
2109
  }
1914
- else if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Selectable) && ARIA_SELECTED_ROLES.has(role)) {
1915
- setBoolAttr(el, "aria-selected", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Selected));
2110
+ else if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Selectable) && ARIA_SELECTED_ROLES.has(role)) {
2111
+ setBoolAttr(el, "aria-selected", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Selected));
1916
2112
  }
1917
2113
  else {
1918
2114
  removeAttr(el, "aria-selected");
1919
2115
  }
1920
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Checkable) && ARIA_CHECKED_ROLES.has(role)) {
2116
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Checkable) && ARIA_CHECKED_ROLES.has(role)) {
1921
2117
  // Check state is a tri-state field, but not every checkable role
1922
2118
  // accepts all three values — see ARIA_MIXED_ROLES.
1923
- var checkState = (0,_types__WEBPACK_IMPORTED_MODULE_0__.checkStateOf)(flags);
1924
- if (checkState === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticCheckState.Mixed &&
2119
+ var checkState = (0,_types__WEBPACK_IMPORTED_MODULE_2__.checkStateOf)(flags);
2120
+ if (checkState === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticCheckState.Mixed &&
1925
2121
  ARIA_MIXED_ROLES.has(role)) {
1926
2122
  setAttr(el, "aria-checked", "mixed");
1927
2123
  }
1928
2124
  else {
1929
- setBoolAttr(el, "aria-checked", checkState === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticCheckState.Checked);
2125
+ setBoolAttr(el, "aria-checked", checkState === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticCheckState.Checked);
1930
2126
  }
1931
2127
  }
1932
2128
  else {
1933
2129
  removeAttr(el, "aria-checked");
1934
2130
  }
1935
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Toggleable)) {
2131
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Toggleable)) {
1936
2132
  if (ARIA_PRESSED_ROLES.has(role)) {
1937
- setBoolAttr(el, "aria-pressed", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Toggled));
2133
+ setBoolAttr(el, "aria-pressed", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Toggled));
1938
2134
  }
1939
2135
  else {
1940
2136
  removeAttr(el, "aria-pressed");
1941
2137
  }
1942
2138
  // switch uses aria-checked (not aria-pressed) for its on/off state.
1943
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl) {
1944
- setBoolAttr(el, "aria-checked", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Toggled));
2139
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.switchControl) {
2140
+ setBoolAttr(el, "aria-checked", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Toggled));
1945
2141
  }
1946
2142
  }
1947
2143
  else {
1948
2144
  removeAttr(el, "aria-pressed");
1949
2145
  }
1950
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Requirable) && ARIA_REQUIRED_ROLES.has(role)) {
1951
- setBoolAttr(el, "aria-required", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Required));
2146
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Requirable) && ARIA_REQUIRED_ROLES.has(role)) {
2147
+ setBoolAttr(el, "aria-required", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Required));
1952
2148
  }
1953
2149
  else {
1954
2150
  removeAttr(el, "aria-required");
1955
2151
  }
1956
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Enablable)) {
1957
- setBoolAttr(el, "aria-disabled", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Disabled));
2152
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(traits, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Enablable)) {
2153
+ setBoolAttr(el, "aria-disabled", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Disabled));
1958
2154
  }
1959
2155
  else {
1960
2156
  removeAttr(el, "aria-disabled");
1961
2157
  }
1962
2158
  // ---- Non-trait states ----
1963
- // Hide from AT when explicitly hidden, or when an image has no accessible
1964
- // name — a nameless role="img" is a WCAG 1.1.1 violation; treat it as
1965
- // decorative instead.
1966
- var isDecorativeImage = role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.image && !node.label;
1967
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Hidden) || (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Obscured) || isDecorativeImage) {
2159
+ if (this.isAriaHidden(node)) {
1968
2160
  setAttr(el, "aria-hidden", "true");
1969
2161
  }
1970
2162
  else {
1971
2163
  removeAttr(el, "aria-hidden");
1972
2164
  }
1973
- if ((0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.LiveRegion)) {
2165
+ if ((0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.LiveRegion)) {
1974
2166
  setAttr(el, "aria-live", "polite");
1975
2167
  }
1976
2168
  else {
@@ -1978,17 +2170,26 @@ var AccessibilityOverlay = /** @class */ (function () {
1978
2170
  }
1979
2171
  // textField-specific
1980
2172
  // TODO: Details here may change once we implement text inputs
1981
- if (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.textField) {
1982
- setBoolAttr(el, "aria-readonly", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.ReadOnly));
1983
- setBoolAttr(el, "aria-multiline", (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Multiline));
2173
+ if (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField) {
2174
+ setBoolAttr(el, "aria-readonly", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.ReadOnly));
2175
+ setBoolAttr(el, "aria-multiline", (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Multiline));
1984
2176
  // Surface the current field value as DOM text so screen readers can
1985
2177
  // announce it. Only safe when the node has no semantic children —
1986
2178
  // setting textContent would remove any child elements from the DOM.
1987
2179
  if (node.children.length === 0) {
1988
- var value = (_c = node.value) !== null && _c !== void 0 ? _c : "";
2180
+ var value = (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Obscured) ? "" : ((_c = node.value) !== null && _c !== void 0 ? _c : "");
1989
2181
  if (el.textContent !== value)
1990
2182
  el.textContent = value;
1991
2183
  }
2184
+ else {
2185
+ // A value rendered earlier (before the node had children) must not linger,
2186
+ // least of all once the field turns Obscured.
2187
+ for (var _i = 0, _d = Array.from(el.childNodes); _i < _d.length; _i++) {
2188
+ var child = _d[_i];
2189
+ if (child.nodeType === Node.TEXT_NODE)
2190
+ child.remove();
2191
+ }
2192
+ }
1992
2193
  }
1993
2194
  else {
1994
2195
  removeAttr(el, "aria-multiline");
@@ -2052,7 +2253,7 @@ var AccessibilityOverlay = /** @class */ (function () {
2052
2253
  // Clear any CSS transform from a previous render pass.
2053
2254
  if (el.style.transform)
2054
2255
  el.style.transform = "";
2055
- if (node.role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.text) {
2256
+ if (node.role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.text) {
2056
2257
  this.pendingTextGeometry.push(el);
2057
2258
  }
2058
2259
  };
@@ -2111,7 +2312,8 @@ var AccessibilityOverlay = /** @class */ (function () {
2111
2312
  * Creates (on first call) and updates the artboard-space transform container.
2112
2313
  *
2113
2314
  * The container is sized to the artboard dimensions and carries a CSS
2114
- * `transform: matrix(...)` equivalent to `forwardMat / dpr`. All semantic
2315
+ * `transform: matrix(...)` that maps artboard coordinates to the canvas's CSS box
2316
+ * (forwardMat in backing-store pixels, scaled by CSS size / backing-store size). All semantic
2115
2317
  * node elements are children of this container and use raw artboard
2116
2318
  * coordinates as their CSS `left/top/width/height`, so the CSS compositor
2117
2319
  * applies the artboard→screen mapping in one pass.
@@ -2136,13 +2338,20 @@ var AccessibilityOverlay = /** @class */ (function () {
2136
2338
  var h = artboardBounds.maxY - artboardBounds.minY;
2137
2339
  this.transformContainer.style.width = Math.round(w) + "px";
2138
2340
  this.transformContainer.style.height = Math.round(h) + "px";
2139
- var s = 1 / (dpr || 1);
2140
- var a = forwardMat.xx * s;
2141
- var b = forwardMat.xy * s;
2142
- var c = forwardMat.yx * s;
2143
- var d = forwardMat.yy * s;
2144
- var tx = forwardMat.tx * s;
2145
- var ty = forwardMat.ty * s;
2341
+ // Backing-store pixels → CSS pixels. Measured rather than 1/dpr: a canvas can be
2342
+ // stretched by CSS, or have a stale backing store after a resize, and the drawn
2343
+ // content follows the CSS box either way. Equal to 1/dpr when they match.
2344
+ var cssWidth = this.lastCanvasPositioning.width;
2345
+ var cssHeight = this.lastCanvasPositioning.height;
2346
+ var fallback = 1 / (dpr || 1);
2347
+ var sx = this.canvas.width > 0 && cssWidth > 0 ? cssWidth / this.canvas.width : fallback;
2348
+ var sy = this.canvas.height > 0 && cssHeight > 0 ? cssHeight / this.canvas.height : fallback;
2349
+ var a = forwardMat.xx * sx;
2350
+ var b = forwardMat.xy * sy;
2351
+ var c = forwardMat.yx * sx;
2352
+ var d = forwardMat.yy * sy;
2353
+ var tx = forwardMat.tx * sx;
2354
+ var ty = forwardMat.ty * sy;
2146
2355
  this.transformContainer.style.transform =
2147
2356
  "matrix(".concat(a, ",").concat(b, ",").concat(c, ",").concat(d, ",").concat(tx, ",").concat(ty, ")");
2148
2357
  };
@@ -2165,11 +2374,11 @@ var AccessibilityOverlay = /** @class */ (function () {
2165
2374
  // ---------------------------------------------------------------------------
2166
2375
  /** aria-expanded: button, link, checkbox, switch (inherits button), tab. */
2167
2376
  var ARIA_EXPANDED_ROLES = new Set([
2168
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.button,
2169
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link,
2170
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox,
2171
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl,
2172
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab,
2377
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.button,
2378
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link,
2379
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox,
2380
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.switchControl,
2381
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab,
2173
2382
  ]);
2174
2383
  /**
2175
2384
  * aria-selected: tab is the only role in our current set that natively
@@ -2178,13 +2387,13 @@ var ARIA_EXPANDED_ROLES = new Set([
2178
2387
  * the set still lists it so the constraint is visible in one place.
2179
2388
  */
2180
2389
  var ARIA_SELECTED_ROLES = new Set([
2181
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab,
2390
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab,
2182
2391
  ]);
2183
2392
  /** aria-checked: checkbox, radio, switch. */
2184
2393
  var ARIA_CHECKED_ROLES = new Set([
2185
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox,
2186
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton,
2187
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl,
2394
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox,
2395
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioButton,
2396
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.switchControl,
2188
2397
  ]);
2189
2398
  /**
2190
2399
  * aria-checked="mixed": checkbox only. ARIA defines checkbox as three-valued
@@ -2193,7 +2402,7 @@ var ARIA_CHECKED_ROLES = new Set([
2193
2402
  * emitting a value they do not support.
2194
2403
  */
2195
2404
  var ARIA_MIXED_ROLES = new Set([
2196
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox,
2405
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox,
2197
2406
  ]);
2198
2407
  /**
2199
2408
  * aria-pressed: button only. switch is a button subclass in ARIA but uses
@@ -2201,13 +2410,13 @@ var ARIA_MIXED_ROLES = new Set([
2201
2410
  * excluded here and handled separately in the Toggleable block.
2202
2411
  */
2203
2412
  var ARIA_PRESSED_ROLES = new Set([
2204
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.button,
2413
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.button,
2205
2414
  ]);
2206
2415
  /** aria-required: checkbox, textbox, radiogroup. */
2207
2416
  var ARIA_REQUIRED_ROLES = new Set([
2208
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox,
2209
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.textField,
2210
- _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioGroup,
2417
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox,
2418
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField,
2419
+ _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioGroup,
2211
2420
  ]);
2212
2421
  // ---------------------------------------------------------------------------
2213
2422
  /** Style for visually-hidden description spans used with aria-describedby. */
@@ -2256,12 +2465,12 @@ function setBoolAttr(el, attr, value) {
2256
2465
  /** Roles that receive click/Enter/Space action handlers. */
2257
2466
  function isClickableRole(role) {
2258
2467
  switch (role) {
2259
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.button:
2260
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link:
2261
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox:
2262
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl:
2263
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab:
2264
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton:
2468
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.button:
2469
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link:
2470
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox:
2471
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.switchControl:
2472
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab:
2473
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioButton:
2265
2474
  return true;
2266
2475
  default:
2267
2476
  return false;
@@ -2270,14 +2479,14 @@ function isClickableRole(role) {
2270
2479
  /** Roles that receive tabindex="-1" for programmatic/AT focus (not Tab order). */
2271
2480
  function isInteractiveRole(role) {
2272
2481
  switch (role) {
2273
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.button:
2274
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link:
2275
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox:
2276
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl:
2277
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.slider:
2278
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab:
2279
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton:
2280
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.textField:
2482
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.button:
2483
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link:
2484
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox:
2485
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.switchControl:
2486
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.slider:
2487
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab:
2488
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioButton:
2489
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField:
2281
2490
  return true;
2282
2491
  default:
2283
2492
  return false;
@@ -2288,13 +2497,13 @@ function isInteractiveRole(role) {
2288
2497
  * dialog only when the Modal state flag is set.
2289
2498
  */
2290
2499
  function isModalDialogRole(role, flags) {
2291
- return (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.alertDialog ||
2292
- (role === _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.dialog && (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticState.Modal)));
2500
+ return (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.alertDialog ||
2501
+ (role === _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.dialog && (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasState)(flags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticState.Modal)));
2293
2502
  }
2294
2503
  /** Whether a node can receive focus: an interactive role or the Focusable trait. */
2295
2504
  function isFocusableNode(node) {
2296
2505
  return (isInteractiveRole(node.role) ||
2297
- (0,_types__WEBPACK_IMPORTED_MODULE_0__.hasTrait)(node.traitFlags, _types__WEBPACK_IMPORTED_MODULE_0__.SemanticTrait.Focusable));
2506
+ (0,_types__WEBPACK_IMPORTED_MODULE_2__.hasTrait)(node.traitFlags, _types__WEBPACK_IMPORTED_MODULE_2__.SemanticTrait.Focusable));
2298
2507
  }
2299
2508
  /**
2300
2509
  * Choose an HTML tag for a given role. Prefer native semantic elements
@@ -2303,9 +2512,9 @@ function isFocusableNode(node) {
2303
2512
  */
2304
2513
  function tagForRole(role) {
2305
2514
  switch (role) {
2306
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link:
2515
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link:
2307
2516
  return "a";
2308
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.text:
2517
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.text:
2309
2518
  // The outer div is the positioned AX element VoiceOver measures for its
2310
2519
  // highlight box. The text itself lives in a child <span> (see createElement).
2311
2520
  return "div";
@@ -2321,43 +2530,43 @@ function tagForRole(role) {
2321
2530
  */
2322
2531
  function ariaRoleForSemantic(role) {
2323
2532
  switch (role) {
2324
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.none:
2533
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.none:
2325
2534
  // TODO: Role "none" removes the node from the accessibility tree. For now, setting to Group, but maybe we want to switch to "none"
2326
2535
  // or "presentation".
2327
2536
  return "group";
2328
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.button:
2537
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.button:
2329
2538
  return "button";
2330
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.link:
2539
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.link:
2331
2540
  return null; // native <a>
2332
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.checkbox:
2541
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.checkbox:
2333
2542
  return "checkbox";
2334
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.switchControl:
2543
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.switchControl:
2335
2544
  return "switch";
2336
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.slider:
2545
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.slider:
2337
2546
  return "slider";
2338
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.textField:
2547
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField:
2339
2548
  return "textbox";
2340
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.image:
2549
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.image:
2341
2550
  return "img";
2342
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.group:
2551
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.group:
2343
2552
  return "group";
2344
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.list:
2553
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.list:
2345
2554
  return "list";
2346
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.listItem:
2555
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.listItem:
2347
2556
  return "listitem";
2348
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tab:
2557
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tab:
2349
2558
  return "tab";
2350
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.tabList:
2559
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.tabList:
2351
2560
  return "tablist";
2352
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.dialog:
2561
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.dialog:
2353
2562
  return "dialog";
2354
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.alertDialog:
2563
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.alertDialog:
2355
2564
  return "alertdialog";
2356
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioGroup:
2565
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioGroup:
2357
2566
  return "radiogroup";
2358
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.radioButton:
2567
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.radioButton:
2359
2568
  return "radio";
2360
- case _types__WEBPACK_IMPORTED_MODULE_0__.SemanticRole.text:
2569
+ case _types__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.text:
2361
2570
  // Text nodes use <span>; heading role is applied separately
2362
2571
  // when headingLevel > 0.
2363
2572
  return null;
@@ -2371,6 +2580,56 @@ function ariaRoleForSemantic(role) {
2371
2580
  /* 10 */
2372
2581
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2373
2582
 
2583
+ __webpack_require__.r(__webpack_exports__);
2584
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2585
+ /* harmony export */ claimKeyEvent: () => (/* binding */ claimKeyEvent),
2586
+ /* harmony export */ isKeyEventClaimed: () => (/* binding */ isKeyEventClaimed)
2587
+ /* harmony export */ });
2588
+ var claimed = new WeakSet();
2589
+ /**
2590
+ * Marks a key event as handled by a semantic overlay widget (and prevents its
2591
+ * default), so the Rive keyboard handler leaves it alone. A plain
2592
+ * `defaultPrevented` check can't tell these apart from host-page handlers.
2593
+ */
2594
+ function claimKeyEvent(event) {
2595
+ event.preventDefault();
2596
+ claimed.add(event);
2597
+ }
2598
+ function isKeyEventClaimed(event) {
2599
+ return claimed.has(event);
2600
+ }
2601
+
2602
+
2603
+ /***/ }),
2604
+ /* 11 */
2605
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2606
+
2607
+ __webpack_require__.r(__webpack_exports__);
2608
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2609
+ /* harmony export */ canvasOffset: () => (/* binding */ canvasOffset)
2610
+ /* harmony export */ });
2611
+ /**
2612
+ * Canvas offset within its offsetParent, minus the scroll of ancestors in between (they
2613
+ * move the canvas, not absolutely positioned siblings).
2614
+ */
2615
+ function canvasOffset(canvas) {
2616
+ var top = canvas.offsetTop;
2617
+ var left = canvas.offsetLeft;
2618
+ var offsetParent = canvas.offsetParent;
2619
+ if (!offsetParent)
2620
+ return { top: top, left: left };
2621
+ for (var el = canvas.parentElement; el && el !== offsetParent; el = el.parentElement) {
2622
+ top -= el.scrollTop;
2623
+ left -= el.scrollLeft;
2624
+ }
2625
+ return { top: top, left: left };
2626
+ }
2627
+
2628
+
2629
+ /***/ }),
2630
+ /* 12 */
2631
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2632
+
2374
2633
  __webpack_require__.r(__webpack_exports__);
2375
2634
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2376
2635
  /* harmony export */ AudioAssetWrapper: () => (/* reexport safe */ _finalizationRegistry__WEBPACK_IMPORTED_MODULE_3__.AudioAssetWrapper),
@@ -2391,11 +2650,11 @@ __webpack_require__.r(__webpack_exports__);
2391
2650
  /* harmony export */ registerTouchInteractions: () => (/* reexport safe */ _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__.registerTouchInteractions),
2392
2651
  /* harmony export */ sanitizeUrl: () => (/* reexport safe */ _sanitizeUrl__WEBPACK_IMPORTED_MODULE_2__.sanitizeUrl)
2393
2652
  /* harmony export */ });
2394
- /* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
2395
- /* harmony import */ var _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
2396
- /* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(13);
2397
- /* harmony import */ var _finalizationRegistry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
2398
- /* harmony import */ var _riveFont__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15);
2653
+ /* harmony import */ var _registerTouchInteractions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13);
2654
+ /* harmony import */ var _registerKeyboardInteractions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(14);
2655
+ /* harmony import */ var _sanitizeUrl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17);
2656
+ /* harmony import */ var _finalizationRegistry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(18);
2657
+ /* harmony import */ var _riveFont__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(19);
2399
2658
 
2400
2659
 
2401
2660
 
@@ -2404,7 +2663,7 @@ __webpack_require__.r(__webpack_exports__);
2404
2663
 
2405
2664
 
2406
2665
  /***/ }),
2407
- /* 11 */
2666
+ /* 13 */
2408
2667
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2409
2668
 
2410
2669
  __webpack_require__.r(__webpack_exports__);
@@ -2483,7 +2742,7 @@ var getClientCoordinates = function (event, isTouchScrollEnabled, enableMultiTou
2483
2742
  * the state machine pointer move/up/down functions based on cursor interaction
2484
2743
  */
2485
2744
  var registerTouchInteractions = function (_a) {
2486
- var canvas = _a.canvas, artboard = _a.artboard, _b = _a.stateMachines, stateMachines = _b === void 0 ? [] : _b, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment, _c = _a.isTouchScrollEnabled, isTouchScrollEnabled = _c === void 0 ? false : _c, _d = _a.dispatchPointerExit, dispatchPointerExit = _d === void 0 ? true : _d, _e = _a.enableMultiTouch, enableMultiTouch = _e === void 0 ? false : _e, _f = _a.layoutScaleFactor, layoutScaleFactor = _f === void 0 ? 1.0 : _f, advanceAndDrain = _a.advanceAndDrain;
2745
+ var canvas = _a.canvas, artboard = _a.artboard, _b = _a.stateMachines, stateMachines = _b === void 0 ? [] : _b, renderer = _a.renderer, rive = _a.rive, fit = _a.fit, alignment = _a.alignment, _c = _a.isTouchScrollEnabled, isTouchScrollEnabled = _c === void 0 ? false : _c, _d = _a.dispatchPointerExit, dispatchPointerExit = _d === void 0 ? true : _d, _e = _a.enableMultiTouch, enableMultiTouch = _e === void 0 ? false : _e, _f = _a.layoutScaleFactor, layoutScaleFactor = _f === void 0 ? 1.0 : _f, advanceAndDrain = _a.advanceAndDrain, summonKeyboard = _a.summonKeyboard, isTextProxyFocused = _a.isTextProxyFocused;
2487
2746
  if (!canvas ||
2488
2747
  !stateMachines.length ||
2489
2748
  !renderer ||
@@ -2503,8 +2762,10 @@ var registerTouchInteractions = function (_a) {
2503
2762
  * We're keeping track of the previous event to not send the synthetic mouse events if the
2504
2763
  * touch event was a click (touchstart -> touchend).
2505
2764
  *
2506
- * This is only needed when `isTouchScrollEnabled` is false
2507
- * When true, `preventDefault()` is called which prevents this behaviour.
2765
+ * Emulated events only occur when `isTouchScrollEnabled` is true; when false,
2766
+ * touchstart is default-prevented, which suppresses them.
2767
+ * Emulated mousedown is prevented while the proxy is focused, or it would blur it and
2768
+ * drop the keyboard.
2508
2769
  **/
2509
2770
  var _prevEventType = null;
2510
2771
  var _syntheticEventsActive = false;
@@ -2521,6 +2782,9 @@ var registerTouchInteractions = function (_a) {
2521
2782
  // https://stackoverflow.com/questions/9656990/how-to-prevent-simulated-mouse-events-in-mobile-browsers
2522
2783
  // https://stackoverflow.com/questions/25572070/javascript-touchend-versus-click-dilemma
2523
2784
  if (_syntheticEventsActive && event instanceof MouseEvent) {
2785
+ if (event.type === "mousedown" && (isTextProxyFocused === null || isTextProxyFocused === void 0 ? void 0 : isTextProxyFocused())) {
2786
+ event.preventDefault();
2787
+ }
2524
2788
  // Synthetic event finished
2525
2789
  if (event.type == "mouseup") {
2526
2790
  _syntheticEventsActive = false;
@@ -2627,7 +2891,7 @@ var registerTouchInteractions = function (_a) {
2627
2891
  _loop_3(stateMachine);
2628
2892
  }
2629
2893
  // Advance the state machine immediately so pointer down(s) takes effect synchronously
2630
- advanceAndDrain(0);
2894
+ advanceAndDrain(0, { pointerDown: true });
2631
2895
  break;
2632
2896
  }
2633
2897
  // Pointer click released on the canvas
@@ -2644,6 +2908,9 @@ var registerTouchInteractions = function (_a) {
2644
2908
  }
2645
2909
  // Advance the state machine immediately so pointer up(s) takes effect synchronously
2646
2910
  advanceAndDrain(0);
2911
+ // Still inside the touch gesture — summon the keyboard if the tap focused a
2912
+ // text input
2913
+ summonKeyboard === null || summonKeyboard === void 0 ? void 0 : summonKeyboard();
2647
2914
  // Release the primary touch lock once that finger lifts so the next
2648
2915
  // touchstart can claim a new primary finger.
2649
2916
  if (!enableMultiTouch &&
@@ -2664,6 +2931,7 @@ var registerTouchInteractions = function (_a) {
2664
2931
  }
2665
2932
  // Advance the state machine immediately so pointer up(s) takes effect synchronously
2666
2933
  advanceAndDrain(0);
2934
+ summonKeyboard === null || summonKeyboard === void 0 ? void 0 : summonKeyboard();
2667
2935
  break;
2668
2936
  }
2669
2937
  default:
@@ -2701,7 +2969,7 @@ var registerTouchInteractions = function (_a) {
2701
2969
 
2702
2970
 
2703
2971
  /***/ }),
2704
- /* 12 */
2972
+ /* 14 */
2705
2973
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2706
2974
 
2707
2975
  __webpack_require__.r(__webpack_exports__);
@@ -2709,6 +2977,43 @@ __webpack_require__.r(__webpack_exports__);
2709
2977
  /* harmony export */ FocusSessionState: () => (/* binding */ FocusSessionState),
2710
2978
  /* harmony export */ KeyboardInteractions: () => (/* binding */ KeyboardInteractions)
2711
2979
  /* harmony export */ });
2980
+ /* harmony import */ var _keyMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15);
2981
+ /* harmony import */ var _semantics_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10);
2982
+ /* harmony import */ var _textInputProxy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
2983
+
2984
+
2985
+
2986
+ /**
2987
+ * Defaults suppressed while typing (scroll/navigate/submit). Tab is traversal's; proxy
2988
+ * Space returns earlier as a printable.
2989
+ */
2990
+ var EDITING_NAV_CODES = new Set([
2991
+ "Space",
2992
+ "ArrowLeft",
2993
+ "ArrowRight",
2994
+ "ArrowUp",
2995
+ "ArrowDown",
2996
+ "Backspace",
2997
+ "Delete",
2998
+ "Home",
2999
+ "End",
3000
+ "Enter",
3001
+ "NumpadEnter",
3002
+ ]);
3003
+ /** A keystroke that types a character (not a Ctrl/Cmd shortcut). */
3004
+ function isPrintable(event) {
3005
+ return event.key.length === 1 && !event.ctrlKey && !event.metaKey;
3006
+ }
3007
+ function isArrowKey(key) {
3008
+ return (key === _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.left || key === _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.right || key === _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.up || key === _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.down);
3009
+ }
3010
+ /**
3011
+ * Alt/Ctrl/Meta arrows are browser/OS shortcuts (Alt+Left = back, Cmd+Arrow, etc.).
3012
+ * Shift is allowed: it is the spatial-navigation chord in Vivaldi/Opera.
3013
+ */
3014
+ function hasShortcutModifier(event) {
3015
+ return event.altKey || event.ctrlKey || event.metaKey;
3016
+ }
2712
3017
  /**
2713
3018
  * Tracks the relationship between DOM focus inside this Rive focus domain (canvas or semantic overlay)
2714
3019
  * and Rive's internal focus for the current focus session.
@@ -2734,7 +3039,8 @@ var FocusSessionState;
2734
3039
  FocusSessionState["RiveFocused"] = "riveFocused";
2735
3040
  })(FocusSessionState || (FocusSessionState = {}));
2736
3041
  /**
2737
- * Manages keyboard and DOM focus interactions for Rive's focus domain (<canvas> or semantic overlay).
3042
+ * Manages keyboard and DOM focus interactions for Rive's focus domain (<canvas>, semantic
3043
+ * overlay, text input proxy). Owns the proxy and the text input session state.
2738
3044
  * Because keyboard events can apply on either part of the domain, we need to track what events we should
2739
3045
  * handle/intercept, and when to release focus back to the page outside of the domain.
2740
3046
  *
@@ -2746,7 +3052,7 @@ var KeyboardInteractions = /** @class */ (function () {
2746
3052
  function KeyboardInteractions(_a) {
2747
3053
  var canvas = _a.canvas, stateMachine = _a.stateMachine, hasFocusNodes = _a.hasFocusNodes, getOverlayElement = _a.getOverlayElement;
2748
3054
  var _this = this;
2749
- var _b;
3055
+ var _b, _c;
2750
3056
  this.focusSessionState = FocusSessionState.NotFocused;
2751
3057
  /** Whether the canvas currently has browser DOM focus. */
2752
3058
  this.canvasHasFocus = false;
@@ -2754,6 +3060,19 @@ var KeyboardInteractions = /** @class */ (function () {
2754
3060
  this.focusDomainReleased = false;
2755
3061
  /** Overlay element currently wired with focusin/keydown listeners, if any. */
2756
3062
  this.currentOverlayElement = null;
3063
+ /** Codes whose keydown an overlay widget took, so their keyup is skipped too. */
3064
+ this.claimedKeyCodes = new Set();
3065
+ this.textInputSessionActive = false;
3066
+ /**
3067
+ * The proxy is always empty: copy Rive's selection; always preventDefault.
3068
+ */
3069
+ this.onCopy = function (event) {
3070
+ var _a;
3071
+ event.preventDefault();
3072
+ var selected = _this.mainSm.selectedText();
3073
+ if (selected)
3074
+ (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData("text/plain", selected);
3075
+ };
2757
3076
  /**
2758
3077
  * Handles the canvas gaining browser focus. The behavior differs based on how focus was gained -
2759
3078
  *
@@ -2769,10 +3088,11 @@ var KeyboardInteractions = /** @class */ (function () {
2769
3088
  _this.syncOverlayListener();
2770
3089
  _this.canvasHasFocus = true;
2771
3090
  _this.focusDomainReleased = false;
2772
- if (!_this.hasFocusNodes)
2773
- return;
2774
- if (_this.mainSm.focusState().hasFocus)
3091
+ if (_this.isInFocusDomain(event.relatedTarget) ||
3092
+ !_this.hasFocusNodes ||
3093
+ _this.mainSm.focusState().hasFocus) {
2775
3094
  return;
3095
+ }
2776
3096
  _this.focusSessionState = FocusSessionState.EntryPending;
2777
3097
  // Pointer focus waits for the user's next Tab (handled in onKeyDown). Keyboard focus enters now.
2778
3098
  if (!_this.isKeyboardDrivenFocus())
@@ -2791,11 +3111,13 @@ var KeyboardInteractions = /** @class */ (function () {
2791
3111
  * When we're not in either of those buckets, it's safe to call `clearFocus()` on the SMI.
2792
3112
  */
2793
3113
  this.onCanvasBlur = function (event) {
3114
+ // Must stay before the state reset because beginTextInputSession sets the session state and
3115
+ // then focuses the proxy, which synchronously blurs the canvas.
3116
+ if (_this.inputProxy.owns(event.relatedTarget))
3117
+ return;
2794
3118
  _this.focusSessionState = FocusSessionState.NotFocused;
2795
3119
  _this.canvasHasFocus = false;
2796
- var movedWithinFocusDomain = _this.isInFocusDomain(event.relatedTarget);
2797
- var documentLostFocus = event.relatedTarget === null && !document.hasFocus();
2798
- if (movedWithinFocusDomain || documentLostFocus)
3120
+ if (_this.blurStaysWithRive(event.relatedTarget))
2799
3121
  return;
2800
3122
  _this.mainSm.clearFocus();
2801
3123
  };
@@ -2821,15 +3143,44 @@ var KeyboardInteractions = /** @class */ (function () {
2821
3143
  this.onFocusDomainHostFocusIn = function (event) {
2822
3144
  _this.syncOverlayListener();
2823
3145
  _this.onOverlayFocusIn(event);
3146
+ // Focus entering the proxy re-enters the focus domain, so clear any earlier Tab-out
3147
+ // release, or onKeyDown would drop the session's keystrokes.
3148
+ if (_this.inputProxy.owns(event.target)) {
3149
+ _this.focusDomainReleased = false;
3150
+ }
2824
3151
  };
3152
+ /**
3153
+ * Handles keydown events in the Rive focus domain. We route certain keys to different functions, with the following
3154
+ * fallback behavior:
3155
+ * 1. Tab/Shift+Tab - check if keyInput() takes this key, if not, call focusNext/Previous traversal if there are focus nodes
3156
+ * 2. Check - if a semantic overlay element's key handler claimed the event, don't intercept the key event further
3157
+ * 3. Send key to `keyInput()` on Rive state machine if applicable.
3158
+ * 4. If the keyInput returned false, and the key is directional arrow keys, call directional focus methods on state machine
3159
+ * 5. Printables: in a session the proxy's input event supplies text; otherwise textInput().
3160
+ * A printable fires both keyInput and textInput even if a listener claims it.
3161
+ * @param event KeyboardEvent
3162
+ * @returns void
3163
+ */
2825
3164
  this.onKeyDown = function (event) {
2826
3165
  _this.syncOverlayListener();
3166
+ // Keys that are part of an IME composition belong to the IME (candidate
3167
+ // navigation, commit). Safari reports the first one as keyCode 229 with
3168
+ // isComposing still false.
3169
+ if (event.isComposing || event.keyCode === 229)
3170
+ return;
2827
3171
  // After Tab exits the last Rive node, ignore keys until focus re-enters the focus domain.
2828
3172
  if (_this.focusDomainReleased)
2829
3173
  return;
2830
3174
  if (!_this.shouldRiveHandleKeyEvent(event))
2831
3175
  return;
2832
- if (event.code === "Tab" && _this.hasFocusNodes) {
3176
+ if (event.key === "Tab" && _this.hasFocusNodes) {
3177
+ // Tab listeners are matched per phase (down/repeat/up), as in the editor, so
3178
+ // each event is offered on its own; one that isn't claimed traverses.
3179
+ if (_this.mainSm.focusState().hasFocus &&
3180
+ _this.mainSm.keyInput(_keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.tab, (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.modifiersFromEvent)(event), true, event.repeat)) {
3181
+ event.preventDefault();
3182
+ return;
3183
+ }
2833
3184
  var forward = !event.shiftKey;
2834
3185
  var focusMoved = forward ? _this.mainSm.focusNext() : _this.mainSm.focusPrevious();
2835
3186
  var focusState = _this.mainSm.focusState();
@@ -2842,13 +3193,74 @@ var KeyboardInteractions = /** @class */ (function () {
2842
3193
  }
2843
3194
  else {
2844
3195
  // No more traversable nodes — release Tab to the page.
3196
+ if (document.activeElement !== _this.canvas &&
3197
+ _this.isInFocusDomain(document.activeElement)) {
3198
+ // The browser's default Tab starts from the focused element; from an overlay element,
3199
+ // the nearest stop backward is the canvas itself. Start it from the
3200
+ // canvas instead, so a Shift+Tab goes to the proper element before Rive.
3201
+ _this.canvas.focus({ preventScroll: true });
3202
+ }
2845
3203
  _this.focusSessionState = FocusSessionState.NotFocused;
2846
3204
  _this.focusDomainReleased = true;
2847
3205
  _this.canvasHasFocus = false;
2848
3206
  }
2849
3207
  _this.syncOverlayListener();
3208
+ return;
3209
+ }
3210
+ // A semantic overlay widget (roving radio/tab group, slider, Enter/Space activation)
3211
+ // already acted on this key at its target, so don't act on it twice.
3212
+ if ((0,_semantics_claimedKeyEvents__WEBPACK_IMPORTED_MODULE_1__.isKeyEventClaimed)(event)) {
3213
+ _this.claimedKeyCodes.add(event.code);
3214
+ return;
3215
+ }
3216
+ // A new unclaimed press: drop any claim whose keyup never arrived.
3217
+ _this.claimedKeyCodes.delete(event.code);
3218
+ var fromProxy = _this.textInputSessionActive && _this.inputProxy.owns(event.target);
3219
+ var expectsKeyboardInput = _this.mainSm.focusState().expectsKeyboardInput;
3220
+ // The focused node gets first refusal (a TextInput's caret, or a keyboard listener
3221
+ // on that key). Keys with no Rive equivalent map to null and aren't dispatched.
3222
+ var key = (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.keyboardEventToRiveKey)(event);
3223
+ var consumed = key !== null &&
3224
+ _this.mainSm.keyInput(key, (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.modifiersFromEvent)(event), true, event.repeat);
3225
+ // An arrow key with no consumed key input moves focus spatially. While a Rive node holds focus,
3226
+ // arrows never scroll the page
3227
+ if (!consumed && key !== null && isArrowKey(key) && !hasShortcutModifier(event)) {
3228
+ consumed =
3229
+ _this.focusInDirection(key) || _this.mainSm.focusState().hasFocus;
3230
+ }
3231
+ if (isPrintable(event)) {
3232
+ // During a session the printable must reach the proxy: its input event is the
3233
+ // (IME- and dead-key-correct) text source, and C++ inserts nothing from keyInput.
3234
+ if (fromProxy)
3235
+ return;
3236
+ // Session live but focus elsewhere in Rive: refocus the proxy so the default inserts there.
3237
+ if (_this.textInputSessionActive && _this.isInFocusDomain(event.target)) {
3238
+ _this.inputProxy.focus();
3239
+ return;
3240
+ }
3241
+ if (!_this.textInputSessionActive && expectsKeyboardInput) {
3242
+ _this.mainSm.textInput(event.key);
3243
+ }
3244
+ }
3245
+ // Rive consumed it, or an unmodified editing key while typing (would scroll/submit).
3246
+ var typing = fromProxy || expectsKeyboardInput;
3247
+ if (consumed ||
3248
+ (typing && !hasShortcutModifier(event) && EDITING_NAV_CODES.has(event.code))) {
3249
+ event.preventDefault();
2850
3250
  }
2851
3251
  };
3252
+ this.onKeyUp = function (event) {
3253
+ if (event.isComposing || event.keyCode === 229)
3254
+ return;
3255
+ if (_this.claimedKeyCodes.delete(event.code))
3256
+ return;
3257
+ if (_this.focusSessionState === FocusSessionState.NotFocused)
3258
+ return;
3259
+ var key = (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.keyboardEventToRiveKey)(event);
3260
+ if (key === null)
3261
+ return;
3262
+ _this.mainSm.keyInput(key, (0,_keyMap__WEBPACK_IMPORTED_MODULE_0__.modifiersFromEvent)(event), false, false);
3263
+ };
2852
3264
  this.canvas = canvas;
2853
3265
  this.mainSm = stateMachine;
2854
3266
  this.hasFocusNodes = hasFocusNodes;
@@ -2857,9 +3269,74 @@ var KeyboardInteractions = /** @class */ (function () {
2857
3269
  canvas.addEventListener("focus", this.onCanvasFocus);
2858
3270
  canvas.addEventListener("blur", this.onCanvasBlur);
2859
3271
  canvas.addEventListener("keydown", this.onKeyDown);
3272
+ canvas.addEventListener("keyup", this.onKeyUp);
2860
3273
  this.focusDomainHost.addEventListener("focusin", this.onFocusDomainHostFocusIn);
2861
3274
  this.syncOverlayListener();
3275
+ this.inputProxy = new _textInputProxy__WEBPACK_IMPORTED_MODULE_2__.TextInputProxy({
3276
+ container: (_c = canvas.parentElement) !== null && _c !== void 0 ? _c : document.body,
3277
+ canvas: canvas,
3278
+ textInput: function (text) { return _this.mainSm.textInput(text); },
3279
+ // Proxy keystrokes go through the same handlers as the canvas.
3280
+ onKeyDown: this.onKeyDown,
3281
+ onKeyUp: this.onKeyUp,
3282
+ onCopy: this.onCopy,
3283
+ onBlur: function (relatedTarget) { return _this.handleProxyBlur(relatedTarget); },
3284
+ });
2862
3285
  }
3286
+ KeyboardInteractions.prototype.isTextInputSessionActive = function () {
3287
+ return this.textInputSessionActive;
3288
+ };
3289
+ /** Session active and the proxy holds DOM focus. */
3290
+ KeyboardInteractions.prototype.isEditingHostFocused = function () {
3291
+ return this.textInputSessionActive && this.inputProxy.hasDomFocus();
3292
+ };
3293
+ /** @param focusProxy move DOM focus to the proxy; false leaves it where it is. */
3294
+ KeyboardInteractions.prototype.beginTextInputSession = function (focusProxy) {
3295
+ this.textInputSessionActive = true;
3296
+ this.focusSessionState = FocusSessionState.RiveFocused;
3297
+ if (focusProxy)
3298
+ this.inputProxy.focus();
3299
+ };
3300
+ /** @param fromBlur focus is already leaving; don't park it on the canvas. */
3301
+ KeyboardInteractions.prototype.endTextInputSession = function (fromBlur) {
3302
+ if (fromBlur === void 0) { fromBlur = false; }
3303
+ if (!this.textInputSessionActive)
3304
+ return;
3305
+ this.textInputSessionActive = false;
3306
+ this.inputProxy.endSession();
3307
+ if (fromBlur || !this.inputProxy.hasDomFocus())
3308
+ return;
3309
+ // Nothing took DOM focus from the proxy (e.g. semantics is off). Park it on the
3310
+ // canvas so keys keep reaching Rive; onCanvasFocus ignores focus from the input proxy.
3311
+ this.canvas.focus({ preventScroll: true });
3312
+ };
3313
+ /** Must run synchronously in the pointer gesture or mobile keyboards won't open. */
3314
+ KeyboardInteractions.prototype.summonForPointer = function () {
3315
+ if (this.textInputSessionActive)
3316
+ this.inputProxy.focus();
3317
+ else
3318
+ this.beginTextInputSession(true);
3319
+ };
3320
+ Object.defineProperty(KeyboardInteractions.prototype, "editingHost", {
3321
+ /** The text-input proxy, for the semantics layer to decorate while editing. */
3322
+ get: function () {
3323
+ return this.inputProxy;
3324
+ },
3325
+ enumerable: false,
3326
+ configurable: true
3327
+ });
3328
+ KeyboardInteractions.prototype.handleProxyBlur = function (relatedTarget) {
3329
+ // Teardown already in progress (endTextInputSession blurred the proxy).
3330
+ if (!this.textInputSessionActive)
3331
+ return;
3332
+ // Still in Rive or the document blurred: keep the session (pollFocusState tears down).
3333
+ if (this.blurStaysWithRive(relatedTarget))
3334
+ return;
3335
+ // Blurred out of Rive entirely: release C++ focus and end the session.
3336
+ this.mainSm.clearFocus();
3337
+ this.endTextInputSession(true);
3338
+ this.focusSessionState = FocusSessionState.NotFocused;
3339
+ };
2863
3340
  /**
2864
3341
  * Set the FocusSessionState. Useful for invoking a Rive "blur" without actually blurring from the <canvas>. This
2865
3342
  * helps put the DOM focus state on the canvas rather than the <body>, so the user doesn't lose the spot in page navigation
@@ -2878,6 +3355,26 @@ var KeyboardInteractions = /** @class */ (function () {
2878
3355
  KeyboardInteractions.prototype.notifyRiveFocused = function () {
2879
3356
  this.focusSessionState = FocusSessionState.RiveFocused;
2880
3357
  };
3358
+ /** Blur into the focus domain, or the whole document losing focus (tab/window switch). */
3359
+ KeyboardInteractions.prototype.blurStaysWithRive = function (relatedTarget) {
3360
+ return (this.isInFocusDomain(relatedTarget) ||
3361
+ (relatedTarget === null && !document.hasFocus()));
3362
+ };
3363
+ /** Arrow keys map to directional focus; anything else is not a focus move. */
3364
+ KeyboardInteractions.prototype.focusInDirection = function (key) {
3365
+ switch (key) {
3366
+ case _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.left:
3367
+ return this.mainSm.focusLeft();
3368
+ case _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.right:
3369
+ return this.mainSm.focusRight();
3370
+ case _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.up:
3371
+ return this.mainSm.focusUp();
3372
+ case _keyMap__WEBPACK_IMPORTED_MODULE_0__.Key.down:
3373
+ return this.mainSm.focusDown();
3374
+ default:
3375
+ return false;
3376
+ }
3377
+ };
2881
3378
  /**
2882
3379
  * Determine if Rive should handle keyboard input. If session state is `NotFocused` - no.
2883
3380
  * DOM focus stays parked on the canvas after Rive releases focus internally, and that Tab
@@ -2895,14 +3392,12 @@ var KeyboardInteractions = /** @class */ (function () {
2895
3392
  var eventOnCanvas = event.target === this.canvas;
2896
3393
  return inFocusDomain || this.canvasHasFocus || eventOnCanvas;
2897
3394
  };
2898
- /**
2899
- * The Rive focus domain: the DOM that counts as "inside" Rive for focus purposes — today the
2900
- * canvas itself OR the accessibility overlay subtree. Anything added later belongs here, so
2901
- * session bookkeeping and keydown routing pick it up for free.
2902
- */
3395
+ /** DOM that counts as inside Rive for focus: canvas, overlay subtree, text-input proxy. */
2903
3396
  KeyboardInteractions.prototype.isInFocusDomain = function (target) {
2904
3397
  if (target === this.canvas)
2905
3398
  return true;
3399
+ if (this.inputProxy.owns(target))
3400
+ return true;
2906
3401
  return this.isInOverlay(target);
2907
3402
  };
2908
3403
  /** Overlay only (excludes the canvas) — the accessibility overlay subtree. */
@@ -2913,15 +3408,19 @@ var KeyboardInteractions = /** @class */ (function () {
2913
3408
  return (_c = (_b = (_a = this.getOverlayElement) === null || _a === void 0 ? void 0 : _a.call(this)) === null || _b === void 0 ? void 0 : _b.contains(target)) !== null && _c !== void 0 ? _c : false;
2914
3409
  };
2915
3410
  KeyboardInteractions.prototype.syncOverlayListener = function () {
2916
- var _a, _b, _c, _d, _e, _f;
3411
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2917
3412
  var nextOverlayElement = (_b = (_a = this.getOverlayElement) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : null;
2918
3413
  if (nextOverlayElement === this.currentOverlayElement)
2919
3414
  return;
2920
3415
  (_c = this.currentOverlayElement) === null || _c === void 0 ? void 0 : _c.removeEventListener("focusin", this.onOverlayFocusIn);
2921
- (_d = this.currentOverlayElement) === null || _d === void 0 ? void 0 : _d.removeEventListener("keydown", this.onKeyDown, true);
3416
+ (_d = this.currentOverlayElement) === null || _d === void 0 ? void 0 : _d.removeEventListener("keydown", this.onKeyDown);
3417
+ (_e = this.currentOverlayElement) === null || _e === void 0 ? void 0 : _e.removeEventListener("keyup", this.onKeyUp);
2922
3418
  this.currentOverlayElement = nextOverlayElement;
2923
- (_e = this.currentOverlayElement) === null || _e === void 0 ? void 0 : _e.addEventListener("focusin", this.onOverlayFocusIn);
2924
- (_f = this.currentOverlayElement) === null || _f === void 0 ? void 0 : _f.addEventListener("keydown", this.onKeyDown, true);
3419
+ (_f = this.currentOverlayElement) === null || _f === void 0 ? void 0 : _f.addEventListener("focusin", this.onOverlayFocusIn);
3420
+ // Bubble phase, so a semantic widget's own key handler runs first and can claim
3421
+ // the key via claimKeyEvent (see onKeyDown).
3422
+ (_g = this.currentOverlayElement) === null || _g === void 0 ? void 0 : _g.addEventListener("keydown", this.onKeyDown);
3423
+ (_h = this.currentOverlayElement) === null || _h === void 0 ? void 0 : _h.addEventListener("keyup", this.onKeyUp);
2925
3424
  };
2926
3425
  /**
2927
3426
  * Whether the canvas currently matches :focus-visible — the browser's heuristic for keyboard-
@@ -2947,13 +3446,22 @@ var KeyboardInteractions = /** @class */ (function () {
2947
3446
  return true;
2948
3447
  };
2949
3448
  KeyboardInteractions.prototype.cleanup = function () {
2950
- var _a, _b;
3449
+ var _a, _b, _c;
2951
3450
  this.canvas.removeEventListener("focus", this.onCanvasFocus);
2952
3451
  this.canvas.removeEventListener("blur", this.onCanvasBlur);
2953
3452
  this.canvas.removeEventListener("keydown", this.onKeyDown);
3453
+ this.canvas.removeEventListener("keyup", this.onKeyUp);
3454
+ this.claimedKeyCodes.clear();
2954
3455
  this.focusDomainHost.removeEventListener("focusin", this.onFocusDomainHostFocusIn);
2955
3456
  (_a = this.currentOverlayElement) === null || _a === void 0 ? void 0 : _a.removeEventListener("focusin", this.onOverlayFocusIn);
2956
- (_b = this.currentOverlayElement) === null || _b === void 0 ? void 0 : _b.removeEventListener("keydown", this.onKeyDown, true);
3457
+ (_b = this.currentOverlayElement) === null || _b === void 0 ? void 0 : _b.removeEventListener("keydown", this.onKeyDown);
3458
+ (_c = this.currentOverlayElement) === null || _c === void 0 ? void 0 : _c.removeEventListener("keyup", this.onKeyUp);
3459
+ // Removing a focused element drops focus to <body> with no blur; park on the canvas.
3460
+ if (this.inputProxy.hasDomFocus()) {
3461
+ this.canvas.focus({ preventScroll: true });
3462
+ }
3463
+ this.inputProxy.cleanup();
3464
+ this.textInputSessionActive = false;
2957
3465
  };
2958
3466
  return KeyboardInteractions;
2959
3467
  }());
@@ -2961,7 +3469,592 @@ var KeyboardInteractions = /** @class */ (function () {
2961
3469
 
2962
3470
 
2963
3471
  /***/ }),
2964
- /* 13 */
3472
+ /* 15 */
3473
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3474
+
3475
+ __webpack_require__.r(__webpack_exports__);
3476
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3477
+ /* harmony export */ Key: () => (/* binding */ Key),
3478
+ /* harmony export */ KeyModifiers: () => (/* binding */ KeyModifiers),
3479
+ /* harmony export */ keyboardEventToRiveKey: () => (/* binding */ keyboardEventToRiveKey),
3480
+ /* harmony export */ modifiersFromEvent: () => (/* binding */ modifiersFromEvent)
3481
+ /* harmony export */ });
3482
+ /*
3483
+ * Maps DOM keyboard events to the GLFW-style key codes and modifier bitmask
3484
+ * that StateMachineInstance.keyInput() expects. Values mirror `enum class Key`
3485
+ * and `enum class KeyModifiers` in rive-runtime focusable.hpp;
3486
+ * they are stable GLFW codes, so they live here as constants instead of an
3487
+ * embind enum.
3488
+ */
3489
+ var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
3490
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3491
+ if (ar || !(i in from)) {
3492
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
3493
+ ar[i] = from[i];
3494
+ }
3495
+ }
3496
+ return to.concat(ar || Array.prototype.slice.call(from));
3497
+ };
3498
+ var Key = {
3499
+ space: 32,
3500
+ apostrophe: 39, // '
3501
+ comma: 44, // ,
3502
+ minus: 45, // -
3503
+ period: 46, // .
3504
+ slash: 47, // /
3505
+ key0: 48,
3506
+ key1: 49,
3507
+ key2: 50,
3508
+ key3: 51,
3509
+ key4: 52,
3510
+ key5: 53,
3511
+ key6: 54,
3512
+ key7: 55,
3513
+ key8: 56,
3514
+ key9: 57,
3515
+ semicolon: 59, // ;
3516
+ equal: 61, // =
3517
+ a: 65,
3518
+ b: 66,
3519
+ c: 67,
3520
+ d: 68,
3521
+ e: 69,
3522
+ f: 70,
3523
+ g: 71,
3524
+ h: 72,
3525
+ i: 73,
3526
+ j: 74,
3527
+ k: 75,
3528
+ l: 76,
3529
+ m: 77,
3530
+ n: 78,
3531
+ o: 79,
3532
+ p: 80,
3533
+ q: 81,
3534
+ r: 82,
3535
+ s: 83,
3536
+ t: 84,
3537
+ u: 85,
3538
+ v: 86,
3539
+ w: 87,
3540
+ x: 88,
3541
+ y: 89,
3542
+ z: 90,
3543
+ leftBracket: 91, // [
3544
+ backslash: 92, // \
3545
+ rightBracket: 93, // ]
3546
+ graveAccent: 96, // `
3547
+ world1: 161, // non-US #1
3548
+ world2: 162, // non-US #2
3549
+ escape: 256,
3550
+ enter: 257,
3551
+ tab: 258,
3552
+ backspace: 259,
3553
+ insert: 260,
3554
+ deleteKey: 261,
3555
+ right: 262,
3556
+ left: 263,
3557
+ down: 264,
3558
+ up: 265,
3559
+ pageUp: 266,
3560
+ pageDown: 267,
3561
+ home: 268,
3562
+ end: 269,
3563
+ capsLock: 280,
3564
+ scrollLock: 281,
3565
+ numLock: 282,
3566
+ printScreen: 283,
3567
+ pause: 284,
3568
+ f1: 290,
3569
+ f2: 291,
3570
+ f3: 292,
3571
+ f4: 293,
3572
+ f5: 294,
3573
+ f6: 295,
3574
+ f7: 296,
3575
+ f8: 297,
3576
+ f9: 298,
3577
+ f10: 299,
3578
+ f11: 300,
3579
+ f12: 301,
3580
+ f13: 302,
3581
+ f14: 303,
3582
+ f15: 304,
3583
+ f16: 305,
3584
+ f17: 306,
3585
+ f18: 307,
3586
+ f19: 308,
3587
+ f20: 309,
3588
+ f21: 310,
3589
+ f22: 311,
3590
+ f23: 312,
3591
+ f24: 313,
3592
+ f25: 314,
3593
+ kp0: 320,
3594
+ kp1: 321,
3595
+ kp2: 322,
3596
+ kp3: 323,
3597
+ kp4: 324,
3598
+ kp5: 325,
3599
+ kp6: 326,
3600
+ kp7: 327,
3601
+ kp8: 328,
3602
+ kp9: 329,
3603
+ kpDecimal: 330,
3604
+ kpDivide: 331,
3605
+ kpMultiply: 332,
3606
+ kpSubtract: 333,
3607
+ kpAdd: 334,
3608
+ kpEnter: 335,
3609
+ kpEqual: 336,
3610
+ leftShift: 340,
3611
+ leftControl: 341,
3612
+ leftAlt: 342,
3613
+ leftSuper: 343,
3614
+ rightShift: 344,
3615
+ rightControl: 345,
3616
+ rightAlt: 346,
3617
+ rightSuper: 347,
3618
+ menu: 348,
3619
+ };
3620
+ var KeyModifiers = {
3621
+ none: 0,
3622
+ shift: 1 << 0,
3623
+ ctrl: 1 << 1,
3624
+ alt: 1 << 2,
3625
+ meta: 1 << 3,
3626
+ };
3627
+ // Physical key (KeyboardEvent.code) to Rive key, by US-QWERTY position.
3628
+ var CODE_TO_KEY = {
3629
+ // Modifiers are keys too (the editor sends them), and are also in the bitmask.
3630
+ ShiftLeft: Key.leftShift,
3631
+ ShiftRight: Key.rightShift,
3632
+ ControlLeft: Key.leftControl,
3633
+ ControlRight: Key.rightControl,
3634
+ AltLeft: Key.leftAlt,
3635
+ AltRight: Key.rightAlt,
3636
+ MetaLeft: Key.leftSuper,
3637
+ MetaRight: Key.rightSuper,
3638
+ KeyA: Key.a,
3639
+ KeyB: Key.b,
3640
+ KeyC: Key.c,
3641
+ KeyD: Key.d,
3642
+ KeyE: Key.e,
3643
+ KeyF: Key.f,
3644
+ KeyG: Key.g,
3645
+ KeyH: Key.h,
3646
+ KeyI: Key.i,
3647
+ KeyJ: Key.j,
3648
+ KeyK: Key.k,
3649
+ KeyL: Key.l,
3650
+ KeyM: Key.m,
3651
+ KeyN: Key.n,
3652
+ KeyO: Key.o,
3653
+ KeyP: Key.p,
3654
+ KeyQ: Key.q,
3655
+ KeyR: Key.r,
3656
+ KeyS: Key.s,
3657
+ KeyT: Key.t,
3658
+ KeyU: Key.u,
3659
+ KeyV: Key.v,
3660
+ KeyW: Key.w,
3661
+ KeyX: Key.x,
3662
+ KeyY: Key.y,
3663
+ KeyZ: Key.z,
3664
+ Digit0: Key.key0,
3665
+ Digit1: Key.key1,
3666
+ Digit2: Key.key2,
3667
+ Digit3: Key.key3,
3668
+ Digit4: Key.key4,
3669
+ Digit5: Key.key5,
3670
+ Digit6: Key.key6,
3671
+ Digit7: Key.key7,
3672
+ Digit8: Key.key8,
3673
+ Digit9: Key.key9,
3674
+ Numpad0: Key.kp0,
3675
+ Numpad1: Key.kp1,
3676
+ Numpad2: Key.kp2,
3677
+ Numpad3: Key.kp3,
3678
+ Numpad4: Key.kp4,
3679
+ Numpad5: Key.kp5,
3680
+ Numpad6: Key.kp6,
3681
+ Numpad7: Key.kp7,
3682
+ Numpad8: Key.kp8,
3683
+ Numpad9: Key.kp9,
3684
+ NumpadDecimal: Key.kpDecimal,
3685
+ NumpadDivide: Key.kpDivide,
3686
+ NumpadMultiply: Key.kpMultiply,
3687
+ NumpadSubtract: Key.kpSubtract,
3688
+ NumpadAdd: Key.kpAdd,
3689
+ NumpadEnter: Key.kpEnter,
3690
+ NumpadEqual: Key.kpEqual,
3691
+ Minus: Key.minus,
3692
+ Equal: Key.equal,
3693
+ BracketLeft: Key.leftBracket,
3694
+ BracketRight: Key.rightBracket,
3695
+ Backslash: Key.backslash,
3696
+ Semicolon: Key.semicolon,
3697
+ Quote: Key.apostrophe,
3698
+ Backquote: Key.graveAccent,
3699
+ Comma: Key.comma,
3700
+ Period: Key.period,
3701
+ Slash: Key.slash,
3702
+ IntlBackslash: Key.world1,
3703
+ IntlRo: Key.world2,
3704
+ Space: Key.space,
3705
+ Enter: Key.enter,
3706
+ Tab: Key.tab,
3707
+ Backspace: Key.backspace,
3708
+ Insert: Key.insert,
3709
+ Delete: Key.deleteKey,
3710
+ Escape: Key.escape,
3711
+ ArrowRight: Key.right,
3712
+ ArrowLeft: Key.left,
3713
+ ArrowDown: Key.down,
3714
+ ArrowUp: Key.up,
3715
+ PageUp: Key.pageUp,
3716
+ PageDown: Key.pageDown,
3717
+ Home: Key.home,
3718
+ End: Key.end,
3719
+ CapsLock: Key.capsLock,
3720
+ ScrollLock: Key.scrollLock,
3721
+ NumLock: Key.numLock,
3722
+ PrintScreen: Key.printScreen,
3723
+ Pause: Key.pause,
3724
+ ContextMenu: Key.menu,
3725
+ F1: Key.f1,
3726
+ F2: Key.f2,
3727
+ F3: Key.f3,
3728
+ F4: Key.f4,
3729
+ F5: Key.f5,
3730
+ F6: Key.f6,
3731
+ F7: Key.f7,
3732
+ F8: Key.f8,
3733
+ F9: Key.f9,
3734
+ F10: Key.f10,
3735
+ F11: Key.f11,
3736
+ F12: Key.f12,
3737
+ F13: Key.f13,
3738
+ F14: Key.f14,
3739
+ F15: Key.f15,
3740
+ F16: Key.f16,
3741
+ F17: Key.f17,
3742
+ F18: Key.f18,
3743
+ F19: Key.f19,
3744
+ F20: Key.f20,
3745
+ F21: Key.f21,
3746
+ F22: Key.f22,
3747
+ F23: Key.f23,
3748
+ F24: Key.f24,
3749
+ F25: Key.f25,
3750
+ };
3751
+ // Unshifted characters (event.key, lowercased) that name a Rive key.
3752
+ var CHAR_TO_KEY = (function () {
3753
+ var map = {
3754
+ " ": Key.space,
3755
+ "'": Key.apostrophe,
3756
+ ",": Key.comma,
3757
+ "-": Key.minus,
3758
+ ".": Key.period,
3759
+ "/": Key.slash,
3760
+ ";": Key.semicolon,
3761
+ "=": Key.equal,
3762
+ "[": Key.leftBracket,
3763
+ "\\": Key.backslash,
3764
+ "]": Key.rightBracket,
3765
+ "`": Key.graveAccent,
3766
+ };
3767
+ for (var c = 0; c < 26; c++)
3768
+ map[String.fromCharCode(97 + c)] = Key.a + c;
3769
+ for (var d = 0; d <= 9; d++)
3770
+ map[String(d)] = Key.key0 + d;
3771
+ return map;
3772
+ })();
3773
+ // Non-printable event.key values; each shares its name with its code.
3774
+ var NAMED_KEYS = new Set(__spreadArray([
3775
+ "Enter",
3776
+ "Tab",
3777
+ "Backspace",
3778
+ "Insert",
3779
+ "Delete",
3780
+ "Escape",
3781
+ "ArrowRight",
3782
+ "ArrowLeft",
3783
+ "ArrowDown",
3784
+ "ArrowUp",
3785
+ "PageUp",
3786
+ "PageDown",
3787
+ "Home",
3788
+ "End",
3789
+ "CapsLock",
3790
+ "ScrollLock",
3791
+ "NumLock",
3792
+ "PrintScreen",
3793
+ "Pause",
3794
+ "ContextMenu"
3795
+ ], Array.from({ length: 25 }, function (_, i) { return "F".concat(i + 1); }), true));
3796
+ /**
3797
+ * Maps a KeyboardEvent to a Rive key, or null if Rive has no equivalent.
3798
+ *
3799
+ * Resolves the logical key: what the user's layout labels the key, ignoring
3800
+ * Shift, so a listener on "A" fires on AZERTY's A too. `event.key` is preferred;
3801
+ * `event.code` is the fallback when `key` isn't a plain unshifted character
3802
+ * (shifted symbols, Option/AltGr output, non-Latin letters, dead keys).
3803
+ * Digit-row and numpad keys skip the character lookup so AZERTY's digit row
3804
+ * still reports digits and numpad digits stay distinct from the digit row.
3805
+ */
3806
+ function keyboardEventToRiveKey(event) {
3807
+ var _a, _b;
3808
+ var code = event.code, key = event.key;
3809
+ if (NAMED_KEYS.has(key)) {
3810
+ // NumpadEnter reports key "Enter"; keep it distinct.
3811
+ return code === "NumpadEnter" ? Key.kpEnter : (_a = CODE_TO_KEY[key]) !== null && _a !== void 0 ? _a : null;
3812
+ }
3813
+ if (!code.startsWith("Digit") && !code.startsWith("Numpad") && key) {
3814
+ var fromChar = CHAR_TO_KEY[key.toLowerCase()];
3815
+ if (fromChar !== undefined)
3816
+ return fromChar;
3817
+ }
3818
+ return (_b = CODE_TO_KEY[code]) !== null && _b !== void 0 ? _b : null;
3819
+ }
3820
+ function modifiersFromEvent(event) {
3821
+ var modifiers = KeyModifiers.none;
3822
+ if (event.shiftKey)
3823
+ modifiers |= KeyModifiers.shift;
3824
+ if (event.ctrlKey)
3825
+ modifiers |= KeyModifiers.ctrl;
3826
+ if (event.altKey)
3827
+ modifiers |= KeyModifiers.alt;
3828
+ if (event.metaKey)
3829
+ modifiers |= KeyModifiers.meta;
3830
+ return modifiers;
3831
+ }
3832
+
3833
+
3834
+ /***/ }),
3835
+ /* 16 */
3836
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3837
+
3838
+ __webpack_require__.r(__webpack_exports__);
3839
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3840
+ /* harmony export */ TextInputProxy: () => (/* binding */ TextInputProxy)
3841
+ /* harmony export */ });
3842
+ /* harmony import */ var _canvasOffset__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
3843
+
3844
+ // 16px: the smallest font size at which iOS Safari doesn't zoom on focus
3845
+ var FONT_SIZE_PX = 16;
3846
+ /** Capture-critical attributes decorate() must not touch. */
3847
+ var PROTECTED_ATTRS = new Set([
3848
+ "type",
3849
+ "value",
3850
+ "style",
3851
+ "tabindex",
3852
+ "autocapitalize",
3853
+ "autocomplete",
3854
+ "autocorrect",
3855
+ "spellcheck",
3856
+ ]);
3857
+ /**
3858
+ * Invisible per-instance <input> capturing IME/dead-key/paste text; focusable inside a
3859
+ * gesture to raise mobile keyboards. Always empty: C++ owns value and caret. Decorated
3860
+ * for AT only while it holds DOM focus.
3861
+ */
3862
+ var TextInputProxy = /** @class */ (function () {
3863
+ function TextInputProxy(params) {
3864
+ var _this = this;
3865
+ // True between compositionstart/compositionend; we never commit mid-composition.
3866
+ this.composing = false;
3867
+ // Names set by decorate(), removed by resetDecoration().
3868
+ this.decoratedKeys = new Set();
3869
+ // Last written left/top, to skip no-op style writes.
3870
+ this.lastLeft = NaN;
3871
+ this.lastTop = NaN;
3872
+ /** Re-sync before input: the canvas may have scrolled since the session began. */
3873
+ this.reposition = function () { return _this.positionOverCanvas(); };
3874
+ this.onCompositionStart = function () {
3875
+ _this.composing = true;
3876
+ };
3877
+ this.onCompositionEnd = function () {
3878
+ _this.composing = false;
3879
+ // The composed text is now committed in element.value; forward it here. A
3880
+ // trailing `input` event (order varies by browser) then sees an empty field.
3881
+ _this.commit();
3882
+ };
3883
+ this.onInput = function () {
3884
+ if (_this.composing)
3885
+ return;
3886
+ _this.commit();
3887
+ };
3888
+ // An <input type=text> strips line breaks from its value, so forward the clipboard
3889
+ // text directly. Core's single-line fields strip them themselves.
3890
+ this.onPaste = function (event) {
3891
+ var _a;
3892
+ var text = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("text/plain");
3893
+ if (!text)
3894
+ return;
3895
+ event.preventDefault();
3896
+ _this.params.textInput(text.replace(/\r\n?/g, "\n"));
3897
+ };
3898
+ this.onBlur = function (event) {
3899
+ _this.params.onBlur(event.relatedTarget);
3900
+ };
3901
+ this.params = params;
3902
+ this.element = this.createElement();
3903
+ this.positionOverCanvas();
3904
+ // Order vs. the overlay is unspecified; fine, Tab release starts from the canvas.
3905
+ this.params.container.appendChild(this.element);
3906
+ }
3907
+ // Registered first so it runs before the key handler inserts or moves the caret.
3908
+ TextInputProxy.prototype.listeners = function () {
3909
+ return [
3910
+ ["keydown", this.reposition],
3911
+ ["beforeinput", this.reposition],
3912
+ ["keydown", this.params.onKeyDown],
3913
+ ["keyup", this.params.onKeyUp],
3914
+ ["input", this.onInput],
3915
+ ["compositionstart", this.onCompositionStart],
3916
+ ["compositionend", this.onCompositionEnd],
3917
+ ["paste", this.onPaste],
3918
+ ["copy", this.params.onCopy],
3919
+ ["blur", this.onBlur],
3920
+ ];
3921
+ };
3922
+ TextInputProxy.prototype.createElement = function () {
3923
+ var el = document.createElement("input");
3924
+ el.type = "text";
3925
+ // Focusable but never in native tab order (Rive drives traversal synthetically),
3926
+ // and invisible without display:none (which would forbid focus).
3927
+ el.tabIndex = -1;
3928
+ el.setAttribute("aria-hidden", "true");
3929
+ // Always empty, so autocapitalize/autocorrect would misfire.
3930
+ el.setAttribute("autocapitalize", "off");
3931
+ el.setAttribute("autocomplete", "off");
3932
+ el.setAttribute("autocorrect", "off");
3933
+ el.spellcheck = false;
3934
+ // Over the canvas (not display:none) so iOS doesn't scroll-jump on keyboard open.
3935
+ // font-size must stay 16px or iOS Safari zooms on focus.
3936
+ el.style.cssText =
3937
+ "position:absolute;width:1px;height:1px;padding:0;margin:0;border:0;" +
3938
+ "outline:none;opacity:0;background:transparent;color:transparent;" +
3939
+ "caret-color:transparent;overflow:hidden;resize:none;z-index:0;" +
3940
+ // Focused programmatically only; must not swallow clicks
3941
+ "pointer-events:none;" +
3942
+ "font-size:".concat(FONT_SIZE_PX, "px;line-height:1;");
3943
+ for (var _i = 0, _a = this.listeners(); _i < _a.length; _i++) {
3944
+ var _b = _a[_i], type = _b[0], listener = _b[1];
3945
+ el.addEventListener(type, listener);
3946
+ }
3947
+ return el;
3948
+ };
3949
+ TextInputProxy.prototype.positionOverCanvas = function () {
3950
+ // Track the canvas (browsers scroll to the caret); clamp on-screen, one caret line box
3951
+ // (FONT_SIZE_PX) from the far edges, or the root scrolls to reveal it.
3952
+ var _a = (0,_canvasOffset__WEBPACK_IMPORTED_MODULE_0__.canvasOffset)(this.params.canvas), top = _a.top, left = _a.left;
3953
+ if (window.innerHeight > 0) {
3954
+ var r = this.params.canvas.getBoundingClientRect();
3955
+ top += clamp(r.top, 0, window.innerHeight - FONT_SIZE_PX) - r.top;
3956
+ left += clamp(r.left, 0, window.innerWidth - FONT_SIZE_PX) - r.left;
3957
+ }
3958
+ if (left !== this.lastLeft) {
3959
+ this.element.style.left = "".concat(left, "px");
3960
+ this.lastLeft = left;
3961
+ }
3962
+ if (top !== this.lastTop) {
3963
+ this.element.style.top = "".concat(top, "px");
3964
+ this.lastTop = top;
3965
+ }
3966
+ };
3967
+ /**
3968
+ * Forward the field's text to Rive and clear it.
3969
+ *
3970
+ * TODO: iOS won't autorepeat Backspace in an empty field (needs a text mirror).
3971
+ * */
3972
+ TextInputProxy.prototype.commit = function () {
3973
+ var text = this.element.value;
3974
+ if (!text)
3975
+ return;
3976
+ this.element.value = "";
3977
+ this.params.textInput(text);
3978
+ };
3979
+ /** Clear any transient value and decoration. Does not blur the element. */
3980
+ TextInputProxy.prototype.endSession = function () {
3981
+ this.element.value = "";
3982
+ // Browsers fire compositionend on blur, but a stuck flag would drop every
3983
+ // keystroke of the next session.
3984
+ this.composing = false;
3985
+ // Also covers blur-out, which bypasses the overlay.
3986
+ this.resetDecoration();
3987
+ };
3988
+ /** Must be called synchronously inside a gesture on iOS to raise the keyboard. */
3989
+ TextInputProxy.prototype.focus = function () {
3990
+ // Reposition first: iOS scrolls the focused input into view when the keyboard opens.
3991
+ this.positionOverCanvas();
3992
+ this.element.focus({ preventScroll: true });
3993
+ };
3994
+ TextInputProxy.prototype.hasDomFocus = function () {
3995
+ return document.activeElement === this.element;
3996
+ };
3997
+ TextInputProxy.prototype.owns = function (target) {
3998
+ return target === this.element;
3999
+ };
4000
+ /** See EditingHost.decorate. */
4001
+ TextInputProxy.prototype.decorate = function (attrs) {
4002
+ // aria-hidden outranks every attribute set below, so it must come off before this
4003
+ // element can stand in as the accessible element for the focused node.
4004
+ this.element.removeAttribute("aria-hidden");
4005
+ for (var _i = 0, _a = Object.entries(attrs); _i < _a.length; _i++) {
4006
+ var _b = _a[_i], name_1 = _b[0], value = _b[1];
4007
+ // Never override capture attrs.
4008
+ if (PROTECTED_ATTRS.has(name_1.toLowerCase()))
4009
+ continue;
4010
+ if (value === null) {
4011
+ this.element.removeAttribute(name_1);
4012
+ this.decoratedKeys.delete(name_1);
4013
+ }
4014
+ else {
4015
+ // Skip no-op writes: setting an attribute to the value it already has still
4016
+ // emits a mutation, and assistive tech is focused on this element mid-edit.
4017
+ if (this.element.getAttribute(name_1) !== value) {
4018
+ this.element.setAttribute(name_1, value);
4019
+ }
4020
+ this.decoratedKeys.add(name_1);
4021
+ }
4022
+ }
4023
+ };
4024
+ /**
4025
+ * type=password for obscured fields so AT doesn't echo keys.
4026
+ * TODO: source "type" from Core, not semantics.
4027
+ */
4028
+ TextInputProxy.prototype.setSecure = function (secure) {
4029
+ var type = secure ? "password" : "text";
4030
+ if (this.element.type !== type)
4031
+ this.element.type = type;
4032
+ };
4033
+ /** Drop all decoration and return to the AT-invisible baseline. */
4034
+ TextInputProxy.prototype.resetDecoration = function () {
4035
+ var _this = this;
4036
+ this.setSecure(false);
4037
+ this.decoratedKeys.forEach(function (name) { return _this.element.removeAttribute(name); });
4038
+ this.decoratedKeys.clear();
4039
+ this.element.setAttribute("aria-hidden", "true");
4040
+ };
4041
+ TextInputProxy.prototype.cleanup = function () {
4042
+ for (var _i = 0, _a = this.listeners(); _i < _a.length; _i++) {
4043
+ var _b = _a[_i], type = _b[0], listener = _b[1];
4044
+ this.element.removeEventListener(type, listener);
4045
+ }
4046
+ this.element.remove();
4047
+ };
4048
+ return TextInputProxy;
4049
+ }());
4050
+
4051
+ function clamp(v, min, max) {
4052
+ return Math.min(Math.max(v, min), Math.max(min, max));
4053
+ }
4054
+
4055
+
4056
+ /***/ }),
4057
+ /* 17 */
2965
4058
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2966
4059
 
2967
4060
  __webpack_require__.r(__webpack_exports__);
@@ -3014,7 +4107,7 @@ function sanitizeUrl(url) {
3014
4107
 
3015
4108
 
3016
4109
  /***/ }),
3017
- /* 14 */
4110
+ /* 18 */
3018
4111
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3019
4112
 
3020
4113
  __webpack_require__.r(__webpack_exports__);
@@ -3314,7 +4407,7 @@ var createFinalization = function (target, finalizable) {
3314
4407
 
3315
4408
 
3316
4409
  /***/ }),
3317
- /* 15 */
4410
+ /* 19 */
3318
4411
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3319
4412
 
3320
4413
  __webpack_require__.r(__webpack_exports__);
@@ -3486,7 +4579,7 @@ __webpack_require__.r(__webpack_exports__);
3486
4579
  /* harmony import */ var _animation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
3487
4580
  /* harmony import */ var _runtimeLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
3488
4581
  /* harmony import */ var _semantics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
3489
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10);
4582
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);
3490
4583
  var __extends = (undefined && undefined.__extends) || (function () {
3491
4584
  var extendStatics = function (d, b) {
3492
4585
  extendStatics = Object.setPrototypeOf ||
@@ -5374,6 +6467,10 @@ var Rive = /** @class */ (function () {
5374
6467
  this._dataEnums = null;
5375
6468
  this._tabIndex = null;
5376
6469
  this._prevHasFocus = false;
6470
+ this._prevWantsTextInputSession = false;
6471
+ // Pointer-down defers the proxy focus: mousedown's default would refocus the canvas and
6472
+ // touchstart isn't user activation; pointer-up focuses it.
6473
+ this._inPointerDownDrain = false;
5377
6474
  this._focusOptions = {
5378
6475
  allowFocusInterrupt: false,
5379
6476
  };
@@ -5409,6 +6506,7 @@ var Rive = /** @class */ (function () {
5409
6506
  _this.resizeToCanvas();
5410
6507
  }
5411
6508
  };
6509
+ this.isEditingHostFocused = function () { var _a, _b; return (_b = (_a = _this._keyboardInteractions) === null || _a === void 0 ? void 0 : _a.isEditingHostFocused()) !== null && _b !== void 0 ? _b : false; };
5412
6510
  // Tracks the current animation frame request
5413
6511
  this.frameRequestId = null;
5414
6512
  /**
@@ -5729,11 +6827,21 @@ var Rive = /** @class */ (function () {
5729
6827
  dispatchPointerExit: dispatchPointerExit,
5730
6828
  enableMultiTouch: enableMultiTouch,
5731
6829
  layoutScaleFactor: this._layout.layoutScaleFactor,
5732
- advanceAndDrain: this.advanceAndReportChanges.bind(this)
6830
+ advanceAndDrain: this.advanceAndDrainForPointer.bind(this),
6831
+ summonKeyboard: this.summonKeyboardForGesture.bind(this),
6832
+ isTextProxyFocused: this.isEditingHostFocused,
5733
6833
  });
5734
6834
  this.ensureKeyboardInteractions();
5735
6835
  }
5736
6836
  };
6837
+ Object.defineProperty(Rive.prototype, "focusStateMachine", {
6838
+ // Assumes a single state machine drives focus.
6839
+ get: function () {
6840
+ return this.animator.stateMachines.find(function (sm) { return sm.playing && sm.hasFocusNodes; });
6841
+ },
6842
+ enumerable: false,
6843
+ configurable: true
6844
+ });
5737
6845
  /**
5738
6846
  * Wire keyboard interactions when a playing state machine has focus nodes.
5739
6847
  * Called at listener setup and lazily each frame so late-bound bindable artboards work.
@@ -5746,7 +6854,7 @@ var Rive = /** @class */ (function () {
5746
6854
  !(this.canvas instanceof HTMLCanvasElement)) {
5747
6855
  return;
5748
6856
  }
5749
- var smWithFocusNodes = this.animator.stateMachines.find(function (sm) { return sm.playing && sm.hasFocusNodes; });
6857
+ var smWithFocusNodes = this.focusStateMachine;
5750
6858
  if (!smWithFocusNodes) {
5751
6859
  return;
5752
6860
  }
@@ -5756,16 +6864,51 @@ var Rive = /** @class */ (function () {
5756
6864
  }
5757
6865
  this._keyboardInteractions = new _utils__WEBPACK_IMPORTED_MODULE_3__.KeyboardInteractions({
5758
6866
  canvas: this.canvas,
5759
- stateMachine: smWithFocusNodes.instance, // work off assumption of single state machine
6867
+ stateMachine: smWithFocusNodes.instance,
5760
6868
  hasFocusNodes: true,
5761
6869
  getOverlayElement: function () { var _a, _b; return (_b = (_a = _this._accessibilityOverlay) === null || _a === void 0 ? void 0 : _a.getSemanticOverlayContainer()) !== null && _b !== void 0 ? _b : null; },
5762
6870
  });
5763
6871
  };
6872
+ /** Runs inside touchend/mouseup so focusing the proxy raises the mobile keyboard. */
6873
+ Rive.prototype.summonKeyboardForGesture = function () {
6874
+ if (!this._keyboardInteractions)
6875
+ return;
6876
+ var activeSm = this.focusStateMachine;
6877
+ if (!activeSm)
6878
+ return;
6879
+ if (this.wantsTextInputSession(activeSm.focusState().expectsKeyboardInput)) {
6880
+ this._keyboardInteractions.summonForPointer();
6881
+ }
6882
+ };
6883
+ /** expectsKeyboardInput, and (with semantics on) the focused node is a textField. */
6884
+ Rive.prototype.wantsTextInputSession = function (expectsKeyboardInput) {
6885
+ var _a;
6886
+ if (!expectsKeyboardInput)
6887
+ return false;
6888
+ var node = (_a = this._semanticTree) === null || _a === void 0 ? void 0 : _a.focusedNode();
6889
+ return node === undefined || node.role === _semantics__WEBPACK_IMPORTED_MODULE_2__.SemanticRole.textField;
6890
+ };
6891
+ Rive.prototype.advanceAndDrainForPointer = function (elapsedTime, options) {
6892
+ if (!(options === null || options === void 0 ? void 0 : options.pointerDown)) {
6893
+ this.advanceAndReportChanges(elapsedTime);
6894
+ return;
6895
+ }
6896
+ this._inPointerDownDrain = true;
6897
+ try {
6898
+ this.advanceAndReportChanges(elapsedTime);
6899
+ }
6900
+ finally {
6901
+ this._inPointerDownDrain = false;
6902
+ }
6903
+ };
5764
6904
  Rive.prototype.cleanupKeyboardInteractions = function () {
6905
+ var _a;
5765
6906
  if (this._keyboardInteractions) {
5766
6907
  this._keyboardInteractions.cleanup();
5767
6908
  this._keyboardInteractions = null;
5768
6909
  }
6910
+ this._prevWantsTextInputSession = false;
6911
+ (_a = this._accessibilityOverlay) === null || _a === void 0 ? void 0 : _a.releaseEditingHost(null, null);
5769
6912
  };
5770
6913
  /**
5771
6914
  * Remove Rive Listeners setup on the canvas
@@ -6101,56 +7244,69 @@ var Rive = /** @class */ (function () {
6101
7244
  var _a, _b, _c;
6102
7245
  return (_c = (_b = (_a = this.riveFile) === null || _a === void 0 ? void 0 : _a.deferredSession) === null || _b === void 0 ? void 0 : _b.recordedThisFrame()) !== null && _c !== void 0 ? _c : false;
6103
7246
  };
6104
- /**
6105
- * Poll focus state each frame to see if we should focus/blur the canvas in case
6106
- * Rive internally updated focus outside of user interaction (e.g., via listener action)
6107
- */
7247
+ /** Rive can move focus on its own, so reconcile the text session and DOM focus each frame. */
6108
7248
  Rive.prototype.pollFocusState = function () {
6109
- var _a, _b;
6110
7249
  this.ensureKeyboardInteractions();
6111
- if (!this._keyboardInteractions) {
7250
+ var ki = this._keyboardInteractions;
7251
+ var activeSm = ki ? this.focusStateMachine : undefined;
7252
+ if (!ki || !activeSm || !(this.canvas instanceof HTMLCanvasElement)) {
6112
7253
  this._prevHasFocus = false;
7254
+ this._prevWantsTextInputSession = false;
6113
7255
  return;
6114
7256
  }
6115
- var activeSm = this.animator.stateMachines.find(function (sm) { return sm.playing && sm.hasFocusNodes; }); // work off assumption of single state machine
6116
- if (!activeSm) {
6117
- this._prevHasFocus = false;
6118
- return;
7257
+ var _a = activeSm.focusState(), hasFocus = _a.hasFocus, expectsKeyboardInput = _a.expectsKeyboardInput;
7258
+ this.syncTextInputSession(ki, this.wantsTextInputSession(expectsKeyboardInput));
7259
+ this.syncRiveFocus(ki, this.canvas, hasFocus);
7260
+ };
7261
+ /** Begin/end the text session on wantsSession edges; decorate the proxy while it has DOM focus. */
7262
+ Rive.prototype.syncTextInputSession = function (ki, wantsSession) {
7263
+ var host = ki.editingHost;
7264
+ var overlay = this._accessibilityOverlay;
7265
+ if (wantsSession) {
7266
+ var began = !this._prevWantsTextInputSession;
7267
+ if (began) {
7268
+ // In-domain or opted-in only; during pointer-down, pointer-up focuses instead.
7269
+ var focusProxy = !this._inPointerDownDrain &&
7270
+ (ki.isInFocusDomain(document.activeElement) ||
7271
+ !!this._focusOptions.allowFocusInterrupt);
7272
+ ki.beginTextInputSession(focusProxy);
7273
+ }
7274
+ // The <input> proxy stands in for the semantic DOM field only while it holds DOM focus.
7275
+ if (overlay && this._semanticTree) {
7276
+ if (host.hasDomFocus()) {
7277
+ overlay.syncEditingHost(this._semanticTree, host, began || !overlay.hasEditingHost());
7278
+ }
7279
+ else if (overlay.hasEditingHost()) {
7280
+ overlay.releaseEditingHost(this._semanticTree, host);
7281
+ }
7282
+ }
6119
7283
  }
6120
- if (this.canvas instanceof HTMLCanvasElement) {
6121
- var hasFocus = activeSm.focusState().hasFocus;
6122
- if (hasFocus) {
6123
- // Rive has an active focus node. Mark the session RiveFocused so Tab stays
6124
- // trapped and a later internal release (hasFocus true → false) is detected.
6125
- this._keyboardInteractions.notifyRiveFocused();
6126
- // Only steal DOM focus on the false→true transition. Rive can hold focus across
6127
- // frames while DOM focus sits elsewhere — a window switch preserves runtime focus
6128
- // by design — and that must not re-focus the canvas again.
6129
- if (!this._prevHasFocus) {
6130
- // Steal DOM focus to the canvas only when focus isn't already held
6131
- // somewhere inside this instance's focus scope. When the accessibility
6132
- // overlay has driven focus onto a specific semantic node element (e.g.
6133
- // an appearing alert dialog), focus is already in-scope. The steal
6134
- // stays a fallback for runtime focus nodes that have no overlay element
6135
- // to hold DOM focus.
6136
- var scope = (_a = this._accessibilityOverlay) === null || _a === void 0 ? void 0 : _a.getSemanticOverlayContainer();
6137
- var focusAlreadyInScope = document.activeElement === this.canvas ||
6138
- ((_b = scope === null || scope === void 0 ? void 0 : scope.contains(document.activeElement)) !== null && _b !== void 0 ? _b : false);
6139
- if (!focusAlreadyInScope && this._focusOptions.allowFocusInterrupt) {
6140
- this.canvas.focus();
6141
- }
6142
- this._prevHasFocus = true;
7284
+ else if (this._prevWantsTextInputSession) {
7285
+ // Overlay hand-off first, ahead of endTextInputSession's park-on-canvas fallback.
7286
+ overlay === null || overlay === void 0 ? void 0 : overlay.releaseEditingHost(this._semanticTree, host);
7287
+ ki.endTextInputSession();
7288
+ }
7289
+ this._prevWantsTextInputSession = wantsSession;
7290
+ };
7291
+ /** Mirror Rive's hasFocus into the keyboard session state and, on opt-in, canvas focus. */
7292
+ Rive.prototype.syncRiveFocus = function (ki, canvas, hasFocus) {
7293
+ if (hasFocus) {
7294
+ ki.notifyRiveFocused();
7295
+ // Pull focus from outside Rive only with allowFocusInterrupt.
7296
+ if (!this._prevHasFocus) {
7297
+ if (!ki.isInFocusDomain(document.activeElement) &&
7298
+ this._focusOptions.allowFocusInterrupt) {
7299
+ canvas.focus();
6143
7300
  }
6144
- return;
7301
+ this._prevHasFocus = true;
6145
7302
  }
7303
+ }
7304
+ else {
6146
7305
  this._prevHasFocus = false;
6147
- // hasFocus is false — only act when Rive previously held focus and released it internally
6148
- // (state change clears focus). Release the DOM Tab trap so the next Tab moves to the next
6149
- // page element. A DOM blur reaches here too now that onCanvasBlur clears Rive focus, but it
6150
- // has already set NotFocused, so this is a no-op. EntryPending and NotFocused are likewise
6151
- // intentional no-ops — EntryPending must stay put (a click awaiting its first Tab).
6152
- if (this._keyboardInteractions.focusSessionState === _utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.RiveFocused) {
6153
- this._keyboardInteractions.setFocusSessionState(_utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.NotFocused);
7306
+ // Rive released focus internally (e.g. a state change): drop the Tab trap so the next
7307
+ // Tab leaves the canvas.
7308
+ if (ki.focusSessionState === _utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.RiveFocused) {
7309
+ ki.setFocusSessionState(_utils__WEBPACK_IMPORTED_MODULE_3__.FocusSessionState.NotFocused);
6154
7310
  }
6155
7311
  }
6156
7312
  };
@@ -6248,6 +7404,7 @@ var Rive = /** @class */ (function () {
6248
7404
  instanceId: this._instanceId,
6249
7405
  semanticsOptions: this.semanticsOptions,
6250
7406
  allowFocusInterrupt: this._focusOptions.allowFocusInterrupt,
7407
+ isEditingHostFocused: this.isEditingHostFocused,
6251
7408
  fireAction: function (nodeId, actionType) {
6252
7409
  mainSm_1.fireSemanticAction(nodeId, actionType);
6253
7410
  },
@@ -6832,7 +7989,7 @@ var Rive = /** @class */ (function () {
6832
7989
  this.canvas.height = dpr * height;
6833
7990
  this._needsRedraw = true;
6834
7991
  this.resizeToCanvas();
6835
- if (this.layout.fit === Fit.Layout) {
7992
+ if (this.layout.fit === Fit.Layout && this.artboard) {
6836
7993
  var scaleFactor = this._layout.layoutScaleFactor;
6837
7994
  this.artboard.width = width / scaleFactor;
6838
7995
  this.artboard.height = height / scaleFactor;