import{t as e}from"./_BCiCTKAo.js";var t=e(((e,t,n)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.rive=r():n.rive=r()})(n,()=>(()=>{var e=[,((e,t,n)=>{n.r(t),n.d(t,{Animation:()=>r.Animation});var r=n(2)}),((e,t,n)=>{n.r(t),n.d(t,{Animation:()=>r});var r=function(){function e(e,t,n,r){this.animation=e,this.artboard=t,this.playing=r,this.loopCount=0,this.scrubTo=null,this.instance=new n.LinearAnimationInstance(e,t)}return Object.defineProperty(e.prototype,"name",{get:function(){return this.animation.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.instance.time},set:function(e){this.instance.time=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loopValue",{get:function(){return this.animation.loopValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"needsScrub",{get:function(){return this.scrubTo!==null},enumerable:!1,configurable:!0}),e.prototype.advance=function(e){this.scrubTo===null?this.instance.advance(e):(this.instance.time=0,this.instance.advance(this.scrubTo),this.scrubTo=null)},e.prototype.apply=function(e){this.instance.apply(e)},e.prototype.cleanup=function(){this.instance.delete()},e}()}),((e,t,n)=>{n.r(t),n.d(t,{RuntimeLoader:()=>o});var r=n(4),i=n(5),a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0;)(n=e.errorCallbackQueue.shift())==null||n(t);e.callBackQueue=[]},e.loadRuntime=function(){var t=e.wasmURL,n=e.wasmBinary;e.enablePerfMarks&&performance.mark(`rive:wasm-init:start`),r.default(a({locateFile:function(){return t}},n?{wasmBinary:n}:{})).then(function(t){var n;for(e.enablePerfMarks&&(performance.mark(`rive:wasm-init:end`),performance.measure(`rive:wasm-init`,`rive:wasm-init:start`,`rive:wasm-init:end`)),e.runtime=t,e.errorCallbackQueue=[];e.callBackQueue.length>0;)(n=e.callBackQueue.shift())==null||n(e.runtime)}).catch(function(n){var r={message:n?.message||`Unknown error`,type:n?.name||`Error`,wasmError:n instanceof WebAssembly.CompileError||n instanceof WebAssembly.RuntimeError,originalError:n};console.debug(`Rive WASM load error details:`,r);var i=e.wasmFallbackURL,a=i!==null&&t.toLowerCase()===i.toLowerCase();if(i!==null&&!a)console.warn(`Failed to load WASM from ${t} (${r.message}), trying fallback URL: ${i}`),e.wasmBinary=null,e.setWasmUrl(i),e.loadRuntime();else{var o=[`Could not load Rive WASM file from ${a?`the configured WASM URL or its fallback (${i})`:t}.`,`Possible reasons:`,`- Network connection is down`,`- WebAssembly is not supported in this environment`,`- The WASM file is corrupted or incompatible`,` Error details:`,`- Type: ${r.type}`,`- Message: ${r.message}`,`- WebAssembly-specific error: ${r.wasmError}`,` To resolve, you may need to:`,`1. Check your network connection`,`2. Set a new WASM source via RuntimeLoader.setWasmUrl()`,`3. Call RuntimeLoader.awaitInstance() again`].join(` `);console.error(o),e.notifyError(Error(o))}})},e.getInstance=function(t,n){e.isLoading||(e.isLoading=!0,e.loadRuntime()),e.runtime?t(e.runtime):(e.callBackQueue.push(t),n&&e.errorCallbackQueue.push(n))},e.awaitInstance=function(){return new Promise(function(t,n){return e.getInstance(t,n)})},e.setWasmUrl=function(t){e.wasmURL=t},e.getWasmUrl=function(){return e.wasmURL},e.setWasmFallbackUrl=function(t){e.wasmFallbackURL=t},e.getWasmFallbackUrl=function(){return e.wasmFallbackURL},e.setWasmBinary=function(t){t instanceof ArrayBuffer||t===null?e.wasmBinary=t:console.error(`setWasmBinary expects an ArrayBuffer or null`)},e.getWasmBinary=function(){return e.wasmBinary},e.isLoading=!1,e.callBackQueue=[],e.wasmURL=`https://unpkg.com/${i.name}@${i.version}/rive.wasm`,e.wasmFallbackURL=`https://cdn.jsdelivr.net/npm/${i.name}@${i.version}/rive_fallback.wasm`,e.wasmBinary=null,e.errorCallbackQueue=[],e.enablePerfMarks=!1,e}()}),((e,t,n)=>{n.r(t),n.d(t,{default:()=>r});let r=(()=>{var e=globalThis.document?.currentScript?.src;return async function(t={}){var n,r=t,i=!!globalThis.window,a=!!globalThis.WorkerGlobalScope;function o(){function e(e){let a=r;n=t=0,r=new Map,a.forEach(t=>{try{t(e)}catch(e){console.error(e)}}),this.Ya(),i&&i.Bb()}let t=0,n=0,r=new Map,i=null,a=null;this.requestAnimationFrame=function(i){t||=requestAnimationFrame(e.bind(this));let a=++n;return r.set(a,i),a},this.cancelAnimationFrame=function(e){r.delete(e),t&&r.size==0&&(cancelAnimationFrame(t),t=0)},this.zb=function(e){a&&=(document.body.remove(a),null),e||(a=document.createElement(`div`),a.style.backgroundColor=`black`,a.style.position=`fixed`,a.style.right=0,a.style.top=0,a.style.color=`white`,a.style.padding=`4px`,a.innerHTML=`RIVE FPS`,e=function(e){a.innerHTML=`RIVE FPS `+e.toFixed(1)},document.body.appendChild(a)),i=new function(){let t=0,n=0;this.Bb=function(){var r=performance.now();n?(++t,r-=n,1e3>e,t.has(r)&&clearTimeout(t.get(r)),t.set(r,setTimeout(function(){t.delete(r),t.length==0?n=-1/0:r==n&&(n=Math.max(...t.keys()),console.assert(n{let t=r.ptrToFileAsset(e);return t.isImage?r.ptrToImageAsset(e):t.isFont?r.ptrToFontAsset(e):t.isAudio?r.ptrToAudioAsset(e):t},r.CustomFileAssetLoader=a.extend(`CustomFileAssetLoader`,{__construct:function({loadContents:e}){this.__parent.__construct.call(this),this.kb=e},loadContents:function(e,t){return e=r.ptrToAsset(e),this.kb(e,t)}}),r.CDNFileAssetLoader=a.extend(`CDNFileAssetLoader`,{__construct:function(e){this.__parent.__construct.call(this),this.lb=e??null},loadContents:function(e){let t=r.ptrToAsset(e);if(e=t.cdnUuid,e===``)return!1;let n=this.lb??null;return(function(e,t){var n=new XMLHttpRequest;n.responseType=`arraybuffer`,n.onreadystatechange=function(){n.readyState==4&&n.status==200&&t(n)},n.open(`GET`,e,!0),n.send(null)})(t.cdnBaseUrl+`/`+e,e=>{t.decode(new Uint8Array(e.response),n)}),!0}}),r.FallbackFileAssetLoader=a.extend(`FallbackFileAssetLoader`,{__construct:function(){this.__parent.__construct.call(this),this.Wa=[]},addLoader:function(e){this.Wa.push(e)},loadContents:function(e,t){for(let n of this.Wa)if(n.loadContents(e,t))return!0;return!1}});let o=r.computeAlignment;r.computeAlignment=function(e,t,n,r,i=1){return o.call(this,e,t,n,r,i)}};function l(){}let u=new Int32Array(5);function d(e,t,n,r,i){e(t,n,u),e=Math.max(u[0],0);let a=Math.max(u[1],0);return t=Math.min(u[2],Math.ceil(r*t)),n=Math.min(u[3],Math.ceil(i*n)),u[4]=+(e!==u[0]||a!==u[1]||t!==u[2]||n!==u[3]),u[0]=e,u[1]=a,u[2]=t,u[3]=n,t>e&&n>a}function f(){let e=h.Kb();return e===0?0:e}function p(e,t,n,i,a,o,s,c,p,m,h){var g=f(),_=g-1,v=_-6;if(!(0_||S>_)&&(y*=Math.min(1,v/x),b*=Math.min(1,v/S),!d(c,y,b,n,i)))return m(),l;n=u[0],i=u[1],_=u[2],v=u[3],c=u[4]!==0,(1>y||1>b)&&(--n,--i,_+=1,v+=1);let C=_-n,w=v-i;if(e.i||(e.i=new r.DynamicRectanizer(g),e.i.reset(512,512)),g=e.i.addRect(C+1,w+1),0>g&&(h(),g=e.i.addRect(C+1,w+1),0>g))return console.assert(!1,`draw does not fit in an empty atlas`),m(),l;let T=g&65535,E=g>>16;e.m.push({nb:[y*a[0],b*a[1],y*a[2],b*a[3],y*a[4]-n+T,b*a[5]-i+E],ob:T,pb:E,Tb:C,Ua:w,Xa:c,M:p,Nb:()=>{m()}});let D=n/y,O=i/b,k=C/y,A=w/b,j=e.L;return function(){let e=j.canvas();e&&(t.save(),t.resetTransform(),t.globalCompositeOperation=o,t.globalAlpha=s,t.drawImage(e,T,E,C,w,D,O,k,A),t.restore())}}class m{constructor(){this.L=new g,this.i=null,this.m=[],this.ma=new s(8),this.Z=new s(8)}}let h=new function(){function e(){if(!t){var e=document.createElement(`canvas`),o={alpha:1,depth:0,stencil:0,antialias:0,premultipliedAlpha:1,preserveDrawingBuffer:0,powerPreference:`high-performance`,failIfMajorPerformanceCaveat:0,enableExtensionsByDefault:1,explicitSwapControl:1,renderViaOffscreenBackBuffer:1};let s;if(/iPhone|iPad|iPod/i.test(navigator.userAgent)){if(s=e.getContext(`webgl`,o),n=1,!s)return console.log(`No WebGL support. Image mesh will not be drawn.`),!1}else if(s=e.getContext(`webgl2`,o))n=2;else if(s=e.getContext(`webgl`,o))n=1;else return console.log(`No WebGL support. Image mesh will not be drawn.`),!1;s=new Proxy(s,{get(e,t){if(e.isContextLost()){if(l||=(console.error(`Cannot render the mesh because the GL Context was lost. Tried to invoke `,t),!0),typeof e[t]==`function`)return function(){}}else return typeof e[t]==`function`?function(...n){return e[t].apply(e,n)}:e[t]},set(e,t,n){if(e.isContextLost())l||=(console.error(`Cannot render the mesh because the GL Context was lost. Tried to set property `+t),!0);else return e[t]=n,!0}}),r=Math.min(s.getParameter(s.MAX_RENDERBUFFER_SIZE),s.getParameter(s.MAX_TEXTURE_SIZE));function c(e,t,n){if(t=s.createShader(t),s.shaderSource(t,n),s.compileShader(t),n=s.getShaderInfoLog(t),0<(n||``).length)throw n;s.attachShader(e,t)}if(e=s.createProgram(),c(e,s.VERTEX_SHADER,`attribute vec2 vertex; attribute vec2 uv; uniform vec4 mat; uniform vec2 translate; varying vec2 st; void main() { st = uv; gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1); }`),c(e,s.FRAGMENT_SHADER,`precision highp float; uniform sampler2D image; varying vec2 st; void main() { gl_FragColor = texture2D(image, st); }`),s.bindAttribLocation(e,0,`vertex`),s.bindAttribLocation(e,1,`uv`),s.linkProgram(e),o=s.getProgramInfoLog(e),0<(o||``).trim().length)throw o;i=s.getUniformLocation(e,`mat`),a=s.getUniformLocation(e,`translate`),s.useProgram(e),s.bindBuffer(s.ARRAY_BUFFER,s.createBuffer()),s.enableVertexAttribArray(0),s.enableVertexAttribArray(1),s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,s.createBuffer()),s.uniform1i(s.getUniformLocation(e,`image`),0),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t=s}return!0}let t=null,n=0,r=0,i=null,a=null,o=0,c=0,l=!1;e(),this.Kb=function(){return e(),r},this.vb=function(e){t&&t.deleteTexture&&t.deleteTexture(e)},this.tb=function(r){if(!e())return null;let i=t.createTexture();return i?(t.bindTexture(t.TEXTURE_2D,i),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),n==2?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.generateMipmap(t.TEXTURE_2D)):t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),i):null};let u=new s(10),d=new s(10);this.yb=function(n,r,s){if(e()&&t.canvas){(t.canvas.width!=n||t.canvas.height!=r)&&(t.canvas.width=n,t.canvas.height=r),t.viewport(0,0,n,r),t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT);var l=e=>e.M.image.za<<1|!!e.Xa;s.sort((e,t)=>l(t)-l(e));var f=0,p=0;for(var m of s)f+=m.M.oa.length,p+=m.M.indices.length;m=u.push(f),o!=m&&(t.bufferData(t.ARRAY_BUFFER,8*m,t.DYNAMIC_DRAW),o=m),m=0;for(var h of s)t.bufferSubData(t.ARRAY_BUFFER,m,h.M.oa),m+=4*h.M.oa.length;console.assert(m==4*f);for(var g of s)t.bufferSubData(t.ARRAY_BUFFER,m,g.M.fb),m+=4*g.M.fb.length;console.assert(m==8*f),m=d.push(p),c!=m&&(t.bufferData(t.ELEMENT_ARRAY_BUFFER,2*m,t.DYNAMIC_DRAW),c=m),h=0;for(var _ of s)t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,h,_.M.indices),h+=2*_.M.indices.length;console.assert(h==2*p),_=0,g=!1,m=h=0;for(let e of s){s=e.M,s.image.za!=_&&(t.bindTexture(t.TEXTURE_2D,s.image.T||null),_=s.image.za),e.Xa?(t.scissor(e.ob,r-e.pb-e.Ua,e.Tb,e.Ua),g||=(t.enable(t.SCISSOR_TEST),!0)):g&&=(t.disable(t.SCISSOR_TEST),!1);let o=e.nb,c=2/n,l=-2/r;t.uniform4f(i,o[0]*c,o[1]*l,o[2]*c,o[3]*l),t.uniform2f(a,o[4]*c-1,o[5]*l+1),t.vertexAttribPointer(0,2,t.FLOAT,!1,0,m),t.vertexAttribPointer(1,2,t.FLOAT,!1,0,m+4*f),t.drawElements(t.TRIANGLES,s.indices.length,t.UNSIGNED_SHORT,h),m+=4*s.oa.length,h+=2*s.indices.length}console.assert(m==4*f),console.assert(h==2*p)}},this.canvas=function(){return e()&&t.canvas}};class g{constructor(){this.bb=!1}canvas(){return h.canvas()||null}}let _=new m;function v(e,t,n,r,i,a){let o=new DOMMatrix;return o.a=e,o.b=t,o.c=n,o.d=r,o.e=i,o.f=a,o}let y=`createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText`.split(` `),b=r.onRuntimeInitialized;r.onRuntimeInitialized=function(){function e(e){switch(e){case S.srcOver:return`source-over`;case S.Ub:return`plus-lighter`;case S.screen:return`screen`;case S.overlay:return`overlay`;case S.darken:return`darken`;case S.lighten:return`lighten`;case S.colorDodge:return`color-dodge`;case S.colorBurn:return`color-burn`;case S.hardLight:return`hard-light`;case S.softLight:return`soft-light`;case S.difference:return`difference`;case S.exclusion:return`exclusion`;case S.multiply:return`multiply`;case S.hue:return`hue`;case S.saturation:return`saturation`;case S.color:return`color`;case S.luminosity:return`luminosity`}}function t(e){return`rgba(`+((16711680&e)>>>16)+`,`+((65280&e)>>>8)+`,`+((255&e)>>>0)+`,`+((4278190080&e)>>>24)/255+`)`}function n(e,t,n,r,i){return{cb:e,eb:t,Pa:n,Qa:r,Va:i,Ha:[],Y:null}}function i(e,t,n,r){return t.W===w&&!(0new j(e)),this.ja=new M(e=>new j(e)),this.V=new Map,this.ga=E,this.ua=!1},__destruct:function(){this.ia.dispose(),this.ja.dispose();for(let e of this.V.values())e.dispose();this.V.clear(),this.__parent.__destruct.call(this)},rewind:function(){this.U.length=0,this.ia.clear(),this.ja.clear();for(let e of this.V.values())e.clear();this.ua=!1},addPath:function(e,t,n,r,i,a,o){let s=e.U.slice();this.aa(e=>e.addPath(s,t,n,r,i,a,o))},fillRule:function(e){this.ga=e},moveTo:function(e,t){this.ua=!0,this.aa(n=>n.moveTo(e,t))},lineTo:function(e,t){this.La(),this.aa(n=>n.lineTo(e,t))},cubicTo:function(e,t,n,r,i,a){this.La(),this.aa(o=>o.ub(e,t,n,r,i,a))},close:function(){this.aa(e=>e.close())},La:function(){this.ua||this.moveTo(0,0)},aa:function(e){this.U.push(e)},Ia:function(e){return e=e===null?this.ia.Aa(this.U,null):this.ja.Aa(this.U,e),e.ref&&e.ref(),e},hb:function(e){var t=this.V.get(e);return t===void 0&&(t=new M(()=>O.Vb(e)),this.V.set(e,t)),t=t.Aa(this.U,null),t.ref&&t.ref(),t},xa:function(e){this.ia.Ga(e),this.ja.Ga(e);for(let t of this.V.values())t.Ga(e);e.unref&&e.unref()}});let P=n(0,0,0,0,!1);var F=d.extend(`CanvasRenderPaint`,{__construct:function(){this.__parent.__construct.call(this),this.W=C,this.ra=4278190080,this.X=1,this.wa=x.miter,this.qa=g.butt,this.sa=0,this.pa=e(S.srcOver),this.va=this.ba=this.J=null,this.ya=1,this.D=0,this.R=null,this.Na=-1},__destruct:function(){this.R!==null&&(r.unrefWebGL2Paint(this.R),this.R=null),this.__parent.__destruct.call(this)},color:function(e){this.ra=e,this.J=null,this.D++},thickness:function(e){this.X=Math.abs(e),this.D++},join:function(e){this.wa=e,this.D++},cap:function(e){this.qa=e,this.D++},feather:function(e){this.sa=Math.abs(e),this.D++},style:function(e){this.W=e,this.D++},blendMode:function(t){this.pa=e(t),this.D++},clearGradient:function(){this.J=null,this.D++},linearGradient:function(e,t,r,i){this.J=n(e,t,r,i,!1),this.D++},radialGradient:function(e,t,r,i){this.J=n(e,t,r,i,!0),this.D++},addStop:function(e,t){this.J.Ha.push({color:e,stop:t}),this.J.Y=null,this.D++},completeGradient:function(){},_setGradientTransform:function(e,t,n,r,i,a,o,s,c,l,u,d,f){e===1&&t===0&&n===0&&r===1&&i===0&&a===0?this.va=this.ba=null:(this.ba=v(e,t,n,r,i,a),this.va=v(o,s,c,l,u,d)),this.ya=f,this.D++},ib:function(){if(this.Na!==this.D){this.R!==null&&r.unrefWebGL2Paint(this.R);let t=this.J===null?P:this.J,n=null,i=null;if(this.J!==null){var e=t.Ha;n=new Uint32Array(e.length),i=new Float32Array(e.length);for(let t=0,r=e.length;te)throw`restore() called without matching save().`;this.K.splice(e),this.C.pop(),this.F.push(this.s.restore.bind(this.s))},transform:function(e,t,n,r,i,a){let o=this.K,s=o.length-6;o.splice(s,6,o[s]*e+o[s+2]*t,o[s+1]*e+o[s+3]*t,o[s]*n+o[s+2]*r,o[s+1]*n+o[s+3]*r,o[s]*i+o[s+2]*a+o[s+4],o[s+1]*i+o[s+3]*a+o[s+5]),this.F.push(this.s.transform.bind(this.s,e,t,n,r,i,a))},rotate:function(e){let t=Math.sin(e);e=Math.cos(e),this.transform(e,t,-t,e,0,0)},modulateOpacity:function(e){this.C[this.C.length-1]*=e},_drawPath:function(e,n){let r=Math.max(0,this.C[this.C.length-1]),a=n.sa===0?n.J===null||n.ba===null?0:n.W!==w||0{var n=this.s;let r=n.globalCompositeOperation,i=n.globalAlpha;if(n.globalCompositeOperation=o.qb,n.globalAlpha=o.opacity,o.Ta!==null){var a=o.Ta;if(a.Y===null){var s=a.cb;let e=a.eb;var c=a.Pa,l=a.Qa;a.Va?(c-=s,l-=e,a.Y=n.createRadialGradient(s,e,0,s,e,Math.sqrt(c*c+l*l))):a.Y=n.createLinearGradient(s,e,c,l),s=a.Ha;for(let e=0,n=s.length;er.webGL2PathPixelBounds(i.path,i.Da,e*o[0],t*o[1],e*o[2],t*o[3],e*o[4],t*o[5],n),e=>e.drawPath(i.path,i.Da),()=>{e.xa(i.path),r.unrefWebGL2Paint(i.Da)},s),I.add(this),this.F.push(t)}},_drawRiveImage:function(t,n,r){var i=t.Ma;if(i){var a=this.s,o=e(n),s=Math.max(0,r*this.C[this.C.length-1]);this.F.push(function(){a.globalCompositeOperation=o,a.globalAlpha=s,a.drawImage(i,0,0),a.globalAlpha=1})}},_getMatrix:function(e){let t=this.K,n=t.length-6;for(let r=0;6>r;++r)e[r]=t[n+r]},_drawImageMesh:function(e,t,n,i,a,o,s,c){let l=e.mb;l?this.Ja(n,i,a,o,s,c,e=>r.drawWebGL2PendingMesh(e,t,l),()=>t.unref()):t.unref()},_drawImageMeshFromHeap:function(e,t,n,i,a,o,s,c,l,u,d,f,p){if(e.T){try{var m=r.HEAPF32.slice(i>>2,(i>>2)+a),h=r.HEAPF32.slice(o>>2,(o>>2)+s),g=r.HEAPU16.slice(c>>1,(c>>1)+l)}catch{console.error(`[Rive] _drawImageMesh: failed to read mesh data from WASM heap. Mesh skipped for this frame.`);return}this.Ja(t,n,u,d,f,p,{image:e,oa:m,fb:h,indices:g},()=>{})}},Ja:function(t,n,r,i,a,o,c,l){t=p(D,this.s,this.s.canvas.width,this.s.canvas.height,this.K.slice(this.K.length-6),e(t),Math.max(0,n*this.C[this.C.length-1]),(e,t,n)=>{n[0]=Math.floor(r*e),n[1]=Math.floor(i*t),n[2]=Math.ceil(a*e),n[3]=Math.ceil(o*t)},c,l,s),I.add(this),this.F.push(t)},_clipPath:function(e){let t=e.ga===T?`evenodd`:`nonzero`,n=e.Ia(null);this.F.push(()=>{this.s.clip(n,t),e.xa(n)})},beginFrame:function(e=!0){I.add(this),e&&this.F.push(this.s.clearRect.bind(this.s,0,0,this.Ka.width,this.Ka.height))},clear:function(){this.beginFrame(!0)},flush:function(){},translate:function(e,t){this.transform(1,0,0,1,e,t)}});r.makeRenderer=function(e){let t=new ee(e),n=t.s,i=null,a=null,o={attachSession:function(e){if(e&&i===e)return!0;if(!e||i||typeof r.c2dDeferredClaim!=`function`||typeof r.c2dDeferredRenderer!=`function`||!r.c2dDeferredClaim(e))return!1;let t=r.c2dDeferredRenderer(e);return t?(i=e,a=t,!0):!1},detachSession:function(){i&&r.c2dDeferredDetach(i),a=i=null},deferredActive:function(){return a!==null}},s={save:function(){r.c2dDeferredSave(i)},restore:function(){r.c2dDeferredRestore(i)},transform:function(e,t,n,a,o,s){r.c2dDeferredTransform(i,e,t,n,a,o,s)},translate:function(e,t){r.c2dDeferredTransform(i,1,0,0,1,e,t)},rotate:function(e){let t=Math.sin(e);e=Math.cos(e),r.c2dDeferredTransform(i,e,t,-t,e,0,0)},align:function(e,t,n,a,o){r.c2dDeferredAlign(i,e,t,n.minX,n.minY,n.maxX,n.maxY,a.minX,a.minY,a.maxX,a.maxY,o===void 0?1:o)},beginFrame:function(e=!0){t.beginFrame(e),r.c2dDeferredBeginFrame(i)},clear:function(){t.beginFrame(!0),r.c2dDeferredBeginFrame(i)},flush:function(){r.c2dDeferredReplay(i,t)}};return new Proxy(t,{get(e,r){if(L.call(o,r))return o[r];if(r===`_deferredRecorder`)return a;if(a!==null&&L.call(s,r))return s[r];if(typeof e[r]==`function`)return function(...t){return e[r].apply(e,t)};if(typeof n[r]==`function`){if(-1{n[r]=i}),!0}})},r.decodeImage=function(e,t){new A({da:t}).decode(e)},r.renderFactory={makeRenderPaint:function(){return new F},makeRenderPath:function(){return new N},makeRenderImage:function(){let e=z;return new A({na:()=>{e.total++},da:()=>{if(e.loaded++,e.loaded===e.total){let t=e.ready;t&&(t(),e.ready=null)}}})}};let R=r.load,z=null;r.load=function(e,t,n=!0,i=null){let a=new r.FallbackFileAssetLoader;return t!==void 0&&a.addLoader(t),n&&(t=new r.CDNFileAssetLoader(i),a.addLoader(t)),new Promise(function(t){let n=null;z={total:0,loaded:0,ready:function(){t(n)}},n=R(e,a,i??null);let o=r.riveScripting;o&&o.prepare(),z.total==0&&t(n)}).then(r.startFileScripts)};let te=r.Artboard.prototype.draw;r.Artboard.prototype.draw=function(e){te.call(this,e._deferredRecorder||e)};let B=r.RendererWrapper.prototype.align;r.RendererWrapper.prototype.align=function(e,t,n,r,i=1){B.call(this,e,t,n,r,i)},c=new o,r.requestAnimationFrame=c.requestAnimationFrame.bind(c),r.cancelAnimationFrame=c.cancelAnimationFrame.bind(c),r.enableFPSCounter=c.zb.bind(c),r.disableFPSCounter=c.wb,c.Ya=s,r.resolveAnimationFrame=s,r.cleanup=function(){D.i&&=(D.i.delete(),null)}},a&&(e=self.location.href);var x=``,S,C;if(i||a){try{x=new URL(`.`,e).href}catch{}a&&(C=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),S=async e=>{if(O(e))return new Promise((t,n)=>{var r=new XMLHttpRequest;r.open(`GET`,e,!0),r.responseType=`arraybuffer`,r.onload=()=>{r.status==200||r.status==0&&r.response?t(r.response):n(r.status)},r.onerror=n,r.send(null)});var t=await fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)}}var w=console.log.bind(console),T=console.error.bind(console),E,D=!1,O=e=>e.startsWith(`file://`),k,A,j,M,N,P,F,I,L,ee,R=!1;function z(){var e=St.buffer;r.HEAP8=j=new Int8Array(e),N=new Int16Array(e),r.HEAPU8=M=new Uint8Array(e),r.HEAPU16=P=new Uint16Array(e),r.HEAP32=F=new Int32Array(e),r.HEAPU32=I=new Uint32Array(e),r.HEAPF32=L=new Float32Array(e),ee=new Float64Array(e)}function te(e){throw r.onAbort?.(e),e=`Aborted(`+e+`)`,T(e),D=!0,e=new WebAssembly.RuntimeError(e+`. Build with -sASSERTIONS for more info.`),A?.(e),e}var B;async function ne(e){if(!E)try{var t=await S(e);return new Uint8Array(t)}catch{}if(e==B&&E)e=new Uint8Array(E);else if(C)e=C(e);else throw`both async and sync fetching of the wasm failed`;return e}async function re(e,t){try{var n=await ne(e);return await WebAssembly.instantiate(n,t)}catch(e){T(`failed to asynchronously prepare wasm: ${e}`),te(e)}}async function ie(e){var t=B;if(!E&&!O(t))try{var n=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(n,e)}catch(e){T(`wasm streaming compile failed: ${e}`),T(`falling back to ArrayBuffer instantiation`)}return re(t,e)}var V,ae,oe=e=>{for(;0{var e=r.preRun.shift();ce.push(e)},H=(e,t)=>Object.defineProperty(t,"name",{value:e}),ue=[],U=[0,1,,1,null,1,!0,1,!1,1],W=class extends Error{constructor(e){super(e),this.name=`BindingError`}},G=e=>{if(!e)throw new W(`Cannot use deleted val. handle = ${e}`);return U[e]},K=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:let t=ue.pop()||U.length;return U[t]=e,U[t+1]=1,t}};class de extends Error{}var q=e=>{for(var t=``;;){var n=M[e++];if(!n)return t;t+=String.fromCharCode(n)}},fe={},pe=(e,t)=>{if(t===void 0)throw new W(`ptr should not be undefined`);for(;e.A;)t=e.ea(t),e=e.A;return t},J={},me=e=>{e=xt(e);var t=q(e);return yt(e),t},he=(e,t)=>{var n=J[e];if(n===void 0)throw e=`${t} has unknown type ${me(e)}`,new W(e);return n},ge=()=>{},_e=!1,ve=e=>globalThis.FinalizationRegistry?(_e=new FinalizationRegistry(e=>{e=e.g,--e.count.value,e.count.value===0&&(e.B?e.I.O(e.B):e.o.h.O(e.l))}),ve=e=>{var t=e.g;return t.B&&_e.register(e,{g:t},e),e},ge=e=>{_e.unregister(e)},ve(e)):(ve=e=>e,e),Y={},ye=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function be(e){return this.j(I[e>>2])}var xe={},Se={},Ce=class extends Error{constructor(e){super(e),this.name=`InternalError`}},X=(e,t,n)=>{function r(t){if(t=n(t),t.length!==e.length)throw new Ce(`Mismatched type converter count`);for(var r=0;rSe[e]=t);var i=Array(t.length),a=[],o=0;for(let[e,n]of t.entries())J.hasOwnProperty(n)?i[e]=J[n]:(a.push(n),xe.hasOwnProperty(n)||(xe[n]=[]),xe[n].push(()=>{i[e]=J[n],++o,o===a.length&&r(i)}));a.length===0&&r(i)};function we(e,t,n={}){var r=t.name;if(!e)throw new W(`type "${r}" must have a positive integer typeid pointer`);if(J.hasOwnProperty(e)){if(n.Hb)return;throw new W(`Cannot register type '${r}' twice`)}J[e]=t,delete Se[e],xe.hasOwnProperty(e)&&(t=xe[e],delete xe[e],t.forEach(e=>e()))}function Z(e,t,n={}){return we(e,t,n)}var Te=e=>{throw new W(e.g.o.h.name+` instance already deleted`)},Ee=[];function De(){}var Oe={},ke=(e,t,n)=>{if(e[t].u===void 0){var r=e[t];e[t]=function(...r){if(!e[t].u.hasOwnProperty(r.length))throw new W(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].u})!`);return e[t].u[r.length].apply(this,r)},e[t].u=[],e[t].u[r.P]=r}},Ae=(e,t,n)=>{if(r.hasOwnProperty(e)){if(n===void 0||r[e].u!==void 0&&r[e].u[n]!==void 0)throw new W(`Cannot register public name '${e}' twice`);if(ke(r,e,e),r[e].u.hasOwnProperty(n))throw new W(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`);r[e].u[n]=t}else r[e]=t,r[e].P=n},je=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,`$`);var t=e.charCodeAt(0);return 48<=t&&57>=t?`_${e}`:e};function Me(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.N=n,this.O=r,this.A=i,this.Cb=a,this.ea=o,this.xb=s,this.Za=[]}var Ne=(e,t,n)=>{for(;t!==n;){if(!t.ea)throw new W(`Expected null or instance of ${n.name}, got an instance of ${t.name}`);e=t.ea(e),t=t.A}return e},Pe=e=>{if(e===null)return`null`;var t=typeof e;return t===`object`||t===`array`||t===`function`?e.toString():``+e};function Fe(e,t){if(t===null){if(this.Ba)throw new W(`null is not a valid ${this.name}`);return 0}if(!t.g)throw new W(`Cannot pass "${Pe(t)}" as a ${this.name}`);if(!t.g.l)throw new W(`Cannot pass deleted object as a pointer of type ${this.name}`);return Ne(t.g.l,t.g.o.h,this.h)}function Ie(e,t){if(t===null){if(this.Ba)throw new W(`null is not a valid ${this.name}`);if(this.la){var n=this.Fa();return e!==null&&e.push(this.O,n),n}return 0}if(!t||!t.g)throw new W(`Cannot pass "${Pe(t)}" as a ${this.name}`);if(!t.g.l)throw new W(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.ka&&t.g.o.ka)throw new W(`Cannot convert argument of type ${t.g.I?t.g.I.name:t.g.o.name} to parameter type ${this.name}`);if(n=Ne(t.g.l,t.g.o.h,this.h),this.la){if(t.g.B===void 0)throw new W(`Passing raw pointer to smart pointer is illegal`);switch(this.Rb){case 0:if(t.g.I===this)n=t.g.B;else throw new W(`Cannot convert argument of type ${t.g.I?t.g.I.name:t.g.o.name} to parameter type ${this.name}`);break;case 1:n=t.g.B;break;case 2:if(t.g.I===this)n=t.g.B;else{var r=t.clone();n=this.Mb(n,K(()=>r.delete())),e!==null&&e.push(this.O,n)}break;default:throw new W(`Unsupported sharing policy`)}}return n}function Le(e,t){if(t===null){if(this.Ba)throw new W(`null is not a valid ${this.name}`);return 0}if(!t.g)throw new W(`Cannot pass "${Pe(t)}" as a ${this.name}`);if(!t.g.l)throw new W(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.g.o.ka)throw new W(`Cannot convert argument of type ${t.g.o.name} to parameter type ${this.name}`);return Ne(t.g.l,t.g.o.h,this.h)}var Re=(e,t,n)=>t===n?e:n.A===void 0?null:(e=Re(e,t,n.A),e===null?null:n.xb(e)),ze=(e,t)=>(t=pe(e,t),fe[t]),Be=(e,t)=>{if(!t.o||!t.l)throw new Ce(`makeClassHandle requires ptr and ptrType`);if(!!t.I!=!!t.B)throw new Ce(`Both smartPtrType and smartPtr must be specified`);return t.count={value:1},ve(Object.create(e,{g:{value:t,writable:!0}}))};function Ve(e,t,n,r,i,a,o,s,c,l,u){this.name=e,this.h=t,this.Ba=n,this.ka=r,this.la=i,this.Lb=a,this.Rb=o,this.$a=s,this.Fa=c,this.Mb=l,this.O=u,i||t.A!==void 0?this.v=Ie:(this.v=r?Fe:Le,this.G=null)}var He=(e,t,n)=>{if(!r.hasOwnProperty(e))throw new Ce(`Replacing nonexistent public symbol`);r[e].u!==void 0&&n!==void 0?r[e].u[n]=t:(r[e]=t,r[e].P=n)},Ue={},We=(e,t,n=[])=>(e.includes(`j`)?(e=e.replace(/p/g,`i`),t=(0,Ue[e])(t,...n)):t=Ct.get(t)(...n),t),Ge=(e,t)=>(...n)=>We(e,t,n),Q=(e,t)=>{e=q(e);var n=e.includes(`j`)?Ge(e,t):Ct.get(t);if(typeof n!=`function`)throw new W(`unknown function pointer with signature ${e}: ${t}`);return n};class Ke extends Error{}var $=(e,t)=>{function n(e){i[e]||J[e]||(Se[e]?Se[e].forEach(n):(r.push(e),i[e]=!0))}var r=[],i={};throw t.forEach(n),new Ke(`${e}: `+r.map(me).join([`, `]))};function qe(e){for(var t=1;ta)throw new W(`argTypes array size mismatch! Must at least get return value and 'this' types!`);var o=t[1]!==null&&n!==null,s=qe(t),c=!t[0].Ib,l=a-2,u=Array(l),d=[],f=[];return H(e,function(...e){if(f.length=0,d.length=o?2:1,d[0]=i,o){var n=t[1].v(f,this);d[1]=n}for(var a=0;a{for(var n=[],r=0;r>2]);return n},Xe=e=>{e=e.trim();let t=e.indexOf(`(`);return t===-1?e:e.slice(0,t)},Ze=(e,t,n)=>{if(!(e instanceof Object))throw new W(`${n} with invalid "this": ${e}`);if(!(e instanceof t.h.constructor))throw new W(`${n} incompatible with "this" of type ${e.constructor.name}`);if(!e.g.l)throw new W(`cannot call emscripten binding method ${n} on deleted object`);return Ne(e.g.l,e.g.o.h,t.h)},Qe=e=>{9{var t=G(e);return Qe(e),t},v:(e,t)=>K(t),H:be,G:null},et=(e,t,n)=>{switch(t){case 1:return n?function(e){return this.j(j[e])}:function(e){return this.j(M[e])};case 2:return n?function(e){return this.j(N[e>>1])}:function(e){return this.j(P[e>>1])};case 4:return n?function(e){return this.j(F[e>>2])}:function(e){return this.j(I[e>>2])};default:throw TypeError(`invalid integer width (${t}): ${e}`)}},tt=(e,t)=>{switch(t){case 4:return function(e){return this.j(L[e>>2])};case 8:return function(e){return this.j(ee[e>>3])};default:throw TypeError(`invalid float width (${t}): ${e}`)}},nt=(e,t,n)=>{switch(t){case 1:return n?e=>j[e]:e=>M[e];case 2:return n?e=>N[e>>1]:e=>P[e>>1];case 4:return n?e=>F[e>>2]:e=>I[e>>2];default:throw TypeError(`invalid integer width (${t}): ${e}`)}},rt=globalThis.TextDecoder&&new TextDecoder,it=(e,t,n,r)=>{if(n=t+n,r)return n;for(;e[t]&&!(t>=n);)++t;return t},at=(e,t=0,n,r)=>{if(n=it(e,t,n,r),16i?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|i&1023))}}else r+=String.fromCharCode(i)}return r},ot=globalThis.TextDecoder?new TextDecoder(`utf-16le`):void 0,st=(e,t,n)=>{if(e>>=1,t=it(P,e,t/2,n),16{if(n??=2147483647,2>n)return 0;n-=2;var r=t;n=n<2*e.length?n/2:e.length;for(var i=0;i>1]=e.charCodeAt(i),t+=2;return N[t>>1]=0,t-r},lt=e=>2*e.length,ut=(e,t,n)=>{var r=``;e>>=2;for(var i=0;!(i>=t/4);i++){var a=I[e+i];if(!a&&!n)break;r+=String.fromCodePoint(a)}return r},dt=(e,t,n)=>{if(n??=2147483647,4>n)return 0;var r=t;n=r+n-4;for(var i=0;i>2]=a,t+=4,t+4>n)break}return F[t>>2]=0,t-r},ft=e=>{for(var t=0,n=0;n{var t=pt.length;return pt.push(e),t},ht=(e,t)=>{for(var n=Array(e),r=0;r>2],`parameter ${r}`);return n},gt={},_t=e=>{var t=gt[e];return t===void 0?q(e):t},vt=[null,[],[]];if((()=>{let e=De.prototype;Object.assign(e,{isAliasOf:function(e){if(!(this instanceof De&&e instanceof De))return!1;var t=this.g.o.h,n=this.g.l;e.g=e.g;var r=e.g.o.h;for(e=e.g.l;t.A;)n=t.ea(n),t=t.A;for(;r.A;)e=r.ea(e),r=r.A;return t===r&&n===e},clone:function(){if(this.g.l||Te(this),this.g.$)return this.g.count.value+=1,this;var e=ve,t=Object,n=t.create,r=Object.getPrototypeOf(this),i=this.g;return e=e(n.call(t,r,{g:{value:{count:i.count,ca:i.ca,$:i.$,l:i.l,o:i.o,B:i.B,I:i.I}}})),e.g.count.value+=1,e.g.ca=!1,e},delete(){if(this.g.l||Te(this),this.g.ca&&!this.g.$)throw new W(`Object already scheduled for deletion`);ge(this);var e=this.g;--e.count.value,e.count.value===0&&(e.B?e.I.O(e.B):e.o.h.O(e.l)),this.g.$||(this.g.B=void 0,this.g.l=void 0)},isDeleted:function(){return!this.g.l},deleteLater:function(){if(this.g.l||Te(this),this.g.ca&&!this.g.$)throw new W(`Object already scheduled for deletion`);return Ee.push(this),this.g.ca=!0,this}});let t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(Ve.prototype,{Db(e){return this.$a&&(e=this.$a(e)),e},Oa(e){this.O?.(e)},H:be,j:function(e){function t(){return this.la?Be(this.h.N,{o:this.Lb,l:n,I:this,B:e}):Be(this.h.N,{o:this,l:e})}var n=this.Db(e);if(!n)return this.Oa(e),null;var r=ze(this.h,n);if(r!==void 0)return r.g.count.value===0?(r.g.l=n,r.g.B=e,r.clone()):(r=r.clone(),this.Oa(e),r);if(r=this.h.Cb(n),r=Oe[r],!r)return t.call(this);r=this.ka?r.sb:r.pointerType;var i=Re(n,this.h,r.h);return i===null?t.call(this):this.la?Be(r.h.N,{o:r,l:i,I:this,B:e}):Be(r.h.N,{o:r,l:i})}}),r.print&&(w=r.print),r.printErr&&(T=r.printErr),r.wasmBinary&&(E=r.wasmBinary),r.preInit)for(typeof r.preInit==`function`&&(r.preInit=[r.preInit]);0te(``),_embind_create_inheriting_constructor:(e,t,n)=>{e=q(e),t=he(t,`wrapper`),n=G(n);var r=t.h,i=r.N,a=r.A.N,o=r.A.constructor;return e=H(e,function(...e){for(var t of r.A.Za)if(this[t]===a[t])throw new de(`Pure virtual function ${t} must be implemented in JavaScript`);Object.defineProperty(this,"__parent",{value:i}),this.__construct(...e)}),i.__construct=function(...e){if(this===i)throw new W(`Pass correct 'this' to __construct`);e=o.implement(this,...e),ge(e);var t=e.g;if(e.notifyOnDestruction(),t.$=!0,Object.defineProperties(this,{g:{value:t}}),ve(this),e=t.l,e=pe(r,e),fe.hasOwnProperty(e))throw new W(`Tried to register registered instance: ${e}`);fe[e]=this},i.__destruct=function(){if(this===i)throw new W(`Pass correct 'this' to __destruct`);ge(this);var e=this.g.l;if(e=pe(r,e),fe.hasOwnProperty(e))delete fe[e];else throw new W(`Tried to unregister unregistered instance: ${e}`)},e.prototype=Object.create(i),Object.assign(e.prototype,n),K(e)},_embind_finalize_value_object:e=>{var t=Y[e];delete Y[e];var n=t.Fa,r=t.O,i=t.Ra,a=i.map(e=>e.Gb).concat(i.map(e=>e.Pb));X([e],a,e=>{var a={},o,s;for([o,s]of i.entries()){let t=e[o],n=s.Eb,r=s.Fb,c=e[o+i.length],l=s.Ob,u=s.Qb;a[s.Ab]={read:e=>t.j(n(r,e)),write:(e,t)=>{var n=[];l(u,e,c.v(n,t)),ye(n)},optional:t.optional}}return[{name:t.name,j:e=>{var t={},n;for(n in a)t[n]=a[n].read(e);return r(e),t},v:(e,t)=>{for(var i in a)if(!(i in t||a[i].optional))throw TypeError(`Missing field: "${i}"`);var o=n();for(i in a)a[i].write(o,t[i]);return e!==null&&e.push(r,o),o},H:be,G:r}]})},_embind_register_bigint:()=>{},_embind_register_bool:(e,t,n,r)=>{t=q(t),Z(e,{name:t,j:function(e){return!!e},v:function(e,t){return t?n:r},H:function(e){return this.j(M[e])},G:null})},_embind_register_class:(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{u=q(u),a=Q(i,a),s&&=Q(o,s),l&&=Q(c,l),f=Q(d,f);var p=je(u);Ae(p,function(){$(`Cannot construct ${u} due to unbound types`,[r])}),X([e,t,n],r?[r]:[],t=>{if(t=t[0],r)var n=t.h,i=n.N;else i=De.prototype;t=H(u,function(...e){if(Object.getPrototypeOf(this)!==o)throw new W(`Use 'new' to construct ${u}`);if(c.S===void 0)throw new W(`${u} has no accessible constructor`);var t=c.S[e.length];if(t===void 0)throw new W(`Tried to invoke ctor of ${u} with invalid number of parameters (${e.length}) - expected (${Object.keys(c.S).toString()}) parameters instead!`);return t.apply(this,e)});var o=Object.create(i,{constructor:{value:t}});t.prototype=o;var c=new Me(u,t,o,f,n,a,s,l);if(c.A){var d;(d=c.A).fa??(d.fa=[]),c.A.fa.push(c)}return n=new Ve(u,c,!0,!1,!1),d=new Ve(u+`*`,c,!1,!1,!1),i=new Ve(u+` const*`,c,!1,!0,!1),Oe[e]={pointerType:d,sb:i},He(p,t),[n,d,i]})},_embind_register_class_class_function:(e,t,n,r,i,a,o)=>{var s=Ye(n,r);t=q(t),t=Xe(t),a=Q(i,a),X([],[e],e=>{function r(){$(`Cannot call ${i} due to unbound types`,s)}e=e[0];var i=`${e.name}.${t}`;t.startsWith(`@@`)&&(t=Symbol[t.substring(2)]);var c=e.h.constructor;return c[t]===void 0?(r.P=n-1,c[t]=r):(ke(c,t,i),c[t].u[n-1]=r),X([],s,r=>{if(r=Je(i,[r[0],null].concat(r.slice(1)),null,a,o),c[t].u===void 0?(r.P=n-1,c[t]=r):c[t].u[n-1]=r,e.h.fa)for(let n of e.h.fa)n.constructor.hasOwnProperty(t)||(n.constructor[t]=r);return[]}),[]})},_embind_register_class_class_property:(e,t,n,r,i,a,o,s)=>{t=q(t),a=Q(i,a),X([],[e],e=>{e=e[0];var i=`${e.name}.${t}`,c={get(){$(`Cannot access ${i} due to unbound types`,[n])},enumerable:!0,configurable:!0};return c.set=s?()=>{$(`Cannot access ${i} due to unbound types`,[n])}:()=>{throw new W(`${i} is a read-only property`)},Object.defineProperty(e.h.constructor,t,c),X([],[n],n=>{n=n[0];var i={get(){return n.j(a(r))},enumerable:!0};return s&&(s=Q(o,s),i.set=e=>{var t=[];s(r,n.v(t,e)),ye(t)}),Object.defineProperty(e.h.constructor,t,i),[]}),[]})},_embind_register_class_constructor:(e,t,n,r,i,a)=>{var o=Ye(t,n);i=Q(r,i),X([],[e],e=>{e=e[0];var n=`constructor ${e.name}`;if(e.h.S===void 0&&(e.h.S=[]),e.h.S[t-1]!==void 0)throw new W(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.h.S[t-1]=()=>{$(`Cannot construct ${e.name} due to unbound types`,o)},X([],o,r=>(r.splice(1,0,null),e.h.S[t-1]=Je(n,r,null,i,a),[])),[]})},_embind_register_class_function:(e,t,n,r,i,a,o,s)=>{var c=Ye(n,r);t=q(t),t=Xe(t),a=Q(i,a),X([],[e],e=>{function r(){$(`Cannot call ${i} due to unbound types`,c)}e=e[0];var i=`${e.name}.${t}`;t.startsWith(`@@`)&&(t=Symbol[t.substring(2)]),s&&e.h.Za.push(t);var l=e.h.N,u=l[t];return u===void 0||u.u===void 0&&u.className!==e.name&&u.P===n-2?(r.P=n-2,r.className=e.name,l[t]=r):(ke(l,t,i),l[t].u[n-2]=r),X([],c,r=>(r=Je(i,r,e,a,o),l[t].u===void 0?(r.P=n-2,l[t]=r):l[t].u[n-2]=r,[])),[]})},_embind_register_class_property:(e,t,n,r,i,a,o,s,c,l)=>{t=q(t),i=Q(r,i),X([],[e],e=>{e=e[0];var r=`${e.name}.${t}`,u={get(){$(`Cannot access ${r} due to unbound types`,[n,o])},enumerable:!0,configurable:!0};return u.set=c?()=>$(`Cannot access ${r} due to unbound types`,[n,o]):()=>{throw new W(r+` is a read-only property`)},Object.defineProperty(e.h.N,t,u),X([],c?[n,o]:[n],n=>{var o=n[0],u={get(){var t=Ze(this,e,r+` getter`);return o.j(i(a,t))},enumerable:!0};if(c){c=Q(s,c);var d=n[1];u.set=function(t){var n=Ze(this,e,r+` setter`),i=[];c(l,n,d.v(i,t)),ye(i)}}return Object.defineProperty(e.h.N,t,u),[]}),[]})},_embind_register_emval:e=>Z(e,$e),_embind_register_enum:(e,t,n,i,a)=>{switch(t=q(t),a=a===0?`object`:a===1?`number`:`string`,a){case`object`:function s(){}s.values={},Z(e,{name:t,constructor:s,valueType:a,j:function(e){return this.constructor.values[e]},v:(e,t)=>t.value,H:et(t,n,i),G:null}),Ae(t,s);break;case`number`:var o={};Z(e,{name:t,Ca:o,valueType:a,j:e=>e,v:(e,t)=>t,H:et(t,n,i),G:null}),Ae(t,o),delete r[t].P;break;case`string`:o={},Z(e,{name:t,gb:{},ab:{},Ca:o,valueType:a,j:function(e){return this.ab[e]},v:function(e,t){return this.gb[t]},H:et(t,n,i),G:null}),Ae(t,o),delete r[t].P}},_embind_register_enum_value:(e,t,n)=>{var r=he(e,`enum`);switch(t=q(t),r.valueType){case`object`:e=r.constructor,r=Object.create(r.constructor.prototype,{value:{value:n},constructor:{value:H(`${r.name}_${t}`,function(){})}}),e.values[n]=r,e[t]=r;break;case`number`:r.Ca[t]=n;break;case`string`:r.gb[t]=n,r.ab[n]=t,r.Ca[t]=t}},_embind_register_float:(e,t,n)=>{t=q(t),Z(e,{name:t,j:e=>e,v:(e,t)=>t,H:tt(t,n),G:null})},_embind_register_function:(e,t,n,r,i,a)=>{var o=Ye(t,n);e=q(e),e=Xe(e),i=Q(r,i),Ae(e,function(){$(`Cannot call ${e} due to unbound types`,o)},t-1),X([],o,n=>(He(e,Je(e,[n[0],null].concat(n.slice(1)),null,i,a),t-1),[]))},_embind_register_integer:(e,t,n,r,i)=>{t=q(t);let a=e=>e;if(r===0){var o=32-8*n;a=e=>e<>>o,i=a(i)}Z(e,{name:t,j:a,v:(e,t)=>t,H:nt(t,n,r!==0),G:null})},_embind_register_memory_view:(e,t,n)=>{function r(e){return new i(j.buffer,I[e+4>>2],I[e>>2])}var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];n=q(n),Z(e,{name:n,j:r,H:r},{Hb:!0})},_embind_register_std_string:(e,t)=>{t=q(t),Z(e,{name:t,j(e){var t=(t=e+4)?at(M,t,I[e>>2],!0):``;return yt(e),t},v(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n,r=typeof t==`string`;if(!(r||ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT==1))throw new W(`Cannot pass non-string to std::string`);var i;if(r)for(n=i=0;n=a?i++:2047>=a?i+=2:55296<=a&&57343>=a?(i+=4,++n):i+=3}else i=t.length;if(n=i,i=bt(4+n+1),a=i+4,I[i>>2]=n,r){if(r=a,a=n+1,n=M,0=s){if(r>=a)break;n[r++]=s}else if(2047>=s){if(r+1>=a)break;n[r++]=192|s>>6,n[r++]=128|s&63}else if(65535>=s){if(r+2>=a)break;n[r++]=224|s>>12,n[r++]=128|s>>6&63,n[r++]=128|s&63}else{if(r+3>=a)break;n[r++]=240|s>>18,n[r++]=128|s>>12&63,n[r++]=128|s>>6&63,n[r++]=128|s&63,o++}}n[r]=0}}else M.set(t,a);return e!==null&&e.push(yt,i),i},H:be,G(e){yt(e)}})},_embind_register_std_wstring:(e,t,n)=>{if(n=q(n),t===2)var r=st,i=ct,a=lt;else r=ut,i=dt,a=ft;Z(e,{name:n,j:e=>{var n=r(e+4,I[e>>2]*t,!0);return yt(e),n},v:(e,r)=>{if(typeof r!=`string`)throw new W(`Cannot pass non-string to C++ string type ${n}`);var o=a(r),s=bt(4+o+t);return I[s>>2]=o/t,i(r,s+4,o+t),e!==null&&e.push(yt,s),s},H:be,G(e){yt(e)}})},_embind_register_value_object:(e,t,n,r,i,a)=>{Y[e]={name:q(t),Fa:Q(n,r),O:Q(i,a),Ra:[]}},_embind_register_value_object_field:(e,t,n,r,i,a,o,s,c,l)=>{Y[e].Ra.push({Ab:q(t),Gb:n,Eb:Q(r,i),Fb:a,Pb:o,Ob:Q(s,c),Qb:l})},_embind_register_void:(e,t)=>{t=q(t),Z(e,{Ib:!0,name:t,j:()=>{},v:()=>{}})},_emval_create_invoker:(e,t,n)=>{var[r,...i]=ht(e,t),a=r.v.bind(r),o=i.map(e=>e.H.bind(e));e--;var s=Array(e);return t=`methodCaller<(${i.map(e=>e.name)}) => ${r.name}>`,mt(H(t,(t,r,i,c)=>{for(var l=0,u=0;u>2]=K(t)),d}))},_emval_decref:Qe,_emval_get_module_property:e=>(e=_t(e),K(r[e])),_emval_get_property:(e,t)=>(e=G(e),t=G(t),K(e[t])),_emval_incref:e=>{9pt[e](t,n,r,i),_emval_new_array:()=>K([]),_emval_new_cstring:e=>K(_t(e)),_emval_new_object:()=>K({}),_emval_run_destructors:e=>{ye(G(e)),Qe(e)},_emval_set_property:(e,t,n)=>{e=G(e),t=G(t),n=G(n),e[t]=n},clock_time_get:function(e,t,n,r){return 0<=e&&3>=e?(e=Math.round(1e6*(e===0?Date.now():performance.now())),ae=[e>>>0,(V=e,1<=+Math.abs(V)?0>>0:~~+Math.ceil((V-+(~~V>>>0))/4294967296)>>>0:0)],F[r>>2]=ae[0],F[r+4>>2]=ae[1],0):28},emscripten_resize_heap:e=>{var t=M.length;if(e>>>=0,2147483648=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);a:{r=(Math.min(2147483648,65536*Math.ceil(Math.max(e,r)/65536))-St.buffer.byteLength+65535)/65536|0;try{St.grow(r),z();var i=1;break a}catch{}i=void 0}if(i)return!0}return!1},fd_close:()=>52,fd_seek:function(){return 70},fd_write:(e,t,n,r)=>{for(var i=0,a=0;a>2],s=I[t+4>>2];t+=8;for(var c=0;c>2]=i,0}},Tt=await async function(){function e(e){return e=Tt=e.exports,yt=e.free,bt=e.malloc,xt=e.__getTypeName,Ue.vij=e.dynCall_vij,Ue.iij=e.dynCall_iij,Ue.ji=e.dynCall_ji,Ue.jiji=e.dynCall_jiji,St=e.memory,Ct=e.__indirect_function_table,z(),Tt}var t={env:wt,wasi_snapshot_preview1:wt};return r.instantiateWasm?new Promise(n=>{r.instantiateWasm(t,(t,r)=>{n(e(t,r))})}):(B??=r.locateFile?r.locateFile(`canvas_advanced_c2d_only.wasm`,x):x+`canvas_advanced_c2d_only.wasm`,e((await ie(t)).instance))}();return(function(){function e(){if(r.calledRun=!0,!D){if(R=!0,Tt.__wasm_call_ctors(),k?.(r),r.onRuntimeInitialized?.(),r.postRun)for(typeof r.postRun==`function`&&(r.postRun=[r.postRun]);r.postRun.length;){var e=r.postRun.shift();se.push(e)}oe(se)}}if(r.preRun)for(typeof r.preRun==`function`&&(r.preRun=[r.preRun]);r.preRun.length;)le();oe(ce),r.setStatus?(r.setStatus(`Running...`),setTimeout(()=>{setTimeout(()=>r.setStatus(``),1),e()},1)):e()})(),n=R?r:new Promise((e,t)=>{k=e,A=t}),n}})()}),(e=>{e.exports=JSON.parse(`{"name":"@rive-app/canvas-lite","version":"2.44.2","description":"A lite version of Rive's canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso (https://rive.app)","Maxwell Talbot (https://rive.app)","Arthur Vivian (https://rive.app)","Umberto Sonnino (https://rive.app)","Matthew Sullivan (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}}`)}),((e,t,n)=>{n.r(t),n.d(t,{AccessibilityOverlay:()=>i.AccessibilityOverlay,CHECK_STATE_MASK:()=>a.CHECK_STATE_MASK,CHECK_STATE_OFFSET:()=>a.CHECK_STATE_OFFSET,SemanticActionType:()=>a.SemanticActionType,SemanticCheckState:()=>a.SemanticCheckState,SemanticMode:()=>a.SemanticMode,SemanticRole:()=>a.SemanticRole,SemanticState:()=>a.SemanticState,SemanticTrait:()=>a.SemanticTrait,SemanticTreeModel:()=>r.SemanticTreeModel,checkStateOf:()=>a.checkStateOf,hasState:()=>a.hasState,hasTrait:()=>a.hasTrait,roleName:()=>a.roleName,stateNames:()=>a.stateNames,traitNames:()=>a.traitNames});var r=n(7),i=n(9),a=n(8)}),((e,t,n)=>{n.r(t),n.d(t,{SemanticTreeModel:()=>a});var r=n(8),i=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;rn?n:e}function s(e,t){if(e.length!==t.length)return!1;for(var n=0;n{n.r(t),n.d(t,{CHECK_STATE_MASK:()=>c,CHECK_STATE_OFFSET:()=>s,SemanticActionType:()=>p,SemanticCheckState:()=>o,SemanticMode:()=>u,SemanticRole:()=>r,SemanticState:()=>i,SemanticTrait:()=>d,checkStateOf:()=>l,hasState:()=>a,hasTrait:()=>f,roleName:()=>S,stateNames:()=>C,traitNames:()=>w});var r={none:0,button:1,link:2,checkbox:3,switchControl:4,slider:5,textField:6,text:7,image:8,group:9,list:10,listItem:11,tab:12,tabList:13,dialog:14,alertDialog:15,radioGroup:16,radioButton:17},i={None:0,Expanded:1,Selected:2,Toggled:16,Required:32,Disabled:64,Focused:128,Hidden:256,LiveRegion:512,ReadOnly:1024,Modal:2048,Obscured:4096,Multiline:8192};function a(e,t){return(e&t)!==0}var o={Unchecked:0,Checked:1,Mixed:2},s=2,c=3<>s;return t>=o.Mixed?o.Mixed:t}var u={Disabled:`disabled`,Enabled:`enabled`},d={None:0,Expandable:1,Selectable:2,Checkable:4,Toggleable:8,Requirable:16,Enablable:32,Focusable:64};function f(e,t){return(e&t)!==0}for(var p={tap:0,increase:1,decrease:2},m={},h=0,g=Object.entries(r);h{n.r(t),n.d(t,{AccessibilityOverlay:()=>c});var r=n(10),i=n(11),a=n(8),o=!1;function s(e){if(!o){var t=e.offsetParent;if(t){for(var n=function(e){return e===`auto`||e===`scroll`||e===`overlay`},r=null,i=e.parentElement,a=32,s=0;i&&i!==document.documentElement&&s "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.`))}}}var c=function(){function e(e){var t=this;this.elements=new Map,this.descElements=new Map,this.lastSemanticVersion=-1,this.lastGeometryVersion=-1,this.pendingTextGeometry=[],this.textGeometryKeys=new WeakMap,this.appliedNodes=new WeakMap,this.lastCanvasPositioning={width:-1,height:-1,offsetTop:-1,offsetLeft:-1},this._geometryDirty=!0,this.isUpdating=!1,this.editingHostNodeId=null,this.editingHostSemanticVersion=-1,this.transformContainer=null,this._artboardBounds={minX:0,minY:0,maxX:0,maxY:0},this.repositionTimer=null,this.canvasResizeObserver=null,this.parentResizeObserver=null,this.positionObserver=null,this._onWindowResize=function(){return t.scheduleReposition()},this.instanceId=e.instanceId,this.fireAction=e.fireAction,this.requestFocus=e.requestFocus,this.clearFocus=e.clearFocus,this.canvas=e.canvas,this.semanticsOptions=e.semanticsOptions,this.allowFocusInterrupt=e.allowFocusInterrupt??!1,this.isEditingHostFocused=e.isEditingHostFocused??(function(){return!1}),this.container=this.createContainer(e.canvas),this.attachPositionObservers(),s(e.canvas)}return e.prototype.setEditingHostNode=function(e){if(this.editingHostNodeId!==e){var t=this.editingHostNodeId;if(this.editingHostNodeId=e,t!==null){var n=this.elements.get(t);if(n){var r=this.appliedNodes.get(n);r&&this.isAriaHidden(r)?v(n,`aria-hidden`,`true`):y(n,`aria-hidden`)}}if(e!==null){var i=this.elements.get(e);i&&v(i,`aria-hidden`,`true`)}}},e.prototype.syncEditingHost=function(e,t,n){if(n||e.semanticVersion!==this.editingHostSemanticVersion){this.editingHostSemanticVersion=e.semanticVersion;var r=e.focusedNode();r===void 0||r.role!==a.SemanticRole.textField?this.editingHostNodeId!==null&&(t.resetDecoration(),this.setEditingHostNode(null)):(t.setSecure((0,a.hasState)(r.stateFlags,a.SemanticState.Obscured)),t.decorate({"aria-label":r.label||null,"aria-readonly":(0,a.hasState)(r.stateFlags,a.SemanticState.ReadOnly)?`true`:null,"aria-multiline":(0,a.hasState)(r.stateFlags,a.SemanticState.Multiline)?`true`:null,"aria-required":(0,a.hasTrait)(r.traitFlags,a.SemanticTrait.Requirable)&&(0,a.hasState)(r.stateFlags,a.SemanticState.Required)?`true`:null,"aria-describedby":r.hint&&this.descElements.get(r.id)?.id||null}),this.setEditingHostNode(r.id))}},e.prototype.hasEditingHost=function(){return this.editingHostNodeId!==null},e.prototype.releaseEditingHost=function(e,t){if(t?.resetDecoration(),this.setEditingHostNode(null),this.editingHostSemanticVersion=-1,t?.hasDomFocus()){var n=e?.focusedNode()?.id;n!==void 0&&this.focusNodeElement(n)}},e.prototype.focusNodeElement=function(e){var t=this.elements.get(e);t&&this.focusElementInPlace(t)},e.prototype.focusElementInPlace=function(e){var t,n;this.syncContainerBeforeFocus(),e.focus({preventScroll:!0}),(n=(t=this.canvas).scrollIntoView)==null||n.call(t,{block:`nearest`,inline:`nearest`,behavior:`instant`}),this.syncContainerGeometry(),this.observePosition()},e.prototype.getSemanticOverlayContainer=function(){return this.container},e.prototype.attachPositionObservers=function(){var e=this;this.canvasResizeObserver=new ResizeObserver(function(){return e.scheduleReposition()}),this.canvasResizeObserver.observe(this.canvas);var t=this.canvas.parentElement;t&&(this.parentResizeObserver=new ResizeObserver(function(){return e.scheduleReposition()}),this.parentResizeObserver.observe(t)),window.addEventListener(`resize`,this._onWindowResize),this.observePosition()},e.prototype.observePosition=function(){var e=this,t;if(typeof IntersectionObserver<`u`){(t=this.positionObserver)==null||t.disconnect(),this.positionObserver=null;var n=this.canvas.getBoundingClientRect();if(n.width&&n.height){var r=[n.top,window.innerWidth-n.right,window.innerHeight-n.bottom,n.left].map(function(e){return`${-Math.round(e)}px`}).join(` `),i=!1;this.positionObserver=new IntersectionObserver(function(){i?e.scheduleReposition():i=!0},{threshold:1,rootMargin:r}),this.positionObserver.observe(this.canvas)}}},e.prototype.scheduleReposition=function(){var e=this;this._geometryDirty=!0,this.repositionTimer===null&&(this.repositionTimer=setTimeout(function(){e.repositionTimer=null,e.syncContainerGeometry(),e.observePosition()},500))},e.prototype.syncContainerGeometry=function(){var e=this.canvas.getBoundingClientRect(),t=(0,i.canvasOffset)(this.canvas),n=t.top,r=t.left,a=e.width!==this.lastCanvasPositioning.width||e.height!==this.lastCanvasPositioning.height;return!a&&n===this.lastCanvasPositioning.offsetTop&&r===this.lastCanvasPositioning.offsetLeft?!1:(this.container.style.top=n+`px`,this.container.style.left=r+`px`,this.container.style.width=e.width+`px`,this.container.style.height=e.height+`px`,this.container.tabIndex=-1,this.lastCanvasPositioning.width=e.width,this.lastCanvasPositioning.height=e.height,this.lastCanvasPositioning.offsetTop=n,this.lastCanvasPositioning.offsetLeft=r,a)},e.prototype.syncContainerBeforeFocus=function(){this.syncContainerGeometry()&&(this._geometryDirty=!0)},e.prototype.createContainer=function(e){var t=document.createElement(`div`);t.id=`rive-a11y-${this.instanceId}`,t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,this.semanticsOptions?.riveCanvasLabel??`Rive animation`);var n=e.getBoundingClientRect(),r=(0,i.canvasOffset)(this.canvas),a=r.top,o=r.left;return t.style.cssText=[`position:absolute`,`top:${a}px`,`left:${o}px`,`line-height:normal`,`font-size:16px`,`width:${n.width}px`,`height:${n.height}px`,`overflow:hidden`,`pointer-events:none`,`opacity:0`].join(`;`),e.insertAdjacentElement(`afterend`,t),t},e.prototype.needsUpdate=function(e){var t=e.semanticVersion!==this.lastSemanticVersion,n=e.geometryVersion!==this.lastGeometryVersion,r=this._geometryDirty||!this.transformContainer;return!t&&!n&&!r?null:{semanticChanged:t,nodeGeometryChanged:n,layoutChanged:r}},e.prototype.update=function(e,t,n,r,i){var a=i??this.needsUpdate(e);!a&&t&&(a={semanticChanged:!1,nodeGeometryChanged:!1,layoutChanged:!0}),a&&this.performUpdate(e,t,n,r,a)},e.prototype.performUpdate=function(e,t,n,r,i){var a=i.semanticChanged,o=i.nodeGeometryChanged,s=e.semanticVersion-this.lastSemanticVersion>1;if(this.lastSemanticVersion=e.semanticVersion,this.lastGeometryVersion=e.geometryVersion,this.isUpdating=!0,this._artboardBounds=r,t&&(this.syncContainerGeometry(),this.syncTransformContainer(t,n,r),this._geometryDirty=!1),a){var c=this.transformContainer??this.container,l=new Set;this.rebuildChildren(c,e.roots,e,0,0,l,s);var u=[];this.elements.forEach(function(e,t){l.has(t)||u.push(t)});for(var d=0,f=u;d0&&this.rebuildChildren(d,u.children,n,u.minX,u.minY,o,s),f&&this.autoFocusDialogOnAppear(d,u,n)}}},e.prototype.updateGeometryForChangedNodes=function(e){for(var t=0,n=Array.from(e.geometryChangedIds);t=0){var c=e.nodeById(i.parentId);c&&(a=c.minX,o=c.minY,s=this.elements.get(i.parentId)??s)}this.updateNodeGeometrySubtree(e,r,a,o,s)}}},e.prototype.updateNodeGeometrySubtree=function(e,t,n,r,i){var a=e.nodeById(t);if(a){var o=this.elements.get(t);if(o){this.applyPosition(o,a,n,r);for(var s=0,c=a.children;s0||!a.label){var s=this.routeDefaultFocusTarget(a,t);if(s)return s}else if(o)return o.querySelector(`:scope > span`)??o}}return null},Object.defineProperty(e.prototype,"nodeIdPrefix",{get:function(){return`rive-${this.instanceId}-sem-`},enumerable:!1,configurable:!0}),e.prototype.nodeIdFromElement=function(e){if(!e.id.startsWith(this.nodeIdPrefix))return null;var t=e.id.slice(this.nodeIdPrefix.length);if(!t)return null;var n=Number(t);return Number.isNaN(n)?null:n},e.prototype.createElement=function(e){var t=T(e.role),n=document.createElement(t);if(n.id=`${this.nodeIdPrefix}${e.id}`,n.style.cssText=g,e.role===a.SemanticRole.text){var r=document.createElement(`span`);r.style.cssText=_,n.appendChild(r)}return this.attachActionHandlers(n,e),n},e.prototype.attachRovingNav=function(e,t){var n=this;e.addEventListener(`keydown`,function(i){var o=null;if(i.key===`ArrowRight`||i.key===`ArrowDown`?o=`next`:i.key===`ArrowLeft`||i.key===`ArrowUp`?o=`prev`:t.includeHomeEnd&&i.key===`Home`?o=`first`:t.includeHomeEnd&&i.key===`End`&&(o=`last`),o){(0,r.claimKeyEvent)(i);var s=t.members(),c=s.indexOf(e);if(!(c<0)){var l=s.length,u=o===`next`?s[(c+1)%l]:o===`prev`?s[(c-1+l)%l]:o===`first`?s[0]:s[l-1];if(u&&u!==e){n.focusElementInPlace(u);var d=n.nodeIdFromElement(u);d!==null&&n.fireAction(d,a.SemanticActionType.tap)}}}})},e.prototype.attachActionHandlers=function(e,t){var n=this,i=t.role,o=t.id;if(x(i)){e.addEventListener(`click`,function(){n.fireAction(o,a.SemanticActionType.tap)});var s=i===a.SemanticRole.link?[`Enter`]:[`Enter`,` `];e.addEventListener(`keydown`,function(e){s.includes(e.key)&&((0,r.claimKeyEvent)(e),n.fireAction(o,a.SemanticActionType.tap))})}i===a.SemanticRole.slider&&e.addEventListener(`keydown`,function(e){e.key===`ArrowRight`||e.key===`ArrowUp`?((0,r.claimKeyEvent)(e),n.fireAction(o,a.SemanticActionType.increase)):(e.key===`ArrowLeft`||e.key===`ArrowDown`)&&((0,r.claimKeyEvent)(e),n.fireAction(o,a.SemanticActionType.decrease))}),i===a.SemanticRole.tab&&this.attachRovingNav(e,{includeHomeEnd:!0,members:function(){var t=e.parentElement;return t?Array.from(t.children).filter(function(e){return e instanceof HTMLElement&&e.getAttribute(`role`)===`tab`}):[]}}),i===a.SemanticRole.radioButton&&this.attachRovingNav(e,{includeHomeEnd:!1,members:function(){var t=e.closest(`[role="radiogroup"]`)??e.parentElement;return t?Array.from(t.querySelectorAll(`[role="radio"]`)):[]}}),(0,a.hasTrait)(t.traitFlags,a.SemanticTrait.Focusable)&&e.addEventListener(`focus`,function(){n.requestFocus(o)})},e.prototype.isAriaHidden=function(e){var t=e.role,n=e.stateFlags,r=t===a.SemanticRole.image&&!e.label,i=e.id===this.editingHostNodeId;return(0,a.hasState)(n,a.SemanticState.Hidden)||(0,a.hasState)(n,a.SemanticState.Obscured)&&t!==a.SemanticRole.textField||r||i},e.prototype.applyAttributes=function(e,t){this.appliedNodes.set(e,t);var n=t.role,r=t.stateFlags,i=t.traitFlags,o=E(n);if(o?v(e,`role`,o):y(e,`role`),n===a.SemanticRole.link&&v(e,`role`,`link`),S(n)||(0,a.hasTrait)(i,a.SemanticTrait.Focusable)||n===a.SemanticRole.listItem?v(e,`tabindex`,`-1`):y(e,`tabindex`),t.label?v(e,`aria-label`,t.label):y(e,`aria-label`),n===a.SemanticRole.slider){if(t.value){var s=parseFloat(t.value);Number.isFinite(s)?v(e,`aria-valuenow`,String(s)):y(e,`aria-valuenow`),v(e,`aria-valuetext`,t.value)}else y(e,`aria-valuenow`),y(e,`aria-valuetext`);v(e,`aria-orientation`,`horizontal`),b(e,`aria-readonly`,(0,a.hasState)(r,a.SemanticState.ReadOnly))}else y(e,`aria-valuenow`),y(e,`aria-valuetext`),y(e,`aria-orientation`),y(e,`aria-readonly`);if(t.hint){var c=`rive-${this.instanceId}-desc-${t.id}`,g=this.descElements.get(t.id);g||(g=document.createElement(`span`),g.id=c,g.style.cssText=h,this.container.appendChild(g),this.descElements.set(t.id,g)),g.textContent!==t.hint&&(g.textContent=t.hint),v(e,`aria-describedby`,c)}else{y(e,`aria-describedby`);var _=this.descElements.get(t.id);_&&(_.parentNode&&_.parentNode.removeChild(_),this.descElements.delete(t.id))}if(n===a.SemanticRole.text){var x=e.querySelector(`:scope > span`)??e,w=t.label??``;x.textContent!==w&&(x.textContent=w),y(e,`aria-label`),t.headingLevel>0?(v(e,`role`,`heading`),v(e,`aria-level`,String(t.headingLevel))):y(e,`aria-level`)}if((0,a.hasTrait)(i,a.SemanticTrait.Expandable)&&l.has(n)?b(e,`aria-expanded`,(0,a.hasState)(r,a.SemanticState.Expanded)):y(e,`aria-expanded`),n===a.SemanticRole.tab||(0,a.hasTrait)(i,a.SemanticTrait.Selectable)&&u.has(n)?b(e,`aria-selected`,(0,a.hasState)(r,a.SemanticState.Selected)):y(e,`aria-selected`),(0,a.hasTrait)(i,a.SemanticTrait.Checkable)&&d.has(n)){var T=(0,a.checkStateOf)(r);T===a.SemanticCheckState.Mixed&&f.has(n)?v(e,`aria-checked`,`mixed`):b(e,`aria-checked`,T===a.SemanticCheckState.Checked)}else y(e,`aria-checked`);if((0,a.hasTrait)(i,a.SemanticTrait.Toggleable)?(p.has(n)?b(e,`aria-pressed`,(0,a.hasState)(r,a.SemanticState.Toggled)):y(e,`aria-pressed`),n===a.SemanticRole.switchControl&&b(e,`aria-checked`,(0,a.hasState)(r,a.SemanticState.Toggled))):y(e,`aria-pressed`),(0,a.hasTrait)(i,a.SemanticTrait.Requirable)&&m.has(n)?b(e,`aria-required`,(0,a.hasState)(r,a.SemanticState.Required)):y(e,`aria-required`),(0,a.hasTrait)(i,a.SemanticTrait.Enablable)?b(e,`aria-disabled`,(0,a.hasState)(r,a.SemanticState.Disabled)):y(e,`aria-disabled`),this.isAriaHidden(t)?v(e,`aria-hidden`,`true`):y(e,`aria-hidden`),(0,a.hasState)(r,a.SemanticState.LiveRegion)?v(e,`aria-live`,`polite`):y(e,`aria-live`),n===a.SemanticRole.textField){if(b(e,`aria-readonly`,(0,a.hasState)(r,a.SemanticState.ReadOnly)),b(e,`aria-multiline`,(0,a.hasState)(r,a.SemanticState.Multiline)),t.children.length===0){var D=(0,a.hasState)(r,a.SemanticState.Obscured)?``:t.value??``;e.textContent!==D&&(e.textContent=D)}else for(var O=0,k=Array.from(e.childNodes);O span`)??r,a=`${r.style.width}|${r.style.height}|${i.textContent}`;this.textGeometryKeys.get(r)!==a&&(i.style.width=`auto`,i.style.height=`auto`,i.style.transformOrigin=`0 0`,i.style.transform=``,e.push({host:r,span:i,key:a}))}this.pendingTextGeometry.length=0;for(var o=e.map(function(e){var t=e.host,n=e.span,r=t.getBoundingClientRect(),i=n.getBoundingClientRect();return i.width>0&&i.height>0?`scale(${r.width/i.width}, ${r.height/i.height})`:`none`}),s=0;s0&&o>0?o/this.canvas.width:c,u=this.canvas.height>0&&s>0?s/this.canvas.height:c,d=e.xx*l,f=e.xy*u,p=e.yx*l,m=e.yy*u,h=e.tx*l,g=e.ty*u;this.transformContainer.style.transform=`matrix(${d},${f},${p},${m},${h},${g})`},e}(),l=new Set([a.SemanticRole.button,a.SemanticRole.link,a.SemanticRole.checkbox,a.SemanticRole.switchControl,a.SemanticRole.tab]),u=new Set([a.SemanticRole.tab]),d=new Set([a.SemanticRole.checkbox,a.SemanticRole.radioButton,a.SemanticRole.switchControl]),f=new Set([a.SemanticRole.checkbox]),p=new Set([a.SemanticRole.button]),m=new Set([a.SemanticRole.checkbox,a.SemanticRole.textField,a.SemanticRole.radioGroup]),h=`position:absolute;width:1px;height:1px;overflow:hidden;pointer-events:none;left:-9999px`,g=`position:absolute;pointer-events:none;box-sizing:border-box;overflow:visible;margin:0;padding:0;transform-origin: 0px 0px 0px;border:none;background:transparent;color:transparent`,_=`display:inline-block;white-space:nowrap;pointer-events:none`;function v(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function y(e,t){e.hasAttribute(t)&&e.removeAttribute(t)}function b(e,t,n){v(e,t,n?`true`:`false`)}function x(e){switch(e){case a.SemanticRole.button:case a.SemanticRole.link:case a.SemanticRole.checkbox:case a.SemanticRole.switchControl:case a.SemanticRole.tab:case a.SemanticRole.radioButton:return!0;default:return!1}}function S(e){switch(e){case a.SemanticRole.button:case a.SemanticRole.link:case a.SemanticRole.checkbox:case a.SemanticRole.switchControl:case a.SemanticRole.slider:case a.SemanticRole.tab:case a.SemanticRole.radioButton:case a.SemanticRole.textField:return!0;default:return!1}}function C(e,t){return e===a.SemanticRole.alertDialog||e===a.SemanticRole.dialog&&(0,a.hasState)(t,a.SemanticState.Modal)}function w(e){return S(e.role)||(0,a.hasTrait)(e.traitFlags,a.SemanticTrait.Focusable)}function T(e){switch(e){case a.SemanticRole.link:return`a`;case a.SemanticRole.text:return`div`;default:return`div`}}function E(e){switch(e){case a.SemanticRole.none:return`group`;case a.SemanticRole.button:return`button`;case a.SemanticRole.link:return null;case a.SemanticRole.checkbox:return`checkbox`;case a.SemanticRole.switchControl:return`switch`;case a.SemanticRole.slider:return`slider`;case a.SemanticRole.textField:return`textbox`;case a.SemanticRole.image:return`img`;case a.SemanticRole.group:return`group`;case a.SemanticRole.list:return`list`;case a.SemanticRole.listItem:return`listitem`;case a.SemanticRole.tab:return`tab`;case a.SemanticRole.tabList:return`tablist`;case a.SemanticRole.dialog:return`dialog`;case a.SemanticRole.alertDialog:return`alertdialog`;case a.SemanticRole.radioGroup:return`radiogroup`;case a.SemanticRole.radioButton:return`radio`;case a.SemanticRole.text:return null;default:return null}}}),((e,t,n)=>{n.r(t),n.d(t,{claimKeyEvent:()=>i,isKeyEventClaimed:()=>a});var r=new WeakSet;function i(e){e.preventDefault(),r.add(e)}function a(e){return r.has(e)}}),((e,t,n)=>{n.r(t),n.d(t,{canvasOffset:()=>r});function r(e){var t=e.offsetTop,n=e.offsetLeft,r=e.offsetParent;if(!r)return{top:t,left:n};for(var i=e.parentElement;i&&i!==r;i=i.parentElement)t-=i.scrollTop,n-=i.scrollLeft;return{top:t,left:n}}}),((e,t,n)=>{n.r(t),n.d(t,{AudioAssetWrapper:()=>o.AudioAssetWrapper,AudioWrapper:()=>o.AudioWrapper,BLANK_URL:()=>a.BLANK_URL,CustomFileAssetLoaderWrapper:()=>o.CustomFileAssetLoaderWrapper,FileAssetWrapper:()=>o.FileAssetWrapper,FileFinalizer:()=>o.FileFinalizer,FocusSessionState:()=>i.FocusSessionState,FontAssetWrapper:()=>o.FontAssetWrapper,FontWrapper:()=>o.FontWrapper,ImageAssetWrapper:()=>o.ImageAssetWrapper,ImageWrapper:()=>o.ImageWrapper,KeyboardInteractions:()=>i.KeyboardInteractions,RiveFont:()=>s.RiveFont,createFinalization:()=>o.createFinalization,finalizationRegistry:()=>o.finalizationRegistry,registerTouchInteractions:()=>r.registerTouchInteractions,sanitizeUrl:()=>a.sanitizeUrl});var r=n(13),i=n(14),a=n(17),o=n(18),s=n(19)}),((e,t,n)=>{n.r(t),n.d(t,{registerTouchInteractions:()=>c});var r=void 0,i=16,a=1,o=function(e,t,n){var r=[];if(t)for(var i=0;i`u`)return null;for(var w=0,T=c;w{n.r(t),n.d(t,{FocusSessionState:()=>u,KeyboardInteractions:()=>d});var r=n(15),i=n(10),a=n(16),o=new Set([`Space`,`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Backspace`,`Delete`,`Home`,`End`,`Enter`,`NumpadEnter`]);function s(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey}function c(e){return e===r.Key.left||e===r.Key.right||e===r.Key.up||e===r.Key.down}function l(e){return e.altKey||e.ctrlKey||e.metaKey}var u;(function(e){e.NotFocused=`notFocused`,e.EntryPending=`entryPending`,e.RiveFocused=`riveFocused`})(u||={});var d=function(){function e(e){var t=e.canvas,n=e.stateMachine,d=e.hasFocusNodes,f=e.getOverlayElement,p=this;this.focusSessionState=u.NotFocused,this.canvasHasFocus=!1,this.focusDomainReleased=!1,this.currentOverlayElement=null,this.claimedKeyCodes=new Set,this.textInputSessionActive=!1,this.onCopy=function(e){var t;e.preventDefault();var n=p.mainSm.selectedText();n&&((t=e.clipboardData)==null||t.setData(`text/plain`,n))},this.onCanvasFocus=function(e){p.syncOverlayListener(),p.canvasHasFocus=!0,p.focusDomainReleased=!1,p.isInFocusDomain(e.relatedTarget)||!p.hasFocusNodes||p.mainSm.focusState().hasFocus||(p.focusSessionState=u.EntryPending,p.isKeyboardDrivenFocus()&&(p.cameFromBeforeCanvas(e.relatedTarget)?p.mainSm.focusNext():p.mainSm.focusPrevious())&&(p.focusSessionState=u.RiveFocused))},this.onCanvasBlur=function(e){p.inputProxy.owns(e.relatedTarget)||(p.focusSessionState=u.NotFocused,p.canvasHasFocus=!1,p.blurStaysWithRive(e.relatedTarget)||p.mainSm.clearFocus())},this.onOverlayFocusIn=function(e){p.isInOverlay(e.target)&&(p.focusDomainReleased=!1,p.hasFocusNodes&&p.focusSessionState===u.NotFocused&&(p.focusSessionState=p.mainSm.focusState().hasFocus?u.RiveFocused:u.EntryPending))},this.onFocusDomainHostFocusIn=function(e){p.syncOverlayListener(),p.onOverlayFocusIn(e),p.inputProxy.owns(e.target)&&(p.focusDomainReleased=!1)},this.onKeyDown=function(e){if(p.syncOverlayListener(),!(e.isComposing||e.keyCode===229)&&!p.focusDomainReleased&&p.shouldRiveHandleKeyEvent(e)){if(e.key===`Tab`&&p.hasFocusNodes){if(p.mainSm.focusState().hasFocus&&p.mainSm.keyInput(r.Key.tab,(0,r.modifiersFromEvent)(e),!0,e.repeat)){e.preventDefault();return}var t=e.shiftKey?p.mainSm.focusPrevious():p.mainSm.focusNext(),n=p.mainSm.focusState();t||n.hasFocus?(p.focusSessionState=u.RiveFocused,e.preventDefault()):(document.activeElement!==p.canvas&&p.isInFocusDomain(document.activeElement)&&p.canvas.focus({preventScroll:!0}),p.focusSessionState=u.NotFocused,p.focusDomainReleased=!0,p.canvasHasFocus=!1),p.syncOverlayListener()}else if((0,i.isKeyEventClaimed)(e))p.claimedKeyCodes.add(e.code);else{p.claimedKeyCodes.delete(e.code);var a=p.textInputSessionActive&&p.inputProxy.owns(e.target),d=p.mainSm.focusState().expectsKeyboardInput,f=(0,r.keyboardEventToRiveKey)(e),m=f!==null&&p.mainSm.keyInput(f,(0,r.modifiersFromEvent)(e),!0,e.repeat);if(!m&&f!==null&&c(f)&&!l(e)&&(m=p.focusInDirection(f)||p.mainSm.focusState().hasFocus),s(e)){if(a)return;if(p.textInputSessionActive&&p.isInFocusDomain(e.target)){p.inputProxy.focus();return}!p.textInputSessionActive&&d&&p.mainSm.textInput(e.key)}(m||(a||d)&&!l(e)&&o.has(e.code))&&e.preventDefault()}}},this.onKeyUp=function(e){if(!(e.isComposing||e.keyCode===229)&&!p.claimedKeyCodes.delete(e.code)&&p.focusSessionState!==u.NotFocused){var t=(0,r.keyboardEventToRiveKey)(e);t!==null&&p.mainSm.keyInput(t,(0,r.modifiersFromEvent)(e),!1,!1)}},this.canvas=t,this.mainSm=n,this.hasFocusNodes=d,this.getOverlayElement=f,this.focusDomainHost=t.parentElement??document,t.addEventListener(`focus`,this.onCanvasFocus),t.addEventListener(`blur`,this.onCanvasBlur),t.addEventListener(`keydown`,this.onKeyDown),t.addEventListener(`keyup`,this.onKeyUp),this.focusDomainHost.addEventListener(`focusin`,this.onFocusDomainHostFocusIn),this.syncOverlayListener(),this.inputProxy=new a.TextInputProxy({container:t.parentElement??document.body,canvas:t,textInput:function(e){return p.mainSm.textInput(e)},onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,onCopy:this.onCopy,onBlur:function(e){return p.handleProxyBlur(e)}})}return e.prototype.isTextInputSessionActive=function(){return this.textInputSessionActive},e.prototype.isEditingHostFocused=function(){return this.textInputSessionActive&&this.inputProxy.hasDomFocus()},e.prototype.beginTextInputSession=function(e){this.textInputSessionActive=!0,this.focusSessionState=u.RiveFocused,e&&this.inputProxy.focus()},e.prototype.endTextInputSession=function(e){e===void 0&&(e=!1),this.textInputSessionActive&&(this.textInputSessionActive=!1,this.inputProxy.endSession(),!e&&this.inputProxy.hasDomFocus()&&this.canvas.focus({preventScroll:!0}))},e.prototype.summonForPointer=function(){this.textInputSessionActive?this.inputProxy.focus():this.beginTextInputSession(!0)},Object.defineProperty(e.prototype,"editingHost",{get:function(){return this.inputProxy},enumerable:!1,configurable:!0}),e.prototype.handleProxyBlur=function(e){this.textInputSessionActive&&(this.blurStaysWithRive(e)||(this.mainSm.clearFocus(),this.endTextInputSession(!0),this.focusSessionState=u.NotFocused))},e.prototype.setFocusSessionState=function(e){this.focusSessionState=e},e.prototype.notifyRiveFocused=function(){this.focusSessionState=u.RiveFocused},e.prototype.blurStaysWithRive=function(e){return this.isInFocusDomain(e)||e===null&&!document.hasFocus()},e.prototype.focusInDirection=function(e){switch(e){case r.Key.left:return this.mainSm.focusLeft();case r.Key.right:return this.mainSm.focusRight();case r.Key.up:return this.mainSm.focusUp();case r.Key.down:return this.mainSm.focusDown();default:return!1}},e.prototype.shouldRiveHandleKeyEvent=function(e){if(this.focusSessionState===u.NotFocused)return!1;var t=this.isInFocusDomain(document.activeElement)||this.isInOverlay(e.target),n=e.target===this.canvas;return t||this.canvasHasFocus||n},e.prototype.isInFocusDomain=function(e){return e===this.canvas||this.inputProxy.owns(e)?!0:this.isInOverlay(e)},e.prototype.isInOverlay=function(e){return e instanceof Node?(this.getOverlayElement?.call(this))?.contains(e)??!1:!1},e.prototype.syncOverlayListener=function(){var e,t,n,r,i,a,o=this.getOverlayElement?.call(this)??null;o!==this.currentOverlayElement&&((e=this.currentOverlayElement)==null||e.removeEventListener(`focusin`,this.onOverlayFocusIn),(t=this.currentOverlayElement)==null||t.removeEventListener(`keydown`,this.onKeyDown),(n=this.currentOverlayElement)==null||n.removeEventListener(`keyup`,this.onKeyUp),this.currentOverlayElement=o,(r=this.currentOverlayElement)==null||r.addEventListener(`focusin`,this.onOverlayFocusIn),(i=this.currentOverlayElement)==null||i.addEventListener(`keydown`,this.onKeyDown),(a=this.currentOverlayElement)==null||a.addEventListener(`keyup`,this.onKeyUp))},e.prototype.isKeyboardDrivenFocus=function(){try{return this.canvas.matches(`:focus-visible`)}catch{return!1}},e.prototype.cameFromBeforeCanvas=function(e){if(!e)return!0;var t=this.canvas.compareDocumentPosition(e);return t&Node.DOCUMENT_POSITION_PRECEDING?!0:!(t&Node.DOCUMENT_POSITION_FOLLOWING)},e.prototype.cleanup=function(){var e,t,n;this.canvas.removeEventListener(`focus`,this.onCanvasFocus),this.canvas.removeEventListener(`blur`,this.onCanvasBlur),this.canvas.removeEventListener(`keydown`,this.onKeyDown),this.canvas.removeEventListener(`keyup`,this.onKeyUp),this.claimedKeyCodes.clear(),this.focusDomainHost.removeEventListener(`focusin`,this.onFocusDomainHostFocusIn),(e=this.currentOverlayElement)==null||e.removeEventListener(`focusin`,this.onOverlayFocusIn),(t=this.currentOverlayElement)==null||t.removeEventListener(`keydown`,this.onKeyDown),(n=this.currentOverlayElement)==null||n.removeEventListener(`keyup`,this.onKeyUp),this.inputProxy.hasDomFocus()&&this.canvas.focus({preventScroll:!0}),this.inputProxy.cleanup(),this.textInputSessionActive=!1},e}()}),((e,t,n)=>{n.r(t),n.d(t,{Key:()=>i,KeyModifiers:()=>a,keyboardEventToRiveKey:()=>l,modifiersFromEvent:()=>u});var r=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r{n.r(t),n.d(t,{TextInputProxy:()=>o});var r=n(11),i=16,a=new Set([`type`,`value`,`style`,`tabindex`,`autocapitalize`,`autocomplete`,`autocorrect`,`spellcheck`]),o=function(){function e(e){var t=this;this.composing=!1,this.decoratedKeys=new Set,this.lastLeft=NaN,this.lastTop=NaN,this.reposition=function(){return t.positionOverCanvas()},this.onCompositionStart=function(){t.composing=!0},this.onCompositionEnd=function(){t.composing=!1,t.commit()},this.onInput=function(){t.composing||t.commit()},this.onPaste=function(e){var n=e.clipboardData?.getData(`text/plain`);n&&(e.preventDefault(),t.params.textInput(n.replace(/\r\n?/g,` `)))},this.onBlur=function(e){t.params.onBlur(e.relatedTarget)},this.params=e,this.element=this.createElement(),this.positionOverCanvas(),this.params.container.appendChild(this.element)}return e.prototype.listeners=function(){return[[`keydown`,this.reposition],[`beforeinput`,this.reposition],[`keydown`,this.params.onKeyDown],[`keyup`,this.params.onKeyUp],[`input`,this.onInput],[`compositionstart`,this.onCompositionStart],[`compositionend`,this.onCompositionEnd],[`paste`,this.onPaste],[`copy`,this.params.onCopy],[`blur`,this.onBlur]]},e.prototype.createElement=function(){var e=document.createElement(`input`);e.type=`text`,e.tabIndex=-1,e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`autocapitalize`,`off`),e.setAttribute(`autocomplete`,`off`),e.setAttribute(`autocorrect`,`off`),e.spellcheck=!1,e.style.cssText=`position:absolute;width:1px;height:1px;padding:0;margin:0;border:0;outline:none;opacity:0;background:transparent;color:transparent;caret-color:transparent;overflow:hidden;resize:none;z-index:0;pointer-events:none;font-size:${i}px;line-height:1;`;for(var t=0,n=this.listeners();t0){var a=this.params.canvas.getBoundingClientRect();t+=s(a.top,0,window.innerHeight-i)-a.top,n+=s(a.left,0,window.innerWidth-i)-a.left}n!==this.lastLeft&&(this.element.style.left=`${n}px`,this.lastLeft=n),t!==this.lastTop&&(this.element.style.top=`${t}px`,this.lastTop=t)},e.prototype.commit=function(){var e=this.element.value;e&&(this.element.value=``,this.params.textInput(e))},e.prototype.endSession=function(){this.element.value=``,this.composing=!1,this.resetDecoration()},e.prototype.focus=function(){this.positionOverCanvas(),this.element.focus({preventScroll:!0})},e.prototype.hasDomFocus=function(){return document.activeElement===this.element},e.prototype.owns=function(e){return e===this.element},e.prototype.decorate=function(e){this.element.removeAttribute(`aria-hidden`);for(var t=0,n=Object.entries(e);t{n.r(t),n.d(t,{BLANK_URL:()=>l,sanitizeUrl:()=>f});var r=/^([^\w]*)(javascript|data|vbscript)/im,i=/&#(\w+)(^\w|;)?/g,a=/&(newline|tab);/gi,o=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,s=/^.+(:|:)/gim,c=[`.`,`/`],l=`about:blank`;function u(e){return c.indexOf(e[0])>-1}function d(e){return e.replace(o,``).replace(i,function(e,t){return String.fromCharCode(t)})}function f(e){if(!e)return l;var t=d(e).replace(a,``).replace(o,``).trim();if(!t)return l;if(u(t))return t;var n=t.match(s);if(!n)return t;var i=n[0];return r.test(i)?l:t}}),((e,t,n)=>{n.r(t),n.d(t,{AudioAssetWrapper:()=>p,AudioWrapper:()=>c,CustomFileAssetLoaderWrapper:()=>u,FileAssetWrapper:()=>d,FileFinalizer:()=>i,FontAssetWrapper:()=>m,FontWrapper:()=>l,ImageAssetWrapper:()=>f,ImageWrapper:()=>s,createFinalization:()=>_,finalizationRegistry:()=>g});var r=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),i=function(){function e(e,t){t===void 0&&(t=null),this.selfUnref=!1,this._file=e,this._session=t}return e.prototype.unref=function(){this._file&&this._file.unref(),this._session&&=(this._session.delete(),null)},e.prototype.release=function(){this._file=null,this._session=null},e}(),a=function(){function e(e){this._finalizableObject=e}return e.prototype.unref=function(){this._finalizableObject.unref()},e}(),o=function(){function e(){this.selfUnref=!1}return e.prototype.unref=function(){},e}(),s=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n._nativeImage=t,n}return Object.defineProperty(t.prototype,"nativeImage",{get:function(){return this._nativeImage},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeImage.unref()},t}(o),c=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n._nativeAudio=t,n}return Object.defineProperty(t.prototype,"nativeAudio",{get:function(){return this._nativeAudio},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeAudio.unref()},t}(o),l=function(e){r(t,e);function t(t){var n=e.call(this)||this;return n._nativeFont=t,n}return Object.defineProperty(t.prototype,"nativeFont",{get:function(){return this._nativeFont},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeFont.unref()},t}(o),u=function(){function e(e,t,n){n===void 0&&(n=null),this._assetLoaderCallback=t,this._session=n,this.assetLoader=new e.CustomFileAssetLoader({loadContents:this.loadContents.bind(this)})}return e.prototype.loadContents=function(e,t){var n;if(e.isImage)n=new f(e,this._session);else if(e.isAudio)n=new p(e,this._session);else if(e.isFont)n=new m(e,this._session);else return!1;return this._assetLoaderCallback(n,t)},e}(),d=function(){function e(e,t){t===void 0&&(t=null),this._nativeFileAsset=e,this._session=t}return e.prototype.decode=function(e){this._nativeFileAsset.decode(e,this._session)},Object.defineProperty(e.prototype,"name",{get:function(){return this._nativeFileAsset.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fileExtension",{get:function(){return this._nativeFileAsset.fileExtension},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueFilename",{get:function(){return this._nativeFileAsset.uniqueFilename},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAudio",{get:function(){return this._nativeFileAsset.isAudio},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isImage",{get:function(){return this._nativeFileAsset.isImage},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFont",{get:function(){return this._nativeFileAsset.isFont},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cdnUuid",{get:function(){return this._nativeFileAsset.cdnUuid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nativeFileAsset",{get:function(){return this._nativeFileAsset},enumerable:!1,configurable:!0}),e}(),f=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setRenderImage=function(e){this._nativeFileAsset.setRenderImage(e.nativeImage)},t}(d),p=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setAudioSource=function(e){this._nativeFileAsset.setAudioSource(e.nativeAudio)},t}(d),m=function(e){r(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setFont=function(e){this._nativeFileAsset.setFont(e.nativeFont)},t}(d),h=function(){function e(e){}return e.prototype.register=function(e){e.selfUnref=!0},e.prototype.unregister=function(e){},e}(),g=new(typeof FinalizationRegistry<`u`?FinalizationRegistry:h)(function(e){e?.unref()}),_=function(e,t){var n=new a(t);g.register(e,n)}}),((e,t,n)=>{n.r(t),n.d(t,{RiveFont:()=>i});var r=n(3),i=function(){function e(){}return e.setFallbackFontCallback=function(t){e._fallbackFontCallback=t??null,e._wireFallbackProc()},e._fontToPtr=function(e){if(e==null)return null;var t=e.nativeFont;return(t?.ptr)?.call(t)??null},e._getFallbackPtr=function(t,n){return n<0||n>=t.length?null:e._fontToPtr(t[n])},e._wireFallbackProc=function(){r.RuntimeLoader.getInstance(function(t){var n=e._fallbackFontCallback;n?t.setFallbackFontCallback((function(t,r,i){var a=n(t,i);return a?Array.isArray(a)?e._getFallbackPtr(a,r):r===0?e._fontToPtr(a):null:null})):t.setFallbackFontCallback(null)})},e._fallbackFontCallback=null,e}()})],t={};function n(r){var i=t[r];if(i!==void 0)return i.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{n.r(r),n.d(r,{Alignment:()=>m,DataEnum:()=>ue,DataType:()=>le,DeprecationKeys:()=>j,DrawOptimizationOptions:()=>h,EventType:()=>T,Fit:()=>p,Layout:()=>g,LoopType:()=>R,Rive:()=>ce,RiveEventType:()=>y,RiveFile:()=>se,RiveFont:()=>a.RiveFont,RuntimeLoader:()=>t.RuntimeLoader,SemanticMode:()=>i.SemanticMode,StateMachineInput:()=>v,StateMachineInputType:()=>_,Testing:()=>ye,ViewModel:()=>H,ViewModelInstance:()=>W,ViewModelInstanceArtboard:()=>_e,ViewModelInstanceAssetFont:()=>ge,ViewModelInstanceAssetImage:()=>he,ViewModelInstanceBoolean:()=>q,ViewModelInstanceColor:()=>me,ViewModelInstanceEnum:()=>pe,ViewModelInstanceList:()=>J,ViewModelInstanceNumber:()=>de,ViewModelInstanceString:()=>K,ViewModelInstanceTrigger:()=>fe,ViewModelInstanceValue:()=>G,decodeAudio:()=>be,decodeFont:()=>Se,decodeImage:()=>xe});var e=n(1),t=n(3),i=n(6),a=n(12),o=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),s=function(){return s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=0||l>=0)c>=0?this.animations[c].playing=n:this.stateMachines[l].playing=n;else{var u=this.artboard.animationByName(t[s]);if(u){var d=new e.Animation(u,this.artboard,this.runtime,n);d.advance(0),d.apply(1),this.animations.push(d)}else{var f=this.artboard.stateMachineByName(t[s]);if(f){var p=new C(f,this.runtime,n,this.artboard);i&&p.enableSemantics(),this.stateMachines.push(p)}}}}return r&&(n?this.eventManager.fire({type:T.Play,data:this.playing}):this.eventManager.fire({type:T.Pause,data:this.paused})),n?this.playing:this.paused},t.prototype.initLinearAnimations=function(t,n,r){r===void 0&&(r=!1);for(var i=this.animations.map(function(e){return e.name}),a=0;a=0)this.animations[o].playing=n;else{var s=this.artboard.animationByName(t[a]);if(s){var c=new e.Animation(s,this.artboard,this.runtime,n);c.advance(0),c.apply(1),this.animations.push(c)}else if(r)throw new d(`State Machine with name ${t[a]} not found`);else console.error(`Animation with name ${t[a]} not found.`)}}},t.prototype.initStateMachines=function(e,t,n){for(var r=this.stateMachines.map(function(e){return e.name}),i=0;i=0)this.stateMachines[a].playing=t;else{var o=this.artboard.stateMachineByName(e[i]);if(o){var s=new C(o,this.runtime,t,this.artboard);n&&s.enableSemantics(),this.stateMachines.push(s)}else console.warn(`State Machine with name ${e[i]} not found. Falling back to find an animation with the same name.`),this.initLinearAnimations([e[i]],t,!0)}}},t.prototype.play=function(e){return this.add(e,!0)},t.prototype.advanceIfPaused=function(){this.stateMachines.forEach(function(e){e.playing||e.advanceAndApply(0)})},t.prototype.pause=function(e){return this.add(e,!1)},t.prototype.scrub=function(e,t){var n=this.animations.filter(function(t){return e.includes(t.name)});return n.forEach(function(e){return e.scrubTo=t}),n.map(function(e){return e.name})},Object.defineProperty(t.prototype,"playing",{get:function(){return this.animations.filter(function(e){return e.playing}).map(function(e){return e.name}).concat(this.stateMachines.filter(function(e){return e.playing}).map(function(e){return e.name}))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paused",{get:function(){return this.animations.filter(function(e){return!e.playing}).map(function(e){return e.name}).concat(this.stateMachines.filter(function(e){return!e.playing}).map(function(e){return e.name}))},enumerable:!1,configurable:!0}),t.prototype.stop=function(e){var t=this;e=Y(e);var n=[];if(e.length===0)n=this.animations.map(function(e){return e.name}).concat(this.stateMachines.map(function(e){return e.name})),this.animations.forEach(function(e){return e.cleanup()}),this.stateMachines.forEach(function(e){return e.cleanup()}),this.animations.splice(0,this.animations.length),this.stateMachines.splice(0,this.stateMachines.length);else{var r=this.animations.filter(function(t){return e.includes(t.name)});r.forEach(function(e){e.cleanup(),t.animations.splice(t.animations.indexOf(e),1)});var i=this.stateMachines.filter(function(t){return e.includes(t.name)});i.forEach(function(e){e.cleanup(),t.stateMachines.splice(t.stateMachines.indexOf(e),1)}),n=r.map(function(e){return e.name}).concat(i.map(function(e){return e.name}))}return this.eventManager.fire({type:T.Stop,data:n}),n},Object.defineProperty(t.prototype,"isPlaying",{get:function(){return this.animations.reduce(function(e,t){return e||t.playing},!1)||this.stateMachines.reduce(function(e,t){return e||t.playing},!1)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isPaused",{get:function(){return!this.isPlaying&&(this.animations.length>0||this.stateMachines.length>0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isStopped",{get:function(){return this.animations.length===0&&this.stateMachines.length===0},enumerable:!1,configurable:!0}),t.prototype.atLeastOne=function(e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1);var r;return this.animations.length===0&&this.stateMachines.length===0&&(this.artboard.animationCount()>0?(this.artboard.stateMachineCount()>0&&I(j.defaultStateMachine,"No `stateMachine` was specified, so the artboard's first linear animation is playing by default. In the next major version, the artboard's state machine will be played by default instead when one exists. Pass the `stateMachine` parameter to adopt that behavior now."),this.add([r=this.artboard.animationByIndex(0).name],e,t)):this.artboard.stateMachineCount()>0&&this.add([r=this.artboard.stateMachineByIndex(0).name],e,t,n)),r},t.prototype.handleLooping=function(){for(var e=0,t=this.animations.filter(function(e){return e.playing});e1&&(this.eventManager.fire({type:T.Loop,data:{animation:n.name,type:R.PingPong}}),n.loopCount=0)}},t.prototype.handleStateChanges=function(){for(var e=[],t=0,n=this.stateMachines.filter(function(e){return e.playing});t0&&this.eventManager.fire({type:T.StateChange,data:e})},t.prototype.handleAdvancing=function(e){this.eventManager.fire({type:T.Advance,data:e})},t}(),T;(function(e){e.Load=`load`,e.LoadError=`loaderror`,e.Play=`play`,e.Pause=`pause`,e.Stop=`stop`,e.Loop=`loop`,e.Draw=`draw`,e.Advance=`advance`,e.StateChange=`statechange`,e.RiveEvent=`riveevent`,e.AudioStatusChange=`audiostatuschange`})(T||={});var E=`Subscribing to Rive Events at runtime is deprecated and will be removed in a future major version: please use data binding instead. See https://rive.app/docs/runtimes/web/rive-events for how to migrate.`,D=`State machine inputs are deprecated and will be removed in a future major version: please use data binding properties instead. See https://rive.app/docs/editor/data-binding/migration-guide#state-machine-inputs for how to migrate.`,O=`Text run APIs are deprecated and will be removed in a future major version: please use data binding instead. See https://rive.app/docs/editor/data-binding/migration-guide#updating-text-runs-at-runtime for how to migrate.`,k=`Loop events are deprecated and will be removed in a future major version: they are only reported for linear animation playback, which is deprecated. Use a state machine to control playback and data binding to react to changes instead. See https://rive.app/docs/editor/data-binding/migration-guide for how to migrate.`,A=`Subscribing to state change events at runtime is deprecated and will be removed in a future major version: use data binding (view model property observers) or state machine actions to react to changes from your graphic instead. See https://rive.app/docs/editor/state-machine/states#actions for how to migrate.`,j={animationNames:`animation-names`,animationsParam:`animations-param`,defaultStateMachine:`default-state-machine`,legacyConstructors:`legacy-constructors`,legacyUnsubscribe:`legacy-unsubscribe`,loopEvents:`loop-events`,namesArray:`names-array`,riveEvents:`rive-events`,scrub:`scrub`,stateChangeEvents:`state-change-events`,stateMachineInputs:`state-machine-inputs`,stateMachinesParam:`state-machines-param`,textRuns:`text-runs`},M=new Set(Object.keys(j).map(function(e){return j[e]})),N=new Set,P=function(e){if(N.clear(),!Array.isArray(e))console.warn(`[Rive] \`suppressDeprecationWarnings\` expects an array of deprecation ids, received ${typeof e}. Nothing was suppressed.`);else for(var t=0,n=e;t0;){var e=this.queue.shift();e?.action&&e.action(),e?.event&&this.eventManager.fire(e.event)}},e}(),B;(function(e){e[e.AVAILABLE=0]=`AVAILABLE`,e[e.UNAVAILABLE=1]=`UNAVAILABLE`})(B||={});var ne=new(function(e){o(t,e);function t(){var t=e!==null&&e.apply(this,arguments)||this;return t._started=!1,t._enabled=!1,t._status=B.UNAVAILABLE,t}return t.prototype.delay=function(e){return c(this,void 0,void 0,function(){return l(this,function(t){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},t.prototype.timeout=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return[2,new Promise(function(e,t){return setTimeout(t,50)})]})})},t.prototype.reportToListeners=function(){this.fire({type:T.AudioStatusChange}),this.removeAll()},t.prototype.enableAudio=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return this._enabled||(this._enabled=!0,this._status=B.AVAILABLE,this.reportToListeners()),[2]})})},t.prototype.testAudio=function(){return c(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:if(this._status!==B.UNAVAILABLE||this._audioContext===null)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,Promise.race([this._audioContext.resume(),this.timeout()])];case 2:return e.sent(),this.enableAudio(),[3,4];case 3:return e.sent(),[3,4];case 4:return[2]}})})},t.prototype._establishAudio=function(){return c(this,void 0,void 0,function(){return l(this,function(e){switch(e.label){case 0:return this._started?[3,5]:(this._started=!0,typeof window<`u`?[3,1]:(this.enableAudio(),[3,5]));case 1:this._audioContext=new AudioContext,this.listenForUserAction(),e.label=2;case 2:return this._status===B.UNAVAILABLE?[4,this.testAudio()]:[3,5];case 3:return e.sent(),[4,this.delay(1e3)];case 4:return e.sent(),[3,2];case 5:return[2]}})})},t.prototype.listenForUserAction=function(){var e=this;document.addEventListener(`pointerdown`,function(){return c(e,void 0,void 0,function(){return l(this,function(e){return this.enableAudio(),[2]})})},{once:!0})},t.prototype.establishAudio=function(){return c(this,void 0,void 0,function(){return l(this,function(e){return this._establishAudio(),[2]})})},Object.defineProperty(t.prototype,"systemVolume",{get:function(){return this._status===B.UNAVAILABLE?(this.testAudio(),0):1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),t}(z)),re=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}(),ie=globalThis.ResizeObserver||re,V=new(function(){function e(){var e=this;this._elementsMap=new Map,this._onObservedEntry=function(t){var n=e._elementsMap.get(t.target);n===null?e._resizeObserver.unobserve(t.target):n.onResize(t.target.clientWidth==0||t.target.clientHeight==0)},this._onObserved=function(t){t.forEach(e._onObservedEntry)},this._resizeObserver=new ie(this._onObserved)}return e.prototype.add=function(e,t){var n={onResize:t,element:e};return this._elementsMap.set(e,n),this._resizeObserver.observe(e),n},e.prototype.remove=function(e){this._resizeObserver.unobserve(e.element),this._elementsMap.delete(e.element)},e}()),ae=0,oe=function(e){var t=e.stateMachine,n=e.animations,r=e.stateMachines;return n!==void 0&&I(j.animationsParam,"The `animations` parameter is deprecated and will be removed in a future major version: please use the `stateMachine` parameter to play a state machine instead."),r!==void 0&&I(j.stateMachinesParam,"The `stateMachines` parameter is deprecated: please use `stateMachine` with a single state machine name instead."),t?{startingAnimationNames:[],startingStateMachineNames:[t]}:{startingAnimationNames:Y(n),startingStateMachineNames:Y(r)}},se=function(){function e(e){this.enableRiveAssetCDN=!0,this.enablePerfMarks=!1,this.referenceCount=0,this.destroyed=!1,this.selfUnref=!1,this.bindableArtboards=[],this.deferred=!1,this.session=null,this._sessionClaimed=!1,this.fileFinalizer=null,this.boundElsewhereWarned=!1,this.src=e.src,this.buffer=e.buffer,this.deferred=!!e.enableGPUCanvas,e.assetLoader&&(this.assetLoader=e.assetLoader),this.enableRiveAssetCDN=typeof e.enableRiveAssetCDN!=`boolean`||e.enableRiveAssetCDN,this.enablePerfMarks=!!e.enablePerfMarks,this.enablePerfMarks&&(t.RuntimeLoader.enablePerfMarks=!0),this.eventManager=new z,e.onLoad&&this.on(T.Load,e.onLoad),e.onLoadError&&this.on(T.LoadError,e.onLoadError)}return e.prototype.releaseFile=function(){var e,t;(e=this.fileFinalizer)==null||e.release(),(t=this.file)==null||t.unref(),this.fileFinalizer=null,this.file=null},e.prototype.releaseSession=function(){var e;(e=this.session)==null||e.delete(),this.session=null},e.prototype.releaseBindableArtboards=function(){this.bindableArtboards.forEach(function(e){return e.destroy()})},e.prototype.initData=function(){return c(this,void 0,void 0,function(){var t,n,r,i,o,s,c;return l(this,function(l){switch(l.label){case 0:if(!this.src||this.buffer)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),t=this,[4,ve(this.src)];case 2:return t.buffer=l.sent(),[3,4];case 3:throw n=l.sent(),n instanceof Error?n:new d(e.fileLoadErrorMessage);case 4:if(this.destroyed)return[2];this.deferred&&this.session===null&&(this.session=e.makeDeferredSession(this.runtime)),this.assetLoader&&(i=new a.CustomFileAssetLoaderWrapper(this.runtime,this.assetLoader,this.session),r=i.assetLoader),this.enablePerfMarks&&performance.mark(`rive:file-load:start`),l.label=5;case 5:return l.trys.push([5,7,,8]),o=this,[4,this.runtime.load(new Uint8Array(this.buffer),r,this.enableRiveAssetCDN,this.session)];case 6:return o.file=l.sent(),[3,8];case 7:throw s=l.sent(),this.releaseSession(),s;case 8:return this.enablePerfMarks&&(performance.mark(`rive:file-load:end`),performance.measure(`rive:file-load`,`rive:file-load:start`,`rive:file-load:end`)),this.destroyed?(this.releaseFile(),this.releaseSession(),[2]):this.file===null?(this.releaseSession(),this.fireLoadError(e.fileLoadErrorMessage),[2]):(c=new a.FileFinalizer(this.file,this.session),this.fileFinalizer=c,a.finalizationRegistry.register(this,c),this.eventManager.fire({type:T.Load,data:this}),[2])}})})},e.prototype.loadRiveFileBytes=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(t){return this.enablePerfMarks&&performance.mark(`rive:fetch-riv:start`),e=this.src?ve(this.src):Promise.resolve(this.buffer),this.enablePerfMarks&&this.src&&e.then(function(){performance.mark(`rive:fetch-riv:end`),performance.measure(`rive:fetch-riv`,`rive:fetch-riv:start`,`rive:fetch-riv:end`)}),[2,e]})})},e.prototype.loadRuntime=function(){return c(this,void 0,void 0,function(){var e;return l(this,function(n){return this.enablePerfMarks&&performance.mark(`rive:await-wasm:start`),e=t.RuntimeLoader.awaitInstance(),this.enablePerfMarks&&e.then(function(){performance.mark(`rive:await-wasm:end`),performance.measure(`rive:await-wasm`,`rive:await-wasm:start`,`rive:await-wasm:end`)}),[2,e]})})},e.prototype.init=function(){return c(this,void 0,void 0,function(){var t,n,r,i;return l(this,function(a){switch(a.label){case 0:if(!this.src&&!this.buffer)return this.fireLoadError(e.missingErrorMessage),[2];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,Promise.all([this.loadRiveFileBytes(),this.loadRuntime()])];case 2:return t=a.sent(),n=t[0],r=t[1],this.destroyed?[2]:(this.buffer=n,this.runtime=r,this.enablePerfMarks&&performance.mark(`rive:init-data:start`),[4,this.initData()]);case 3:return a.sent(),this.enablePerfMarks&&(performance.mark(`rive:init-data:end`),performance.measure(`rive:init-data`,`rive:init-data:start`,`rive:init-data:end`)),[3,5];case 4:return i=a.sent(),this.fireLoadError(i instanceof Error?i.message:e.fileLoadErrorMessage),[3,5];case 5:return[2]}})})},e.prototype.fireLoadError=function(e){throw this.eventManager.fire({type:T.LoadError,data:e}),new d(e)},e.prototype.on=function(e,t){this.eventManager.add({type:e,callback:t})},e.prototype.off=function(e,t){this.eventManager.remove({type:e,callback:t})},e.prototype.cleanup=function(){--this.referenceCount,this.referenceCount<=0&&(this.removeAllRiveEventListeners(),this.releaseFile(),this.releaseBindableArtboards(),this.releaseSession(),this.destroyed=!0)},e.makeDeferredSession=function(t){var n=t.makeDeferredSession?.call(t)??null;return n===null&&!e.deferredUnsupportedWarned&&(e.deferredUnsupportedWarned=!0,console.warn("Rive: `enableGPUCanvas: true` was ignored because this runtime build has no GPU Canvas support; importing in immediate mode. Use a @rive-app/webgl2 or @rive-app/canvas build with deferred rendering compiled in.")),n},Object.defineProperty(e.prototype,"deferredSession",{get:function(){return this.session},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deferredRequested",{get:function(){return this.deferred},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionClaimed",{get:function(){return this._sessionClaimed},enumerable:!1,configurable:!0}),e.prototype.claimSession=function(){this._sessionClaimed=!0},e.prototype.warnBoundElsewhereOnce=function(){this.boundElsewhereWarned||(this.boundElsewhereWarned=!0,console.warn(`Rive: this deferred RiveFile is already bound to another Rive instance's canvas, and a deferred session cannot span canvases. Re-importing the file for this instance (an extra parse of the retained buffer, no extra network request).`))},e.prototype.reimport=function(t){return c(this,void 0,void 0,function(){var n;return l(this,function(r){switch(r.label){case 0:return n=new e({buffer:this.buffer,assetLoader:this.assetLoader,enableRiveAssetCDN:this.enableRiveAssetCDN,enablePerfMarks:this.enablePerfMarks,enableGPUCanvas:t}),[4,n.init()];case 1:return r.sent(),[2,n]}})})},e.prototype.removeAllRiveEventListeners=function(e){this.eventManager.removeAll(e)},e.prototype.getInstance=function(){if(this.file!==null)return this.referenceCount+=1,this.file},e.prototype.destroyIfUnused=function(){this.referenceCount<=0&&this.cleanup()},e.prototype.createBindableArtboard=function(e){if(e!=null){var t=new S(e);return(0,a.createFinalization)(t,t.nativeArtboard),this.bindableArtboards.push(t),t}return null},e.prototype.getArtboard=function(e){var t=this.file.artboardByName(e);if(t!=null)return new x(t,this)},e.prototype.getBindableArtboard=function(e){var t=this.file.bindableArtboardByName(e);return this.createBindableArtboard(t)},e.prototype.getDefaultBindableArtboard=function(){var e=this.file.bindableArtboardDefault();return this.createBindableArtboard(e)},e.prototype.internalBindableArtboardFromArtboard=function(e){var t=this.file.internalBindableArtboardFromArtboard(e);return this.createBindableArtboard(t)},e.prototype.viewModelByName=function(e){var t=this.file.viewModelByName(e);return t===null?null:new H(t)},e.prototype.globalViewModelNames=function(){return this.file.globalViewModelNames()},e.missingErrorMessage=`Rive source file or data buffer required`,e.fileLoadErrorMessage=`The file failed to load`,e.deferredUnsupportedWarned=!1,e}(),ce=function(){function e(e){var n=this;this.loaded=!1,this.destroyed=!1,this._observed=null,this.readyForPlaying=!1,this.deferredRenderer=!1,this.ownsRiveFile=!1,this.artboard=null,this.eventCleanup=null,this._keyboardInteractions=null,this.shouldDisableRiveListeners=!1,this.automaticallyHandleEvents=!1,this.dispatchPointerExit=!0,this.enableMultiTouch=!1,this.enableRiveAssetCDN=!0,this.semanticsMode=i.SemanticMode.Disabled,this.semanticsOptions={riveCanvasLabel:`Rive animation`},this._semanticsActive=!1,this._volume=1,this._artboardWidth=void 0,this._artboardHeight=void 0,this._devicePixelRatioUsed=1,this._hasZeroSize=!1,this._needsRedraw=!1,this._currentCanvasWidth=0,this._currentCanvasHeight=0,this._audioEventListener=null,this._boundDraw=null,this._pageVisibilityHandler=null,this._explicitlyStoppedRendering=!1,this._viewModelInstance=null,this._globalViewModelInstances=new Map,this._dataEnums=null,this._tabIndex=null,this._prevHasFocus=!1,this._prevWantsTextInputSession=!1,this._inPointerDownDrain=!1,this._focusOptions={allowFocusInterrupt:!1},this._semanticTree=null,this._accessibilityOverlay=null,this._overlayTransformDirty=!0,this._instanceId=`${ae++}`,this.drawOptimization=h.DrawOnChanged,this.enablePerfMarks=!1,this.durations=[],this.frameTimes=[],this.frameCount=0,this.isTouchScrollEnabled=!1,this.onCanvasResize=function(e){var t=n._hasZeroSize!==e;n._hasZeroSize=e,e?n._layout.maxX&&n._layout.maxY||n.resizeToCanvas():t&&n.resizeDrawingSurfaceToCanvas()},this.isEditingHostFocused=function(){return n._keyboardInteractions?.isEditingHostFocused()??!1},this.frameRequestId=null,this.renderSecondTimer=0,this._boundDraw=this.draw.bind(this),typeof document<`u`&&(this._pageVisibilityHandler=this._onPageVisibilityChange.bind(this),document.addEventListener(`visibilitychange`,this._pageVisibilityHandler)),this.canvas=e.canvas,e.canvas.constructor===HTMLCanvasElement&&(this._observed=V.add(this.canvas,this.onCanvasResize)),this._currentCanvasWidth=this.canvas.width,this._currentCanvasHeight=this.canvas.height,this.src=e.src,this.buffer=e.buffer,this.riveFile=e.riveFile,this.layout=e.layout??new g,this.shouldDisableRiveListeners=!!e.shouldDisableRiveListeners,this.isTouchScrollEnabled=!!e.isTouchScrollEnabled,e.automaticallyHandleEvents&&I(j.riveEvents,"The `automaticallyHandleEvents` parameter is deprecated. "+E),this.automaticallyHandleEvents=!!e.automaticallyHandleEvents,this.dispatchPointerExit=e.dispatchPointerExit===!1?e.dispatchPointerExit:this.dispatchPointerExit,this.enableMultiTouch=!!e.enableMultiTouch,this.drawOptimization=e.drawingOptions??this.drawOptimization,this.enableRiveAssetCDN=e.enableRiveAssetCDN===void 0||e.enableRiveAssetCDN,this.enablePerfMarks=!!e.enablePerfMarks,this.enablePerfMarks&&(t.RuntimeLoader.enablePerfMarks=!0),this._focusOptions=e.focusOptions??this._focusOptions,this._tabIndex=e.tabIndex??null,this.deferredRenderer=!!e.enableGPUCanvas,this.eventManager=new z,e.onLoad&&this.on(T.Load,e.onLoad),e.onLoadError&&this.on(T.LoadError,e.onLoadError),e.onPlay&&this.on(T.Play,e.onPlay),e.onPause&&this.on(T.Pause,e.onPause),e.onStop&&this.on(T.Stop,e.onStop),e.onLoop&&this.on(T.Loop,e.onLoop),e.onStateChange&&this.on(T.StateChange,e.onStateChange),e.onAdvance&&this.on(T.Advance,e.onAdvance),e.onload&&!e.onLoad&&this.on(T.Load,e.onload),e.onloaderror&&!e.onLoadError&&this.on(T.LoadError,e.onloaderror),e.onplay&&!e.onPlay&&this.on(T.Play,e.onplay),e.onpause&&!e.onPause&&this.on(T.Pause,e.onpause),e.onstop&&!e.onStop&&this.on(T.Stop,e.onstop),e.onloop&&!e.onLoop&&this.on(T.Loop,e.onloop),e.onstatechange&&!e.onStateChange&&this.on(T.StateChange,e.onstatechange),e.assetLoader&&(this.assetLoader=e.assetLoader),this.taskQueue=new te(this.eventManager),this.init({src:this.src,buffer:this.buffer,riveFile:this.riveFile,autoplay:e.autoplay,autoBind:e.autoBind,stateMachine:e.stateMachine,animations:e.animations,stateMachines:e.stateMachines,artboard:e.artboard,useOffscreenRenderer:e.useOffscreenRenderer,tabIndex:e.tabIndex,semanticsMode:e.semanticsMode,semanticsOptions:e.semanticsOptions,enableGPUCanvas:this.deferredRenderer})}return Object.defineProperty(e,"suppressDeprecationWarnings",{get:function(){return Object.freeze(Array.from(N))},set:function(e){P(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewModelCount",{get:function(){return this.file.viewModelCount()},enumerable:!1,configurable:!0}),e.new=function(t){return I(j.legacyConstructors,"This function is deprecated: please use `new Rive({})` instead"),new e(t)},e.prototype.enableSemantics=function(){this.semanticsMode=i.SemanticMode.Enabled,this.activateSemantics()},e.prototype.activateSemantics=function(){this._semanticsActive||this.semanticsMode===i.SemanticMode.Disabled||(this._semanticsActive=!0,this.syncSemanticsOnStateMachines())},e.prototype.syncSemanticsOnStateMachines=function(){if(this._semanticsActive&&this.animator)for(var e=0,t=this.animator.stateMachines;e`u`||!(this.canvas instanceof HTMLCanvasElement))){var t=this.focusStateMachine;if(t){var n=this.canvas.tabIndex;(n===-1||isNaN(n))&&(this.canvas.tabIndex=this._tabIndex===null?0:this._tabIndex),this._keyboardInteractions=new a.KeyboardInteractions({canvas:this.canvas,stateMachine:t.instance,hasFocusNodes:!0,getOverlayElement:function(){return e._accessibilityOverlay?.getSemanticOverlayContainer()??null}})}}},e.prototype.summonKeyboardForGesture=function(){if(this._keyboardInteractions){var e=this.focusStateMachine;e&&this.wantsTextInputSession(e.focusState().expectsKeyboardInput)&&this._keyboardInteractions.summonForPointer()}},e.prototype.wantsTextInputSession=function(e){if(!e)return!1;var t=this._semanticTree?.focusedNode();return t===void 0||t.role===i.SemanticRole.textField},e.prototype.advanceAndDrainForPointer=function(e,t){if(!t?.pointerDown)this.advanceAndReportChanges(e);else{this._inPointerDownDrain=!0;try{this.advanceAndReportChanges(e)}finally{this._inPointerDownDrain=!1}}},e.prototype.cleanupKeyboardInteractions=function(){var e;this._keyboardInteractions&&=(this._keyboardInteractions.cleanup(),null),this._prevWantsTextInputSession=!1,(e=this._accessibilityOverlay)==null||e.releaseEditingHost(null,null)},e.prototype.removeRiveListeners=function(){this.eventCleanup&&=(this.eventCleanup(),null),this.cleanupKeyboardInteractions()},e.prototype.initializeAudio=function(){var e=this;ne.status==B.UNAVAILABLE&&(this.file.hasAudio||this.artboard?.hasAudio&&this._audioEventListener===null)&&(this._audioEventListener={type:T.AudioStatusChange,callback:function(){return e.onSystemAudioChanged()}},ne.add(this._audioEventListener),ne.establishAudio())},e.prototype.initArtboardSize=function(){this.artboard&&(this._artboardWidth=this.artboard.width=this._artboardWidth||this.artboard.width,this._artboardHeight=this.artboard.height=this._artboardHeight||this.artboard.height)},e.prototype.initData=function(e,t,n,r,a){return c(this,void 0,void 0,function(){var o,s,c,u;return l(this,function(l){switch(l.label){case 0:return l.trys.push([0,5,,6]),this.ownsRiveFile=this.riveFile==null,this.ownsRiveFile?(o=new se({src:this.src,buffer:this.buffer,enableRiveAssetCDN:this.enableRiveAssetCDN,assetLoader:this.assetLoader,enablePerfMarks:this.enablePerfMarks,enableGPUCanvas:this.deferredRenderer}),this.riveFile=o,[4,o.init()]):[3,2];case 1:if(l.sent(),this.destroyed)return o.destroyIfUnused(),[2,!1];l.label=2;case 2:return this.riveFile.deferredSession!==null||this.deferredRenderer?[4,this.resolveDeferredRendering()]:[3,4];case 3:if(l.sent(),this.destroyed)return this.ownsRiveFile&&((u=this.riveFile)==null||u.destroyIfUnused()),[2,!1];l.label=4;case 4:this.file=this.riveFile.getInstance(),this.reportDisplayScale(),this.initArtboard(e,t,n,r,a),this.initArtboardSize(),this.initializeAudio(),this.semanticsMode===i.SemanticMode.Enabled?this.activateSemantics():this._semanticsActive&&this.syncSemanticsOnStateMachines();try{this.loaded=!0,this.eventManager.fire({type:T.Load,data:this.src??`buffer`})}catch(e){console.error(e)}return this.animator.advanceIfPaused(),this.readyForPlaying=!0,this.taskQueue.process(),this.drawFrame(),[2,!0];case 5:return s=l.sent(),c=f(s),this.eventManager.fire({type:T.LoadError,data:c}),[2,Promise.reject(c)];case 6:return[2]}})})},e.prototype.resolveDeferredRendering=function(){return c(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,u;return l(this,function(l){switch(l.label){case 0:return e=this.riveFile,t=this.ownsRiveFile,n=this.renderer,r=e.deferredSession,r===null?(this.deferredRenderer&&!e.deferredRequested&&console.warn("Rive: `enableGPUCanvas: true` was ignored because this RiveFile was imported without it. The mode is fixed at import: construct the RiveFile with `enableGPUCanvas: true` to opt in."),[2]):(this.deferredRenderer||console.warn("Rive: this RiveFile was imported with `enableGPUCanvas: true`, so this instance renders deferred even though `enableGPUCanvas` is false on the instance. An immediate renderer would drop the file's deferred resources and draw nothing."),i=n?.attachSession,typeof i==`function`?[3,2]:(console.warn("Rive: this renderer cannot replay a deferred session (`useOffscreenRenderer` is not supported with deferred rendering). Re-importing the file in immediate mode for this instance."),[4,e.reimport(!1)]));case 1:return a=l.sent(),this.destroyed?(a.destroyIfUnused(),[2]):(this.riveFile=a,this.ownsRiveFile=!0,t&&e.destroyIfUnused(),[2]);case 2:return!e.sessionClaimed&&i.call(n,r)?(e.claimSession(),[2]):(e.warnBoundElsewhereOnce(),[4,e.reimport(!0)]);case 3:return o=l.sent(),this.destroyed?(o.destroyIfUnused(),[2]):(this.riveFile=o,this.ownsRiveFile=!0,s=o.deferredSession,s!==null&&i.call(n,s)?(o.claimSession(),[2]):(console.warn(`Rive: could not attach the re-imported file's deferred session to this canvas; falling back to immediate rendering for this instance.`),(u=n.detachSession)==null||u.call(n),[4,e.reimport(!1)]));case 4:return c=l.sent(),o.destroyIfUnused(),this.destroyed?(c.destroyIfUnused(),[2]):(this.riveFile=c,this.ownsRiveFile=!0,t&&e.destroyIfUnused(),[2])}})})},e.prototype.initArtboard=function(e,t,n,r,i){if(this.file){var o=e?this.file.artboardByName(e):this.file.defaultArtboard();if(!o)throw new d(`Invalid artboard name or no default artboard`);this.artboard=o,o.volume=this._volume*ne.systemVolume,this.animator=new w(this.runtime,this.artboard,this.eventManager);var s;if(t.length>0||n.length>0?(s=t.concat(n),this.animator.initLinearAnimations(t,r),this.animator.initStateMachines(n,r,this._semanticsActive)):s=[this.animator.atLeastOne(r,!1,this._semanticsActive)],this.taskQueue.add({event:{type:r?T.Play:T.Pause,data:s}}),i){var c=this.file.defaultArtboardViewModel(o);if(c!==null){var l=c.defaultInstance();if(l!==null){var u=new W(l,null);(0,a.createFinalization)(u,u.runtimeInstance),this.setViewModelInstance(u)}}for(var f=0,p=this.file.globalViewModelNames();f=0&&performance.mark(`rive:sm-advance:start:f${l}`),f.advanceAndApply(e),l>=0&&(performance.mark(`rive:sm-advance:end:f${l}`),performance.measure(`rive:sm-advance:f${l}`,`rive:sm-advance:start:f${l}`,`rive:sm-advance:end:f${l}`)),this._semanticsActive){var S=f.drainSemanticsDiff();S&&(this._semanticTree||=new i.SemanticTreeModel,this._semanticTree.applyDiff(S))}}if(this._semanticsActive&&this._semanticTree&&c.length>0&&this.canvas instanceof HTMLCanvasElement){if(!this._accessibilityOverlay){var C=c[0];this._accessibilityOverlay=new i.AccessibilityOverlay({canvas:this.canvas,instanceId:this._instanceId,semanticsOptions:this.semanticsOptions,allowFocusInterrupt:this._focusOptions.allowFocusInterrupt,isEditingHostFocused:this.isEditingHostFocused,fireAction:function(e,t){C.fireSemanticAction(e,t)},requestFocus:function(e){return C.focusSemanticNode(e)},clearFocus:function(){return C.instance.clearFocus()}})}var w=this._accessibilityOverlay?.needsUpdate(this._semanticTree);if(w||this._overlayTransformDirty){var E=null;if(w?.layoutChanged||this._overlayTransformDirty){var D=this._layout.runtimeFit(this.runtime),O=this._layout.runtimeAlignment(this.runtime);E=this.runtime.computeAlignment(D,O,{minX:this._layout.minX,minY:this._layout.minY,maxX:this._layout.maxX,maxY:this._layout.maxY},this.artboard.bounds,this._devicePixelRatioUsed*this._layout.layoutScaleFactor),this._overlayTransformDirty=!1}this._accessibilityOverlay.update(this._semanticTree,E,this._devicePixelRatioUsed,this.artboard.bounds,w),E?.delete()}}this.animator.stateMachines.length==0&&this.artboard.advance(e),this.animator.handleLooping(),this.animator.handleStateChanges(),this.animator.handleAdvancing(e),this.pollFocusState(),(t=this._viewModelInstance)==null||t.handleCallbacks(),this._globalViewModelInstances.forEach(function(e){e&&e.handleCallbacks()})},e.prototype.draw=function(e,t){if(this.frameRequestId=null,this.artboard){var n=performance.now(),r=this.enablePerfMarks&&this.frameCount<3?this.frameCount:-1;this.lastRenderTime||=e,this.renderSecondTimer+=e-this.lastRenderTime,this.renderSecondTimer>5e3&&(this.renderSecondTimer=0,t?.());var i=(e-this.lastRenderTime)/1e3;this.lastRenderTime=e,this.advanceAndReportChanges(i);var a=this.renderer;this._hasZeroSize||(this.drawOptimization==h.AlwaysDraw||this.artboard.didChange()||this._deferredWorkPending()||this._needsRedraw||this._canvasSizeChanged())&&(a.clear(),a.save(),r>=0&&performance.mark(`rive:align-renderer:start:f${r}`),this.alignRenderer(),r>=0&&(performance.mark(`rive:align-renderer:end:f${r}`),performance.measure(`rive:align-renderer:f${r}`,`rive:align-renderer:start:f${r}`,`rive:align-renderer:end:f${r}`)),r>=0&&performance.mark(`rive:artboard-draw:start:f${r}`),this.artboard.draw(a),r>=0&&(performance.mark(`rive:artboard-draw:end:f${r}`),performance.measure(`rive:artboard-draw:f${r}`,`rive:artboard-draw:start:f${r}`,`rive:artboard-draw:end:f${r}`)),a.restore(),r>=0&&performance.mark(`rive:renderer-flush:start:f${r}`),a.flush(),r>=0&&(performance.mark(`rive:renderer-flush:end:f${r}`),performance.measure(`rive:renderer-flush:f${r}`,`rive:renderer-flush:start:f${r}`,`rive:renderer-flush:end:f${r}`)),this._needsRedraw=!1),this.frameCount++;var o=performance.now();for(this.frameTimes.push(o),this.durations.push(o-n);this.frameTimes[0]<=o-1e3;)this.frameTimes.shift(),this.durations.shift();this.animator.isPlaying?this.scheduleRendering():(this.animator.isPaused||this.animator.isStopped)&&(this.lastRenderTime=0)}},e.prototype.alignRenderer=function(){var e=this,t=e.renderer,n=e.runtime,r=e._layout,i=e.artboard;t.align(r.runtimeFit(n),r.runtimeAlignment(n),{minX:r.minX,minY:r.minY,maxX:r.maxX,maxY:r.maxY},i.bounds,this._devicePixelRatioUsed*r.layoutScaleFactor)},Object.defineProperty(e.prototype,"fps",{get:function(){return this.durations.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frameTime",{get:function(){return this.durations.length===0?0:(this.durations.reduce(function(e,t){return e+t},0)/this.durations.length).toFixed(4)},enumerable:!1,configurable:!0}),e.prototype.cleanup=function(){var e,t,n,r,i;this.destroyed=!0,this.stopRendering(),(t=(e=this.renderer)?.bindContext)==null||t.call(e),this.cleanupInstances(),this._observed!==null&&V.remove(this._observed),this.removeRiveListeners(),this.renderer&&((r=(n=this.renderer).detachSession)==null||r.call(n)),this.releaseCurrentRiveFile(!0),this.riveFile=null,this.deleteRiveRenderer(),this._audioEventListener!==null&&(ne.remove(this._audioEventListener),this._audioEventListener=null),this._pageVisibilityHandler&&=(document.removeEventListener(`visibilitychange`,this._pageVisibilityHandler),null),(i=this._viewModelInstance)==null||i.cleanup(),this._viewModelInstance=null,this._globalViewModelInstances.forEach(function(e){return e.cleanup()}),this._globalViewModelInstances.clear(),this._dataEnums=null},e.prototype.releaseCurrentRiveFile=function(e){var t,n;this.file?((e||this.ownsRiveFile)&&((t=this.riveFile)==null||t.cleanup()),this.file=null):this.ownsRiveFile&&((n=this.riveFile)==null||n.destroyIfUnused())},e.prototype.deleteRiveRenderer=function(){var e,t;this.renderer&&((t=(e=this.renderer).detachSession)==null||t.call(e),this.renderer.delete()),this.renderer=null},Object.defineProperty(e.prototype,"deferredRendererActive",{get:function(){var e;return((e=this.renderer)?.deferredActive)?.call(e)??!1},enumerable:!1,configurable:!0}),e.prototype.cleanupInstances=function(){var e;this.eventCleanup!==null&&this.eventCleanup(),this.cleanupKeyboardInteractions(),this.cleanupSemantics(),(e=this.animator)==null||e.stop(),this.artboard&&=(this.artboard.delete(),null)},e.prototype.retrieveTextRun=function(e){if(!e)console.warn(`No text run name provided`);else if(!this.artboard)console.warn(`Tried to access text run, but the Artboard is null`);else{var t=this.artboard.textRun(e);if(!t)console.warn(`Could not access a text run with name '${e}' in the '${this.artboard?.name}' Artboard. Note that you must rename a text run node in the Rive editor to make it queryable at runtime.`);else return t}},e.prototype.getTextRunValue=function(e){I(j.textRuns,O);var t=this.retrieveTextRun(e);return t?t.text:void 0},e.prototype.setTextRunValue=function(e,t){I(j.textRuns,O);var n=this.retrieveTextRun(e);n&&(n.text=t)},e.prototype.warnIfLinearAnimationNames=function(e,t){this.animator&&this.animator.animations.some(function(t){return e.includes(t.name)})&&ee(t)},e.prototype.play=function(e,t){var n=this;L(e,`play`);var r=Y(e);this.readyForPlaying?(this.animator.play(r),this.warnIfLinearAnimationNames(r,`play`),this.syncSemanticsOnStateMachines(),this.eventCleanup&&this.eventCleanup(),this.cleanupKeyboardInteractions(),this.setupRiveListeners(),this.startRendering()):this.taskQueue.add({action:function(){return n.play(e,t)}})},e.prototype.pause=function(e){var t=this;L(e,`pause`);var n=Y(e);this.readyForPlaying?(this.eventCleanup&&this.eventCleanup(),this.cleanupKeyboardInteractions(),this.animator.pause(n),this.warnIfLinearAnimationNames(n,`pause`)):this.taskQueue.add({action:function(){return t.pause(e)}})},e.prototype.scrub=function(e,t){var n=this;I(j.scrub,"`scrub()` is deprecated and will be removed in a future major version: use a state machine to control playback instead.");var r=Y(e);this.readyForPlaying?(this.animator.scrub(r,t||0),this.drawFrame()):this.taskQueue.add({action:function(){return n.scrub(e,t)}})},e.prototype.stop=function(e){var t=this;L(e,`stop`);var n=Y(e);this.readyForPlaying?(this.warnIfLinearAnimationNames(n,`stop`),this.animator&&this.animator.stop(n),this.eventCleanup&&this.eventCleanup(),this.cleanupKeyboardInteractions(),this.cleanupSemantics()):this.taskQueue.add({action:function(){return t.stop(e)}})},e.prototype.reset=function(e){var t=e?.artboard,n=oe({stateMachine:e?.stateMachine,animations:e?.animations,stateMachines:e?.stateMachines}),r=n.startingAnimationNames,i=n.startingStateMachineNames,a=e?.autoplay??!1,o=e?.autoBind??!1;this.cleanupInstances(),this.initArtboard(t,r,i,a,o),this.readyForPlaying&&this.taskQueue.process()},e.prototype.load=function(t){if(!t.src&&!t.buffer&&!t.riveFile)throw new d(e.missingErrorMessage);this.stop(),this.init(t)},Object.defineProperty(e.prototype,"layout",{get:function(){return this._layout},set:function(e){this._layout=e,this.reportDisplayScale(),this._overlayTransformDirty=!0,e.maxX&&e.maxY||this.resizeToCanvas(),this.loaded&&!this.animator.isPlaying&&this.drawFrame()},enumerable:!1,configurable:!0}),e.prototype.resizeToCanvas=function(){this._layout=this.layout.copyWith({minX:0,minY:0,maxX:this.canvas.width,maxY:this.canvas.height}),this._overlayTransformDirty=!0},e.prototype.resizeDrawingSurfaceToCanvas=function(e){if(this.canvas instanceof HTMLCanvasElement&&window){var t=this.canvas.getBoundingClientRect(),n=t.width,r=t.height,i=e||window.devicePixelRatio||1;if(this.devicePixelRatioUsed=i,this.canvas.width=i*n,this.canvas.height=i*r,this._needsRedraw=!0,this.resizeToCanvas(),this.layout.fit===p.Layout&&this.artboard){var a=this._layout.layoutScaleFactor;this.artboard.width=n/a,this.artboard.height=r/a}this.drawFrame()}},Object.defineProperty(e.prototype,"source",{get:function(){return this.src},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeArtboard",{get:function(){return this.artboard?this.artboard.name:``},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"semanticTree",{get:function(){return this._semanticTree},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"accessibilityOverlay",{get:function(){return this._accessibilityOverlay},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"animationNames",{get:function(){if(!this.loaded||!this.artboard)return[];for(var e=[],t=0;t0?this.animator.stateMachines.forEach(function(e){return e.instance.setViewModelInstance(n)}):this.artboard.setViewModelInstance(n))},e.prototype.bind=function(){this.artboard&&!this.destroyed&&(this.animator.stateMachines.length>0?this.animator.stateMachines.forEach(function(e){return e.instance.bind()}):this.artboard.bind())},Object.defineProperty(e.prototype,"viewModelInstance",{get:function(){return this._viewModelInstance},enumerable:!1,configurable:!0}),e.prototype.setGlobalViewModelInstance=function(e,t){var n,r=t?.runtimeInstance;if(!this.artboard||this.destroyed||!r)return!1;var i=!1;return this.animator.stateMachines.length>0?this.animator.stateMachines.forEach(function(t){t.instance.setGlobalViewModelInstance(e,r)&&(i=!0)}):i=this.artboard.setGlobalViewModelInstance(e,r),i&&(t.internalIncrementReferenceCount(),(n=this._globalViewModelInstances.get(e))==null||n.cleanup(),this._globalViewModelInstances.set(e,t)),i},e.prototype.globalViewModelInstance=function(e){var t=this._globalViewModelInstances.get(e);if(t)return t;if(!this.artboard||this.destroyed)return null;var n=this.animator.stateMachines.length>0?this.animator.stateMachines[0].instance.globalViewModelInstance(e):this.artboard.globalViewModelInstance(e);if(n===null)return null;var r=new W(n,null);return(0,a.createFinalization)(r,n),r.internalIncrementReferenceCount(),this._globalViewModelInstances.set(e,r),r},e.prototype.globalViewModelNames=function(){return this.file?.globalViewModelNames()??[]},e.prototype.viewModelByIndex=function(e){var t=this.file.viewModelByIndex(e);return t===null?null:new H(t)},e.prototype.viewModelByName=function(e){return this.riveFile?.viewModelByName(e)},e.prototype.enums=function(){if(this._dataEnums===null){var e=this.file.enums();this._dataEnums=e.map(function(e){return new ue(e)})}return this._dataEnums},e.prototype.defaultViewModel=function(){if(this.artboard){var e=this.file.defaultArtboardViewModel(this.artboard);if(e)return new H(e)}return null},e.prototype.getArtboard=function(e){return this.riveFile?.getArtboard(e)??null},e.prototype.getBindableArtboard=function(e){return this.riveFile?.getBindableArtboard(e)??null},e.prototype.getDefaultBindableArtboard=function(){return this.riveFile?.getDefaultBindableArtboard()??null},e.prototype.clearFocus=function(){this.animator.stateMachines.filter(function(e){return e.playing&&e.hasFocusNodes}).forEach(function(e){return e.clearFocus()})},e.missingErrorMessage=`Rive source file or data buffer required`,e.cleanupErrorMessage=`Attempt to use file after calling cleanup.`,e}(),le;(function(e){e.none=`none`,e.string=`string`,e.number=`number`,e.boolean=`boolean`,e.color=`color`,e.list=`list`,e.enumType=`enumType`,e.trigger=`trigger`,e.viewModel=`viewModel`,e.integer=`integer`,e.listIndex=`listIndex`,e.image=`image`,e.artboard=`artboard`})(le||={});var H=function(){function e(e){this._viewModel=e}return Object.defineProperty(e.prototype,"instanceCount",{get:function(){return this._viewModel.instanceCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._viewModel.name},enumerable:!1,configurable:!0}),e.prototype.instanceByIndex=function(e){var t=this._viewModel.instanceByIndex(e);if(t!==null){var n=new W(t,null);return(0,a.createFinalization)(n,t),n}return null},e.prototype.instanceByName=function(e){var t=this._viewModel.instanceByName(e);if(t!==null){var n=new W(t,null);return(0,a.createFinalization)(n,t),n}return null},e.prototype.defaultInstance=function(){var e=this._viewModel.defaultInstance();if(e!==null){var t=new W(e,null);return(0,a.createFinalization)(t,e),t}return null},e.prototype.instance=function(){var e=this._viewModel.instance();if(e!==null){var t=new W(e,null);return(0,a.createFinalization)(t,e),t}return null},Object.defineProperty(e.prototype,"properties",{get:function(){return this._viewModel.getProperties()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"instanceNames",{get:function(){return this._viewModel.getInstanceNames()},enumerable:!1,configurable:!0}),e}(),ue=function(){function e(e){this._dataEnum=e}return Object.defineProperty(e.prototype,"name",{get:function(){return this._dataEnum.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){return this._dataEnum.values},enumerable:!1,configurable:!0}),e}(),U;(function(e){e.Number=`number`,e.String=`string`,e.Boolean=`boolean`,e.Color=`color`,e.Trigger=`trigger`,e.Enum=`enum`,e.List=`list`,e.Image=`image`,e.Font=`font`,e.Artboard=`artboard`})(U||={});var W=function(){function e(e,t){this._parents=[],this._children=[],this._viewModelInstances=new Map,this._propertiesWithCallbacks=[],this._referenceCount=0,this.selfUnref=!1,this._runtimeInstance=e,t!==null&&this._parents.push(t)}return Object.defineProperty(e.prototype,"runtimeInstance",{get:function(){return this._runtimeInstance},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nativeInstance",{get:function(){return this._runtimeInstance},enumerable:!1,configurable:!0}),e.prototype.handleCallbacks=function(){this._propertiesWithCallbacks.length!==0&&(this._propertiesWithCallbacks.forEach(function(e){e.handleCallbacks()}),this._propertiesWithCallbacks.forEach(function(e){e.clearChanges()})),this._children.forEach(function(e){return e.handleCallbacks()})},e.prototype.addParent=function(e){this._parents.includes(e)||(this._parents.push(e),(this._propertiesWithCallbacks.length>0||this._children.length>0)&&e.addToViewModelCallbacks(this))},e.prototype.removeParent=function(e){var t=this._parents.indexOf(e);t!==-1&&(this._parents[t].removeFromViewModelCallbacks(this),this._parents.splice(t,1))},e.prototype.addToPropertyCallbacks=function(e){var t=this;this._propertiesWithCallbacks.includes(e)||(this._propertiesWithCallbacks.push(e),this._propertiesWithCallbacks.length>0&&this._parents.forEach(function(e){e.addToViewModelCallbacks(t)}))},e.prototype.removeFromPropertyCallbacks=function(e){var t=this;this._propertiesWithCallbacks.includes(e)&&(this._propertiesWithCallbacks=this._propertiesWithCallbacks.filter(function(t){return t!==e}),this._children.length===0&&this._propertiesWithCallbacks.length===0&&this._parents.forEach(function(e){e.removeFromViewModelCallbacks(t)}))},e.prototype.addToViewModelCallbacks=function(e){var t=this;this._children.includes(e)||(this._children.push(e),this._parents.forEach(function(e){e.addToViewModelCallbacks(t)}))},e.prototype.removeFromViewModelCallbacks=function(e){var t=this;this._children.includes(e)&&(this._children=this._children.filter(function(t){return t!==e}),this._children.length===0&&this._propertiesWithCallbacks.length===0&&this._parents.forEach(function(e){e.removeFromViewModelCallbacks(t)}))},e.prototype.clearCallbacks=function(){this._propertiesWithCallbacks.forEach(function(e){e.clearCallbacks()})},e.prototype.propertyFromPath=function(e,t){var n=e.split(`/`);return this.propertyFromPathSegments(n,0,t)},e.prototype.viewModelFromPathSegments=function(e,t){var n=this.internalViewModelInstance(e[t]);return n===null?null:t==e.length-1?n:n.viewModelFromPathSegments(e,t++)},e.prototype.propertyFromPathSegments=function(e,t,n){if(t1?this.viewModelFromPathSegments(t.slice(0,t.length-1),0):this;return n==null?null:n.internalViewModelInstance(t[t.length-1])},e.prototype.internalReplaceViewModel=function(e,t){if(t.runtimeInstance!==null){var n=this._runtimeInstance?.replaceViewModel(e,t.runtimeInstance)||!1;if(n){t.internalIncrementReferenceCount();var r=this.internalViewModelInstance(e);r!==null&&(r.removeParent(this),this._children.includes(r)&&(this._children=this._children.filter(function(e){return e!==r})),r.cleanup()),this._viewModelInstances.set(e,t),t.addParent(this)}return n}return!1},e.prototype.replaceViewModel=function(e,t){var n=e.split(`/`);return(n.length>1?this.viewModelFromPathSegments(n.slice(0,n.length-1),0):this)?.internalReplaceViewModel(n[n.length-1],t)??!1},e.prototype.incrementReferenceCount=function(){var e;this._referenceCount++,(e=this._runtimeInstance)==null||e.incrementReferenceCount()},e.prototype.decrementReferenceCount=function(){var e;this._referenceCount--,(e=this._runtimeInstance)==null||e.decrementReferenceCount()},Object.defineProperty(e.prototype,"properties",{get:function(){return this._runtimeInstance?.getProperties().map(function(e){return s({},e)})||[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewModelName",{get:function(){return this._runtimeInstance?.getViewModelName()??``},enumerable:!1,configurable:!0}),e.prototype.internalIncrementReferenceCount=function(){this._referenceCount++},e.prototype.cleanup=function(){var e=this,t;if(this._referenceCount--,this._referenceCount<=0){this.selfUnref&&((t=this._runtimeInstance)==null||t.unref()),this._runtimeInstance=null,this.clearCallbacks(),this._propertiesWithCallbacks=[],this._viewModelInstances.forEach(function(e){e.cleanup()}),this._viewModelInstances.clear();var n=u([],this._children,!0);this._children.length=0;var r=u([],this._parents,!0);this._parents.length=0,n.forEach(function(t){t.removeParent(e)}),r.forEach(function(t){t.removeFromViewModelCallbacks(e)})}},e}(),G=function(){function e(e,t){this.callbacks=[],this._viewModelInstanceValue=e,this._parentViewModel=t}return e.prototype.on=function(e){this.callbacks.length===0&&this._viewModelInstanceValue.clearChanges(),this.callbacks.includes(e)||(this.callbacks.push(e),this._parentViewModel.addToPropertyCallbacks(this))},e.prototype.off=function(e){e?this.callbacks=this.callbacks.filter(function(t){return t!==e}):this.callbacks.length=0,this.callbacks.length===0&&this._parentViewModel.removeFromPropertyCallbacks(this)},e.prototype.internalHandleCallback=function(e){},e.prototype.handleCallbacks=function(){var e=this;this._viewModelInstanceValue.hasChanged&&this.callbacks.forEach(function(t){e.internalHandleCallback(t)})},e.prototype.clearChanges=function(){this._viewModelInstanceValue.clearChanges()},e.prototype.clearCallbacks=function(){this.callbacks.length=0},Object.defineProperty(e.prototype,"name",{get:function(){return this._viewModelInstanceValue.name},enumerable:!1,configurable:!0}),e}(),K=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{get:function(){return this._viewModelInstanceValue.value},set:function(e){this._viewModelInstanceValue.value=e},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e(this.value)},t}(G),de=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{get:function(){return this._viewModelInstanceValue.value},set:function(e){this._viewModelInstanceValue.value=e},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e(this.value)},t}(G),q=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{get:function(){return this._viewModelInstanceValue.value},set:function(e){this._viewModelInstanceValue.value=e},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e(this.value)},t}(G),fe=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return t.prototype.trigger=function(){return this._viewModelInstanceValue.trigger()},t.prototype.internalHandleCallback=function(e){e()},t}(G),pe=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{get:function(){return this._viewModelInstanceValue.value},set:function(e){this._viewModelInstanceValue.value=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"valueIndex",{get:function(){return this._viewModelInstanceValue.valueIndex},set:function(e){this._viewModelInstanceValue.valueIndex=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return this._viewModelInstanceValue.values},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e(this.value)},t}(G),J=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"length",{get:function(){return this._viewModelInstanceValue.size},enumerable:!1,configurable:!0}),t.prototype.addInstance=function(e){e.runtimeInstance!=null&&(this._viewModelInstanceValue.addInstance(e.runtimeInstance),e.addParent(this._parentViewModel))},t.prototype.addInstanceAt=function(e,t){return e.runtimeInstance!=null&&this._viewModelInstanceValue.addInstanceAt(e.runtimeInstance,t)?(e.addParent(this._parentViewModel),!0):!1},t.prototype.removeInstance=function(e){e.runtimeInstance!=null&&(this._viewModelInstanceValue.removeInstance(e.runtimeInstance),e.removeParent(this._parentViewModel))},t.prototype.removeInstanceAt=function(e){this._viewModelInstanceValue.removeInstanceAt(e)},t.prototype.instanceAt=function(e){var t=this._viewModelInstanceValue.instanceAt(e);if(t!=null){var n=new W(t,this._parentViewModel);return(0,a.createFinalization)(n,t),n}return null},t.prototype.swap=function(e,t){this._viewModelInstanceValue.swap(e,t)},t.prototype.internalHandleCallback=function(e){e()},t}(G),me=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{get:function(){return this._viewModelInstanceValue.value},set:function(e){this._viewModelInstanceValue.value=e},enumerable:!1,configurable:!0}),t.prototype.rgb=function(e,t,n){this._viewModelInstanceValue.rgb(e,t,n)},t.prototype.rgba=function(e,t,n,r){this._viewModelInstanceValue.argb(r,e,t,n)},t.prototype.argb=function(e,t,n,r){this._viewModelInstanceValue.argb(e,t,n,r)},t.prototype.alpha=function(e){this._viewModelInstanceValue.alpha(e)},t.prototype.opacity=function(e){this._viewModelInstanceValue.alpha(Math.round(Math.max(0,Math.min(1,e))*255))},t.prototype.internalHandleCallback=function(e){e(this.value)},t}(G),he=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{set:function(e){this._viewModelInstanceValue.value(e?.nativeImage??null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(G),ge=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{set:function(e){this._viewModelInstanceValue.value(e?.nativeFont??null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(G),_e=function(e){o(t,e);function t(t,n){return e.call(this,t,n)||this}return Object.defineProperty(t.prototype,"value",{set:function(e){var t=e.isBindableArtboard?e:e.file.internalBindableArtboardFromArtboard(e.nativeArtboard);this._viewModelInstanceValue.value(t?.nativeArtboard??null),t?.nativeViewModel&&this._viewModelInstanceValue.viewModelInstance(t?.nativeViewModel??null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(G),ve=function(e){return c(void 0,void 0,void 0,function(){var t,n,r;return l(this,function(i){switch(i.label){case 0:return t=new Request(e),[4,fetch(t)];case 1:if(n=i.sent(),!n.ok)throw Error(`Failed to fetch the Rive file: HTTP ${n.status}`);return[4,n.arrayBuffer()];case 2:return r=i.sent(),[2,r]}})})},Y=function(e){return typeof e==`string`?[e]:e instanceof Array?e:[]},ye={EventManager:z,TaskQueueManager:te},be=function(e){return c(void 0,void 0,void 0,function(){var n,r,i;return l(this,function(o){switch(o.label){case 0:return n=new Promise(function(n){return t.RuntimeLoader.getInstance(function(t){t.decodeAudio(e,n,null)})}),[4,n];case 1:return r=o.sent(),i=new a.AudioWrapper(r),a.finalizationRegistry.register(i,r),[2,i]}})})},xe=function(e){return c(void 0,void 0,void 0,function(){var n,r,i;return l(this,function(o){switch(o.label){case 0:return n=new Promise(function(n){return t.RuntimeLoader.getInstance(function(t){t.decodeImage(e,n,null)})}),[4,n];case 1:return r=o.sent(),i=new a.ImageWrapper(r),a.finalizationRegistry.register(i,r),[2,i]}})})},Se=function(e){return c(void 0,void 0,void 0,function(){var n,r,i;return l(this,function(o){switch(o.label){case 0:return n=new Promise(function(n){return t.RuntimeLoader.getInstance(function(t){t.decodeFont(e,n,null)})}),[4,n];case 1:return r=o.sent(),i=new a.FontWrapper(r),a.finalizationRegistry.register(i,r),[2,i]}})})}})(),r})())}));export default t();