@splinetool/viewer
Version:
Spline is a collaborative design platform for creating production-ready interactive experiences in multiple dimensions. © 2025 Spline, Inc.
1 lines • 2.29 MB
JavaScript
var A2=Object.defineProperty;var AR=Object.getOwnPropertyDescriptor;var rh=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var m0=(e,t)=>()=>(e&&(t=e(e=0)),t);var M2=(e,t)=>{for(var i in t)A2(e,i,{get:t[i],enumerable:!0})};var bs=(e,t,i,r)=>{for(var a=r>1?void 0:r?AR(t,i):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(a=(r?n(t,i,a):n(a))||a);return r&&a&&A2(t,i,a),a};var MR={};var E2=m0(()=>{"use strict";(function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var c=this||t;return c._counter=1e3,c._html5AudioPool=[],c.html5PoolSize=10,c._codecs={},c._howls=[],c._muted=!1,c._volume=1,c._canPlayEvent="canplaythrough",c._navigator=typeof window<"u"&&window.navigator?window.navigator:null,c.masterGain=null,c.noAudio=!1,c.usingWebAudio=!0,c.autoSuspend=!0,c.ctx=null,c.autoUnlock=!0,c._setup(),c},volume:function(c){var d=this||t;if(c=parseFloat(c),d.ctx||h(),c!==void 0&&c>=0&&c<=1){if(d._volume=c,d._muted)return d;d.usingWebAudio&&d.masterGain.gain.setValueAtTime(c,t.ctx.currentTime);for(var u=0;u<d._howls.length;u++)if(!d._howls[u]._webAudio)for(var p=d._howls[u]._getSoundIds(),f=0;f<p.length;f++){var m=d._howls[u]._soundById(p[f]);m&&m._node&&(m._node.volume=m._volume*c)}return d}return d._volume},mute:function(c){var d=this||t;d.ctx||h(),d._muted=c,d.usingWebAudio&&d.masterGain.gain.setValueAtTime(c?0:d._volume,t.ctx.currentTime);for(var u=0;u<d._howls.length;u++)if(!d._howls[u]._webAudio)for(var p=d._howls[u]._getSoundIds(),f=0;f<p.length;f++){var m=d._howls[u]._soundById(p[f]);m&&m._node&&(m._node.muted=!!c||m._muted)}return d},stop:function(){for(var c=this||t,d=0;d<c._howls.length;d++)c._howls[d].stop();return c},unload:function(){for(var c=this||t,d=c._howls.length-1;d>=0;d--)c._howls[d].unload();return c.usingWebAudio&&c.ctx&&c.ctx.close!==void 0&&(c.ctx.close(),c.ctx=null,h()),c},codecs:function(c){return(this||t)._codecs[c.replace(/^x-/,"")]},_setup:function(){var c=this||t;if(c.state=c.ctx&&c.ctx.state||"suspended",c._autoSuspend(),!c.usingWebAudio)if(typeof Audio<"u")try{var d=new Audio;d.oncanplaythrough===void 0&&(c._canPlayEvent="canplay")}catch{c.noAudio=!0}else c.noAudio=!0;try{var d=new Audio;d.muted&&(c.noAudio=!0)}catch{}return c.noAudio||c._setupCodecs(),c},_setupCodecs:function(){var c=this||t,d=null;try{d=typeof Audio<"u"?new Audio:null}catch{return c}if(!d||typeof d.canPlayType!="function")return c;var u=d.canPlayType("audio/mpeg;").replace(/^no$/,""),p=c._navigator?c._navigator.userAgent:"",f=p.match(/OPR\/([0-6].)/g),m=f&&parseInt(f[0].split("/")[1],10)<33,g=p.indexOf("Safari")!==-1&&p.indexOf("Chrome")===-1,y=p.match(/Version\/(.*?) /),x=g&&y&&parseInt(y[1],10)<15;return c._codecs={mp3:!(m||!u&&!d.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!u,opus:!!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(d.canPlayType('audio/wav; codecs="1"')||d.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!d.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!d.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/m4a;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(d.canPlayType("audio/x-m4b;")||d.canPlayType("audio/m4b;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(d.canPlayType("audio/x-mp4;")||d.canPlayType("audio/mp4;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(x||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(x||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(d.canPlayType("audio/x-flac;")||d.canPlayType("audio/flac;")).replace(/^no$/,"")},c},_unlockAudio:function(){var c=this||t;if(!c._audioUnlocked&&c.ctx){c._audioUnlocked=!1,c.autoUnlock=!1,c._mobileUnloaded||c.ctx.sampleRate===44100||(c._mobileUnloaded=!0,c.unload()),c._scratchBuffer=c.ctx.createBuffer(1,1,22050);var d=function(u){for(;c._html5AudioPool.length<c.html5PoolSize;)try{var p=new Audio;p._unlocked=!0,c._releaseHtml5Audio(p)}catch{c.noAudio=!0;break}for(var f=0;f<c._howls.length;f++)if(!c._howls[f]._webAudio)for(var m=c._howls[f]._getSoundIds(),g=0;g<m.length;g++){var y=c._howls[f]._soundById(m[g]);y&&y._node&&!y._node._unlocked&&(y._node._unlocked=!0,y._node.load())}c._autoResume();var x=c.ctx.createBufferSource();x.buffer=c._scratchBuffer,x.connect(c.ctx.destination),x.start===void 0?x.noteOn(0):x.start(0),typeof c.ctx.resume=="function"&&c.ctx.resume(),x.onended=function(){x.disconnect(0),c._audioUnlocked=!0,document.removeEventListener("touchstart",d,!0),document.removeEventListener("touchend",d,!0),document.removeEventListener("click",d,!0),document.removeEventListener("keydown",d,!0);for(var b=0;b<c._howls.length;b++)c._howls[b]._emit("unlock")}};return document.addEventListener("touchstart",d,!0),document.addEventListener("touchend",d,!0),document.addEventListener("click",d,!0),document.addEventListener("keydown",d,!0),c}},_obtainHtml5Audio:function(){var c=this||t;if(c._html5AudioPool.length)return c._html5AudioPool.pop();var d=new Audio().play();return d&&typeof Promise<"u"&&(d instanceof Promise||typeof d.then=="function")&&d.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(c){var d=this||t;return c._unlocked&&d._html5AudioPool.push(c),d},_autoSuspend:function(){var c=this;if(c.autoSuspend&&c.ctx&&c.ctx.suspend!==void 0&&t.usingWebAudio){for(var d=0;d<c._howls.length;d++)if(c._howls[d]._webAudio){for(var u=0;u<c._howls[d]._sounds.length;u++)if(!c._howls[d]._sounds[u]._paused)return c}return c._suspendTimer&&clearTimeout(c._suspendTimer),c._suspendTimer=setTimeout(function(){if(c.autoSuspend){c._suspendTimer=null,c.state="suspending";var p=function(){c.state="suspended",c._resumeAfterSuspend&&(delete c._resumeAfterSuspend,c._autoResume())};c.ctx.suspend().then(p,p)}},3e4),c}},_autoResume:function(){var c=this;if(c.ctx&&c.ctx.resume!==void 0&&t.usingWebAudio)return c.state==="running"&&c.ctx.state!=="interrupted"&&c._suspendTimer?(clearTimeout(c._suspendTimer),c._suspendTimer=null):c.state==="suspended"||c.state==="running"&&c.ctx.state==="interrupted"?(c.ctx.resume().then(function(){c.state="running";for(var d=0;d<c._howls.length;d++)c._howls[d]._emit("resume")}),c._suspendTimer&&(clearTimeout(c._suspendTimer),c._suspendTimer=null)):c.state==="suspending"&&(c._resumeAfterSuspend=!0),c}};var t=new e,i=function(c){var d=this;if(!c.src||c.src.length===0)return void console.error("An array of source files must be passed with any new Howl.");d.init(c)};i.prototype={init:function(c){var d=this;return t.ctx||h(),d._autoplay=c.autoplay||!1,d._format=typeof c.format!="string"?c.format:[c.format],d._html5=c.html5||!1,d._muted=c.mute||!1,d._loop=c.loop||!1,d._pool=c.pool||5,d._preload=typeof c.preload!="boolean"&&c.preload!=="metadata"||c.preload,d._rate=c.rate||1,d._sprite=c.sprite||{},d._src=typeof c.src!="string"?c.src:[c.src],d._volume=c.volume!==void 0?c.volume:1,d._xhr={method:c.xhr&&c.xhr.method?c.xhr.method:"GET",headers:c.xhr&&c.xhr.headers?c.xhr.headers:null,withCredentials:!(!c.xhr||!c.xhr.withCredentials)&&c.xhr.withCredentials},d._duration=0,d._state="unloaded",d._sounds=[],d._endTimers={},d._queue=[],d._playLock=!1,d._onend=c.onend?[{fn:c.onend}]:[],d._onfade=c.onfade?[{fn:c.onfade}]:[],d._onload=c.onload?[{fn:c.onload}]:[],d._onloaderror=c.onloaderror?[{fn:c.onloaderror}]:[],d._onplayerror=c.onplayerror?[{fn:c.onplayerror}]:[],d._onpause=c.onpause?[{fn:c.onpause}]:[],d._onplay=c.onplay?[{fn:c.onplay}]:[],d._onstop=c.onstop?[{fn:c.onstop}]:[],d._onmute=c.onmute?[{fn:c.onmute}]:[],d._onvolume=c.onvolume?[{fn:c.onvolume}]:[],d._onrate=c.onrate?[{fn:c.onrate}]:[],d._onseek=c.onseek?[{fn:c.onseek}]:[],d._onunlock=c.onunlock?[{fn:c.onunlock}]:[],d._onresume=[],d._webAudio=t.usingWebAudio&&!d._html5,t.ctx!==void 0&&t.ctx&&t.autoUnlock&&t._unlockAudio(),t._howls.push(d),d._autoplay&&d._queue.push({event:"play",action:function(){d.play()}}),d._preload&&d._preload!=="none"&&d.load(),d},load:function(){var c=this,d=null;if(t.noAudio)return void c._emit("loaderror",null,"No audio support.");typeof c._src=="string"&&(c._src=[c._src]);for(var u=0;u<c._src.length;u++){var p,f;if(c._format&&c._format[u])p=c._format[u];else{if(typeof(f=c._src[u])!="string"){c._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}p=/^data:audio\/([^;,]+);/i.exec(f),p||(p=/\.([^.]+)$/.exec(f.split("?",1)[0])),p&&(p=p[1].toLowerCase())}if(p||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),p&&t.codecs(p)){d=c._src[u];break}}return d?(c._src=d,c._state="loading",window.location.protocol==="https:"&&d.slice(0,5)==="http:"&&(c._html5=!0,c._webAudio=!1),new r(c),c._webAudio&&s(c),c):void c._emit("loaderror",null,"No codec support for selected audio sources.")},play:function(c,d){var u=this,p=null;if(typeof c=="number")p=c,c=null;else{if(typeof c=="string"&&u._state==="loaded"&&!u._sprite[c])return null;if(c===void 0&&(c="__default",!u._playLock)){for(var f=0,m=0;m<u._sounds.length;m++)u._sounds[m]._paused&&!u._sounds[m]._ended&&(f++,p=u._sounds[m]._id);f===1?c=null:p=null}}var g=p?u._soundById(p):u._inactiveSound();if(!g)return null;if(p&&!c&&(c=g._sprite||"__default"),u._state!=="loaded"){g._sprite=c,g._ended=!1;var y=g._id;return u._queue.push({event:"play",action:function(){u.play(y)}}),y}if(p&&!g._paused)return d||u._loadQueue("play"),g._id;u._webAudio&&t._autoResume();var x=Math.max(0,g._seek>0?g._seek:u._sprite[c][0]/1e3),b=Math.max(0,(u._sprite[c][0]+u._sprite[c][1])/1e3-x),_=1e3*b/Math.abs(g._rate),S=u._sprite[c][0]/1e3,A=(u._sprite[c][0]+u._sprite[c][1])/1e3;g._sprite=c,g._ended=!1;var E=function(){g._paused=!1,g._seek=x,g._start=S,g._stop=A,g._loop=!(!g._loop&&!u._sprite[c][2])};if(x>=A)return void u._ended(g);var M=g._node;if(u._webAudio){var T=function(){u._playLock=!1,E(),u._refreshBuffer(g);var U=g._muted||u._muted?0:g._volume;M.gain.setValueAtTime(U,t.ctx.currentTime),g._playStart=t.ctx.currentTime,M.bufferSource.start===void 0?g._loop?M.bufferSource.noteGrainOn(0,x,86400):M.bufferSource.noteGrainOn(0,x,b):g._loop?M.bufferSource.start(0,x,86400):M.bufferSource.start(0,x,b),_!==1/0&&(u._endTimers[g._id]=setTimeout(u._ended.bind(u,g),_)),d||setTimeout(function(){u._emit("play",g._id),u._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?T():(u._playLock=!0,u.once("resume",T),u._clearTimer(g._id))}else{var P=function(){M.currentTime=x,M.muted=g._muted||u._muted||t._muted||M.muted,M.volume=g._volume*t.volume(),M.playbackRate=g._rate;try{var U=M.play();if(U&&typeof Promise<"u"&&(U instanceof Promise||typeof U.then=="function")?(u._playLock=!0,E(),U.then(function(){u._playLock=!1,M._unlocked=!0,d?u._loadQueue():u._emit("play",g._id)}).catch(function(){u._playLock=!1,u._emit("playerror",g._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),g._ended=!0,g._paused=!0})):d||(u._playLock=!1,E(),u._emit("play",g._id)),M.playbackRate=g._rate,M.paused)return void u._emit("playerror",g._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");c!=="__default"||g._loop?u._endTimers[g._id]=setTimeout(u._ended.bind(u,g),_):(u._endTimers[g._id]=function(){u._ended(g),M.removeEventListener("ended",u._endTimers[g._id],!1)},M.addEventListener("ended",u._endTimers[g._id],!1))}catch(L){u._emit("playerror",g._id,L)}};M.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(M.src=u._src,M.load());var R=window&&window.ejecta||!M.readyState&&t._navigator.isCocoonJS;if(M.readyState>=3||R)P();else{u._playLock=!0,u._state="loading";var z=function(){u._state="loaded",P(),M.removeEventListener(t._canPlayEvent,z,!1)};M.addEventListener(t._canPlayEvent,z,!1),u._clearTimer(g._id)}}return g._id},pause:function(c){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"pause",action:function(){d.pause(c)}}),d;for(var u=d._getSoundIds(c),p=0;p<u.length;p++){d._clearTimer(u[p]);var f=d._soundById(u[p]);if(f&&!f._paused&&(f._seek=d.seek(u[p]),f._rateSeek=0,f._paused=!0,d._stopFade(u[p]),f._node))if(d._webAudio){if(!f._node.bufferSource)continue;f._node.bufferSource.stop===void 0?f._node.bufferSource.noteOff(0):f._node.bufferSource.stop(0),d._cleanBuffer(f._node)}else isNaN(f._node.duration)&&f._node.duration!==1/0||f._node.pause();arguments[1]||d._emit("pause",f?f._id:null)}return d},stop:function(c,d){var u=this;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"stop",action:function(){u.stop(c)}}),u;for(var p=u._getSoundIds(c),f=0;f<p.length;f++){u._clearTimer(p[f]);var m=u._soundById(p[f]);m&&(m._seek=m._start||0,m._rateSeek=0,m._paused=!0,m._ended=!0,u._stopFade(p[f]),m._node&&(u._webAudio?m._node.bufferSource&&(m._node.bufferSource.stop===void 0?m._node.bufferSource.noteOff(0):m._node.bufferSource.stop(0),u._cleanBuffer(m._node)):isNaN(m._node.duration)&&m._node.duration!==1/0||(m._node.currentTime=m._start||0,m._node.pause(),m._node.duration===1/0&&u._clearSound(m._node))),d||u._emit("stop",m._id))}return u},mute:function(c,d){var u=this;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"mute",action:function(){u.mute(c,d)}}),u;if(d===void 0){if(typeof c!="boolean")return u._muted;u._muted=c}for(var p=u._getSoundIds(d),f=0;f<p.length;f++){var m=u._soundById(p[f]);m&&(m._muted=c,m._interval&&u._stopFade(m._id),u._webAudio&&m._node?m._node.gain.setValueAtTime(c?0:m._volume,t.ctx.currentTime):m._node&&(m._node.muted=!!t._muted||c),u._emit("mute",m._id))}return u},volume:function(){var c,d,u=this,p=arguments;if(p.length===0)return u._volume;p.length===1||p.length===2&&p[1]===void 0?u._getSoundIds().indexOf(p[0])>=0?d=parseInt(p[0],10):c=parseFloat(p[0]):p.length>=2&&(c=parseFloat(p[0]),d=parseInt(p[1],10));var f;if(!(c!==void 0&&c>=0&&c<=1))return f=d?u._soundById(d):u._sounds[0],f?f._volume:0;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"volume",action:function(){u.volume.apply(u,p)}}),u;d===void 0&&(u._volume=c),d=u._getSoundIds(d);for(var m=0;m<d.length;m++)(f=u._soundById(d[m]))&&(f._volume=c,p[2]||u._stopFade(d[m]),u._webAudio&&f._node&&!f._muted?f._node.gain.setValueAtTime(c,t.ctx.currentTime):f._node&&!f._muted&&(f._node.volume=c*t.volume()),u._emit("volume",f._id));return u},fade:function(c,d,u,p){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"fade",action:function(){f.fade(c,d,u,p)}}),f;c=Math.min(Math.max(0,parseFloat(c)),1),d=Math.min(Math.max(0,parseFloat(d)),1),u=parseFloat(u),f.volume(c,p);for(var m=f._getSoundIds(p),g=0;g<m.length;g++){var y=f._soundById(m[g]);if(y){if(p||f._stopFade(m[g]),f._webAudio&&!y._muted){var x=t.ctx.currentTime,b=x+u/1e3;y._volume=c,y._node.gain.setValueAtTime(c,x),y._node.gain.linearRampToValueAtTime(d,b)}f._startFadeInterval(y,c,d,u,m[g],p===void 0)}}return f},_startFadeInterval:function(c,d,u,p,f,m){var g=this,y=d,x=u-d,b=Math.abs(x/.01),_=Math.max(4,b>0?p/b:p),S=Date.now();c._fadeTo=u,c._interval=setInterval(function(){var A=(Date.now()-S)/p;S=Date.now(),y+=x*A,y=Math.round(100*y)/100,y=x<0?Math.max(u,y):Math.min(u,y),g._webAudio?c._volume=y:g.volume(y,c._id,!0),m&&(g._volume=y),(u<d&&y<=u||u>d&&y>=u)&&(clearInterval(c._interval),c._interval=null,c._fadeTo=null,g.volume(u,c._id),g._emit("fade",c._id))},_)},_stopFade:function(c){var d=this,u=d._soundById(c);return u&&u._interval&&(d._webAudio&&u._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(u._interval),u._interval=null,d.volume(u._fadeTo,c),u._fadeTo=null,d._emit("fade",c)),d},loop:function(){var c,d,u,p=this,f=arguments;if(f.length===0)return p._loop;if(f.length===1){if(typeof f[0]!="boolean")return!!(u=p._soundById(parseInt(f[0],10)))&&u._loop;c=f[0],p._loop=c}else f.length===2&&(c=f[0],d=parseInt(f[1],10));for(var m=p._getSoundIds(d),g=0;g<m.length;g++)(u=p._soundById(m[g]))&&(u._loop=c,p._webAudio&&u._node&&u._node.bufferSource&&(u._node.bufferSource.loop=c,c&&(u._node.bufferSource.loopStart=u._start||0,u._node.bufferSource.loopEnd=u._stop,p.playing(m[g])&&(p.pause(m[g],!0),p.play(m[g],!0)))));return p},rate:function(){var c,d,u=this,p=arguments;if(p.length===0)d=u._sounds[0]._id;else if(p.length===1){var f=u._getSoundIds(),m=f.indexOf(p[0]);m>=0?d=parseInt(p[0],10):c=parseFloat(p[0])}else p.length===2&&(c=parseFloat(p[0]),d=parseInt(p[1],10));var g;if(typeof c!="number")return g=u._soundById(d),g?g._rate:u._rate;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"rate",action:function(){u.rate.apply(u,p)}}),u;d===void 0&&(u._rate=c),d=u._getSoundIds(d);for(var y=0;y<d.length;y++)if(g=u._soundById(d[y])){u.playing(d[y])&&(g._rateSeek=u.seek(d[y]),g._playStart=u._webAudio?t.ctx.currentTime:g._playStart),g._rate=c,u._webAudio&&g._node&&g._node.bufferSource?g._node.bufferSource.playbackRate.setValueAtTime(c,t.ctx.currentTime):g._node&&(g._node.playbackRate=c);var x=u.seek(d[y]),b=(u._sprite[g._sprite][0]+u._sprite[g._sprite][1])/1e3-x,_=1e3*b/Math.abs(g._rate);!u._endTimers[d[y]]&&g._paused||(u._clearTimer(d[y]),u._endTimers[d[y]]=setTimeout(u._ended.bind(u,g),_)),u._emit("rate",g._id)}return u},seek:function(){var c,d,u=this,p=arguments;if(p.length===0)u._sounds.length&&(d=u._sounds[0]._id);else if(p.length===1){var f=u._getSoundIds(),m=f.indexOf(p[0]);m>=0?d=parseInt(p[0],10):u._sounds.length&&(d=u._sounds[0]._id,c=parseFloat(p[0]))}else p.length===2&&(c=parseFloat(p[0]),d=parseInt(p[1],10));if(d===void 0)return 0;if(typeof c=="number"&&(u._state!=="loaded"||u._playLock))return u._queue.push({event:"seek",action:function(){u.seek.apply(u,p)}}),u;var g=u._soundById(d);if(g){if(!(typeof c=="number"&&c>=0)){if(u._webAudio){var y=u.playing(d)?t.ctx.currentTime-g._playStart:0,x=g._rateSeek?g._rateSeek-g._seek:0;return g._seek+(x+y*Math.abs(g._rate))}return g._node.currentTime}var b=u.playing(d);b&&u.pause(d,!0),g._seek=c,g._ended=!1,u._clearTimer(d),u._webAudio||!g._node||isNaN(g._node.duration)||(g._node.currentTime=c);var _=function(){b&&u.play(d,!0),u._emit("seek",d)};if(b&&!u._webAudio){var S=function(){u._playLock?setTimeout(S,0):_()};setTimeout(S,0)}else _()}return u},playing:function(c){var d=this;if(typeof c=="number"){var u=d._soundById(c);return!!u&&!u._paused}for(var p=0;p<d._sounds.length;p++)if(!d._sounds[p]._paused)return!0;return!1},duration:function(c){var d=this,u=d._duration,p=d._soundById(c);return p&&(u=d._sprite[p._sprite][1]/1e3),u},state:function(){return this._state},unload:function(){for(var c=this,d=c._sounds,u=0;u<d.length;u++)d[u]._paused||c.stop(d[u]._id),c._webAudio||(c._clearSound(d[u]._node),d[u]._node.removeEventListener("error",d[u]._errorFn,!1),d[u]._node.removeEventListener(t._canPlayEvent,d[u]._loadFn,!1),d[u]._node.removeEventListener("ended",d[u]._endFn,!1),t._releaseHtml5Audio(d[u]._node)),delete d[u]._node,c._clearTimer(d[u]._id);var p=t._howls.indexOf(c);p>=0&&t._howls.splice(p,1);var f=!0;for(u=0;u<t._howls.length;u++)if(t._howls[u]._src===c._src||c._src.indexOf(t._howls[u]._src)>=0){f=!1;break}return a&&f&&delete a[c._src],t.noAudio=!1,c._state="unloaded",c._sounds=[],c=null,null},on:function(c,d,u,p){var f=this,m=f["_on"+c];return typeof d=="function"&&m.push(p?{id:u,fn:d,once:p}:{id:u,fn:d}),f},off:function(c,d,u){var p=this,f=p["_on"+c],m=0;if(typeof d=="number"&&(u=d,d=null),d||u)for(m=0;m<f.length;m++){var g=u===f[m].id;if(d===f[m].fn&&g||!d&&g){f.splice(m,1);break}}else if(c)p["_on"+c]=[];else{var y=Object.keys(p);for(m=0;m<y.length;m++)y[m].indexOf("_on")===0&&Array.isArray(p[y[m]])&&(p[y[m]]=[])}return p},once:function(c,d,u){var p=this;return p.on(c,d,u,1),p},_emit:function(c,d,u){for(var p=this,f=p["_on"+c],m=f.length-1;m>=0;m--)f[m].id&&f[m].id!==d&&c!=="load"||(setTimeout(function(g){g.call(this,d,u)}.bind(p,f[m].fn),0),f[m].once&&p.off(c,f[m].fn,f[m].id));return p._loadQueue(c),p},_loadQueue:function(c){var d=this;if(d._queue.length>0){var u=d._queue[0];u.event===c&&(d._queue.shift(),d._loadQueue()),c||u.action()}return d},_ended:function(c){var d=this,u=c._sprite;if(!d._webAudio&&c._node&&!c._node.paused&&!c._node.ended&&c._node.currentTime<c._stop)return setTimeout(d._ended.bind(d,c),100),d;var p=!(!c._loop&&!d._sprite[u][2]);if(d._emit("end",c._id),!d._webAudio&&p&&d.stop(c._id,!0).play(c._id),d._webAudio&&p){d._emit("play",c._id),c._seek=c._start||0,c._rateSeek=0,c._playStart=t.ctx.currentTime;var f=1e3*(c._stop-c._start)/Math.abs(c._rate);d._endTimers[c._id]=setTimeout(d._ended.bind(d,c),f)}return d._webAudio&&!p&&(c._paused=!0,c._ended=!0,c._seek=c._start||0,c._rateSeek=0,d._clearTimer(c._id),d._cleanBuffer(c._node),t._autoSuspend()),d._webAudio||p||d.stop(c._id,!0),d},_clearTimer:function(c){var d=this;if(d._endTimers[c]){if(typeof d._endTimers[c]!="function")clearTimeout(d._endTimers[c]);else{var u=d._soundById(c);u&&u._node&&u._node.removeEventListener("ended",d._endTimers[c],!1)}delete d._endTimers[c]}return d},_soundById:function(c){for(var d=this,u=0;u<d._sounds.length;u++)if(c===d._sounds[u]._id)return d._sounds[u];return null},_inactiveSound:function(){var c=this;c._drain();for(var d=0;d<c._sounds.length;d++)if(c._sounds[d]._ended)return c._sounds[d].reset();return new r(c)},_drain:function(){var c=this,d=c._pool,u=0,p=0;if(!(c._sounds.length<d)){for(p=0;p<c._sounds.length;p++)c._sounds[p]._ended&&u++;for(p=c._sounds.length-1;p>=0;p--){if(u<=d)return;c._sounds[p]._ended&&(c._webAudio&&c._sounds[p]._node&&c._sounds[p]._node.disconnect(0),c._sounds.splice(p,1),u--)}}},_getSoundIds:function(c){var d=this;if(c===void 0){for(var u=[],p=0;p<d._sounds.length;p++)u.push(d._sounds[p]._id);return u}return[c]},_refreshBuffer:function(c){var d=this;return c._node.bufferSource=t.ctx.createBufferSource(),c._node.bufferSource.buffer=a[d._src],c._panner?c._node.bufferSource.connect(c._panner):c._node.bufferSource.connect(c._node),c._node.bufferSource.loop=c._loop,c._loop&&(c._node.bufferSource.loopStart=c._start||0,c._node.bufferSource.loopEnd=c._stop||0),c._node.bufferSource.playbackRate.setValueAtTime(c._rate,t.ctx.currentTime),d},_cleanBuffer:function(c){var d=this,u=t._navigator&&t._navigator.vendor.indexOf("Apple")>=0;if(t._scratchBuffer&&c.bufferSource&&(c.bufferSource.onended=null,c.bufferSource.disconnect(0),u))try{c.bufferSource.buffer=t._scratchBuffer}catch{}return c.bufferSource=null,d},_clearSound:function(c){/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent)||(c.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(c){this._parent=c,this.init()};r.prototype={init:function(){var c=this,d=c._parent;return c._muted=d._muted,c._loop=d._loop,c._volume=d._volume,c._rate=d._rate,c._seek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++t._counter,d._sounds.push(c),c.create(),c},create:function(){var c=this,d=c._parent,u=t._muted||c._muted||c._parent._muted?0:c._volume;return d._webAudio?(c._node=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),c._node.gain.setValueAtTime(u,t.ctx.currentTime),c._node.paused=!0,c._node.connect(t.masterGain)):t.noAudio||(c._node=t._obtainHtml5Audio(),c._errorFn=c._errorListener.bind(c),c._node.addEventListener("error",c._errorFn,!1),c._loadFn=c._loadListener.bind(c),c._node.addEventListener(t._canPlayEvent,c._loadFn,!1),c._endFn=c._endListener.bind(c),c._node.addEventListener("ended",c._endFn,!1),c._node.src=d._src,c._node.preload=d._preload===!0?"auto":d._preload,c._node.volume=u*t.volume(),c._node.load()),c},reset:function(){var c=this,d=c._parent;return c._muted=d._muted,c._loop=d._loop,c._volume=d._volume,c._rate=d._rate,c._seek=0,c._rateSeek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++t._counter,c},_errorListener:function(){var c=this;c._parent._emit("loaderror",c._id,c._node.error?c._node.error.code:0),c._node.removeEventListener("error",c._errorFn,!1)},_loadListener:function(){var c=this,d=c._parent;d._duration=Math.ceil(10*c._node.duration)/10,Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,1e3*d._duration]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue()),c._node.removeEventListener(t._canPlayEvent,c._loadFn,!1)},_endListener:function(){var c=this,d=c._parent;d._duration===1/0&&(d._duration=Math.ceil(10*c._node.duration)/10,d._sprite.__default[1]===1/0&&(d._sprite.__default[1]=1e3*d._duration),d._ended(c)),c._node.removeEventListener("ended",c._endFn,!1)}};var a={},s=function(c){var d=c._src;if(a[d])return c._duration=a[d].duration,void l(c);if(/^data:[^;]+;base64,/.test(d)){for(var u=atob(d.split(",")[1]),p=new Uint8Array(u.length),f=0;f<u.length;++f)p[f]=u.charCodeAt(f);o(p.buffer,c)}else{var m=new XMLHttpRequest;m.open(c._xhr.method,d,!0),m.withCredentials=c._xhr.withCredentials,m.responseType="arraybuffer",c._xhr.headers&&Object.keys(c._xhr.headers).forEach(function(g){m.setRequestHeader(g,c._xhr.headers[g])}),m.onload=function(){var g=(m.status+"")[0];if(g!=="0"&&g!=="2"&&g!=="3")return void c._emit("loaderror",null,"Failed loading audio file with status: "+m.status+".");o(m.response,c)},m.onerror=function(){c._webAudio&&(c._html5=!0,c._webAudio=!1,c._sounds=[],delete a[d],c.load())},n(m)}},n=function(c){try{c.send()}catch{c.onerror()}},o=function(c,d){var u=function(){d._emit("loaderror",null,"Decoding audio data failed.")},p=function(f){f&&d._sounds.length>0?(a[d._src]=f,l(d,f)):u()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(c).then(p).catch(u):t.ctx.decodeAudioData(c,p,u)},l=function(c,d){d&&!c._duration&&(c._duration=d.duration),Object.keys(c._sprite).length===0&&(c._sprite={__default:[0,1e3*c._duration]}),c._state!=="loaded"&&(c._state="loaded",c._emit("load"),c._loadQueue())},h=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch{t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var c=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),d=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),u=d?parseInt(d[1],10):null;if(c&&u&&u<9){var p=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!p&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};typeof define=="function"&&define.amd&&define([],function(){return{Howler:t,Howl:i}}),typeof exports<"u"&&(exports.Howler=t,exports.Howl=i),typeof global<"u"?(global.HowlerGlobal=e,global.Howler=t,global.Howl=i,global.Sound=r):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=i,window.Sound=r)})()});var T2={};M2(T2,{default:()=>TR});var C2,ER,CR,TR,P2=m0(()=>{"use strict";C2=(e=>typeof rh<"u"?rh:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof rh<"u"?rh:t)[i]}):e)(function(e){if(typeof rh<"u")return rh.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),ER=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),CR=ER((e,t)=>{var i=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(a={}){var s=a,n,o;s.ready=new Promise((v,w)=>{n=v,o=w}),function(v){v.Id=v.Id||[],v.Id.push(function(){v.MakeSWCanvasSurface=function(w){var C=w,I=typeof OffscreenCanvas<"u"&&C instanceof OffscreenCanvas;if(!(typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||I||(C=document.getElementById(w),C)))throw"Canvas with id "+w+" was not found";return(w=v.MakeSurface(C.width,C.height))&&(w.ie=C),w},v.MakeCanvasSurface||(v.MakeCanvasSurface=v.MakeSWCanvasSurface),v.MakeSurface=function(w,C){var I={width:w,height:C,colorType:v.ColorType.RGBA_8888,alphaType:v.AlphaType.Unpremul,colorSpace:v.ColorSpace.SRGB},B=w*C*4,H=v._malloc(B);return(I=v.Surface._makeRasterDirect(I,H,4*w))&&(I.ie=null,I.Pe=w,I.Me=C,I.Ne=B,I.re=H,I.getCanvas().clear(v.TRANSPARENT)),I},v.MakeRasterDirectSurface=function(w,C,I){return v.Surface._makeRasterDirect(w,C.byteOffset,I)},v.Surface.prototype.flush=function(w){if(v.Fd(this.Ed),this._flush(),this.ie){var C=new Uint8ClampedArray(v.HEAPU8.buffer,this.re,this.Ne);C=new ImageData(C,this.Pe,this.Me),w?this.ie.getContext("2d").putImageData(C,0,0,w[0],w[1],w[2]-w[0],w[3]-w[1]):this.ie.getContext("2d").putImageData(C,0,0)}},v.Surface.prototype.dispose=function(){this.re&&v._free(this.re),this.delete()},v.Fd=v.Fd||function(){},v.je=v.je||function(){return null}})}(s),function(v){v.Id=v.Id||[],v.Id.push(function(){function w(Z,le,Re){return Z&&Z.hasOwnProperty(le)?Z[le]:Re}function C(Z){var le=oc(gs);return gs[le]=Z,le}function I(Z){return Z.naturalHeight||Z.videoHeight||Z.displayHeight||Z.height}function B(Z){return Z.naturalWidth||Z.videoWidth||Z.displayWidth||Z.width}function H(Z,le,Re,Ne){return Z.bindTexture(Z.TEXTURE_2D,le),Ne||Re.alphaType!==v.AlphaType.Premul||Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),le}function K(Z,le,Re){Re||le.alphaType!==v.AlphaType.Premul||Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),Z.bindTexture(Z.TEXTURE_2D,null)}v.GetWebGLContext=function(Z,le){if(!Z)throw"null canvas passed into makeWebGLContext";var Re={alpha:w(le,"alpha",1),depth:w(le,"depth",1),stencil:w(le,"stencil",8),antialias:w(le,"antialias",0),premultipliedAlpha:w(le,"premultipliedAlpha",1),preserveDrawingBuffer:w(le,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:w(le,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:w(le,"failIfMajorPerformanceCaveat",0),enableExtensionsByDefault:w(le,"enableExtensionsByDefault",1),explicitSwapControl:w(le,"explicitSwapControl",0),renderViaOffscreenBackBuffer:w(le,"renderViaOffscreenBackBuffer",0)};if(Re.majorVersion=le&&le.majorVersion?le.majorVersion:typeof WebGL2RenderingContext<"u"?2:1,Re.explicitSwapControl)throw"explicitSwapControl is not supported";return Z=rR(Z,Re),Z?(a2(Z),$t.Qd.getExtension("WEBGL_debug_renderer_info"),Z):0},v.deleteContext=function(Z){$t===un[Z]&&($t=null),typeof JSEvents=="object"&&JSEvents.tf(un[Z].Qd.canvas),un[Z]&&un[Z].Qd.canvas&&(un[Z].Qd.canvas.Ke=void 0),un[Z]=null},v._setTextureCleanup({deleteTexture:function(Z,le){var Re=gs[le];Re&&un[Z].Qd.deleteTexture(Re),gs[le]=null}}),v.MakeWebGLContext=function(Z){if(!this.Fd(Z))return null;var le=this._MakeGrContext();if(!le)return null;le.Ed=Z;var Re=le.delete.bind(le);return le.delete=function(){v.Fd(this.Ed),Re()}.bind(le),$t.te=le},v.MakeGrContext=v.MakeWebGLContext,v.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){v.Fd(this.Ed),this._getResourceCacheLimitBytes()},v.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){v.Fd(this.Ed),this._getResourceCacheUsageBytes()},v.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){v.Fd(this.Ed),this._releaseResourcesAndAbandonContext()},v.GrDirectContext.prototype.setResourceCacheLimitBytes=function(Z){v.Fd(this.Ed),this._setResourceCacheLimitBytes(Z)},v.MakeOnScreenGLSurface=function(Z,le,Re,Ne,$e,mt){return!this.Fd(Z.Ed)||(le=$e===void 0||mt===void 0?this._MakeOnScreenGLSurface(Z,le,Re,Ne):this._MakeOnScreenGLSurface(Z,le,Re,Ne,$e,mt),!le)?null:(le.Ed=Z.Ed,le)},v.MakeRenderTarget=function(){var Z=arguments[0];if(!this.Fd(Z.Ed))return null;if(arguments.length===3){var le=this._MakeRenderTargetWH(Z,arguments[1],arguments[2]);if(!le)return null}else if(arguments.length===2){if(le=this._MakeRenderTargetII(Z,arguments[1]),!le)return null}else return null;return le.Ed=Z.Ed,le},v.MakeWebGLCanvasSurface=function(Z,le,Re){le=le||null;var Ne=Z,$e=typeof OffscreenCanvas<"u"&&Ne instanceof OffscreenCanvas;if(!(typeof HTMLCanvasElement<"u"&&Ne instanceof HTMLCanvasElement||$e||(Ne=document.getElementById(Z),Ne)))throw"Canvas with id "+Z+" was not found";if(Z=this.GetWebGLContext(Ne,Re),!Z||0>Z)throw"failed to create webgl context: err "+Z;return Z=this.MakeWebGLContext(Z),le=this.MakeOnScreenGLSurface(Z,Ne.width,Ne.height,le),le||(le=Ne.cloneNode(!0),Ne.parentNode.replaceChild(le,Ne),le.classList.add("ck-replaced"),v.MakeSWCanvasSurface(le))},v.MakeCanvasSurface=v.MakeWebGLCanvasSurface,v.Surface.prototype.makeImageFromTexture=function(Z,le){return v.Fd(this.Ed),Z=C(Z),(le=this._makeImageFromTexture(this.Ed,Z,le))&&(le.de=Z),le},v.Surface.prototype.makeImageFromTextureSource=function(Z,le,Re){le||(le={height:I(Z),width:B(Z),colorType:v.ColorType.RGBA_8888,alphaType:Re?v.AlphaType.Premul:v.AlphaType.Unpremul}),le.colorSpace||(le.colorSpace=v.ColorSpace.SRGB),v.Fd(this.Ed);var Ne=$t.Qd;return Re=H(Ne,Ne.createTexture(),le,Re),$t.version===2?Ne.texImage2D(Ne.TEXTURE_2D,0,Ne.RGBA,le.width,le.height,0,Ne.RGBA,Ne.UNSIGNED_BYTE,Z):Ne.texImage2D(Ne.TEXTURE_2D,0,Ne.RGBA,Ne.RGBA,Ne.UNSIGNED_BYTE,Z),K(Ne,le),this._resetContext(),this.makeImageFromTexture(Re,le)},v.Surface.prototype.updateTextureFromSource=function(Z,le,Re){if(Z.de){v.Fd(this.Ed);var Ne=Z.getImageInfo(),$e=$t.Qd,mt=H($e,gs[Z.de],Ne,Re);$t.version===2?$e.texImage2D($e.TEXTURE_2D,0,$e.RGBA,B(le),I(le),0,$e.RGBA,$e.UNSIGNED_BYTE,le):$e.texImage2D($e.TEXTURE_2D,0,$e.RGBA,$e.RGBA,$e.UNSIGNED_BYTE,le),K($e,Ne,Re),this._resetContext(),gs[Z.de]=null,Z.de=C(mt),Ne.colorSpace=Z.getColorSpace(),le=this._makeImageFromTexture(this.Ed,Z.de,Ne),Re=Z.Dd.Hd,$e=Z.Dd.Ld,Z.Dd.Hd=le.Dd.Hd,Z.Dd.Ld=le.Dd.Ld,le.Dd.Hd=Re,le.Dd.Ld=$e,le.delete(),Ne.colorSpace.delete()}},v.MakeLazyImageFromTextureSource=function(Z,le,Re){le||(le={height:I(Z),width:B(Z),colorType:v.ColorType.RGBA_8888,alphaType:Re?v.AlphaType.Premul:v.AlphaType.Unpremul}),le.colorSpace||(le.colorSpace=v.ColorSpace.SRGB);var Ne={makeTexture:function(){var $e=$t,mt=$e.Qd,xe=H(mt,mt.createTexture(),le,Re);return $e.version===2?mt.texImage2D(mt.TEXTURE_2D,0,mt.RGBA,le.width,le.height,0,mt.RGBA,mt.UNSIGNED_BYTE,Z):mt.texImage2D(mt.TEXTURE_2D,0,mt.RGBA,mt.RGBA,mt.UNSIGNED_BYTE,Z),K(mt,le,Re),C(xe)},freeSrc:function(){}};return Z.constructor.name==="VideoFrame"&&(Ne.freeSrc=function(){Z.close()}),v.Image._makeFromGenerator(le,Ne)},v.Fd=function(Z){return Z?a2(Z):!1},v.je=function(){return $t&&$t.te&&!$t.te.isDeleted()?$t.te:null}})}(s),function(v){function w(k){return(B(255*k[3])<<24|B(255*k[0])<<16|B(255*k[1])<<8|B(255*k[2])<<0)>>>0}function C(k){if(k&&k._ck)return k;if(k instanceof Float32Array){for(var D=Math.floor(k.length/4),N=new Uint32Array(D),$=0;$<D;$++)N[$]=w(k.slice(4*$,4*($+1)));return N}if(k instanceof Uint32Array)return k;if(k instanceof Array&&k[0]instanceof Float32Array)return k.map(w)}function I(k){if(k===void 0)return 1;var D=parseFloat(k);return k&&k.indexOf("%")!==-1?D/100:D}function B(k){return Math.round(Math.max(0,Math.min(k||0,255)))}function H(k,D){D&&D._ck||v._free(k)}function K(k,D,N){if(!k||!k.length)return ui;if(k&&k._ck)return k.byteOffset;var $=v[D].BYTES_PER_ELEMENT;return N||(N=v._malloc(k.length*$)),v[D].set(k,N/$),N}function Z(k){var D={Nd:ui,count:k.length,colorType:v.ColorType.RGBA_F32};if(k instanceof Float32Array)D.Nd=K(k,"HEAPF32"),D.count=k.length/4;else if(k instanceof Uint32Array)D.Nd=K(k,"HEAPU32"),D.colorType=v.ColorType.RGBA_8888;else if(k instanceof Array){if(k&&k.length){for(var N=v._malloc(16*k.length),$=0,pe=N/4,De=0;De<k.length;De++)for(var Ge=0;4>Ge;Ge++)v.HEAPF32[pe+$]=k[De][Ge],$++;k=N}else k=ui;D.Nd=k}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof k;return D}function le(k){if(!k)return ui;var D=$i.toTypedArray();if(k.length){if(k.length===6||k.length===9)return K(k,"HEAPF32",Ht),k.length===6&&v.HEAPF32.set(SR,6+Ht/4),Ht;if(k.length===16)return D[0]=k[0],D[1]=k[1],D[2]=k[3],D[3]=k[4],D[4]=k[5],D[5]=k[7],D[6]=k[12],D[7]=k[13],D[8]=k[15],Ht;throw"invalid matrix size"}if(k.m11===void 0)throw"invalid matrix argument";return D[0]=k.m11,D[1]=k.m21,D[2]=k.m41,D[3]=k.m12,D[4]=k.m22,D[5]=k.m42,D[6]=k.m14,D[7]=k.m24,D[8]=k.m44,Ht}function Re(k){if(!k)return ui;var D=Zr.toTypedArray();if(k.length){if(k.length!==16&&k.length!==6&&k.length!==9)throw"invalid matrix size";return k.length===16?K(k,"HEAPF32",Ra):(D.fill(0),D[0]=k[0],D[1]=k[1],D[3]=k[2],D[4]=k[3],D[5]=k[4],D[7]=k[5],D[10]=1,D[12]=k[6],D[13]=k[7],D[15]=k[8],k.length===6&&(D[12]=0,D[13]=0,D[15]=1),Ra)}if(k.m11===void 0)throw"invalid matrix argument";return D[0]=k.m11,D[1]=k.m21,D[2]=k.m31,D[3]=k.m41,D[4]=k.m12,D[5]=k.m22,D[6]=k.m32,D[7]=k.m42,D[8]=k.m13,D[9]=k.m23,D[10]=k.m33,D[11]=k.m43,D[12]=k.m14,D[13]=k.m24,D[14]=k.m34,D[15]=k.m44,Ra}function Ne(k,D){return K(k,"HEAPF32",D||pn)}function $e(k,D,N,$){var pe=hc.toTypedArray();return pe[0]=k,pe[1]=D,pe[2]=N,pe[3]=$,pn}function mt(k){for(var D=new Float32Array(4),N=0;4>N;N++)D[N]=v.HEAPF32[k/4+N];return D}function xe(k,D){return K(k,"HEAPF32",D||kr)}function xt(k,D){return K(k,"HEAPF32",D||u0)}v.Color=function(k,D,N,$){return $===void 0&&($=1),v.Color4f(B(k)/255,B(D)/255,B(N)/255,$)},v.ColorAsInt=function(k,D,N,$){return $===void 0&&($=255),(B($)<<24|B(k)<<16|B(D)<<8|B(N)<<0&268435455)>>>0},v.Color4f=function(k,D,N,$){return $===void 0&&($=1),Float32Array.of(k,D,N,$)},Object.defineProperty(v,"TRANSPARENT",{get:function(){return v.Color4f(0,0,0,0)}}),Object.defineProperty(v,"BLACK",{get:function(){return v.Color4f(0,0,0,1)}}),Object.defineProperty(v,"WHITE",{get:function(){return v.Color4f(1,1,1,1)}}),Object.defineProperty(v,"RED",{get:function(){return v.Color4f(1,0,0,1)}}),Object.defineProperty(v,"GREEN",{get:function(){return v.Color4f(0,1,0,1)}}),Object.defineProperty(v,"BLUE",{get:function(){return v.Color4f(0,0,1,1)}}),Object.defineProperty(v,"YELLOW",{get:function(){return v.Color4f(1,1,0,1)}}),Object.defineProperty(v,"CYAN",{get:function(){return v.Color4f(0,1,1,1)}}),Object.defineProperty(v,"MAGENTA",{get:function(){return v.Color4f(1,0,1,1)}}),v.getColorComponents=function(k){return[Math.floor(255*k[0]),Math.floor(255*k[1]),Math.floor(255*k[2]),k[3]]},v.parseColorString=function(k,D){if(k=k.toLowerCase(),k.startsWith("#")){switch(D=255,k.length){case 9:D=parseInt(k.slice(7,9),16);case 7:var N=parseInt(k.slice(1,3),16),$=parseInt(k.slice(3,5),16),pe=parseInt(k.slice(5,7),16);break;case 5:D=17*parseInt(k.slice(4,5),16);case 4:N=17*parseInt(k.slice(1,2),16),$=17*parseInt(k.slice(2,3),16),pe=17*parseInt(k.slice(3,4),16)}return v.Color(N,$,pe,D/255)}return k.startsWith("rgba")?(k=k.slice(5,-1),k=k.split(","),v.Color(+k[0],+k[1],+k[2],I(k[3]))):k.startsWith("rgb")?(k=k.slice(4,-1),k=k.split(","),v.Color(+k[0],+k[1],+k[2],I(k[3]))):k.startsWith("gray(")||k.startsWith("hsl")||!D||(k=D[k],k===void 0)?v.BLACK:k},v.multiplyByAlpha=function(k,D){return k=k.slice(),k[3]=Math.max(0,Math.min(k[3]*D,1)),k},v.Malloc=function(k,D){var N=v._malloc(D*k.BYTES_PER_ELEMENT);return{_ck:!0,length:D,byteOffset:N,Xd:null,subarray:function($,pe){return $=this.toTypedArray().subarray($,pe),$._ck=!0,$},toTypedArray:function(){return this.Xd&&this.Xd.length?this.Xd:(this.Xd=new k(v.HEAPU8.buffer,N,D),this.Xd._ck=!0,this.Xd)}}},v.Free=function(k){v._free(k.byteOffset),k.byteOffset=ui,k.toTypedArray=null,k.Xd=null};var Ht=ui,$i,Ra=ui,Zr,pn=ui,hc,Vs,kr=ui,v2,Jo=ui,y2,c0=ui,x2,d0=ui,_f,cu=ui,b2,u0=ui,w2,_2=ui,SR=Float32Array.of(0,0,1),ui=0;v.onRuntimeInitialized=function(){function k(D,N,$,pe,De,Ge,gt){Ge||(Ge=4*pe.width,pe.colorType===v.ColorType.RGBA_F16?Ge*=2:pe.colorType===v.ColorType.RGBA_F32&&(Ge*=4));var Kt=Ge*pe.height,qt=De?De.byteOffset:v._malloc(Kt);if(gt?!D._readPixels(pe,qt,Ge,N,$,gt):!D._readPixels(pe,qt,Ge,N,$))return De||v._free(qt),null;if(De)return De.toTypedArray();switch(pe.colorType){case v.ColorType.RGBA_8888:case v.ColorType.RGBA_F16:D=new Uint8Array(v.HEAPU8.buffer,qt,Kt).slice();break;case v.ColorType.RGBA_F32:D=new Float32Array(v.HEAPU8.buffer,qt,Kt).slice();break;default:return null}return v._free(qt),D}hc=v.Malloc(Float32Array,4),pn=hc.byteOffset,Zr=v.Malloc(Float32Array,16),Ra=Zr.byteOffset,$i=v.Malloc(Float32Array,9),Ht=$i.byteOffset,b2=v.Malloc(Float32Array,12),u0=b2.byteOffset,w2=v.Malloc(Float32Array,12),_2=w2.byteOffset,Vs=v.Malloc(Float32Array,4),kr=Vs.byteOffset,v2=v.Malloc(Float32Array,4),Jo=v2.byteOffset,y2=v.Malloc(Float32Array,3),c0=y2.byteOffset,x2=v.Malloc(Float32Array,3),d0=x2.byteOffset,_f=v.Malloc(Int32Array,4),cu=_f.byteOffset,v.ColorSpace.SRGB=v.ColorSpace._MakeSRGB(),v.ColorSpace.DISPLAY_P3=v.ColorSpace._MakeDisplayP3(),v.ColorSpace.ADOBE_RGB=v.ColorSpace._MakeAdobeRGB(),v.GlyphRunFlags={IsWhiteSpace:v._GlyphRunFlags_isWhiteSpace},v.Path.MakeFromCmds=function(D){var N=K(D,"HEAPF32"),$=v.Path._MakeFromCmds(N,D.length);return H(N,D),$},v.Path.MakeFromVerbsPointsWeights=function(D,N,$){var pe=K(D,"HEAPU8"),De=K(N,"HEAPF32"),Ge=K($,"HEAPF32"),gt=v.Path._MakeFromVerbsPointsWeights(pe,D.length,De,N.length,Ge,$&&$.length||0);return H(pe,D),H(De,N),H(Ge,$),gt},v.Path.prototype.addArc=function(D,N,$){return D=xe(D),this._addArc(D,N,$),this},v.Path.prototype.addCircle=function(D,N,$,pe){return this._addCircle(D,N,$,!!pe),this},v.Path.prototype.addOval=function(D,N,$){return $===void 0&&($=1),D=xe(D),this._addOval(D,!!N,$),this},v.Path.prototype.addPath=function(){var D=Array.prototype.slice.call(arguments),N=D[0],$=!1;if(typeof D[D.length-1]=="boolean"&&($=D.pop()),D.length===1)this._addPath(N,1,0,0,0,1,0,0,0,1,$);else if(D.length===2)D=D[1],this._addPath(N,D[0],D[1],D[2],D[3],D[4],D[5],D[6]||0,D[7]||0,D[8]||1,$);else if(D.length===7||D.length===10)this._addPath(N,D[1],D[2],D[3],D[4],D[5],D[6],D[7]||0,D[8]||0,D[9]||1,$);else return null;return this},v.Path.prototype.addPoly=function(D,N){var $=K(D,"HEAPF32");return this._addPoly($,D.length/2,N),H($,D),this},v.Path.prototype.addRect=function(D,N){return D=xe(D),this._addRect(D,!!N),this},v.Path.prototype.addRRect=function(D,N){return D=xt(D),this._addRRect(D,!!N),this},v.Path.prototype.addVerbsPointsWeights=function(D,N,$){var pe=K(D,"HEAPU8"),De=K(N,"HEAPF32"),Ge=K($,"HEAPF32");this._addVerbsPointsWeights(pe,D.length,De,N.length,Ge,$&&$.length||0),H(pe,D),H(De,N),H(Ge,$)},v.Path.prototype.arc=function(D,N,$,pe,De,Ge){return D=v.LTRBRect(D-$,N-$,D+$,N+$),De=(De-pe)/Math.PI*180-360*!!Ge,Ge=new v.Path,Ge.addArc(D,pe/Math.PI*180,De),this.addPath(Ge,!0),Ge.delete(),this},v.Path.prototype.arcToOval=function(D,N,$,pe){return D=xe(D),this._arcToOval(D,N,$,pe),this},v.Path.prototype.arcToRotated=function(D,N,$,pe,De,Ge,gt){return this._arcToRotated(D,N,$,!!pe,!!De,Ge,gt),this},v.Path.prototype.arcToTangent=function(D,N,$,pe,De){return this._arcToTangent(D,N,$,pe,De),this},v.Path.prototype.close=function(){return this._close(),this},v.Path.prototype.conicTo=function(D,N,$,pe,De){return this._conicTo(D,N,$,pe,De),this},v.Path.prototype.computeTightBounds=function(D){this._computeTightBounds(kr);var N=Vs.toTypedArray();return D?(D.set(N),D):N.slice()},v.Path.prototype.cubicTo=function(D,N,$,pe,De,Ge){return this._cubicTo(D,N,$,pe,De,Ge),this},v.Path.prototype.dash=function(D,N,$){return this._dash(D,N,$)?this:null},v.Path.prototype.getBounds=function(D){this._getBounds(kr);var N=Vs.toTypedArray();return D?(D.set(N),D):N.slice()},v.Path.prototype.lineTo=function(D,N){return this._lineTo(D,N),this},v.Path.prototype.moveTo=function(D,N){return this._moveTo(D,N),this},v.Path.prototype.offset=function(D,N){return this._transform(1,0,D,0,1,N,0,0,1),this},v.Path.prototype.quadTo=function(D,N,$,pe){return this._quadTo(D,N,$,pe),this},v.Path.prototype.rArcTo=function(D,N,$,pe,De,Ge,gt){return this._rArcTo(D,N,$,pe,De,Ge,gt),this},v.Path.prototype.rConicTo=function(D,N,$,pe,De){return this._rConicTo(D,N,$,pe,De),this},v.Path.prototype.rCubicTo=function(D,N,$,pe,De,Ge){return this._rCubicTo(D,N,$,pe,De,Ge),this},v.Path.prototype.rLineTo=function(D,N){return this._rLineTo(D,N),this},v.Path.prototype.rMoveTo=function(D,N){return this._rMoveTo(D,N),this},v.Path.prototype.rQuadTo=function(D,N,$,pe){return this._rQuadTo(D,N,$,pe),this},v.Path.prototype.stroke=function(D){return D=D||{},D.width=D.width||1,D.miter_limit=D.miter_limit||4,D.cap=D.cap||v.StrokeCap.Butt,D.join=D.join||v.StrokeJoin.Miter,D.precision=D.precision||1,this._stroke(D)?this:null},v.Path.prototype.transform=function(){if(arguments.length===1){var D=arguments[0];this._transform(D[0],D[1],D[2],D[3],D[4],D[5],D[6]||0,D[7]||0,D[8]||1)}else if(arguments.length===6||arguments.length===9)D=arguments,this._transform(D[0],D[1],D[2],D[3],D[4],D[5],D[6]||0,D[7]||0,D[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;return this},v.Path.prototype.trim=function(D,N,$){return this._trim(D,N,!!$)?this:null},v.Image.prototype.encodeToBytes=function(D,N){var $=v.je();return D=D||v.ImageFormat.PNG,N=N||100,$?this._encodeToBytes(D,N,$):this._encodeToBytes(D,N)},v.Image.prototype.makeShaderCubic=function(D,N,$,pe,De){return De=le(De),this._makeShaderCubic(D,N,$,pe,De)},v.Image.prototype.makeShaderOptions=function(D,N,$,pe,De){return De=le(De),this._makeShaderOptions(D,N,$,pe,De)},v.Image.prototype.readPixels=function(D,N,$,pe,De){var Ge=v.je();return k(this,D,N,$,pe,De,Ge)},v.Canvas.prototype.clear=function(D){v.Fd(this.Ed),D=Ne(D),this._clear(D)},v.Canvas.prototype.clipRRect=function(D,N,$){v.Fd(this.Ed),D=xt(D),this._clipRRect(D,N,$)},v.Canvas.prototype.clipRect=function(D,N,$){v.Fd(this.Ed),D=xe(D),this._clipRect(D,N,$)},v.Canvas.prototype.concat=function(D){v.Fd(this.Ed),D=Re(D),this._concat(D)},v.Canvas.prototype.drawArc=function(D,N,$,pe,De){v.Fd(this.Ed),D=xe(D),this._drawArc(D,N,$,pe,De)},v.Canvas.prototype.drawAtlas=function(D,N,$,pe,De,Ge,gt){if(D&&pe&&N&&$&&N.length===$.length){v.Fd(this.Ed),De||(De=v.BlendMode.SrcOver);var Kt=K(N,"HEAPF32"),qt=K($,"HEAPF32"),er=$.length/4,pr=K(C(Ge),"HEAPU32");if(gt&&"B"in gt&&"C"in gt)this._drawAtlasCubic(D,qt,Kt,pr,er,De,gt.B,gt.C,pe);else{let ne=v.FilterMode.Linear,qe=v.MipmapMode.None;gt&&(ne=gt.filter,"mipmap"in gt&&(qe=gt.mipmap)),this._drawAtlasOptions(D,qt,Kt,pr,er,De,ne,qe,pe)}H(Kt,N),H(qt,$),H(pr,Ge)}},v.Canvas.prototype.drawCircle=function(D,N,$,pe){v.Fd(this.Ed),this._drawCircle(D,N,$,pe)},v.Canvas.prototype.drawColor=function(D,N){v.Fd(this.Ed),D=Ne(D),N!==void 0?this._drawColor(D,N):this._drawColor(D)},v.Canvas.prototype.drawColorInt=function(D,N){v.Fd(this.Ed),this._drawColorInt(D,N||v.BlendMode.SrcOver)},v.Canvas.prototype.drawColorComponents=function(D,N,$,pe,De){v.Fd(this.Ed),D=$e(D,N,$,pe),De!==void 0?this._drawColor(D,De):this._drawColor(D)},v.Canvas.prototype.drawDRRect=function(D,N,$){v.Fd(this.Ed),D=xt(D,u0),N=xt(N,_2),this._drawDRRect(D,N,$)},v.Canvas.prototype.drawImage=function(D,N,$,pe){v.Fd(this.Ed),this._drawImage(D,N,$,pe||null)},v.Canvas.prototype.drawImageCubic=function(D,N,$,pe,De,Ge){v.Fd(this.Ed),this._drawImageCubic(D,N,$,pe,De,Ge||null)},v.Canvas.prototype.drawImageOptions=function(D,N,$,pe,De,Ge){v.Fd(this.Ed),this._drawImageOptions(D,N,$,pe,De,Ge||null)},v.Canvas.prototype.drawImageNine=function(D,N,$,pe,De){v.Fd(this.Ed),N=K(N,"HEAP32",cu),$=xe($),this._drawImageNine(D,N,$,pe,De||null)},v.Canvas.prototype.drawImageRect=function(D,N,$,pe,De){v.Fd(this.Ed),xe(N,kr),xe($,Jo),this._drawImageRect(D,kr,Jo,pe,!!De)},v.Canvas.prototype.drawImageRectCubic=function(D,N,$,pe,De,Ge){v.Fd(this.Ed),xe(N,kr),xe($,Jo),this._drawImageRectCubic(D,kr,Jo,pe,De,Ge||null)},v.Canvas.prototype.drawImageRectOptions=function(D,N,$,pe,De,Ge){v.Fd(this.Ed),xe(N,kr),xe($,Jo),this._drawImageRectOptions(D,kr,Jo,pe,De,Ge||null)},v.Canvas.prototype.drawLine=function(D,N,$,pe,De){v.Fd(this.Ed),this._drawLine(D,N,$,pe,De)},v.Canvas.prototype.drawOval=function(D,N){v.Fd(this.Ed),D=xe(D),this._drawOval(D,N)},v.Canvas.prototype.drawPaint=function(D){v.Fd(this.Ed),this._drawPaint(D)},v.Canvas.prototype.drawParagraph=function(D,N,$){v.Fd(this.Ed),this._drawParagraph(D,N,$)},v.Canvas.prototype.drawPatch=function(D,N,$,pe,De){if(24>D.length)throw"Need 12 cubic points";if(N&&4>N.length)throw"Need 4 colors";if($&&8>$.length)throw"Need 4 shader coordinates";v.Fd(this.Ed);let Ge=K(D,"HEAPF32"),gt=N?K(C(N),"HEAPU32"):ui,Kt=$?K($,"HEAPF32"):ui;pe||(pe=v.BlendMode.Modulate),this._drawPatch(Ge,gt,Kt,pe,De),H(Kt,$),H(gt,N),H(Ge,D)},v.Canvas.prototype.drawPath=function(D,N){v.Fd(this.Ed),this._drawPath(D,N)},v.Canvas.prototype.drawPicture=function(D){v.Fd(this.Ed),this._drawPicture(D)},v.Canvas.prototype.drawPoints=function(D,N,$){v.Fd(this.Ed);var pe=K(N,"HEAPF32");this._drawPoints(D,pe,N.length/2,$),H(pe,N)},v.Canvas.prototype.drawRRect=function(D,N){v.Fd(this.Ed),D=xt(D),this._drawRRect(D,N)},v.Canvas.prototype.drawRect=function(D,N){v.Fd(this.Ed),D=xe(D),this._drawRect(D,N)},v.Canvas.prototype.drawRect4f=function(D,N,$,pe,De){v.Fd(this.Ed),this._drawRect4f(D,N,$,pe,De)},v.Canvas.prototype.drawShadow=function(D,N,$,pe,De,Ge,gt){v.Fd(this.Ed);var Kt=K(De,"HEAPF32"),qt=K(Ge,"HEAPF32");N=K(N,"HEAPF32",c0),$=K($,"HEAPF32",d0),this._drawShadow(D,N,$,pe,Kt,qt,gt),H(Kt,De),H(qt,Ge)},v.getShadowLocalBounds=function(D,N,$,pe,De,Ge,gt){return D=le(D),$=K($,"HEAPF32",c0),pe=K(pe,"HEAPF32",d0),this._getShadowLocalBounds(D,N,$,pe,De,Ge,kr)?(N=Vs.toTypedArray(),gt?(gt.set(N),gt):N.slice()):null},v.Canvas.prototype.drawTextBlob=function(D,N,$,pe){v.Fd(this.Ed),this._drawTextBlob(D,N,$,pe)},v.Canvas.prototype.drawVertices=function(D,N,$){v.Fd(this.Ed),this._drawVertices(D,N,$)},v.Canvas.prototype.getDeviceClipBounds=function(D){this._getDeviceClipBounds(cu);var N=_f.toTypedArray();return D?D.set(N):D=N.slice(),D},v.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(Ra);for(var D=Ra,N=Array(16),$=0;16>$;$++)N[$]=v.HEAPF32[D/4+$];return N},v.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(Ht);for(var D=Array(9),