@machete-jhun/canvas-studio 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ const c="c0",a="c1",s="c2",e="c3",E="c4",t="c5",d="c6",r="c7",_="c8",i="c9",o="ca",C="cb",R="cc",b="cd",f="ce",v={IMAGE:"image",RECT:"rect",TEXT:"text",SVG:"svg",QR_CODE:"qr_code",BAR_CODE:"bar_code",RIVE:"rive",VIDEO:"video",BACK_SCREEN:"back_screen"},g={active:"#1677ff",disable:"#666",default:"#ccc"};export{g as _,s as a,E as c,b as d,d as f,c as g,R as h,r as i,C as l,v as m,o as n,a as o,t as p,i as r,_ as s,e as t,f as u};
package/dist/index.js CHANGED
@@ -1,25 +1,25 @@
1
- import{n as e,s as t,t as n}from"./utils-HkiclU4u.js";import r,{forwardRef as i,useCallback as a,useEffect as o,useImperativeHandle as s,useMemo as u,useRef as l,useState as c}from"react";import d from"konva";import{Group as h,Image as f,Layer as p,Path as m,Rect as v,Shape as g,Stage as b,Text as y,Transformer as w}from"react-konva";import _ from"qrcode";import{encode as A}from"js-base64";import{jsx as C,jsxs as E}from"react/jsx-runtime";import{useImage as M}from"react-konva-utils";import x from"jsbarcode";import{debounce as k}from"lodash-es";import{nanoid as I}from"nanoid";var P=Object.getOwnPropertyNames,R=(e,t)=>function(){return t||(0,e[P(e)[0]])((t={exports:{}}).exports,t),t.exports};const S="c0",L="c1",T="c2",F="c3",O="c4",j="c5",D="c6",W="c7",B="c8",V="c9",U="ca",N="cb",$="cc",z="cd",Y="ce",H={IMAGE:"image",RECT:"rect",TEXT:"text",SVG:"svg",QR_CODE:"qr_code",BAR_CODE:"bar_code",RIVE:"rive",VIDEO:"video",BACK_SCREEN:"back_screen"},X={active:"#1677ff",disable:"#666",default:"#ccc"};function G(e){throw new Error(`Unexpected object: ${e}`)}var q=i(({value:e,onShapeChange:t,...n},r)=>{const[i,s]=c(),{source:u,margin:l,errorCorrectionLevel:d,dark:h,light:p}=e,m=a(async()=>{const r=await _.toString(u,{type:"svg",errorCorrectionLevel:d,margin:l,color:{dark:h,light:p}}),i=new Image;i.src=`data:image/svg+xml;base64,${A(r)}`,i.onload=()=>{s(i),e.info?.svgSource!==r&&(n.onLoad?.(),t?.({...e,info:{svgSource:r}}))}},[u,l,d,h,p,e,t,n]);return o(()=>{m()},[m]),/* @__PURE__ */C(f,{ref:r,image:i,...n})}),K=i((e,t)=>{const[n,r]=M(e.url,"anonymous");return"loaded"===r&&e.onLoad?.(),/* @__PURE__ */C(f,{ref:t,image:n,...e})}),J=i(({value:e,onShapeChange:t,onLoad:n,...r},i)=>{const{source:a,displayValue:s,background:u,lineColor:d,margin:h,barType:p}=e,[m,v]=c(),g=l("");return o(()=>{let r=!0;return(()=>{const i=document.createElement("svg");x(i,a,{displayValue:s,background:u,lineColor:d,margin:h,format:p});const o=i.outerHTML,l=new Image;l.src=`data:image/svg+xml;base64,${A(o)}`,l.onload=()=>{r&&(v(l),n?.(),g.current!==o&&(g.current=o,t?.({...e,info:{svgSource:o}})))}})(),()=>{r=!1}},[a,s,u,d,h,p,e,t,n]),/* @__PURE__ */C(f,{ref:i,image:m,...r})}),Q=i((e,t)=>{const{url:n,colors:r=[],onLoad:i,...a}=e,[s,u]=c(),d=l("");return o(()=>{let e=!0;return(async()=>{let t=d.current;if(!d.current){const e=await(await fetch(n)).text();d.current=e,t=e}r.forEach(({origin:e,target:n})=>{e!==n&&(t=t.replaceAll(e,n))});const a=`data:image/svg+xml;base64,${A(t)}`,o=new Image;o.src=a,o.onload=()=>{e&&(u(o),i?.())}})(),()=>{e=!1}},[n,r,i]),/* @__PURE__ */C(f,{ref:t,image:s,...a})}),Z=/* @__PURE__ */R({"node_modules/.pnpm/@rive-app+canvas@2.34.2/node_modules/@rive-app/canvas/rive.js":(e,t)=>{var n,r;n=e,r=()=>(()=>{var e=[,(e,t,n)=>{n.r(t),n.d(t,{default:()=>r});const r=(i="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,n,r=e,a=new Promise((e,r)=>{t=e,n=r}),o="object"==typeof window,s="function"==typeof importScripts;function u(){function e(e){const a=r;n=t=0,r=/* @__PURE__ */new Map,a.forEach(t=>{try{t(e)}catch(n){console.error(n)}}),this.ob(),i&&i.Qb()}let t=0,n=0,r=/* @__PURE__ */new Map,i=null,a=null;this.requestAnimationFrame=function(i){t||=requestAnimationFrame(e.bind(this));const a=++n;return r.set(a,i),a},this.cancelAnimationFrame=function(e){r.delete(e),t&&0==r.size&&(cancelAnimationFrame(t),t=0)},this.Ob=function(e){a&&(document.body.remove(a),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.Qb=function(){var r=performance.now();n?(++t,1e3<(r-=n)&&(e(1e3*t/r),t=n=0)):(n=r,t=0)}}},this.Lb=function(){a&&(document.body.remove(a),a=null),i=null},this.ob=function(){}}function l(e){const t=/* @__PURE__ */new Map;let n=-1/0;this.push=function(r){return r=r+((1<<e)-1)>>e,t.has(r)&&clearTimeout(t.get(r)),t.set(r,setTimeout(function(){t.delete(r),0==t.length?n=-1/0:r==n&&(n=Math.max(...t.keys()),console.assert(n<r))},1e3)),n=Math.max(r,n),n<<e}}const c=r.onRuntimeInitialized;r.onRuntimeInitialized=function(){c&&c();let e=r.decodeAudio;r.decodeAudio=function(t,n){n(t=e(t))};let t=r.decodeFont;r.decodeFont=function(e,n){n(e=t(e))};const n=r.FileAssetLoader;r.ptrToAsset=e=>{let t=r.ptrToFileAsset(e);return t.isImage?r.ptrToImageAsset(e):t.isFont?r.ptrToFontAsset(e):t.isAudio?r.ptrToAudioAsset(e):t},r.CustomFileAssetLoader=n.extend("CustomFileAssetLoader",{__construct:function({loadContents:e}){this.__parent.__construct.call(this),this.Eb=e},loadContents:function(e,t){return e=r.ptrToAsset(e),this.Eb(e,t)}}),r.CDNFileAssetLoader=n.extend("CDNFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this)},loadContents:function(e){let t=r.ptrToAsset(e);return""!==(e=t.cdnUuid)&&(n=t.cdnBaseUrl+"/"+e,(i=new XMLHttpRequest).responseType="arraybuffer",i.onreadystatechange=function(){4==i.readyState&&200==i.status&&(e=>{t.decode(new Uint8Array(e.response))})(i)},i.open("GET",n,!0),i.send(null),!0);var n,i}}),r.FallbackFileAssetLoader=n.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this),this.kb=[]},addLoader:function(e){this.kb.push(e)},loadContents:function(e,t){for(let n of this.kb)if(n.loadContents(e,t))return!0;return!1}});let i=r.computeAlignment;r.computeAlignment=function(e,t,n,r,a=1){return i.call(this,e,t,n,r,a)}};const d="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),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)))return console.log("No WebGL support. Image mesh will not be drawn."),!1;n=1}function l(e,t,n){if(t=s.createShader(t),s.shaderSource(t,n),s.compileShader(t),0<((n=s.getShaderInfoLog(t))||"").length)throw n;s.attachShader(e,t)}if(s=new Proxy(s,{get:(e,t)=>e.isContextLost()?(u||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",t),u=!0),"function"==typeof e[t]?function(){}:void 0):"function"==typeof e[t]?function(...n){return e[t].apply(e,n)}:e[t],set(e,t,n){if(!e.isContextLost())return e[t]=n,!0;u||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+t),u=!0)}}),r=Math.min(s.getParameter(s.MAX_RENDERBUFFER_SIZE),s.getParameter(s.MAX_TEXTURE_SIZE)),l(e=s.createProgram(),s.VERTEX_SHADER,"attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }"),l(e,s.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }"),s.bindAttribLocation(e,0,"vertex"),s.bindAttribLocation(e,1,"uv"),s.linkProgram(e),0<((o=s.getProgramInfoLog(e))||"").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,s=0,u=!1;e(),this.bc=function(){return e(),r},this.Kb=function(e){t.deleteTexture&&t.deleteTexture(e)},this.Jb=function(r){if(!e())return null;const 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),2==n?(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};const c=new l(8),d=new l(8),h=new l(10),f=new l(10);this.Nb=function(n,r,u,l,p){if(e()){var m=c.push(n),v=d.push(r);if(t.canvas){for(var g of(t.canvas.width==m&&t.canvas.height==v||(t.canvas.width=m,t.canvas.height=v),t.viewport(0,v-r,n,r),t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.enable(t.SCISSOR_TEST),u.sort((e,t)=>t.vb-e.vb),m=h.push(l),o!=m&&(t.bufferData(t.ARRAY_BUFFER,8*m,t.DYNAMIC_DRAW),o=m),m=0,u))t.bufferSubData(t.ARRAY_BUFFER,m,g.Ta),m+=4*g.Ta.length;for(var b of(console.assert(m==4*l),u))t.bufferSubData(t.ARRAY_BUFFER,m,b.Bb),m+=4*b.Bb.length;for(var y of(console.assert(m==8*l),m=f.push(p),s!=m&&(t.bufferData(t.ELEMENT_ARRAY_BUFFER,2*m,t.DYNAMIC_DRAW),s=m),g=0,u))t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,g,y.indices),g+=2*y.indices.length;console.assert(g==2*p),y=0,b=!0,m=g=0;for(const e of u){e.image.Ja!=y&&(t.bindTexture(t.TEXTURE_2D,e.image.Ia||null),y=e.image.Ja),e.hc?(t.scissor(e.Za,v-e.$a-e.jb,e.uc,e.jb),b=!0):b&&(t.scissor(0,v-r,n,r),b=!1),u=2/n;const o=-2/r;t.uniform4f(i,e.ha[0]*u*e.Aa,e.ha[1]*o*e.Ba,e.ha[2]*u*e.Aa,e.ha[3]*o*e.Ba),t.uniform2f(a,e.ha[4]*u*e.Aa+u*(e.Za-e.cc*e.Aa)-1,e.ha[5]*o*e.Ba+o*(e.$a-e.dc*e.Ba)+1),t.vertexAttribPointer(0,2,t.FLOAT,!1,0,m),t.vertexAttribPointer(1,2,t.FLOAT,!1,0,m+4*l),t.drawElements(t.TRIANGLES,e.indices.length,t.UNSIGNED_SHORT,g),m+=4*e.Ta.length,g+=2*e.indices.length}console.assert(m==4*l),console.assert(g==2*p)}}},this.canvas=function(){return e()&&t.canvas}},f=r.onRuntimeInitialized;r.onRuntimeInitialized=function(){function e(e){switch(e){case p.srcOver:return"source-over";case p.screen:return"screen";case p.overlay:return"overlay";case p.darken:return"darken";case p.lighten:return"lighten";case p.colorDodge:return"color-dodge";case p.colorBurn:return"color-burn";case p.hardLight:return"hard-light";case p.softLight:return"soft-light";case p.difference:return"difference";case p.exclusion:return"exclusion";case p.multiply:return"multiply";case p.hue:return"hue";case p.saturation:return"saturation";case p.color:return"color";case p.luminosity:return"luminosity"}}function t(e){return"rgba("+((16711680&e)>>>16)+","+((65280&e)>>>8)+","+((255&e)>>>0)+","+((4278190080&e)>>>24)/255+")"}function n(){0<E.length&&(h.Nb(C.drawWidth(),C.drawHeight(),E,M,x),E=[],x=M=0,C.reset(512,512));for(const e of A){for(const t of e.I)t();e.I=[]}A.clear()}f&&f();var i=r.RenderPaintStyle;const a=r.RenderPath,o=r.RenderPaint,s=r.Renderer,l=r.StrokeCap,c=r.StrokeJoin,p=r.BlendMode,m=i.fill,v=i.stroke,g=r.FillRule.evenOdd;let b=1;var y=r.RenderImage.extend("CanvasRenderImage",{__construct:function({la:e,wa:t}={}){this.__parent.__construct.call(this),this.Ja=b,b=b+1&2147483647||1,this.la=e,this.wa=t},__destruct:function(){this.Ia&&(h.Kb(this.Ia),URL.revokeObjectURL(this.Wa)),this.__parent.__destruct.call(this)},decode:function(e){var t=this;t.wa&&t.wa(t);var n=new Image;t.Wa=URL.createObjectURL(new Blob([e],{type:"image/png"})),n.onload=function(){t.Db=n,t.Ia=h.Jb(n),t.size(n.width,n.height),t.la&&t.la(t)},n.src=t.Wa}}),w=a.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this),this.U=new Path2D},rewind:function(){this.U=new Path2D},addPath:function(e,t,n,r,i,a,o){var s=this.U,u=s.addPath;e=e.U;const l=new DOMMatrix;l.a=t,l.b=n,l.c=r,l.d=i,l.e=a,l.f=o,u.call(s,e,l)},fillRule:function(e){this.Va=e},moveTo:function(e,t){this.U.moveTo(e,t)},lineTo:function(e,t){this.U.lineTo(e,t)},cubicTo:function(e,t,n,r,i,a){this.U.bezierCurveTo(e,t,n,r,i,a)},close:function(){this.U.closePath()}}),_=o.extend("CanvasRenderPaint",{color:function(e){this.Xa=t(e)},thickness:function(e){this.Gb=e},join:function(e){switch(e){case c.miter:this.Ha="miter";break;case c.round:this.Ha="round";break;case c.bevel:this.Ha="bevel"}},cap:function(e){switch(e){case l.butt:this.Ga="butt";break;case l.round:this.Ga="round";break;case l.square:this.Ga="square"}},style:function(e){this.Fb=e},blendMode:function(t){this.Cb=e(t)},clearGradient:function(){this.ja=null},linearGradient:function(e,t,n,r){this.ja={xb:e,yb:t,cb:n,eb:r,Qa:[]}},radialGradient:function(e,t,n,r){this.ja={xb:e,yb:t,cb:n,eb:r,Qa:[],ac:!0}},addStop:function(e,t){this.ja.Qa.push({color:e,stop:t})},completeGradient:function(){},draw:function(e,n,r,i){let a=this.Fb;var o=this.Xa,s=this.ja;const u=e.globalCompositeOperation,l=e.globalAlpha;if(e.globalCompositeOperation=this.Cb,e.globalAlpha=i,null!=s){o=s.xb;const n=s.yb,r=s.cb;var c=s.eb;i=s.Qa,s.ac?(s=r-o,c-=n,o=e.createRadialGradient(o,n,0,o,n,Math.sqrt(s*s+c*c))):o=e.createLinearGradient(o,n,r,c);for(let e=0,a=i.length;e<a;e++)s=i[e],o.addColorStop(s.stop,t(s.color));this.Xa=o,this.ja=null}switch(a){case v:e.strokeStyle=o,e.lineWidth=this.Gb,e.lineCap=this.Ga,e.lineJoin=this.Ha,e.stroke(n);break;case m:e.fillStyle=o,e.fill(n,r)}e.globalCompositeOperation=u,e.globalAlpha=l}});const A=/* @__PURE__ */new Set;let C=null,E=[],M=0,x=0;var k=r.CanvasRenderer=s.extend("Renderer",{__construct:function(e){this.__parent.__construct.call(this),this.T=[1,0,0,1,0,0],this.G=[1],this.B=e.getContext("2d"),this.Ua=e,this.I=[]},save:function(){this.T.push(...this.T.slice(this.T.length-6)),this.G.push(this.G[this.G.length-1]),this.I.push(this.B.save.bind(this.B))},restore:function(){const e=this.T.length-6;if(6>e)throw"restore() called without matching save().";this.T.splice(e),this.G.pop(),this.I.push(this.B.restore.bind(this.B))},transform:function(e,t,n,r,i,a){const o=this.T,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.I.push(this.B.transform.bind(this.B,e,t,n,r,i,a))},rotate:function(e){const t=Math.sin(e);e=Math.cos(e),this.transform(e,t,-t,e,0,0)},modulateOpacity:function(e){this.G[this.G.length-1]*=e},_drawPath:function(e,t){this.I.push(t.draw.bind(t,this.B,e.U,e.Va===g?"evenodd":"nonzero",Math.max(0,this.G[this.G.length-1])))},_drawRiveImage:function(t,n,r,i){var a=t.Db;if(a){var o=this.B,s=e(r),u=Math.max(0,i*this.G[this.G.length-1]);this.I.push(function(){o.globalCompositeOperation=s,o.globalAlpha=u,o.drawImage(a,0,0),o.globalAlpha=1})}},_getMatrix:function(e){const t=this.T,n=t.length-6;for(let r=0;6>r;++r)e[r]=t[n+r]},_drawImageMesh:function(t,i,a,o,s,u,l,c,d,f,p){i=this.B.canvas.width;var m=this.B.canvas.height;const v=f-c,g=p-d;c=Math.max(c,0),d=Math.max(d,0),f=Math.min(f,i),p=Math.min(p,m);const b=f-c,y=p-d;if(console.assert(b<=Math.min(v,i)),console.assert(y<=Math.min(g,m)),!(0>=b||0>=y)){f=b<v||y<g,i=p=1;var w=Math.ceil(b*p),_=Math.ceil(y*i);m=h.bc(),w>m&&(p*=m/w,w=m),_>m&&(i*=m/_,_=m),C||(C=new r.DynamicRectanizer(m),C.reset(512,512)),0>(m=C.addRect(w,_))&&(n(),A.add(this),m=C.addRect(w,_),console.assert(0<=m));var k=65535&m,I=m>>16;E.push({ha:this.T.slice(this.T.length-6),image:t,Za:k,$a:I,cc:c,dc:d,uc:w,jb:_,Aa:p,Ba:i,Ta:new Float32Array(s),Bb:new Float32Array(u),indices:new Uint16Array(l),hc:f,vb:t.Ja<<1|(f?1:0)}),M+=s.length,x+=l.length;var P=this.B,R=e(a),S=Math.max(0,o*this.G[this.G.length-1]);this.I.push(function(){P.save(),P.resetTransform(),P.globalCompositeOperation=R,P.globalAlpha=S;const e=h.canvas();e&&P.drawImage(e,k,I,w,_,c,d,b,y),P.restore()})}},_clipPath:function(e){this.I.push(this.B.clip.bind(this.B,e.U,e.Va===g?"evenodd":"nonzero"))},clear:function(){A.add(this),this.I.push(this.B.clearRect.bind(this.B,0,0,this.Ua.width,this.Ua.height))},flush:function(){},translate:function(e,t){this.transform(1,0,0,1,e,t)}});r.makeRenderer=function(e){const t=new k(e),n=t.B;return new Proxy(t,{get(e,r){if("function"==typeof e[r])return function(...t){return e[r].apply(e,t)};if("function"==typeof n[r]){if(-1<d.indexOf(r))throw Error("RiveException: Method call to '"+r+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...e){t.I.push(n[r].bind(n,...e))}}return e[r]},set(e,r,i){if(r in n)return t.I.push(()=>{n[r]=i}),!0}})},r.decodeImage=function(e,t){new y({la:t}).decode(e)},r.renderFactory={makeRenderPaint:function(){return new _},makeRenderPath:function(){return new w},makeRenderImage:function(){let e=P;return new y({wa:()=>{e.total++},la:()=>{if(e.loaded++,e.loaded===e.total){const t=e.ready;t&&(t(),e.ready=null)}}})}};let I=r.load,P=null;r.load=function(e,t,n=!0){const i=new r.FallbackFileAssetLoader;return void 0!==t&&i.addLoader(t),n&&(t=new r.CDNFileAssetLoader,i.addLoader(t)),new Promise(function(t){let n=null;P={total:0,loaded:0,ready:function(){t(n)}},n=I(e,i),0==P.total&&t(n)})};let R=r.RendererWrapper.prototype.align;r.RendererWrapper.prototype.align=function(e,t,n,r,i=1){R.call(this,e,t,n,r,i)},i=new u,r.requestAnimationFrame=i.requestAnimationFrame.bind(i),r.cancelAnimationFrame=i.cancelAnimationFrame.bind(i),r.enableFPSCounter=i.Ob.bind(i),r.disableFPSCounter=i.Lb,i.ob=n,r.resolveAnimationFrame=n,r.cleanup=function(){C&&C.delete()}};var p,m,v=Object.assign({},r),g="./this.program",b="";(o||s)&&(s?b=self.location.href:"undefined"!=typeof document&&document.currentScript&&(b=document.currentScript.src),i&&(b=i),b=b.startsWith("blob:")?"":b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(m=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=(e,t,n)=>{if($(e)){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)}else fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))).then(t,n)});var y,w=r.print||console.log.bind(console),_=r.printErr||console.error.bind(console);Object.assign(r,v),v=null,r.thisProgram&&(g=r.thisProgram),r.wasmBinary&&(y=r.wasmBinary);var A,C,E,M,x,k,I,P,R,S=!1;function L(){var e=A.buffer;r.HEAP8=C=new Int8Array(e),r.HEAP16=M=new Int16Array(e),r.HEAPU8=E=new Uint8Array(e),r.HEAPU16=x=new Uint16Array(e),r.HEAP32=k=new Int32Array(e),r.HEAPU32=I=new Uint32Array(e),r.HEAPF32=P=new Float32Array(e),r.HEAPF64=R=new Float64Array(e)}var T=[],F=[],O=[];function j(){var e=r.preRun.shift();T.unshift(e)}var D=0,W=null,B=null;function V(e){throw r.onAbort?.(e),_(e="Aborted("+e+")"),S=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),n(e),e}var U,N=e=>e.startsWith("data:application/octet-stream;base64,"),$=e=>e.startsWith("file://");function z(e){if(e==U&&y)return new Uint8Array(y);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}function Y(e,t,n){return function(e){return y?Promise.resolve().then(()=>z(e)):new Promise((t,n)=>{p(e,e=>t(new Uint8Array(e)),()=>{try{t(z(e))}catch(r){n(r)}})})}(e).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{_(`failed to asynchronously prepare wasm: ${e}`),V(e)})}var H,X,G={490818:(e,t,n,r,i)=>{if("undefined"==typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if(void 0===window.h){window.h={za:0},window.h.J={},window.h.J.xa=e,window.h.J.capture=t,window.h.J.Ka=n,window.h.ga={},window.h.ga.stopped=r,window.h.ga.wb=i;let a=window.h;a.D=[],a.sc=function(e){for(var t=0;t<a.D.length;++t)if(null==a.D[t])return a.D[t]=e,t;return a.D.push(e),a.D.length-1},a.Ab=function(e){for(a.D[e]=null;0<a.D.length&&null==a.D[a.D.length-1];)a.D.pop()},a.Pc=function(e){for(var t=0;t<a.D.length;++t)if(a.D[t]==e)return a.Ab(t)},a.qa=function(e){return a.D[e]},a.Sa=["touchend","click"],a.unlock=function(){for(var e=0;e<a.D.length;++e){var t=a.D[e];null!=t&&null!=t.L&&t.state===a.ga.wb&&t.L.resume().then(()=>{Tn(t.pb)},e=>{console.error("Failed to resume audiocontext",e)})}a.Sa.map(function(e){document.removeEventListener(e,a.unlock,!0)})},a.Sa.map(function(e){document.addEventListener(e,a.unlock,!0)})}return window.h.za+=1,1},492996:()=>{void 0!==window.h&&(window.h.Sa.map(function(e){document.removeEventListener(e,window.h.unlock,!0)}),--window.h.za,0===window.h.za&&delete window.h)},493300:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,493404:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(n){return 0}},493575:(e,t,n,r,i,a)=>{if(void 0===window.h)return-1;var o={},s={};return e==window.h.J.xa&&0!=n&&(s.sampleRate=n),o.L=new(window.AudioContext||window.webkitAudioContext)(s),o.L.suspend(),o.state=window.h.ga.stopped,n=0,e!=window.h.J.xa&&(n=t),o.Z=o.L.createScriptProcessor(r,n,t),o.Z.onaudioprocess=function(n){if(null!=o.ra&&0!=o.ra.length||(o.ra=new Float32Array(P.buffer,i,r*t)),e==window.h.J.capture||e==window.h.J.Ka){for(var s=0;s<t;s+=1)for(var u=n.inputBuffer.getChannelData(s),l=o.ra,c=0;c<r;c+=1)l[c*t+s]=u[c];On(a,r,i)}if(e==window.h.J.xa||e==window.h.J.Ka)for(jn(a,r,i),s=0;s<n.outputBuffer.numberOfChannels;++s)for(u=n.outputBuffer.getChannelData(s),l=o.ra,c=0;c<r;c+=1)u[c]=l[c*t+s];else for(s=0;s<n.outputBuffer.numberOfChannels;++s)n.outputBuffer.getChannelData(s).fill(0)},e!=window.h.J.capture&&e!=window.h.J.Ka||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(e){o.Ca=o.L.createMediaStreamSource(e),o.Ca.connect(o.Z),o.Z.connect(o.L.destination)}).catch(function(e){console.log("Failed to get user media: "+e)}),e==window.h.J.xa&&o.Z.connect(o.L.destination),o.pb=a,window.h.sc(o)},496452:e=>window.h.qa(e).L.sampleRate,496525:e=>{void 0!==(e=window.h.qa(e)).Z&&(e.Z.onaudioprocess=function(){},e.Z.disconnect(),e.Z=void 0),void 0!==e.Ca&&(e.Ca.disconnect(),e.Ca=void 0),e.L.close(),e.L=void 0,e.pb=void 0},496925:e=>{window.h.Ab(e)},496975:e=>{(e=window.h.qa(e)).L.resume(),e.state=window.h.ga.wb},497114:e=>{(e=window.h.qa(e)).L.suspend(),e.state=window.h.ga.stopped}},q=e=>{for(;0<e.length;)e.shift()(r)};function K(){var e=k[+tt>>2];return tt+=4,e}var J=(e,t)=>{for(var n=0,r=e.length-1;0<=r;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},Q=e=>{var t="/"===e.charAt(0),n="/"===e.substr(-1);return(e=J(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},Z=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.substr(0,t.length-1),e+t):"."},ee=e=>{if("/"===e)return"/";var t=(e=(e=Q(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},te=e=>(te=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);V("initRandomDevice")})())(e),ne=(...e)=>{for(var t="",n=!1,r=e.length-1;-1<=r&&!n;r--){if("string"!=typeof(n=0<=r?e[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,n="/"===n.charAt(0)}return(n?"/":"")+(t=J(t.split("/").filter(e=>!!e),!n).join("/"))||"."},re="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,ie=(e,t,n)=>{var r=t+n;for(n=t;e[n]&&!(n>=r);)++n;if(16<n-t&&e.buffer&&re)return re.decode(e.subarray(t,n));for(r="";t<n;){var i=e[t++];if(128&i){var a=63&e[t++];if(192==(224&i))r+=String.fromCharCode((31&i)<<6|a);else{var o=63&e[t++];65536>(i=224==(240&i)?(15&i)<<12|a<<6|o:(7&i)<<18|a<<12|o<<6|63&e[t++])?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else r+=String.fromCharCode(i)}return r},ae=[],oe=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);127>=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t},se=(e,t,n,r)=>{if(!(0<r))return 0;var i=n;r=n+r-1;for(var a=0;a<e.length;++a){var o=e.charCodeAt(a);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),127>=o){if(n>=r)break;t[n++]=o}else{if(2047>=o){if(n+1>=r)break;t[n++]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;t[n++]=224|o>>12}else{if(n+3>=r)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63}t[n++]=128|o>>6&63}t[n++]=128|63&o}}return t[n]=0,n-i};function ue(e,t){var n=Array(oe(e)+1);return e=se(e,n,0,n.length),t&&(n.length=e),n}var le=[];function ce(e,t){le[e]={input:[],H:[],W:t},We(e,de)}var de={open(e){var t=le[e.node.ya];if(!t)throw new Ae(43);e.s=t,e.seekable=!1},close(e){e.s.W.pa(e.s)},pa(e){e.s.W.pa(e.s)},read(e,t,n,r){if(!e.s||!e.s.W.ib)throw new Ae(60);for(var i=0,a=0;a<r;a++){try{var o=e.s.W.ib(e.s)}catch(s){throw new Ae(29)}if(void 0===o&&0===i)throw new Ae(6);if(null==o)break;i++,t[n+a]=o}return i&&(e.node.timestamp=Date.now()),i},write(e,t,n,r){if(!e.s||!e.s.W.Na)throw new Ae(60);try{for(var i=0;i<r;i++)e.s.W.Na(e.s,t[n+i])}catch(a){throw new Ae(29)}return r&&(e.node.timestamp=Date.now()),i}},he={ib(){e:{if(!ae.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n"),!e){e=null;break e}ae=ue(e,!0)}e=ae.shift()}return e},Na(e,t){null===t||10===t?(w(ie(e.H,0)),e.H=[]):0!=t&&e.H.push(t)},pa(e){e.H&&0<e.H.length&&(w(ie(e.H,0)),e.H=[])},Yb:()=>({Ac:25856,Cc:5,zc:191,Bc:35387,yc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),Zb:()=>0,$b:()=>[24,80]},fe={Na(e,t){null===t||10===t?(_(ie(e.H,0)),e.H=[]):0!=t&&e.H.push(t)},pa(e){e.H&&0<e.H.length&&(_(ie(e.H,0)),e.H=[])}};function pe(e,t){var n=e.l?e.l.length:0;n>=t||(t=Math.max(t,n*(1048576>n?2:1.125)>>>0),0!=n&&(t=Math.max(t,256)),n=e.l,e.l=new Uint8Array(t),0<e.v&&e.l.set(n.subarray(0,e.v),0))}var me={O:null,V:()=>me.createNode(null,"/",16895,0),createNode(e,t,n,r){if(24576==(61440&n)||4096==(61440&n))throw new Ae(63);return me.O||(me.O={dir:{node:{Y:me.j.Y,R:me.j.R,ka:me.j.ka,ua:me.j.ua,tb:me.j.tb,zb:me.j.zb,ub:me.j.ub,sb:me.j.sb,Da:me.j.Da},stream:{ba:me.m.ba}},file:{node:{Y:me.j.Y,R:me.j.R},stream:{ba:me.m.ba,read:me.m.read,write:me.m.write,Ya:me.m.Ya,lb:me.m.lb,nb:me.m.nb}},link:{node:{Y:me.j.Y,R:me.j.R,ma:me.j.ma},stream:{}},ab:{node:{Y:me.j.Y,R:me.j.R},stream:De}}),16384==(61440&(n=Re(e,t,n,r)).mode)?(n.j=me.O.dir.node,n.m=me.O.dir.stream,n.l={}):32768==(61440&n.mode)?(n.j=me.O.file.node,n.m=me.O.file.stream,n.v=0,n.l=null):40960==(61440&n.mode)?(n.j=me.O.link.node,n.m=me.O.link.stream):8192==(61440&n.mode)&&(n.j=me.O.ab.node,n.m=me.O.ab.stream),n.timestamp=Date.now(),e&&(e.l[t]=n,e.timestamp=n.timestamp),n},Gc:e=>e.l?e.l.subarray?e.l.subarray(0,e.v):new Uint8Array(e.l):new Uint8Array(0),j:{Y(e){var t={};return t.Ec=8192==(61440&e.mode)?e.id:1,t.Ic=e.id,t.mode=e.mode,t.Lc=1,t.uid=0,t.Hc=0,t.ya=e.ya,16384==(61440&e.mode)?t.size=4096:32768==(61440&e.mode)?t.size=e.v:40960==(61440&e.mode)?t.size=e.link.length:t.size=0,t.wc=new Date(e.timestamp),t.Kc=new Date(e.timestamp),t.Dc=new Date(e.timestamp),t.Hb=4096,t.xc=Math.ceil(t.size/t.Hb),t},R(e,t){if(void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&(t=t.size,e.v!=t))if(0==t)e.l=null,e.v=0;else{var n=e.l;e.l=new Uint8Array(t),n&&e.l.set(n.subarray(0,Math.min(t,e.v))),e.v=t}},ka(){throw Ce[44]},ua:(e,t,n,r)=>me.createNode(e,t,n,r),tb(e,t,n){if(16384==(61440&e.mode)){try{var r=Pe(t,n)}catch(a){}if(r)for(var i in r.l)throw new Ae(55)}delete e.parent.l[e.name],e.parent.timestamp=Date.now(),e.name=n,t.l[n]=e,t.timestamp=e.parent.timestamp},zb(e,t){delete e.l[t],e.timestamp=Date.now()},ub(e,t){var n,r=Pe(e,t);for(n in r.l)throw new Ae(55);delete e.l[t],e.timestamp=Date.now()},sb(e){var t,n=[".",".."];for(t of Object.keys(e.l))n.push(t);return n},Da:(e,t,n)=>((e=me.createNode(e,t,41471,0)).link=n,e),ma(e){if(40960!=(61440&e.mode))throw new Ae(28);return e.link}},m:{read(e,t,n,r,i){var a=e.node.l;if(i>=e.node.v)return 0;if(8<(e=Math.min(e.node.v-i,r))&&a.subarray)t.set(a.subarray(i,i+e),n);else for(r=0;r<e;r++)t[n+r]=a[i+r];return e},write(e,t,n,r,i,a){if(t.buffer===C.buffer&&(a=!1),!r)return 0;if((e=e.node).timestamp=Date.now(),t.subarray&&(!e.l||e.l.subarray)){if(a)return e.l=t.subarray(n,n+r),e.v=r;if(0===e.v&&0===i)return e.l=t.slice(n,n+r),e.v=r;if(i+r<=e.v)return e.l.set(t.subarray(n,n+r),i),r}if(pe(e,i+r),e.l.subarray&&t.subarray)e.l.set(t.subarray(n,n+r),i);else for(a=0;a<r;a++)e.l[i+a]=t[n+a];return e.v=Math.max(e.v,i+r),r},ba(e,t,n){if(1===n?t+=e.position:2===n&&32768==(61440&e.node.mode)&&(t+=e.node.v),0>t)throw new Ae(28);return t},Ya(e,t,n){pe(e.node,t+n),e.node.v=Math.max(e.node.v,t+n)},lb(e,t,n,r,i){if(32768!=(61440&e.node.mode))throw new Ae(43);if(e=e.node.l,2&i||e.buffer!==C.buffer){if((0<n||n+t<e.length)&&(e=e.subarray?e.subarray(n,n+t):Array.prototype.slice.call(e,n,n+t)),n=!0,V(),!(t=void 0))throw new Ae(48);C.set(e,t)}else n=!1,t=e.byteOffset;return{o:t,vc:n}},nb:(e,t,n,r)=>(me.m.write(e,t,0,r,n,!1),0)}},ve=null,ge={},be=[],ye=1,we=null,_e=!0,Ae=class{constructor(e){this.name="ErrnoError",this.aa=e}},Ce={},Ee=class{constructor(){this.h={},this.node=null}get flags(){return this.h.flags}set flags(e){this.h.flags=e}get position(){return this.h.position}set position(e){this.h.position=e}},Me=class{constructor(e,t,n,r){e||=this,this.parent=e,this.V=e.V,this.va=null,this.id=ye++,this.name=t,this.mode=n,this.j={},this.m={},this.ya=r}get read(){return!(365&~this.mode)}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(e){e?this.mode|=146:this.mode&=-147}};function xe(e,t={}){if(!(e=ne(e)))return{path:"",node:null};if(8<(t=Object.assign({hb:!0,Pa:0},t)).Pa)throw new Ae(32);e=e.split("/").filter(e=>!!e);for(var n=ve,r="/",i=0;i<e.length;i++){var a=i===e.length-1;if(a&&t.parent)break;if(n=Pe(n,e[i]),r=Q(r+"/"+e[i]),n.va&&(!a||a&&t.hb)&&(n=n.va.root),!a||t.gb)for(a=0;40960==(61440&n.mode);)if(n=ze(r),n=xe(r=ne(Z(r),n),{Pa:t.Pa+1}).node,40<a++)throw new Ae(32)}return{path:r,node:n}}function ke(e){for(var t;;){if(e===e.parent)return e=e.V.mb,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function Ie(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%we.length}function Pe(e,t){var n=16384==(61440&e.mode)?(n=Le(e,"x"))?n:e.j.ka?0:2:54;if(n)throw new Ae(n);for(n=we[Ie(e.id,t)];n;n=n.fc){var r=n.name;if(n.parent.id===e.id&&r===t)return n}return e.j.ka(e,t)}function Re(e,t,n,r){return t=Ie((e=new Me(e,t,n,r)).parent.id,e.name),e.fc=we[t],we[t]=e}function Se(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function Le(e,t){return _e?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function Te(e,t){try{return Pe(e,t),20}catch(n){}return Le(e,"wx")}function Fe(e){if(!(e=be[e]))throw new Ae(8);return e}function Oe(e,t=-1){if(e=Object.assign(new Ee,e),-1==t)e:{for(t=0;4096>=t;t++)if(!be[t])break e;throw new Ae(33)}return e.X=t,be[t]=e}var je,De={open(e){e.m=ge[e.node.ya].m,e.m.open?.(e)},ba(){throw new Ae(70)}};function We(e,t){ge[e]={m:t}}function Be(e,t){var n="/"===t;if(n&&ve)throw new Ae(10);if(!n&&t){var r=xe(t,{hb:!1});if(t=r.path,(r=r.node).va)throw new Ae(10);if(16384!=(61440&r.mode))throw new Ae(54)}t={type:e,Nc:{},mb:t,ec:[]},(e=e.V(t)).V=t,t.root=e,n?ve=e:r&&(r.va=t,r.V&&r.V.ec.push(t))}function Ve(e,t,n){var r=xe(e,{parent:!0}).node;if(!(e=ee(e))||"."===e||".."===e)throw new Ae(28);var i=Te(r,e);if(i)throw new Ae(i);if(!r.j.ua)throw new Ae(63);return r.j.ua(r,e,t,n)}function Ue(e){return Ve(e,16895,0)}function Ne(e,t,n){void 0===n&&(n=t,t=438),Ve(e,8192|t,n)}function $e(e,t){if(!ne(e))throw new Ae(44);var n=xe(t,{parent:!0}).node;if(!n)throw new Ae(44);var r=Te(n,t=ee(t));if(r)throw new Ae(r);if(!n.j.Da)throw new Ae(63);n.j.Da(n,t,e)}function ze(e){if(!(e=xe(e).node))throw new Ae(44);if(!e.j.ma)throw new Ae(28);return ne(ke(e.parent),e.j.ma(e))}function Ye(e,t,n){if(""===e)throw new Ae(44);if("string"==typeof t){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===i)throw Error(`Unknown file open mode: ${t}`);t=i}if(n=64&t?4095&(void 0===n?438:n)|32768:0,"object"==typeof e)var a=e;else{e=Q(e);try{a=xe(e,{gb:!(131072&t)}).node}catch(o){}}if(i=!1,64&t)if(a){if(128&t)throw new Ae(20)}else a=Ve(e,n,0),i=!0;if(!a)throw new Ae(44);if(8192==(61440&a.mode)&&(t&=-513),65536&t&&16384!=(61440&a.mode))throw new Ae(54);if(!i&&(n=a?40960==(61440&a.mode)?32:16384==(61440&a.mode)&&("r"!==Se(t)||512&t)?31:Le(a,Se(t)):44))throw new Ae(n);if(512&t&&!i){if(!(n="string"==typeof(n=a)?xe(n,{gb:!0}).node:n).j.R)throw new Ae(63);if(16384==(61440&n.mode))throw new Ae(31);if(32768!=(61440&n.mode))throw new Ae(28);if(i=Le(n,"w"))throw new Ae(i);n.j.R(n,{size:0,timestamp:Date.now()})}return t&=-131713,(a=Oe({node:a,path:ke(a),flags:t,seekable:!0,position:0,m:a.m,tc:[],error:!1})).m.open&&a.m.open(a),!r.logReadFiles||1&t||(qe||={},e in qe||(qe[e]=1)),a}function He(e,t,n){if(null===e.X)throw new Ae(8);if(!e.seekable||!e.m.ba)throw new Ae(70);if(0!=n&&1!=n&&2!=n)throw new Ae(28);e.position=e.m.ba(e,t,n),e.tc=[]}function Xe(e,t,n){e=Q("/dev/"+e);var r=((e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n})(!!t,!!n);Ge||=64;var i=Ge++<<8;We(i,{open(e){e.seekable=!1},close(){n?.buffer?.length&&n(10)},read(e,n,r,i){for(var a=0,o=0;o<i;o++){try{var s=t()}catch(u){throw new Ae(29)}if(void 0===s&&0===a)throw new Ae(6);if(null==s)break;a++,n[r+o]=s}return a&&(e.node.timestamp=Date.now()),a},write(e,t,r,i){for(var a=0;a<i;a++)try{n(t[r+a])}catch(o){throw new Ae(29)}return i&&(e.node.timestamp=Date.now()),a}}),Ne(e,r,i)}var Ge,qe,Ke,Je,Qe,Ze,et,tt=void 0,nt=(e,t)=>Object.defineProperty(t,"name",{value:e}),rt=[],it=[],at=e=>{if(!e)throw new Ke("Cannot use deleted val. handle = "+e);return it[e]},ot=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const t=rt.pop()||it.length;return it[t]=e,it[t+1]=1,t}},st=e=>{var t=Error,n=nt(e,function(t){this.name=e,this.message=t,void 0!==(t=Error(t).stack)&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},n},ut=e=>{for(var t="";E[e];)t+=Qe[E[e++]];return t},lt=[],ct=()=>{for(;lt.length;){var e=lt.pop();e.g.fa=!1,e.delete()}},dt={},ht=(e,t)=>{if(void 0===t)throw new Ke("ptr should not be undefined");for(;e.C;)t=e.na(t),e=e.C;return t},ft={},pt=e=>{e=Ln(e);var t=ut(e);return Rn(e),t},mt=(e,t)=>{var n=ft[e];if(void 0===n)throw e=`${t} has unknown type ${pt(e)}`,new Ke(e);return n},vt=()=>{},gt=!1,bt=(e,t,n)=>t===n?e:void 0===n.C||null===(e=bt(e,t,n.C))?null:n.Mb(e),yt={},wt=(e,t)=>{if(!t.u||!t.o)throw new et("makeClassHandle requires ptr and ptrType");if(!!t.K!=!!t.F)throw new et("Both smartPtrType and smartPtr must be specified");return t.count={value:1},_t(Object.create(e,{g:{value:t,writable:!0}}))},_t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(gt=new FinalizationRegistry(e=>{--(e=e.g).count.value,0===e.count.value&&(e.F?e.K.P(e.F):e.u.i.P(e.o))}),vt=e=>{gt.unregister(e)},(_t=e=>{var t=e.g;return t.F&&gt.register(e,{g:t},e),e})(e)),At={},Ct=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Et(e){return this.fromWireType(I[e>>2])}var Mt={},xt={},kt=(e,t,n)=>{function r(t){if((t=n(t)).length!==e.length)throw new et("Mismatched type converter count");for(var r=0;r<e.length;++r)It(e[r],t[r])}e.forEach(function(e){xt[e]=t});var i=Array(t.length),a=[],o=0;t.forEach((e,t)=>{ft.hasOwnProperty(e)?i[t]=ft[e]:(a.push(e),Mt.hasOwnProperty(e)||(Mt[e]=[]),Mt[e].push(()=>{i[t]=ft[e],++o===a.length&&r(i)}))}),0===a.length&&r(i)};function It(e,t,n={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,n={}){var r=t.name;if(!e)throw new Ke(`type "${r}" must have a positive integer typeid pointer`);if(ft.hasOwnProperty(e)){if(n.Wb)return;throw new Ke(`Cannot register type '${r}' twice`)}ft[e]=t,delete xt[e],Mt.hasOwnProperty(e)&&(t=Mt[e],delete Mt[e],t.forEach(e=>e()))}(e,t,n)}var Pt=e=>{throw new Ke(e.g.u.i.name+" instance already deleted")};function Rt(){}var St=(e,t,n)=>{if(void 0===e[t].A){var r=e[t];e[t]=function(...r){if(!e[t].A.hasOwnProperty(r.length))throw new Ke(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].A})!`);return e[t].A[r.length].apply(this,r)},e[t].A=[],e[t].A[r.ea]=r}},Lt=(e,t,n)=>{if(r.hasOwnProperty(e)){if(void 0===n||void 0!==r[e].A&&void 0!==r[e].A[n])throw new Ke(`Cannot register public name '${e}' twice`);if(St(r,e,e),r.hasOwnProperty(n))throw new Ke(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`);r[e].A[n]=t}else r[e]=t,void 0!==n&&(r[e].Mc=n)};function Tt(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.N=n,this.P=r,this.C=i,this.Rb=a,this.na=o,this.Mb=s,this.qb=[]}var Ft=(e,t,n)=>{for(;t!==n;){if(!t.na)throw new Ke(`Expected null or instance of ${n.name}, got an instance of ${t.name}`);e=t.na(e),t=t.C}return e};function Ot(e,t){if(null===t){if(this.Ma)throw new Ke(`null is not a valid ${this.name}`);return 0}if(!t.g)throw new Ke(`Cannot pass "${tn(t)}" as a ${this.name}`);if(!t.g.o)throw new Ke(`Cannot pass deleted object as a pointer of type ${this.name}`);return Ft(t.g.o,t.g.u.i,this.i)}function jt(e,t){if(null===t){if(this.Ma)throw new Ke(`null is not a valid ${this.name}`);if(this.ta){var n=this.Oa();return null!==e&&e.push(this.P,n),n}return 0}if(!t||!t.g)throw new Ke(`Cannot pass "${tn(t)}" as a ${this.name}`);if(!t.g.o)throw new Ke(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.sa&&t.g.u.sa)throw new Ke(`Cannot convert argument of type ${t.g.K?t.g.K.name:t.g.u.name} to parameter type ${this.name}`);if(n=Ft(t.g.o,t.g.u.i,this.i),this.ta){if(void 0===t.g.F)throw new Ke("Passing raw pointer to smart pointer is illegal");switch(this.nc){case 0:if(t.g.K!==this)throw new Ke(`Cannot convert argument of type ${t.g.K?t.g.K.name:t.g.u.name} to parameter type ${this.name}`);n=t.g.F;break;case 1:n=t.g.F;break;case 2:if(t.g.K===this)n=t.g.F;else{var r=t.clone();n=this.jc(n,ot(()=>r.delete())),null!==e&&e.push(this.P,n)}break;default:throw new Ke("Unsupporting sharing policy")}}return n}function Dt(e,t){if(null===t){if(this.Ma)throw new Ke(`null is not a valid ${this.name}`);return 0}if(!t.g)throw new Ke(`Cannot pass "${tn(t)}" as a ${this.name}`);if(!t.g.o)throw new Ke(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.g.u.sa)throw new Ke(`Cannot convert argument of type ${t.g.u.name} to parameter type ${this.name}`);return Ft(t.g.o,t.g.u.i,this.i)}function Wt(e,t,n,r,i,a,o,s,u,l,c){this.name=e,this.i=t,this.Ma=n,this.sa=r,this.ta=i,this.ic=a,this.nc=o,this.rb=s,this.Oa=u,this.jc=l,this.P=c,i||void 0!==t.C?this.toWireType=jt:(this.toWireType=r?Ot:Dt,this.M=null)}var Bt,Vt,Ut=(e,t,n)=>{if(!r.hasOwnProperty(e))throw new et("Replacing nonexistent public symbol");void 0!==r[e].A&&void 0!==n?r[e].A[n]=t:(r[e]=t,r[e].ea=n)},Nt=[],$t=e=>{var t=Nt[e];return t||(e>=Nt.length&&(Nt.length=e+1),Nt[e]=t=Bt.get(e)),t},zt=(e,t)=>(...n)=>((e,t,n=[])=>(e.includes("j")?(e=e.replace(/p/g,"i"),t=(0,r["dynCall_"+e])(t,...n)):t=$t(t)(...n),t))(e,t,n),Yt=(e,t)=>{var n=(e=ut(e)).includes("j")?zt(e,t):$t(t);if("function"!=typeof n)throw new Ke(`unknown function pointer with signature ${e}: ${t}`);return n},Ht=(e,t)=>{var n=[],r={};throw t.forEach(function e(t){r[t]||ft[t]||(xt[t]?xt[t].forEach(e):(n.push(t),r[t]=!0))}),new Vt(`${e}: `+n.map(pt).join([", "]))};function Xt(e,t,n,r,i){var a=t.length;if(2>a)throw new Ke("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=null!==t[1]&&null!==n,s=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].M)return!0;return!1}(t),u="void"!==t[0].name,l=a-2,c=Array(l),d=[],h=[];return nt(e,function(...n){if(n.length!==l)throw new Ke(`function ${e} called with ${n.length} arguments, expected ${l}`);if(h.length=0,d.length=o?2:1,d[0]=i,o){var a=t[1].toWireType(h,this);d[1]=a}for(var f=0;f<l;++f)c[f]=t[f+2].toWireType(h,n[f]),d.push(c[f]);if(n=r(...d),s)Ct(h);else for(f=o?1:2;f<t.length;f++){var p=1===f?a:c[f-2];null!==t[f].M&&t[f].M(p)}return a=u?t[0].fromWireType(n):void 0})}var Gt,qt=(e,t)=>{for(var n=[],r=0;r<e;r++)n.push(I[t+4*r>>2]);return n},Kt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,n)=>{if(!(e instanceof Object))throw new Ke(`${n} with invalid "this": ${e}`);if(!(e instanceof t.i.constructor))throw new Ke(`${n} incompatible with "this" of type ${e.constructor.name}`);if(!e.g.o)throw new Ke(`cannot call emscripten binding method ${n} on deleted object`);return Ft(e.g.o,e.g.u.i,t.i)},Qt=e=>{9<e&&0===--it[e+1]&&(it[e]=void 0,rt.push(e))},Zt={name:"emscripten::val",fromWireType:e=>{var t=at(e);return Qt(e),t},toWireType:(e,t)=>ot(t),argPackAdvance:8,readValueFromPointer:Et,M:null},en=(e,t,n)=>{switch(t){case 1:return n?function(e){return this.fromWireType(C[e])}:function(e){return this.fromWireType(E[e])};case 2:return n?function(e){return this.fromWireType(M[e>>1])}:function(e){return this.fromWireType(x[e>>1])};case 4:return n?function(e){return this.fromWireType(k[e>>2])}:function(e){return this.fromWireType(I[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},tn=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},nn=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(P[e>>2])};case 8:return function(e){return this.fromWireType(R[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},rn=(e,t,n)=>{switch(t){case 1:return n?e=>C[e]:e=>E[e];case 2:return n?e=>M[e>>1]:e=>x[e>>1];case 4:return n?e=>k[e>>2]:e=>I[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},an="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,on=(e,t)=>{for(var n=e>>1,r=n+t/2;!(n>=r)&&x[n];)++n;if(32<(n<<=1)-e&&an)return an.decode(E.subarray(e,n));for(n="",r=0;!(r>=t/2);++r){var i=M[e+2*r>>1];if(0==i)break;n+=String.fromCharCode(i)}return n},sn=(e,t,n)=>{if(n??=2147483647,2>n)return 0;var r=t;n=(n-=2)<2*e.length?n/2:e.length;for(var i=0;i<n;++i)M[t>>1]=e.charCodeAt(i),t+=2;return M[t>>1]=0,t-r},un=e=>2*e.length,ln=(e,t)=>{for(var n=0,r="";!(n>=t/4);){var i=k[e+4*n>>2];if(0==i)break;++n,65536<=i?(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)):r+=String.fromCharCode(i)}return r},cn=(e,t,n)=>{if(n??=2147483647,4>n)return 0;var r=t;n=r+n-4;for(var i=0;i<e.length;++i){var a=e.charCodeAt(i);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),k[t>>2]=a,(t+=4)+4>n)break}return k[t>>2]=0,t-r},dn=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);55296<=r&&57343>=r&&++n,t+=4}return t},hn=(e,t,n)=>{var r=[];return e=e.toWireType(r,n),r.length&&(I[t>>2]=ot(r)),e},fn={},pn=e=>{var t=fn[e];return void 0===t?ut(e):t},mn=[],vn=Reflect.construct,gn=e=>0==e%4&&(0!=e%100||0==e%400),bn=[0,31,60,91,121,152,182,213,244,274,305,335],yn=[0,31,59,90,120,151,181,212,243,273,304,334],wn=[],_n={},An=()=>{if(!Gt){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"};for(e in _n)void 0===_n[e]?delete t[e]:t[e]=_n[e];var n=[];for(e in t)n.push(`${e}=${t[e]}`);Gt=n}return Gt},Cn=[31,29,31,30,31,30,31,31,30,31,30,31],En=[31,28,31,30,31,30,31,31,30,31,30,31],Mn=(e,t,n,r)=>{function i(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length<t;)e=n[0]+e;return e}function a(e,t){return i(e,t,"0")}function o(e,t){function n(e){return 0>e?-1:0<e?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function s(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function u(e){var t=e.ca;for(e=new Date(new Date(e.da+1900,0,1).getTime());0<t;){var n=e.getMonth(),r=(gn(e.getFullYear())?Cn:En)[n];if(!(t>r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),11>n?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return n=new Date(e.getFullYear()+1,0,4),t=s(new Date(e.getFullYear(),0,4)),n=s(n),0>=o(t,e)?0>=o(n,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var l=I[r+40>>2];for(var c in r={qc:k[r>>2],pc:k[r+4>>2],Ea:k[r+8>>2],Ra:k[r+12>>2],Fa:k[r+16>>2],da:k[r+20>>2],S:k[r+24>>2],ca:k[r+28>>2],Oc:k[r+32>>2],oc:k[r+36>>2],rc:l&&l?ie(E,l):""},n=n?ie(E,n):"",l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(c,"g"),l[c]);var d="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),h="January February March April May June July August September October November December".split(" ");for(c in l={"%a":e=>d[e.S].substring(0,3),"%A":e=>d[e.S],"%b":e=>h[e.Fa].substring(0,3),"%B":e=>h[e.Fa],"%C":e=>a((e.da+1900)/100|0,2),"%d":e=>a(e.Ra,2),"%e":e=>i(e.Ra,2," "),"%g":e=>u(e).toString().substring(2),"%G":u,"%H":e=>a(e.Ea,2),"%I":e=>(0==(e=e.Ea)?e=12:12<e&&(e-=12),a(e,2)),"%j":e=>{for(var t=0,n=0;n<=e.Fa-1;t+=(gn(e.da+1900)?Cn:En)[n++]);return a(e.Ra+t,3)},"%m":e=>a(e.Fa+1,2),"%M":e=>a(e.pc,2),"%n":()=>"\n","%p":e=>0<=e.Ea&&12>e.Ea?"AM":"PM","%S":e=>a(e.qc,2),"%t":()=>"\t","%u":e=>e.S||7,"%U":e=>a(Math.floor((e.ca+7-e.S)/7),2),"%V":e=>{var t=Math.floor((e.ca+7-(e.S+6)%7)/7);if(2>=(e.S+371-e.ca-2)%7&&t++,t)53==t&&(4==(n=(e.S+371-e.ca)%7)||3==n&&gn(e.da)||(t=1));else{t=52;var n=(e.S+7-e.ca-1)%7;(4==n||5==n&&gn(e.da%400-1))&&t++}return a(t,2)},"%w":e=>e.S,"%W":e=>a(Math.floor((e.ca+7-(e.S+6)%7)/7),2),"%y":e=>(e.da+1900).toString().substring(2),"%Y":e=>e.da+1900,"%z":e=>{var t=0<=(e=e.oc);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":e=>e.rc,"%%":()=>"%"},n=n.replace(/%%/g,"\0\0"),l)n.includes(c)&&(n=n.replace(new RegExp(c,"g"),l[c](r)));return(c=ue(n=n.replace(/\0\0/g,"%"),!1)).length>t?0:(C.set(c,e),c.length-1)};[44].forEach(e=>{Ce[e]=new Ae(e),Ce[e].stack="<generic error, no stack>"}),we=Array(4096),Be(me,"/"),Ue("/tmp"),Ue("/home"),Ue("/home/web_user"),function(){Ue("/dev"),We(259,{read:()=>0,write:(e,t,n,r)=>r}),Ne("/dev/null",259),ce(1280,he),ce(1536,fe),Ne("/dev/tty",1280),Ne("/dev/tty1",1536);var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=te(e).byteLength),e[--t]);Xe("random",n),Xe("urandom",n),Ue("/dev/shm"),Ue("/dev/shm/tmp")}(),function(){Ue("/proc");var e=Ue("/proc/self");Ue("/proc/self/fd"),Be({V(){var t=Re(e,"fd",16895,73);return t.j={ka(e,t){var n=Fe(+t);return(e={parent:null,V:{mb:"fake"},j:{ma:()=>n.path}}).parent=e}},t}},"/proc/self/fd")}(),Ke=r.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},it.push(0,1,void 0,1,null,1,!0,1,!1,1),r.count_emval_handles=()=>it.length/2-5-rt.length,Je=r.PureVirtualError=st("PureVirtualError");for(var xn=Array(256),kn=0;256>kn;++kn)xn[kn]=String.fromCharCode(kn);Qe=xn,r.getInheritedInstanceCount=()=>Object.keys(dt).length,r.getLiveInheritedInstances=()=>{var e,t=[];for(e in dt)dt.hasOwnProperty(e)&&t.push(dt[e]);return t},r.flushPendingDeletes=ct,r.setDelayFunction=e=>{Ze=e,lt.length&&Ze&&Ze(ct)},et=r.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Object.assign(Rt.prototype,{isAliasOf:function(e){if(!(this instanceof Rt&&e instanceof Rt))return!1;var t=this.g.u.i,n=this.g.o;e.g=e.g;var r=e.g.u.i;for(e=e.g.o;t.C;)n=t.na(n),t=t.C;for(;r.C;)e=r.na(e),r=r.C;return t===r&&n===e},clone:function(){if(this.g.o||Pt(this),this.g.ia)return this.g.count.value+=1,this;var e=_t,t=Object,n=t.create,r=Object.getPrototypeOf(this),i=this.g;return(e=e(n.call(t,r,{g:{value:{count:i.count,fa:i.fa,ia:i.ia,o:i.o,u:i.u,F:i.F,K:i.K}}}))).g.count.value+=1,e.g.fa=!1,e},delete(){if(this.g.o||Pt(this),this.g.fa&&!this.g.ia)throw new Ke("Object already scheduled for deletion");vt(this);var e=this.g;--e.count.value,0===e.count.value&&(e.F?e.K.P(e.F):e.u.i.P(e.o)),this.g.ia||(this.g.F=void 0,this.g.o=void 0)},isDeleted:function(){return!this.g.o},deleteLater:function(){if(this.g.o||Pt(this),this.g.fa&&!this.g.ia)throw new Ke("Object already scheduled for deletion");return lt.push(this),1===lt.length&&Ze&&Ze(ct),this.g.fa=!0,this}}),Object.assign(Wt.prototype,{Sb(e){return this.rb&&(e=this.rb(e)),e},bb(e){this.P?.(e)},argPackAdvance:8,readValueFromPointer:Et,fromWireType:function(e){function t(){return this.ta?wt(this.i.N,{u:this.ic,o:n,K:this,F:e}):wt(this.i.N,{u:this,o:e})}var n=this.Sb(e);if(!n)return this.bb(e),null;var r=((e,t)=>(t=ht(e,t),dt[t]))(this.i,n);if(void 0!==r)return 0===r.g.count.value?(r.g.o=n,r.g.F=e,r.clone()):(r=r.clone(),this.bb(e),r);if(r=this.i.Rb(n),!(r=yt[r]))return t.call(this);r=this.sa?r.Ib:r.pointerType;var i=bt(n,this.i,r.i);return null===i?t.call(this):this.ta?wt(r.i.N,{u:r,o:i,K:this,F:e}):wt(r.i.N,{u:r,o:i})}}),Vt=r.UnboundTypeError=st("UnboundTypeError");var In={__syscall_fcntl64:function(e,t,n){tt=n;try{var r=Fe(e);switch(t){case 0:var i=K();if(0>i)break;for(;be[i];)i++;return function(e,t=-1){return e=Oe(e,t),e.m?.Fc?.(e),e}(r,i).X;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:return i=K(),r.flags|=i,0;case 12:return i=K(),M[i+0>>1]=2,0}return-28}catch(a){if("ErrnoError"!==a.name)throw a;return-a.aa}},__syscall_ioctl:function(e,t,n){tt=n;try{var r=Fe(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return r.s?0:-59;case 21505:if(!r.s)return-59;if(r.s.W.Yb){e=[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var i=K();k[i>>2]=25856,k[i+4>>2]=5,k[i+8>>2]=191,k[i+12>>2]=35387;for(var a=0;32>a;a++)C[i+a+17]=e[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.s)return-59;if(r.s.W.Zb)for(i=K(),e=[],a=0;32>a;a++)e.push(C[i+a+17]);return 0;case 21519:return r.s?(i=K(),k[i>>2]=0):-59;case 21520:return r.s?-28:-59;case 21531:if(i=K(),!r.m.Xb)throw new Ae(59);return r.m.Xb(r,t,i);case 21523:return r.s?(r.s.W.$b&&(a=[24,80],i=K(),M[i>>1]=a[0],M[i+2>>1]=a[1]),0):-59;default:return-28}}catch(o){if("ErrnoError"!==o.name)throw o;return-o.aa}},__syscall_openat:function(e,t,n,r){tt=r;try{var i=t=t?ie(E,t):"";if("/"===i.charAt(0))t=i;else{var a=-100===e?"/":Fe(e).path;if(0==i.length)throw new Ae(44);t=Q(a+"/"+i)}return Ye(t,n,r?K():0).X}catch(o){if("ErrnoError"!==o.name)throw o;return-o.aa}},_abort_js:()=>{V("")},_embind_create_inheriting_constructor:(e,t,n)=>{e=ut(e),t=mt(t,"wrapper"),n=at(n);var r=t.i,i=r.N,a=r.C.N,o=r.C.constructor;return e=nt(e,function(...e){r.C.qb.forEach(function(e){if(this[e]===a[e])throw new Je(`Pure virtual function ${e} must be implemented in JavaScript`)}.bind(this)),Object.defineProperty(this,"__parent",{value:i}),this.__construct(...e)}),i.__construct=function(...e){if(this===i)throw new Ke("Pass correct 'this' to __construct");e=o.implement(this,...e),vt(e);var t=e.g;if(e.notifyOnDestruction(),t.ia=!0,Object.defineProperties(this,{g:{value:t}}),_t(this),e=t.o,e=ht(r,e),dt.hasOwnProperty(e))throw new Ke(`Tried to register registered instance: ${e}`);dt[e]=this},i.__destruct=function(){if(this===i)throw new Ke("Pass correct 'this' to __destruct");vt(this);var e=this.g.o;if(e=ht(r,e),!dt.hasOwnProperty(e))throw new Ke(`Tried to unregister unregistered instance: ${e}`);delete dt[e]},e.prototype=Object.create(i),Object.assign(e.prototype,n),ot(e)},_embind_finalize_value_object:e=>{var t=At[e];delete At[e];var n=t.Oa,r=t.P,i=t.fb,a=i.map(e=>e.Vb).concat(i.map(e=>e.lc));kt([e],a,e=>{var a={};return i.forEach((t,n)=>{var r=e[n],o=t.Tb,s=t.Ub,u=e[n+i.length],l=t.kc,c=t.mc;a[t.Pb]={read:e=>r.fromWireType(o(s,e)),write:(e,t)=>{var n=[];l(c,e,u.toWireType(n,t)),Ct(n)}}}),[{name:t.name,fromWireType:e=>{var t,n={};for(t in a)n[t]=a[t].read(e);return r(e),n},toWireType:(e,t)=>{for(var i in a)if(!(i in t))throw new TypeError(`Missing field: "${i}"`);var o=n();for(i in a)a[i].write(o,t[i]);return null!==e&&e.push(r,o),o},argPackAdvance:8,readValueFromPointer:Et,M:r}]})},_embind_register_bigint:()=>{},_embind_register_bool:(e,t,n,r)=>{It(e,{name:t=ut(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(E[e])},M:null})},_embind_register_class:(e,t,n,r,i,a,o,s,u,l,c,d,h)=>{c=ut(c),a=Yt(i,a),s&&=Yt(o,s),l&&=Yt(u,l),h=Yt(d,h);var f=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=t&&57>=t?`_${e}`:e})(c);Lt(f,function(){Ht(`Cannot construct ${c} due to unbound types`,[r])}),kt([e,t,n],r?[r]:[],t=>{if(t=t[0],r)var n=t.i,i=n.N;else i=Rt.prototype;t=nt(c,function(...e){if(Object.getPrototypeOf(this)!==o)throw new Ke("Use 'new' to construct "+c);if(void 0===d.$)throw new Ke(c+" has no accessible constructor");var t=d.$[e.length];if(void 0===t)throw new Ke(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.$).toString()}) parameters instead!`);return t.apply(this,e)});var o=Object.create(i,{constructor:{value:t}});t.prototype=o;var u,d=new Tt(c,t,o,h,n,a,s,l);return d.C&&((u=d.C).oa??(u.oa=[]),d.C.oa.push(d)),n=new Wt(c,d,!0,!1,!1),u=new Wt(c+"*",d,!1,!1,!1),i=new Wt(c+" const*",d,!1,!0,!1),yt[e]={pointerType:u,Ib:i},Ut(f,t),[n,u,i]})},_embind_register_class_class_function:(e,t,n,r,i,a,o)=>{var s=qt(n,r);t=ut(t),t=Kt(t),a=Yt(i,a),kt([],[e],e=>{function r(){Ht(`Cannot call ${i} due to unbound types`,s)}var i=`${(e=e[0]).name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var u=e.i.constructor;return void 0===u[t]?(r.ea=n-1,u[t]=r):(St(u,t,i),u[t].A[n-1]=r),kt([],s,r=>{if(r=Xt(i,[r[0],null].concat(r.slice(1)),null,a,o),void 0===u[t].A?(r.ea=n-1,u[t]=r):u[t].A[n-1]=r,e.i.oa)for(const n of e.i.oa)n.constructor.hasOwnProperty(t)||(n.constructor[t]=r);return[]}),[]})},_embind_register_class_class_property:(e,t,n,r,i,a,o,s)=>{t=ut(t),a=Yt(i,a),kt([],[e],e=>{var i=`${(e=e[0]).name}.${t}`,u={get(){Ht(`Cannot access ${i} due to unbound types`,[n])},enumerable:!0,configurable:!0};return u.set=s?()=>{Ht(`Cannot access ${i} due to unbound types`,[n])}:()=>{throw new Ke(`${i} is a read-only property`)},Object.defineProperty(e.i.constructor,t,u),kt([],[n],n=>{n=n[0];var i={get:()=>n.fromWireType(a(r)),enumerable:!0};return s&&(s=Yt(o,s),i.set=e=>{var t=[];s(r,n.toWireType(t,e)),Ct(t)}),Object.defineProperty(e.i.constructor,t,i),[]}),[]})},_embind_register_class_constructor:(e,t,n,r,i,a)=>{var o=qt(t,n);i=Yt(r,i),kt([],[e],e=>{var n=`constructor ${(e=e[0]).name}`;if(void 0===e.i.$&&(e.i.$=[]),void 0!==e.i.$[t-1])throw new Ke(`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.i.$[t-1]=()=>{Ht(`Cannot construct ${e.name} due to unbound types`,o)},kt([],o,r=>(r.splice(1,0,null),e.i.$[t-1]=Xt(n,r,null,i,a),[])),[]})},_embind_register_class_function:(e,t,n,r,i,a,o,s)=>{var u=qt(n,r);t=ut(t),t=Kt(t),a=Yt(i,a),kt([],[e],e=>{function r(){Ht(`Cannot call ${i} due to unbound types`,u)}var i=`${(e=e[0]).name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.i.qb.push(t);var l=e.i.N,c=l[t];return void 0===c||void 0===c.A&&c.className!==e.name&&c.ea===n-2?(r.ea=n-2,r.className=e.name,l[t]=r):(St(l,t,i),l[t].A[n-2]=r),kt([],u,r=>(r=Xt(i,r,e,a,o),void 0===l[t].A?(r.ea=n-2,l[t]=r):l[t].A[n-2]=r,[])),[]})},_embind_register_class_property:(e,t,n,r,i,a,o,s,u,l)=>{t=ut(t),i=Yt(r,i),kt([],[e],e=>{var r=`${(e=e[0]).name}.${t}`,c={get(){Ht(`Cannot access ${r} due to unbound types`,[n,o])},enumerable:!0,configurable:!0};return c.set=u?()=>Ht(`Cannot access ${r} due to unbound types`,[n,o]):()=>{throw new Ke(r+" is a read-only property")},Object.defineProperty(e.i.N,t,c),kt([],u?[n,o]:[n],n=>{var o=n[0],c={get(){var t=Jt(this,e,r+" getter");return o.fromWireType(i(a,t))},enumerable:!0};if(u){u=Yt(s,u);var d=n[1];c.set=function(t){var n=Jt(this,e,r+" setter"),i=[];u(l,n,d.toWireType(i,t)),Ct(i)}}return Object.defineProperty(e.i.N,t,c),[]}),[]})},_embind_register_emval:e=>It(e,Zt),_embind_register_enum:(e,t,n,r)=>{function i(){}t=ut(t),i.values={},It(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:8,readValueFromPointer:en(t,n,r),M:null}),Lt(t,i)},_embind_register_enum_value:(e,t,n)=>{var r=mt(e,"enum");t=ut(t),e=r.constructor,r=Object.create(r.constructor.prototype,{value:{value:n},constructor:{value:nt(`${r.name}_${t}`,function(){})}}),e.values[n]=r,e[t]=r},_embind_register_float:(e,t,n)=>{It(e,{name:t=ut(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:nn(t,n),M:null})},_embind_register_function:(e,t,n,r,i,a)=>{var o=qt(t,n);e=ut(e),e=Kt(e),i=Yt(r,i),Lt(e,function(){Ht(`Cannot call ${e} due to unbound types`,o)},t-1),kt([],o,n=>(Ut(e,Xt(e,[n[0],null].concat(n.slice(1)),null,i,a),t-1),[]))},_embind_register_integer:(e,t,n,r,i)=>{if(t=ut(t),-1===i&&(i=4294967295),i=e=>e,0===r){var a=32-8*n;i=e=>e<<a>>>a}var o=t.includes("unsigned")?function(e,t){return t>>>0}:function(e,t){return t};It(e,{name:t,fromWireType:i,toWireType:o,argPackAdvance:8,readValueFromPointer:rn(t,n,0!==r),M:null})},_embind_register_memory_view:(e,t,n)=>{function r(e){return new i(C.buffer,I[e+4>>2],I[e>>2])}var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];It(e,{name:n=ut(n),fromWireType:r,argPackAdvance:8,readValueFromPointer:r},{Wb:!0})},_embind_register_std_string:(e,t)=>{var n="std::string"===(t=ut(t));It(e,{name:t,fromWireType:function(e){var t=I[e>>2],r=e+4;if(n)for(var i=r,a=0;a<=t;++a){var o=r+a;if(a==t||0==E[o]){if(i=i?ie(E,i,o-i):"",void 0===s)var s=i;else s+=String.fromCharCode(0),s+=i;i=o+1}}else{for(s=Array(t),a=0;a<t;++a)s[a]=String.fromCharCode(E[r+a]);s=s.join("")}return Rn(e),s},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r="string"==typeof t;if(!(r||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array))throw new Ke("Cannot pass non-string to std::string");var i=n&&r?oe(t):t.length,a=Sn(4+i+1),o=a+4;if(I[a>>2]=i,n&&r)se(t,E,o,i+1);else if(r)for(r=0;r<i;++r){var s=t.charCodeAt(r);if(255<s)throw Rn(o),new Ke("String has UTF-16 code units that do not fit in 8 bits");E[o+r]=s}else for(r=0;r<i;++r)E[o+r]=t[r];return null!==e&&e.push(Rn,a),a},argPackAdvance:8,readValueFromPointer:Et,M(e){Rn(e)}})},_embind_register_std_wstring:(e,t,n)=>{if(n=ut(n),2===t)var r=on,i=sn,a=un,o=e=>x[e>>1];else 4===t&&(r=ln,i=cn,a=dn,o=e=>I[e>>2]);It(e,{name:n,fromWireType:e=>{for(var n,i=I[e>>2],a=e+4,s=0;s<=i;++s){var u=e+4+s*t;s!=i&&0!=o(u)||(a=r(a,u-a),void 0===n?n=a:(n+=String.fromCharCode(0),n+=a),a=u+t)}return Rn(e),n},toWireType:(e,r)=>{if("string"!=typeof r)throw new Ke(`Cannot pass non-string to C++ string type ${n}`);var o=a(r),s=Sn(4+o+t);return I[s>>2]=o/t,i(r,s+4,o+t),null!==e&&e.push(Rn,s),s},argPackAdvance:8,readValueFromPointer:Et,M(e){Rn(e)}})},_embind_register_value_object:(e,t,n,r,i,a)=>{At[e]={name:ut(t),Oa:Yt(n,r),P:Yt(i,a),fb:[]}},_embind_register_value_object_field:(e,t,n,r,i,a,o,s,u,l)=>{At[e].fb.push({Pb:ut(t),Vb:n,Tb:Yt(r,i),Ub:a,lc:o,kc:Yt(s,u),mc:l})},_embind_register_void:(e,t)=>{It(e,{Jc:!0,name:t=ut(t),argPackAdvance:0,fromWireType:()=>{},toWireType:()=>{}})},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:(e,t,n)=>E.copyWithin(e,t,t+n),_emscripten_throw_longjmp:()=>{throw 1/0},_emval_as:(e,t,n)=>(e=at(e),t=mt(t,"emval::as"),hn(t,n,e)),_emval_call_method:(e,t,n,r,i)=>(e=mn[e])(t=at(t),t[n=pn(n)],r,i),_emval_decref:Qt,_emval_get_method_caller:(e,t,n)=>{var r=((e,t)=>{for(var n=Array(e),r=0;r<e;++r)n[r]=mt(I[t+4*r>>2],"parameter "+r);return n})(e,t),i=r.shift();e--;var a=Array(e);return t=`methodCaller<(${r.map(e=>e.name).join(", ")}) => ${i.name}>`,(e=>{var t=mn.length;return mn.push(e),t})(nt(t,(t,o,s,u)=>{for(var l=0,c=0;c<e;++c)a[c]=r[c].readValueFromPointer(u+l),l+=r[c].argPackAdvance;return t=1===n?vn(o,a):o.apply(t,a),hn(i,s,t)}))},_emval_get_module_property:e=>(e=pn(e),ot(r[e])),_emval_get_property:(e,t)=>(e=at(e),t=at(t),ot(e[t])),_emval_incref:e=>{9<e&&(it[e+1]+=1)},_emval_new_array:()=>ot([]),_emval_new_cstring:e=>ot(pn(e)),_emval_new_object:()=>ot({}),_emval_run_destructors:e=>{Ct(at(e)),Qt(e)},_emval_set_property:(e,t,n)=>{e=at(e),t=at(t),n=at(n),e[t]=n},_emval_take_value:(e,t)=>(e=(e=mt(e,"_emval_take_value")).readValueFromPointer(t),ot(e)),_gmtime_js:function(e,t,n){e=/* @__PURE__ */new Date(1e3*(t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN)),k[n>>2]=e.getUTCSeconds(),k[n+4>>2]=e.getUTCMinutes(),k[n+8>>2]=e.getUTCHours(),k[n+12>>2]=e.getUTCDate(),k[n+16>>2]=e.getUTCMonth(),k[n+20>>2]=e.getUTCFullYear()-1900,k[n+24>>2]=e.getUTCDay(),k[n+28>>2]=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},_localtime_js:function(e,t,n){e=/* @__PURE__ */new Date(1e3*(t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN)),k[n>>2]=e.getSeconds(),k[n+4>>2]=e.getMinutes(),k[n+8>>2]=e.getHours(),k[n+12>>2]=e.getDate(),k[n+16>>2]=e.getMonth(),k[n+20>>2]=e.getFullYear()-1900,k[n+24>>2]=e.getDay(),k[n+28>>2]=(gn(e.getFullYear())?bn:yn)[e.getMonth()]+e.getDate()-1|0,k[n+36>>2]=-60*e.getTimezoneOffset(),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var r=new Date(e.getFullYear(),0,1).getTimezoneOffset();k[n+32>>2]=0|(t!=r&&e.getTimezoneOffset()==Math.min(r,t))},_tzset_js:(e,t,n,r)=>{var i=/* @__PURE__ */(new Date).getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1);i=a.getTimezoneOffset();var s=o.getTimezoneOffset();I[e>>2]=60*Math.max(i,s),k[t>>2]=Number(i!=s),a=(e=e=>e.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1])(a),o=e(o),s<i?(se(a,E,n,17),se(o,E,r,17)):(se(a,E,r,17),se(o,E,n,17))},emscripten_asm_const_int:(e,t,n)=>{wn.length=0;for(var r;r=E[t++];){var i=105!=r;n+=(i&=112!=r)&&n%8?4:0,wn.push(112==r?I[n>>2]:105==r?k[n>>2]:R[n>>3]),n+=i?8:4}return G[e](...wn)},emscripten_date_now:()=>Date.now(),emscripten_get_now:()=>performance.now(),emscripten_resize_heap:e=>{var t=E.length;if(2147483648<(e>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);var i=Math;r=Math.max(e,r);e:{i=(i.min.call(i,2147483648,r+(65536-r%65536)%65536)-A.buffer.byteLength+65535)/65536;try{A.grow(i),L();var a=1;break e}catch(o){}a=void 0}if(a)return!0}return!1},environ_get:(e,t)=>{var n=0;return An().forEach((r,i)=>{var a=t+n;for(i=I[e+4*i>>2]=a,a=0;a<r.length;++a)C[i++]=r.charCodeAt(a);C[i]=0,n+=r.length+1}),0},environ_sizes_get:(e,t)=>{var n=An();I[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),I[t>>2]=r,0},fd_close:function(e){try{var t=Fe(e);if(null===t.X)throw new Ae(8);t.La&&(t.La=null);try{t.m.close&&t.m.close(t)}catch(n){throw n}finally{be[t.X]=null}return t.X=null,0}catch(n){if("ErrnoError"!==n.name)throw n;return n.aa}},fd_read:function(e,t,n,r){try{e:{var i=Fe(e);e=t;for(var a,o=t=0;o<n;o++){var s=I[e>>2],u=I[e+4>>2];e+=8;var l=i,c=a,d=C;if(0>u||0>c)throw new Ae(28);if(null===l.X)throw new Ae(8);if(1==(2097155&l.flags))throw new Ae(8);if(16384==(61440&l.node.mode))throw new Ae(31);if(!l.m.read)throw new Ae(28);var h=void 0!==c;if(h){if(!l.seekable)throw new Ae(70)}else c=l.position;var f=l.m.read(l,d,s,u,c);h||(l.position+=f);var p=f;if(0>p){var m=-1;break e}if(t+=p,p<u)break;void 0!==a&&(a+=p)}m=t}return I[r>>2]=m,0}catch(v){if("ErrnoError"!==v.name)throw v;return v.aa}},fd_seek:function(e,t,n,r,i){t=n+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*n:NaN;try{if(isNaN(t))return 61;var a=Fe(e);return He(a,t,r),X=[a.position>>>0,(H=a.position,1<=+Math.abs(H)?0<H?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[i>>2]=X[0],k[i+4>>2]=X[1],a.La&&0===t&&0===r&&(a.La=null),0}catch(o){if("ErrnoError"!==o.name)throw o;return o.aa}},fd_write:function(e,t,n,r){try{e:{var i=Fe(e);e=t;for(var a,o=t=0;o<n;o++){var s=I[e>>2],u=I[e+4>>2];e+=8;var l=i,c=s,d=u,h=a,f=C;if(0>d||0>h)throw new Ae(28);if(null===l.X)throw new Ae(8);if(!(2097155&l.flags))throw new Ae(8);if(16384==(61440&l.node.mode))throw new Ae(31);if(!l.m.write)throw new Ae(28);l.seekable&&1024&l.flags&&He(l,0,2);var p=void 0!==h;if(p){if(!l.seekable)throw new Ae(70)}else h=l.position;var m=l.m.write(l,f,c,d,h,void 0);p||(l.position+=m);var v=m;if(0>v){var g=-1;break e}t+=v,void 0!==a&&(a+=v)}g=t}return I[r>>2]=g,0}catch(b){if("ErrnoError"!==b.name)throw b;return b.aa}},invoke_vii:function(e,t,n){var r=Bn();try{$t(e)(t,n)}catch(i){if(Wn(r),i!==i+0)throw i;Dn(1,0)}},isWindowsBrowser:function(){return-1<navigator.platform.indexOf("Win")},strftime:Mn,strftime_l:(e,t,n,r)=>Mn(e,t,n,r)},Pn=function(){function e(e){return Pn=e.exports,A=Pn.memory,L(),Bt=Pn.__indirect_function_table,F.unshift(Pn.__wasm_call_ctors),D--,r.monitorRunDependencies?.(D),0==D&&(null!==W&&(clearInterval(W),W=null),B&&(e=B,B=null,e())),Pn}var t={env:In,wasi_snapshot_preview1:In};if(D++,r.monitorRunDependencies?.(D),r.instantiateWasm)try{return r.instantiateWasm(t,e)}catch(i){_(`Module.instantiateWasm callback failed with error: ${i}`),n(i)}return U||=N("canvas_advanced.wasm")?"canvas_advanced.wasm":r.locateFile?r.locateFile("canvas_advanced.wasm",b):b+"canvas_advanced.wasm",function(e,t){var n=U;return y||"function"!=typeof WebAssembly.instantiateStreaming||N(n)||$(n)||"function"!=typeof fetch?Y(n,e,t):fetch(n,{credentials:"same-origin"}).then(r=>WebAssembly.instantiateStreaming(r,e).then(t,function(r){return _(`wasm streaming compile failed: ${r}`),_("falling back to ArrayBuffer instantiation"),Y(n,e,t)}))}(t,function(t){e(t.instance)}).catch(n),{}}(),Rn=e=>(Rn=Pn.free)(e),Sn=e=>(Sn=Pn.malloc)(e),Ln=e=>(Ln=Pn.__getTypeName)(e),Tn=r._ma_device__on_notification_unlocked=e=>(Tn=r._ma_device__on_notification_unlocked=Pn.ma_device__on_notification_unlocked)(e);r._ma_malloc_emscripten=(e,t)=>(r._ma_malloc_emscripten=Pn.ma_malloc_emscripten)(e,t),r._ma_free_emscripten=(e,t)=>(r._ma_free_emscripten=Pn.ma_free_emscripten)(e,t);var Fn,On=r._ma_device_process_pcm_frames_capture__webaudio=(e,t,n)=>(On=r._ma_device_process_pcm_frames_capture__webaudio=Pn.ma_device_process_pcm_frames_capture__webaudio)(e,t,n),jn=r._ma_device_process_pcm_frames_playback__webaudio=(e,t,n)=>(jn=r._ma_device_process_pcm_frames_playback__webaudio=Pn.ma_device_process_pcm_frames_playback__webaudio)(e,t,n),Dn=(e,t)=>(Dn=Pn.setThrew)(e,t),Wn=e=>(Wn=Pn._emscripten_stack_restore)(e),Bn=()=>(Bn=Pn.emscripten_stack_get_current)();function Vn(){function e(){if(!Fn&&(Fn=!0,r.calledRun=!0,!S)){if(r.noFSInit||je||(je=!0,r.stdin=r.stdin,r.stdout=r.stdout,r.stderr=r.stderr,r.stdin?Xe("stdin",r.stdin):$e("/dev/tty","/dev/stdin"),r.stdout?Xe("stdout",null,r.stdout):$e("/dev/tty","/dev/stdout"),r.stderr?Xe("stderr",null,r.stderr):$e("/dev/tty1","/dev/stderr"),Ye("/dev/stdin",0),Ye("/dev/stdout",1),Ye("/dev/stderr",1)),_e=!1,q(F),t(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;){var e=r.postRun.shift();O.unshift(e)}q(O)}}if(!(0<D)){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)j();q(T),0<D||(r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),e()},1)):e())}}if(r.dynCall_iiji=(e,t,n,i,a)=>(r.dynCall_iiji=Pn.dynCall_iiji)(e,t,n,i,a),r.dynCall_jiji=(e,t,n,i,a)=>(r.dynCall_jiji=Pn.dynCall_jiji)(e,t,n,i,a),r.dynCall_iiiji=(e,t,n,i,a,o)=>(r.dynCall_iiiji=Pn.dynCall_iiiji)(e,t,n,i,a,o),r.dynCall_iij=(e,t,n,i)=>(r.dynCall_iij=Pn.dynCall_iij)(e,t,n,i),r.dynCall_jii=(e,t,n)=>(r.dynCall_jii=Pn.dynCall_jii)(e,t,n),r.dynCall_viijii=(e,t,n,i,a,o,s)=>(r.dynCall_viijii=Pn.dynCall_viijii)(e,t,n,i,a,o,s),r.dynCall_iiiiij=(e,t,n,i,a,o,s)=>(r.dynCall_iiiiij=Pn.dynCall_iiiiij)(e,t,n,i,a,o,s),r.dynCall_iiiiijj=(e,t,n,i,a,o,s,u,l)=>(r.dynCall_iiiiijj=Pn.dynCall_iiiiijj)(e,t,n,i,a,o,s,u,l),r.dynCall_iiiiiijj=(e,t,n,i,a,o,s,u,l,c)=>(r.dynCall_iiiiiijj=Pn.dynCall_iiiiiijj)(e,t,n,i,a,o,s,u,l,c),B=function e(){Fn||Vn(),Fn||(B=e)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);0<r.preInit.length;)r.preInit.pop()();return Vn(),a});var i},e=>{e.exports=/* @__PURE__ */JSON.parse('{"name":"@rive-app/canvas","version":"2.34.2","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}')},(e,t,n)=>{n.r(t),n.d(t,{Animation:()=>r.Animation});var r=n(4)},(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 null!==this.scrubTo},enumerable:!1,configurable:!0}),e.prototype.advance=function(e){null===this.scrubTo?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,{AudioAssetWrapper:()=>a.AudioAssetWrapper,AudioWrapper:()=>a.AudioWrapper,BLANK_URL:()=>i.BLANK_URL,CustomFileAssetLoaderWrapper:()=>a.CustomFileAssetLoaderWrapper,FileAssetWrapper:()=>a.FileAssetWrapper,FileFinalizer:()=>a.FileFinalizer,FontAssetWrapper:()=>a.FontAssetWrapper,FontWrapper:()=>a.FontWrapper,ImageAssetWrapper:()=>a.ImageAssetWrapper,ImageWrapper:()=>a.ImageWrapper,createFinalization:()=>a.createFinalization,finalizationRegistry:()=>a.finalizationRegistry,registerTouchInteractions:()=>r.registerTouchInteractions,sanitizeUrl:()=>i.sanitizeUrl});var r=n(6),i=n(7),a=n(8)},(e,t,n)=>{n.r(t),n.d(t,{registerTouchInteractions:()=>r});var r=function(e){var t=e.canvas,n=e.artboard,r=e.stateMachines,i=void 0===r?[]:r,a=e.renderer,o=e.rive,s=e.fit,u=e.alignment,l=e.isTouchScrollEnabled,c=void 0!==l&&l,d=e.dispatchPointerExit,h=void 0===d||d,f=e.enableMultiTouch,p=void 0!==f&&f,m=e.layoutScaleFactor,v=void 0===m?1:m;if(!(t&&i.length&&a&&o&&n&&"undefined"!=typeof window))return null;var g=null,b=!1,y=function(e){if(b&&e instanceof MouseEvent)"mouseup"==e.type&&(b=!1);else{b=c&&"touchend"===e.type&&"touchstart"===g,g=e.type;var t=e.currentTarget.getBoundingClientRect(),r=function(e,t,n){var r,i,a=[];if(["touchstart","touchmove"].indexOf(e.type)>-1&&(null===(r=e.changedTouches)||void 0===r?void 0:r.length)){t||e.preventDefault();for(var o=0,s=n?e.changedTouches.length:1;o<s;){var u=e.changedTouches[o];a.push({clientX:u.clientX,clientY:u.clientY,identifier:u.identifier}),o++}}else if("touchend"===e.type&&(null===(i=e.changedTouches)||void 0===i?void 0:i.length))for(o=0,s=n?e.changedTouches.length:1;o<s;)u=e.changedTouches[o],a.push({clientX:u.clientX,clientY:u.clientY,identifier:u.identifier}),o++;else a.push({clientX:e.clientX,clientY:e.clientY,identifier:0});return a}(e,c,p),a=o.computeAlignment(s,u,{minX:0,minY:0,maxX:t.width,maxY:t.height},n.bounds,v),l=new o.Mat2D;switch(a.invert(l),r.forEach(function(e){var n=e.clientX,r=e.clientY;if(n||r){var i=n-t.left,a=r-t.top,s=new o.Vec2D(i,a),u=o.mapXY(l,s),c=u.x(),d=u.y();e.transformedX=c,e.transformedY=d,u.delete(),s.delete()}}),l.delete(),a.delete(),e.type){case"mouseout":for(var d=function(e){h?r.forEach(function(t){e.pointerExit(t.transformedX,t.transformedY,t.identifier)}):r.forEach(function(t){e.pointerMove(t.transformedX,t.transformedY,t.identifier)})},f=0,m=i;f<m.length;f++)d(m[f]);break;case"touchmove":case"mouseover":case"mousemove":for(var y=function(e){r.forEach(function(t){e.pointerMove(t.transformedX,t.transformedY,t.identifier)})},w=0,_=i;w<_.length;w++)y(_[w]);break;case"touchstart":case"mousedown":for(var A=function(e){r.forEach(function(t){e.pointerDown(t.transformedX,t.transformedY,t.identifier)})},C=0,E=i;C<E.length;C++)A(E[C]);break;case"touchend":for(var M=function(e){r.forEach(function(t){e.pointerUp(t.transformedX,t.transformedY,t.identifier),e.pointerExit(t.transformedX,t.transformedY,t.identifier)})},x=0,k=i;x<k.length;x++)M(k[x]);break;case"mouseup":for(var I=function(e){r.forEach(function(t){e.pointerUp(t.transformedX,t.transformedY,t.identifier)})},P=0,R=i;P<R.length;P++)I(R[P])}}}.bind(void 0);return t.addEventListener("mouseover",y),t.addEventListener("mouseout",y),t.addEventListener("mousemove",y),t.addEventListener("mousedown",y),t.addEventListener("mouseup",y),t.addEventListener("touchmove",y,{passive:c}),t.addEventListener("touchstart",y,{passive:c}),t.addEventListener("touchend",y),function(){t.removeEventListener("mouseover",y),t.removeEventListener("mouseout",y),t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",y),t.removeEventListener("mouseup",y),t.removeEventListener("touchmove",y),t.removeEventListener("touchstart",y),t.removeEventListener("touchend",y)}}},(e,t,n)=>{n.r(t),n.d(t,{BLANK_URL:()=>l,sanitizeUrl:()=>c});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=/^.+(:|&colon;)/gim,u=[".","/"],l="about:blank";function c(e){if(!e)return l;var t,n=(t=e,t.replace(o,"").replace(i,function(e,t){return String.fromCharCode(t)})).replace(a,"").replace(o,"").trim();if(!n)return l;if(function(e){return u.indexOf(e[0])>-1}(n))return n;var c=n.match(s);if(!c)return n;var d=c[0];return r.test(d)?l:n}},(e,t,n)=>{n.r(t),n.d(t,{AudioAssetWrapper:()=>p,AudioWrapper:()=>l,CustomFileAssetLoaderWrapper:()=>d,FileAssetWrapper:()=>h,FileFinalizer:()=>a,FontAssetWrapper:()=>m,FontWrapper:()=>c,ImageAssetWrapper:()=>f,ImageWrapper:()=>u,createFinalization:()=>b,finalizationRegistry:()=>g});var r,i=(r=function(e,t){return(r=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)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(){function e(e){this.selfUnref=!1,this._file=e}return e.prototype.unref=function(){this._file&&this._file.unref()},e}(),o=function(){function e(e){this._finalizableObject=e}return e.prototype.unref=function(){this._finalizableObject.unref()},e}(),s=function(){function e(){this.selfUnref=!1}return e.prototype.unref=function(){},e}(),u=function(e){function t(t){var n=e.call(this)||this;return n._nativeImage=t,n}return i(t,e),Object.defineProperty(t.prototype,"nativeImage",{get:function(){return this._nativeImage},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeImage.unref()},t}(s),l=function(e){function t(t){var n=e.call(this)||this;return n._nativeAudio=t,n}return i(t,e),Object.defineProperty(t.prototype,"nativeAudio",{get:function(){return this._nativeAudio},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeAudio.unref()},t}(s),c=function(e){function t(t){var n=e.call(this)||this;return n._nativeFont=t,n}return i(t,e),Object.defineProperty(t.prototype,"nativeFont",{get:function(){return this._nativeFont},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeFont.unref()},t}(s),d=function(){function e(e,t){this._assetLoaderCallback=t,this.assetLoader=new e.CustomFileAssetLoader({loadContents:this.loadContents.bind(this)})}return e.prototype.loadContents=function(e,t){var n;return e.isImage?n=new f(e):e.isAudio?n=new p(e):e.isFont&&(n=new m(e)),this._assetLoaderCallback(n,t)},e}(),h=function(){function e(e){this._nativeFileAsset=e}return e.prototype.decode=function(e){this._nativeFileAsset.decode(e)},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){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.setRenderImage=function(e){this._nativeFileAsset.setRenderImage(e.nativeImage)},t}(h),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.setAudioSource=function(e){this._nativeFileAsset.setAudioSource(e.nativeAudio)},t}(h),m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.setFont=function(e){this._nativeFileAsset.setFont(e.nativeFont)},t}(h),v=function(){function e(e){}return e.prototype.register=function(e){e.selfUnref=!0},e.prototype.unregister=function(e){},e}(),g=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:v)(function(e){null==e||e.unref()}),b=function(e,t){var n=new o(t);g.register(e,n)}}],t={};function n(r){var i=t[r];if(void 0!==i)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=>{"undefined"!=typeof Symbol&&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:()=>a,DataEnum:()=>G,DrawOptimizationOptions:()=>s,EventType:()=>x,Fit:()=>t,Layout:()=>_,LoopType:()=>I,Rive:()=>H,RiveEventType:()=>C,RiveFile:()=>Y,RuntimeLoader:()=>A,StateMachineInput:()=>M,StateMachineInputType:()=>y,Testing:()=>ue,ViewModel:()=>X,ViewModelInstance:()=>q,ViewModelInstanceArtboard:()=>ae,ViewModelInstanceAssetImage:()=>ie,ViewModelInstanceBoolean:()=>Z,ViewModelInstanceColor:()=>re,ViewModelInstanceEnum:()=>te,ViewModelInstanceList:()=>ne,ViewModelInstanceNumber:()=>Q,ViewModelInstanceString:()=>J,ViewModelInstanceTrigger:()=>ee,ViewModelInstanceValue:()=>K,decodeAudio:()=>le,decodeFont:()=>de,decodeImage:()=>ce});var e,t,i,a,o,s,u,l=n(1),c=n(2),d=n(3),h=n(5),f=(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])})(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},p.apply(this,arguments)},m=function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{u(r.next(e))}catch(t){a(t)}}function s(e){try{u(r.throw(e))}catch(t){a(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}u((r=r.apply(e,t||[])).next())})},v=function(e,t){var n,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(u){s=[6,u],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},g=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isHandledError=!0,t}return f(t,e),t}(Error);(i=t||(t={})).Cover="cover",i.Contain="contain",i.Fill="fill",i.FitWidth="fitWidth",i.FitHeight="fitHeight",i.None="none",i.ScaleDown="scaleDown",i.Layout="layout",(o=a||(a={})).Center="center",o.TopLeft="topLeft",o.TopCenter="topCenter",o.TopRight="topRight",o.CenterLeft="centerLeft",o.CenterRight="centerRight",o.BottomLeft="bottomLeft",o.BottomCenter="bottomCenter",o.BottomRight="bottomRight",(u=s||(s={})).AlwaysDraw="alwaysDraw",u.DrawOnChanged="drawOnChanged";var y,w,_=function(){function e(e){var n,r,i,o,s,u,l;this.fit=null!==(n=null==e?void 0:e.fit)&&void 0!==n?n:t.Contain,this.alignment=null!==(r=null==e?void 0:e.alignment)&&void 0!==r?r:a.Center,this.layoutScaleFactor=null!==(i=null==e?void 0:e.layoutScaleFactor)&&void 0!==i?i:1,this.minX=null!==(o=null==e?void 0:e.minX)&&void 0!==o?o:0,this.minY=null!==(s=null==e?void 0:e.minY)&&void 0!==s?s:0,this.maxX=null!==(u=null==e?void 0:e.maxX)&&void 0!==u?u:0,this.maxY=null!==(l=null==e?void 0:e.maxY)&&void 0!==l?l:0}return e.new=function(t){var n=t.fit,r=t.alignment,i=t.minX,a=t.minY,o=t.maxX,s=t.maxY;return console.warn("This function is deprecated: please use `new Layout({})` instead"),new e({fit:n,alignment:r,minX:i,minY:a,maxX:o,maxY:s})},e.prototype.copyWith=function(t){var n=t.fit,r=t.alignment,i=t.layoutScaleFactor,a=t.minX,o=t.minY,s=t.maxX,u=t.maxY;return new e({fit:null!=n?n:this.fit,alignment:null!=r?r:this.alignment,layoutScaleFactor:null!=i?i:this.layoutScaleFactor,minX:null!=a?a:this.minX,minY:null!=o?o:this.minY,maxX:null!=s?s:this.maxX,maxY:null!=u?u:this.maxY})},e.prototype.runtimeFit=function(e){return this.cachedRuntimeFit?this.cachedRuntimeFit:(n=this.fit===t.Cover?e.Fit.cover:this.fit===t.Contain?e.Fit.contain:this.fit===t.Fill?e.Fit.fill:this.fit===t.FitWidth?e.Fit.fitWidth:this.fit===t.FitHeight?e.Fit.fitHeight:this.fit===t.ScaleDown?e.Fit.scaleDown:this.fit===t.Layout?e.Fit.layout:e.Fit.none,this.cachedRuntimeFit=n,n);var n},e.prototype.runtimeAlignment=function(e){return this.cachedRuntimeAlignment?this.cachedRuntimeAlignment:(t=this.alignment===a.TopLeft?e.Alignment.topLeft:this.alignment===a.TopCenter?e.Alignment.topCenter:this.alignment===a.TopRight?e.Alignment.topRight:this.alignment===a.CenterLeft?e.Alignment.centerLeft:this.alignment===a.CenterRight?e.Alignment.centerRight:this.alignment===a.BottomLeft?e.Alignment.bottomLeft:this.alignment===a.BottomCenter?e.Alignment.bottomCenter:this.alignment===a.BottomRight?e.Alignment.bottomRight:e.Alignment.center,this.cachedRuntimeAlignment=t,t);var t},e}(),A=function(){function e(){}return e.loadRuntime=function(){l.default({locateFile:function(){return e.wasmURL}}).then(function(t){var n;for(e.runtime=t;e.callBackQueue.length>0;)null===(n=e.callBackQueue.shift())||void 0===n||n(e.runtime)}).catch(function(t){var n={message:(null==t?void 0:t.message)||"Unknown error",type:(null==t?void 0:t.name)||"Error",wasmError:t instanceof WebAssembly.CompileError||t instanceof WebAssembly.RuntimeError,originalError:t};console.debug("Rive WASM load error details:",n);var r="https://cdn.jsdelivr.net/npm/".concat(c.name,"@").concat(c.version,"/rive_fallback.wasm");if(e.wasmURL.toLowerCase()!==r)console.warn("Failed to load WASM from ".concat(e.wasmURL," (").concat(n.message,"), trying jsdelivr as a backup")),e.setWasmUrl(r),e.loadRuntime();else{var i=["Could not load Rive WASM file from ".concat(e.wasmURL," or ").concat(r,"."),"Possible reasons:","- Network connection is down","- WebAssembly is not supported in this environment","- The WASM file is corrupted or incompatible","\nError details:","- Type: ".concat(n.type),"- Message: ".concat(n.message),"- WebAssembly-specific error: ".concat(n.wasmError),"\nTo resolve, you may need to:","1. Check your network connection","2. Set a new WASM source via RuntimeLoader.setWasmUrl()","3. Call RuntimeLoader.loadRuntime() again"].join("\n");console.error(i)}})},e.getInstance=function(t){e.isLoading||(e.isLoading=!0,e.loadRuntime()),e.runtime?t(e.runtime):e.callBackQueue.push(t)},e.awaitInstance=function(){return new Promise(function(t){return e.getInstance(function(e){return t(e)})})},e.setWasmUrl=function(t){e.wasmURL=t},e.getWasmUrl=function(){return e.wasmURL},e.isLoading=!1,e.callBackQueue=[],e.wasmURL="https://unpkg.com/".concat(c.name,"@").concat(c.version,"/rive.wasm"),e}();(w=y||(y={}))[w.Number=56]="Number",w[w.Trigger=58]="Trigger",w[w.Boolean=59]="Boolean";var C,E,M=function(){function e(e,t){this.type=e,this.runtimeInput=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this.runtimeInput.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.runtimeInput.value},set:function(e){this.runtimeInput.value=e},enumerable:!1,configurable:!0}),e.prototype.fire=function(){this.type===y.Trigger&&this.runtimeInput.fire()},e.prototype.delete=function(){this.runtimeInput=null},e}();(E=C||(C={}))[E.General=128]="General",E[E.OpenUrl=131]="OpenUrl";var x,k,I,P,R=function(e){this.isBindableArtboard=!1,this.isBindableArtboard=e},S=function(e){function t(t,n){var r=e.call(this,!1)||this;return r.nativeArtboard=t,r.file=n,r}return f(t,e),t}(R),L=function(e){function t(t){var n=e.call(this,!0)||this;return n.selfUnref=!1,n.nativeArtboard=t,n}return f(t,e),Object.defineProperty(t.prototype,"viewModel",{set:function(e){this.nativeViewModel=e.nativeInstance},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){var e;this.selfUnref&&(this.nativeArtboard.unref(),null===(e=this.nativeViewModel)||void 0===e||e.unref())},t}(R),T=function(){function e(e,t,n,r){this.stateMachine=e,this.playing=n,this.artboard=r,this.inputs=[],this.instance=new t.StateMachineInstance(e,r),this.initInputs(t)}return Object.defineProperty(e.prototype,"name",{get:function(){return this.stateMachine.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statesChanged",{get:function(){for(var e=[],t=0;t<this.instance.stateChangedCount();t++)e.push(this.instance.stateChangedNameByIndex(t));return e},enumerable:!1,configurable:!0}),e.prototype.advance=function(e){this.instance.advance(e)},e.prototype.advanceAndApply=function(e){this.instance.advanceAndApply(e)},e.prototype.reportedEventCount=function(){return this.instance.reportedEventCount()},e.prototype.reportedEventAt=function(e){return this.instance.reportedEventAt(e)},e.prototype.initInputs=function(e){for(var t=0;t<this.instance.inputCount();t++){var n=this.instance.input(t);this.inputs.push(this.mapRuntimeInput(n,e))}},e.prototype.mapRuntimeInput=function(e,t){return e.type===t.SMIInput.bool?new M(y.Boolean,e.asBool()):e.type===t.SMIInput.number?new M(y.Number,e.asNumber()):e.type===t.SMIInput.trigger?new M(y.Trigger,e.asTrigger()):void 0},e.prototype.cleanup=function(){this.inputs.forEach(function(e){e.delete()}),this.inputs.length=0,this.instance.delete()},e.prototype.bindViewModelInstance=function(e){null!=e.runtimeInstance&&this.instance.bindViewModelInstance(e.runtimeInstance)},e}(),F=function(){function e(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=[]),this.runtime=e,this.artboard=t,this.eventManager=n,this.animations=r,this.stateMachines=i}return e.prototype.add=function(e,t,n){if(void 0===n&&(n=!0),0===(e=se(e)).length)this.animations.forEach(function(e){return e.playing=t}),this.stateMachines.forEach(function(e){return e.playing=t});else for(var r=this.animations.map(function(e){return e.name}),i=this.stateMachines.map(function(e){return e.name}),a=0;a<e.length;a++){var o=r.indexOf(e[a]),s=i.indexOf(e[a]);if(o>=0||s>=0)o>=0?this.animations[o].playing=t:this.stateMachines[s].playing=t;else{var u=this.artboard.animationByName(e[a]);if(u){var l=new d.Animation(u,this.artboard,this.runtime,t);l.advance(0),l.apply(1),this.animations.push(l)}else{var c=this.artboard.stateMachineByName(e[a]);if(c){var h=new T(c,this.runtime,t,this.artboard);this.stateMachines.push(h)}}}}return n&&(t?this.eventManager.fire({type:x.Play,data:this.playing}):this.eventManager.fire({type:x.Pause,data:this.paused})),t?this.playing:this.paused},e.prototype.initLinearAnimations=function(e,t){for(var n=this.animations.map(function(e){return e.name}),r=0;r<e.length;r++){var i=n.indexOf(e[r]);if(i>=0)this.animations[i].playing=t;else{var a=this.artboard.animationByName(e[r]);if(a){var o=new d.Animation(a,this.artboard,this.runtime,t);o.advance(0),o.apply(1),this.animations.push(o)}else console.error("Animation with name ".concat(e[r]," not found."))}}},e.prototype.initStateMachines=function(e,t){for(var n=this.stateMachines.map(function(e){return e.name}),r=0;r<e.length;r++){var i=n.indexOf(e[r]);if(i>=0)this.stateMachines[i].playing=t;else{var a=this.artboard.stateMachineByName(e[r]);if(a){var o=new T(a,this.runtime,t,this.artboard);this.stateMachines.push(o)}else console.warn("State Machine with name ".concat(e[r]," not found.")),this.initLinearAnimations([e[r]],t)}}},e.prototype.play=function(e){return this.add(e,!0)},e.prototype.advanceIfPaused=function(){this.stateMachines.forEach(function(e){e.playing||e.advanceAndApply(0)})},e.prototype.pause=function(e){return this.add(e,!1)},e.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(e.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(e.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}),e.prototype.stop=function(e){var t=this,n=[];if(0===(e=se(e)).length)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:x.Stop,data:n}),n},Object.defineProperty(e.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(e.prototype,"isPaused",{get:function(){return!this.isPlaying&&(this.animations.length>0||this.stateMachines.length>0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStopped",{get:function(){return 0===this.animations.length&&0===this.stateMachines.length},enumerable:!1,configurable:!0}),e.prototype.atLeastOne=function(e,t){var n;return void 0===t&&(t=!0),0===this.animations.length&&0===this.stateMachines.length&&(this.artboard.animationCount()>0?this.add([n=this.artboard.animationByIndex(0).name],e,t):this.artboard.stateMachineCount()>0&&this.add([n=this.artboard.stateMachineByIndex(0).name],e,t)),n},e.prototype.handleLooping=function(){for(var e=0,t=this.animations.filter(function(e){return e.playing});e<t.length;e++){var n=t[e];0===n.loopValue&&n.loopCount?(n.loopCount=0,this.stop(n.name)):1===n.loopValue&&n.loopCount?(this.eventManager.fire({type:x.Loop,data:{animation:n.name,type:I.Loop}}),n.loopCount=0):2===n.loopValue&&n.loopCount>1&&(this.eventManager.fire({type:x.Loop,data:{animation:n.name,type:I.PingPong}}),n.loopCount=0)}},e.prototype.handleStateChanges=function(){for(var e=[],t=0,n=this.stateMachines.filter(function(e){return e.playing});t<n.length;t++){var r=n[t];e.push.apply(e,r.statesChanged)}e.length>0&&this.eventManager.fire({type:x.StateChange,data:e})},e.prototype.handleAdvancing=function(e){this.eventManager.fire({type:x.Advance,data:e})},e}();(k=x||(x={})).Load="load",k.LoadError="loaderror",k.Play="play",k.Pause="pause",k.Stop="stop",k.Loop="loop",k.Draw="draw",k.Advance="advance",k.StateChange="statechange",k.RiveEvent="riveevent",k.AudioStatusChange="audiostatuschange",(P=I||(I={})).OneShot="oneshot",P.Loop="loop",P.PingPong="pingpong";var O,j,D=function(){function e(e){void 0===e&&(e=[]),this.listeners=e}return e.prototype.getListeners=function(e){return this.listeners.filter(function(t){return t.type===e})},e.prototype.add=function(e){this.listeners.includes(e)||this.listeners.push(e)},e.prototype.remove=function(e){for(var t=0;t<this.listeners.length;t++){var n=this.listeners[t];if(n.type===e.type&&n.callback===e.callback){this.listeners.splice(t,1);break}}},e.prototype.removeAll=function(e){var t=this;e?this.listeners.filter(function(t){return t.type===e}).forEach(function(e){return t.remove(e)}):this.listeners.splice(0,this.listeners.length)},e.prototype.fire=function(e){this.getListeners(e.type).forEach(function(t){return t.callback(e)})},e}(),W=function(){function e(e){this.eventManager=e,this.queue=[]}return e.prototype.add=function(e){this.queue.push(e)},e.prototype.process=function(){for(;this.queue.length>0;){var e=this.queue.shift();(null==e?void 0:e.action)&&e.action(),(null==e?void 0:e.event)&&this.eventManager.fire(e.event)}},e}();(j=O||(O={}))[j.AVAILABLE=0]="AVAILABLE",j[j.UNAVAILABLE=1]="UNAVAILABLE";var B,V,U=new(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._started=!1,t._enabled=!1,t._status=O.UNAVAILABLE,t}return f(t,e),t.prototype.delay=function(e){return m(this,void 0,void 0,function(){return v(this,function(t){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},t.prototype.timeout=function(){return m(this,void 0,void 0,function(){return v(this,function(e){return[2,new Promise(function(e,t){return setTimeout(t,50)})]})})},t.prototype.reportToListeners=function(){this.fire({type:x.AudioStatusChange}),this.removeAll()},t.prototype.enableAudio=function(){return m(this,void 0,void 0,function(){return v(this,function(e){return this._enabled||(this._enabled=!0,this._status=O.AVAILABLE,this.reportToListeners()),[2]})})},t.prototype.testAudio=function(){return m(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:if(this._status!==O.UNAVAILABLE||null===this._audioContext)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 m(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return this._started?[3,5]:(this._started=!0,"undefined"!=typeof window?[3,1]:(this.enableAudio(),[3,5]));case 1:this._audioContext=new AudioContext,this.listenForUserAction(),e.label=2;case 2:return this._status!==O.UNAVAILABLE?[3,5]:[4,this.testAudio()];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 m(e,void 0,void 0,function(){return v(this,function(e){return this.enableAudio(),[2]})})},{once:!0})},t.prototype.establishAudio=function(){return m(this,void 0,void 0,function(){return v(this,function(e){return this._establishAudio(),[2]})})},Object.defineProperty(t.prototype,"systemVolume",{get:function(){return this._status===O.UNAVAILABLE?(this.testAudio(),0):1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),t}(D)),N=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}(),$=globalThis.ResizeObserver||N,z=new(function(){function e(){var e=this;this._elementsMap=/* @__PURE__ */new Map,this._onObservedEntry=function(t){var n=e._elementsMap.get(t.target);null!==n?n.onResize(0==t.target.clientWidth||0==t.target.clientHeight):e._resizeObserver.unobserve(t.target)},this._onObserved=function(t){t.forEach(e._onObservedEntry)},this._resizeObserver=new $(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}()),Y=function(){function e(e){this.enableRiveAssetCDN=!0,this.referenceCount=0,this.destroyed=!1,this.selfUnref=!1,this.bindableArtboards=[],this.src=e.src,this.buffer=e.buffer,e.assetLoader&&(this.assetLoader=e.assetLoader),this.enableRiveAssetCDN="boolean"!=typeof e.enableRiveAssetCDN||e.enableRiveAssetCDN,this.eventManager=new D,e.onLoad&&this.on(x.Load,e.onLoad),e.onLoadError&&this.on(x.LoadError,e.onLoadError)}return e.prototype.releaseFile=function(){var e;this.selfUnref&&(null===(e=this.file)||void 0===e||e.unref()),this.file=null},e.prototype.releaseBindableArtboards=function(){this.bindableArtboards.forEach(function(e){return e.destroy()})},e.prototype.initData=function(){return m(this,void 0,void 0,function(){var t,n,r,i,a;return v(this,function(o){switch(o.label){case 0:return this.src?(t=this,[4,oe(this.src)]):[3,2];case 1:t.buffer=o.sent(),o.label=2;case 2:return this.destroyed?[2]:(this.assetLoader&&(r=new h.CustomFileAssetLoaderWrapper(this.runtime,this.assetLoader),n=r.assetLoader),i=this,[4,this.runtime.load(new Uint8Array(this.buffer),n,this.enableRiveAssetCDN)]);case 3:return i.file=o.sent(),a=new h.FileFinalizer(this.file),h.finalizationRegistry.register(this,a),this.destroyed?(this.releaseFile(),[2]):(null!==this.file?this.eventManager.fire({type:x.Load,data:this}):this.fireLoadError(e.fileLoadErrorMessage),[2])}})})},e.prototype.init=function(){return m(this,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:if(!this.src&&!this.buffer)return this.fireLoadError(e.missingErrorMessage),[2];r.label=1;case 1:return r.trys.push([1,4,,5]),t=this,[4,A.awaitInstance()];case 2:return t.runtime=r.sent(),this.destroyed?[2]:[4,this.initData()];case 3:return r.sent(),[3,5];case 4:return n=r.sent(),this.fireLoadError(n instanceof Error?n.message:e.fileLoadErrorMessage),[3,5];case 5:return[2]}})})},e.prototype.fireLoadError=function(e){throw this.eventManager.fire({type:x.LoadError,data:e}),new Error(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-=1,this.referenceCount<=0&&(this.removeAllRiveEventListeners(),this.releaseFile(),this.releaseBindableArtboards(),this.destroyed=!0)},e.prototype.removeAllRiveEventListeners=function(e){this.eventManager.removeAll(e)},e.prototype.getInstance=function(){if(null!==this.file)return this.referenceCount+=1,this.file},e.prototype.destroyIfUnused=function(){this.referenceCount<=0&&this.cleanup()},e.prototype.createBindableArtboard=function(e){if(null!=e){var t=new L(e);return(0,h.createFinalization)(t,t.nativeArtboard),this.bindableArtboards.push(t),t}return null},e.prototype.getArtboard=function(e){var t=this.file.artboardByName(e);if(null!=t)return new S(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 null!==t?new X(t):null},e.missingErrorMessage="Rive source file or data buffer required",e.fileLoadErrorMessage="The file failed to load",e}(),H=function(){function e(e){var t,n,r=this;this.loaded=!1,this.destroyed=!1,this._observed=null,this.readyForPlaying=!1,this.artboard=null,this.eventCleanup=null,this.shouldDisableRiveListeners=!1,this.automaticallyHandleEvents=!1,this.dispatchPointerExit=!0,this.enableMultiTouch=!1,this.enableRiveAssetCDN=!0,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._viewModelInstance=null,this._dataEnums=null,this.drawOptimization=s.DrawOnChanged,this.durations=[],this.frameTimes=[],this.frameCount=0,this.isTouchScrollEnabled=!1,this.onCanvasResize=function(e){var t=r._hasZeroSize!==e;r._hasZeroSize=e,e?r._layout.maxX&&r._layout.maxY||r.resizeToCanvas():t&&r.resizeDrawingSurfaceToCanvas()},this.renderSecondTimer=0,this._boundDraw=this.draw.bind(this),this.canvas=e.canvas,e.canvas.constructor===HTMLCanvasElement&&(this._observed=z.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=null!==(t=e.layout)&&void 0!==t?t:new _,this.shouldDisableRiveListeners=!!e.shouldDisableRiveListeners,this.isTouchScrollEnabled=!!e.isTouchScrollEnabled,this.automaticallyHandleEvents=!!e.automaticallyHandleEvents,this.dispatchPointerExit=!1===e.dispatchPointerExit?e.dispatchPointerExit:this.dispatchPointerExit,this.enableMultiTouch=!!e.enableMultiTouch,this.drawOptimization=null!==(n=e.drawingOptions)&&void 0!==n?n:this.drawOptimization,this.enableRiveAssetCDN=void 0===e.enableRiveAssetCDN||e.enableRiveAssetCDN,this.eventManager=new D,e.onLoad&&this.on(x.Load,e.onLoad),e.onLoadError&&this.on(x.LoadError,e.onLoadError),e.onPlay&&this.on(x.Play,e.onPlay),e.onPause&&this.on(x.Pause,e.onPause),e.onStop&&this.on(x.Stop,e.onStop),e.onLoop&&this.on(x.Loop,e.onLoop),e.onStateChange&&this.on(x.StateChange,e.onStateChange),e.onAdvance&&this.on(x.Advance,e.onAdvance),e.onload&&!e.onLoad&&this.on(x.Load,e.onload),e.onloaderror&&!e.onLoadError&&this.on(x.LoadError,e.onloaderror),e.onplay&&!e.onPlay&&this.on(x.Play,e.onplay),e.onpause&&!e.onPause&&this.on(x.Pause,e.onpause),e.onstop&&!e.onStop&&this.on(x.Stop,e.onstop),e.onloop&&!e.onLoop&&this.on(x.Loop,e.onloop),e.onstatechange&&!e.onStateChange&&this.on(x.StateChange,e.onstatechange),e.assetLoader&&(this.assetLoader=e.assetLoader),this.taskQueue=new W(this.eventManager),this.init({src:this.src,buffer:this.buffer,riveFile:this.riveFile,autoplay:e.autoplay,autoBind:e.autoBind,animations:e.animations,stateMachines:e.stateMachines,artboard:e.artboard,useOffscreenRenderer:e.useOffscreenRenderer})}return Object.defineProperty(e.prototype,"viewModelCount",{get:function(){return this.file.viewModelCount()},enumerable:!1,configurable:!0}),e.new=function(t){return console.warn("This function is deprecated: please use `new Rive({})` instead"),new e(t)},e.prototype.onSystemAudioChanged=function(){this.volume=this._volume},e.prototype.init=function(t){var n=this,r=t.src,i=t.buffer,a=t.riveFile,o=t.animations,s=t.stateMachines,u=t.artboard,l=t.autoplay,c=void 0!==l&&l,d=t.useOffscreenRenderer,h=void 0!==d&&d,f=t.autoBind,p=void 0!==f&&f;if(!this.destroyed){if(this.src=r,this.buffer=i,this.riveFile=a,!this.src&&!this.buffer&&!this.riveFile)throw new b(e.missingErrorMessage);var m=se(o),v=se(s);this.loaded=!1,this.readyForPlaying=!1,A.awaitInstance().then(function(e){n.destroyed||(n.runtime=e,n.removeRiveListeners(),n.deleteRiveRenderer(),n.renderer=n.runtime.makeRenderer(n.canvas,h),n.canvas.width||n.canvas.height||n.resizeDrawingSurfaceToCanvas(),n.initData(u,m,v,c,p).then(function(e){if(e)return n.setupRiveListeners()}).catch(function(e){console.error(e)}))}).catch(function(e){console.error(e)})}},e.prototype.setupRiveListeners=function(e){var t=this;if(this.eventCleanup&&this.eventCleanup(),!this.shouldDisableRiveListeners){var n=(this.animator.stateMachines||[]).filter(function(e){return e.playing&&t.runtime.hasListeners(e.instance)}).map(function(e){return e.instance}),r=this.isTouchScrollEnabled,i=this.dispatchPointerExit,a=this.enableMultiTouch;e&&"isTouchScrollEnabled"in e&&(r=e.isTouchScrollEnabled),this.eventCleanup=(0,h.registerTouchInteractions)({canvas:this.canvas,artboard:this.artboard,stateMachines:n,renderer:this.renderer,rive:this.runtime,fit:this._layout.runtimeFit(this.runtime),alignment:this._layout.runtimeAlignment(this.runtime),isTouchScrollEnabled:r,dispatchPointerExit:i,enableMultiTouch:a,layoutScaleFactor:this._layout.layoutScaleFactor})}},e.prototype.removeRiveListeners=function(){this.eventCleanup&&(this.eventCleanup(),this.eventCleanup=null)},e.prototype.initializeAudio=function(){var e,t=this;U.status==O.UNAVAILABLE&&(null===(e=this.artboard)||void 0===e?void 0:e.hasAudio)&&null===this._audioEventListener&&(this._audioEventListener={type:x.AudioStatusChange,callback:function(){return t.onSystemAudioChanged()}},U.add(this._audioEventListener),U.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,i){return m(this,void 0,void 0,function(){var a,o,s,u;return v(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),null!=this.riveFile?[3,2]:(a=new Y({src:this.src,buffer:this.buffer,enableRiveAssetCDN:this.enableRiveAssetCDN,assetLoader:this.assetLoader}),this.riveFile=a,[4,a.init()]);case 1:if(l.sent(),this.destroyed)return a.destroyIfUnused(),[2,!1];l.label=2;case 2:return this.file=this.riveFile.getInstance(),this.initArtboard(e,t,n,r,i),this.initArtboardSize(),this.initializeAudio(),this.loaded=!0,this.eventManager.fire({type:x.Load,data:null!==(u=this.src)&&void 0!==u?u:"buffer"}),this.animator.advanceIfPaused(),this.readyForPlaying=!0,this.taskQueue.process(),this.drawFrame(),[2,!0];case 3:return o=l.sent(),s=(c=o)&&c.isHandledError?c.message:"Problem loading file; may be corrupt!",console.warn(s),this.eventManager.fire({type:x.LoadError,data:s}),[2,Promise.reject(s)];case 4:return[2]}var c})})},e.prototype.initArtboard=function(e,t,n,r,i){if(this.file){var a,o=e?this.file.artboardByName(e):this.file.defaultArtboard();if(!o){var s="Invalid artboard name or no default artboard";return console.warn(s),void this.eventManager.fire({type:x.LoadError,data:s})}if(this.artboard=o,o.volume=this._volume*U.systemVolume,this.animator=new F(this.runtime,this.artboard,this.eventManager),t.length>0||n.length>0?(a=t.concat(n),this.animator.initLinearAnimations(t,r),this.animator.initStateMachines(n,r)):a=[this.animator.atLeastOne(r,!1)],this.taskQueue.add({event:{type:r?x.Play:x.Pause,data:a}}),i){var u=this.file.defaultArtboardViewModel(o);if(null!==u){var l=u.defaultInstance();if(null!==l){var c=new q(l,null);(0,h.createFinalization)(c,c.runtimeInstance),this.bindViewModelInstance(c)}}}}},e.prototype.drawFrame=function(){var e,t;(null===(e=null===document||void 0===document?void 0:document.timeline)||void 0===e?void 0:e.currentTime)?this.loaded&&this.artboard&&!this.frameRequestId&&(this._boundDraw(document.timeline.currentTime),null===(t=this.runtime)||void 0===t||t.resolveAnimationFrame()):this.scheduleRendering()},e.prototype._canvasSizeChanged=function(){var e=!1;return this.canvas&&(this.canvas.width!==this._currentCanvasWidth&&(this._currentCanvasWidth=this.canvas.width,e=!0),this.canvas.height!==this._currentCanvasHeight&&(this._currentCanvasHeight=this.canvas.height,e=!0)),e},e.prototype.draw=function(e,t){var n;this.frameRequestId=null;var r=performance.now();this.lastRenderTime||(this.lastRenderTime=e),this.renderSecondTimer+=e-this.lastRenderTime,this.renderSecondTimer>5e3&&(this.renderSecondTimer=0,null==t||t());var i=(e-this.lastRenderTime)/1e3;this.lastRenderTime=e;for(var a=0,o=this.animator.animations.filter(function(e){return e.playing||e.needsScrub}).sort(function(e){return e.needsScrub?-1:1});a<o.length;a++){var u=o[a];u.advance(i),u.instance.didLoop&&(u.loopCount+=1),u.apply(1)}for(var l=0,c=this.animator.stateMachines.filter(function(e){return e.playing});l<c.length;l++){var d=c[l],f=d.reportedEventCount();if(f)for(var p=0;p<f;p++){var m=d.reportedEventAt(p);if(m)if(m.type===C.OpenUrl){if(this.eventManager.fire({type:x.RiveEvent,data:m}),this.automaticallyHandleEvents){var v=document.createElement("a"),g=m,b=g.url,y=g.target,w=(0,h.sanitizeUrl)(b);b&&v.setAttribute("href",w),y&&v.setAttribute("target",y),w&&w!==h.BLANK_URL&&v.click()}}else this.eventManager.fire({type:x.RiveEvent,data:m})}d.advanceAndApply(i)}0==this.animator.stateMachines.length&&this.artboard.advance(i);var _=this.renderer;this._hasZeroSize||(this.drawOptimization==s.AlwaysDraw||this.artboard.didChange()||this._needsRedraw||this._canvasSizeChanged())&&(_.clear(),_.save(),this.alignRenderer(),this.artboard.draw(_),_.restore(),_.flush(),this._needsRedraw=!1),this.animator.handleLooping(),this.animator.handleStateChanges(),this.animator.handleAdvancing(i),this.frameCount++;var A=performance.now();for(this.frameTimes.push(A),this.durations.push(A-r);this.frameTimes[0]<=A-1e3;)this.frameTimes.shift(),this.durations.shift();null===(n=this._viewModelInstance)||void 0===n||n.handleCallbacks(),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 0===this.durations.length?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;this.destroyed=!0,this.stopRendering(),this.cleanupInstances(),null!==this._observed&&z.remove(this._observed),this.removeRiveListeners(),this.file&&(null===(e=this.riveFile)||void 0===e||e.cleanup(),this.file=null),this.riveFile=null,this.deleteRiveRenderer(),null!==this._audioEventListener&&(U.remove(this._audioEventListener),this._audioEventListener=null),null===(t=this._viewModelInstance)||void 0===t||t.cleanup(),this._viewModelInstance=null,this._dataEnums=null},e.prototype.deleteRiveRenderer=function(){var e;null===(e=this.renderer)||void 0===e||e.delete(),this.renderer=null},e.prototype.cleanupInstances=function(){null!==this.eventCleanup&&this.eventCleanup(),this.stop(),this.artboard&&(this.artboard.delete(),this.artboard=null)},e.prototype.retrieveTextRun=function(e){var t;if(e)if(this.artboard){var n=this.artboard.textRun(e);if(n)return n;console.warn("Could not access a text run with name '".concat(e,"' in the '").concat(null===(t=this.artboard)||void 0===t?void 0:t.name,"' Artboard. Note that you must rename a text run node in the Rive editor to make it queryable at runtime."))}else console.warn("Tried to access text run, but the Artboard is null");else console.warn("No text run name provided")},e.prototype.getTextRunValue=function(e){var t=this.retrieveTextRun(e);return t?t.text:void 0},e.prototype.setTextRunValue=function(e,t){var n=this.retrieveTextRun(e);n&&(n.text=t)},e.prototype.play=function(e,t){var n=this;e=se(e),this.readyForPlaying?(this.animator.play(e),this.eventCleanup&&this.eventCleanup(),this.setupRiveListeners(),this.startRendering()):this.taskQueue.add({action:function(){return n.play(e,t)}})},e.prototype.pause=function(e){var t=this;e=se(e),this.readyForPlaying?(this.eventCleanup&&this.eventCleanup(),this.animator.pause(e)):this.taskQueue.add({action:function(){return t.pause(e)}})},e.prototype.scrub=function(e,t){var n=this;e=se(e),this.readyForPlaying?(this.animator.scrub(e,t||0),this.drawFrame()):this.taskQueue.add({action:function(){return n.scrub(e,t)}})},e.prototype.stop=function(e){var t=this;e=se(e),this.readyForPlaying?(this.animator&&this.animator.stop(e),this.eventCleanup&&this.eventCleanup()):this.taskQueue.add({action:function(){return t.stop(e)}})},e.prototype.reset=function(e){var t,n,r=null==e?void 0:e.artboard,i=se(null==e?void 0:e.animations),a=se(null==e?void 0:e.stateMachines),o=null!==(t=null==e?void 0:e.autoplay)&&void 0!==t&&t,s=null!==(n=null==e?void 0:e.autoBind)&&void 0!==n&&n;this.cleanupInstances(),this.initArtboard(r,i,a,o,s),this.taskQueue.process()},e.prototype.load=function(e){this.file=null,this.stop(),this.init(e)},Object.defineProperty(e.prototype,"layout",{get:function(){return this._layout},set:function(e){this._layout=e,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})},e.prototype.resizeDrawingSurfaceToCanvas=function(e){if(this.canvas instanceof HTMLCanvasElement&&window){var n=this.canvas.getBoundingClientRect(),r=n.width,i=n.height,a=e||window.devicePixelRatio||1;if(this.devicePixelRatioUsed=a,this.canvas.width=a*r,this.canvas.height=a*i,this._needsRedraw=!0,this.resizeToCanvas(),this.drawFrame(),this.layout.fit===t.Layout){var o=this._layout.layoutScaleFactor;this.artboard.width=r/o,this.artboard.height=i/o}}},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,"animationNames",{get:function(){if(!this.loaded||!this.artboard)return[];for(var e=[],t=0;t<this.artboard.animationCount();t++)e.push(this.artboard.animationByIndex(t).name);return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateMachineNames",{get:function(){if(!this.loaded||!this.artboard)return[];for(var e=[],t=0;t<this.artboard.stateMachineCount();t++)e.push(this.artboard.stateMachineByIndex(t).name);return e},enumerable:!1,configurable:!0}),e.prototype.stateMachineInputs=function(e){if(this.loaded){var t=this.animator.stateMachines.find(function(t){return t.name===e});return null==t?void 0:t.inputs}},e.prototype.retrieveInputAtPath=function(e,t){if(e)if(this.artboard){var n=this.artboard.inputByPath(e,t);if(n)return n;console.warn("Could not access an input with name: '".concat(e,"', at path:'").concat(t,"'"))}else console.warn("Tried to access input: '".concat(e,"', at path: '").concat(t,"', but the Artboard is null"));else console.warn("No input name provided for path '".concat(t,"'"))},e.prototype.setBooleanStateAtPath=function(e,t,n){var r=this.retrieveInputAtPath(e,n);r&&(r.type===y.Boolean?r.asBool().value=t:console.warn("Input with name: '".concat(e,"', at path:'").concat(n,"' is not a boolean")))},e.prototype.setNumberStateAtPath=function(e,t,n){var r=this.retrieveInputAtPath(e,n);r&&(r.type===y.Number?r.asNumber().value=t:console.warn("Input with name: '".concat(e,"', at path:'").concat(n,"' is not a number")))},e.prototype.fireStateAtPath=function(e,t){var n=this.retrieveInputAtPath(e,t);n&&(n.type===y.Trigger?n.asTrigger().fire():console.warn("Input with name: '".concat(e,"', at path:'").concat(t,"' is not a trigger")))},e.prototype.retrieveTextAtPath=function(e,t){if(e)if(t)if(this.artboard){var n=this.artboard.textByPath(e,t);if(n)return n;console.warn("Could not access text with name: '".concat(e,"', at path:'").concat(t,"'"))}else console.warn("Tried to access text: '".concat(e,"', at path: '").concat(t,"', but the Artboard is null"));else console.warn("No path provided for text '".concat(e,"'"));else console.warn("No text name provided for path '".concat(t,"'"))},e.prototype.getTextRunValueAtPath=function(e,t){var n=this.retrieveTextAtPath(e,t);if(n)return n.text;console.warn("Could not get text with name: '".concat(e,"', at path:'").concat(t,"'"))},e.prototype.setTextRunValueAtPath=function(e,t,n){var r=this.retrieveTextAtPath(e,n);r?r.text=t:console.warn("Could not set text with name: '".concat(e,"', at path:'").concat(n,"'"))},Object.defineProperty(e.prototype,"playingStateMachineNames",{get:function(){return this.loaded?this.animator.stateMachines.filter(function(e){return e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playingAnimationNames",{get:function(){return this.loaded?this.animator.animations.filter(function(e){return e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pausedAnimationNames",{get:function(){return this.loaded?this.animator.animations.filter(function(e){return!e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pausedStateMachineNames",{get:function(){return this.loaded?this.animator.stateMachines.filter(function(e){return!e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this.animator.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPaused",{get:function(){return this.animator.isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStopped",{get:function(){var e,t;return null===(t=null===(e=this.animator)||void 0===e?void 0:e.isStopped)||void 0===t||t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.artboard?this.artboard.bounds:void 0},enumerable:!1,configurable:!0}),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.unsubscribe=function(e,t){console.warn("This function is deprecated: please use `off()` instead."),this.off(e,t)},e.prototype.removeAllRiveEventListeners=function(e){this.eventManager.removeAll(e)},e.prototype.unsubscribeAll=function(e){console.warn("This function is deprecated: please use `removeAllRiveEventListeners()` instead."),this.removeAllRiveEventListeners(e)},e.prototype.stopRendering=function(){this.loaded&&this.frameRequestId&&(this.runtime.cancelAnimationFrame?this.runtime.cancelAnimationFrame(this.frameRequestId):cancelAnimationFrame(this.frameRequestId),this.frameRequestId=null)},e.prototype.startRendering=function(){this.drawFrame()},e.prototype.scheduleRendering=function(){this.loaded&&this.artboard&&!this.frameRequestId&&(this.runtime.requestAnimationFrame?this.frameRequestId=this.runtime.requestAnimationFrame(this._boundDraw):this.frameRequestId=requestAnimationFrame(this._boundDraw))},e.prototype.enableFPSCounter=function(e){this.runtime.enableFPSCounter(e)},e.prototype.disableFPSCounter=function(){this.runtime.disableFPSCounter()},Object.defineProperty(e.prototype,"contents",{get:function(){if(this.loaded){for(var e={artboards:[]},t=0;t<this.file.artboardCount();t++){for(var n=this.file.artboardByIndex(t),r={name:n.name,animations:[],stateMachines:[]},i=0;i<n.animationCount();i++){var a=n.animationByIndex(i);r.animations.push(a.name)}for(var o=0;o<n.stateMachineCount();o++){for(var s=n.stateMachineByIndex(o),u=s.name,l=new this.runtime.StateMachineInstance(s,n),c=[],d=0;d<l.inputCount();d++){var h=l.input(d);c.push({name:h.name,type:h.type})}r.stateMachines.push({name:u,inputs:c})}e.artboards.push(r)}return e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this.artboard&&this.artboard.volume!==this._volume&&(this._volume=this.artboard.volume),this._volume},set:function(e){this._volume=e,this.artboard&&(this.artboard.volume=e*U.systemVolume)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"artboardWidth",{get:function(){var e;return this.artboard?this.artboard.width:null!==(e=this._artboardWidth)&&void 0!==e?e:0},set:function(e){this._artboardWidth=e,this.artboard&&(this.artboard.width=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"artboardHeight",{get:function(){var e;return this.artboard?this.artboard.height:null!==(e=this._artboardHeight)&&void 0!==e?e:0},set:function(e){this._artboardHeight=e,this.artboard&&(this.artboard.height=e)},enumerable:!1,configurable:!0}),e.prototype.resetArtboardSize=function(){this.artboard?(this.artboard.resetArtboardSize(),this._artboardWidth=this.artboard.width,this._artboardHeight=this.artboard.height):(this._artboardWidth=void 0,this._artboardHeight=void 0)},Object.defineProperty(e.prototype,"devicePixelRatioUsed",{get:function(){return this._devicePixelRatioUsed},set:function(e){this._devicePixelRatioUsed=e},enumerable:!1,configurable:!0}),e.prototype.bindViewModelInstance=function(e){var t;this.artboard&&!this.destroyed&&e&&e.runtimeInstance&&(e.internalIncrementReferenceCount(),null===(t=this._viewModelInstance)||void 0===t||t.cleanup(),this._viewModelInstance=e,this.animator.stateMachines.length>0?this.animator.stateMachines.forEach(function(t){return t.bindViewModelInstance(e)}):this.artboard.bindViewModelInstance(e.runtimeInstance))},Object.defineProperty(e.prototype,"viewModelInstance",{get:function(){return this._viewModelInstance},enumerable:!1,configurable:!0}),e.prototype.viewModelByIndex=function(e){var t=this.file.viewModelByIndex(e);return null!==t?new X(t):null},e.prototype.viewModelByName=function(e){var t;return null===(t=this.riveFile)||void 0===t?void 0:t.viewModelByName(e)},e.prototype.enums=function(){return null===this._dataEnums&&(this._dataEnums=this.file.enums().map(function(e){return new G(e)})),this._dataEnums},e.prototype.defaultViewModel=function(){if(this.artboard){var e=this.file.defaultArtboardViewModel(this.artboard);if(e)return new X(e)}return null},e.prototype.getArtboard=function(e){var t,n;return null!==(n=null===(t=this.riveFile)||void 0===t?void 0:t.getArtboard(e))&&void 0!==n?n:null},e.prototype.getBindableArtboard=function(e){var t,n;return null!==(n=null===(t=this.riveFile)||void 0===t?void 0:t.getBindableArtboard(e))&&void 0!==n?n:null},e.prototype.getDefaultBindableArtboard=function(){var e,t;return null!==(t=null===(e=this.riveFile)||void 0===e?void 0:e.getDefaultBindableArtboard())&&void 0!==t?t:null},e.missingErrorMessage="Rive source file or data buffer required",e.cleanupErrorMessage="Attempt to use file after calling cleanup.",e}(),X=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(null!==t){var n=new q(t,null);return(0,h.createFinalization)(n,t),n}return null},e.prototype.instanceByName=function(e){var t=this._viewModel.instanceByName(e);if(null!==t){var n=new q(t,null);return(0,h.createFinalization)(n,t),n}return null},e.prototype.defaultInstance=function(){var e=this._viewModel.defaultInstance();if(null!==e){var t=new q(e,null);return(0,h.createFinalization)(t,e),t}return null},e.prototype.instance=function(){var e=this._viewModel.instance();if(null!==e){var t=new q(e,null);return(0,h.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}(),G=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}();(V=B||(B={})).Number="number",V.String="string",V.Boolean="boolean",V.Color="color",V.Trigger="trigger",V.Enum="enum",V.List="list",V.Image="image",V.Artboard="artboard";var q=function(){function e(e,t){this._parents=[],this._children=[],this._viewModelInstances=/* @__PURE__ */new Map,this._propertiesWithCallbacks=[],this._referenceCount=0,this.selfUnref=!1,this._runtimeInstance=e,null!==t&&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(){0!==this._propertiesWithCallbacks.length&&(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);-1!==t&&(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}),0===this._children.length&&0===this._propertiesWithCallbacks.length&&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}),0===this._children.length&&0===this._propertiesWithCallbacks.length&&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 null!==n?t==e.length-1?n:n.viewModelFromPathSegments(e,t++):null},e.prototype.propertyFromPathSegments=function(e,t,n){var r,i,a,o,s,u,l,c,d,h,f,p,m,v,g,b,y,w;if(t<e.length-1){var _=this.internalViewModelInstance(e[t]);return null!==_?_.propertyFromPathSegments(e,t+1,n):null}var A=null;switch(n){case B.Number:if(null!==(A=null!==(i=null===(r=this._runtimeInstance)||void 0===r?void 0:r.number(e[t]))&&void 0!==i?i:null))return new Q(A,this);break;case B.String:if(null!==(A=null!==(o=null===(a=this._runtimeInstance)||void 0===a?void 0:a.string(e[t]))&&void 0!==o?o:null))return new J(A,this);break;case B.Boolean:if(null!==(A=null!==(u=null===(s=this._runtimeInstance)||void 0===s?void 0:s.boolean(e[t]))&&void 0!==u?u:null))return new Z(A,this);break;case B.Color:if(null!==(A=null!==(c=null===(l=this._runtimeInstance)||void 0===l?void 0:l.color(e[t]))&&void 0!==c?c:null))return new re(A,this);break;case B.Trigger:if(null!==(A=null!==(h=null===(d=this._runtimeInstance)||void 0===d?void 0:d.trigger(e[t]))&&void 0!==h?h:null))return new ee(A,this);break;case B.Enum:if(null!==(A=null!==(p=null===(f=this._runtimeInstance)||void 0===f?void 0:f.enum(e[t]))&&void 0!==p?p:null))return new te(A,this);break;case B.List:if(null!==(A=null!==(v=null===(m=this._runtimeInstance)||void 0===m?void 0:m.list(e[t]))&&void 0!==v?v:null))return new ne(A,this);break;case B.Image:if(null!==(A=null!==(b=null===(g=this._runtimeInstance)||void 0===g?void 0:g.image(e[t]))&&void 0!==b?b:null))return new ie(A,this);break;case B.Artboard:if(null!==(A=null!==(w=null===(y=this._runtimeInstance)||void 0===y?void 0:y.artboard(e[t]))&&void 0!==w?w:null))return new ae(A,this)}return null},e.prototype.internalViewModelInstance=function(t){var n;if(this._viewModelInstances.has(t))return this._viewModelInstances.get(t);var r=null===(n=this._runtimeInstance)||void 0===n?void 0:n.viewModel(t);if(null!==r){var i=new e(r,this);return(0,h.createFinalization)(i,r),i.internalIncrementReferenceCount(),this._viewModelInstances.set(t,i),i}return null},e.prototype.number=function(e){return this.propertyFromPath(e,B.Number)},e.prototype.string=function(e){return this.propertyFromPath(e,B.String)},e.prototype.boolean=function(e){return this.propertyFromPath(e,B.Boolean)},e.prototype.color=function(e){return this.propertyFromPath(e,B.Color)},e.prototype.trigger=function(e){return this.propertyFromPath(e,B.Trigger)},e.prototype.enum=function(e){return this.propertyFromPath(e,B.Enum)},e.prototype.list=function(e){return this.propertyFromPath(e,B.List)},e.prototype.image=function(e){return this.propertyFromPath(e,B.Image)},e.prototype.artboard=function(e){return this.propertyFromPath(e,B.Artboard)},e.prototype.viewModel=function(e){var t=e.split("/"),n=t.length>1?this.viewModelFromPathSegments(t.slice(0,t.length-1),0):this;return null!=n?n.internalViewModelInstance(t[t.length-1]):null},e.prototype.internalReplaceViewModel=function(e,t){var n;if(null!==t.runtimeInstance){var r=(null===(n=this._runtimeInstance)||void 0===n?void 0:n.replaceViewModel(e,t.runtimeInstance))||!1;if(r){t.internalIncrementReferenceCount();var i=this.internalViewModelInstance(e);null!==i&&(i.removeParent(this),this._children.includes(i)&&(this._children=this._children.filter(function(e){return e!==i})),i.cleanup()),this._viewModelInstances.set(e,t),t.addParent(this)}return r}return!1},e.prototype.replaceViewModel=function(e,t){var n,r=e.split("/"),i=r.length>1?this.viewModelFromPathSegments(r.slice(0,r.length-1),0):this;return null!==(n=null==i?void 0:i.internalReplaceViewModel(r[r.length-1],t))&&void 0!==n&&n},e.prototype.incrementReferenceCount=function(){var e;this._referenceCount++,null===(e=this._runtimeInstance)||void 0===e||e.incrementReferenceCount()},e.prototype.decrementReferenceCount=function(){var e;this._referenceCount--,null===(e=this._runtimeInstance)||void 0===e||e.decrementReferenceCount()},Object.defineProperty(e.prototype,"properties",{get:function(){var e;return(null===(e=this._runtimeInstance)||void 0===e?void 0:e.getProperties().map(function(e){return p({},e)}))||[]},enumerable:!1,configurable:!0}),e.prototype.internalIncrementReferenceCount=function(){this._referenceCount++},e.prototype.cleanup=function(){var e,t=this;if(this._referenceCount--,this._referenceCount<=0){this.selfUnref&&(null===(e=this._runtimeInstance)||void 0===e||e.unref()),this._runtimeInstance=null,this.clearCallbacks(),this._propertiesWithCallbacks=[],this._viewModelInstances.forEach(function(e){e.cleanup()}),this._viewModelInstances.clear();var n=g([],this._children,!0);this._children.length=0;var r=g([],this._parents,!0);this._parents.length=0,n.forEach(function(e){e.removeParent(t)}),r.forEach(function(e){e.removeFromViewModelCallbacks(t)})}},e}(),K=function(){function e(e,t){this.callbacks=[],this._viewModelInstanceValue=e,this._parentViewModel=t}return e.prototype.on=function(e){0===this.callbacks.length&&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,0===this.callbacks.length&&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}(),J=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),Q=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),Z=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),ee=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),t.prototype.trigger=function(){return this._viewModelInstanceValue.trigger()},t.prototype.internalHandleCallback=function(e){e()},t}(K),te=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),ne=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),Object.defineProperty(t.prototype,"length",{get:function(){return this._viewModelInstanceValue.size},enumerable:!1,configurable:!0}),t.prototype.addInstance=function(e){null!=e.runtimeInstance&&(this._viewModelInstanceValue.addInstance(e.runtimeInstance),e.addParent(this._parentViewModel))},t.prototype.addInstanceAt=function(e,t){return!(null==e.runtimeInstance||!this._viewModelInstanceValue.addInstanceAt(e.runtimeInstance,t)||(e.addParent(this._parentViewModel),0))},t.prototype.removeInstance=function(e){null!=e.runtimeInstance&&(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(null!=t){var n=new q(t,this._parentViewModel);return(0,h.createFinalization)(n,t),n}return null},t.prototype.swap=function(e,t){this._viewModelInstanceValue.swap(e,t)},t.prototype.internalHandleCallback=function(e){e()},t}(K),re=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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(255*Math.max(0,Math.min(1,e))))},t.prototype.internalHandleCallback=function(e){e(this.value)},t}(K),ie=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),Object.defineProperty(t.prototype,"value",{set:function(e){var t;this._viewModelInstanceValue.value(null!==(t=null==e?void 0:e.nativeImage)&&void 0!==t?t:null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(K),ae=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),Object.defineProperty(t.prototype,"value",{set:function(e){var t,n,r;r=e.isBindableArtboard?e:e.file.internalBindableArtboardFromArtboard(e.nativeArtboard),this._viewModelInstanceValue.value(null!==(t=null==r?void 0:r.nativeArtboard)&&void 0!==t?t:null),(null==r?void 0:r.nativeViewModel)&&this._viewModelInstanceValue.viewModelInstance(null!==(n=null==r?void 0:r.nativeViewModel)&&void 0!==n?n:null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(K),oe=function(e){return m(void 0,void 0,void 0,function(){var t;return v(this,function(n){switch(n.label){case 0:return t=new Request(e),[4,fetch(t)];case 1:return[4,n.sent().arrayBuffer()];case 2:return[2,n.sent()]}})})},se=function(e){return"string"==typeof e?[e]:e instanceof Array?e:[]},ue={EventManager:D,TaskQueueManager:W},le=function(e){return m(void 0,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:return[4,new Promise(function(t){return A.getInstance(function(n){n.decodeAudio(e,t)})})];case 1:return t=r.sent(),n=new h.AudioWrapper(t),h.finalizationRegistry.register(n,t),[2,n]}})})},ce=function(e){return m(void 0,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:return[4,new Promise(function(t){return A.getInstance(function(n){n.decodeImage(e,t)})})];case 1:return t=r.sent(),n=new h.ImageWrapper(t),h.finalizationRegistry.register(n,t),[2,n]}})})},de=function(e){return m(void 0,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:return[4,new Promise(function(t){return A.getInstance(function(n){n.decodeFont(e,t)})})];case 1:return t=r.sent(),n=new h.FontWrapper(t),h.finalizationRegistry.register(n,t),[2,n]}})})}})(),r})(),"object"==typeof e&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof e?e.rive=r():n.rive=r()}})(),ee=i((e,t)=>{const{value:n,variableObj:i,onLoad:a,...s}=e,{id:u,width:c,height:d,url:h,stateMachine:p,artboard:m,inputs:v=[],x:g,y:b}=n,y=l(null),w=l(new OffscreenCanvas(c,d)),_=l({}),[A,E]=r.useState(!1),M=l(null),x=l(/* @__PURE__ */new Map);return o(()=>{if(!t)return;if(!w.current)return;const e=new Z.Rive({src:h,canvas:w.current,stateMachines:p,artboard:m,autoplay:!1,autoBind:!0,layout:new Z.Layout({fit:Z.Fit.Contain,alignment:Z.Alignment.TopLeft}),onLoad:()=>{a?.(),e.resizeToCanvas(),"function"!=typeof t&&t.current?.getLayer()?.batchDraw(),M.current=e.viewModelInstance,E(!0)}});y.current=e;const n=x.current;return()=>{console.log("cleanup rive instance",u),e.cleanup(),y.current=null,n?.clear(),E(!1)}},[h,p,u,m,t,a,w]),o(()=>{const e=M.current,t=x.current;A&&e&&t&&v&&0!==v.length&&v.forEach(({name:n,type:r,value:i,bindName:a})=>{switch(r){case"number":{let i=t.get(n)?.vmv;if(!i){const o=e.number(n);if(!o)return;i=o,t.set(n,{type:r,bindName:a,vmv:i,update:e=>{i.value=e}})}}break;case"boolean":{let i=t.get(n)?.vmv;if(!i){const o=e.boolean(n);if(!o)return;i=o,t.set(n,{type:r,bindName:a,vmv:i,update:e=>{i.value=e}})}}break;case"color":{let i=t.get(n)?.vmv;if(!i){const o=e.color(n);if(!o)return;i=o,t.set(n,{type:r,bindName:a,vmv:i,update:e=>{i.value=e}})}}break;default:G(r)}_.current[n]=i})},[v,A]),o(()=>{w.current&&y.current&&(w.current.width=c,w.current.height=d,y.current.resizeToCanvas(),y.current.drawFrame())},[c,d]),o(()=>{A&&x.current.forEach(e=>{const{bindName:t,update:n}=e;if(!t)return;const r=i[t];void 0!==r&&n(r)})},[A,i]),/* @__PURE__ */C(f,{ref:t,image:w.current,width:c,height:d,x:g,y:b,...s})}),te=i((e,t)=>{const{x:n=0,y:r=0,width:i,height:a,onLoad:s,value:l,...c}=e,{url:d,playbackRate:h=1,loop:p=!0}=l,m=u(()=>{const e=document.createElement("video");return e.muted=!0,e},[]);return o(()=>{m.src!==d&&(m.src=d,m.load()),m.loop=p,m.playbackRate=h,s&&m.addEventListener("loadeddata",()=>{s(),"function"!=typeof t&&t?.current?.getLayer()?.batchDraw()},{once:!0});const e=m.play();void 0!==e&&e.catch(e=>{console.warn("Video play interrupted or failed:",e)})},[m,d,p,h,s,t]),o(()=>()=>{m.pause(),m.src="",m.load(),m.remove()},[m]),/* @__PURE__ */C(f,{ref:t,image:m,x:n,y:r,width:i,height:a,...c})}),ne=i((t,n)=>{const{x:r,y:i,width:a,height:s,screenId:u,name:l,fill:h,onLoad:p,...m}=t,[v,g]=c(void 0),b=12;return o(()=>{const t=new d.Stage({container:document.createElement("div"),width:a+24,height:s+24}),n=new d.Layer,r=new d.Group({x:b,y:b});n.listening(!1),t.add(n),n.add(r);const i=new d.Rect({x:0,y:0,width:a,height:s,fill:h}),o=new d.Rect({x:-12,y:-12,width:a+24,height:s+24,stroke:"#000",strokeWidth:6,dash:[4,4]}),l=new d.Text({x:0,y:0,width:a,height:s,text:u,fontSize:a/10,align:"center",verticalAlign:"middle",fill:e(h)});r.add(i,l,o),n.draw();const c=n.getCanvas()._canvas;createImageBitmap(c).then(e=>{g(e),t.destroy(),p&&p()})},[h,s,p,u,a]),/* @__PURE__ */C(f,{image:v,name:l,x:r-b,y:i-b,width:a+24,height:s+24,ref:n,...m})}),re=r.memo(e=>{const{shapeProps:t,onSelect:n,onChange:r,onDragStart:i,onDragEnd:o,onLoad:s,onMouseEnter:u,onMouseLeave:c,onShapeChange:d,...h}=e,f=l(null),p=a(()=>{s?.(t.type)},[s,t.type]),m={...h,onClick:e=>{!0!==e.target.attrs.lock&&(n?.(e),h.onClick?.(e))},onMouseEnter(e){u?.(e)},onMouseLeave(e){c?.(e)},onTap:e=>{!0===e.target.attrs.lock||e.evt.touches.length||n?.(e)},onTouchMove:e=>{e.evt.preventDefault()},ref:f,listening:(t.listening??!0)&&(t.visible??!0),...t,onDragStart:e=>{i&&(e.cancelBubble=!0,i(e))},onDragEnd:e=>{o&&o(e),r?.({...t,x:Math.round(e.target.x()),y:Math.round(e.target.y())})},onTransformEnd:()=>{const e=f.current;if(!e)return;const n=e.scaleX(),i=e.scaleY();e.skew({x:0,y:0}),e.scaleX(n>=0?1:-1),e.scaleY(i>=0?1:-1);const a={...t,x:Math.round(e.x()),y:Math.round(e.y()),scaleX:n>=0?1:-1,scaleY:i>=0?1:-1,rotation:e.rotation()},o=t.type;switch(o){case H.TEXT:Object.assign(a,{width:Math.round(e.width())});break;case H.SVG:case H.QR_CODE:case H.BAR_CODE:case H.IMAGE:case H.RIVE:case H.VIDEO:case H.RECT:case H.BACK_SCREEN:Object.assign(a,{width:Math.round(Math.max(.1,e.width()*Math.abs(n))),height:Math.round(Math.max(.1,e.height()*Math.abs(i)))});break;default:G(o)}r?.(a)}};let g;const b=t.type;switch(b){case H.IMAGE:g=/* @__PURE__ */C(K,{...m,onLoad:p,url:t.imageSource});break;case H.RIVE:g=/* @__PURE__ */C(ee,{...m,onLoad:p,value:t,variableObj:t.variableObj});break;case H.SVG:g=/* @__PURE__ */C(Q,{...m,url:t.url,colors:t.colors,onLoad:p});break;case H.BAR_CODE:g=/* @__PURE__ */C(J,{value:t,onLoad:p,onShapeChange:d,...m});break;case H.QR_CODE:g=/* @__PURE__ */C(q,{value:t,onLoad:p,onShapeChange:d,...m});break;case H.TEXT:g=/* @__PURE__ */C(y,{...m,wrap:"none",height:void 0,width:void 0}),p();break;case H.RECT:g=/* @__PURE__ */C(v,{...m}),p();break;case H.VIDEO:g=/* @__PURE__ */C(te,{value:t,onLoad:p,...m});break;case H.BACK_SCREEN:g=/* @__PURE__ */C(ne,{...m}),p();break;default:p(),G(b)}return g}),ie=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],ae=({stageIns:e,selectedShapeIds:t,rotateEnabled:n=!0,onTransformEnd:r,onDragEnd:i,shaleSelector:a,enabledAnchor:s,...u})=>{const c=l(null);function h(e){c.current?.enabledAnchors(e),ie=e}return o(()=>{if(!e)return;!function(){if(t?.length)if(1===t.length){const n=e?.findOne(`#${t[0]}`),r=n?.attrs.type;if("c2"===n?.attrs.name)h([]);else switch(r){case H.TEXT:case H.BACK_SCREEN:h([]);break;case H.QR_CODE:case H.RIVE:case H.VIDEO:h(["top-left","top-right","bottom-left","bottom-right"]);break;case H.IMAGE:case H.SVG:case H.BAR_CODE:case H.RECT:h(["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"]);break;case void 0:break;default:G(r)}}else t.map(t=>e?.findOne(`#${t}`)).every(e=>"c2"===e?.attrs.name)?h([]):h(["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"]);s&&h(s)}();const n=e.find(a);if(n.forEach(e=>{e.draggable(t?.includes(e.id())||!1)}),t?.length){const e=n.filter(e=>t?.includes(e.id())||!1);c.current.nodes(e),c.current.getLayer().batchDraw()}else c.current.nodes([]);const r=c.current?.getClientRect();r?.width&&0!==r.width&&(r.width-9<30||r.height-25<30)&&(c.current?.enabledAnchors().length||0)>4&&c.current?.enabledAnchors(["top-left","top-right","bottom-left","bottom-right"])},[t,e]),/* @__PURE__ */C(w,{ref:c,keepRatio:!0,rotateEnabled:n,padding:0,onTransformEnd:r,onDragEnd:i,rotateAnchorOffset:18,rotationSnaps:[0,90,180,270],anchorFill:X.active,borderStroke:X.active,anchorSize:8,anchorCornerRadius:0,boundBoxFunc:(e,t)=>{const[n]=c.current.nodes();return 1===c.current.nodes().length||n instanceof d.Text||(ie.length>4&&(t.width<30||t.height<30)?c.current?.enabledAnchors(["top-left","top-right","bottom-left","bottom-right"]):c.current?.enabledAnchors(["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"])),t},...u})},oe=({children:e,onClick:t,icon:n,danger:r=!1,disabled:i=!1,style:a,...o})=>/* @__PURE__ */E("div",{style:{display:"flex",alignItems:"center",padding:"6px 12px",cursor:i?"not-allowed":"pointer",borderRadius:"4px",margin:"2px 4px",color:i?"#bfbfbf":r?"#ff4d4f":"#333",fontSize:"13px",opacity:i?.6:1,...a},onMouseEnter:e=>{i||(e.currentTarget.style.backgroundColor="#f5f5f5")},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},onClick:i?void 0:t,...o,children:[n&&/* @__PURE__ */C("span",{style:{marginRight:"8px",display:"flex",alignItems:"center"},children:n}),e]}),se=(e,t,n)=>{const r=[...e];if(t===n)return r;const[i]=r.splice(t,1);return r.splice(n,0,i),r},ue=({type:e})=>/* @__PURE__ */C("span",{style:{fontSize:"14px"},children:{"move-top":"⬆️","move-up":"🔼","move-down":"🔽","move-bottom":"⬇️",lock:"🔒",unlock:"🔓",copy:"📋",hide:"👁️",delete:"🗑️"}[e]||"•"}),le=({target:e,shapeList:t,closeMenu:n,onUpdateShapeList:r,onSetSelectedIds:i,onDeleteShape:a,onDuplicateShape:o,...s})=>{const u=t.find(t=>t.id===e.id()),l=!0===u?.lock;/* @__PURE__ */
2
- return E("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",minWidth:"120px"},...s,children:[
3
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"move-top"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);e!==t.length-1&&r(se(t,e,t.length-1))},disabled:l,children:"置顶"}),
4
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"move-up"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);e!==t.length-1&&r(se(t,e,e+1))},disabled:l,children:"上移一层"}),
5
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"move-down"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);0!==e&&r(se(t,e,e-1))},disabled:l,children:"下移一层"}),
6
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"move-bottom"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);0!==e&&r(se(t,e,0))},disabled:l,children:"置底"}),
7
- /* @__PURE__ */C("div",{style:{height:"1px",background:"#e8e8e8",margin:"4px 8px"}}),
8
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:u?.lock?"unlock":"lock"}),onClick:function(){if(n(),!u)return;const e=t.map(e=>e.id===u.id?{...e,lock:!e.lock}:e);i(u.lock?[u.id]:[]),r(e)},children:u?.lock?"解锁":"锁定"}),
9
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"copy"}),onClick:function(){n(),u&&o(u)},disabled:l,children:"复制"}),
10
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"hide"}),onClick:function(){if(n(),!u)return;const e=t.map(e=>e.id===u.id?{...e,visible:!e.visible}:e);i([]),r(e)},disabled:l,children:!1===u?.visible?"显示":"隐藏"}),
11
- /* @__PURE__ */C("div",{style:{height:"1px",background:"#e8e8e8",margin:"4px 8px"}}),
12
- /* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ue,{type:"delete"}),onClick:function(){n(),u&&a(u.id)},danger:!0,disabled:l,children:"删除"})]})},ce=({type:e})=>/* @__PURE__ */C("span",{style:{fontSize:"14px"},children:{lock:"🔒",unlock:"🔓",delete:"🗑️"}[e]||"•"}),de=({target:e,closeMenu:t,...n})=>{if(!e)return null;const r=!e.draggable();/* @__PURE__ */
13
- return E("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",minWidth:"100px"},...n,children:[/* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ce,{type:r?"unlock":"lock"}),onClick:function(){t(),e&&e.draggable(!e.draggable())},children:r?"解锁辅助线":"锁定辅助线"}),/* @__PURE__ */C(oe,{icon:/* @__PURE__ */C(ce,{type:"delete"}),onClick:function(){t(),e&&(e.destroy(),e.getStage()?.batchDraw())},danger:!0,children:"删除辅助线"})]})},he=i(({children:e,containerWidth:t=window.innerWidth,containerHeight:n=window.innerHeight},r)=>{const i=l(null),[a,u]=c({top:-99999,left:-99999}),[d,h]=c(!1);return s(r,()=>({show:e=>{h(!0),setTimeout(()=>{if(!i.current)return;const r=i.current.offsetHeight,a=i.current.offsetWidth;let{x:o,y:s}=e;s+r>n&&(s=n-r-10),o+a>t&&(o=t-a-10),u({top:s,left:o})},0)},close:()=>{h(!1),u({top:-99999,left:-99999})}})),o(()=>{if(!d)return;const e=e=>{i.current&&!i.current.contains(e.target)&&(h(!1),u({top:-99999,left:-99999}))},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[d]),/* @__PURE__ */C("div",{ref:i,style:{position:"absolute",top:a.top,left:a.left,zIndex:1e3,background:"#fff",borderRadius:"6px",boxShadow:"0 3px 12px rgba(0, 0, 0, 0.15)",border:"1px solid #e8e8e8",visibility:d?"visible":"hidden"},children:e})});he.displayName="ContextMenu";var fe=he;function pe(e){return"Stage"===e.getClassName()}function me(e){return"cb"===e.attrs.name}function ve(e){return t()?e.metaKey:e.ctrlKey}var ge=({stageIns:e,selectedShapeIds:t,shapeList:n,callbacks:r})=>{const i=l([]),a=l(null),[s,u]=c(null);o(()=>{i.current=[...t]},[t]);const d=l({movement:!1,movementX:0,movementY:0,keySpace:!1,transform:!1,selectTarget:!1,downOnStage:!1,downOnShape:null});function h(t){e&&(e.container().style.cursor=t)}function f(e){d.current.downOnStage=!0,d.current.downOnShape=e.target,1===e.evt.buttons&&(d.current.transform=e.target.name().includes("_anchor")||e.target.name().includes("help-line"),d.current.selectTarget=i.current.includes(e.target.attrs.id))}function p(e){const{target:t}=e;"cd"!==t.name()?"ce"!==t.name()?(me(t)?t.draggable()?h(t.attrs.vertical?"col-resize":"row-resize"):h("no-drop"):!0===t.attrs.lock?h("no-drop"):(pe(t),h("unset")),d.current.downOnStage&&(0===e.evt.movementX&&0===e.evt.movementX||(d.current.movement=!0,d.current.movementX+=e.evt.movementX,d.current.movementY+=e.evt.movementY))):h("row-resize"):h("col-resize")}function m(e){switch(e.evt.button){case 0:if(!d.current.movement&&!d.current.transform){if(e.target.attrs.lock)break;const t=e.target.id()?e.target:e.target.getParent();if(!t){i.current=[],r.onSetActiveShapeIds([]);break}const n=t.id();switch(t.name()){case"c1":i.current.includes(n)&&ve(e.evt)?(i.current.splice(i.current.indexOf(n),1),r.onRemoveActiveShapeId(n)):!i.current.includes(n)&&ve(e.evt)?(i.current.push(n),r.onAddActiveShapeId(n)):i.current.includes(n)||ve(e.evt)||(i.current=[n],r.onSetActiveShapeIds([n]));break;case"c2":i.current=[n],r.onSetActiveShapeIds([n]);break;default:i.current=[],r.onSetActiveShapeIds([])}}}d.current.movement&&(d.current.movement=!1,d.current.movementX=0,d.current.movementY=0),d.current.downOnStage=!1,h("default")}function v(){d.current.movement&&(d.current.movement=!1,d.current.movementX=0,d.current.movementY=0),d.current.downOnStage=!1}function g(){a.current?.close()}function b(t){t.evt.preventDefault();const{target:o}=t;pe(o)||me(o)||!0===o.attrs.lock||(i.current=[o.id()],r.onSetActiveShapeIds([o.id()]));const s=e.getPointerPosition();if(me(o))return u(/* @__PURE__ */C(de,{target:o,closeMenu:g})),void a.current?.show(s);"c1"===o.name()&&(u(/* @__PURE__ */C(le,{target:o,shapeList:n,closeMenu:g,onUpdateShapeList:r.onUpdateShapeList,onSetSelectedIds:r.onSetActiveShapeIds,onDeleteShape:r.onDeleteShape,onDuplicateShape:r.onDuplicateShape})),a.current?.show(s))}return o(()=>{if(!e)return;const t=e.container(),n=e=>{" "===e.key&&(d.current.keySpace=!0)},r=e=>{" "===e.key&&(d.current.keySpace=!1)};return t?.addEventListener("keydown",n),t?.addEventListener("keyup",r),e.on("dragstart",()=>h("grabbing")),e.on("dragend",()=>h("unset")),e.on("pointerdown",f),e.on("pointermove",p),e.on("pointerup",m),e.on("mouseleave",v),e.on("contextmenu",b),()=>{e.off("dragstart"),e.off("dragend"),e.off("pointerdown"),e.off("pointermove"),e.off("pointerup"),e.off("mouseleave"),e.off("contextmenu"),t?.removeEventListener("keydown",n),t?.removeEventListener("keyup",r)}},[e,n,r]),/* @__PURE__ */C(fe,{ref:a,containerWidth:e?.container()?.offsetWidth||window.innerWidth,containerHeight:e?.container()?.offsetHeight||window.innerHeight,children:s})};function be(e,t,n){const r=e.total||("H"===t?20:15),i={x:-e.x/e.scale,y:-e.y/e.scale,width:e.width/e.scale-e.x/e.scale,height:e.height/e.scale-e.y/e.scale},a="H"===t?e.x:e.y,o="H"===t?e.width:e.height,s="H"===t?i.x:i.y,u="H"===t?i.width:i.height;let l=`M${i.x},${i.y} ${t.toLowerCase()}${u-s}`,c=Math.round(o/r/e.scale);n?c=n:c>100*e.ppmm?c-=c%(100*e.ppmm):c>10*e.ppmm?c-=c%(10*e.ppmm):c>5*e.ppmm?c-=c%(5*e.ppmm):c-=c%(2*e.ppmm),c||=1*e.ppmm;const d=(-1*a+e.strokeWidth)/e.scale-(-1*a+e.strokeWidth)/e.scale%c,h=Math.floor(o/e.scale/c),f=[];for(let p=0;p<h;p++){const n=d+p*c;if(n>s+e.strokeWidth/e.scale){const r=n%(5*c)?1:2;"H"===t?(l+=`M${n},${i.y} v${10/e.scale*r}`,f.push({label:String(Math.round(n/e.ppmm)),tickMarkScale:r,x:n,y:i.y})):(l+=`M${i.x},${n} h${10/e.scale*r} `,f.push({label:String(Math.round(n/e.ppmm)),tickMarkScale:r,y:n,x:i.x}))}}return{path:l,nodes:f,interval:c,rect:i}}function ye(e,t=1){switch(e){case"dash1":return[1,3*t];case"dash2":return[5*t,5*t];default:return[]}}var we={name:"cc",stroke:"#ffc400",strokeWidth:1},_e={shiftKey:!1,currentPpmm:1},Ae=r.forwardRef(({stageIns:e,hideRuler:t=!1,currentPpmm:r=1,auxiliaryVisible:i=!0,auxiliaryData:u,auxiliaryLock:c=!1,globalAuxiliaryLineSettings:f,disableAuxiliary:b=!1},y)=>{const w=l(null),_=l(null),A=l(null),M=l(null),x=l(null),k=l(null),I=a(()=>{i&&e&&requestAnimationFrame(()=>{const t=e.find(e=>"cb"===e.attrs.name&&!0!==e.attrs.absolute),{x:n,y:r}=e.position();t.forEach(t=>{t.scale({x:1/e.scaleX(),y:1/e.scaleY()}),t.attrs.vertical?t.y((-r-e.offsetY())/e.scaleY()):t.x((-n-e.offsetX())/e.scaleX())})})},[i,e]),P=a(e=>{const{x:t,y:n}=e.getAbsolutePosition(),i=e.width(),a=e.height(),o=e.scaleX(),s=20,{path:u,nodes:l,interval:c,rect:d}=be({x:t,y:n,width:i,height:a,scale:o,strokeWidth:s,ppmm:r,total:Math.ceil(i/70)},"H"),{path:h,nodes:f}=be({x:t,y:n,width:i,height:a,scale:o,strokeWidth:s,ppmm:r,total:Math.ceil(a/70)},"V",c);k.current?.sceneFunc(e=>{e.fillStyle="#f2f3f5",e.fillRect(-t/o,-n/o,i/o,s/o),e.fillRect(-t/o,-n/o,s/o,a/o),e.fillStyle="#a0a0a0",e.font=12/o+"px sans-serif",l.forEach(t=>{e.fillText(t.label,t.x+5/o,t.y+15/o)}),f.forEach(t=>{e.save(),e.translate(t.x,t.y),e.rotate(90*Math.PI/180),e.fillText(t.label,5/o,-5/o),e.restore()}),e.fillStyle="#f2f3f5",e.fillRect(-t/o,-n/o,s/o,s/o),e.fillStyle="#a0a0a0",e.font=12/o+"px sans-serif",e.fillText(1===r?"Px":"mm",-t/o+3/o,-n/o+15/o)}),k.current?.drawScene(),M.current?.setAttrs({data:u,strokeWidth:1/o}),w.current?.setAttrs({x:d.x,y:d.y,width:d.width-d.x,height:s/o}),x.current?.setAttrs({data:h,strokeWidth:1/o}),_.current?.setAttrs({x:d.x,y:d.y,width:s/o,height:d.height-d.y}),I()},[r,I]),R=a((t=!0)=>{if(!e)return null;const n=f?.strokeWidth||1,r=n+8,i=ye(f?.dashType,n),a=new d.Line({name:"cb",points:t?[0,0,0,e.height()]:[0,0,e.width(),0],stroke:f?.color||"#00ffff",dash:i,absolute:!1,strokeWidth:n,hitStrokeWidth:r,draggable:!0,vertical:t,info:{dashType:f?.dashType,color:"default"}});return a.scale({x:1/e.scaleX(),y:1/e.scaleY()}),A.current?.add(a),a},[e,f]),S=a(t=>()=>{if(!i||!e)return;const n=R(t);if(!n)return;const r=e=>{requestAnimationFrame(()=>{const t=e.evt;n.attrs.vertical?n.absolutePosition({x:t.offsetX,y:0}):n.absolutePosition({x:0,y:t.offsetY}),n.visible(!0),t.preventDefault()})};n.dragBoundFunc(e=>n.attrs.vertical?{x:e.x,y:!0===n.attrs.absolute?e.y:0}:{x:!0===n.attrs.absolute?e.x:0,y:e.y}),e.on("pointermove",r);const a=()=>{e.off("pointermove",r),e.off("pointerup",a)};e.on("pointerup",a)},[i,e,R]),L=a(t=>{e&&A.current&&(t.forEach(t=>{let n;n=t.vertical?t.absolute?[0,0,0,t.length||e.height()]:[0,0,0,e.height()]:t.absolute?[0,0,t.length||e.width(),0]:[0,0,e.width(),0];const r=new d.Line({x:t.x,y:t.y,name:"cb",dash:ye(t.dashType),points:n,absolute:t.absolute,stroke:"default"===t.color?f?.color||"#00FFFF":t.color,strokeWidth:t.strokeWidth||1,hitStrokeWidth:(t.strokeWidth||1)+4,draggable:t.draggable,vertical:t.vertical,info:{color:t.color,length:t.length,dashType:t.dashType}});r.dragBoundFunc(e=>r.attrs.vertical?{x:e.x,y:!0===r.attrs.absolute?e.y:0}:{x:!0===r.attrs.absolute?e.x:0,y:e.y}),A.current?.add(r)}),I())},[e,f,I]);o(()=>{if(!e)return;const t=e=>{_e.shiftKey=e.shiftKey};return document.addEventListener("keydown",t),document.addEventListener("keyup",t),e.on("scaleChange",I),e.on("dragmove",I),()=>{document.removeEventListener("keydown",t),document.removeEventListener("keyup",t),e.off("scaleChange",I),e.off("dragmove",I)}},[e,I]),o(()=>{e&&P(e),_e.currentPpmm=r},[r,e,P]);const T=a(t=>{if(!e)return{vertical:[],horizontal:[]};const n=[],r=[],i=e.findOne(e=>"c5"===e.attrs.name),a=e.findOne(e=>"c7"===e.attrs.name);return i?.find(e=>["c1"].includes(e.attrs.name)).forEach(e=>{if(e.id()===t.id()||!e.isVisible())return;const i=e.getClientRect();n.push(i.x,i.x+i.width,i.x+i.width/2),r.push(i.y,i.y+i.height,i.y+i.height/2)}),a?.find(e=>["c2"].includes(e.attrs.name)).forEach(e=>{if(e.id()===t.id()||!e.isVisible())return;const i=e.getClientRect();n.push(i.x,i.x+i.width,i.x+i.width/2),r.push(i.y,i.y+i.height,i.y+i.height/2)}),A.current?.find(e=>["cb"].includes(e.attrs.name)).forEach(e=>{if(e.id()===t.id()||!e.isVisible())return;const i=e.getClientRect();n.push(i.x,i.x+i.width,i.x+i.width/2),r.push(i.y,i.y+i.height,i.y+i.height/2)}),{vertical:n,horizontal:r}},[e]),F=a(e=>{const t=e.getClientRect(),n=e.absolutePosition();return{vertical:[{guide:Math.round(t.x),offset:Math.round(n.x-t.x),snap:"start"},{guide:Math.round(t.x+t.width/2),offset:Math.round(n.x-t.x-t.width/2),snap:"center"},{guide:Math.round(t.x+t.width),offset:Math.round(n.x-t.x-t.width),snap:"end"}],horizontal:[{guide:Math.round(t.y),offset:Math.round(n.y-t.y),snap:"start"},{guide:Math.round(t.y+t.height/2),offset:Math.round(n.y-t.y-t.height/2),snap:"center"},{guide:Math.round(t.y+t.height),offset:Math.round(n.y-t.y-t.height),snap:"end"}]}},[]),O=a((e,t)=>{const n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{const r=Math.abs(e-t.guide);r<5&&n.push({lineGuide:e,diff:r,snap:t.snap,offset:t.offset})})}),e.horizontal.forEach(e=>{t.horizontal.forEach(t=>{const n=Math.abs(e-t.guide);n<5&&r.push({lineGuide:e,diff:n,snap:t.snap,offset:t.offset})})});const i=[],a=n.sort((e,t)=>e.diff-t.diff)[0],o=r.sort((e,t)=>e.diff-t.diff)[0];return a&&i.push({lineGuide:a.lineGuide,offset:a.offset,orientation:"V",snap:a.snap}),o&&i.push({lineGuide:o.lineGuide,offset:o.offset,orientation:"H",snap:o.snap}),i},[]),j=a(t=>{e&&t.forEach(t=>{if("H"===t.orientation){const n=new d.Line({...we,points:[0,0,e.width(),0]});n.scale({x:1/e.scaleX(),y:1/e.scaleY()}),A.current?.add(n),n.absolutePosition({x:0,y:t.lineGuide})}else{const n=new d.Line({...we,points:[0,0,0,e.height()]});n.scale({x:1/e.scaleX(),y:1/e.scaleY()}),A.current?.add(n),n.absolutePosition({x:t.lineGuide,y:0})}})},[e]),D=a(()=>{e&&e.find(e=>"cc"===e.attrs.name).forEach(e=>e.destroy())},[e]),W=a(e=>{D();const t=O(T(e.target),F(e.target));if(!t.length)return;j(t);const r=e.target.absolutePosition();t.forEach(e=>{switch(e.orientation){case"V":r.x=e.lineGuide+e.offset;break;case"H":r.y=e.lineGuide+e.offset;break;default:n(e.orientation)}}),e.target.absolutePosition(r)},[D,T,F,O,j]);return o(()=>{if(!e)return;P(e);const t=e.findOne(e=>"c5"===e.attrs.name);return t&&(t.on("dragmove",W),t.on("dragend",D)),()=>{t&&(t.off("dragmove",W),t.off("dragend",D))}},[e,P,W,D]),o(()=>{if(!e)return;const t=e.getContent(),n=new ResizeObserver(()=>{e&&(e.find(e=>"cb"===e.attrs.name&&!0!==e.attrs.absolute).forEach(t=>{t.attrs.vertical?t.points([0,0,0,e.height()]):t.points([0,0,e.width(),0])}),P(e))});return n.observe(t),()=>n.disconnect()},[e,P]),o(()=>{if(A.current&&u&&e)try{L(JSON.parse(u||"[]"))}catch(t){console.error("Failed to parse auxiliary data:",t)}},[u,e,L]),s(y,()=>({rulerReRender:P,calcHelpLine:I}),[P,I]),/* @__PURE__ */E(p,{name:"c9",listening:!0,draggable:!1,children:[
14
- /* @__PURE__ */C(h,{listening:!c,visible:Boolean(i),ref:A,id:"ca"}),
15
- /* @__PURE__ */E(h,{id:"rulerGroup",visible:!t,children:[
16
- /* @__PURE__ */C(g,{ref:k,stroke:"#666"}),
17
- /* @__PURE__ */C(m,{ref:M,stroke:"#a0a0a0",strokeWidth:1}),
18
- /* @__PURE__ */C(m,{ref:x,stroke:"#a0a0a0",strokeWidth:1})]}),
19
- /* @__PURE__ */C(v,{ref:w,visible:!b,onPointerDown:S(!1),name:"ce"}),
20
- /* @__PURE__ */C(v,{visible:!b,ref:_,onPointerDown:S(!0),name:"cd"})]})});Ae.displayName="AuxiliaryLines";var Ce=Ae;var Ee=function(e){return function(t){if(!e)return void console.error("Stage is not defined");t.evt.preventDefault();const n=e.scaleX(),r=e.getPointerPosition().x/n-e.x()/n,i=e.getPointerPosition().y/n-e.y()/n;let a=t.evt.deltaY>0?.9*n:1.1*n;a=Math.max(.125,a),a=Math.min(100,a),e.scale({x:a,y:a});const o={x:-(r-e.getPointerPosition().x/a)*a,y:-(i-e.getPointerPosition().y/a)*a};e.position(o)}},Me=!0;var xe=function(e){function t(t){try{" "===t.key&&(Me&&(e.container().style.cursor="grab",Me=!1),e.draggable(!0))}catch{}}function n(t){if(" "===t.key)try{e.draggable(!1),e.container().style.cursor="default",Me=!0}catch{}}return[function(){window.addEventListener("keydown",t),window.addEventListener("keyup",n)},function(){window.removeEventListener("keydown",t),window.removeEventListener("keyup",n)}]},ke=!1,Ie={x:0,y:0},Pe=!1;var Re=!0,Se=[];var Le=function(e,t,n){let r=[],i=0,a=0,o=1,s=0,u=-1;const l=[],c=[];function d(e,t){"keydown"===t?l.push(e):c.push(e)}function h(e){let t=0;l[t](e,function n(){t++,t<l.length&&l[t](e,n)})}function f(e){let t=0;c[t](e,function n(){t++,t<c.length&&c[t](e,n)})}function p(){return r.length||(r=e?.find(e=>t.some(t=>t.id===e.attrs.id))),r}const m=k(()=>{if(!p().length)return;const e=t.map(e=>{const t=p().find(t=>t.attrs.id===e.id)?.x(),n=p().find(t=>t.attrs.id===e.id)?.y();return{...e,x:t||e.x,y:n||e.y}});n.onSetShapes(e)},1200),v=e=>{p().length&&t.length&&(u=requestAnimationFrame(()=>{0!==i||0!==a?(p().forEach(e=>{e.setAttr("x",e.x()+i),e.setAttr("y",e.y()+a)}),e.shiftKey||e.altKey||(i=0,a=0),v(e),m()):u=-1}))},g=e.getContent();g.setAttribute("tabindex","2"),g.style.outline="none";const b=()=>{Re=!1},y=()=>{Re=!0};return d((e,t)=>{const n=["ArrowLeft","ArrowRight","f","h","s"];(e.ctrlKey||e.metaKey)&&n.includes(e.key)&&e.preventDefault(),t()},"keydown"),d((e,n)=>{if(t.length&&!Re){switch(e.altKey?o=2:e.shiftKey&&(o=5),e.key){case"ArrowUp":a=0,a-=o,e.preventDefault(),e.stopPropagation();break;case"ArrowDown":a=0,a+=o,e.preventDefault(),e.stopPropagation();break;case"ArrowLeft":i=0,i-=o,e.preventDefault(),e.stopPropagation();break;case"ArrowRight":i=0,i+=o,e.preventDefault(),e.stopPropagation();break;default:return void n()}u<0&&v(e)}else n()},"keydown"),d((r,i)=>{t?.length&&!Re&&"Backspace"===r.key?(r.preventDefault(),n.onRemoveShapes(t.map(e=>e.id)),n.onSetActiveShapeIds([]),Object.assign(e?.container().style??{},{cursor:"unset"})):i()},"keydown"),d((e,r)=>{(e.ctrlKey||e.metaKey)&&["c","v"].includes(e.key)&&t?.length&&!Re?"c"===e.key?s=0:(s++,Se=t.map(e=>({...e,id:I(),x:e.x+10*s,y:e.y+10*s})),n.onAddShapes(Se),n.onSetActiveShapeIds(Se.map(e=>e.id))):r()},"keydown"),d((e,t)=>{switch(e.key){case"ArrowUp":case"ArrowDown":a=0,e.preventDefault();break;case"ArrowLeft":case"ArrowRight":i=0,e.preventDefault();break;default:t()}},"keyup"),[function(){window.addEventListener("keydown",h),window.addEventListener("keyup",f),g.addEventListener("focus",b),g.addEventListener("blur",y)},function(){cancelAnimationFrame(u),window.removeEventListener("keydown",h),window.removeEventListener("keyup",f),g.removeEventListener("focus",b),g.removeEventListener("blur",y)}]};const Te={wrapper:{width:"100%",height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},container:{width:"100%",height:"100%",position:"relative",overflow:"hidden",backgroundColor:"#f5f5f5"},stage:{width:"100%",height:"100%"}};var Fe=({width:e,height:t,shapeList:n,bgShapeList:r,onSelectedShapeIdsChange:i,onShapeListChange:u,onBgShapeListChange:f,className:m="",backgroundType:v="grid",hideRuler:g=!1,ppmm:y=1,forwardedRef:w})=>{const _=l(null),A=l(null),M=l(null),[x,P]=c(null),[R,S]=c({width:e||800,height:t||600}),[L,T]=c([]),[F,O]=c([]),[j,D]=c([]),W=l([]),B=n??L,V=r??F,U=[...B,...V].filter(e=>j.includes(e.id)),N=a(e=>{void 0===n&&T(e),u?.(e)},[n,u]),$=a(e=>{void 0===r&&O(e),f?.(e)},[r,f]),z=a(e=>{D(e),W.current=e,i?.(e)},[i]),Y=a(e=>{N(B.map(t=>t.id===e.id?e:t))},[B,N]);o(()=>{if(!_.current)return;const e=_.current.findOne(".c5"),t=new d.Animation(()=>{},e);return t.start(),()=>{t.stop()}},[_]);const H=a(e=>{$(V.map(t=>t.id===e.id?e:t))},[V,$]),X=a(e=>{N([...B,...e])},[B,N]),G=a(e=>{$([...V,...e])},[V,$]),q=a(e=>{N(B.filter(t=>!e.includes(t.id)))},[B,N]),K=a(e=>{$(V.filter(t=>!e.includes(t.id)))},[V,$]),J=a(e=>{N(B.filter(t=>t.id!==e)),z(j.filter(t=>t!==e))},[B,N,j,z]),Q=a(e=>{$(V.filter(t=>t.id!==e)),z(j.filter(t=>t!==e))},[V,$,j,z]),Z=a(e=>{const t={...structuredClone(e),id:I(),x:e.x+20,y:e.y+20};X([t]),z([t.id])},[X,z]),ee=a(e=>{j.includes(e)||z([...j,e])},[j,z]),te=a(e=>{z(j.filter(t=>t!==e))},[j,z]),ne=a(()=>{if(!_.current)return;const e=_.current;e.scale({x:1,y:1}),e.position({x:0,y:0});const t=e.findOne(".c7"),n=e.findOne(".c5"),r=[];if(t&&t.find(e=>{const t=e.getClassName();return"Group"!==t&&"Layer"!==t&&r.push(e),!1}),n&&n.find(e=>{const t=e.getClassName();return"Group"!==t&&"Layer"!==t&&r.push(e),!1}),0===r.length)return;const i=new d.Group;r.forEach(e=>{i.add(e.clone())});const{x:a,y:o,width:s,height:u}=i.getClientRect();if(i.destroy(),0===s||0===u)return;const l=e.width()-20,c=e.height()-20,h=Math.min(l/s,c/u,1);e.scale({x:h,y:h}),e.position({x:(l-s*h)/2-a*h+10,y:(c-u*h)/2-o*h+10}),M.current?.rulerReRender(e)},[]);s(w,()=>({getStage:()=>_.current,getSelectedShapeIds:()=>j,setSelectedShapeIds:z,addShapes:X,removeShapes:q,updateShape:Y,getShapeList:()=>B,fitToContent:ne,addBgShapes:G,removeBgShapes:K,removeBgShape:Q}),[j,z,X,q,Y,B,ne,G,K,Q]),o(()=>{if(!_.current)return;P(_.current);const e=_.current,t=()=>{M.current?.rulerReRender(e)},n=Ee(e),r=e=>{n(e),t()};e.on("wheel",r),e.on("dragmove",t);const[i,a]=xe(e);i();const[o,s]=function(e,t){function n(e){if(t?.press&&e.key===t?.press){if(t?.hasSelectedElements?.())return void(Pe=!1);Pe=!0}}function r(e){t?.press&&e.key===t?.press&&(Pe=!1)}function i(t){0===t.button&&e&&e.contains(t.target)&&(ke=!0,Object.assign(Ie,{x:t.clientX,y:t.clientY}))}function a(e){0===e.button&&(ke=!1)}function o(n){ke&&e&&(t?.press&&!Pe||(e.style.setProperty("--offsetX",`${Ie.x+n.clientX}px`),e.style.setProperty("--offsetY",`${Ie.y+n.clientY}px`)))}let s="";const u=k(()=>{e&&(s?e.style.setProperty("background-image",s):e.style.removeProperty("background-image"))},100),l=()=>{if(!e)return;const t=e.style.getPropertyValue("background-image");t&&"none"!==t&&(s=t),e.style.setProperty("background-image","none"),u()};return[function(){e&&(e.addEventListener("wheel",l),window.addEventListener("mousedown",i),window.addEventListener("mouseup",a),window.addEventListener("mousemove",o),window.addEventListener("keydown",n),window.addEventListener("keyup",r))},function(){e&&(e.removeEventListener("wheel",l),window.removeEventListener("mousedown",i),window.removeEventListener("mouseup",a),window.removeEventListener("mousemove",o),window.removeEventListener("keydown",n),window.removeEventListener("keyup",r))}]}(A.current,{press:" ",hasSelectedElements:()=>W.current.length>0});return o(),()=>{e.off("wheel",r),e.off("dragmove",t),a(),s()}},[]),o(()=>{if(!x)return;const[e,t]=Le(x,U,{onSetShapes:e=>{N(B.map(t=>e.find(e=>e.id===t.id)||t)),$(V.map(t=>e.find(e=>e.id===t.id)||t))},onRemoveShapes:q,onSetActiveShapeIds:z,onAddShapes:X});return e(),t},[x,U,B,N,q,z,X,V,$]),o(()=>{if(!A.current)return;const n=()=>{if(_.current){const{clientWidth:n,clientHeight:r}=_.current.container();S({width:e||n,height:t||r})}};n();const r=new ResizeObserver(n);return r.observe(A.current),()=>{r.disconnect()}},[e,t]);/* @__PURE__ */
21
- return C("div",{style:Te.wrapper,className:m,children:/* @__PURE__ */E("div",{ref:A,id:"c0",style:{...Te.container,..."grid"===v?((e=0,t=0,n=10,r="#e0e0e0")=>({backgroundImage:`\n linear-gradient(45deg, ${r} 25%, transparent 0, transparent 75%, ${r} 0),\n linear-gradient(45deg, ${r} 25%, transparent 0, transparent 75%, ${r} 0)\n `,backgroundPosition:`${e}px ${t}px, ${n+e}px ${n+t}px`,backgroundSize:`${2*n}px ${2*n}px`}))():"point"===v?((e=0,t=0,n=20)=>({backgroundSize:`${n}px ${n}px`,backgroundImage:"radial-gradient(circle, #2f3542 1px, rgba(0, 0, 0, 0) 1px)",backgroundPosition:`${e}px ${t}px`}))():{}},children:[/* @__PURE__ */E(b,{ref:_,style:Te.stage,...R,children:[
22
- /* @__PURE__ */C(p,{name:"c7",children:/* @__PURE__ */C(h,{id:"c6",children:V.map(e=>/* @__PURE__ */C(re,{shapeProps:{...e,name:"c2"},onChange:H,onShapeChange:H},e.id))})}),
23
- /* @__PURE__ */C(p,{name:"c5",children:B.map(e=>/* @__PURE__ */C(re,{shapeProps:e,onChange:Y,onShapeChange:Y},e.id))}),
24
- /* @__PURE__ */C(p,{children:/* @__PURE__ */C(ae,{selectedShapeIds:j,stageIns:x,shaleSelector:".c1, .c2"})}),
25
- /* @__PURE__ */C(Ce,{ref:M,stageIns:x,hideRuler:g,currentPpmm:y,auxiliaryVisible:!0,auxiliaryLock:!1,disableAuxiliary:!1})]}),/* @__PURE__ */C(ge,{stageIns:x,selectedShapeIds:j,shapeList:B,callbacks:{onSetActiveShapeIds:z,onAddActiveShapeId:ee,onRemoveActiveShapeId:te,onUpdateShapeList:N,onDeleteShape:J,onDuplicateShape:Z}})]})})};const Oe=i((e,t)=>/* @__PURE__ */C(Fe,{...e,forwardedRef:t}));Oe.displayName="CanvasStudio";var je=Oe;export{F as AREA_SHAPE_NAME,U as AUXILIARY_GROUP,V as AUXILIARY_LAYER_NAME,W as BACKGROUND_LAYER_NAME,T as BACKGROUND_SHAPE_NAME,L as CUSTOMER_SHAPE_NAME,Oe as CanvasStudio,B as DRAW_AREA_LAYER_NAME,O as DRAW_AREA_SHAPE_NAME,N as HELP_LINE_NAME,Y as RULER_RECT_H,z as RULER_RECT_V,D as SHAPE_GROUP,j as SHAPE_LAYER_NAME,H as SHAPE_TYPES,$ as SNAPPING_LINE_NAME,S as STAGE_CONTAINER_ID,X as THEME_COLOR,G as assertNever,je as default};
1
+ import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as u,m as l,n as c,o as h,p as d,r as f,s as p,t as m,u as v}from"./constants-CHIlz4uF.js";import{n as g,s as b,t as y}from"./utils-DrbTlu3h.js";import w,{forwardRef as _,useCallback as A,useEffect as C,useImperativeHandle as E,useMemo as M,useRef as x,useState as k}from"react";import I from"konva";import{Group as P,Image as R,Layer as S,Path as L,Rect as T,Shape as F,Stage as O,Text as j,Transformer as D}from"react-konva";import W from"qrcode";import{encode as B}from"js-base64";import{jsx as V,jsxs as U}from"react/jsx-runtime";import{useImage as N}from"react-konva-utils";import $ from"jsbarcode";import{debounce as z}from"lodash-es";import{nanoid as Y}from"nanoid";var H=Object.getOwnPropertyNames,X=(e,t)=>function(){return t||(0,e[H(e)[0]])((t={exports:{}}).exports,t),t.exports};function G(e){throw new Error(`Unexpected object: ${e}`)}var q=_(({value:e,onShapeChange:t,...n},r)=>{const[i,a]=k(),{source:o,margin:s,errorCorrectionLevel:u,dark:l,light:c}=e,h=A(async()=>{const r=await W.toString(o,{type:"svg",errorCorrectionLevel:u,margin:s,color:{dark:l,light:c}}),i=new Image;i.src=`data:image/svg+xml;base64,${B(r)}`,i.onload=()=>{a(i),e.info?.svgSource!==r&&(n.onLoad?.(),t?.({...e,info:{svgSource:r}}))}},[o,s,u,l,c,e,t,n]);return C(()=>{h()},[h]),/* @__PURE__ */V(R,{ref:r,image:i,...n})}),K=_((e,t)=>{const[n,r]=N(e.url,"anonymous");return"loaded"===r&&e.onLoad?.(),/* @__PURE__ */V(R,{ref:t,image:n,...e})}),J=_(({value:e,onShapeChange:t,onLoad:n,...r},i)=>{const{source:a,displayValue:o,background:s,lineColor:u,margin:l,barType:c}=e,[h,d]=k(),f=x("");return C(()=>{let r=!0;return(()=>{const i=document.createElement("svg");$(i,a,{displayValue:o,background:s,lineColor:u,margin:l,format:c});const h=i.outerHTML,p=new Image;p.src=`data:image/svg+xml;base64,${B(h)}`,p.onload=()=>{r&&(d(p),n?.(),f.current!==h&&(f.current=h,t?.({...e,info:{svgSource:h}})))}})(),()=>{r=!1}},[a,o,s,u,l,c,e,t,n]),/* @__PURE__ */V(R,{ref:i,image:h,...r})}),Z=_((e,t)=>{const{url:n,colors:r=[],onLoad:i,...a}=e,[o,s]=k(),u=x("");return C(()=>{let e=!0;return(async()=>{let t=u.current;if(!u.current){const e=await(await fetch(n)).text();u.current=e,t=e}r.forEach(({origin:e,target:n})=>{e!==n&&(t=t.replaceAll(e,n))});const a=`data:image/svg+xml;base64,${B(t)}`,o=new Image;o.src=a,o.onload=()=>{e&&(s(o),i?.())}})(),()=>{e=!1}},[n,r,i]),/* @__PURE__ */V(R,{ref:t,image:o,...a})}),Q=/* @__PURE__ */X({"node_modules/.pnpm/@rive-app+canvas@2.34.2/node_modules/@rive-app/canvas/rive.js":(e,t)=>{var n,r;n=e,r=()=>(()=>{var e=[,(e,t,n)=>{n.r(t),n.d(t,{default:()=>r});const r=(i="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var t,n,r=e,a=new Promise((e,r)=>{t=e,n=r}),o="object"==typeof window,s="function"==typeof importScripts;function u(){function e(e){const a=r;n=t=0,r=/* @__PURE__ */new Map,a.forEach(t=>{try{t(e)}catch(n){console.error(n)}}),this.ob(),i&&i.Qb()}let t=0,n=0,r=/* @__PURE__ */new Map,i=null,a=null;this.requestAnimationFrame=function(i){t||=requestAnimationFrame(e.bind(this));const a=++n;return r.set(a,i),a},this.cancelAnimationFrame=function(e){r.delete(e),t&&0==r.size&&(cancelAnimationFrame(t),t=0)},this.Ob=function(e){a&&(document.body.remove(a),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.Qb=function(){var r=performance.now();n?(++t,1e3<(r-=n)&&(e(1e3*t/r),t=n=0)):(n=r,t=0)}}},this.Lb=function(){a&&(document.body.remove(a),a=null),i=null},this.ob=function(){}}function l(e){const t=/* @__PURE__ */new Map;let n=-1/0;this.push=function(r){return r=r+((1<<e)-1)>>e,t.has(r)&&clearTimeout(t.get(r)),t.set(r,setTimeout(function(){t.delete(r),0==t.length?n=-1/0:r==n&&(n=Math.max(...t.keys()),console.assert(n<r))},1e3)),n=Math.max(r,n),n<<e}}const c=r.onRuntimeInitialized;r.onRuntimeInitialized=function(){c&&c();let e=r.decodeAudio;r.decodeAudio=function(t,n){n(t=e(t))};let t=r.decodeFont;r.decodeFont=function(e,n){n(e=t(e))};const n=r.FileAssetLoader;r.ptrToAsset=e=>{let t=r.ptrToFileAsset(e);return t.isImage?r.ptrToImageAsset(e):t.isFont?r.ptrToFontAsset(e):t.isAudio?r.ptrToAudioAsset(e):t},r.CustomFileAssetLoader=n.extend("CustomFileAssetLoader",{__construct:function({loadContents:e}){this.__parent.__construct.call(this),this.Eb=e},loadContents:function(e,t){return e=r.ptrToAsset(e),this.Eb(e,t)}}),r.CDNFileAssetLoader=n.extend("CDNFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this)},loadContents:function(e){let t=r.ptrToAsset(e);return""!==(e=t.cdnUuid)&&(n=t.cdnBaseUrl+"/"+e,(i=new XMLHttpRequest).responseType="arraybuffer",i.onreadystatechange=function(){4==i.readyState&&200==i.status&&(e=>{t.decode(new Uint8Array(e.response))})(i)},i.open("GET",n,!0),i.send(null),!0);var n,i}}),r.FallbackFileAssetLoader=n.extend("FallbackFileAssetLoader",{__construct:function(){this.__parent.__construct.call(this),this.kb=[]},addLoader:function(e){this.kb.push(e)},loadContents:function(e,t){for(let n of this.kb)if(n.loadContents(e,t))return!0;return!1}});let i=r.computeAlignment;r.computeAlignment=function(e,t,n,r,a=1){return i.call(this,e,t,n,r,a)}};const h="createConicGradient createImageData createLinearGradient createPattern createRadialGradient getContextAttributes getImageData getLineDash getTransform isContextLost isPointInPath isPointInStroke measureText".split(" "),d=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)))return console.log("No WebGL support. Image mesh will not be drawn."),!1;n=1}function l(e,t,n){if(t=s.createShader(t),s.shaderSource(t,n),s.compileShader(t),0<((n=s.getShaderInfoLog(t))||"").length)throw n;s.attachShader(e,t)}if(s=new Proxy(s,{get:(e,t)=>e.isContextLost()?(u||(console.error("Cannot render the mesh because the GL Context was lost. Tried to invoke ",t),u=!0),"function"==typeof e[t]?function(){}:void 0):"function"==typeof e[t]?function(...n){return e[t].apply(e,n)}:e[t],set(e,t,n){if(!e.isContextLost())return e[t]=n,!0;u||(console.error("Cannot render the mesh because the GL Context was lost. Tried to set property "+t),u=!0)}}),r=Math.min(s.getParameter(s.MAX_RENDERBUFFER_SIZE),s.getParameter(s.MAX_TEXTURE_SIZE)),l(e=s.createProgram(),s.VERTEX_SHADER,"attribute vec2 vertex;\n attribute vec2 uv;\n uniform vec4 mat;\n uniform vec2 translate;\n varying vec2 st;\n void main() {\n st = uv;\n gl_Position = vec4(mat2(mat) * vertex + translate, 0, 1);\n }"),l(e,s.FRAGMENT_SHADER,"precision highp float;\n uniform sampler2D image;\n varying vec2 st;\n void main() {\n gl_FragColor = texture2D(image, st);\n }"),s.bindAttribLocation(e,0,"vertex"),s.bindAttribLocation(e,1,"uv"),s.linkProgram(e),0<((o=s.getProgramInfoLog(e))||"").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,s=0,u=!1;e(),this.bc=function(){return e(),r},this.Kb=function(e){t.deleteTexture&&t.deleteTexture(e)},this.Jb=function(r){if(!e())return null;const 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),2==n?(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};const c=new l(8),h=new l(8),d=new l(10),f=new l(10);this.Nb=function(n,r,u,l,p){if(e()){var m=c.push(n),v=h.push(r);if(t.canvas){for(var g of(t.canvas.width==m&&t.canvas.height==v||(t.canvas.width=m,t.canvas.height=v),t.viewport(0,v-r,n,r),t.disable(t.SCISSOR_TEST),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.enable(t.SCISSOR_TEST),u.sort((e,t)=>t.vb-e.vb),m=d.push(l),o!=m&&(t.bufferData(t.ARRAY_BUFFER,8*m,t.DYNAMIC_DRAW),o=m),m=0,u))t.bufferSubData(t.ARRAY_BUFFER,m,g.Ta),m+=4*g.Ta.length;for(var b of(console.assert(m==4*l),u))t.bufferSubData(t.ARRAY_BUFFER,m,b.Bb),m+=4*b.Bb.length;for(var y of(console.assert(m==8*l),m=f.push(p),s!=m&&(t.bufferData(t.ELEMENT_ARRAY_BUFFER,2*m,t.DYNAMIC_DRAW),s=m),g=0,u))t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,g,y.indices),g+=2*y.indices.length;console.assert(g==2*p),y=0,b=!0,m=g=0;for(const e of u){e.image.Ja!=y&&(t.bindTexture(t.TEXTURE_2D,e.image.Ia||null),y=e.image.Ja),e.hc?(t.scissor(e.Za,v-e.$a-e.jb,e.uc,e.jb),b=!0):b&&(t.scissor(0,v-r,n,r),b=!1),u=2/n;const o=-2/r;t.uniform4f(i,e.ha[0]*u*e.Aa,e.ha[1]*o*e.Ba,e.ha[2]*u*e.Aa,e.ha[3]*o*e.Ba),t.uniform2f(a,e.ha[4]*u*e.Aa+u*(e.Za-e.cc*e.Aa)-1,e.ha[5]*o*e.Ba+o*(e.$a-e.dc*e.Ba)+1),t.vertexAttribPointer(0,2,t.FLOAT,!1,0,m),t.vertexAttribPointer(1,2,t.FLOAT,!1,0,m+4*l),t.drawElements(t.TRIANGLES,e.indices.length,t.UNSIGNED_SHORT,g),m+=4*e.Ta.length,g+=2*e.indices.length}console.assert(m==4*l),console.assert(g==2*p)}}},this.canvas=function(){return e()&&t.canvas}},f=r.onRuntimeInitialized;r.onRuntimeInitialized=function(){function e(e){switch(e){case p.srcOver:return"source-over";case p.screen:return"screen";case p.overlay:return"overlay";case p.darken:return"darken";case p.lighten:return"lighten";case p.colorDodge:return"color-dodge";case p.colorBurn:return"color-burn";case p.hardLight:return"hard-light";case p.softLight:return"soft-light";case p.difference:return"difference";case p.exclusion:return"exclusion";case p.multiply:return"multiply";case p.hue:return"hue";case p.saturation:return"saturation";case p.color:return"color";case p.luminosity:return"luminosity"}}function t(e){return"rgba("+((16711680&e)>>>16)+","+((65280&e)>>>8)+","+((255&e)>>>0)+","+((4278190080&e)>>>24)/255+")"}function n(){0<E.length&&(d.Nb(C.drawWidth(),C.drawHeight(),E,M,x),E=[],x=M=0,C.reset(512,512));for(const e of A){for(const t of e.I)t();e.I=[]}A.clear()}f&&f();var i=r.RenderPaintStyle;const a=r.RenderPath,o=r.RenderPaint,s=r.Renderer,l=r.StrokeCap,c=r.StrokeJoin,p=r.BlendMode,m=i.fill,v=i.stroke,g=r.FillRule.evenOdd;let b=1;var y=r.RenderImage.extend("CanvasRenderImage",{__construct:function({la:e,wa:t}={}){this.__parent.__construct.call(this),this.Ja=b,b=b+1&2147483647||1,this.la=e,this.wa=t},__destruct:function(){this.Ia&&(d.Kb(this.Ia),URL.revokeObjectURL(this.Wa)),this.__parent.__destruct.call(this)},decode:function(e){var t=this;t.wa&&t.wa(t);var n=new Image;t.Wa=URL.createObjectURL(new Blob([e],{type:"image/png"})),n.onload=function(){t.Db=n,t.Ia=d.Jb(n),t.size(n.width,n.height),t.la&&t.la(t)},n.src=t.Wa}}),w=a.extend("CanvasRenderPath",{__construct:function(){this.__parent.__construct.call(this),this.U=new Path2D},rewind:function(){this.U=new Path2D},addPath:function(e,t,n,r,i,a,o){var s=this.U,u=s.addPath;e=e.U;const l=new DOMMatrix;l.a=t,l.b=n,l.c=r,l.d=i,l.e=a,l.f=o,u.call(s,e,l)},fillRule:function(e){this.Va=e},moveTo:function(e,t){this.U.moveTo(e,t)},lineTo:function(e,t){this.U.lineTo(e,t)},cubicTo:function(e,t,n,r,i,a){this.U.bezierCurveTo(e,t,n,r,i,a)},close:function(){this.U.closePath()}}),_=o.extend("CanvasRenderPaint",{color:function(e){this.Xa=t(e)},thickness:function(e){this.Gb=e},join:function(e){switch(e){case c.miter:this.Ha="miter";break;case c.round:this.Ha="round";break;case c.bevel:this.Ha="bevel"}},cap:function(e){switch(e){case l.butt:this.Ga="butt";break;case l.round:this.Ga="round";break;case l.square:this.Ga="square"}},style:function(e){this.Fb=e},blendMode:function(t){this.Cb=e(t)},clearGradient:function(){this.ja=null},linearGradient:function(e,t,n,r){this.ja={xb:e,yb:t,cb:n,eb:r,Qa:[]}},radialGradient:function(e,t,n,r){this.ja={xb:e,yb:t,cb:n,eb:r,Qa:[],ac:!0}},addStop:function(e,t){this.ja.Qa.push({color:e,stop:t})},completeGradient:function(){},draw:function(e,n,r,i){let a=this.Fb;var o=this.Xa,s=this.ja;const u=e.globalCompositeOperation,l=e.globalAlpha;if(e.globalCompositeOperation=this.Cb,e.globalAlpha=i,null!=s){o=s.xb;const n=s.yb,r=s.cb;var c=s.eb;i=s.Qa,s.ac?(s=r-o,c-=n,o=e.createRadialGradient(o,n,0,o,n,Math.sqrt(s*s+c*c))):o=e.createLinearGradient(o,n,r,c);for(let e=0,a=i.length;e<a;e++)s=i[e],o.addColorStop(s.stop,t(s.color));this.Xa=o,this.ja=null}switch(a){case v:e.strokeStyle=o,e.lineWidth=this.Gb,e.lineCap=this.Ga,e.lineJoin=this.Ha,e.stroke(n);break;case m:e.fillStyle=o,e.fill(n,r)}e.globalCompositeOperation=u,e.globalAlpha=l}});const A=/* @__PURE__ */new Set;let C=null,E=[],M=0,x=0;var k=r.CanvasRenderer=s.extend("Renderer",{__construct:function(e){this.__parent.__construct.call(this),this.T=[1,0,0,1,0,0],this.G=[1],this.B=e.getContext("2d"),this.Ua=e,this.I=[]},save:function(){this.T.push(...this.T.slice(this.T.length-6)),this.G.push(this.G[this.G.length-1]),this.I.push(this.B.save.bind(this.B))},restore:function(){const e=this.T.length-6;if(6>e)throw"restore() called without matching save().";this.T.splice(e),this.G.pop(),this.I.push(this.B.restore.bind(this.B))},transform:function(e,t,n,r,i,a){const o=this.T,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.I.push(this.B.transform.bind(this.B,e,t,n,r,i,a))},rotate:function(e){const t=Math.sin(e);e=Math.cos(e),this.transform(e,t,-t,e,0,0)},modulateOpacity:function(e){this.G[this.G.length-1]*=e},_drawPath:function(e,t){this.I.push(t.draw.bind(t,this.B,e.U,e.Va===g?"evenodd":"nonzero",Math.max(0,this.G[this.G.length-1])))},_drawRiveImage:function(t,n,r,i){var a=t.Db;if(a){var o=this.B,s=e(r),u=Math.max(0,i*this.G[this.G.length-1]);this.I.push(function(){o.globalCompositeOperation=s,o.globalAlpha=u,o.drawImage(a,0,0),o.globalAlpha=1})}},_getMatrix:function(e){const t=this.T,n=t.length-6;for(let r=0;6>r;++r)e[r]=t[n+r]},_drawImageMesh:function(t,i,a,o,s,u,l,c,h,f,p){i=this.B.canvas.width;var m=this.B.canvas.height;const v=f-c,g=p-h;c=Math.max(c,0),h=Math.max(h,0),f=Math.min(f,i),p=Math.min(p,m);const b=f-c,y=p-h;if(console.assert(b<=Math.min(v,i)),console.assert(y<=Math.min(g,m)),!(0>=b||0>=y)){f=b<v||y<g,i=p=1;var w=Math.ceil(b*p),_=Math.ceil(y*i);m=d.bc(),w>m&&(p*=m/w,w=m),_>m&&(i*=m/_,_=m),C||(C=new r.DynamicRectanizer(m),C.reset(512,512)),0>(m=C.addRect(w,_))&&(n(),A.add(this),m=C.addRect(w,_),console.assert(0<=m));var k=65535&m,I=m>>16;E.push({ha:this.T.slice(this.T.length-6),image:t,Za:k,$a:I,cc:c,dc:h,uc:w,jb:_,Aa:p,Ba:i,Ta:new Float32Array(s),Bb:new Float32Array(u),indices:new Uint16Array(l),hc:f,vb:t.Ja<<1|(f?1:0)}),M+=s.length,x+=l.length;var P=this.B,R=e(a),S=Math.max(0,o*this.G[this.G.length-1]);this.I.push(function(){P.save(),P.resetTransform(),P.globalCompositeOperation=R,P.globalAlpha=S;const e=d.canvas();e&&P.drawImage(e,k,I,w,_,c,h,b,y),P.restore()})}},_clipPath:function(e){this.I.push(this.B.clip.bind(this.B,e.U,e.Va===g?"evenodd":"nonzero"))},clear:function(){A.add(this),this.I.push(this.B.clearRect.bind(this.B,0,0,this.Ua.width,this.Ua.height))},flush:function(){},translate:function(e,t){this.transform(1,0,0,1,e,t)}});r.makeRenderer=function(e){const t=new k(e),n=t.B;return new Proxy(t,{get(e,r){if("function"==typeof e[r])return function(...t){return e[r].apply(e,t)};if("function"==typeof n[r]){if(-1<h.indexOf(r))throw Error("RiveException: Method call to '"+r+"()' is not allowed, as the renderer cannot immediately pass through the return values of any canvas 2d context methods.");return function(...e){t.I.push(n[r].bind(n,...e))}}return e[r]},set(e,r,i){if(r in n)return t.I.push(()=>{n[r]=i}),!0}})},r.decodeImage=function(e,t){new y({la:t}).decode(e)},r.renderFactory={makeRenderPaint:function(){return new _},makeRenderPath:function(){return new w},makeRenderImage:function(){let e=P;return new y({wa:()=>{e.total++},la:()=>{if(e.loaded++,e.loaded===e.total){const t=e.ready;t&&(t(),e.ready=null)}}})}};let I=r.load,P=null;r.load=function(e,t,n=!0){const i=new r.FallbackFileAssetLoader;return void 0!==t&&i.addLoader(t),n&&(t=new r.CDNFileAssetLoader,i.addLoader(t)),new Promise(function(t){let n=null;P={total:0,loaded:0,ready:function(){t(n)}},n=I(e,i),0==P.total&&t(n)})};let R=r.RendererWrapper.prototype.align;r.RendererWrapper.prototype.align=function(e,t,n,r,i=1){R.call(this,e,t,n,r,i)},i=new u,r.requestAnimationFrame=i.requestAnimationFrame.bind(i),r.cancelAnimationFrame=i.cancelAnimationFrame.bind(i),r.enableFPSCounter=i.Ob.bind(i),r.disableFPSCounter=i.Lb,i.ob=n,r.resolveAnimationFrame=n,r.cleanup=function(){C&&C.delete()}};var p,m,v=Object.assign({},r),g="./this.program",b="";(o||s)&&(s?b=self.location.href:"undefined"!=typeof document&&document.currentScript&&(b=document.currentScript.src),i&&(b=i),b=b.startsWith("blob:")?"":b.substr(0,b.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(m=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),p=(e,t,n)=>{if($(e)){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?t(r.response):n()},r.onerror=n,r.send(null)}else fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(Error(e.status+" : "+e.url))).then(t,n)});var y,w=r.print||console.log.bind(console),_=r.printErr||console.error.bind(console);Object.assign(r,v),v=null,r.thisProgram&&(g=r.thisProgram),r.wasmBinary&&(y=r.wasmBinary);var A,C,E,M,x,k,I,P,R,S=!1;function L(){var e=A.buffer;r.HEAP8=C=new Int8Array(e),r.HEAP16=M=new Int16Array(e),r.HEAPU8=E=new Uint8Array(e),r.HEAPU16=x=new Uint16Array(e),r.HEAP32=k=new Int32Array(e),r.HEAPU32=I=new Uint32Array(e),r.HEAPF32=P=new Float32Array(e),r.HEAPF64=R=new Float64Array(e)}var T=[],F=[],O=[];function j(){var e=r.preRun.shift();T.unshift(e)}var D=0,W=null,B=null;function V(e){throw r.onAbort?.(e),_(e="Aborted("+e+")"),S=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),n(e),e}var U,N=e=>e.startsWith("data:application/octet-stream;base64,"),$=e=>e.startsWith("file://");function z(e){if(e==U&&y)return new Uint8Array(y);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}function Y(e,t,n){return function(e){return y?Promise.resolve().then(()=>z(e)):new Promise((t,n)=>{p(e,e=>t(new Uint8Array(e)),()=>{try{t(z(e))}catch(r){n(r)}})})}(e).then(e=>WebAssembly.instantiate(e,t)).then(n,e=>{_(`failed to asynchronously prepare wasm: ${e}`),V(e)})}var H,X,G={490818:(e,t,n,r,i)=>{if("undefined"==typeof window||void 0===(window.AudioContext||window.webkitAudioContext))return 0;if(void 0===window.h){window.h={za:0},window.h.J={},window.h.J.xa=e,window.h.J.capture=t,window.h.J.Ka=n,window.h.ga={},window.h.ga.stopped=r,window.h.ga.wb=i;let a=window.h;a.D=[],a.sc=function(e){for(var t=0;t<a.D.length;++t)if(null==a.D[t])return a.D[t]=e,t;return a.D.push(e),a.D.length-1},a.Ab=function(e){for(a.D[e]=null;0<a.D.length&&null==a.D[a.D.length-1];)a.D.pop()},a.Pc=function(e){for(var t=0;t<a.D.length;++t)if(a.D[t]==e)return a.Ab(t)},a.qa=function(e){return a.D[e]},a.Sa=["touchend","click"],a.unlock=function(){for(var e=0;e<a.D.length;++e){var t=a.D[e];null!=t&&null!=t.L&&t.state===a.ga.wb&&t.L.resume().then(()=>{Tn(t.pb)},e=>{console.error("Failed to resume audiocontext",e)})}a.Sa.map(function(e){document.removeEventListener(e,a.unlock,!0)})},a.Sa.map(function(e){document.addEventListener(e,a.unlock,!0)})}return window.h.za+=1,1},492996:()=>{void 0!==window.h&&(window.h.Sa.map(function(e){document.removeEventListener(e,window.h.unlock,!0)}),--window.h.za,0===window.h.za&&delete window.h)},493300:()=>void 0!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia,493404:()=>{try{var e=new(window.AudioContext||window.webkitAudioContext),t=e.sampleRate;return e.close(),t}catch(n){return 0}},493575:(e,t,n,r,i,a)=>{if(void 0===window.h)return-1;var o={},s={};return e==window.h.J.xa&&0!=n&&(s.sampleRate=n),o.L=new(window.AudioContext||window.webkitAudioContext)(s),o.L.suspend(),o.state=window.h.ga.stopped,n=0,e!=window.h.J.xa&&(n=t),o.Z=o.L.createScriptProcessor(r,n,t),o.Z.onaudioprocess=function(n){if(null!=o.ra&&0!=o.ra.length||(o.ra=new Float32Array(P.buffer,i,r*t)),e==window.h.J.capture||e==window.h.J.Ka){for(var s=0;s<t;s+=1)for(var u=n.inputBuffer.getChannelData(s),l=o.ra,c=0;c<r;c+=1)l[c*t+s]=u[c];On(a,r,i)}if(e==window.h.J.xa||e==window.h.J.Ka)for(jn(a,r,i),s=0;s<n.outputBuffer.numberOfChannels;++s)for(u=n.outputBuffer.getChannelData(s),l=o.ra,c=0;c<r;c+=1)u[c]=l[c*t+s];else for(s=0;s<n.outputBuffer.numberOfChannels;++s)n.outputBuffer.getChannelData(s).fill(0)},e!=window.h.J.capture&&e!=window.h.J.Ka||navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(e){o.Ca=o.L.createMediaStreamSource(e),o.Ca.connect(o.Z),o.Z.connect(o.L.destination)}).catch(function(e){console.log("Failed to get user media: "+e)}),e==window.h.J.xa&&o.Z.connect(o.L.destination),o.pb=a,window.h.sc(o)},496452:e=>window.h.qa(e).L.sampleRate,496525:e=>{void 0!==(e=window.h.qa(e)).Z&&(e.Z.onaudioprocess=function(){},e.Z.disconnect(),e.Z=void 0),void 0!==e.Ca&&(e.Ca.disconnect(),e.Ca=void 0),e.L.close(),e.L=void 0,e.pb=void 0},496925:e=>{window.h.Ab(e)},496975:e=>{(e=window.h.qa(e)).L.resume(),e.state=window.h.ga.wb},497114:e=>{(e=window.h.qa(e)).L.suspend(),e.state=window.h.ga.stopped}},q=e=>{for(;0<e.length;)e.shift()(r)};function K(){var e=k[+tt>>2];return tt+=4,e}var J=(e,t)=>{for(var n=0,r=e.length-1;0<=r;r--){var i=e[r];"."===i?e.splice(r,1):".."===i?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},Z=e=>{var t="/"===e.charAt(0),n="/"===e.substr(-1);return(e=J(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&n&&(e+="/"),(t?"/":"")+e},Q=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.substr(0,t.length-1),e+t):"."},ee=e=>{if("/"===e)return"/";var t=(e=(e=Z(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},te=e=>(te=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return e=>crypto.getRandomValues(e);V("initRandomDevice")})())(e),ne=(...e)=>{for(var t="",n=!1,r=e.length-1;-1<=r&&!n;r--){if("string"!=typeof(n=0<=r?e[r]:"/"))throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";t=n+"/"+t,n="/"===n.charAt(0)}return(n?"/":"")+(t=J(t.split("/").filter(e=>!!e),!n).join("/"))||"."},re="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,ie=(e,t,n)=>{var r=t+n;for(n=t;e[n]&&!(n>=r);)++n;if(16<n-t&&e.buffer&&re)return re.decode(e.subarray(t,n));for(r="";t<n;){var i=e[t++];if(128&i){var a=63&e[t++];if(192==(224&i))r+=String.fromCharCode((31&i)<<6|a);else{var o=63&e[t++];65536>(i=224==(240&i)?(15&i)<<12|a<<6|o:(7&i)<<18|a<<12|o<<6|63&e[t++])?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else r+=String.fromCharCode(i)}return r},ae=[],oe=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);127>=r?t++:2047>=r?t+=2:55296<=r&&57343>=r?(t+=4,++n):t+=3}return t},se=(e,t,n,r)=>{if(!(0<r))return 0;var i=n;r=n+r-1;for(var a=0;a<e.length;++a){var o=e.charCodeAt(a);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),127>=o){if(n>=r)break;t[n++]=o}else{if(2047>=o){if(n+1>=r)break;t[n++]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;t[n++]=224|o>>12}else{if(n+3>=r)break;t[n++]=240|o>>18,t[n++]=128|o>>12&63}t[n++]=128|o>>6&63}t[n++]=128|63&o}}return t[n]=0,n-i};function ue(e,t){var n=Array(oe(e)+1);return e=se(e,n,0,n.length),t&&(n.length=e),n}var le=[];function ce(e,t){le[e]={input:[],H:[],W:t},We(e,he)}var he={open(e){var t=le[e.node.ya];if(!t)throw new Ae(43);e.s=t,e.seekable=!1},close(e){e.s.W.pa(e.s)},pa(e){e.s.W.pa(e.s)},read(e,t,n,r){if(!e.s||!e.s.W.ib)throw new Ae(60);for(var i=0,a=0;a<r;a++){try{var o=e.s.W.ib(e.s)}catch(s){throw new Ae(29)}if(void 0===o&&0===i)throw new Ae(6);if(null==o)break;i++,t[n+a]=o}return i&&(e.node.timestamp=Date.now()),i},write(e,t,n,r){if(!e.s||!e.s.W.Na)throw new Ae(60);try{for(var i=0;i<r;i++)e.s.W.Na(e.s,t[n+i])}catch(a){throw new Ae(29)}return r&&(e.node.timestamp=Date.now()),i}},de={ib(){e:{if(!ae.length){var e=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n"),!e){e=null;break e}ae=ue(e,!0)}e=ae.shift()}return e},Na(e,t){null===t||10===t?(w(ie(e.H,0)),e.H=[]):0!=t&&e.H.push(t)},pa(e){e.H&&0<e.H.length&&(w(ie(e.H,0)),e.H=[])},Yb:()=>({Ac:25856,Cc:5,zc:191,Bc:35387,yc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),Zb:()=>0,$b:()=>[24,80]},fe={Na(e,t){null===t||10===t?(_(ie(e.H,0)),e.H=[]):0!=t&&e.H.push(t)},pa(e){e.H&&0<e.H.length&&(_(ie(e.H,0)),e.H=[])}};function pe(e,t){var n=e.l?e.l.length:0;n>=t||(t=Math.max(t,n*(1048576>n?2:1.125)>>>0),0!=n&&(t=Math.max(t,256)),n=e.l,e.l=new Uint8Array(t),0<e.v&&e.l.set(n.subarray(0,e.v),0))}var me={O:null,V:()=>me.createNode(null,"/",16895,0),createNode(e,t,n,r){if(24576==(61440&n)||4096==(61440&n))throw new Ae(63);return me.O||(me.O={dir:{node:{Y:me.j.Y,R:me.j.R,ka:me.j.ka,ua:me.j.ua,tb:me.j.tb,zb:me.j.zb,ub:me.j.ub,sb:me.j.sb,Da:me.j.Da},stream:{ba:me.m.ba}},file:{node:{Y:me.j.Y,R:me.j.R},stream:{ba:me.m.ba,read:me.m.read,write:me.m.write,Ya:me.m.Ya,lb:me.m.lb,nb:me.m.nb}},link:{node:{Y:me.j.Y,R:me.j.R,ma:me.j.ma},stream:{}},ab:{node:{Y:me.j.Y,R:me.j.R},stream:De}}),16384==(61440&(n=Re(e,t,n,r)).mode)?(n.j=me.O.dir.node,n.m=me.O.dir.stream,n.l={}):32768==(61440&n.mode)?(n.j=me.O.file.node,n.m=me.O.file.stream,n.v=0,n.l=null):40960==(61440&n.mode)?(n.j=me.O.link.node,n.m=me.O.link.stream):8192==(61440&n.mode)&&(n.j=me.O.ab.node,n.m=me.O.ab.stream),n.timestamp=Date.now(),e&&(e.l[t]=n,e.timestamp=n.timestamp),n},Gc:e=>e.l?e.l.subarray?e.l.subarray(0,e.v):new Uint8Array(e.l):new Uint8Array(0),j:{Y(e){var t={};return t.Ec=8192==(61440&e.mode)?e.id:1,t.Ic=e.id,t.mode=e.mode,t.Lc=1,t.uid=0,t.Hc=0,t.ya=e.ya,16384==(61440&e.mode)?t.size=4096:32768==(61440&e.mode)?t.size=e.v:40960==(61440&e.mode)?t.size=e.link.length:t.size=0,t.wc=new Date(e.timestamp),t.Kc=new Date(e.timestamp),t.Dc=new Date(e.timestamp),t.Hb=4096,t.xc=Math.ceil(t.size/t.Hb),t},R(e,t){if(void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&(t=t.size,e.v!=t))if(0==t)e.l=null,e.v=0;else{var n=e.l;e.l=new Uint8Array(t),n&&e.l.set(n.subarray(0,Math.min(t,e.v))),e.v=t}},ka(){throw Ce[44]},ua:(e,t,n,r)=>me.createNode(e,t,n,r),tb(e,t,n){if(16384==(61440&e.mode)){try{var r=Pe(t,n)}catch(a){}if(r)for(var i in r.l)throw new Ae(55)}delete e.parent.l[e.name],e.parent.timestamp=Date.now(),e.name=n,t.l[n]=e,t.timestamp=e.parent.timestamp},zb(e,t){delete e.l[t],e.timestamp=Date.now()},ub(e,t){var n,r=Pe(e,t);for(n in r.l)throw new Ae(55);delete e.l[t],e.timestamp=Date.now()},sb(e){var t,n=[".",".."];for(t of Object.keys(e.l))n.push(t);return n},Da:(e,t,n)=>((e=me.createNode(e,t,41471,0)).link=n,e),ma(e){if(40960!=(61440&e.mode))throw new Ae(28);return e.link}},m:{read(e,t,n,r,i){var a=e.node.l;if(i>=e.node.v)return 0;if(8<(e=Math.min(e.node.v-i,r))&&a.subarray)t.set(a.subarray(i,i+e),n);else for(r=0;r<e;r++)t[n+r]=a[i+r];return e},write(e,t,n,r,i,a){if(t.buffer===C.buffer&&(a=!1),!r)return 0;if((e=e.node).timestamp=Date.now(),t.subarray&&(!e.l||e.l.subarray)){if(a)return e.l=t.subarray(n,n+r),e.v=r;if(0===e.v&&0===i)return e.l=t.slice(n,n+r),e.v=r;if(i+r<=e.v)return e.l.set(t.subarray(n,n+r),i),r}if(pe(e,i+r),e.l.subarray&&t.subarray)e.l.set(t.subarray(n,n+r),i);else for(a=0;a<r;a++)e.l[i+a]=t[n+a];return e.v=Math.max(e.v,i+r),r},ba(e,t,n){if(1===n?t+=e.position:2===n&&32768==(61440&e.node.mode)&&(t+=e.node.v),0>t)throw new Ae(28);return t},Ya(e,t,n){pe(e.node,t+n),e.node.v=Math.max(e.node.v,t+n)},lb(e,t,n,r,i){if(32768!=(61440&e.node.mode))throw new Ae(43);if(e=e.node.l,2&i||e.buffer!==C.buffer){if((0<n||n+t<e.length)&&(e=e.subarray?e.subarray(n,n+t):Array.prototype.slice.call(e,n,n+t)),n=!0,V(),!(t=void 0))throw new Ae(48);C.set(e,t)}else n=!1,t=e.byteOffset;return{o:t,vc:n}},nb:(e,t,n,r)=>(me.m.write(e,t,0,r,n,!1),0)}},ve=null,ge={},be=[],ye=1,we=null,_e=!0,Ae=class{constructor(e){this.name="ErrnoError",this.aa=e}},Ce={},Ee=class{constructor(){this.h={},this.node=null}get flags(){return this.h.flags}set flags(e){this.h.flags=e}get position(){return this.h.position}set position(e){this.h.position=e}},Me=class{constructor(e,t,n,r){e||=this,this.parent=e,this.V=e.V,this.va=null,this.id=ye++,this.name=t,this.mode=n,this.j={},this.m={},this.ya=r}get read(){return!(365&~this.mode)}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(e){e?this.mode|=146:this.mode&=-147}};function xe(e,t={}){if(!(e=ne(e)))return{path:"",node:null};if(8<(t=Object.assign({hb:!0,Pa:0},t)).Pa)throw new Ae(32);e=e.split("/").filter(e=>!!e);for(var n=ve,r="/",i=0;i<e.length;i++){var a=i===e.length-1;if(a&&t.parent)break;if(n=Pe(n,e[i]),r=Z(r+"/"+e[i]),n.va&&(!a||a&&t.hb)&&(n=n.va.root),!a||t.gb)for(a=0;40960==(61440&n.mode);)if(n=ze(r),n=xe(r=ne(Q(r),n),{Pa:t.Pa+1}).node,40<a++)throw new Ae(32)}return{path:r,node:n}}function ke(e){for(var t;;){if(e===e.parent)return e=e.V.mb,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function Ie(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%we.length}function Pe(e,t){var n=16384==(61440&e.mode)?(n=Le(e,"x"))?n:e.j.ka?0:2:54;if(n)throw new Ae(n);for(n=we[Ie(e.id,t)];n;n=n.fc){var r=n.name;if(n.parent.id===e.id&&r===t)return n}return e.j.ka(e,t)}function Re(e,t,n,r){return t=Ie((e=new Me(e,t,n,r)).parent.id,e.name),e.fc=we[t],we[t]=e}function Se(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function Le(e,t){return _e?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function Te(e,t){try{return Pe(e,t),20}catch(n){}return Le(e,"wx")}function Fe(e){if(!(e=be[e]))throw new Ae(8);return e}function Oe(e,t=-1){if(e=Object.assign(new Ee,e),-1==t)e:{for(t=0;4096>=t;t++)if(!be[t])break e;throw new Ae(33)}return e.X=t,be[t]=e}var je,De={open(e){e.m=ge[e.node.ya].m,e.m.open?.(e)},ba(){throw new Ae(70)}};function We(e,t){ge[e]={m:t}}function Be(e,t){var n="/"===t;if(n&&ve)throw new Ae(10);if(!n&&t){var r=xe(t,{hb:!1});if(t=r.path,(r=r.node).va)throw new Ae(10);if(16384!=(61440&r.mode))throw new Ae(54)}t={type:e,Nc:{},mb:t,ec:[]},(e=e.V(t)).V=t,t.root=e,n?ve=e:r&&(r.va=t,r.V&&r.V.ec.push(t))}function Ve(e,t,n){var r=xe(e,{parent:!0}).node;if(!(e=ee(e))||"."===e||".."===e)throw new Ae(28);var i=Te(r,e);if(i)throw new Ae(i);if(!r.j.ua)throw new Ae(63);return r.j.ua(r,e,t,n)}function Ue(e){return Ve(e,16895,0)}function Ne(e,t,n){void 0===n&&(n=t,t=438),Ve(e,8192|t,n)}function $e(e,t){if(!ne(e))throw new Ae(44);var n=xe(t,{parent:!0}).node;if(!n)throw new Ae(44);var r=Te(n,t=ee(t));if(r)throw new Ae(r);if(!n.j.Da)throw new Ae(63);n.j.Da(n,t,e)}function ze(e){if(!(e=xe(e).node))throw new Ae(44);if(!e.j.ma)throw new Ae(28);return ne(ke(e.parent),e.j.ma(e))}function Ye(e,t,n){if(""===e)throw new Ae(44);if("string"==typeof t){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===i)throw Error(`Unknown file open mode: ${t}`);t=i}if(n=64&t?4095&(void 0===n?438:n)|32768:0,"object"==typeof e)var a=e;else{e=Z(e);try{a=xe(e,{gb:!(131072&t)}).node}catch(o){}}if(i=!1,64&t)if(a){if(128&t)throw new Ae(20)}else a=Ve(e,n,0),i=!0;if(!a)throw new Ae(44);if(8192==(61440&a.mode)&&(t&=-513),65536&t&&16384!=(61440&a.mode))throw new Ae(54);if(!i&&(n=a?40960==(61440&a.mode)?32:16384==(61440&a.mode)&&("r"!==Se(t)||512&t)?31:Le(a,Se(t)):44))throw new Ae(n);if(512&t&&!i){if(!(n="string"==typeof(n=a)?xe(n,{gb:!0}).node:n).j.R)throw new Ae(63);if(16384==(61440&n.mode))throw new Ae(31);if(32768!=(61440&n.mode))throw new Ae(28);if(i=Le(n,"w"))throw new Ae(i);n.j.R(n,{size:0,timestamp:Date.now()})}return t&=-131713,(a=Oe({node:a,path:ke(a),flags:t,seekable:!0,position:0,m:a.m,tc:[],error:!1})).m.open&&a.m.open(a),!r.logReadFiles||1&t||(qe||={},e in qe||(qe[e]=1)),a}function He(e,t,n){if(null===e.X)throw new Ae(8);if(!e.seekable||!e.m.ba)throw new Ae(70);if(0!=n&&1!=n&&2!=n)throw new Ae(28);e.position=e.m.ba(e,t,n),e.tc=[]}function Xe(e,t,n){e=Z("/dev/"+e);var r=((e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n})(!!t,!!n);Ge||=64;var i=Ge++<<8;We(i,{open(e){e.seekable=!1},close(){n?.buffer?.length&&n(10)},read(e,n,r,i){for(var a=0,o=0;o<i;o++){try{var s=t()}catch(u){throw new Ae(29)}if(void 0===s&&0===a)throw new Ae(6);if(null==s)break;a++,n[r+o]=s}return a&&(e.node.timestamp=Date.now()),a},write(e,t,r,i){for(var a=0;a<i;a++)try{n(t[r+a])}catch(o){throw new Ae(29)}return i&&(e.node.timestamp=Date.now()),a}}),Ne(e,r,i)}var Ge,qe,Ke,Je,Ze,Qe,et,tt=void 0,nt=(e,t)=>Object.defineProperty(t,"name",{value:e}),rt=[],it=[],at=e=>{if(!e)throw new Ke("Cannot use deleted val. handle = "+e);return it[e]},ot=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const t=rt.pop()||it.length;return it[t]=e,it[t+1]=1,t}},st=e=>{var t=Error,n=nt(e,function(t){this.name=e,this.message=t,void 0!==(t=Error(t).stack)&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(t.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},n},ut=e=>{for(var t="";E[e];)t+=Ze[E[e++]];return t},lt=[],ct=()=>{for(;lt.length;){var e=lt.pop();e.g.fa=!1,e.delete()}},ht={},dt=(e,t)=>{if(void 0===t)throw new Ke("ptr should not be undefined");for(;e.C;)t=e.na(t),e=e.C;return t},ft={},pt=e=>{e=Ln(e);var t=ut(e);return Rn(e),t},mt=(e,t)=>{var n=ft[e];if(void 0===n)throw e=`${t} has unknown type ${pt(e)}`,new Ke(e);return n},vt=()=>{},gt=!1,bt=(e,t,n)=>t===n?e:void 0===n.C||null===(e=bt(e,t,n.C))?null:n.Mb(e),yt={},wt=(e,t)=>{if(!t.u||!t.o)throw new et("makeClassHandle requires ptr and ptrType");if(!!t.K!=!!t.F)throw new et("Both smartPtrType and smartPtr must be specified");return t.count={value:1},_t(Object.create(e,{g:{value:t,writable:!0}}))},_t=e=>"undefined"==typeof FinalizationRegistry?(_t=e=>e,e):(gt=new FinalizationRegistry(e=>{--(e=e.g).count.value,0===e.count.value&&(e.F?e.K.P(e.F):e.u.i.P(e.o))}),vt=e=>{gt.unregister(e)},(_t=e=>{var t=e.g;return t.F&&gt.register(e,{g:t},e),e})(e)),At={},Ct=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Et(e){return this.fromWireType(I[e>>2])}var Mt={},xt={},kt=(e,t,n)=>{function r(t){if((t=n(t)).length!==e.length)throw new et("Mismatched type converter count");for(var r=0;r<e.length;++r)It(e[r],t[r])}e.forEach(function(e){xt[e]=t});var i=Array(t.length),a=[],o=0;t.forEach((e,t)=>{ft.hasOwnProperty(e)?i[t]=ft[e]:(a.push(e),Mt.hasOwnProperty(e)||(Mt[e]=[]),Mt[e].push(()=>{i[t]=ft[e],++o===a.length&&r(i)}))}),0===a.length&&r(i)};function It(e,t,n={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,n={}){var r=t.name;if(!e)throw new Ke(`type "${r}" must have a positive integer typeid pointer`);if(ft.hasOwnProperty(e)){if(n.Wb)return;throw new Ke(`Cannot register type '${r}' twice`)}ft[e]=t,delete xt[e],Mt.hasOwnProperty(e)&&(t=Mt[e],delete Mt[e],t.forEach(e=>e()))}(e,t,n)}var Pt=e=>{throw new Ke(e.g.u.i.name+" instance already deleted")};function Rt(){}var St=(e,t,n)=>{if(void 0===e[t].A){var r=e[t];e[t]=function(...r){if(!e[t].A.hasOwnProperty(r.length))throw new Ke(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].A})!`);return e[t].A[r.length].apply(this,r)},e[t].A=[],e[t].A[r.ea]=r}},Lt=(e,t,n)=>{if(r.hasOwnProperty(e)){if(void 0===n||void 0!==r[e].A&&void 0!==r[e].A[n])throw new Ke(`Cannot register public name '${e}' twice`);if(St(r,e,e),r.hasOwnProperty(n))throw new Ke(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`);r[e].A[n]=t}else r[e]=t,void 0!==n&&(r[e].Mc=n)};function Tt(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.N=n,this.P=r,this.C=i,this.Rb=a,this.na=o,this.Mb=s,this.qb=[]}var Ft=(e,t,n)=>{for(;t!==n;){if(!t.na)throw new Ke(`Expected null or instance of ${n.name}, got an instance of ${t.name}`);e=t.na(e),t=t.C}return e};function Ot(e,t){if(null===t){if(this.Ma)throw new Ke(`null is not a valid ${this.name}`);return 0}if(!t.g)throw new Ke(`Cannot pass "${tn(t)}" as a ${this.name}`);if(!t.g.o)throw new Ke(`Cannot pass deleted object as a pointer of type ${this.name}`);return Ft(t.g.o,t.g.u.i,this.i)}function jt(e,t){if(null===t){if(this.Ma)throw new Ke(`null is not a valid ${this.name}`);if(this.ta){var n=this.Oa();return null!==e&&e.push(this.P,n),n}return 0}if(!t||!t.g)throw new Ke(`Cannot pass "${tn(t)}" as a ${this.name}`);if(!t.g.o)throw new Ke(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.sa&&t.g.u.sa)throw new Ke(`Cannot convert argument of type ${t.g.K?t.g.K.name:t.g.u.name} to parameter type ${this.name}`);if(n=Ft(t.g.o,t.g.u.i,this.i),this.ta){if(void 0===t.g.F)throw new Ke("Passing raw pointer to smart pointer is illegal");switch(this.nc){case 0:if(t.g.K!==this)throw new Ke(`Cannot convert argument of type ${t.g.K?t.g.K.name:t.g.u.name} to parameter type ${this.name}`);n=t.g.F;break;case 1:n=t.g.F;break;case 2:if(t.g.K===this)n=t.g.F;else{var r=t.clone();n=this.jc(n,ot(()=>r.delete())),null!==e&&e.push(this.P,n)}break;default:throw new Ke("Unsupporting sharing policy")}}return n}function Dt(e,t){if(null===t){if(this.Ma)throw new Ke(`null is not a valid ${this.name}`);return 0}if(!t.g)throw new Ke(`Cannot pass "${tn(t)}" as a ${this.name}`);if(!t.g.o)throw new Ke(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.g.u.sa)throw new Ke(`Cannot convert argument of type ${t.g.u.name} to parameter type ${this.name}`);return Ft(t.g.o,t.g.u.i,this.i)}function Wt(e,t,n,r,i,a,o,s,u,l,c){this.name=e,this.i=t,this.Ma=n,this.sa=r,this.ta=i,this.ic=a,this.nc=o,this.rb=s,this.Oa=u,this.jc=l,this.P=c,i||void 0!==t.C?this.toWireType=jt:(this.toWireType=r?Ot:Dt,this.M=null)}var Bt,Vt,Ut=(e,t,n)=>{if(!r.hasOwnProperty(e))throw new et("Replacing nonexistent public symbol");void 0!==r[e].A&&void 0!==n?r[e].A[n]=t:(r[e]=t,r[e].ea=n)},Nt=[],$t=e=>{var t=Nt[e];return t||(e>=Nt.length&&(Nt.length=e+1),Nt[e]=t=Bt.get(e)),t},zt=(e,t)=>(...n)=>((e,t,n=[])=>(e.includes("j")?(e=e.replace(/p/g,"i"),t=(0,r["dynCall_"+e])(t,...n)):t=$t(t)(...n),t))(e,t,n),Yt=(e,t)=>{var n=(e=ut(e)).includes("j")?zt(e,t):$t(t);if("function"!=typeof n)throw new Ke(`unknown function pointer with signature ${e}: ${t}`);return n},Ht=(e,t)=>{var n=[],r={};throw t.forEach(function e(t){r[t]||ft[t]||(xt[t]?xt[t].forEach(e):(n.push(t),r[t]=!0))}),new Vt(`${e}: `+n.map(pt).join([", "]))};function Xt(e,t,n,r,i){var a=t.length;if(2>a)throw new Ke("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=null!==t[1]&&null!==n,s=function(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].M)return!0;return!1}(t),u="void"!==t[0].name,l=a-2,c=Array(l),h=[],d=[];return nt(e,function(...n){if(n.length!==l)throw new Ke(`function ${e} called with ${n.length} arguments, expected ${l}`);if(d.length=0,h.length=o?2:1,h[0]=i,o){var a=t[1].toWireType(d,this);h[1]=a}for(var f=0;f<l;++f)c[f]=t[f+2].toWireType(d,n[f]),h.push(c[f]);if(n=r(...h),s)Ct(d);else for(f=o?1:2;f<t.length;f++){var p=1===f?a:c[f-2];null!==t[f].M&&t[f].M(p)}return a=u?t[0].fromWireType(n):void 0})}var Gt,qt=(e,t)=>{for(var n=[],r=0;r<e;r++)n.push(I[t+4*r>>2]);return n},Kt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},Jt=(e,t,n)=>{if(!(e instanceof Object))throw new Ke(`${n} with invalid "this": ${e}`);if(!(e instanceof t.i.constructor))throw new Ke(`${n} incompatible with "this" of type ${e.constructor.name}`);if(!e.g.o)throw new Ke(`cannot call emscripten binding method ${n} on deleted object`);return Ft(e.g.o,e.g.u.i,t.i)},Zt=e=>{9<e&&0===--it[e+1]&&(it[e]=void 0,rt.push(e))},Qt={name:"emscripten::val",fromWireType:e=>{var t=at(e);return Zt(e),t},toWireType:(e,t)=>ot(t),argPackAdvance:8,readValueFromPointer:Et,M:null},en=(e,t,n)=>{switch(t){case 1:return n?function(e){return this.fromWireType(C[e])}:function(e){return this.fromWireType(E[e])};case 2:return n?function(e){return this.fromWireType(M[e>>1])}:function(e){return this.fromWireType(x[e>>1])};case 4:return n?function(e){return this.fromWireType(k[e>>2])}:function(e){return this.fromWireType(I[e>>2])};default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},tn=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},nn=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(P[e>>2])};case 8:return function(e){return this.fromWireType(R[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},rn=(e,t,n)=>{switch(t){case 1:return n?e=>C[e]:e=>E[e];case 2:return n?e=>M[e>>1]:e=>x[e>>1];case 4:return n?e=>k[e>>2]:e=>I[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},an="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,on=(e,t)=>{for(var n=e>>1,r=n+t/2;!(n>=r)&&x[n];)++n;if(32<(n<<=1)-e&&an)return an.decode(E.subarray(e,n));for(n="",r=0;!(r>=t/2);++r){var i=M[e+2*r>>1];if(0==i)break;n+=String.fromCharCode(i)}return n},sn=(e,t,n)=>{if(n??=2147483647,2>n)return 0;var r=t;n=(n-=2)<2*e.length?n/2:e.length;for(var i=0;i<n;++i)M[t>>1]=e.charCodeAt(i),t+=2;return M[t>>1]=0,t-r},un=e=>2*e.length,ln=(e,t)=>{for(var n=0,r="";!(n>=t/4);){var i=k[e+4*n>>2];if(0==i)break;++n,65536<=i?(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)):r+=String.fromCharCode(i)}return r},cn=(e,t,n)=>{if(n??=2147483647,4>n)return 0;var r=t;n=r+n-4;for(var i=0;i<e.length;++i){var a=e.charCodeAt(i);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++i)),k[t>>2]=a,(t+=4)+4>n)break}return k[t>>2]=0,t-r},hn=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);55296<=r&&57343>=r&&++n,t+=4}return t},dn=(e,t,n)=>{var r=[];return e=e.toWireType(r,n),r.length&&(I[t>>2]=ot(r)),e},fn={},pn=e=>{var t=fn[e];return void 0===t?ut(e):t},mn=[],vn=Reflect.construct,gn=e=>0==e%4&&(0!=e%100||0==e%400),bn=[0,31,60,91,121,152,182,213,244,274,305,335],yn=[0,31,59,90,120,151,181,212,243,273,304,334],wn=[],_n={},An=()=>{if(!Gt){var e,t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:g||"./this.program"};for(e in _n)void 0===_n[e]?delete t[e]:t[e]=_n[e];var n=[];for(e in t)n.push(`${e}=${t[e]}`);Gt=n}return Gt},Cn=[31,29,31,30,31,30,31,31,30,31,30,31],En=[31,28,31,30,31,30,31,31,30,31,30,31],Mn=(e,t,n,r)=>{function i(e,t,n){for(e="number"==typeof e?e.toString():e||"";e.length<t;)e=n[0]+e;return e}function a(e,t){return i(e,t,"0")}function o(e,t){function n(e){return 0>e?-1:0<e?1:0}var r;return 0===(r=n(e.getFullYear()-t.getFullYear()))&&0===(r=n(e.getMonth()-t.getMonth()))&&(r=n(e.getDate()-t.getDate())),r}function s(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function u(e){var t=e.ca;for(e=new Date(new Date(e.da+1900,0,1).getTime());0<t;){var n=e.getMonth(),r=(gn(e.getFullYear())?Cn:En)[n];if(!(t>r-e.getDate())){e.setDate(e.getDate()+t);break}t-=r-e.getDate()+1,e.setDate(1),11>n?e.setMonth(n+1):(e.setMonth(0),e.setFullYear(e.getFullYear()+1))}return n=new Date(e.getFullYear()+1,0,4),t=s(new Date(e.getFullYear(),0,4)),n=s(n),0>=o(t,e)?0>=o(n,e)?e.getFullYear()+1:e.getFullYear():e.getFullYear()-1}var l=I[r+40>>2];for(var c in r={qc:k[r>>2],pc:k[r+4>>2],Ea:k[r+8>>2],Ra:k[r+12>>2],Fa:k[r+16>>2],da:k[r+20>>2],S:k[r+24>>2],ca:k[r+28>>2],Oc:k[r+32>>2],oc:k[r+36>>2],rc:l&&l?ie(E,l):""},n=n?ie(E,n):"",l={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(c,"g"),l[c]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(c in l={"%a":e=>h[e.S].substring(0,3),"%A":e=>h[e.S],"%b":e=>d[e.Fa].substring(0,3),"%B":e=>d[e.Fa],"%C":e=>a((e.da+1900)/100|0,2),"%d":e=>a(e.Ra,2),"%e":e=>i(e.Ra,2," "),"%g":e=>u(e).toString().substring(2),"%G":u,"%H":e=>a(e.Ea,2),"%I":e=>(0==(e=e.Ea)?e=12:12<e&&(e-=12),a(e,2)),"%j":e=>{for(var t=0,n=0;n<=e.Fa-1;t+=(gn(e.da+1900)?Cn:En)[n++]);return a(e.Ra+t,3)},"%m":e=>a(e.Fa+1,2),"%M":e=>a(e.pc,2),"%n":()=>"\n","%p":e=>0<=e.Ea&&12>e.Ea?"AM":"PM","%S":e=>a(e.qc,2),"%t":()=>"\t","%u":e=>e.S||7,"%U":e=>a(Math.floor((e.ca+7-e.S)/7),2),"%V":e=>{var t=Math.floor((e.ca+7-(e.S+6)%7)/7);if(2>=(e.S+371-e.ca-2)%7&&t++,t)53==t&&(4==(n=(e.S+371-e.ca)%7)||3==n&&gn(e.da)||(t=1));else{t=52;var n=(e.S+7-e.ca-1)%7;(4==n||5==n&&gn(e.da%400-1))&&t++}return a(t,2)},"%w":e=>e.S,"%W":e=>a(Math.floor((e.ca+7-(e.S+6)%7)/7),2),"%y":e=>(e.da+1900).toString().substring(2),"%Y":e=>e.da+1900,"%z":e=>{var t=0<=(e=e.oc);return e=Math.abs(e)/60,(t?"+":"-")+String("0000"+(e/60*100+e%60)).slice(-4)},"%Z":e=>e.rc,"%%":()=>"%"},n=n.replace(/%%/g,"\0\0"),l)n.includes(c)&&(n=n.replace(new RegExp(c,"g"),l[c](r)));return(c=ue(n=n.replace(/\0\0/g,"%"),!1)).length>t?0:(C.set(c,e),c.length-1)};[44].forEach(e=>{Ce[e]=new Ae(e),Ce[e].stack="<generic error, no stack>"}),we=Array(4096),Be(me,"/"),Ue("/tmp"),Ue("/home"),Ue("/home/web_user"),function(){Ue("/dev"),We(259,{read:()=>0,write:(e,t,n,r)=>r}),Ne("/dev/null",259),ce(1280,de),ce(1536,fe),Ne("/dev/tty",1280),Ne("/dev/tty1",1536);var e=new Uint8Array(1024),t=0,n=()=>(0===t&&(t=te(e).byteLength),e[--t]);Xe("random",n),Xe("urandom",n),Ue("/dev/shm"),Ue("/dev/shm/tmp")}(),function(){Ue("/proc");var e=Ue("/proc/self");Ue("/proc/self/fd"),Be({V(){var t=Re(e,"fd",16895,73);return t.j={ka(e,t){var n=Fe(+t);return(e={parent:null,V:{mb:"fake"},j:{ma:()=>n.path}}).parent=e}},t}},"/proc/self/fd")}(),Ke=r.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},it.push(0,1,void 0,1,null,1,!0,1,!1,1),r.count_emval_handles=()=>it.length/2-5-rt.length,Je=r.PureVirtualError=st("PureVirtualError");for(var xn=Array(256),kn=0;256>kn;++kn)xn[kn]=String.fromCharCode(kn);Ze=xn,r.getInheritedInstanceCount=()=>Object.keys(ht).length,r.getLiveInheritedInstances=()=>{var e,t=[];for(e in ht)ht.hasOwnProperty(e)&&t.push(ht[e]);return t},r.flushPendingDeletes=ct,r.setDelayFunction=e=>{Qe=e,lt.length&&Qe&&Qe(ct)},et=r.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Object.assign(Rt.prototype,{isAliasOf:function(e){if(!(this instanceof Rt&&e instanceof Rt))return!1;var t=this.g.u.i,n=this.g.o;e.g=e.g;var r=e.g.u.i;for(e=e.g.o;t.C;)n=t.na(n),t=t.C;for(;r.C;)e=r.na(e),r=r.C;return t===r&&n===e},clone:function(){if(this.g.o||Pt(this),this.g.ia)return this.g.count.value+=1,this;var e=_t,t=Object,n=t.create,r=Object.getPrototypeOf(this),i=this.g;return(e=e(n.call(t,r,{g:{value:{count:i.count,fa:i.fa,ia:i.ia,o:i.o,u:i.u,F:i.F,K:i.K}}}))).g.count.value+=1,e.g.fa=!1,e},delete(){if(this.g.o||Pt(this),this.g.fa&&!this.g.ia)throw new Ke("Object already scheduled for deletion");vt(this);var e=this.g;--e.count.value,0===e.count.value&&(e.F?e.K.P(e.F):e.u.i.P(e.o)),this.g.ia||(this.g.F=void 0,this.g.o=void 0)},isDeleted:function(){return!this.g.o},deleteLater:function(){if(this.g.o||Pt(this),this.g.fa&&!this.g.ia)throw new Ke("Object already scheduled for deletion");return lt.push(this),1===lt.length&&Qe&&Qe(ct),this.g.fa=!0,this}}),Object.assign(Wt.prototype,{Sb(e){return this.rb&&(e=this.rb(e)),e},bb(e){this.P?.(e)},argPackAdvance:8,readValueFromPointer:Et,fromWireType:function(e){function t(){return this.ta?wt(this.i.N,{u:this.ic,o:n,K:this,F:e}):wt(this.i.N,{u:this,o:e})}var n=this.Sb(e);if(!n)return this.bb(e),null;var r=((e,t)=>(t=dt(e,t),ht[t]))(this.i,n);if(void 0!==r)return 0===r.g.count.value?(r.g.o=n,r.g.F=e,r.clone()):(r=r.clone(),this.bb(e),r);if(r=this.i.Rb(n),!(r=yt[r]))return t.call(this);r=this.sa?r.Ib:r.pointerType;var i=bt(n,this.i,r.i);return null===i?t.call(this):this.ta?wt(r.i.N,{u:r,o:i,K:this,F:e}):wt(r.i.N,{u:r,o:i})}}),Vt=r.UnboundTypeError=st("UnboundTypeError");var In={__syscall_fcntl64:function(e,t,n){tt=n;try{var r=Fe(e);switch(t){case 0:var i=K();if(0>i)break;for(;be[i];)i++;return function(e,t=-1){return e=Oe(e,t),e.m?.Fc?.(e),e}(r,i).X;case 1:case 2:case 13:case 14:return 0;case 3:return r.flags;case 4:return i=K(),r.flags|=i,0;case 12:return i=K(),M[i+0>>1]=2,0}return-28}catch(a){if("ErrnoError"!==a.name)throw a;return-a.aa}},__syscall_ioctl:function(e,t,n){tt=n;try{var r=Fe(e);switch(t){case 21509:case 21510:case 21511:case 21512:case 21524:case 21515:return r.s?0:-59;case 21505:if(!r.s)return-59;if(r.s.W.Yb){e=[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var i=K();k[i>>2]=25856,k[i+4>>2]=5,k[i+8>>2]=191,k[i+12>>2]=35387;for(var a=0;32>a;a++)C[i+a+17]=e[a]||0}return 0;case 21506:case 21507:case 21508:if(!r.s)return-59;if(r.s.W.Zb)for(i=K(),e=[],a=0;32>a;a++)e.push(C[i+a+17]);return 0;case 21519:return r.s?(i=K(),k[i>>2]=0):-59;case 21520:return r.s?-28:-59;case 21531:if(i=K(),!r.m.Xb)throw new Ae(59);return r.m.Xb(r,t,i);case 21523:return r.s?(r.s.W.$b&&(a=[24,80],i=K(),M[i>>1]=a[0],M[i+2>>1]=a[1]),0):-59;default:return-28}}catch(o){if("ErrnoError"!==o.name)throw o;return-o.aa}},__syscall_openat:function(e,t,n,r){tt=r;try{var i=t=t?ie(E,t):"";if("/"===i.charAt(0))t=i;else{var a=-100===e?"/":Fe(e).path;if(0==i.length)throw new Ae(44);t=Z(a+"/"+i)}return Ye(t,n,r?K():0).X}catch(o){if("ErrnoError"!==o.name)throw o;return-o.aa}},_abort_js:()=>{V("")},_embind_create_inheriting_constructor:(e,t,n)=>{e=ut(e),t=mt(t,"wrapper"),n=at(n);var r=t.i,i=r.N,a=r.C.N,o=r.C.constructor;return e=nt(e,function(...e){r.C.qb.forEach(function(e){if(this[e]===a[e])throw new Je(`Pure virtual function ${e} must be implemented in JavaScript`)}.bind(this)),Object.defineProperty(this,"__parent",{value:i}),this.__construct(...e)}),i.__construct=function(...e){if(this===i)throw new Ke("Pass correct 'this' to __construct");e=o.implement(this,...e),vt(e);var t=e.g;if(e.notifyOnDestruction(),t.ia=!0,Object.defineProperties(this,{g:{value:t}}),_t(this),e=t.o,e=dt(r,e),ht.hasOwnProperty(e))throw new Ke(`Tried to register registered instance: ${e}`);ht[e]=this},i.__destruct=function(){if(this===i)throw new Ke("Pass correct 'this' to __destruct");vt(this);var e=this.g.o;if(e=dt(r,e),!ht.hasOwnProperty(e))throw new Ke(`Tried to unregister unregistered instance: ${e}`);delete ht[e]},e.prototype=Object.create(i),Object.assign(e.prototype,n),ot(e)},_embind_finalize_value_object:e=>{var t=At[e];delete At[e];var n=t.Oa,r=t.P,i=t.fb,a=i.map(e=>e.Vb).concat(i.map(e=>e.lc));kt([e],a,e=>{var a={};return i.forEach((t,n)=>{var r=e[n],o=t.Tb,s=t.Ub,u=e[n+i.length],l=t.kc,c=t.mc;a[t.Pb]={read:e=>r.fromWireType(o(s,e)),write:(e,t)=>{var n=[];l(c,e,u.toWireType(n,t)),Ct(n)}}}),[{name:t.name,fromWireType:e=>{var t,n={};for(t in a)n[t]=a[t].read(e);return r(e),n},toWireType:(e,t)=>{for(var i in a)if(!(i in t))throw new TypeError(`Missing field: "${i}"`);var o=n();for(i in a)a[i].write(o,t[i]);return null!==e&&e.push(r,o),o},argPackAdvance:8,readValueFromPointer:Et,M:r}]})},_embind_register_bigint:()=>{},_embind_register_bool:(e,t,n,r)=>{It(e,{name:t=ut(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(E[e])},M:null})},_embind_register_class:(e,t,n,r,i,a,o,s,u,l,c,h,d)=>{c=ut(c),a=Yt(i,a),s&&=Yt(o,s),l&&=Yt(u,l),d=Yt(h,d);var f=(e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=t&&57>=t?`_${e}`:e})(c);Lt(f,function(){Ht(`Cannot construct ${c} due to unbound types`,[r])}),kt([e,t,n],r?[r]:[],t=>{if(t=t[0],r)var n=t.i,i=n.N;else i=Rt.prototype;t=nt(c,function(...e){if(Object.getPrototypeOf(this)!==o)throw new Ke("Use 'new' to construct "+c);if(void 0===h.$)throw new Ke(c+" has no accessible constructor");var t=h.$[e.length];if(void 0===t)throw new Ke(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(h.$).toString()}) parameters instead!`);return t.apply(this,e)});var o=Object.create(i,{constructor:{value:t}});t.prototype=o;var u,h=new Tt(c,t,o,d,n,a,s,l);return h.C&&((u=h.C).oa??(u.oa=[]),h.C.oa.push(h)),n=new Wt(c,h,!0,!1,!1),u=new Wt(c+"*",h,!1,!1,!1),i=new Wt(c+" const*",h,!1,!0,!1),yt[e]={pointerType:u,Ib:i},Ut(f,t),[n,u,i]})},_embind_register_class_class_function:(e,t,n,r,i,a,o)=>{var s=qt(n,r);t=ut(t),t=Kt(t),a=Yt(i,a),kt([],[e],e=>{function r(){Ht(`Cannot call ${i} due to unbound types`,s)}var i=`${(e=e[0]).name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var u=e.i.constructor;return void 0===u[t]?(r.ea=n-1,u[t]=r):(St(u,t,i),u[t].A[n-1]=r),kt([],s,r=>{if(r=Xt(i,[r[0],null].concat(r.slice(1)),null,a,o),void 0===u[t].A?(r.ea=n-1,u[t]=r):u[t].A[n-1]=r,e.i.oa)for(const n of e.i.oa)n.constructor.hasOwnProperty(t)||(n.constructor[t]=r);return[]}),[]})},_embind_register_class_class_property:(e,t,n,r,i,a,o,s)=>{t=ut(t),a=Yt(i,a),kt([],[e],e=>{var i=`${(e=e[0]).name}.${t}`,u={get(){Ht(`Cannot access ${i} due to unbound types`,[n])},enumerable:!0,configurable:!0};return u.set=s?()=>{Ht(`Cannot access ${i} due to unbound types`,[n])}:()=>{throw new Ke(`${i} is a read-only property`)},Object.defineProperty(e.i.constructor,t,u),kt([],[n],n=>{n=n[0];var i={get:()=>n.fromWireType(a(r)),enumerable:!0};return s&&(s=Yt(o,s),i.set=e=>{var t=[];s(r,n.toWireType(t,e)),Ct(t)}),Object.defineProperty(e.i.constructor,t,i),[]}),[]})},_embind_register_class_constructor:(e,t,n,r,i,a)=>{var o=qt(t,n);i=Yt(r,i),kt([],[e],e=>{var n=`constructor ${(e=e[0]).name}`;if(void 0===e.i.$&&(e.i.$=[]),void 0!==e.i.$[t-1])throw new Ke(`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.i.$[t-1]=()=>{Ht(`Cannot construct ${e.name} due to unbound types`,o)},kt([],o,r=>(r.splice(1,0,null),e.i.$[t-1]=Xt(n,r,null,i,a),[])),[]})},_embind_register_class_function:(e,t,n,r,i,a,o,s)=>{var u=qt(n,r);t=ut(t),t=Kt(t),a=Yt(i,a),kt([],[e],e=>{function r(){Ht(`Cannot call ${i} due to unbound types`,u)}var i=`${(e=e[0]).name}.${t}`;t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.i.qb.push(t);var l=e.i.N,c=l[t];return void 0===c||void 0===c.A&&c.className!==e.name&&c.ea===n-2?(r.ea=n-2,r.className=e.name,l[t]=r):(St(l,t,i),l[t].A[n-2]=r),kt([],u,r=>(r=Xt(i,r,e,a,o),void 0===l[t].A?(r.ea=n-2,l[t]=r):l[t].A[n-2]=r,[])),[]})},_embind_register_class_property:(e,t,n,r,i,a,o,s,u,l)=>{t=ut(t),i=Yt(r,i),kt([],[e],e=>{var r=`${(e=e[0]).name}.${t}`,c={get(){Ht(`Cannot access ${r} due to unbound types`,[n,o])},enumerable:!0,configurable:!0};return c.set=u?()=>Ht(`Cannot access ${r} due to unbound types`,[n,o]):()=>{throw new Ke(r+" is a read-only property")},Object.defineProperty(e.i.N,t,c),kt([],u?[n,o]:[n],n=>{var o=n[0],c={get(){var t=Jt(this,e,r+" getter");return o.fromWireType(i(a,t))},enumerable:!0};if(u){u=Yt(s,u);var h=n[1];c.set=function(t){var n=Jt(this,e,r+" setter"),i=[];u(l,n,h.toWireType(i,t)),Ct(i)}}return Object.defineProperty(e.i.N,t,c),[]}),[]})},_embind_register_emval:e=>It(e,Qt),_embind_register_enum:(e,t,n,r)=>{function i(){}t=ut(t),i.values={},It(e,{name:t,constructor:i,fromWireType:function(e){return this.constructor.values[e]},toWireType:(e,t)=>t.value,argPackAdvance:8,readValueFromPointer:en(t,n,r),M:null}),Lt(t,i)},_embind_register_enum_value:(e,t,n)=>{var r=mt(e,"enum");t=ut(t),e=r.constructor,r=Object.create(r.constructor.prototype,{value:{value:n},constructor:{value:nt(`${r.name}_${t}`,function(){})}}),e.values[n]=r,e[t]=r},_embind_register_float:(e,t,n)=>{It(e,{name:t=ut(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:8,readValueFromPointer:nn(t,n),M:null})},_embind_register_function:(e,t,n,r,i,a)=>{var o=qt(t,n);e=ut(e),e=Kt(e),i=Yt(r,i),Lt(e,function(){Ht(`Cannot call ${e} due to unbound types`,o)},t-1),kt([],o,n=>(Ut(e,Xt(e,[n[0],null].concat(n.slice(1)),null,i,a),t-1),[]))},_embind_register_integer:(e,t,n,r,i)=>{if(t=ut(t),-1===i&&(i=4294967295),i=e=>e,0===r){var a=32-8*n;i=e=>e<<a>>>a}var o=t.includes("unsigned")?function(e,t){return t>>>0}:function(e,t){return t};It(e,{name:t,fromWireType:i,toWireType:o,argPackAdvance:8,readValueFromPointer:rn(t,n,0!==r),M:null})},_embind_register_memory_view:(e,t,n)=>{function r(e){return new i(C.buffer,I[e+4>>2],I[e>>2])}var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];It(e,{name:n=ut(n),fromWireType:r,argPackAdvance:8,readValueFromPointer:r},{Wb:!0})},_embind_register_std_string:(e,t)=>{var n="std::string"===(t=ut(t));It(e,{name:t,fromWireType:function(e){var t=I[e>>2],r=e+4;if(n)for(var i=r,a=0;a<=t;++a){var o=r+a;if(a==t||0==E[o]){if(i=i?ie(E,i,o-i):"",void 0===s)var s=i;else s+=String.fromCharCode(0),s+=i;i=o+1}}else{for(s=Array(t),a=0;a<t;++a)s[a]=String.fromCharCode(E[r+a]);s=s.join("")}return Rn(e),s},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var r="string"==typeof t;if(!(r||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array))throw new Ke("Cannot pass non-string to std::string");var i=n&&r?oe(t):t.length,a=Sn(4+i+1),o=a+4;if(I[a>>2]=i,n&&r)se(t,E,o,i+1);else if(r)for(r=0;r<i;++r){var s=t.charCodeAt(r);if(255<s)throw Rn(o),new Ke("String has UTF-16 code units that do not fit in 8 bits");E[o+r]=s}else for(r=0;r<i;++r)E[o+r]=t[r];return null!==e&&e.push(Rn,a),a},argPackAdvance:8,readValueFromPointer:Et,M(e){Rn(e)}})},_embind_register_std_wstring:(e,t,n)=>{if(n=ut(n),2===t)var r=on,i=sn,a=un,o=e=>x[e>>1];else 4===t&&(r=ln,i=cn,a=hn,o=e=>I[e>>2]);It(e,{name:n,fromWireType:e=>{for(var n,i=I[e>>2],a=e+4,s=0;s<=i;++s){var u=e+4+s*t;s!=i&&0!=o(u)||(a=r(a,u-a),void 0===n?n=a:(n+=String.fromCharCode(0),n+=a),a=u+t)}return Rn(e),n},toWireType:(e,r)=>{if("string"!=typeof r)throw new Ke(`Cannot pass non-string to C++ string type ${n}`);var o=a(r),s=Sn(4+o+t);return I[s>>2]=o/t,i(r,s+4,o+t),null!==e&&e.push(Rn,s),s},argPackAdvance:8,readValueFromPointer:Et,M(e){Rn(e)}})},_embind_register_value_object:(e,t,n,r,i,a)=>{At[e]={name:ut(t),Oa:Yt(n,r),P:Yt(i,a),fb:[]}},_embind_register_value_object_field:(e,t,n,r,i,a,o,s,u,l)=>{At[e].fb.push({Pb:ut(t),Vb:n,Tb:Yt(r,i),Ub:a,lc:o,kc:Yt(s,u),mc:l})},_embind_register_void:(e,t)=>{It(e,{Jc:!0,name:t=ut(t),argPackAdvance:0,fromWireType:()=>{},toWireType:()=>{}})},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:(e,t,n)=>E.copyWithin(e,t,t+n),_emscripten_throw_longjmp:()=>{throw 1/0},_emval_as:(e,t,n)=>(e=at(e),t=mt(t,"emval::as"),dn(t,n,e)),_emval_call_method:(e,t,n,r,i)=>(e=mn[e])(t=at(t),t[n=pn(n)],r,i),_emval_decref:Zt,_emval_get_method_caller:(e,t,n)=>{var r=((e,t)=>{for(var n=Array(e),r=0;r<e;++r)n[r]=mt(I[t+4*r>>2],"parameter "+r);return n})(e,t),i=r.shift();e--;var a=Array(e);return t=`methodCaller<(${r.map(e=>e.name).join(", ")}) => ${i.name}>`,(e=>{var t=mn.length;return mn.push(e),t})(nt(t,(t,o,s,u)=>{for(var l=0,c=0;c<e;++c)a[c]=r[c].readValueFromPointer(u+l),l+=r[c].argPackAdvance;return t=1===n?vn(o,a):o.apply(t,a),dn(i,s,t)}))},_emval_get_module_property:e=>(e=pn(e),ot(r[e])),_emval_get_property:(e,t)=>(e=at(e),t=at(t),ot(e[t])),_emval_incref:e=>{9<e&&(it[e+1]+=1)},_emval_new_array:()=>ot([]),_emval_new_cstring:e=>ot(pn(e)),_emval_new_object:()=>ot({}),_emval_run_destructors:e=>{Ct(at(e)),Zt(e)},_emval_set_property:(e,t,n)=>{e=at(e),t=at(t),n=at(n),e[t]=n},_emval_take_value:(e,t)=>(e=(e=mt(e,"_emval_take_value")).readValueFromPointer(t),ot(e)),_gmtime_js:function(e,t,n){e=/* @__PURE__ */new Date(1e3*(t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN)),k[n>>2]=e.getUTCSeconds(),k[n+4>>2]=e.getUTCMinutes(),k[n+8>>2]=e.getUTCHours(),k[n+12>>2]=e.getUTCDate(),k[n+16>>2]=e.getUTCMonth(),k[n+20>>2]=e.getUTCFullYear()-1900,k[n+24>>2]=e.getUTCDay(),k[n+28>>2]=(e.getTime()-Date.UTC(e.getUTCFullYear(),0,1,0,0,0,0))/864e5|0},_localtime_js:function(e,t,n){e=/* @__PURE__ */new Date(1e3*(t+2097152>>>0<4194305-!!e?(e>>>0)+4294967296*t:NaN)),k[n>>2]=e.getSeconds(),k[n+4>>2]=e.getMinutes(),k[n+8>>2]=e.getHours(),k[n+12>>2]=e.getDate(),k[n+16>>2]=e.getMonth(),k[n+20>>2]=e.getFullYear()-1900,k[n+24>>2]=e.getDay(),k[n+28>>2]=(gn(e.getFullYear())?bn:yn)[e.getMonth()]+e.getDate()-1|0,k[n+36>>2]=-60*e.getTimezoneOffset(),t=new Date(e.getFullYear(),6,1).getTimezoneOffset();var r=new Date(e.getFullYear(),0,1).getTimezoneOffset();k[n+32>>2]=0|(t!=r&&e.getTimezoneOffset()==Math.min(r,t))},_tzset_js:(e,t,n,r)=>{var i=/* @__PURE__ */(new Date).getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1);i=a.getTimezoneOffset();var s=o.getTimezoneOffset();I[e>>2]=60*Math.max(i,s),k[t>>2]=Number(i!=s),a=(e=e=>e.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1])(a),o=e(o),s<i?(se(a,E,n,17),se(o,E,r,17)):(se(a,E,r,17),se(o,E,n,17))},emscripten_asm_const_int:(e,t,n)=>{wn.length=0;for(var r;r=E[t++];){var i=105!=r;n+=(i&=112!=r)&&n%8?4:0,wn.push(112==r?I[n>>2]:105==r?k[n>>2]:R[n>>3]),n+=i?8:4}return G[e](...wn)},emscripten_date_now:()=>Date.now(),emscripten_get_now:()=>performance.now(),emscripten_resize_heap:e=>{var t=E.length;if(2147483648<(e>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=t*(1+.2/n);r=Math.min(r,e+100663296);var i=Math;r=Math.max(e,r);e:{i=(i.min.call(i,2147483648,r+(65536-r%65536)%65536)-A.buffer.byteLength+65535)/65536;try{A.grow(i),L();var a=1;break e}catch(o){}a=void 0}if(a)return!0}return!1},environ_get:(e,t)=>{var n=0;return An().forEach((r,i)=>{var a=t+n;for(i=I[e+4*i>>2]=a,a=0;a<r.length;++a)C[i++]=r.charCodeAt(a);C[i]=0,n+=r.length+1}),0},environ_sizes_get:(e,t)=>{var n=An();I[e>>2]=n.length;var r=0;return n.forEach(e=>r+=e.length+1),I[t>>2]=r,0},fd_close:function(e){try{var t=Fe(e);if(null===t.X)throw new Ae(8);t.La&&(t.La=null);try{t.m.close&&t.m.close(t)}catch(n){throw n}finally{be[t.X]=null}return t.X=null,0}catch(n){if("ErrnoError"!==n.name)throw n;return n.aa}},fd_read:function(e,t,n,r){try{e:{var i=Fe(e);e=t;for(var a,o=t=0;o<n;o++){var s=I[e>>2],u=I[e+4>>2];e+=8;var l=i,c=a,h=C;if(0>u||0>c)throw new Ae(28);if(null===l.X)throw new Ae(8);if(1==(2097155&l.flags))throw new Ae(8);if(16384==(61440&l.node.mode))throw new Ae(31);if(!l.m.read)throw new Ae(28);var d=void 0!==c;if(d){if(!l.seekable)throw new Ae(70)}else c=l.position;var f=l.m.read(l,h,s,u,c);d||(l.position+=f);var p=f;if(0>p){var m=-1;break e}if(t+=p,p<u)break;void 0!==a&&(a+=p)}m=t}return I[r>>2]=m,0}catch(v){if("ErrnoError"!==v.name)throw v;return v.aa}},fd_seek:function(e,t,n,r,i){t=n+2097152>>>0<4194305-!!t?(t>>>0)+4294967296*n:NaN;try{if(isNaN(t))return 61;var a=Fe(e);return He(a,t,r),X=[a.position>>>0,(H=a.position,1<=+Math.abs(H)?0<H?+Math.floor(H/4294967296)>>>0:~~+Math.ceil((H-+(~~H>>>0))/4294967296)>>>0:0)],k[i>>2]=X[0],k[i+4>>2]=X[1],a.La&&0===t&&0===r&&(a.La=null),0}catch(o){if("ErrnoError"!==o.name)throw o;return o.aa}},fd_write:function(e,t,n,r){try{e:{var i=Fe(e);e=t;for(var a,o=t=0;o<n;o++){var s=I[e>>2],u=I[e+4>>2];e+=8;var l=i,c=s,h=u,d=a,f=C;if(0>h||0>d)throw new Ae(28);if(null===l.X)throw new Ae(8);if(!(2097155&l.flags))throw new Ae(8);if(16384==(61440&l.node.mode))throw new Ae(31);if(!l.m.write)throw new Ae(28);l.seekable&&1024&l.flags&&He(l,0,2);var p=void 0!==d;if(p){if(!l.seekable)throw new Ae(70)}else d=l.position;var m=l.m.write(l,f,c,h,d,void 0);p||(l.position+=m);var v=m;if(0>v){var g=-1;break e}t+=v,void 0!==a&&(a+=v)}g=t}return I[r>>2]=g,0}catch(b){if("ErrnoError"!==b.name)throw b;return b.aa}},invoke_vii:function(e,t,n){var r=Bn();try{$t(e)(t,n)}catch(i){if(Wn(r),i!==i+0)throw i;Dn(1,0)}},isWindowsBrowser:function(){return-1<navigator.platform.indexOf("Win")},strftime:Mn,strftime_l:(e,t,n,r)=>Mn(e,t,n,r)},Pn=function(){function e(e){return Pn=e.exports,A=Pn.memory,L(),Bt=Pn.__indirect_function_table,F.unshift(Pn.__wasm_call_ctors),D--,r.monitorRunDependencies?.(D),0==D&&(null!==W&&(clearInterval(W),W=null),B&&(e=B,B=null,e())),Pn}var t={env:In,wasi_snapshot_preview1:In};if(D++,r.monitorRunDependencies?.(D),r.instantiateWasm)try{return r.instantiateWasm(t,e)}catch(i){_(`Module.instantiateWasm callback failed with error: ${i}`),n(i)}return U||=N("canvas_advanced.wasm")?"canvas_advanced.wasm":r.locateFile?r.locateFile("canvas_advanced.wasm",b):b+"canvas_advanced.wasm",function(e,t){var n=U;return y||"function"!=typeof WebAssembly.instantiateStreaming||N(n)||$(n)||"function"!=typeof fetch?Y(n,e,t):fetch(n,{credentials:"same-origin"}).then(r=>WebAssembly.instantiateStreaming(r,e).then(t,function(r){return _(`wasm streaming compile failed: ${r}`),_("falling back to ArrayBuffer instantiation"),Y(n,e,t)}))}(t,function(t){e(t.instance)}).catch(n),{}}(),Rn=e=>(Rn=Pn.free)(e),Sn=e=>(Sn=Pn.malloc)(e),Ln=e=>(Ln=Pn.__getTypeName)(e),Tn=r._ma_device__on_notification_unlocked=e=>(Tn=r._ma_device__on_notification_unlocked=Pn.ma_device__on_notification_unlocked)(e);r._ma_malloc_emscripten=(e,t)=>(r._ma_malloc_emscripten=Pn.ma_malloc_emscripten)(e,t),r._ma_free_emscripten=(e,t)=>(r._ma_free_emscripten=Pn.ma_free_emscripten)(e,t);var Fn,On=r._ma_device_process_pcm_frames_capture__webaudio=(e,t,n)=>(On=r._ma_device_process_pcm_frames_capture__webaudio=Pn.ma_device_process_pcm_frames_capture__webaudio)(e,t,n),jn=r._ma_device_process_pcm_frames_playback__webaudio=(e,t,n)=>(jn=r._ma_device_process_pcm_frames_playback__webaudio=Pn.ma_device_process_pcm_frames_playback__webaudio)(e,t,n),Dn=(e,t)=>(Dn=Pn.setThrew)(e,t),Wn=e=>(Wn=Pn._emscripten_stack_restore)(e),Bn=()=>(Bn=Pn.emscripten_stack_get_current)();function Vn(){function e(){if(!Fn&&(Fn=!0,r.calledRun=!0,!S)){if(r.noFSInit||je||(je=!0,r.stdin=r.stdin,r.stdout=r.stdout,r.stderr=r.stderr,r.stdin?Xe("stdin",r.stdin):$e("/dev/tty","/dev/stdin"),r.stdout?Xe("stdout",null,r.stdout):$e("/dev/tty","/dev/stdout"),r.stderr?Xe("stderr",null,r.stderr):$e("/dev/tty1","/dev/stderr"),Ye("/dev/stdin",0),Ye("/dev/stdout",1),Ye("/dev/stderr",1)),_e=!1,q(F),t(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;){var e=r.postRun.shift();O.unshift(e)}q(O)}}if(!(0<D)){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)j();q(T),0<D||(r.setStatus?(r.setStatus("Running..."),setTimeout(function(){setTimeout(function(){r.setStatus("")},1),e()},1)):e())}}if(r.dynCall_iiji=(e,t,n,i,a)=>(r.dynCall_iiji=Pn.dynCall_iiji)(e,t,n,i,a),r.dynCall_jiji=(e,t,n,i,a)=>(r.dynCall_jiji=Pn.dynCall_jiji)(e,t,n,i,a),r.dynCall_iiiji=(e,t,n,i,a,o)=>(r.dynCall_iiiji=Pn.dynCall_iiiji)(e,t,n,i,a,o),r.dynCall_iij=(e,t,n,i)=>(r.dynCall_iij=Pn.dynCall_iij)(e,t,n,i),r.dynCall_jii=(e,t,n)=>(r.dynCall_jii=Pn.dynCall_jii)(e,t,n),r.dynCall_viijii=(e,t,n,i,a,o,s)=>(r.dynCall_viijii=Pn.dynCall_viijii)(e,t,n,i,a,o,s),r.dynCall_iiiiij=(e,t,n,i,a,o,s)=>(r.dynCall_iiiiij=Pn.dynCall_iiiiij)(e,t,n,i,a,o,s),r.dynCall_iiiiijj=(e,t,n,i,a,o,s,u,l)=>(r.dynCall_iiiiijj=Pn.dynCall_iiiiijj)(e,t,n,i,a,o,s,u,l),r.dynCall_iiiiiijj=(e,t,n,i,a,o,s,u,l,c)=>(r.dynCall_iiiiiijj=Pn.dynCall_iiiiiijj)(e,t,n,i,a,o,s,u,l,c),B=function e(){Fn||Vn(),Fn||(B=e)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);0<r.preInit.length;)r.preInit.pop()();return Vn(),a});var i},e=>{e.exports=/* @__PURE__ */JSON.parse('{"name":"@rive-app/canvas","version":"2.34.2","description":"Rive\'s canvas based web api.","main":"rive.js","homepage":"https://rive.app","repository":{"type":"git","url":"https://github.com/rive-app/rive-wasm/tree/master/js"},"keywords":["rive","animation"],"author":"Rive","contributors":["Luigi Rosso <luigi@rive.app> (https://rive.app)","Maxwell Talbot <max@rive.app> (https://rive.app)","Arthur Vivian <arthur@rive.app> (https://rive.app)","Umberto Sonnino <umberto@rive.app> (https://rive.app)","Matthew Sullivan <matt.j.sullivan@gmail.com> (mailto:matt.j.sullivan@gmail.com)"],"license":"MIT","files":["rive.js","rive.js.map","rive.wasm","rive_fallback.wasm","rive.d.ts","rive_advanced.mjs.d.ts"],"typings":"rive.d.ts","dependencies":{},"browser":{"fs":false,"path":false}}')},(e,t,n)=>{n.r(t),n.d(t,{Animation:()=>r.Animation});var r=n(4)},(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 null!==this.scrubTo},enumerable:!1,configurable:!0}),e.prototype.advance=function(e){null===this.scrubTo?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,{AudioAssetWrapper:()=>a.AudioAssetWrapper,AudioWrapper:()=>a.AudioWrapper,BLANK_URL:()=>i.BLANK_URL,CustomFileAssetLoaderWrapper:()=>a.CustomFileAssetLoaderWrapper,FileAssetWrapper:()=>a.FileAssetWrapper,FileFinalizer:()=>a.FileFinalizer,FontAssetWrapper:()=>a.FontAssetWrapper,FontWrapper:()=>a.FontWrapper,ImageAssetWrapper:()=>a.ImageAssetWrapper,ImageWrapper:()=>a.ImageWrapper,createFinalization:()=>a.createFinalization,finalizationRegistry:()=>a.finalizationRegistry,registerTouchInteractions:()=>r.registerTouchInteractions,sanitizeUrl:()=>i.sanitizeUrl});var r=n(6),i=n(7),a=n(8)},(e,t,n)=>{n.r(t),n.d(t,{registerTouchInteractions:()=>r});var r=function(e){var t=e.canvas,n=e.artboard,r=e.stateMachines,i=void 0===r?[]:r,a=e.renderer,o=e.rive,s=e.fit,u=e.alignment,l=e.isTouchScrollEnabled,c=void 0!==l&&l,h=e.dispatchPointerExit,d=void 0===h||h,f=e.enableMultiTouch,p=void 0!==f&&f,m=e.layoutScaleFactor,v=void 0===m?1:m;if(!(t&&i.length&&a&&o&&n&&"undefined"!=typeof window))return null;var g=null,b=!1,y=function(e){if(b&&e instanceof MouseEvent)"mouseup"==e.type&&(b=!1);else{b=c&&"touchend"===e.type&&"touchstart"===g,g=e.type;var t=e.currentTarget.getBoundingClientRect(),r=function(e,t,n){var r,i,a=[];if(["touchstart","touchmove"].indexOf(e.type)>-1&&(null===(r=e.changedTouches)||void 0===r?void 0:r.length)){t||e.preventDefault();for(var o=0,s=n?e.changedTouches.length:1;o<s;){var u=e.changedTouches[o];a.push({clientX:u.clientX,clientY:u.clientY,identifier:u.identifier}),o++}}else if("touchend"===e.type&&(null===(i=e.changedTouches)||void 0===i?void 0:i.length))for(o=0,s=n?e.changedTouches.length:1;o<s;)u=e.changedTouches[o],a.push({clientX:u.clientX,clientY:u.clientY,identifier:u.identifier}),o++;else a.push({clientX:e.clientX,clientY:e.clientY,identifier:0});return a}(e,c,p),a=o.computeAlignment(s,u,{minX:0,minY:0,maxX:t.width,maxY:t.height},n.bounds,v),l=new o.Mat2D;switch(a.invert(l),r.forEach(function(e){var n=e.clientX,r=e.clientY;if(n||r){var i=n-t.left,a=r-t.top,s=new o.Vec2D(i,a),u=o.mapXY(l,s),c=u.x(),h=u.y();e.transformedX=c,e.transformedY=h,u.delete(),s.delete()}}),l.delete(),a.delete(),e.type){case"mouseout":for(var h=function(e){d?r.forEach(function(t){e.pointerExit(t.transformedX,t.transformedY,t.identifier)}):r.forEach(function(t){e.pointerMove(t.transformedX,t.transformedY,t.identifier)})},f=0,m=i;f<m.length;f++)h(m[f]);break;case"touchmove":case"mouseover":case"mousemove":for(var y=function(e){r.forEach(function(t){e.pointerMove(t.transformedX,t.transformedY,t.identifier)})},w=0,_=i;w<_.length;w++)y(_[w]);break;case"touchstart":case"mousedown":for(var A=function(e){r.forEach(function(t){e.pointerDown(t.transformedX,t.transformedY,t.identifier)})},C=0,E=i;C<E.length;C++)A(E[C]);break;case"touchend":for(var M=function(e){r.forEach(function(t){e.pointerUp(t.transformedX,t.transformedY,t.identifier),e.pointerExit(t.transformedX,t.transformedY,t.identifier)})},x=0,k=i;x<k.length;x++)M(k[x]);break;case"mouseup":for(var I=function(e){r.forEach(function(t){e.pointerUp(t.transformedX,t.transformedY,t.identifier)})},P=0,R=i;P<R.length;P++)I(R[P])}}}.bind(void 0);return t.addEventListener("mouseover",y),t.addEventListener("mouseout",y),t.addEventListener("mousemove",y),t.addEventListener("mousedown",y),t.addEventListener("mouseup",y),t.addEventListener("touchmove",y,{passive:c}),t.addEventListener("touchstart",y,{passive:c}),t.addEventListener("touchend",y),function(){t.removeEventListener("mouseover",y),t.removeEventListener("mouseout",y),t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",y),t.removeEventListener("mouseup",y),t.removeEventListener("touchmove",y),t.removeEventListener("touchstart",y),t.removeEventListener("touchend",y)}}},(e,t,n)=>{n.r(t),n.d(t,{BLANK_URL:()=>l,sanitizeUrl:()=>c});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=/^.+(:|&colon;)/gim,u=[".","/"],l="about:blank";function c(e){if(!e)return l;var t,n=(t=e,t.replace(o,"").replace(i,function(e,t){return String.fromCharCode(t)})).replace(a,"").replace(o,"").trim();if(!n)return l;if(function(e){return u.indexOf(e[0])>-1}(n))return n;var c=n.match(s);if(!c)return n;var h=c[0];return r.test(h)?l:n}},(e,t,n)=>{n.r(t),n.d(t,{AudioAssetWrapper:()=>p,AudioWrapper:()=>l,CustomFileAssetLoaderWrapper:()=>h,FileAssetWrapper:()=>d,FileFinalizer:()=>a,FontAssetWrapper:()=>m,FontWrapper:()=>c,ImageAssetWrapper:()=>f,ImageWrapper:()=>u,createFinalization:()=>b,finalizationRegistry:()=>g});var r,i=(r=function(e,t){return(r=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)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(){function e(e){this.selfUnref=!1,this._file=e}return e.prototype.unref=function(){this._file&&this._file.unref()},e}(),o=function(){function e(e){this._finalizableObject=e}return e.prototype.unref=function(){this._finalizableObject.unref()},e}(),s=function(){function e(){this.selfUnref=!1}return e.prototype.unref=function(){},e}(),u=function(e){function t(t){var n=e.call(this)||this;return n._nativeImage=t,n}return i(t,e),Object.defineProperty(t.prototype,"nativeImage",{get:function(){return this._nativeImage},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeImage.unref()},t}(s),l=function(e){function t(t){var n=e.call(this)||this;return n._nativeAudio=t,n}return i(t,e),Object.defineProperty(t.prototype,"nativeAudio",{get:function(){return this._nativeAudio},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeAudio.unref()},t}(s),c=function(e){function t(t){var n=e.call(this)||this;return n._nativeFont=t,n}return i(t,e),Object.defineProperty(t.prototype,"nativeFont",{get:function(){return this._nativeFont},enumerable:!1,configurable:!0}),t.prototype.unref=function(){this.selfUnref&&this._nativeFont.unref()},t}(s),h=function(){function e(e,t){this._assetLoaderCallback=t,this.assetLoader=new e.CustomFileAssetLoader({loadContents:this.loadContents.bind(this)})}return e.prototype.loadContents=function(e,t){var n;return e.isImage?n=new f(e):e.isAudio?n=new p(e):e.isFont&&(n=new m(e)),this._assetLoaderCallback(n,t)},e}(),d=function(){function e(e){this._nativeFileAsset=e}return e.prototype.decode=function(e){this._nativeFileAsset.decode(e)},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){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.setRenderImage=function(e){this._nativeFileAsset.setRenderImage(e.nativeImage)},t}(d),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.setAudioSource=function(e){this._nativeFileAsset.setAudioSource(e.nativeAudio)},t}(d),m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.setFont=function(e){this._nativeFileAsset.setFont(e.nativeFont)},t}(d),v=function(){function e(e){}return e.prototype.register=function(e){e.selfUnref=!0},e.prototype.unregister=function(e){},e}(),g=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:v)(function(e){null==e||e.unref()}),b=function(e,t){var n=new o(t);g.register(e,n)}}],t={};function n(r){var i=t[r];if(void 0!==i)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=>{"undefined"!=typeof Symbol&&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:()=>a,DataEnum:()=>G,DrawOptimizationOptions:()=>s,EventType:()=>x,Fit:()=>t,Layout:()=>_,LoopType:()=>I,Rive:()=>H,RiveEventType:()=>C,RiveFile:()=>Y,RuntimeLoader:()=>A,StateMachineInput:()=>M,StateMachineInputType:()=>y,Testing:()=>ue,ViewModel:()=>X,ViewModelInstance:()=>q,ViewModelInstanceArtboard:()=>ae,ViewModelInstanceAssetImage:()=>ie,ViewModelInstanceBoolean:()=>Q,ViewModelInstanceColor:()=>re,ViewModelInstanceEnum:()=>te,ViewModelInstanceList:()=>ne,ViewModelInstanceNumber:()=>Z,ViewModelInstanceString:()=>J,ViewModelInstanceTrigger:()=>ee,ViewModelInstanceValue:()=>K,decodeAudio:()=>le,decodeFont:()=>he,decodeImage:()=>ce});var e,t,i,a,o,s,u,l=n(1),c=n(2),h=n(3),d=n(5),f=(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])})(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},p.apply(this,arguments)},m=function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{u(r.next(e))}catch(t){a(t)}}function s(e){try{u(r.throw(e))}catch(t){a(t)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}u((r=r.apply(e,t||[])).next())})},v=function(e,t){var n,r,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(u){s=[6,u],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},g=function(e,t,n){if(n||2===arguments.length)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))},b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.isHandledError=!0,t}return f(t,e),t}(Error);(i=t||(t={})).Cover="cover",i.Contain="contain",i.Fill="fill",i.FitWidth="fitWidth",i.FitHeight="fitHeight",i.None="none",i.ScaleDown="scaleDown",i.Layout="layout",(o=a||(a={})).Center="center",o.TopLeft="topLeft",o.TopCenter="topCenter",o.TopRight="topRight",o.CenterLeft="centerLeft",o.CenterRight="centerRight",o.BottomLeft="bottomLeft",o.BottomCenter="bottomCenter",o.BottomRight="bottomRight",(u=s||(s={})).AlwaysDraw="alwaysDraw",u.DrawOnChanged="drawOnChanged";var y,w,_=function(){function e(e){var n,r,i,o,s,u,l;this.fit=null!==(n=null==e?void 0:e.fit)&&void 0!==n?n:t.Contain,this.alignment=null!==(r=null==e?void 0:e.alignment)&&void 0!==r?r:a.Center,this.layoutScaleFactor=null!==(i=null==e?void 0:e.layoutScaleFactor)&&void 0!==i?i:1,this.minX=null!==(o=null==e?void 0:e.minX)&&void 0!==o?o:0,this.minY=null!==(s=null==e?void 0:e.minY)&&void 0!==s?s:0,this.maxX=null!==(u=null==e?void 0:e.maxX)&&void 0!==u?u:0,this.maxY=null!==(l=null==e?void 0:e.maxY)&&void 0!==l?l:0}return e.new=function(t){var n=t.fit,r=t.alignment,i=t.minX,a=t.minY,o=t.maxX,s=t.maxY;return console.warn("This function is deprecated: please use `new Layout({})` instead"),new e({fit:n,alignment:r,minX:i,minY:a,maxX:o,maxY:s})},e.prototype.copyWith=function(t){var n=t.fit,r=t.alignment,i=t.layoutScaleFactor,a=t.minX,o=t.minY,s=t.maxX,u=t.maxY;return new e({fit:null!=n?n:this.fit,alignment:null!=r?r:this.alignment,layoutScaleFactor:null!=i?i:this.layoutScaleFactor,minX:null!=a?a:this.minX,minY:null!=o?o:this.minY,maxX:null!=s?s:this.maxX,maxY:null!=u?u:this.maxY})},e.prototype.runtimeFit=function(e){return this.cachedRuntimeFit?this.cachedRuntimeFit:(n=this.fit===t.Cover?e.Fit.cover:this.fit===t.Contain?e.Fit.contain:this.fit===t.Fill?e.Fit.fill:this.fit===t.FitWidth?e.Fit.fitWidth:this.fit===t.FitHeight?e.Fit.fitHeight:this.fit===t.ScaleDown?e.Fit.scaleDown:this.fit===t.Layout?e.Fit.layout:e.Fit.none,this.cachedRuntimeFit=n,n);var n},e.prototype.runtimeAlignment=function(e){return this.cachedRuntimeAlignment?this.cachedRuntimeAlignment:(t=this.alignment===a.TopLeft?e.Alignment.topLeft:this.alignment===a.TopCenter?e.Alignment.topCenter:this.alignment===a.TopRight?e.Alignment.topRight:this.alignment===a.CenterLeft?e.Alignment.centerLeft:this.alignment===a.CenterRight?e.Alignment.centerRight:this.alignment===a.BottomLeft?e.Alignment.bottomLeft:this.alignment===a.BottomCenter?e.Alignment.bottomCenter:this.alignment===a.BottomRight?e.Alignment.bottomRight:e.Alignment.center,this.cachedRuntimeAlignment=t,t);var t},e}(),A=function(){function e(){}return e.loadRuntime=function(){l.default({locateFile:function(){return e.wasmURL}}).then(function(t){var n;for(e.runtime=t;e.callBackQueue.length>0;)null===(n=e.callBackQueue.shift())||void 0===n||n(e.runtime)}).catch(function(t){var n={message:(null==t?void 0:t.message)||"Unknown error",type:(null==t?void 0:t.name)||"Error",wasmError:t instanceof WebAssembly.CompileError||t instanceof WebAssembly.RuntimeError,originalError:t};console.debug("Rive WASM load error details:",n);var r="https://cdn.jsdelivr.net/npm/".concat(c.name,"@").concat(c.version,"/rive_fallback.wasm");if(e.wasmURL.toLowerCase()!==r)console.warn("Failed to load WASM from ".concat(e.wasmURL," (").concat(n.message,"), trying jsdelivr as a backup")),e.setWasmUrl(r),e.loadRuntime();else{var i=["Could not load Rive WASM file from ".concat(e.wasmURL," or ").concat(r,"."),"Possible reasons:","- Network connection is down","- WebAssembly is not supported in this environment","- The WASM file is corrupted or incompatible","\nError details:","- Type: ".concat(n.type),"- Message: ".concat(n.message),"- WebAssembly-specific error: ".concat(n.wasmError),"\nTo resolve, you may need to:","1. Check your network connection","2. Set a new WASM source via RuntimeLoader.setWasmUrl()","3. Call RuntimeLoader.loadRuntime() again"].join("\n");console.error(i)}})},e.getInstance=function(t){e.isLoading||(e.isLoading=!0,e.loadRuntime()),e.runtime?t(e.runtime):e.callBackQueue.push(t)},e.awaitInstance=function(){return new Promise(function(t){return e.getInstance(function(e){return t(e)})})},e.setWasmUrl=function(t){e.wasmURL=t},e.getWasmUrl=function(){return e.wasmURL},e.isLoading=!1,e.callBackQueue=[],e.wasmURL="https://unpkg.com/".concat(c.name,"@").concat(c.version,"/rive.wasm"),e}();(w=y||(y={}))[w.Number=56]="Number",w[w.Trigger=58]="Trigger",w[w.Boolean=59]="Boolean";var C,E,M=function(){function e(e,t){this.type=e,this.runtimeInput=t}return Object.defineProperty(e.prototype,"name",{get:function(){return this.runtimeInput.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.runtimeInput.value},set:function(e){this.runtimeInput.value=e},enumerable:!1,configurable:!0}),e.prototype.fire=function(){this.type===y.Trigger&&this.runtimeInput.fire()},e.prototype.delete=function(){this.runtimeInput=null},e}();(E=C||(C={}))[E.General=128]="General",E[E.OpenUrl=131]="OpenUrl";var x,k,I,P,R=function(e){this.isBindableArtboard=!1,this.isBindableArtboard=e},S=function(e){function t(t,n){var r=e.call(this,!1)||this;return r.nativeArtboard=t,r.file=n,r}return f(t,e),t}(R),L=function(e){function t(t){var n=e.call(this,!0)||this;return n.selfUnref=!1,n.nativeArtboard=t,n}return f(t,e),Object.defineProperty(t.prototype,"viewModel",{set:function(e){this.nativeViewModel=e.nativeInstance},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){var e;this.selfUnref&&(this.nativeArtboard.unref(),null===(e=this.nativeViewModel)||void 0===e||e.unref())},t}(R),T=function(){function e(e,t,n,r){this.stateMachine=e,this.playing=n,this.artboard=r,this.inputs=[],this.instance=new t.StateMachineInstance(e,r),this.initInputs(t)}return Object.defineProperty(e.prototype,"name",{get:function(){return this.stateMachine.name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"statesChanged",{get:function(){for(var e=[],t=0;t<this.instance.stateChangedCount();t++)e.push(this.instance.stateChangedNameByIndex(t));return e},enumerable:!1,configurable:!0}),e.prototype.advance=function(e){this.instance.advance(e)},e.prototype.advanceAndApply=function(e){this.instance.advanceAndApply(e)},e.prototype.reportedEventCount=function(){return this.instance.reportedEventCount()},e.prototype.reportedEventAt=function(e){return this.instance.reportedEventAt(e)},e.prototype.initInputs=function(e){for(var t=0;t<this.instance.inputCount();t++){var n=this.instance.input(t);this.inputs.push(this.mapRuntimeInput(n,e))}},e.prototype.mapRuntimeInput=function(e,t){return e.type===t.SMIInput.bool?new M(y.Boolean,e.asBool()):e.type===t.SMIInput.number?new M(y.Number,e.asNumber()):e.type===t.SMIInput.trigger?new M(y.Trigger,e.asTrigger()):void 0},e.prototype.cleanup=function(){this.inputs.forEach(function(e){e.delete()}),this.inputs.length=0,this.instance.delete()},e.prototype.bindViewModelInstance=function(e){null!=e.runtimeInstance&&this.instance.bindViewModelInstance(e.runtimeInstance)},e}(),F=function(){function e(e,t,n,r,i){void 0===r&&(r=[]),void 0===i&&(i=[]),this.runtime=e,this.artboard=t,this.eventManager=n,this.animations=r,this.stateMachines=i}return e.prototype.add=function(e,t,n){if(void 0===n&&(n=!0),0===(e=se(e)).length)this.animations.forEach(function(e){return e.playing=t}),this.stateMachines.forEach(function(e){return e.playing=t});else for(var r=this.animations.map(function(e){return e.name}),i=this.stateMachines.map(function(e){return e.name}),a=0;a<e.length;a++){var o=r.indexOf(e[a]),s=i.indexOf(e[a]);if(o>=0||s>=0)o>=0?this.animations[o].playing=t:this.stateMachines[s].playing=t;else{var u=this.artboard.animationByName(e[a]);if(u){var l=new h.Animation(u,this.artboard,this.runtime,t);l.advance(0),l.apply(1),this.animations.push(l)}else{var c=this.artboard.stateMachineByName(e[a]);if(c){var d=new T(c,this.runtime,t,this.artboard);this.stateMachines.push(d)}}}}return n&&(t?this.eventManager.fire({type:x.Play,data:this.playing}):this.eventManager.fire({type:x.Pause,data:this.paused})),t?this.playing:this.paused},e.prototype.initLinearAnimations=function(e,t){for(var n=this.animations.map(function(e){return e.name}),r=0;r<e.length;r++){var i=n.indexOf(e[r]);if(i>=0)this.animations[i].playing=t;else{var a=this.artboard.animationByName(e[r]);if(a){var o=new h.Animation(a,this.artboard,this.runtime,t);o.advance(0),o.apply(1),this.animations.push(o)}else console.error("Animation with name ".concat(e[r]," not found."))}}},e.prototype.initStateMachines=function(e,t){for(var n=this.stateMachines.map(function(e){return e.name}),r=0;r<e.length;r++){var i=n.indexOf(e[r]);if(i>=0)this.stateMachines[i].playing=t;else{var a=this.artboard.stateMachineByName(e[r]);if(a){var o=new T(a,this.runtime,t,this.artboard);this.stateMachines.push(o)}else console.warn("State Machine with name ".concat(e[r]," not found.")),this.initLinearAnimations([e[r]],t)}}},e.prototype.play=function(e){return this.add(e,!0)},e.prototype.advanceIfPaused=function(){this.stateMachines.forEach(function(e){e.playing||e.advanceAndApply(0)})},e.prototype.pause=function(e){return this.add(e,!1)},e.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(e.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(e.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}),e.prototype.stop=function(e){var t=this,n=[];if(0===(e=se(e)).length)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:x.Stop,data:n}),n},Object.defineProperty(e.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(e.prototype,"isPaused",{get:function(){return!this.isPlaying&&(this.animations.length>0||this.stateMachines.length>0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStopped",{get:function(){return 0===this.animations.length&&0===this.stateMachines.length},enumerable:!1,configurable:!0}),e.prototype.atLeastOne=function(e,t){var n;return void 0===t&&(t=!0),0===this.animations.length&&0===this.stateMachines.length&&(this.artboard.animationCount()>0?this.add([n=this.artboard.animationByIndex(0).name],e,t):this.artboard.stateMachineCount()>0&&this.add([n=this.artboard.stateMachineByIndex(0).name],e,t)),n},e.prototype.handleLooping=function(){for(var e=0,t=this.animations.filter(function(e){return e.playing});e<t.length;e++){var n=t[e];0===n.loopValue&&n.loopCount?(n.loopCount=0,this.stop(n.name)):1===n.loopValue&&n.loopCount?(this.eventManager.fire({type:x.Loop,data:{animation:n.name,type:I.Loop}}),n.loopCount=0):2===n.loopValue&&n.loopCount>1&&(this.eventManager.fire({type:x.Loop,data:{animation:n.name,type:I.PingPong}}),n.loopCount=0)}},e.prototype.handleStateChanges=function(){for(var e=[],t=0,n=this.stateMachines.filter(function(e){return e.playing});t<n.length;t++){var r=n[t];e.push.apply(e,r.statesChanged)}e.length>0&&this.eventManager.fire({type:x.StateChange,data:e})},e.prototype.handleAdvancing=function(e){this.eventManager.fire({type:x.Advance,data:e})},e}();(k=x||(x={})).Load="load",k.LoadError="loaderror",k.Play="play",k.Pause="pause",k.Stop="stop",k.Loop="loop",k.Draw="draw",k.Advance="advance",k.StateChange="statechange",k.RiveEvent="riveevent",k.AudioStatusChange="audiostatuschange",(P=I||(I={})).OneShot="oneshot",P.Loop="loop",P.PingPong="pingpong";var O,j,D=function(){function e(e){void 0===e&&(e=[]),this.listeners=e}return e.prototype.getListeners=function(e){return this.listeners.filter(function(t){return t.type===e})},e.prototype.add=function(e){this.listeners.includes(e)||this.listeners.push(e)},e.prototype.remove=function(e){for(var t=0;t<this.listeners.length;t++){var n=this.listeners[t];if(n.type===e.type&&n.callback===e.callback){this.listeners.splice(t,1);break}}},e.prototype.removeAll=function(e){var t=this;e?this.listeners.filter(function(t){return t.type===e}).forEach(function(e){return t.remove(e)}):this.listeners.splice(0,this.listeners.length)},e.prototype.fire=function(e){this.getListeners(e.type).forEach(function(t){return t.callback(e)})},e}(),W=function(){function e(e){this.eventManager=e,this.queue=[]}return e.prototype.add=function(e){this.queue.push(e)},e.prototype.process=function(){for(;this.queue.length>0;){var e=this.queue.shift();(null==e?void 0:e.action)&&e.action(),(null==e?void 0:e.event)&&this.eventManager.fire(e.event)}},e}();(j=O||(O={}))[j.AVAILABLE=0]="AVAILABLE",j[j.UNAVAILABLE=1]="UNAVAILABLE";var B,V,U=new(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._started=!1,t._enabled=!1,t._status=O.UNAVAILABLE,t}return f(t,e),t.prototype.delay=function(e){return m(this,void 0,void 0,function(){return v(this,function(t){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},t.prototype.timeout=function(){return m(this,void 0,void 0,function(){return v(this,function(e){return[2,new Promise(function(e,t){return setTimeout(t,50)})]})})},t.prototype.reportToListeners=function(){this.fire({type:x.AudioStatusChange}),this.removeAll()},t.prototype.enableAudio=function(){return m(this,void 0,void 0,function(){return v(this,function(e){return this._enabled||(this._enabled=!0,this._status=O.AVAILABLE,this.reportToListeners()),[2]})})},t.prototype.testAudio=function(){return m(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:if(this._status!==O.UNAVAILABLE||null===this._audioContext)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 m(this,void 0,void 0,function(){return v(this,function(e){switch(e.label){case 0:return this._started?[3,5]:(this._started=!0,"undefined"!=typeof window?[3,1]:(this.enableAudio(),[3,5]));case 1:this._audioContext=new AudioContext,this.listenForUserAction(),e.label=2;case 2:return this._status!==O.UNAVAILABLE?[3,5]:[4,this.testAudio()];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 m(e,void 0,void 0,function(){return v(this,function(e){return this.enableAudio(),[2]})})},{once:!0})},t.prototype.establishAudio=function(){return m(this,void 0,void 0,function(){return v(this,function(e){return this._establishAudio(),[2]})})},Object.defineProperty(t.prototype,"systemVolume",{get:function(){return this._status===O.UNAVAILABLE?(this.testAudio(),0):1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this._status},enumerable:!1,configurable:!0}),t}(D)),N=function(){function e(){}return e.prototype.observe=function(){},e.prototype.unobserve=function(){},e.prototype.disconnect=function(){},e}(),$=globalThis.ResizeObserver||N,z=new(function(){function e(){var e=this;this._elementsMap=/* @__PURE__ */new Map,this._onObservedEntry=function(t){var n=e._elementsMap.get(t.target);null!==n?n.onResize(0==t.target.clientWidth||0==t.target.clientHeight):e._resizeObserver.unobserve(t.target)},this._onObserved=function(t){t.forEach(e._onObservedEntry)},this._resizeObserver=new $(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}()),Y=function(){function e(e){this.enableRiveAssetCDN=!0,this.referenceCount=0,this.destroyed=!1,this.selfUnref=!1,this.bindableArtboards=[],this.src=e.src,this.buffer=e.buffer,e.assetLoader&&(this.assetLoader=e.assetLoader),this.enableRiveAssetCDN="boolean"!=typeof e.enableRiveAssetCDN||e.enableRiveAssetCDN,this.eventManager=new D,e.onLoad&&this.on(x.Load,e.onLoad),e.onLoadError&&this.on(x.LoadError,e.onLoadError)}return e.prototype.releaseFile=function(){var e;this.selfUnref&&(null===(e=this.file)||void 0===e||e.unref()),this.file=null},e.prototype.releaseBindableArtboards=function(){this.bindableArtboards.forEach(function(e){return e.destroy()})},e.prototype.initData=function(){return m(this,void 0,void 0,function(){var t,n,r,i,a;return v(this,function(o){switch(o.label){case 0:return this.src?(t=this,[4,oe(this.src)]):[3,2];case 1:t.buffer=o.sent(),o.label=2;case 2:return this.destroyed?[2]:(this.assetLoader&&(r=new d.CustomFileAssetLoaderWrapper(this.runtime,this.assetLoader),n=r.assetLoader),i=this,[4,this.runtime.load(new Uint8Array(this.buffer),n,this.enableRiveAssetCDN)]);case 3:return i.file=o.sent(),a=new d.FileFinalizer(this.file),d.finalizationRegistry.register(this,a),this.destroyed?(this.releaseFile(),[2]):(null!==this.file?this.eventManager.fire({type:x.Load,data:this}):this.fireLoadError(e.fileLoadErrorMessage),[2])}})})},e.prototype.init=function(){return m(this,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:if(!this.src&&!this.buffer)return this.fireLoadError(e.missingErrorMessage),[2];r.label=1;case 1:return r.trys.push([1,4,,5]),t=this,[4,A.awaitInstance()];case 2:return t.runtime=r.sent(),this.destroyed?[2]:[4,this.initData()];case 3:return r.sent(),[3,5];case 4:return n=r.sent(),this.fireLoadError(n instanceof Error?n.message:e.fileLoadErrorMessage),[3,5];case 5:return[2]}})})},e.prototype.fireLoadError=function(e){throw this.eventManager.fire({type:x.LoadError,data:e}),new Error(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-=1,this.referenceCount<=0&&(this.removeAllRiveEventListeners(),this.releaseFile(),this.releaseBindableArtboards(),this.destroyed=!0)},e.prototype.removeAllRiveEventListeners=function(e){this.eventManager.removeAll(e)},e.prototype.getInstance=function(){if(null!==this.file)return this.referenceCount+=1,this.file},e.prototype.destroyIfUnused=function(){this.referenceCount<=0&&this.cleanup()},e.prototype.createBindableArtboard=function(e){if(null!=e){var t=new L(e);return(0,d.createFinalization)(t,t.nativeArtboard),this.bindableArtboards.push(t),t}return null},e.prototype.getArtboard=function(e){var t=this.file.artboardByName(e);if(null!=t)return new S(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 null!==t?new X(t):null},e.missingErrorMessage="Rive source file or data buffer required",e.fileLoadErrorMessage="The file failed to load",e}(),H=function(){function e(e){var t,n,r=this;this.loaded=!1,this.destroyed=!1,this._observed=null,this.readyForPlaying=!1,this.artboard=null,this.eventCleanup=null,this.shouldDisableRiveListeners=!1,this.automaticallyHandleEvents=!1,this.dispatchPointerExit=!0,this.enableMultiTouch=!1,this.enableRiveAssetCDN=!0,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._viewModelInstance=null,this._dataEnums=null,this.drawOptimization=s.DrawOnChanged,this.durations=[],this.frameTimes=[],this.frameCount=0,this.isTouchScrollEnabled=!1,this.onCanvasResize=function(e){var t=r._hasZeroSize!==e;r._hasZeroSize=e,e?r._layout.maxX&&r._layout.maxY||r.resizeToCanvas():t&&r.resizeDrawingSurfaceToCanvas()},this.renderSecondTimer=0,this._boundDraw=this.draw.bind(this),this.canvas=e.canvas,e.canvas.constructor===HTMLCanvasElement&&(this._observed=z.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=null!==(t=e.layout)&&void 0!==t?t:new _,this.shouldDisableRiveListeners=!!e.shouldDisableRiveListeners,this.isTouchScrollEnabled=!!e.isTouchScrollEnabled,this.automaticallyHandleEvents=!!e.automaticallyHandleEvents,this.dispatchPointerExit=!1===e.dispatchPointerExit?e.dispatchPointerExit:this.dispatchPointerExit,this.enableMultiTouch=!!e.enableMultiTouch,this.drawOptimization=null!==(n=e.drawingOptions)&&void 0!==n?n:this.drawOptimization,this.enableRiveAssetCDN=void 0===e.enableRiveAssetCDN||e.enableRiveAssetCDN,this.eventManager=new D,e.onLoad&&this.on(x.Load,e.onLoad),e.onLoadError&&this.on(x.LoadError,e.onLoadError),e.onPlay&&this.on(x.Play,e.onPlay),e.onPause&&this.on(x.Pause,e.onPause),e.onStop&&this.on(x.Stop,e.onStop),e.onLoop&&this.on(x.Loop,e.onLoop),e.onStateChange&&this.on(x.StateChange,e.onStateChange),e.onAdvance&&this.on(x.Advance,e.onAdvance),e.onload&&!e.onLoad&&this.on(x.Load,e.onload),e.onloaderror&&!e.onLoadError&&this.on(x.LoadError,e.onloaderror),e.onplay&&!e.onPlay&&this.on(x.Play,e.onplay),e.onpause&&!e.onPause&&this.on(x.Pause,e.onpause),e.onstop&&!e.onStop&&this.on(x.Stop,e.onstop),e.onloop&&!e.onLoop&&this.on(x.Loop,e.onloop),e.onstatechange&&!e.onStateChange&&this.on(x.StateChange,e.onstatechange),e.assetLoader&&(this.assetLoader=e.assetLoader),this.taskQueue=new W(this.eventManager),this.init({src:this.src,buffer:this.buffer,riveFile:this.riveFile,autoplay:e.autoplay,autoBind:e.autoBind,animations:e.animations,stateMachines:e.stateMachines,artboard:e.artboard,useOffscreenRenderer:e.useOffscreenRenderer})}return Object.defineProperty(e.prototype,"viewModelCount",{get:function(){return this.file.viewModelCount()},enumerable:!1,configurable:!0}),e.new=function(t){return console.warn("This function is deprecated: please use `new Rive({})` instead"),new e(t)},e.prototype.onSystemAudioChanged=function(){this.volume=this._volume},e.prototype.init=function(t){var n=this,r=t.src,i=t.buffer,a=t.riveFile,o=t.animations,s=t.stateMachines,u=t.artboard,l=t.autoplay,c=void 0!==l&&l,h=t.useOffscreenRenderer,d=void 0!==h&&h,f=t.autoBind,p=void 0!==f&&f;if(!this.destroyed){if(this.src=r,this.buffer=i,this.riveFile=a,!this.src&&!this.buffer&&!this.riveFile)throw new b(e.missingErrorMessage);var m=se(o),v=se(s);this.loaded=!1,this.readyForPlaying=!1,A.awaitInstance().then(function(e){n.destroyed||(n.runtime=e,n.removeRiveListeners(),n.deleteRiveRenderer(),n.renderer=n.runtime.makeRenderer(n.canvas,d),n.canvas.width||n.canvas.height||n.resizeDrawingSurfaceToCanvas(),n.initData(u,m,v,c,p).then(function(e){if(e)return n.setupRiveListeners()}).catch(function(e){console.error(e)}))}).catch(function(e){console.error(e)})}},e.prototype.setupRiveListeners=function(e){var t=this;if(this.eventCleanup&&this.eventCleanup(),!this.shouldDisableRiveListeners){var n=(this.animator.stateMachines||[]).filter(function(e){return e.playing&&t.runtime.hasListeners(e.instance)}).map(function(e){return e.instance}),r=this.isTouchScrollEnabled,i=this.dispatchPointerExit,a=this.enableMultiTouch;e&&"isTouchScrollEnabled"in e&&(r=e.isTouchScrollEnabled),this.eventCleanup=(0,d.registerTouchInteractions)({canvas:this.canvas,artboard:this.artboard,stateMachines:n,renderer:this.renderer,rive:this.runtime,fit:this._layout.runtimeFit(this.runtime),alignment:this._layout.runtimeAlignment(this.runtime),isTouchScrollEnabled:r,dispatchPointerExit:i,enableMultiTouch:a,layoutScaleFactor:this._layout.layoutScaleFactor})}},e.prototype.removeRiveListeners=function(){this.eventCleanup&&(this.eventCleanup(),this.eventCleanup=null)},e.prototype.initializeAudio=function(){var e,t=this;U.status==O.UNAVAILABLE&&(null===(e=this.artboard)||void 0===e?void 0:e.hasAudio)&&null===this._audioEventListener&&(this._audioEventListener={type:x.AudioStatusChange,callback:function(){return t.onSystemAudioChanged()}},U.add(this._audioEventListener),U.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,i){return m(this,void 0,void 0,function(){var a,o,s,u;return v(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),null!=this.riveFile?[3,2]:(a=new Y({src:this.src,buffer:this.buffer,enableRiveAssetCDN:this.enableRiveAssetCDN,assetLoader:this.assetLoader}),this.riveFile=a,[4,a.init()]);case 1:if(l.sent(),this.destroyed)return a.destroyIfUnused(),[2,!1];l.label=2;case 2:return this.file=this.riveFile.getInstance(),this.initArtboard(e,t,n,r,i),this.initArtboardSize(),this.initializeAudio(),this.loaded=!0,this.eventManager.fire({type:x.Load,data:null!==(u=this.src)&&void 0!==u?u:"buffer"}),this.animator.advanceIfPaused(),this.readyForPlaying=!0,this.taskQueue.process(),this.drawFrame(),[2,!0];case 3:return o=l.sent(),s=(c=o)&&c.isHandledError?c.message:"Problem loading file; may be corrupt!",console.warn(s),this.eventManager.fire({type:x.LoadError,data:s}),[2,Promise.reject(s)];case 4:return[2]}var c})})},e.prototype.initArtboard=function(e,t,n,r,i){if(this.file){var a,o=e?this.file.artboardByName(e):this.file.defaultArtboard();if(!o){var s="Invalid artboard name or no default artboard";return console.warn(s),void this.eventManager.fire({type:x.LoadError,data:s})}if(this.artboard=o,o.volume=this._volume*U.systemVolume,this.animator=new F(this.runtime,this.artboard,this.eventManager),t.length>0||n.length>0?(a=t.concat(n),this.animator.initLinearAnimations(t,r),this.animator.initStateMachines(n,r)):a=[this.animator.atLeastOne(r,!1)],this.taskQueue.add({event:{type:r?x.Play:x.Pause,data:a}}),i){var u=this.file.defaultArtboardViewModel(o);if(null!==u){var l=u.defaultInstance();if(null!==l){var c=new q(l,null);(0,d.createFinalization)(c,c.runtimeInstance),this.bindViewModelInstance(c)}}}}},e.prototype.drawFrame=function(){var e,t;(null===(e=null===document||void 0===document?void 0:document.timeline)||void 0===e?void 0:e.currentTime)?this.loaded&&this.artboard&&!this.frameRequestId&&(this._boundDraw(document.timeline.currentTime),null===(t=this.runtime)||void 0===t||t.resolveAnimationFrame()):this.scheduleRendering()},e.prototype._canvasSizeChanged=function(){var e=!1;return this.canvas&&(this.canvas.width!==this._currentCanvasWidth&&(this._currentCanvasWidth=this.canvas.width,e=!0),this.canvas.height!==this._currentCanvasHeight&&(this._currentCanvasHeight=this.canvas.height,e=!0)),e},e.prototype.draw=function(e,t){var n;this.frameRequestId=null;var r=performance.now();this.lastRenderTime||(this.lastRenderTime=e),this.renderSecondTimer+=e-this.lastRenderTime,this.renderSecondTimer>5e3&&(this.renderSecondTimer=0,null==t||t());var i=(e-this.lastRenderTime)/1e3;this.lastRenderTime=e;for(var a=0,o=this.animator.animations.filter(function(e){return e.playing||e.needsScrub}).sort(function(e){return e.needsScrub?-1:1});a<o.length;a++){var u=o[a];u.advance(i),u.instance.didLoop&&(u.loopCount+=1),u.apply(1)}for(var l=0,c=this.animator.stateMachines.filter(function(e){return e.playing});l<c.length;l++){var h=c[l],f=h.reportedEventCount();if(f)for(var p=0;p<f;p++){var m=h.reportedEventAt(p);if(m)if(m.type===C.OpenUrl){if(this.eventManager.fire({type:x.RiveEvent,data:m}),this.automaticallyHandleEvents){var v=document.createElement("a"),g=m,b=g.url,y=g.target,w=(0,d.sanitizeUrl)(b);b&&v.setAttribute("href",w),y&&v.setAttribute("target",y),w&&w!==d.BLANK_URL&&v.click()}}else this.eventManager.fire({type:x.RiveEvent,data:m})}h.advanceAndApply(i)}0==this.animator.stateMachines.length&&this.artboard.advance(i);var _=this.renderer;this._hasZeroSize||(this.drawOptimization==s.AlwaysDraw||this.artboard.didChange()||this._needsRedraw||this._canvasSizeChanged())&&(_.clear(),_.save(),this.alignRenderer(),this.artboard.draw(_),_.restore(),_.flush(),this._needsRedraw=!1),this.animator.handleLooping(),this.animator.handleStateChanges(),this.animator.handleAdvancing(i),this.frameCount++;var A=performance.now();for(this.frameTimes.push(A),this.durations.push(A-r);this.frameTimes[0]<=A-1e3;)this.frameTimes.shift(),this.durations.shift();null===(n=this._viewModelInstance)||void 0===n||n.handleCallbacks(),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 0===this.durations.length?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;this.destroyed=!0,this.stopRendering(),this.cleanupInstances(),null!==this._observed&&z.remove(this._observed),this.removeRiveListeners(),this.file&&(null===(e=this.riveFile)||void 0===e||e.cleanup(),this.file=null),this.riveFile=null,this.deleteRiveRenderer(),null!==this._audioEventListener&&(U.remove(this._audioEventListener),this._audioEventListener=null),null===(t=this._viewModelInstance)||void 0===t||t.cleanup(),this._viewModelInstance=null,this._dataEnums=null},e.prototype.deleteRiveRenderer=function(){var e;null===(e=this.renderer)||void 0===e||e.delete(),this.renderer=null},e.prototype.cleanupInstances=function(){null!==this.eventCleanup&&this.eventCleanup(),this.stop(),this.artboard&&(this.artboard.delete(),this.artboard=null)},e.prototype.retrieveTextRun=function(e){var t;if(e)if(this.artboard){var n=this.artboard.textRun(e);if(n)return n;console.warn("Could not access a text run with name '".concat(e,"' in the '").concat(null===(t=this.artboard)||void 0===t?void 0:t.name,"' Artboard. Note that you must rename a text run node in the Rive editor to make it queryable at runtime."))}else console.warn("Tried to access text run, but the Artboard is null");else console.warn("No text run name provided")},e.prototype.getTextRunValue=function(e){var t=this.retrieveTextRun(e);return t?t.text:void 0},e.prototype.setTextRunValue=function(e,t){var n=this.retrieveTextRun(e);n&&(n.text=t)},e.prototype.play=function(e,t){var n=this;e=se(e),this.readyForPlaying?(this.animator.play(e),this.eventCleanup&&this.eventCleanup(),this.setupRiveListeners(),this.startRendering()):this.taskQueue.add({action:function(){return n.play(e,t)}})},e.prototype.pause=function(e){var t=this;e=se(e),this.readyForPlaying?(this.eventCleanup&&this.eventCleanup(),this.animator.pause(e)):this.taskQueue.add({action:function(){return t.pause(e)}})},e.prototype.scrub=function(e,t){var n=this;e=se(e),this.readyForPlaying?(this.animator.scrub(e,t||0),this.drawFrame()):this.taskQueue.add({action:function(){return n.scrub(e,t)}})},e.prototype.stop=function(e){var t=this;e=se(e),this.readyForPlaying?(this.animator&&this.animator.stop(e),this.eventCleanup&&this.eventCleanup()):this.taskQueue.add({action:function(){return t.stop(e)}})},e.prototype.reset=function(e){var t,n,r=null==e?void 0:e.artboard,i=se(null==e?void 0:e.animations),a=se(null==e?void 0:e.stateMachines),o=null!==(t=null==e?void 0:e.autoplay)&&void 0!==t&&t,s=null!==(n=null==e?void 0:e.autoBind)&&void 0!==n&&n;this.cleanupInstances(),this.initArtboard(r,i,a,o,s),this.taskQueue.process()},e.prototype.load=function(e){this.file=null,this.stop(),this.init(e)},Object.defineProperty(e.prototype,"layout",{get:function(){return this._layout},set:function(e){this._layout=e,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})},e.prototype.resizeDrawingSurfaceToCanvas=function(e){if(this.canvas instanceof HTMLCanvasElement&&window){var n=this.canvas.getBoundingClientRect(),r=n.width,i=n.height,a=e||window.devicePixelRatio||1;if(this.devicePixelRatioUsed=a,this.canvas.width=a*r,this.canvas.height=a*i,this._needsRedraw=!0,this.resizeToCanvas(),this.drawFrame(),this.layout.fit===t.Layout){var o=this._layout.layoutScaleFactor;this.artboard.width=r/o,this.artboard.height=i/o}}},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,"animationNames",{get:function(){if(!this.loaded||!this.artboard)return[];for(var e=[],t=0;t<this.artboard.animationCount();t++)e.push(this.artboard.animationByIndex(t).name);return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateMachineNames",{get:function(){if(!this.loaded||!this.artboard)return[];for(var e=[],t=0;t<this.artboard.stateMachineCount();t++)e.push(this.artboard.stateMachineByIndex(t).name);return e},enumerable:!1,configurable:!0}),e.prototype.stateMachineInputs=function(e){if(this.loaded){var t=this.animator.stateMachines.find(function(t){return t.name===e});return null==t?void 0:t.inputs}},e.prototype.retrieveInputAtPath=function(e,t){if(e)if(this.artboard){var n=this.artboard.inputByPath(e,t);if(n)return n;console.warn("Could not access an input with name: '".concat(e,"', at path:'").concat(t,"'"))}else console.warn("Tried to access input: '".concat(e,"', at path: '").concat(t,"', but the Artboard is null"));else console.warn("No input name provided for path '".concat(t,"'"))},e.prototype.setBooleanStateAtPath=function(e,t,n){var r=this.retrieveInputAtPath(e,n);r&&(r.type===y.Boolean?r.asBool().value=t:console.warn("Input with name: '".concat(e,"', at path:'").concat(n,"' is not a boolean")))},e.prototype.setNumberStateAtPath=function(e,t,n){var r=this.retrieveInputAtPath(e,n);r&&(r.type===y.Number?r.asNumber().value=t:console.warn("Input with name: '".concat(e,"', at path:'").concat(n,"' is not a number")))},e.prototype.fireStateAtPath=function(e,t){var n=this.retrieveInputAtPath(e,t);n&&(n.type===y.Trigger?n.asTrigger().fire():console.warn("Input with name: '".concat(e,"', at path:'").concat(t,"' is not a trigger")))},e.prototype.retrieveTextAtPath=function(e,t){if(e)if(t)if(this.artboard){var n=this.artboard.textByPath(e,t);if(n)return n;console.warn("Could not access text with name: '".concat(e,"', at path:'").concat(t,"'"))}else console.warn("Tried to access text: '".concat(e,"', at path: '").concat(t,"', but the Artboard is null"));else console.warn("No path provided for text '".concat(e,"'"));else console.warn("No text name provided for path '".concat(t,"'"))},e.prototype.getTextRunValueAtPath=function(e,t){var n=this.retrieveTextAtPath(e,t);if(n)return n.text;console.warn("Could not get text with name: '".concat(e,"', at path:'").concat(t,"'"))},e.prototype.setTextRunValueAtPath=function(e,t,n){var r=this.retrieveTextAtPath(e,n);r?r.text=t:console.warn("Could not set text with name: '".concat(e,"', at path:'").concat(n,"'"))},Object.defineProperty(e.prototype,"playingStateMachineNames",{get:function(){return this.loaded?this.animator.stateMachines.filter(function(e){return e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"playingAnimationNames",{get:function(){return this.loaded?this.animator.animations.filter(function(e){return e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pausedAnimationNames",{get:function(){return this.loaded?this.animator.animations.filter(function(e){return!e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pausedStateMachineNames",{get:function(){return this.loaded?this.animator.stateMachines.filter(function(e){return!e.playing}).map(function(e){return e.name}):[]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this.animator.isPlaying},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPaused",{get:function(){return this.animator.isPaused},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isStopped",{get:function(){var e,t;return null===(t=null===(e=this.animator)||void 0===e?void 0:e.isStopped)||void 0===t||t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bounds",{get:function(){return this.artboard?this.artboard.bounds:void 0},enumerable:!1,configurable:!0}),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.unsubscribe=function(e,t){console.warn("This function is deprecated: please use `off()` instead."),this.off(e,t)},e.prototype.removeAllRiveEventListeners=function(e){this.eventManager.removeAll(e)},e.prototype.unsubscribeAll=function(e){console.warn("This function is deprecated: please use `removeAllRiveEventListeners()` instead."),this.removeAllRiveEventListeners(e)},e.prototype.stopRendering=function(){this.loaded&&this.frameRequestId&&(this.runtime.cancelAnimationFrame?this.runtime.cancelAnimationFrame(this.frameRequestId):cancelAnimationFrame(this.frameRequestId),this.frameRequestId=null)},e.prototype.startRendering=function(){this.drawFrame()},e.prototype.scheduleRendering=function(){this.loaded&&this.artboard&&!this.frameRequestId&&(this.runtime.requestAnimationFrame?this.frameRequestId=this.runtime.requestAnimationFrame(this._boundDraw):this.frameRequestId=requestAnimationFrame(this._boundDraw))},e.prototype.enableFPSCounter=function(e){this.runtime.enableFPSCounter(e)},e.prototype.disableFPSCounter=function(){this.runtime.disableFPSCounter()},Object.defineProperty(e.prototype,"contents",{get:function(){if(this.loaded){for(var e={artboards:[]},t=0;t<this.file.artboardCount();t++){for(var n=this.file.artboardByIndex(t),r={name:n.name,animations:[],stateMachines:[]},i=0;i<n.animationCount();i++){var a=n.animationByIndex(i);r.animations.push(a.name)}for(var o=0;o<n.stateMachineCount();o++){for(var s=n.stateMachineByIndex(o),u=s.name,l=new this.runtime.StateMachineInstance(s,n),c=[],h=0;h<l.inputCount();h++){var d=l.input(h);c.push({name:d.name,type:d.type})}r.stateMachines.push({name:u,inputs:c})}e.artboards.push(r)}return e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this.artboard&&this.artboard.volume!==this._volume&&(this._volume=this.artboard.volume),this._volume},set:function(e){this._volume=e,this.artboard&&(this.artboard.volume=e*U.systemVolume)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"artboardWidth",{get:function(){var e;return this.artboard?this.artboard.width:null!==(e=this._artboardWidth)&&void 0!==e?e:0},set:function(e){this._artboardWidth=e,this.artboard&&(this.artboard.width=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"artboardHeight",{get:function(){var e;return this.artboard?this.artboard.height:null!==(e=this._artboardHeight)&&void 0!==e?e:0},set:function(e){this._artboardHeight=e,this.artboard&&(this.artboard.height=e)},enumerable:!1,configurable:!0}),e.prototype.resetArtboardSize=function(){this.artboard?(this.artboard.resetArtboardSize(),this._artboardWidth=this.artboard.width,this._artboardHeight=this.artboard.height):(this._artboardWidth=void 0,this._artboardHeight=void 0)},Object.defineProperty(e.prototype,"devicePixelRatioUsed",{get:function(){return this._devicePixelRatioUsed},set:function(e){this._devicePixelRatioUsed=e},enumerable:!1,configurable:!0}),e.prototype.bindViewModelInstance=function(e){var t;this.artboard&&!this.destroyed&&e&&e.runtimeInstance&&(e.internalIncrementReferenceCount(),null===(t=this._viewModelInstance)||void 0===t||t.cleanup(),this._viewModelInstance=e,this.animator.stateMachines.length>0?this.animator.stateMachines.forEach(function(t){return t.bindViewModelInstance(e)}):this.artboard.bindViewModelInstance(e.runtimeInstance))},Object.defineProperty(e.prototype,"viewModelInstance",{get:function(){return this._viewModelInstance},enumerable:!1,configurable:!0}),e.prototype.viewModelByIndex=function(e){var t=this.file.viewModelByIndex(e);return null!==t?new X(t):null},e.prototype.viewModelByName=function(e){var t;return null===(t=this.riveFile)||void 0===t?void 0:t.viewModelByName(e)},e.prototype.enums=function(){return null===this._dataEnums&&(this._dataEnums=this.file.enums().map(function(e){return new G(e)})),this._dataEnums},e.prototype.defaultViewModel=function(){if(this.artboard){var e=this.file.defaultArtboardViewModel(this.artboard);if(e)return new X(e)}return null},e.prototype.getArtboard=function(e){var t,n;return null!==(n=null===(t=this.riveFile)||void 0===t?void 0:t.getArtboard(e))&&void 0!==n?n:null},e.prototype.getBindableArtboard=function(e){var t,n;return null!==(n=null===(t=this.riveFile)||void 0===t?void 0:t.getBindableArtboard(e))&&void 0!==n?n:null},e.prototype.getDefaultBindableArtboard=function(){var e,t;return null!==(t=null===(e=this.riveFile)||void 0===e?void 0:e.getDefaultBindableArtboard())&&void 0!==t?t:null},e.missingErrorMessage="Rive source file or data buffer required",e.cleanupErrorMessage="Attempt to use file after calling cleanup.",e}(),X=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(null!==t){var n=new q(t,null);return(0,d.createFinalization)(n,t),n}return null},e.prototype.instanceByName=function(e){var t=this._viewModel.instanceByName(e);if(null!==t){var n=new q(t,null);return(0,d.createFinalization)(n,t),n}return null},e.prototype.defaultInstance=function(){var e=this._viewModel.defaultInstance();if(null!==e){var t=new q(e,null);return(0,d.createFinalization)(t,e),t}return null},e.prototype.instance=function(){var e=this._viewModel.instance();if(null!==e){var t=new q(e,null);return(0,d.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}(),G=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}();(V=B||(B={})).Number="number",V.String="string",V.Boolean="boolean",V.Color="color",V.Trigger="trigger",V.Enum="enum",V.List="list",V.Image="image",V.Artboard="artboard";var q=function(){function e(e,t){this._parents=[],this._children=[],this._viewModelInstances=/* @__PURE__ */new Map,this._propertiesWithCallbacks=[],this._referenceCount=0,this.selfUnref=!1,this._runtimeInstance=e,null!==t&&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(){0!==this._propertiesWithCallbacks.length&&(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);-1!==t&&(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}),0===this._children.length&&0===this._propertiesWithCallbacks.length&&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}),0===this._children.length&&0===this._propertiesWithCallbacks.length&&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 null!==n?t==e.length-1?n:n.viewModelFromPathSegments(e,t++):null},e.prototype.propertyFromPathSegments=function(e,t,n){var r,i,a,o,s,u,l,c,h,d,f,p,m,v,g,b,y,w;if(t<e.length-1){var _=this.internalViewModelInstance(e[t]);return null!==_?_.propertyFromPathSegments(e,t+1,n):null}var A=null;switch(n){case B.Number:if(null!==(A=null!==(i=null===(r=this._runtimeInstance)||void 0===r?void 0:r.number(e[t]))&&void 0!==i?i:null))return new Z(A,this);break;case B.String:if(null!==(A=null!==(o=null===(a=this._runtimeInstance)||void 0===a?void 0:a.string(e[t]))&&void 0!==o?o:null))return new J(A,this);break;case B.Boolean:if(null!==(A=null!==(u=null===(s=this._runtimeInstance)||void 0===s?void 0:s.boolean(e[t]))&&void 0!==u?u:null))return new Q(A,this);break;case B.Color:if(null!==(A=null!==(c=null===(l=this._runtimeInstance)||void 0===l?void 0:l.color(e[t]))&&void 0!==c?c:null))return new re(A,this);break;case B.Trigger:if(null!==(A=null!==(d=null===(h=this._runtimeInstance)||void 0===h?void 0:h.trigger(e[t]))&&void 0!==d?d:null))return new ee(A,this);break;case B.Enum:if(null!==(A=null!==(p=null===(f=this._runtimeInstance)||void 0===f?void 0:f.enum(e[t]))&&void 0!==p?p:null))return new te(A,this);break;case B.List:if(null!==(A=null!==(v=null===(m=this._runtimeInstance)||void 0===m?void 0:m.list(e[t]))&&void 0!==v?v:null))return new ne(A,this);break;case B.Image:if(null!==(A=null!==(b=null===(g=this._runtimeInstance)||void 0===g?void 0:g.image(e[t]))&&void 0!==b?b:null))return new ie(A,this);break;case B.Artboard:if(null!==(A=null!==(w=null===(y=this._runtimeInstance)||void 0===y?void 0:y.artboard(e[t]))&&void 0!==w?w:null))return new ae(A,this)}return null},e.prototype.internalViewModelInstance=function(t){var n;if(this._viewModelInstances.has(t))return this._viewModelInstances.get(t);var r=null===(n=this._runtimeInstance)||void 0===n?void 0:n.viewModel(t);if(null!==r){var i=new e(r,this);return(0,d.createFinalization)(i,r),i.internalIncrementReferenceCount(),this._viewModelInstances.set(t,i),i}return null},e.prototype.number=function(e){return this.propertyFromPath(e,B.Number)},e.prototype.string=function(e){return this.propertyFromPath(e,B.String)},e.prototype.boolean=function(e){return this.propertyFromPath(e,B.Boolean)},e.prototype.color=function(e){return this.propertyFromPath(e,B.Color)},e.prototype.trigger=function(e){return this.propertyFromPath(e,B.Trigger)},e.prototype.enum=function(e){return this.propertyFromPath(e,B.Enum)},e.prototype.list=function(e){return this.propertyFromPath(e,B.List)},e.prototype.image=function(e){return this.propertyFromPath(e,B.Image)},e.prototype.artboard=function(e){return this.propertyFromPath(e,B.Artboard)},e.prototype.viewModel=function(e){var t=e.split("/"),n=t.length>1?this.viewModelFromPathSegments(t.slice(0,t.length-1),0):this;return null!=n?n.internalViewModelInstance(t[t.length-1]):null},e.prototype.internalReplaceViewModel=function(e,t){var n;if(null!==t.runtimeInstance){var r=(null===(n=this._runtimeInstance)||void 0===n?void 0:n.replaceViewModel(e,t.runtimeInstance))||!1;if(r){t.internalIncrementReferenceCount();var i=this.internalViewModelInstance(e);null!==i&&(i.removeParent(this),this._children.includes(i)&&(this._children=this._children.filter(function(e){return e!==i})),i.cleanup()),this._viewModelInstances.set(e,t),t.addParent(this)}return r}return!1},e.prototype.replaceViewModel=function(e,t){var n,r=e.split("/"),i=r.length>1?this.viewModelFromPathSegments(r.slice(0,r.length-1),0):this;return null!==(n=null==i?void 0:i.internalReplaceViewModel(r[r.length-1],t))&&void 0!==n&&n},e.prototype.incrementReferenceCount=function(){var e;this._referenceCount++,null===(e=this._runtimeInstance)||void 0===e||e.incrementReferenceCount()},e.prototype.decrementReferenceCount=function(){var e;this._referenceCount--,null===(e=this._runtimeInstance)||void 0===e||e.decrementReferenceCount()},Object.defineProperty(e.prototype,"properties",{get:function(){var e;return(null===(e=this._runtimeInstance)||void 0===e?void 0:e.getProperties().map(function(e){return p({},e)}))||[]},enumerable:!1,configurable:!0}),e.prototype.internalIncrementReferenceCount=function(){this._referenceCount++},e.prototype.cleanup=function(){var e,t=this;if(this._referenceCount--,this._referenceCount<=0){this.selfUnref&&(null===(e=this._runtimeInstance)||void 0===e||e.unref()),this._runtimeInstance=null,this.clearCallbacks(),this._propertiesWithCallbacks=[],this._viewModelInstances.forEach(function(e){e.cleanup()}),this._viewModelInstances.clear();var n=g([],this._children,!0);this._children.length=0;var r=g([],this._parents,!0);this._parents.length=0,n.forEach(function(e){e.removeParent(t)}),r.forEach(function(e){e.removeFromViewModelCallbacks(t)})}},e}(),K=function(){function e(e,t){this.callbacks=[],this._viewModelInstanceValue=e,this._parentViewModel=t}return e.prototype.on=function(e){0===this.callbacks.length&&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,0===this.callbacks.length&&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}(),J=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),Z=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),Q=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),ee=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),t.prototype.trigger=function(){return this._viewModelInstanceValue.trigger()},t.prototype.internalHandleCallback=function(e){e()},t}(K),te=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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}(K),ne=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),Object.defineProperty(t.prototype,"length",{get:function(){return this._viewModelInstanceValue.size},enumerable:!1,configurable:!0}),t.prototype.addInstance=function(e){null!=e.runtimeInstance&&(this._viewModelInstanceValue.addInstance(e.runtimeInstance),e.addParent(this._parentViewModel))},t.prototype.addInstanceAt=function(e,t){return!(null==e.runtimeInstance||!this._viewModelInstanceValue.addInstanceAt(e.runtimeInstance,t)||(e.addParent(this._parentViewModel),0))},t.prototype.removeInstance=function(e){null!=e.runtimeInstance&&(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(null!=t){var n=new q(t,this._parentViewModel);return(0,d.createFinalization)(n,t),n}return null},t.prototype.swap=function(e,t){this._viewModelInstanceValue.swap(e,t)},t.prototype.internalHandleCallback=function(e){e()},t}(K),re=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),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(255*Math.max(0,Math.min(1,e))))},t.prototype.internalHandleCallback=function(e){e(this.value)},t}(K),ie=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),Object.defineProperty(t.prototype,"value",{set:function(e){var t;this._viewModelInstanceValue.value(null!==(t=null==e?void 0:e.nativeImage)&&void 0!==t?t:null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(K),ae=function(e){function t(t,n){return e.call(this,t,n)||this}return f(t,e),Object.defineProperty(t.prototype,"value",{set:function(e){var t,n,r;r=e.isBindableArtboard?e:e.file.internalBindableArtboardFromArtboard(e.nativeArtboard),this._viewModelInstanceValue.value(null!==(t=null==r?void 0:r.nativeArtboard)&&void 0!==t?t:null),(null==r?void 0:r.nativeViewModel)&&this._viewModelInstanceValue.viewModelInstance(null!==(n=null==r?void 0:r.nativeViewModel)&&void 0!==n?n:null)},enumerable:!1,configurable:!0}),t.prototype.internalHandleCallback=function(e){e()},t}(K),oe=function(e){return m(void 0,void 0,void 0,function(){var t;return v(this,function(n){switch(n.label){case 0:return t=new Request(e),[4,fetch(t)];case 1:return[4,n.sent().arrayBuffer()];case 2:return[2,n.sent()]}})})},se=function(e){return"string"==typeof e?[e]:e instanceof Array?e:[]},ue={EventManager:D,TaskQueueManager:W},le=function(e){return m(void 0,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:return[4,new Promise(function(t){return A.getInstance(function(n){n.decodeAudio(e,t)})})];case 1:return t=r.sent(),n=new d.AudioWrapper(t),d.finalizationRegistry.register(n,t),[2,n]}})})},ce=function(e){return m(void 0,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:return[4,new Promise(function(t){return A.getInstance(function(n){n.decodeImage(e,t)})})];case 1:return t=r.sent(),n=new d.ImageWrapper(t),d.finalizationRegistry.register(n,t),[2,n]}})})},he=function(e){return m(void 0,void 0,void 0,function(){var t,n;return v(this,function(r){switch(r.label){case 0:return[4,new Promise(function(t){return A.getInstance(function(n){n.decodeFont(e,t)})})];case 1:return t=r.sent(),n=new d.FontWrapper(t),d.finalizationRegistry.register(n,t),[2,n]}})})}})(),r})(),"object"==typeof e&&"object"==typeof t?t.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof e?e.rive=r():n.rive=r()}})(),ee=_((e,t)=>{const{value:n,variableObj:r,onLoad:i,...a}=e,{id:o,width:s,height:u,url:l,stateMachine:c,artboard:h,inputs:d=[],x:f,y:p}=n,m=x(null),v=x(new OffscreenCanvas(s,u)),g=x({}),[b,y]=w.useState(!1),_=x(null),A=x(/* @__PURE__ */new Map);return C(()=>{if(!t)return;if(!v.current)return;const e=new Q.Rive({src:l,canvas:v.current,stateMachines:c,artboard:h,autoplay:!1,autoBind:!0,layout:new Q.Layout({fit:Q.Fit.Contain,alignment:Q.Alignment.TopLeft}),onLoad:()=>{i?.(),e.resizeToCanvas(),"function"!=typeof t&&t.current?.getLayer()?.batchDraw(),_.current=e.viewModelInstance,y(!0)}});m.current=e;const n=A.current;return()=>{console.log("cleanup rive instance",o),e.cleanup(),m.current=null,n?.clear(),y(!1)}},[l,c,o,h,t,i,v]),C(()=>{const e=_.current,t=A.current;b&&e&&t&&d&&0!==d.length&&d.forEach(({name:n,type:r,value:i,bindName:a})=>{switch(r){case"number":{let i=t.get(n)?.vmv;if(!i){const o=e.number(n);if(!o)return;i=o,t.set(n,{type:r,bindName:a,vmv:i,update:e=>{i.value=e}})}}break;case"boolean":{let i=t.get(n)?.vmv;if(!i){const o=e.boolean(n);if(!o)return;i=o,t.set(n,{type:r,bindName:a,vmv:i,update:e=>{i.value=e}})}}break;case"color":{let i=t.get(n)?.vmv;if(!i){const o=e.color(n);if(!o)return;i=o,t.set(n,{type:r,bindName:a,vmv:i,update:e=>{i.value=e}})}}break;default:G(r)}g.current[n]=i})},[d,b]),C(()=>{v.current&&m.current&&(v.current.width=s,v.current.height=u,m.current.resizeToCanvas(),m.current.drawFrame())},[s,u]),C(()=>{b&&A.current.forEach(e=>{const{bindName:t,update:n}=e;if(!t)return;const i=r[t];void 0!==i&&n(i)})},[b,r]),/* @__PURE__ */V(R,{ref:t,image:v.current,width:s,height:u,x:f,y:p,...a})}),te=_((e,t)=>{const{x:n=0,y:r=0,width:i,height:a,onLoad:o,value:s,...u}=e,{url:l,playbackRate:c=1,loop:h=!0}=s,d=M(()=>{const e=document.createElement("video");return e.muted=!0,e},[]);return C(()=>{d.src!==l&&(d.src=l,d.load()),d.loop=h,d.playbackRate=c,o&&d.addEventListener("loadeddata",()=>{o(),"function"!=typeof t&&t?.current?.getLayer()?.batchDraw()},{once:!0});const e=d.play();void 0!==e&&e.catch(e=>{console.warn("Video play interrupted or failed:",e)})},[d,l,h,c,o,t]),C(()=>()=>{d.pause(),d.src="",d.load(),d.remove()},[d]),/* @__PURE__ */V(R,{ref:t,image:d,x:n,y:r,width:i,height:a,...u})}),ne=_((e,t)=>{const{x:n,y:r,width:i,height:a,screenId:o,name:s,fill:u,onLoad:l,...c}=e,[h,d]=k(void 0),f=12;return C(()=>{const e=new I.Stage({container:document.createElement("div"),width:i+24,height:a+24}),t=new I.Layer,n=new I.Group({x:f,y:f});t.listening(!1),e.add(t),t.add(n);const r=new I.Rect({x:0,y:0,width:i,height:a,fill:u}),s=new I.Rect({x:-12,y:-12,width:i+24,height:a+24,stroke:"#000",strokeWidth:6,dash:[4,4]}),c=new I.Text({x:0,y:0,width:i,height:a,text:o,fontSize:i/10,align:"center",verticalAlign:"middle",fill:g(u)});n.add(r,c,s),t.draw();const h=t.getCanvas()._canvas;createImageBitmap(h).then(t=>{d(t),e.destroy(),l&&l()})},[u,a,l,o,i]),/* @__PURE__ */V(R,{image:h,name:s,x:n-f,y:r-f,width:i+24,height:a+24,ref:t,...c})}),re=w.memo(e=>{const{shapeProps:t,onSelect:n,onChange:r,onDragStart:i,onDragEnd:a,onLoad:o,onMouseEnter:s,onMouseLeave:u,onShapeChange:c,...h}=e,d=x(null),f=A(()=>{o?.(t.type)},[o,t.type]),p={...h,onClick:e=>{!0!==e.target.attrs.lock&&(n?.(e),h.onClick?.(e))},onMouseEnter(e){s?.(e)},onMouseLeave(e){u?.(e)},onTap:e=>{!0===e.target.attrs.lock||e.evt.touches.length||n?.(e)},onTouchMove:e=>{e.evt.preventDefault()},ref:d,listening:(t.listening??!0)&&(t.visible??!0),...t,onDragStart:e=>{i&&(e.cancelBubble=!0,i(e))},onDragEnd:e=>{a&&a(e),r?.({...t,x:Math.round(e.target.x()),y:Math.round(e.target.y())})},onTransformEnd:()=>{const e=d.current;if(!e)return;const n=e.scaleX(),i=e.scaleY();e.skew({x:0,y:0}),e.scaleX(n>=0?1:-1),e.scaleY(i>=0?1:-1);const a={...t,x:Math.round(e.x()),y:Math.round(e.y()),scaleX:n>=0?1:-1,scaleY:i>=0?1:-1,rotation:e.rotation()},o=t.type;switch(o){case l.TEXT:Object.assign(a,{width:Math.round(e.width())});break;case l.SVG:case l.QR_CODE:case l.BAR_CODE:case l.IMAGE:case l.RIVE:case l.VIDEO:case l.RECT:case l.BACK_SCREEN:Object.assign(a,{width:Math.round(Math.max(.1,e.width()*Math.abs(n))),height:Math.round(Math.max(.1,e.height()*Math.abs(i)))});break;default:G(o)}r?.(a)}};let m;const v=t.type;switch(v){case l.IMAGE:m=/* @__PURE__ */V(K,{...p,onLoad:f,url:t.imageSource});break;case l.RIVE:m=/* @__PURE__ */V(ee,{...p,onLoad:f,value:t,variableObj:t.variableObj});break;case l.SVG:m=/* @__PURE__ */V(Z,{...p,url:t.url,colors:t.colors,onLoad:f});break;case l.BAR_CODE:m=/* @__PURE__ */V(J,{value:t,onLoad:f,onShapeChange:c,...p});break;case l.QR_CODE:m=/* @__PURE__ */V(q,{value:t,onLoad:f,onShapeChange:c,...p});break;case l.TEXT:m=/* @__PURE__ */V(j,{...p,wrap:"none",height:void 0,width:void 0}),f();break;case l.RECT:m=/* @__PURE__ */V(T,{...p}),f();break;case l.VIDEO:m=/* @__PURE__ */V(te,{value:t,onLoad:f,...p});break;case l.BACK_SCREEN:m=/* @__PURE__ */V(ne,{...p}),f();break;default:f(),G(v)}return m}),ie=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],ae=({stageIns:t,selectedShapeIds:n,rotateEnabled:r=!0,onTransformEnd:i,onDragEnd:a,shaleSelector:o,enabledAnchor:s,...u})=>{const c=x(null);function h(e){c.current?.enabledAnchors(e),ie=e}return C(()=>{if(!t)return;!function(){if(n?.length)if(1===n.length){const e=t?.findOne(`#${n[0]}`),r=e?.attrs.type;if("c2"===e?.attrs.name)h([]);else switch(r){case l.TEXT:case l.BACK_SCREEN:h([]);break;case l.QR_CODE:case l.RIVE:case l.VIDEO:h(["top-left","top-right","bottom-left","bottom-right"]);break;case l.IMAGE:case l.SVG:case l.BAR_CODE:case l.RECT:h(["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"]);break;case void 0:break;default:G(r)}}else n.map(e=>t?.findOne(`#${e}`)).every(e=>"c2"===e?.attrs.name)?h([]):h(["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"]);s&&h(s)}();const e=t.find(o);if(e.forEach(e=>{e.draggable(n?.includes(e.id())||!1)}),n?.length){const t=e.filter(e=>n?.includes(e.id())||!1);c.current.nodes(t),c.current.getLayer().batchDraw()}else c.current.nodes([]);const r=c.current?.getClientRect();r?.width&&0!==r.width&&(r.width-9<30||r.height-25<30)&&(c.current?.enabledAnchors().length||0)>4&&c.current?.enabledAnchors(["top-left","top-right","bottom-left","bottom-right"])},[n,t]),/* @__PURE__ */V(D,{ref:c,keepRatio:!0,rotateEnabled:r,padding:0,onTransformEnd:i,onDragEnd:a,rotateAnchorOffset:18,rotationSnaps:[0,90,180,270],anchorFill:e.active,borderStroke:e.active,anchorSize:8,anchorCornerRadius:0,boundBoxFunc:(e,t)=>{const[n]=c.current.nodes();return 1===c.current.nodes().length||n instanceof I.Text||(ie.length>4&&(t.width<30||t.height<30)?c.current?.enabledAnchors(["top-left","top-right","bottom-left","bottom-right"]):c.current?.enabledAnchors(["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"])),t},...u})},oe=({children:e,onClick:t,icon:n,danger:r=!1,disabled:i=!1,style:a,...o})=>/* @__PURE__ */U("div",{style:{display:"flex",alignItems:"center",padding:"6px 12px",cursor:i?"not-allowed":"pointer",borderRadius:"4px",margin:"2px 4px",color:i?"#bfbfbf":r?"#ff4d4f":"#333",fontSize:"13px",opacity:i?.6:1,...a},onMouseEnter:e=>{i||(e.currentTarget.style.backgroundColor="#f5f5f5")},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},onClick:i?void 0:t,...o,children:[n&&/* @__PURE__ */V("span",{style:{marginRight:"8px",display:"flex",alignItems:"center"},children:n}),e]}),se=(e,t,n)=>{const r=[...e];if(t===n)return r;const[i]=r.splice(t,1);return r.splice(n,0,i),r},ue=({type:e})=>/* @__PURE__ */V("span",{style:{fontSize:"14px"},children:{"move-top":"⬆️","move-up":"🔼","move-down":"🔽","move-bottom":"⬇️",lock:"🔒",unlock:"🔓",copy:"📋",hide:"👁️",delete:"🗑️"}[e]||"•"}),le=({target:e,shapeList:t,closeMenu:n,onUpdateShapeList:r,onSetSelectedIds:i,onDeleteShape:a,onDuplicateShape:o,...s})=>{const u=t.find(t=>t.id===e.id()),l=!0===u?.lock;/* @__PURE__ */
2
+ return U("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",minWidth:"120px"},...s,children:[
3
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"move-top"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);e!==t.length-1&&r(se(t,e,t.length-1))},disabled:l,children:"置顶"}),
4
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"move-up"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);e!==t.length-1&&r(se(t,e,e+1))},disabled:l,children:"上移一层"}),
5
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"move-down"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);0!==e&&r(se(t,e,e-1))},disabled:l,children:"下移一层"}),
6
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"move-bottom"}),onClick:function(){if(n(),!u)return;const e=t.findIndex(e=>e.id===u.id);0!==e&&r(se(t,e,0))},disabled:l,children:"置底"}),
7
+ /* @__PURE__ */V("div",{style:{height:"1px",background:"#e8e8e8",margin:"4px 8px"}}),
8
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:u?.lock?"unlock":"lock"}),onClick:function(){if(n(),!u)return;const e=t.map(e=>e.id===u.id?{...e,lock:!e.lock}:e);i(u.lock?[u.id]:[]),r(e)},children:u?.lock?"解锁":"锁定"}),
9
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"copy"}),onClick:function(){n(),u&&o(u)},disabled:l,children:"复制"}),
10
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"hide"}),onClick:function(){if(n(),!u)return;const e=t.map(e=>e.id===u.id?{...e,visible:!e.visible}:e);i([]),r(e)},disabled:l,children:!1===u?.visible?"显示":"隐藏"}),
11
+ /* @__PURE__ */V("div",{style:{height:"1px",background:"#e8e8e8",margin:"4px 8px"}}),
12
+ /* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ue,{type:"delete"}),onClick:function(){n(),u&&a(u.id)},danger:!0,disabled:l,children:"删除"})]})},ce=({type:e})=>/* @__PURE__ */V("span",{style:{fontSize:"14px"},children:{lock:"🔒",unlock:"🔓",delete:"🗑️"}[e]||"•"}),he=({target:e,closeMenu:t,...n})=>{if(!e)return null;const r=!e.draggable();/* @__PURE__ */
13
+ return U("div",{style:{display:"flex",flexDirection:"column",padding:"4px 0",minWidth:"100px"},...n,children:[/* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ce,{type:r?"unlock":"lock"}),onClick:function(){t(),e&&e.draggable(!e.draggable())},children:r?"解锁辅助线":"锁定辅助线"}),/* @__PURE__ */V(oe,{icon:/* @__PURE__ */V(ce,{type:"delete"}),onClick:function(){t(),e&&(e.destroy(),e.getStage()?.batchDraw())},danger:!0,children:"删除辅助线"})]})},de=_(({children:e,containerWidth:t=window.innerWidth,containerHeight:n=window.innerHeight},r)=>{const i=x(null),[a,o]=k({top:-99999,left:-99999}),[s,u]=k(!1);return E(r,()=>({show:e=>{u(!0),setTimeout(()=>{if(!i.current)return;const r=i.current.offsetHeight,a=i.current.offsetWidth;let{x:s,y:u}=e;u+r>n&&(u=n-r-10),s+a>t&&(s=t-a-10),o({top:u,left:s})},0)},close:()=>{u(!1),o({top:-99999,left:-99999})}})),C(()=>{if(!s)return;const e=e=>{i.current&&!i.current.contains(e.target)&&(u(!1),o({top:-99999,left:-99999}))},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[s]),/* @__PURE__ */V("div",{ref:i,style:{position:"absolute",top:a.top,left:a.left,zIndex:1e3,background:"#fff",borderRadius:"6px",boxShadow:"0 3px 12px rgba(0, 0, 0, 0.15)",border:"1px solid #e8e8e8",visibility:s?"visible":"hidden"},children:e})});de.displayName="ContextMenu";var fe=de;function pe(e){return"Stage"===e.getClassName()}function me(e){return"cb"===e.attrs.name}function ve(e){return b()?e.metaKey:e.ctrlKey}var ge=({stageIns:e,selectedShapeIds:t,shapeList:n,callbacks:r})=>{const i=x([]),a=x(null),[o,s]=k(null);C(()=>{i.current=[...t]},[t]);const u=x({movement:!1,movementX:0,movementY:0,keySpace:!1,transform:!1,selectTarget:!1,downOnStage:!1,downOnShape:null});function l(t){e&&(e.container().style.cursor=t)}function c(e){u.current.downOnStage=!0,u.current.downOnShape=e.target,1===e.evt.buttons&&(u.current.transform=e.target.name().includes("_anchor")||e.target.name().includes("help-line"),u.current.selectTarget=i.current.includes(e.target.attrs.id))}function h(e){const{target:t}=e;"cd"!==t.name()?"ce"!==t.name()?(me(t)?t.draggable()?l(t.attrs.vertical?"col-resize":"row-resize"):l("no-drop"):!0===t.attrs.lock?l("no-drop"):(pe(t),l("unset")),u.current.downOnStage&&(0===e.evt.movementX&&0===e.evt.movementX||(u.current.movement=!0,u.current.movementX+=e.evt.movementX,u.current.movementY+=e.evt.movementY))):l("row-resize"):l("col-resize")}function d(e){switch(e.evt.button){case 0:if(!u.current.movement&&!u.current.transform){if(e.target.attrs.lock)break;const t=e.target.id()?e.target:e.target.getParent();if(!t){i.current=[],r.onSetActiveShapeIds([]);break}const n=t.id();switch(t.name()){case"c1":i.current.includes(n)&&ve(e.evt)?(i.current.splice(i.current.indexOf(n),1),r.onRemoveActiveShapeId(n)):!i.current.includes(n)&&ve(e.evt)?(i.current.push(n),r.onAddActiveShapeId(n)):i.current.includes(n)||ve(e.evt)||(i.current=[n],r.onSetActiveShapeIds([n]));break;case"c2":i.current=[n],r.onSetActiveShapeIds([n]);break;default:i.current=[],r.onSetActiveShapeIds([])}}}u.current.movement&&(u.current.movement=!1,u.current.movementX=0,u.current.movementY=0),u.current.downOnStage=!1,l("default")}function f(){u.current.movement&&(u.current.movement=!1,u.current.movementX=0,u.current.movementY=0),u.current.downOnStage=!1}function p(){a.current?.close()}function m(t){t.evt.preventDefault();const{target:o}=t;pe(o)||me(o)||!0===o.attrs.lock||(i.current=[o.id()],r.onSetActiveShapeIds([o.id()]));const u=e.getPointerPosition();if(me(o))return s(/* @__PURE__ */V(he,{target:o,closeMenu:p})),void a.current?.show(u);"c1"===o.name()&&(s(/* @__PURE__ */V(le,{target:o,shapeList:n,closeMenu:p,onUpdateShapeList:r.onUpdateShapeList,onSetSelectedIds:r.onSetActiveShapeIds,onDeleteShape:r.onDeleteShape,onDuplicateShape:r.onDuplicateShape})),a.current?.show(u))}return C(()=>{if(!e)return;const t=e.container(),n=e=>{" "===e.key&&(u.current.keySpace=!0)},r=e=>{" "===e.key&&(u.current.keySpace=!1)};return t?.addEventListener("keydown",n),t?.addEventListener("keyup",r),e.on("dragstart",()=>l("grabbing")),e.on("dragend",()=>l("unset")),e.on("pointerdown",c),e.on("pointermove",h),e.on("pointerup",d),e.on("mouseleave",f),e.on("contextmenu",m),()=>{e.off("dragstart"),e.off("dragend"),e.off("pointerdown"),e.off("pointermove"),e.off("pointerup"),e.off("mouseleave"),e.off("contextmenu"),t?.removeEventListener("keydown",n),t?.removeEventListener("keyup",r)}},[e,n,r]),/* @__PURE__ */V(fe,{ref:a,containerWidth:e?.container()?.offsetWidth||window.innerWidth,containerHeight:e?.container()?.offsetHeight||window.innerHeight,children:o})};function be(e,t,n){const r=e.total||("H"===t?20:15),i={x:-e.x/e.scale,y:-e.y/e.scale,width:e.width/e.scale-e.x/e.scale,height:e.height/e.scale-e.y/e.scale},a="H"===t?e.x:e.y,o="H"===t?e.width:e.height,s="H"===t?i.x:i.y,u="H"===t?i.width:i.height;let l=`M${i.x},${i.y} ${t.toLowerCase()}${u-s}`,c=Math.round(o/r/e.scale);n?c=n:c>100*e.ppmm?c-=c%(100*e.ppmm):c>10*e.ppmm?c-=c%(10*e.ppmm):c>5*e.ppmm?c-=c%(5*e.ppmm):c-=c%(2*e.ppmm),c||=1*e.ppmm;const h=(-1*a+e.strokeWidth)/e.scale-(-1*a+e.strokeWidth)/e.scale%c,d=Math.floor(o/e.scale/c),f=[];for(let p=0;p<d;p++){const n=h+p*c;if(n>s+e.strokeWidth/e.scale){const r=n%(5*c)?1:2;"H"===t?(l+=`M${n},${i.y} v${10/e.scale*r}`,f.push({label:String(Math.round(n/e.ppmm)),tickMarkScale:r,x:n,y:i.y})):(l+=`M${i.x},${n} h${10/e.scale*r} `,f.push({label:String(Math.round(n/e.ppmm)),tickMarkScale:r,y:n,x:i.x}))}}return{path:l,nodes:f,interval:c,rect:i}}function ye(e,t=1){switch(e){case"dash1":return[1,3*t];case"dash2":return[5*t,5*t];default:return[]}}var we={name:"cc",stroke:"#ffc400",strokeWidth:1},_e={shiftKey:!1,currentPpmm:1},Ae=w.forwardRef(({stageIns:e,hideRuler:t=!1,currentPpmm:n=1,auxiliaryVisible:r=!0,auxiliaryData:i,auxiliaryLock:a=!1,globalAuxiliaryLineSettings:o,disableAuxiliary:s=!1},u)=>{const l=x(null),c=x(null),h=x(null),d=x(null),f=x(null),p=x(null),m=A(()=>{r&&e&&requestAnimationFrame(()=>{const t=e.find(e=>"cb"===e.attrs.name&&!0!==e.attrs.absolute),{x:n,y:r}=e.position();t.forEach(t=>{t.scale({x:1/e.scaleX(),y:1/e.scaleY()}),t.attrs.vertical?t.y((-r-e.offsetY())/e.scaleY()):t.x((-n-e.offsetX())/e.scaleX())})})},[r,e]),v=A(e=>{const{x:t,y:r}=e.getAbsolutePosition(),i=e.width(),a=e.height(),o=e.scaleX(),s=20,{path:u,nodes:h,interval:v,rect:g}=be({x:t,y:r,width:i,height:a,scale:o,strokeWidth:s,ppmm:n,total:Math.ceil(i/70)},"H"),{path:b,nodes:y}=be({x:t,y:r,width:i,height:a,scale:o,strokeWidth:s,ppmm:n,total:Math.ceil(a/70)},"V",v);p.current?.sceneFunc(e=>{e.fillStyle="#f2f3f5",e.fillRect(-t/o,-r/o,i/o,s/o),e.fillRect(-t/o,-r/o,s/o,a/o),e.fillStyle="#a0a0a0",e.font=12/o+"px sans-serif",h.forEach(t=>{e.fillText(t.label,t.x+5/o,t.y+15/o)}),y.forEach(t=>{e.save(),e.translate(t.x,t.y),e.rotate(90*Math.PI/180),e.fillText(t.label,5/o,-5/o),e.restore()}),e.fillStyle="#f2f3f5",e.fillRect(-t/o,-r/o,s/o,s/o),e.fillStyle="#a0a0a0",e.font=12/o+"px sans-serif",e.fillText(1===n?"Px":"mm",-t/o+3/o,-r/o+15/o)}),p.current?.drawScene(),d.current?.setAttrs({data:u,strokeWidth:1/o}),l.current?.setAttrs({x:g.x,y:g.y,width:g.width-g.x,height:s/o}),f.current?.setAttrs({data:b,strokeWidth:1/o}),c.current?.setAttrs({x:g.x,y:g.y,width:s/o,height:g.height-g.y}),m()},[n,m]),g=A((t=!0)=>{if(!e)return null;const n=o?.strokeWidth||1,r=n+8,i=ye(o?.dashType,n),a=new I.Line({name:"cb",points:t?[0,0,0,e.height()]:[0,0,e.width(),0],stroke:o?.color||"#00ffff",dash:i,absolute:!1,strokeWidth:n,hitStrokeWidth:r,draggable:!0,vertical:t,info:{dashType:o?.dashType,color:"default"}});return a.scale({x:1/e.scaleX(),y:1/e.scaleY()}),h.current?.add(a),a},[e,o]),b=A(t=>()=>{if(!r||!e)return;const n=g(t);if(!n)return;const i=e=>{requestAnimationFrame(()=>{const t=e.evt;n.attrs.vertical?n.absolutePosition({x:t.offsetX,y:0}):n.absolutePosition({x:0,y:t.offsetY}),n.visible(!0),t.preventDefault()})};n.dragBoundFunc(e=>n.attrs.vertical?{x:e.x,y:!0===n.attrs.absolute?e.y:0}:{x:!0===n.attrs.absolute?e.x:0,y:e.y}),e.on("pointermove",i);const a=()=>{e.off("pointermove",i),e.off("pointerup",a)};e.on("pointerup",a)},[r,e,g]),w=A(t=>{e&&h.current&&(t.forEach(t=>{let n;n=t.vertical?t.absolute?[0,0,0,t.length||e.height()]:[0,0,0,e.height()]:t.absolute?[0,0,t.length||e.width(),0]:[0,0,e.width(),0];const r=new I.Line({x:t.x,y:t.y,name:"cb",dash:ye(t.dashType),points:n,absolute:t.absolute,stroke:"default"===t.color?o?.color||"#00FFFF":t.color,strokeWidth:t.strokeWidth||1,hitStrokeWidth:(t.strokeWidth||1)+4,draggable:t.draggable,vertical:t.vertical,info:{color:t.color,length:t.length,dashType:t.dashType}});r.dragBoundFunc(e=>r.attrs.vertical?{x:e.x,y:!0===r.attrs.absolute?e.y:0}:{x:!0===r.attrs.absolute?e.x:0,y:e.y}),h.current?.add(r)}),m())},[e,o,m]);C(()=>{if(!e)return;const t=e=>{_e.shiftKey=e.shiftKey};return document.addEventListener("keydown",t),document.addEventListener("keyup",t),e.on("scaleChange",m),e.on("dragmove",m),()=>{document.removeEventListener("keydown",t),document.removeEventListener("keyup",t),e.off("scaleChange",m),e.off("dragmove",m)}},[e,m]),C(()=>{e&&v(e),_e.currentPpmm=n},[n,e,v]);const _=A(t=>{if(!e)return{vertical:[],horizontal:[]};const n=[],r=[],i=e.findOne(e=>"c5"===e.attrs.name),a=e.findOne(e=>"c7"===e.attrs.name);return i?.find(e=>["c1"].includes(e.attrs.name)).forEach(e=>{if(e.id()===t.id()||!e.isVisible())return;const i=e.getClientRect();n.push(i.x,i.x+i.width,i.x+i.width/2),r.push(i.y,i.y+i.height,i.y+i.height/2)}),a?.find(e=>["c2"].includes(e.attrs.name)).forEach(e=>{if(e.id()===t.id()||!e.isVisible())return;const i=e.getClientRect();n.push(i.x,i.x+i.width,i.x+i.width/2),r.push(i.y,i.y+i.height,i.y+i.height/2)}),h.current?.find(e=>["cb"].includes(e.attrs.name)).forEach(e=>{if(e.id()===t.id()||!e.isVisible())return;const i=e.getClientRect();n.push(i.x,i.x+i.width,i.x+i.width/2),r.push(i.y,i.y+i.height,i.y+i.height/2)}),{vertical:n,horizontal:r}},[e]),M=A(e=>{const t=e.getClientRect(),n=e.absolutePosition();return{vertical:[{guide:Math.round(t.x),offset:Math.round(n.x-t.x),snap:"start"},{guide:Math.round(t.x+t.width/2),offset:Math.round(n.x-t.x-t.width/2),snap:"center"},{guide:Math.round(t.x+t.width),offset:Math.round(n.x-t.x-t.width),snap:"end"}],horizontal:[{guide:Math.round(t.y),offset:Math.round(n.y-t.y),snap:"start"},{guide:Math.round(t.y+t.height/2),offset:Math.round(n.y-t.y-t.height/2),snap:"center"},{guide:Math.round(t.y+t.height),offset:Math.round(n.y-t.y-t.height),snap:"end"}]}},[]),k=A((e,t)=>{const n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{const r=Math.abs(e-t.guide);r<5&&n.push({lineGuide:e,diff:r,snap:t.snap,offset:t.offset})})}),e.horizontal.forEach(e=>{t.horizontal.forEach(t=>{const n=Math.abs(e-t.guide);n<5&&r.push({lineGuide:e,diff:n,snap:t.snap,offset:t.offset})})});const i=[],a=n.sort((e,t)=>e.diff-t.diff)[0],o=r.sort((e,t)=>e.diff-t.diff)[0];return a&&i.push({lineGuide:a.lineGuide,offset:a.offset,orientation:"V",snap:a.snap}),o&&i.push({lineGuide:o.lineGuide,offset:o.offset,orientation:"H",snap:o.snap}),i},[]),R=A(t=>{e&&t.forEach(t=>{if("H"===t.orientation){const n=new I.Line({...we,points:[0,0,e.width(),0]});n.scale({x:1/e.scaleX(),y:1/e.scaleY()}),h.current?.add(n),n.absolutePosition({x:0,y:t.lineGuide})}else{const n=new I.Line({...we,points:[0,0,0,e.height()]});n.scale({x:1/e.scaleX(),y:1/e.scaleY()}),h.current?.add(n),n.absolutePosition({x:t.lineGuide,y:0})}})},[e]),O=A(()=>{e&&e.find(e=>"cc"===e.attrs.name).forEach(e=>e.destroy())},[e]),j=A(e=>{O();const t=k(_(e.target),M(e.target));if(!t.length)return;R(t);const n=e.target.absolutePosition();t.forEach(e=>{switch(e.orientation){case"V":n.x=e.lineGuide+e.offset;break;case"H":n.y=e.lineGuide+e.offset;break;default:y(e.orientation)}}),e.target.absolutePosition(n)},[O,_,M,k,R]);return C(()=>{if(!e)return;v(e);const t=e.findOne(e=>"c5"===e.attrs.name);return t&&(t.on("dragmove",j),t.on("dragend",O)),()=>{t&&(t.off("dragmove",j),t.off("dragend",O))}},[e,v,j,O]),C(()=>{if(!e)return;const t=e.getContent(),n=new ResizeObserver(()=>{e&&(e.find(e=>"cb"===e.attrs.name&&!0!==e.attrs.absolute).forEach(t=>{t.attrs.vertical?t.points([0,0,0,e.height()]):t.points([0,0,e.width(),0])}),v(e))});return n.observe(t),()=>n.disconnect()},[e,v]),C(()=>{if(h.current&&i&&e)try{w(JSON.parse(i||"[]"))}catch(t){console.error("Failed to parse auxiliary data:",t)}},[i,e,w]),E(u,()=>({rulerReRender:v,calcHelpLine:m}),[v,m]),/* @__PURE__ */U(S,{name:"c9",listening:!0,draggable:!1,children:[
14
+ /* @__PURE__ */V(P,{listening:!a,visible:Boolean(r),ref:h,id:"ca"}),
15
+ /* @__PURE__ */U(P,{id:"rulerGroup",visible:!t,children:[
16
+ /* @__PURE__ */V(F,{ref:p,stroke:"#666"}),
17
+ /* @__PURE__ */V(L,{ref:d,stroke:"#a0a0a0",strokeWidth:1}),
18
+ /* @__PURE__ */V(L,{ref:f,stroke:"#a0a0a0",strokeWidth:1})]}),
19
+ /* @__PURE__ */V(T,{ref:l,visible:!s,onPointerDown:b(!1),name:"ce"}),
20
+ /* @__PURE__ */V(T,{visible:!s,ref:c,onPointerDown:b(!0),name:"cd"})]})});Ae.displayName="AuxiliaryLines";var Ce=Ae;var Ee=function(e){return function(t){if(!e)return void console.error("Stage is not defined");t.evt.preventDefault();const n=e.scaleX(),r=e.getPointerPosition().x/n-e.x()/n,i=e.getPointerPosition().y/n-e.y()/n;let a=t.evt.deltaY>0?.9*n:1.1*n;a=Math.max(.125,a),a=Math.min(100,a),e.scale({x:a,y:a});const o={x:-(r-e.getPointerPosition().x/a)*a,y:-(i-e.getPointerPosition().y/a)*a};e.position(o)}},Me=!0;var xe=function(e){function t(t){try{" "===t.key&&(Me&&(e.container().style.cursor="grab",Me=!1),e.draggable(!0))}catch{}}function n(t){if(" "===t.key)try{e.draggable(!1),e.container().style.cursor="default",Me=!0}catch{}}return[function(){window.addEventListener("keydown",t),window.addEventListener("keyup",n)},function(){window.removeEventListener("keydown",t),window.removeEventListener("keyup",n)}]},ke=!1,Ie={x:0,y:0},Pe=!1;var Re=!0,Se=[];var Le=function(e,t,n){let r=[],i=0,a=0,o=1,s=0,u=-1;const l=[],c=[];function h(e,t){"keydown"===t?l.push(e):c.push(e)}function d(e){let t=0;l[t](e,function n(){t++,t<l.length&&l[t](e,n)})}function f(e){let t=0;c[t](e,function n(){t++,t<c.length&&c[t](e,n)})}function p(){return r.length||(r=e?.find(e=>t.some(t=>t.id===e.attrs.id))),r}const m=z(()=>{if(!p().length)return;const e=t.map(e=>{const t=p().find(t=>t.attrs.id===e.id)?.x(),n=p().find(t=>t.attrs.id===e.id)?.y();return{...e,x:t||e.x,y:n||e.y}});n.onSetShapes(e)},1200),v=e=>{p().length&&t.length&&(u=requestAnimationFrame(()=>{0!==i||0!==a?(p().forEach(e=>{e.setAttr("x",e.x()+i),e.setAttr("y",e.y()+a)}),e.shiftKey||e.altKey||(i=0,a=0),v(e),m()):u=-1}))},g=e.getContent();g.setAttribute("tabindex","2"),g.style.outline="none";const b=()=>{Re=!1},y=()=>{Re=!0};return h((e,t)=>{const n=["ArrowLeft","ArrowRight","f","h","s"];(e.ctrlKey||e.metaKey)&&n.includes(e.key)&&e.preventDefault(),t()},"keydown"),h((e,n)=>{if(t.length&&!Re){switch(e.altKey?o=2:e.shiftKey&&(o=5),e.key){case"ArrowUp":a=0,a-=o,e.preventDefault(),e.stopPropagation();break;case"ArrowDown":a=0,a+=o,e.preventDefault(),e.stopPropagation();break;case"ArrowLeft":i=0,i-=o,e.preventDefault(),e.stopPropagation();break;case"ArrowRight":i=0,i+=o,e.preventDefault(),e.stopPropagation();break;default:return void n()}u<0&&v(e)}else n()},"keydown"),h((r,i)=>{t?.length&&!Re&&"Backspace"===r.key?(r.preventDefault(),n.onRemoveShapes(t.map(e=>e.id)),n.onSetActiveShapeIds([]),Object.assign(e?.container().style??{},{cursor:"unset"})):i()},"keydown"),h((e,r)=>{(e.ctrlKey||e.metaKey)&&["c","v"].includes(e.key)&&t?.length&&!Re?"c"===e.key?s=0:(s++,Se=t.map(e=>({...e,id:Y(),x:e.x+10*s,y:e.y+10*s})),n.onAddShapes(Se),n.onSetActiveShapeIds(Se.map(e=>e.id))):r()},"keydown"),h((e,t)=>{switch(e.key){case"ArrowUp":case"ArrowDown":a=0,e.preventDefault();break;case"ArrowLeft":case"ArrowRight":i=0,e.preventDefault();break;default:t()}},"keyup"),[function(){window.addEventListener("keydown",d),window.addEventListener("keyup",f),g.addEventListener("focus",b),g.addEventListener("blur",y)},function(){cancelAnimationFrame(u),window.removeEventListener("keydown",d),window.removeEventListener("keyup",f),g.removeEventListener("focus",b),g.removeEventListener("blur",y)}]};const Te={wrapper:{width:"100%",height:"100%",display:"flex",flexDirection:"column",overflow:"hidden"},container:{width:"100%",height:"100%",position:"relative",overflow:"hidden",backgroundColor:"#f5f5f5"},stage:{width:"100%",height:"100%"}};var Fe=({width:e,height:t,shapeList:n,bgShapeList:r,onSelectedShapeIdsChange:i,onShapeListChange:a,onBgShapeListChange:o,className:s="",backgroundType:u="grid",hideRuler:l=!1,ppmm:c=1,forwardedRef:h})=>{const d=x(null),f=x(null),p=x(null),[m,v]=k(null),[g,b]=k({width:e||800,height:t||600}),[y,w]=k([]),[_,M]=k([]),[R,L]=k([]),T=x([]),F=n??y,j=r??_,D=[...F,...j].filter(e=>R.includes(e.id)),W=A(e=>{void 0===n&&w(e),a?.(e)},[n,a]),B=A(e=>{void 0===r&&M(e),o?.(e)},[r,o]),N=A(e=>{L(e),T.current=e,i?.(e)},[i]),$=A(e=>{W(F.map(t=>t.id===e.id?e:t))},[F,W]);C(()=>{if(!d.current)return;const e=d.current.findOne(".c5"),t=new I.Animation(()=>{},e);return t.start(),()=>{t.stop()}},[d]);const H=A(e=>{B(j.map(t=>t.id===e.id?e:t))},[j,B]),X=A(e=>{W([...F,...e])},[F,W]),G=A(e=>{B([...j,...e])},[j,B]),q=A(e=>{W(F.filter(t=>!e.includes(t.id)))},[F,W]),K=A(e=>{B(j.filter(t=>!e.includes(t.id)))},[j,B]),J=A(e=>{W(F.filter(t=>t.id!==e)),N(R.filter(t=>t!==e))},[F,W,R,N]),Z=A(e=>{B(j.filter(t=>t.id!==e)),N(R.filter(t=>t!==e))},[j,B,R,N]),Q=A(e=>{const t={...structuredClone(e),id:Y(),x:e.x+20,y:e.y+20};X([t]),N([t.id])},[X,N]),ee=A(e=>{R.includes(e)||N([...R,e])},[R,N]),te=A(e=>{N(R.filter(t=>t!==e))},[R,N]),ne=A(()=>{if(!d.current)return;const e=d.current;e.scale({x:1,y:1}),e.position({x:0,y:0});const t=e.findOne(".c7"),n=e.findOne(".c5"),r=[];if(t&&t.find(e=>{const t=e.getClassName();return"Group"!==t&&"Layer"!==t&&r.push(e),!1}),n&&n.find(e=>{const t=e.getClassName();return"Group"!==t&&"Layer"!==t&&r.push(e),!1}),0===r.length)return;const i=new I.Group;r.forEach(e=>{i.add(e.clone())});const{x:a,y:o,width:s,height:u}=i.getClientRect();if(i.destroy(),0===s||0===u)return;const l=e.width()-20,c=e.height()-20,h=Math.min(l/s,c/u,1);e.scale({x:h,y:h}),e.position({x:(l-s*h)/2-a*h+10,y:(c-u*h)/2-o*h+10}),p.current?.rulerReRender(e)},[]);E(h,()=>({getStage:()=>d.current,getSelectedShapeIds:()=>R,setSelectedShapeIds:N,addShapes:X,removeShapes:q,updateShape:$,getShapeList:()=>F,fitToContent:ne,addBgShapes:G,removeBgShapes:K,removeBgShape:Z}),[R,N,X,q,$,F,ne,G,K,Z]),C(()=>{if(!d.current)return;v(d.current);const e=d.current,t=()=>{p.current?.rulerReRender(e)},n=Ee(e),r=e=>{n(e),t()};e.on("wheel",r),e.on("dragmove",t);const[i,a]=xe(e);i();const[o,s]=function(e,t){function n(e){if(t?.press&&e.key===t?.press){if(t?.hasSelectedElements?.())return void(Pe=!1);Pe=!0}}function r(e){t?.press&&e.key===t?.press&&(Pe=!1)}function i(t){0===t.button&&e&&e.contains(t.target)&&(ke=!0,Object.assign(Ie,{x:t.clientX,y:t.clientY}))}function a(e){0===e.button&&(ke=!1)}function o(n){ke&&e&&(t?.press&&!Pe||(e.style.setProperty("--offsetX",`${Ie.x+n.clientX}px`),e.style.setProperty("--offsetY",`${Ie.y+n.clientY}px`)))}let s="";const u=z(()=>{e&&(s?e.style.setProperty("background-image",s):e.style.removeProperty("background-image"))},100),l=()=>{if(!e)return;const t=e.style.getPropertyValue("background-image");t&&"none"!==t&&(s=t),e.style.setProperty("background-image","none"),u()};return[function(){e&&(e.addEventListener("wheel",l),window.addEventListener("mousedown",i),window.addEventListener("mouseup",a),window.addEventListener("mousemove",o),window.addEventListener("keydown",n),window.addEventListener("keyup",r))},function(){e&&(e.removeEventListener("wheel",l),window.removeEventListener("mousedown",i),window.removeEventListener("mouseup",a),window.removeEventListener("mousemove",o),window.removeEventListener("keydown",n),window.removeEventListener("keyup",r))}]}(f.current,{press:" ",hasSelectedElements:()=>T.current.length>0});return o(),()=>{e.off("wheel",r),e.off("dragmove",t),a(),s()}},[]),C(()=>{if(!m)return;const[e,t]=Le(m,D,{onSetShapes:e=>{W(F.map(t=>e.find(e=>e.id===t.id)||t)),B(j.map(t=>e.find(e=>e.id===t.id)||t))},onRemoveShapes:q,onSetActiveShapeIds:N,onAddShapes:X});return e(),t},[m,D,F,W,q,N,X,j,B]),C(()=>{if(!f.current)return;const n=()=>{if(d.current){const{clientWidth:n,clientHeight:r}=d.current.container();b({width:e||n,height:t||r})}};n();const r=new ResizeObserver(n);return r.observe(f.current),()=>{r.disconnect()}},[e,t]);/* @__PURE__ */
21
+ return V("div",{style:Te.wrapper,className:s,children:/* @__PURE__ */U("div",{ref:f,id:"c0",style:{...Te.container,..."grid"===u?((e=0,t=0,n=10,r="#e0e0e0")=>({backgroundImage:`\n linear-gradient(45deg, ${r} 25%, transparent 0, transparent 75%, ${r} 0),\n linear-gradient(45deg, ${r} 25%, transparent 0, transparent 75%, ${r} 0)\n `,backgroundPosition:`${e}px ${t}px, ${n+e}px ${n+t}px`,backgroundSize:`${2*n}px ${2*n}px`}))():"point"===u?((e=0,t=0,n=20)=>({backgroundSize:`${n}px ${n}px`,backgroundImage:"radial-gradient(circle, #2f3542 1px, rgba(0, 0, 0, 0) 1px)",backgroundPosition:`${e}px ${t}px`}))():{}},children:[/* @__PURE__ */U(O,{ref:d,style:Te.stage,...g,children:[
22
+ /* @__PURE__ */V(S,{name:"c7",children:/* @__PURE__ */V(P,{id:"c6",children:j.map(e=>/* @__PURE__ */V(re,{shapeProps:{...e,name:"c2"},onChange:H,onShapeChange:H},e.id))})}),
23
+ /* @__PURE__ */V(S,{name:"c5",children:F.map(e=>/* @__PURE__ */V(re,{shapeProps:e,onChange:$,onShapeChange:$},e.id))}),
24
+ /* @__PURE__ */V(S,{children:/* @__PURE__ */V(ae,{selectedShapeIds:R,stageIns:m,shaleSelector:".c1, .c2"})}),
25
+ /* @__PURE__ */V(Ce,{ref:p,stageIns:m,hideRuler:l,currentPpmm:c,auxiliaryVisible:!0,auxiliaryLock:!1,disableAuxiliary:!1})]}),/* @__PURE__ */V(ge,{stageIns:m,selectedShapeIds:R,shapeList:F,callbacks:{onSetActiveShapeIds:N,onAddActiveShapeId:ee,onRemoveActiveShapeId:te,onUpdateShapeList:W,onDeleteShape:J,onDuplicateShape:Q}})]})})};const Oe=_((e,t)=>/* @__PURE__ */V(Fe,{...e,forwardedRef:t}));Oe.displayName="CanvasStudio";var je=Oe;export{m as AREA_SHAPE_NAME,c as AUXILIARY_GROUP,f as AUXILIARY_LAYER_NAME,s as BACKGROUND_LAYER_NAME,t as BACKGROUND_SHAPE_NAME,h as CUSTOMER_SHAPE_NAME,Oe as CanvasStudio,p as DRAW_AREA_LAYER_NAME,n as DRAW_AREA_SHAPE_NAME,u as HELP_LINE_NAME,v as RULER_RECT_H,r as RULER_RECT_V,i as SHAPE_GROUP,d as SHAPE_LAYER_NAME,l as SHAPE_TYPES,o as SNAPPING_LINE_NAME,a as STAGE_CONTAINER_ID,e as THEME_COLOR,G as assertNever,je as default};
@@ -1 +1 @@
1
- import{a as s,i as a,n as o,o as r,r as t,s as i,t as m}from"../utils-HkiclU4u.js";export{m as assertNever,o as complementaryHexColor,t as getPointerPosition,a as getStageCenter,s as getStageViewPortCenter,r as getVector2Position,i as isMac};
1
+ import{a as s,i as a,n as o,o as r,r as t,s as i,t as m}from"../utils-DrbTlu3h.js";export{m as assertNever,o as complementaryHexColor,t as getPointerPosition,a as getStageCenter,s as getStageViewPortCenter,r as getVector2Position,i as isMac};
@@ -0,0 +1 @@
1
+ import{m as t,o as e}from"../constants-CHIlz4uF.js";import{nanoid as i}from"nanoid";var a=()=>({id:i(),width:void 0,scaleX:1,scaleY:1,rotation:0,visible:!0,displayName:"shape",opacity:1});const n=t=>({...t,id:i()}),r=(e,i,n,r,o,s=0,d=0,l="")=>{const c=a();return l&&(c.id=l),{...c,type:t.TEXT,x:s,y:d,letterSpacing:0,text:e,lineHeight:1,fontSize:i,fontStyle:"normal",textDecoration:"",fontFamily:n,fontId:`${r}`,fill:"#000",align:"left",displayName:e,name:"c1",info:{fontUrl:o}}},o=(e,i,n,r="",o=0,s=0,d=0,l=0)=>{const c=a();return r&&(c.id=r),{type:t.IMAGE,...c,imageName:i,x:o,y:s,width:d,height:l,imageSource:e,displayName:n,name:"c1"}},s=(e=0,i=0,n=0,r=0,o="",s="transparent",d=0,l="transparent")=>{const c=a();return o&&(c.id=o),{type:t.RECT,...c,x:e,y:i,width:n,height:r,fill:s,stroke:l,strokeWidth:d,name:"c1"}},d=(e,i,n,r=0,o=0,s=0,d=0,l="")=>{const c=a();return l&&(c.id=l),{type:t.SVG,...c,url:e,colors:n,displayName:i,x:r,y:o,width:s,height:d,name:"c1"}},l=(e,i,n=0,r=0,o=100,s=100,d="")=>{const l=a();return d&&(l.id=d),{type:t.QR_CODE,...l,source:e,displayName:i,x:n,y:r,width:o,height:s,margin:0,errorCorrectionLevel:"M",dark:"#000000",light:"#ffffff",name:"c1"}},c=(e,i,n=0,r=0,o=200,s=100,d="")=>{const l=a();return d&&(l.id=d),{type:t.BAR_CODE,...l,source:e,displayName:i,x:n,y:r,width:o,height:s,displayValue:!0,background:"#ffffff",lineColor:"#000000",margin:10,barType:"CODE128",name:"c1"}},y=(e,i,n,r=0,o=0,s=0,d=0,l="",c,y,p)=>{const h=a();return l&&(h.id=l),{type:t.RIVE,...h,url:e,stateMachine:i,artboard:p,displayName:n,x:r,y:o,width:s,height:d,inputs:c,name:"c1",variableObj:y}},p=(e,i,n=0,r=0,o=0,s=0,d="")=>{const l=a();return d&&(l.id=d),{type:t.VIDEO,...l,url:e,displayName:i,x:n,y:r,width:o,height:s,name:"c1"}},h=(e,n,r,o,s,d,l,c=i())=>{const y=a();return c&&(y.id=c),{type:t.BACK_SCREEN,...y,screenId:e,displayName:n,x:o,y:s,width:d,height:l,fill:r,name:"c1"}};function m(e){return e.type===t.TEXT}function f(e){return e.type===t.IMAGE}export{n as copyShape,h as createBackScreen,c as createBarCode,o as createImage,l as createQrCode,s as createRect,y as createRive,d as createSvg,r as createText,p as createVideo,f as isImgShape,m as isTextShape};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@machete-jhun/canvas-studio",
3
3
  "description": "一个基于 React 和 Konva 的画布编辑组件库,支持多种图形和媒体元素的添加与编辑,适用于构建复杂的图形应用。",
4
4
  "private": false,
5
- "version": "0.0.5",
5
+ "version": "0.0.6",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.js",
@@ -18,6 +18,10 @@
18
18
  "./utils": {
19
19
  "import": "./dist/utils/index.js",
20
20
  "types": "./dist/utils/index.d.ts"
21
+ },
22
+ "./utils/shapeTools": {
23
+ "import": "./dist/utils/shapeTools.js",
24
+ "types": "./dist/utils/shapeTools.d.ts"
21
25
  }
22
26
  },
23
27
  "files": [
File without changes