route-graphics 1.44.3 → 1.44.4

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.
@@ -1625,7 +1625,7 @@ A™§²Âœp˜[ô’s‹šFû .oCtï@ݘÚý‰# £=MÖ#ƒ‡wìîxýß½G
1625
1625
  ã/¸Äyf"Ÿ5TàyÊ0îEê²Þ—€m6ëÞè6ðÏâ§9ž¬„k=}¼àt<ž‚¦Mdžç6"p_î3, oO3p"pw÷´/(1ñøs.íA/&ÏUÃ_X™ÍpÕ1hÌ80E’Qö„
1626
1626
  ow÷!x.™AÜ"¢j+惡¦¶®ä“R–ow÷!xꔊpn…â#ðù
1627
1627
  z AÍp\Ž0N˜HJê´ªØ^U
1628
- I€wu¸öôú!3å6³‹âVq£³¹´RN£%y10º:pŠ#\:J:b9Hµ7h_Ž:¢I9 _¼™µV,þ <`});var G={a:U};this.setModule=V=>{t.setModule(Ls,V)},this.getModule=()=>t.getModule(Ls),this.instantiate=()=>(this.getModule().then(V=>WebAssembly.instantiate(V,G)).then(V=>{let q=V.exports;W(q),m=q.g,p(),D(q),r()}),this.ready=new Promise(V=>{r=V}).then(()=>{this.HEAP=m.buffer,this.malloc=O,this.free=ie,this.opus_frame_decoder_create=j,this.opus_frame_decode_float_deinterleaved=N,this.opus_frame_decoder_destroy=z}),this)}function Kn(t={}){Kn.errors||Object.defineProperties(Kn,{errors:{value:new Map([[-1,"OPUS_BAD_ARG: One or more invalid/out of range arguments"],[-2,"OPUS_BUFFER_TOO_SMALL: Not enough bytes allocated in the buffer"],[-3,"OPUS_INTERNAL_ERROR: An internal error was detected"],[-4,"OPUS_INVALID_PACKET: The compressed data passed is corrupted"],[-5,"OPUS_UNIMPLEMENTED: Invalid/unsupported request number"],[-6,"OPUS_INVALID_STATE: An encoder or decoder structure is invalid or already freed"],[-7,"OPUS_ALLOC_FAIL: Memory allocation has failed"]])}}),this._init=()=>new this._WASMAudioDecoderCommon(this).instantiate(this._EmscriptenWASM,this._module).then(u=>{this._common=u,this._inputBytes=0,this._outputSamples=0,this._frameNumber=0,this._input=this._common.allocateTypedArray(this._inputSize,Uint8Array),this._output=this._common.allocateTypedArray(this._outputChannels*this._outputChannelSize,Float32Array);let d=this._common.allocateTypedArray(this._channels,Uint8Array);d.buf.set(this._channelMappingTable),this._decoder=this._common.wasm.opus_frame_decoder_create(this._sampleRate,this._channels,this._streamCount,this._coupledStreamCount,d.ptr,this._preSkip,this._forceStereo)}),Object.defineProperty(this,"ready",{enumerable:!0,get:()=>this._ready}),this.reset=()=>(this.free(),this._init()),this.free=()=>{this._common.free(),this._common.wasm.opus_frame_decoder_destroy(this._decoder),this._common.wasm.free(this._decoder)},this._decode=u=>{if(!(u instanceof Uint8Array))throw Error("Data to decode must be Uint8Array. Instead got "+typeof u);this._input.buf.set(u);let d=this._common.wasm.opus_frame_decode_float_deinterleaved(this._decoder,this._input.ptr,u.length,this._output.ptr),f;return d<0&&(f="libopus "+d+" "+(Kn.errors.get(d)||"Unknown Error"),console.error(f),d=0),{outputBuffer:this._common.getOutputChannels(this._output.buf,this._outputChannels,d),samplesDecoded:d,error:f}},this.decodeFrame=u=>{let d=[],f=this._decode(u);return f.error&&this._common.addError(d,f.error,u.length,this._frameNumber,this._inputBytes,this._outputSamples),this._frameNumber++,this._inputBytes+=u.length,this._outputSamples+=f.samplesDecoded,this._WASMAudioDecoderCommon.getDecodedAudioMultiChannel(d,[f.outputBuffer],this._outputChannels,f.samplesDecoded,this._sampleRate)},this.decodeFrames=u=>{let d=[],f=[],h=0,m=0;for(;m<u.length;){let p=u[m++],g=this._decode(p);d.push(g.outputBuffer),h+=g.samplesDecoded,g.error&&this._common.addError(f,g.error,p.length,this._frameNumber,this._inputBytes,this._outputSamples),this._frameNumber++,this._inputBytes+=p.length,this._outputSamples+=g.samplesDecoded}return this._WASMAudioDecoderCommon.getDecodedAudioMultiChannel(f,d,this._outputChannels,h,this._sampleRate)},this._isWebWorker=Kn.isWebWorker,this._WASMAudioDecoderCommon=Kn.WASMAudioDecoderCommon||wt,this._EmscriptenWASM=Kn.EmscriptenWASM||Ls,this._module=Kn.module;let e=8,r=u=>typeof u=="number",n=t.sampleRate,i=t.channels,o=t.streamCount,s=t.coupledStreamCount,a=t.channelMappingTable,c=t.preSkip,l=t.forceStereo?1:0;if(i>2&&(!r(o)||!r(s)||!Array.isArray(a)))throw new Error("Invalid Opus Decoder Options for multichannel decoding.");return this._sampleRate=[8e3,12e3,16e3,24e3,48e3].includes(n)?n:48e3,this._channels=r(i)?i:2,this._streamCount=r(o)?o:1,this._coupledStreamCount=r(s)?s:this._channels-1,this._channelMappingTable=a||(this._channels===2?[0,1]:[0]),this._preSkip=c||0,this._forceStereo=i<=e&&i!=2?l:0,this._inputSize=32e3*.12*this._channels,this._outputChannelSize=120*48,this._outputChannels=this._forceStereo?2:this._channels,this._ready=this._init(),this}var xl=class extends Pa{constructor(e){super(e,"opus-decoder",Kn,Ls)}async decodeFrame(e){return this.postToDecoder("decodeFrame",e)}async decodeFrames(e){return this.postToDecoder("decodeFrames",e)}};Go(Kn,"OpusDecoder");Go(xl,"OpusDecoderWebWorker");var Z8=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Us=class{constructor(e={}){this._sampleRate=e.sampleRate||48e3,this._speechQualityEnhancement=e.speechQualityEnhancement,this._forceStereo=e.forceStereo!==void 0?e.forceStereo:!1,this._onCodec=r=>{if(r!=="opus")throw new Error("ogg-opus-decoder does not support this codec "+r)},new wt,this._useMLDecoder=["lace","nolace"].includes(this._speechQualityEnhancement),this._decoderLibraryLoaded=this._loadDecoderLibrary(),this._ready=this._init()}_initDecoderClass(){this._decoderClass=this._useMLDecoder?this.OpusMLDecoder:this.OpusDecoder}async _loadDecoderLibrary(){if(this._useMLDecoder)if(await Z8()){let{OpusMLDecoder:r,OpusMLDecoderWebWorker:n}=await Promise.resolve().then(()=>(a3(),s3));this.OpusMLDecoder=r,this.OpusMLDecoderWebWorker=n}else console.warn(`ogg-opus-decoder: This platform does not support WebAssembly SIMD; { speechQualityEnhancements: '${this._speechQualityEnhancement}' } has been disabled`),this._useMLDecoder=!1;this.OpusDecoder=Kn,this.OpusDecoderWebWorker=xl,this._initDecoderClass()}async _init(){this._decoder&&await this._decoder.free(),this._decoder=null,this._decoderReady=null,this._codecParser=new j0("application/ogg",{onCodec:this._onCodec,enableFrameCRC32:!1})}async _instantiateDecoder(e){return this._totalSamplesDecoded=0,this._preSkip=e[r3],this._channels=this._forceStereo?2:e[HE],await this._decoderLibraryLoaded,this._decoder=new this._decoderClass({channels:e[HE],streamCount:e[o3],coupledStreamCount:e[t3],channelMappingTable:e[i3],preSkip:Math.round(this._preSkip/48e3*this._sampleRate),sampleRate:this._sampleRate,speechQualityEnhancement:this._speechQualityEnhancement,forceStereo:this._forceStereo}),this._decoder.ready}get ready(){return this._ready}async reset(){this._ready=this._init(),await this._ready}free(){this._decoder&&this._decoder.free()}async _decode(e){let r=[],n=[],i=[],o=0,s=async()=>{if(r.length){await this._decoderReady;let{channelData:a,samplesDecoded:c,errors:l}=await this._decoder.decodeFrames(r);i.push(a),n.push(...l),o+=c,this._totalSamplesDecoded+=c,r=[]}};for(let a=0;a<e.length;a++){let c=e[a],l=c[gl].map(u=>u[Bd]);if(l.length&&(r.push(...l),this._decoderReady||(this._decoderReady=this._instantiateDecoder(c[gl][0][q0]))),c[K0]){if(await s(),c[e3]!==void 0&&i.length){let u=this._totalSamplesDecoded/this._sampleRate*48e3,d=Math.round((u-c[Q0])/48e3*this._sampleRate),f=i[i.length-1];if(d>0)for(let h=0;h<f.length;h++)f[h]=f[h].subarray(0,f[h].length-d);o-=d,this._totalSamplesDecoded-=d}await this.reset()}}return await s(),[n,i,this._channels,o,this._sampleRate,16]}async decode(e){let r=await this._decode([...this._codecParser.parseChunk(e)]);return wt.getDecodedAudioMultiChannel(...r)}async decodeFile(e){let r=await this._decode([...this._codecParser.parseAll(e)]);return await this.reset(),wt.getDecodedAudioMultiChannel(...r)}async flush(){let e=await this._decode([...this._codecParser.flush()]);return await this.reset(),wt.getDecodedAudioMultiChannel(...e)}};var Im=class extends Us{constructor(e){super(e)}_initDecoderClass(){this._decoderClass=this._useMLDecoder?this.OpusMLDecoderWebWorker:this.OpusDecoderWebWorker}async free(){this._decoder&&await this._decoder.free()}};Go(Us,"OggOpusDecoder");Go(Im,"OggOpusDecoderWebWorker");var e6=new Set(["audio/ogg","application/ogg"]),_l={opus:{decoderPromise:null,queue:Promise.resolve()},vorbis:{decoderPromise:null,queue:Promise.resolve()}},WE=new Map,l3=t=>t instanceof Uint8Array?t:new Uint8Array(t??new ArrayBuffer(0)),c3=(t,e)=>{let r=Array.from(e,i=>i.charCodeAt(0)),n=t.length-r.length;for(let i=0;i<=n;i+=1){let o=!0;for(let s=0;s<r.length;s+=1)if(t[i+s]!==r[s]){o=!1;break}if(o)return!0}return!1},km=t=>{if(WE.has(t))return WE.get(t);let e=!1;try{let r=globalThis.document?.createElement?.("audio");e=typeof r?.canPlayType=="function"&&r.canPlayType(t)!==""}catch{e=!1}return WE.set(t,e),e},t6=t=>typeof t!="string"?"":t.split(";")[0].trim().toLowerCase(),XE=t=>e6.has(t6(t)),u3=t=>{let e=l3(t);return c3(e,"OpusHead")?"opus":c3(e,"vorbis")?"vorbis":"unknown"},r6=t=>t==="opus"?km('audio/ogg; codecs="opus"')||km("audio/ogg"):t==="vorbis"&&km('audio/ogg; codecs="vorbis"')||km("audio/ogg"),n6=({audioContext:t,channelData:e,sampleRate:r,samplesDecoded:n})=>{let i=e.length;if(i===0)throw new Error("Ogg decoder returned no audio channels.");let o=Math.max(0,n??Math.max(...e.map(a=>a.length)));if(o===0)throw new Error("Ogg decoder returned an empty audio buffer.");let s=t.createBuffer(i,o,r);for(let a=0;a<i;a+=1){let c=e[a];s.getChannelData(a).set(c.subarray(0,o))}return s},i6=async()=>(_l.opus.decoderPromise||(_l.opus.decoderPromise=(async()=>{let t=new Us;return await t.ready,t})()),_l.opus.decoderPromise),o6=async()=>(_l.vorbis.decoderPromise||(_l.vorbis.decoderPromise=(async()=>{let t=new Os;return await t.ready,t})()),_l.vorbis.decoderPromise),d3=t=>{if(t==="opus")return i6();if(t==="vorbis")return o6();throw new Error(`Unsupported Ogg codec "${t}".`)},s6=async({codec:t,bytes:e})=>{let r=_l[t];if(!r)throw new Error(`Unsupported Ogg codec "${t}".`);let n=async()=>{let o=await d3(t);try{return await o.decodeFile(e)}finally{await o.reset?.()}},i=r.queue.then(n,n);return r.queue=i.catch(()=>{}),i},h3=async(t={})=>{let e=new Set;for(let r of Object.values(t)){if(!XE(r?.type)||!r?.buffer)continue;let n=u3(r.buffer);n==="unknown"||r6(n)||e.add(n)}await Promise.all([...e].map(r=>d3(r)))},f3=async({arrayBuffer:t,audioContext:e})=>{let r=u3(t),n=l3(t),i=await s6({codec:r,bytes:n});return n6({audioContext:e,channelData:i.channelData??[],sampleRate:i.sampleRate,samplesDecoded:i.samplesDecoded})};var Rm,YE,a6=()=>globalThis.window?.RTGL_AUDIO_DEBUG===!0||globalThis.window?.RTGL_VT_DEBUG===!0,c6=(t,e={})=>{a6()&&console.log(`[AudioContext] ${t}`,e)},l6=()=>{if(Rm)return Rm;let t=globalThis.window?.AudioContext??globalThis.window?.webkitAudioContext;if(!t)throw new Error("AudioContext is not available in this environment.");return Rm=new t,c6("context created",{state:Rm.state}),Rm},u6={get context(){return l6()},nowMs:()=>Date.now(),setTimeout:(t,e)=>globalThis.setTimeout(t,e),clearTimeout:t=>globalThis.clearTimeout(t),setInterval:(t,e)=>globalThis.setInterval(t,e),clearInterval:t=>globalThis.clearInterval(t),queueMicrotask:t=>globalThis.queueMicrotask(t)},d6=t=>{if(!t||typeof t!="object")throw new Error("Audio runtime must be an object.");if(!t.context)throw new Error("Audio runtime must provide a context.");for(let e of["nowMs","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask"])if(typeof t[e]!="function")throw new Error(`Audio runtime must provide ${e}().`)},h6=t=>{d6(t),YE=t},f6=()=>{YE=void 0},Ya=()=>YE??u6,Ie=()=>Ya().context;var Fd=Object.create(null),$s=Object.create(null),p6=async t=>{await h3(t)},m6=t=>t?typeof t=="string"?t:t.message||String(t):"Unknown error",p3=(t,e)=>{let r="Unsupported or damaged audio file.",n=`Could not load audio "${t}". ${r}`,i=new Error(n,{cause:e});return i.userMessage=n,i.rootCauseMessage=r,i.details={assetKey:t,assetKind:"audio",phase:"decode",cause:m6(e)},i},g6=async({key:t,arrayBuffer:e,type:r,audioContext:n})=>{try{return await n.decodeAudioData(e.slice(0))}catch(i){if(!XE(r))throw p3(t,i);try{return await f3({arrayBuffer:e,audioContext:n})}catch(o){throw p3(t,o)}}},y6=(t,e,r)=>{if(Fd[t])return Fd[t];if($s[t])return $s[t];if(!e||e.byteLength===0)return;let n=Ie(),i=g6({key:t,arrayBuffer:e,type:r,audioContext:n}).then(o=>($s[t]===i&&(Fd[t]=o),o)).finally(()=>{$s[t]===i&&delete $s[t]});return $s[t]=i,i},x6=t=>Fd[t],_6=t=>$s[t],b6=t=>{let e=!!Fd[t]||!!$s[t];return delete Fd[t],delete $s[t],e},uo={prepareDecoders:p6,load:y6,getAsset:x6,getAssetPromise:_6,unload:b6};var m3=(t,e)=>{let r=t*e/1e3,n=Math.round(r),i=Number.EPSILON*Math.max(1,Math.abs(r))*8;return Math.abs(r-n)<=i?n:Math.ceil(r)},Z0=(t,e)=>{let r=Number(t);if(!Number.isFinite(r)||r<0)throw new Error(`${e} must be a finite non-negative number.`);return r},e_=(t,e)=>{let r=Number(t);if(!Number.isInteger(r)||r<=0)throw new Error(`${e} must be a positive integer.`);return r},jE=async()=>{for(let t=0;t<8;t++)await Promise.resolve()},w6=()=>new Promise(t=>globalThis.setTimeout(t,0)),S6=({durationMs:t,sampleRate:e=48e3,numberOfChannels:r=2,renderQuantumSize:n=128,maxCallbacks:i=1e5,OfflineAudioContextCtor:o=globalThis.OfflineAudioContext}={})=>{let s=Z0(t,"durationMs");if(s===0)throw new Error("durationMs must be greater than zero.");let a=e_(e,"sampleRate"),c=e_(r,"numberOfChannels"),l=e_(n,"renderQuantumSize"),u=e_(i,"maxCallbacks");if(typeof o!="function")throw new Error("OfflineAudioContext is not available in this environment.");let d=m3(s,a),f=new o({numberOfChannels:c,length:d,sampleRate:a}),h=new Set,m=D=>{let G=!1,V=!1,q=!1,Z=()=>{G&&!V&&(!D.loop||q)?h.add(D):h.delete(D)};return D.addEventListener("ended",()=>{V=!0,h.delete(D)},{once:!0}),new Proxy(D,{get(re,de){if(de==="start")return(...Fe)=>{let ce=re.start(...Fe);return G=!0,Z(),ce};if(de==="stop")return(...Fe)=>{let ce=re.stop(...Fe);return q=!0,Z(),ce};let _e=Reflect.get(re,de,re);return typeof _e=="function"?_e.bind(re):_e},set(re,de,_e){let Fe=Reflect.set(re,de,_e,re);return de==="loop"&&Z(),Fe}})},p=new Proxy(f,{get(D,G){if(G==="state")return"running";if(G==="createBufferSource")return()=>m(D.createBufferSource());let V=Reflect.get(D,G,D);return typeof V=="function"?V.bind(D):V}}),g=new Map,x=1,b=1,w=0,S,_=!1,T=!1,v=()=>f.currentTime*1e3,C=D=>{let G=m3(D,a);return Math.ceil(G/l)*l/a*1e3},M=({callback:D,dueTimeMs:G,intervalMs:V=null})=>{if(T)throw new Error("Deterministic audio runtime has been destroyed.");if(typeof D!="function")throw new Error("Scheduled audio callback must be a function.");let q=x++;return g.set(q,{id:q,callback:D,dueTimeMs:Math.max(v(),G),intervalMs:V,order:b++}),q},F=(D,G=0)=>M({callback:D,dueTimeMs:v()+Z0(G,"delayMs")}),R=D=>{g.delete(D)},U=(D,G=0)=>{let V=Z0(G,"intervalMs");if(V===0)throw new Error("intervalMs must be greater than zero.");return M({callback:D,dueTimeMs:v()+V,intervalMs:V})},W=R,j=(D,G)=>M({callback:G,dueTimeMs:Z0(D,"timeMs")}),O=D=>[...g.values()].filter(G=>C(G.dueTimeMs)<=D+1e-7).sort((G,V)=>G.dueTimeMs-V.dueTimeMs||G.order-V.order),N=async D=>{for(;;){if(S)throw S;let G=O(D);if(G.length===0)return;for(let V of G){if(g.get(V.id)!==V)continue;if(w+=1,w>u)throw new Error(`Deterministic audio runtime exceeded ${u} callbacks.`);V.intervalMs===null?g.delete(V.id):V.dueTimeMs+=V.intervalMs;let q=V.callback();if(q!==null&&(typeof q=="object"||typeof q=="function")&&typeof q.then=="function"&&Promise.resolve(q).catch(Z=>{S??=Z}),await jE(),S)throw S}}},z=()=>{let D=Number.POSITIVE_INFINITY;for(let G of g.values())D=Math.min(D,C(G.dueTimeMs));if(h.size>0){let G=Math.round(f.currentTime*a),V=(Math.floor(G/l)+1)*l;D=Math.min(D,V/a*1e3)}return D};return{context:p,offlineContext:f,durationMs:s,sampleRate:a,numberOfChannels:c,nowMs:v,setTimeout:F,clearTimeout:R,setInterval:U,clearInterval:W,queueMicrotask:D=>globalThis.queueMicrotask(D),scheduleAt:j,render:async()=>{if(T)throw new Error("Deterministic audio runtime has been destroyed.");if(_)throw new Error("Deterministic audio runtime can only render once.");_=!0;let D,G=new Set,V=()=>{if(D||S)return;let Z=z();if(!Number.isFinite(Z)||Z>=s-1e-7)return;let re=f.suspend(Z/1e3).then(async()=>{try{await w6(),await jE(),await N(v()),V()}catch(de){D=de}finally{try{await f.resume()}catch(de){D??=de}}}).catch(de=>{D??=de}).finally(()=>{G.delete(re)});G.add(re)};await jE(),await N(0),V();let q=await f.startRendering();if(await Promise.allSettled(G),D||S)throw D??S;return q},destroy:()=>{T=!0,g.clear(),h.clear()},getPendingTaskCount:()=>g.size}};var vr=({type:t,add:e,update:r,delete:n,parse:i,shouldUpdateUnchanged:o})=>({type:t,add:e,update:r,delete:n,parse:i,shouldUpdateUnchanged:o});var qE=({type:t})=>({type:t});var KE=({type:t,add:e,update:r,delete:n})=>({type:t,add:e,update:r,delete:n});var v6={alpha:"alpha",x:"x",y:"y",translateX:"translateX",translateY:"translateY",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY",width:"width",height:"height",uProgress:"uProgress"},T6=/^rect\.(?:width|height|fill\.(?:color|(?:start|end|innerCenter|outerCenter)\.(?:x|y)|(?:innerRadius|outerRadius|scale|rotation)|stops\.\d+\.(?:offset|color))|border\.(?:width|color|alpha)|cornerRadius\.(?:topLeft|topRight|bottomRight|bottomLeft))$/,QE=t=>typeof t=="string"&&T6.test(t),t_=t=>!!v6[t]||QE(t);var _i={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"],width:["width"],height:["height"],uProgress:["uProgress"]};var ja={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Pt={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var g3={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},E6=.4,A6=t=>{if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,t);if(typeof t=="string"){let e=Number.parseFloat(t);if(Number.isFinite(e))return Math.max(0,e)}return Pt.fontSize},M6=t=>typeof t=="number"&&Number.isFinite(t)?t:0,P6=(t={})=>Math.ceil(A6(t.fontSize)*E6),C6=(t={})=>{let e=typeof t.stroke=="object"&&t.stroke!==null?t.stroke:{};return{...e,color:t.strokeColor??e.color??Pt.strokeColor,width:t.strokeWidth??e.width??Pt.strokeWidth}},I6=t=>{if(t===void 0)return;if(t===null||t===!1)return null;let e=typeof t=="object"&&t!==null?{...g3,...t}:g3,r=e.offsetX,n=e.offsetY,i=Math.hypot(r,n);return{alpha:e.alpha,angle:i===0?0:Math.atan2(n,r),blur:e.blur,color:e.color,distance:i}},k6=t=>t?Math.ceil(Math.max(0,t.blur)+t.distance):0,sn=(t={},e={})=>{let r=e.includeShadow!==!1,{strokeColor:n,strokeWidth:i,stroke:o,shadow:s,...a}=t;delete a.dropShadow;let c={...a,stroke:C6({strokeColor:n,strokeWidth:i,stroke:o})};if(Array.isArray(c.fontFamily)&&(c.fontFamily=[...c.fontFamily]),r){let l=I6(s),u=k6(l),d=Math.max(M6(a.padding),u,P6(a));s!==void 0&&(c.dropShadow=l),d>0&&(c.padding=d)}return c};var jo=(t,e)=>{let r={fill:e?.fill??Pt.fill,fontFamily:e?.fontFamily??Pt.fontFamily,fontSize:e?.fontSize??Pt.fontSize,...e?.fontWeight!==void 0?{fontWeight:e.fontWeight}:{},...e?.fontStyle!==void 0?{fontStyle:e.fontStyle}:{},align:e?.align??Pt.align,lineHeight:e?.lineHeight??Pt.lineHeight,wordWrap:e?.wordWrap??Pt.wordWrap,breakWords:e?.breakWords??Pt.breakWords,strokeColor:e?.strokeColor??Pt.strokeColor,strokeWidth:e?.strokeWidth??Pt.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Pt.wordWrapWidth,...e?.padding!==void 0?{padding:e.padding}:{},...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};t.style=sn(r)};var bl=(t=0)=>t*Math.PI/180,Fm=(t=0)=>t*180/Math.PI,w3=new WeakMap,y3=new WeakMap,x3=t=>typeof t=="number"&&Number.isFinite(t)&&t!==0?t:1,Bm=t=>typeof t=="number"&&Number.isFinite(t)?t:1,_3=t=>typeof t=="number"&&Number.isFinite(t)?Math.abs(t):1,R6=(t,e,{scaleMode:r="sign",preserveScaleMagnitude:n=!1}={})=>{if(!t.scale)return;let i=y3.get(t)??{x:!1,y:!1},o=e.scaleX!==void 0||i.x,s=e.scaleY!==void 0||i.y;if(!o&&!s)return;let a=Bm(e.scaleX),c=Bm(e.scaleY),l=r==="full"?a:Math.sign(a),u=r==="full"?c:Math.sign(c),d=_3(t.scale.x),f=_3(t.scale.y);o&&(t.scale.x=n?d*l:l),s&&(t.scale.y=n?f*u:u),y3.set(t,{x:e.scaleX!==void 0,y:e.scaleY!==void 0})},wl=(t,e,{localOriginX:r,localOriginY:n,scaleMode:i="sign",preserveScaleMagnitude:o=!1}={})=>{R6(t,e,{scaleMode:i,preserveScaleMagnitude:o}),Sl(t,e,{localOriginX:r,localOriginY:n})},r_=t=>({x:Math.round((t.x??0)+(t.originX??0)),y:Math.round((t.y??0)+(t.originY??0))}),Dm=t=>{let e=w3.get(t);e&&t.pivot?.set?.(e.x,e.y)},Sl=(t,e,{localOriginX:r,localOriginY:n,baseScaleX:i,baseScaleY:o}={})=>{let s=e.originX??0,a=e.originY??0,c=r??s,l=n??a,u=x3(i??t.scale?.x),d=x3(o??t.scale?.y);w3.set(t,{x:c/u,y:l/d}),Dm(t)},ot=(t,e,{localOriginX:r,localOriginY:n,scaleMode:i="sign",preserveScaleMagnitude:o=!1}={})=>{let s=r_(e);wl(t,e,{localOriginX:r,localOriginY:n,scaleMode:i,preserveScaleMagnitude:o}),t.x=s.x,t.y=s.y,t.rotation=bl(e.rotation??0)},B6=(t,e)=>{let r=e==="x"?"width":"height",n=t.texture?.orig?.[r]??t.texture?.source?.[r];if(Number.isFinite(n)&&n>0)return n;let i=Math.abs(t[r]),o=Math.abs(t.scale?.[e]),s=i/o;return Number.isFinite(s)&&s>0?s:void 0},b3=(t,e,r,n)=>{let i=Bm(r==="x"?e.scaleX:e.scaleY),o=Math.sign(i);if(o===0)return 0;let s=B6(t,r),a=Math.abs(n);if(Number.isFinite(a)&&Number.isFinite(s)&&s>0)return o*a/s;let c=Math.abs(t.scale?.[r]);return o*(Number.isFinite(c)?c:1)},Qn=(t,e,r={})=>{let n=r.width??e.width??t.width,i=r.height??e.height??t.height;return{scaleX:b3(t,e,"x",n),scaleY:b3(t,e,"y",i)}},qe=(t,e={})=>{let r=r_(t),n={x:r.x,y:r.y};return t.scaleX!==void 0&&(n.scaleX=Math.sign(Bm(t.scaleX))),t.scaleY!==void 0&&(n.scaleY=Math.sign(Bm(t.scaleY))),t.rotation!==void 0&&(n.rotation=t.rotation),{...n,...e}};var S3={color:0,alpha:0},F6={x:0,y:0},D6={x:0,y:1},O6={x:.5,y:.5},v3=t=>t==null||t===""||t==="transparent",T3=t=>[...t].sort((e,r)=>e.offset-r.offset),L6=(t,e)=>{if(!t||!e)return t;let r=e.originX??0,n=e.originY??0,i=r_(e),o=bl(e.rotation??0),s=Math.cos(o),a=Math.sin(o),c=t.x-i.x,l=t.y-i.y;return{x:r+c*s+l*a,y:n-c*a+l*s}},n_=(t,e,r,n)=>e.coordinateSpace==="global"?L6(t??n,r):t,qa=t=>{t._rtglFillResource?.destroy(),delete t._rtglFillResource},U6=(t,e)=>v3(t)?S3:typeof t=="string"?t:t.type==="solid"?v3(t.color)?S3:t.color:t.type==="linear-gradient"?new Lr({type:"linear",start:n_(t.start,t,e,F6),end:n_(t.end,t,e,D6),colorStops:T3(t.stops),textureSpace:t.coordinateSpace,textureSize:t.resolution,wrapMode:t.spread==="repeat"?"repeat":"clamp-to-edge"}):t.type==="radial-gradient"?new Lr({type:"radial",center:n_(t.innerCenter,t,e,O6),innerRadius:t.innerRadius,outerCenter:n_(t.outerCenter,t,e),outerRadius:t.outerRadius,colorStops:T3(t.stops),textureSpace:t.coordinateSpace,textureSize:t.resolution,wrapMode:t.spread==="repeat"?"repeat":"clamp-to-edge",scale:t.scale,rotation:t.rotation}):t,i_=(t,e,r)=>{qa(t);let n=U6(e,r);return n instanceof Lr&&(t._rtglFillResource=n),n};var Dd=Object.freeze(["topLeft","topRight","bottomRight","bottomLeft"]),$6=Object.freeze({topLeft:0,topRight:0,bottomRight:0,bottomLeft:0}),G6=new Set(["id","type","width","height","x","y","anchorX","anchorY","originX","originY","alpha","scaleX","scaleY","rotation","fill","border","cornerRadius","blur","filters","hover","click","rightClick","drag","scrollUp","scrollDown"]),N6=new Set(["solid","linear-gradient","radial-gradient"]),V6=new Set(["local","global"]),H6=new Set(["pad","repeat"]),z6=t=>!!t&&typeof t=="object"&&!Array.isArray(t),ho=(t,e)=>{if(!z6(t))throw new Error(`Input Error: ${e} must be an object`)},$i=(t,e,r)=>{for(let n of Object.keys(t))if(!e.has(n))throw new Error(`Input Error: ${r}.${n} is not supported`)},Od=(t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new Error(`Input Error: ${e} must be a finite number`)},ZE=(t,e)=>{t!==void 0&&Od(t,e)},Lm=(t,e,r,n)=>{if(Od(t,e),t<r||t>n)throw new Error(`Input Error: ${e} must be between ${r} and ${n}`)},s_=(t,e)=>{if(Od(t,e),t<0)throw new Error(`Input Error: ${e} must be greater than or equal to 0`)},Om=(t,e)=>{if(Od(t,e),t<=0)throw new Error(`Input Error: ${e} must be greater than 0`)},a_=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input Error: ${e} must be a non-empty color string`);if(typeof Ce=="function")try{new Ce(t)}catch{throw new Error(`Input Error: ${e} is not a valid color`)}},o_=(t,e)=>{if(ho(t,e),$i(t,new Set(["x","y"]),e),t.x===void 0||t.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);Od(t.x,`${e}.x`),Od(t.y,`${e}.y`)},E3=(t,e)=>{if(!Array.isArray(t)||t.length<2)throw new Error(`Input Error: ${e} must be an array with at least two stops`);let r=-1/0;t.forEach((n,i)=>{let o=`${e}[${i}]`;if(ho(n,o),$i(n,new Set(["offset","color"]),o),n.offset===void 0||n.color===void 0)throw new Error(`Input Error: ${o}.offset and ${o}.color are required`);if(Lm(n.offset,`${o}.offset`,0,1),a_(n.color,`${o}.color`),n.offset<=r)throw new Error(`Input Error: ${e} offsets must be strictly increasing`);r=n.offset})},A3=(t,e)=>{if(t.textureSize!==void 0)throw new Error(`Input Error: ${e}.textureSize is no longer supported; use ${e}.resolution`);if(t.wrapMode!==void 0)throw new Error(`Input Error: ${e}.wrapMode is no longer supported; use ${e}.spread with "pad" or "repeat"`);if(t.coordinateSpace!==void 0&&!V6.has(t.coordinateSpace))throw new Error(`Input Error: ${e}.coordinateSpace must be "local" or "global"`);if(t.resolution!==void 0&&Om(t.resolution,`${e}.resolution`),t.spread!==void 0&&!H6.has(t.spread))throw new Error(`Input Error: ${e}.spread must be "pad" or "repeat"`)},c_=(t,e="fill")=>{if(typeof t=="string"){a_(t,e);return}if(ho(t,e),!N6.has(t.type))throw new Error(`Input Error: ${e}.type must be "solid", "linear-gradient", or "radial-gradient"`);if(t.type==="solid"){if($i(t,new Set(["type","color"]),e),t.color===void 0)throw new Error(`Input Error: ${e}.color is required`);a_(t.color,`${e}.color`);return}if(t.type==="linear-gradient"){$i(t,new Set(["type","start","end","stops","coordinateSpace","resolution","spread","textureSize","wrapMode"]),e),t.start!==void 0&&o_(t.start,`${e}.start`),t.end!==void 0&&o_(t.end,`${e}.end`),E3(t.stops,`${e}.stops`),A3(t,e);return}$i(t,new Set(["type","innerCenter","innerRadius","outerCenter","outerRadius","stops","coordinateSpace","resolution","spread","scale","rotation","textureSize","wrapMode"]),e),t.innerCenter!==void 0&&o_(t.innerCenter,`${e}.innerCenter`),t.outerCenter!==void 0&&o_(t.outerCenter,`${e}.outerCenter`),t.innerRadius!==void 0&&s_(t.innerRadius,`${e}.innerRadius`),t.outerRadius!==void 0&&Om(t.outerRadius,`${e}.outerRadius`),t.scale!==void 0&&Om(t.scale,`${e}.scale`),ZE(t.rotation,`${e}.rotation`),E3(t.stops,`${e}.stops`),A3(t,e)},vl=t=>t===void 0?{...$6}:Object.fromEntries(typeof t=="number"?Dd.map(e=>[e,t]):Dd.map(e=>[e,t[e]??0])),W6=(t,e)=>{if(typeof t=="number"){s_(t,e);return}ho(t,e),$i(t,new Set(Dd),e);for(let r of Dd)t[r]!==void 0&&s_(t[r],`${e}.${r}`)},M3=(t,e)=>{t!==void 0&&ho(t,e)},X6=(t,e,{cursor:r=!1}={})=>{if(t.soundSrc!==void 0&&(typeof t.soundSrc!="string"||t.soundSrc.length===0))throw new Error(`Input Error: ${e}.soundSrc must be a non-empty string`);if(t.soundVolume!==void 0&&Lm(t.soundVolume,`${e}.soundVolume`,0,100),r&&t.cursor!==void 0&&(typeof t.cursor!="string"||t.cursor.length===0))throw new Error(`Input Error: ${e}.cursor must be a non-empty string`);M3(t.payload,`${e}.payload`)},JE=(t,e,{cursor:r=!1}={})=>{ho(t,e),$i(t,new Set(["fill","alpha","soundSrc","soundVolume","payload",...r?["cursor"]:[]]),e),t.fill!==void 0&&c_(t.fill,`${e}.fill`),t.alpha!==void 0&&Lm(t.alpha,`${e}.alpha`,0,1),X6(t,e,{cursor:r})},e1=(t,e)=>{ho(t,e),$i(t,new Set(["payload"]),e),M3(t.payload,`${e}.payload`)},Y6=(t,e)=>{if(ho(t,e),$i(t,new Set(["start","move","end"]),e),!t.start&&!t.move&&!t.end)throw new Error(`Input Error: ${e} must define start, move, or end`);for(let r of["start","move","end"])t[r]!==void 0&&e1(t[r],`${e}.${r}`)},j6=(t,e)=>{ho(t,e),$i(t,new Set(["width","color","alpha"]),e),t.width!==void 0&&s_(t.width,`${e}.width`),t.color!==void 0&&a_(t.color,`${e}.color`),t.alpha!==void 0&&Lm(t.alpha,`${e}.alpha`,0,1)},q6=(t,e)=>{ho(t,e),$i(t,new Set(["x","y","quality","kernelSize","repeatEdgePixels"]),e)},P3=(t,e="rect")=>{if(ho(t,e),$i(t,G6,e),typeof t.id!="string"||t.id.length===0)throw new Error(`Input Error: ${e}.id must be a non-empty string`);if(t.type!=="rect")throw new Error(`Input Error: ${e}.type must be "rect"`);Om(t.width,`${e}.width`),Om(t.height,`${e}.height`);for(let r of["x","y","anchorX","anchorY","originX","originY","rotation"])ZE(t[r],`${e}.${r}`);for(let r of["scaleX","scaleY"])ZE(t[r],`${e}.${r}`);t.alpha!==void 0&&Lm(t.alpha,`${e}.alpha`,0,1),t.fill!==void 0&&c_(t.fill,`${e}.fill`),t.border!==void 0&&j6(t.border,`${e}.border`),t.cornerRadius!==void 0&&W6(t.cornerRadius,`${e}.cornerRadius`),t.blur!==void 0&&q6(t.blur,`${e}.blur`),t.hover!==void 0&&JE(t.hover,`${e}.hover`,{cursor:!0}),t.click!==void 0&&JE(t.click,`${e}.click`),t.rightClick!==void 0&&JE(t.rightClick,`${e}.rightClick`),t.drag!==void 0&&Y6(t.drag,`${e}.drag`),t.scrollUp!==void 0&&e1(t.scrollUp,`${e}.scrollUp`),t.scrollDown!==void 0&&e1(t.scrollDown,`${e}.scrollDown`)};var l_=t=>typeof t=="number"&&Number.isFinite(t)?Math.max(0,t):0,K6=(t,e,r)=>{let n=vl(t),i=l_(e),o=l_(r),s=n.topLeft+n.topRight,a=n.bottomLeft+n.bottomRight,c=n.topLeft+n.bottomLeft,l=n.topRight+n.bottomRight,u=Math.min(1,s>0?i/s:1,a>0?i/a:1,c>0?o/c:1,l>0?o/l:1);return Object.fromEntries(Object.entries(n).map(([d,f])=>[d,Math.max(0,f*u)]))},Q6=(t,e,r,n)=>{let i=l_(e),o=l_(r),s=K6(n,i,o);return Object.values(s).every(a=>a===0)?(t.rect(0,0,i,o),t):(t.moveTo(s.topLeft,0).lineTo(i-s.topRight,0).quadraticCurveTo(i,0,i,s.topRight).lineTo(i,o-s.bottomRight).quadraticCurveTo(i,o,i-s.bottomRight,o).lineTo(s.bottomLeft,o).quadraticCurveTo(0,o,0,o-s.bottomLeft).lineTo(0,s.topLeft).quadraticCurveTo(0,0,s.topLeft,0).closePath(),t)},C3=(t,e,r=e)=>{t.clear(),Q6(t,e.width,e.height,e.cornerRadius),t.fill(i_(t,e.fill,r)),e.border?.width>0&&t.stroke({color:e.border.color,alpha:e.border.alpha,width:e.border.width})};var Gi="_routeGraphicsRectAppearance",J6=["rightClick","click","hover"],I3=(t,e)=>{for(let r of J6)if(t.active[r]&&t.interactionElement?.[r]?.[e]!==void 0)return t.interactionElement[r][e];return e==="fill"?t.styleRuntime.state.fill:t._baseAlpha},k3=(t,e)=>{t.alpha=I3(e,"alpha")},Ld=(t,e)=>{let n={...e.styleRuntime.state,fill:I3(e,"fill")};C3(t,n,{...e.element,...n}),k3(t,e)},Um=(t,e,r)=>{let n=t[Gi];if(n)n.element=e,n.interactionElement=e,n.styleRuntime=r;else{let i={displayObject:t,element:e,interactionElement:e,styleRuntime:r,_baseAlpha:e.alpha??1,active:{hover:!1,click:!1,rightClick:!1},sync(o,s){this.element=o,this.interactionElement=o,this.styleRuntime=s,this._baseAlpha=o.alpha??1,Ld(t,n)},syncInteractions(o){this.interactionElement=o,Ld(t,n)},setInteractionActive(o,s){this.active[o]!==s&&(this.active[o]=s,Ld(t,n))},notifyBaseStyleChange(){Ld(t,n)},apply(){Ld(t,n)},destroy(){t[Gi]===n&&delete t[Gi]}};n=new Proxy(i,{get(o,s,a){return s==="baseAlpha"?o._baseAlpha:Reflect.get(o,s,a)},set(o,s,a,c){return s==="baseAlpha"?(o._baseAlpha=a,k3(t,n),!0):Reflect.set(o,s,a,c)}}),t[Gi]=n,Ld(t,n)}return n},R3=(t,e,r)=>{let n=t?.[Gi];return n?(n.sync(e,r),n):Um(t,e,r)},B3=(t,e)=>{t?.[Gi]?.syncInteractions(e)},u_=t=>{t?.[Gi]?.notifyBaseStyleChange()},qo=(t,e,r)=>{t?.[Gi]?.setInteractionActive(e,r)};var t1=t=>{t?.[Gi]?.destroy()};var Ka=t=>t==="translateX"||t==="translateY",O3=(t,e,r)=>typeof r!="string"?r:r==="alpha"&&t?.[Gi]?[Gi,"baseAlpha"]:r.startsWith("rect.")?["_routeGraphicsRectStyle",r]:e[r]??r,Ud=(t,e,r,n)=>{let i=O3(t,r,e);if(typeof i=="string"){let s=t[i];return s===void 0?n:e==="rotation"?Fm(s):s}let o=t;for(let s of i){if(o==null)return n;o=o[s]}return o===void 0?n:e==="rotation"?Fm(o):o},Z6=(t,e,r,n)=>{let i=O3(t,r,e),o=e==="rotation"?bl(n):n;if(typeof i=="string")return t[i]=o,t;let s=t;for(let a=0;a<i.length-1;a++){let c=i[a];c in s||(s[c]={}),s=s[c]}return s[i[i.length-1]]=o,t},F3=t=>typeof t=="number"&&Number.isFinite(t),ej=t=>{let e=t?.getLocalBounds?.();return e?.rectangle??e??null},D3=(t,e)=>{let r=e==="x"?t?.width:t?.height;if(F3(r)&&r>0)return r;let n=ej(t),i=e==="x"?n?.width:n?.height,o=e==="x"?t?.scale?.x:t?.scale?.y;return F3(i)&&i>0?Math.abs(i*(o??1)):0},Jn=t=>({x:t?.x??0,y:t?.y??0,width:D3(t,"x"),height:D3(t,"y")}),r1=({object:t,property:e,propertyPathMap:r,subjectState:n,defaultValue:i=0})=>e==="translateX"||e==="translateY"?i:Ud(t,e,r,i),Gs=({object:t,property:e,propertyPathMap:r,subjectState:n,value:i})=>{if(e==="translateX")return t.x=n.x+i*n.width,t;if(e==="translateY")return t.y=n.y+i*n.height,t;let o=Z6(t,e,r,i);return(e==="scaleX"||e==="scaleY")&&Dm(t),o};var n1=new WeakMap,Zn=(t,e)=>{let r=n1.get(t);if(!r){r={cleanups:new Set,disposed:!1},n1.set(t,r);let o=t.destroy;t.destroy=function(...s){return tj(this),o.apply(this,s)}}let n=!1,i=()=>{n||(n=!0,r.cleanups.delete(i),e())};return r.disposed||t.destroyed?i():r.cleanups.add(i),i},tj=t=>{let e=n1.get(t);if(!(!e||e.disposed)){e.disposed=!0;for(let r of[...e.cleanups])try{r()}catch{}}};var rj="8.10.2",nj=["uOutputFrame","uInputSize","uInputPixel","uInputClamp","uGlobalFrame","uOutputTexture"],ij=({filterManager:t,filter:e,input:r,output:n})=>{let i=[],o=t?._filterStack,s=t?._filterStackIndex,a=t?._filterGlobalUniforms,c=t?._globalFilterBindGroup,l=t?.renderer,u=Array.isArray(o)&&Number.isInteger(s)?o[s]:null;if(Array.isArray(o)||i.push("_filterStack"),Number.isInteger(s)||i.push("_filterStackIndex"),a?.uniforms||i.push("_filterGlobalUniforms"),typeof c?.setResource!="function"&&i.push("_globalFilterBindGroup"),u?.bounds||i.push("active filter stack entry"),nj.some(d=>!a?.uniforms?.[d])&&i.push("global filter uniform layout"),(!l?.renderTarget?.rootRenderTarget?.colorTexture?.source||typeof l.renderTarget.getRenderTarget!="function"||typeof l.renderTarget.bind!="function")&&i.push("render target system"),typeof l?.encoder?.draw!="function"&&i.push("renderer encoder"),(!e?._state||!e?.groups)&&i.push("filter draw state"),(!r?.frame||!r?.source?.style)&&i.push("filter input texture"),n==null&&i.push("filter output surface"),i.length>0)throw new Error(`Custom shader meshes are incompatible with the installed Pixi runtime. Route Graphics' Pixi ${rj} adapter could not resolve: ${i.join(", ")}.`);return{filterStack:o,filterStackIndex:s,filterUniforms:a,globalFilterBindGroup:c,renderer:l,filterData:u}},L3=({filterManager:t,filter:e,geometry:r,input:n,output:i,clear:o})=>{let{filterStack:s,filterStackIndex:a,filterUniforms:c,globalFilterBindGroup:l,renderer:u,filterData:d}=ij({filterManager:t,filter:e,input:n,output:i}),f=d.bounds,h=Ze.shared.set(0,0),m=d.outputRenderSurface===i,p=u.renderTarget.rootRenderTarget.colorTexture.source.resolution,g=a-1;for(;g>0&&s[g].skip;)g--;g>0&&s[g].inputTexture&&(p=s[g].inputTexture.source.resolution);let x=c.uniforms,b=x.uOutputFrame,w=x.uInputSize,S=x.uInputPixel,_=x.uInputClamp,T=x.uGlobalFrame,v=x.uOutputTexture;if(m){let F=a;for(;F>0;){F--;let R=s[F];if(!R.skip){h.x=R.bounds.minX,h.y=R.bounds.minY;break}}b[0]=f.minX-h.x,b[1]=f.minY-h.y}else b[0]=0,b[1]=0;b[2]=n.frame.width,b[3]=n.frame.height,w[0]=n.source.width,w[1]=n.source.height,w[2]=1/w[0],w[3]=1/w[1],S[0]=n.source.pixelWidth,S[1]=n.source.pixelHeight,S[2]=1/S[0],S[3]=1/S[1],_[0]=.5*S[2],_[1]=.5*S[3],_[2]=n.frame.width*w[2]-.5*S[2],_[3]=n.frame.height*w[3]-.5*S[3];let C=u.renderTarget.rootRenderTarget.colorTexture;T[0]=h.x*p,T[1]=h.y*p,T[2]=C.source.width*p,T[3]=C.source.height*p,i instanceof X&&(i.source.resource=null);let M=u.renderTarget.getRenderTarget(i);if(u.renderTarget.bind(i,!!o),i instanceof X?(v[0]=i.frame.width,v[1]=i.frame.height):(v[0]=M.width,v[1]=M.height),v[2]=M.isRoot?-1:1,c.update(),u.renderPipes.uniformBatch){let F=u.renderPipes.uniformBatch.getUboResource(c);l.setResource(F,0)}else l.setResource(c,0);l.setResource(n.source,1),l.setResource(n.source.style,2),e.groups[0]=l,u.encoder.draw({geometry:r,shader:e,state:e._state,topology:"triangle-list"}),u.type===Ft.WEBGL&&u.renderTarget.finishRenderPass()};var Qa=(t,e)=>{let r=t.replace(/(\bfn\s+mainVertex\s*\([\s\S]*?)(\)\s*->)/,"$1 $2");return{name:e,vertex:{source:r,entryPoint:"mainVertex"},fragment:{source:r,entryPoint:"mainFragment"}}};var i1="__routeGraphicsManagedFilters",oj=["shadow","blur","shader"],sj=t=>(t[i1]||Object.defineProperty(t,i1,{value:new Map,enumerable:!1,configurable:!0}),t[i1]),aj=t=>t.filters?Array.isArray(t.filters)?t.filters:[t.filters]:[],d_=t=>t?Array.isArray(t)?t.filter(Boolean):[t]:[],cj=(t,e,r)=>{let n=new Set;for(let a of e.values())for(let c of d_(a))n.add(c);for(let a of d_(r))n.add(a);let i=aj(t).filter(a=>!n.has(a)),s=[...oj.flatMap(a=>d_(e.get(a))),...i];t.filters=s.length>0?s:null},lj=t=>{for(let e of d_(t))e.destroy?.()},Tl=(t,e,r)=>{let n=sj(t),i=n.get(e);r?n.set(e,r):n.delete(e),cj(t,n,i),i&&i!==r&&lj(i)};var U3=/^[a-z][A-Za-z0-9]*$/;var uj=new Set(["shader"]),$3=new Set(["normal","add","multiply","screen"]),h_=new Set(["clamp","repeat"]),dj=new Set(["on","off","inherit"]),z3=new Set(["type","id","parameters","uniforms","textures","pipeline","mesh","padding","resolution","antialias","clipToViewport","time","source","passes"]),hj=new Set([...z3,"tween"]),fj=new Set(["id","source","uniforms","textures","pipeline","mesh","padding","resolution","antialias","clipToViewport","time"]),pj=new Set(["blend","textureWrap","mipmap"]),mj=new Set(["grid"]),gj=new Set(["webgl","webgpu"]),yj=new Set(["vertex","fragment"]),xj=new Set(["source"]),_j=new Set(["src","wrap","mipmap"]),bj=new Set(["type","value"]),W3=new WeakMap,G3=new Map([["f32","f32"],["vec2","vec2<f32>"],["vec2<f32>","vec2<f32>"],["vec3","vec3<f32>"],["vec3<f32>","vec3<f32>"],["vec4","vec4<f32>"],["vec4<f32>","vec4<f32>"],["mat3","mat3x3<f32>"],["mat3x3<f32>","mat3x3<f32>"],["mat4","mat4x4<f32>"],["mat4x4<f32>","mat4x4<f32>"]]),wj=new Map([["f32",1],["vec2<f32>",2],["vec3<f32>",3],["vec4<f32>",4],["mat3x3<f32>",9],["mat4x4<f32>",16]]),Sj=new Set(["uTexture","uPrevTexture","uNextTexture","uNextTextureMatrix","uNextTextureClamp","uMaskTexture","uProgress","uTime","uResolution","uSampler","GlobalFilterUniforms","ShaderUniforms","VSOutput","gfu","shaderUniforms","mainVertex","mainFragment","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture"]),X3=t=>!!t&&typeof t=="object"&&!Array.isArray(t),$d=t=>typeof t=="number"&&Number.isFinite(t),Ko=(t,e)=>{if(!X3(t))throw new Error(`Input Error: ${e} must be an object`)},Ns=(t,e,r)=>{for(let n of Object.keys(t))if(!r.has(n))throw new Error(`Input Error: ${e}.${n} is not supported`)},Y3=(t,e)=>(W3.set(t,e),t),El=(t,e="shader")=>W3.get(t)??e,Ja=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new Error(`Input Error: ${e} must be a non-empty string`)},j3=(t,e)=>{if(!U3.test(t))throw new Error(`Input Error: ${e} must match ${U3.source}`)},q3=t=>t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,""),N3=t=>/\bvoid\s+main\s*\(/.test(q3(t)),V3=(t,e,r)=>new RegExp(`@${e}\\s+fn\\s+${r}\\s*\\(`).test(q3(t)),K3=t=>t.charAt(0).toUpperCase()+t.slice(1),s1=t=>`u${K3(t)}`,Q3=t=>`u${K3(t)}Texture`,vj=t=>`${Q3(t)}Sampler`,o1=({key:t,symbol:e,path:r,symbols:n,kind:i})=>{if(Sj.has(e))throw new Error(`Input Error: ${r}.${t} generates reserved shader symbol ${e}`);if(n.has(e))throw new Error(`Input Error: ${r}.${t} generates duplicate shader symbol ${e}`);n.set(e,{key:t,kind:i})},Tj=(t,e)=>{if($d(t))return"f32";if(!Array.isArray(t)||!t.every($d))throw new Error(`Input Error: ${e} must be a finite number or a numeric array`);switch(t.length){case 2:return"vec2<f32>";case 3:return"vec3<f32>";case 4:return"vec4<f32>";case 9:return"mat3x3<f32>";case 16:return"mat4x4<f32>";default:throw new Error(`Input Error: ${e} numeric arrays must have length 2, 3, 4, 9, or 16`)}},Ej=(t,e)=>{Ns(t,e,bj);let r=G3.get(t.type);if(!r)throw new Error(`Input Error: ${e}.type must be one of: ${Array.from(G3.keys()).join(", ")}`);let n=wj.get(r),i=t.value;if(n===1){if(!$d(i))throw new Error(`Input Error: ${e}.value must be a finite number`);return{type:r,value:i}}if(!Array.isArray(i)||i.length!==n||!i.every($d))throw new Error(`Input Error: ${e}.value must be a ${n}-number array for ${r}`);return{type:r,value:[...i]}},Aj=(t,e)=>{if(X3(t)){if(t.type===void 0||t.value===void 0)throw new Error(`Input Error: ${e} typed values must define type and value`);return Ej(t,e)}let r=Tj(t,e);return{type:r,value:r==="f32"?t:[...t]}},H3=(t,e)=>{for(let r of e)t.set(r.symbol,{key:r.key,kind:r.role??"uniform"}),r.samplerSymbol&&t.set(r.samplerSymbol,{key:r.key,kind:"texture sampler"})},J3=(t,e,r,n="uniform")=>t===void 0?[]:(Ko(t,e),Object.keys(t).sort().map(i=>{j3(i,`${e}.${i}`);let o=s1(i);return o1({key:i,symbol:o,path:e,symbols:r,kind:n}),{key:i,symbol:o,role:n,...Aj(t[i],`${e}.${i}`)}})),Mj=(t,e,r,n)=>{if(typeof t=="string")return Ja(t,e),n?{src:t}:{src:t,wrap:r.textureWrap,mipmap:r.mipmap};Ko(t,e),Ns(t,e,_j),Ja(t.src,`${e}.src`);let i=t.wrap??r.textureWrap;if(!h_.has(i))throw new Error(`Input Error: ${e}.wrap must be one of: ${Array.from(h_).join(", ")}`);let o=t.mipmap??r.mipmap;if(typeof o!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{src:t.src,...t.wrap!==void 0||!n?{wrap:i}:{},...t.mipmap!==void 0||!n?{mipmap:o}:{}}},Z3=({textures:t,path:e,symbols:r,maxTextures:n,pipeline:i,preserveInheritedSampling:o=!1})=>{if(t===void 0)return[];Ko(t,e);let s=Object.keys(t).sort();if(s.length>n)throw new Error(`Input Error: ${e} supports at most ${n} custom textures`);return s.map(a=>{j3(a,`${e}.${a}`);let c=Q3(a),l=vj(a);return o1({key:a,symbol:c,path:e,symbols:r,kind:"texture"}),o1({key:a,symbol:l,path:e,symbols:r,kind:"texture sampler"}),{key:a,symbol:c,samplerSymbol:l,...Mj(t[a],`${e}.${a}`,i,o)}})},e$=(t,e,r={})=>{t!==void 0&&(Ko(t,e),Ns(t,e,pj));let n=t?.blend??r.blend??"normal";if(!$3.has(n))throw new Error(`Input Error: ${e}.blend must be one of: ${Array.from($3).join(", ")}`);let i=t?.textureWrap??r.textureWrap??"clamp";if(!h_.has(i))throw new Error(`Input Error: ${e}.textureWrap must be one of: ${Array.from(h_).join(", ")}`);let o=t?.mipmap??r.mipmap??!1;if(typeof o!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{blend:n,textureWrap:i,mipmap:o}},Pj=(t,e)=>{if(Ko(t,e),Ns(t,e,gj),Ko(t.webgl,`${e}.webgl`),Ns(t.webgl,`${e}.webgl`,yj),Ko(t.webgpu,`${e}.webgpu`),Ns(t.webgpu,`${e}.webgpu`,xj),t.webgl.vertex!==void 0&&(Ja(t.webgl.vertex,`${e}.webgl.vertex`),!N3(t.webgl.vertex)))throw new Error(`Input Error: ${e}.webgl.vertex must define void main()`);if(Ja(t.webgl.fragment,`${e}.webgl.fragment`),Ja(t.webgpu.source,`${e}.webgpu.source`),!N3(t.webgl.fragment))throw new Error(`Input Error: ${e}.webgl.fragment must define void main()`);if(!V3(t.webgpu.source,"vertex","mainVertex")||!V3(t.webgpu.source,"fragment","mainFragment"))throw new Error(`Input Error: ${e}.webgpu.source must define mainVertex and mainFragment`);return{webgl:{...t.webgl.vertex!==void 0?{vertex:t.webgl.vertex}:{},fragment:t.webgl.fragment},webgpu:{source:t.webgpu.source}}},t$=(t,e,r)=>{let n=t??r;if(n===void 0)return{grid:[1,1]};if(Ko(n,e),Ns(n,e,mj),!Array.isArray(n.grid)||n.grid.length!==2||!n.grid.every(i=>Number.isInteger(i)&&i>=1&&i<=512))throw new Error(`Input Error: ${e}.grid must be [columns, rows] with integers from 1 to 512`);return{grid:[n.grid[0],n.grid[1]]}},r$=(t,e,r={})=>{let n=t.padding??r.padding??0;if(!$d(n)||n<0)throw new Error(`Input Error: ${e}.padding must be a finite number >= 0`);let i=t.resolution??r.resolution??1;if(i!=="inherit"&&(!$d(i)||i<=0))throw new Error(`Input Error: ${e}.resolution must be "inherit" or a finite number > 0`);let o=t.antialias??r.antialias??"off";if(typeof o=="boolean"&&(o=o?"on":"off"),!dj.has(o))throw new Error(`Input Error: ${e}.antialias must be on, off, inherit, or a boolean`);let s=t.clipToViewport??r.clipToViewport??!0;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.clipToViewport must be a boolean`);let a=t.time??r.time??!1;if(typeof a!="boolean")throw new Error(`Input Error: ${e}.time must be a boolean`);return{padding:n,resolution:i,antialias:o,clipToViewport:s,time:a}},Cj=({pass:t,index:e,path:r,parameters:n,commonTextures:i,effectPipeline:o,effectOptions:s,effectMesh:a,textureLimit:c})=>{Ko(t,r),Ns(t,r,fj);let l=t.id??`pass${e+1}`;Ja(l,`${r}.id`);let u=e$(t.pipeline,`${r}.pipeline`,o),d=new Map;H3(d,n),H3(d,i);let f=J3(t.uniforms,`${r}.uniforms`,d),h=c-i.length,m=Z3({textures:t.textures,path:`${r}.textures`,symbols:d,maxTextures:h,pipeline:u}),p=i.map(g=>({...g,wrap:g.wrap??u.textureWrap,mipmap:g.mipmap??u.mipmap}));return Y3({id:l,source:Pj(t.source,`${r}.source`),uniforms:[...n,...f].sort((g,x)=>g.key.localeCompare(x.key)),textures:[...p,...m].sort((g,x)=>g.key.localeCompare(x.key)),pipeline:u,mesh:t$(t.mesh,`${r}.mesh`,a),...r$(t,r,s)},r)},n$=({shader:t,path:e,requireId:r,textureLimit:n,allowTween:i=!1})=>{if(Ko(t,e),Ns(t,e,i?hj:z3),!uj.has(t.type))throw new Error(`Input Error: ${e}.type must be shader`);let o={type:"shader"};if(r?(Ja(t.id,`${e}.id`),o.id=t.id):t.id!==void 0&&(Ja(t.id,`${e}.id`),o.id=t.id),t.parameters!==void 0&&t.uniforms!==void 0)throw new Error(`Input Error: ${e} cannot define both parameters and legacy uniforms`);let s=new Map;o.parameters=J3(t.parameters??t.uniforms,t.parameters!==void 0?`${e}.parameters`:`${e}.uniforms`,s,"parameter"),o.uniforms=o.parameters,o.pipeline=e$(t.pipeline,`${e}.pipeline`),o.textures=Z3({textures:t.textures,path:`${e}.textures`,symbols:s,maxTextures:n,pipeline:o.pipeline,preserveInheritedSampling:!0}),o.mesh=t$(t.mesh,`${e}.mesh`),Object.assign(o,r$(t,e));let a=t.passes!==void 0;if(a&&t.source!==void 0)throw new Error(`Input Error: ${e} cannot define both source and passes`);let c;if(a){if(!Array.isArray(t.passes)||t.passes.length===0)throw new Error(`Input Error: ${e}.passes must be a non-empty array`);c=t.passes}else c=[{id:"main",source:t.source}];let l=new Set;return o.passes=c.map((u,d)=>{let f=Cj({pass:u,index:d,path:a?`${e}.passes[${d}]`:e,parameters:o.parameters,commonTextures:o.textures,effectPipeline:o.pipeline,effectOptions:o,effectMesh:o.mesh,textureLimit:n});if(l.has(f.id))throw new Error(`Input Error: ${e}.passes[${d}].id must be unique`);return l.add(f.id),f}),Y3(o,e)},i$=(t,e="filters")=>{if(t===void 0)return;if(!Array.isArray(t))throw new Error(`Input Error: ${e} must be an array`);let r=new Set;return t.map((n,i)=>{let o=n$({shader:n,path:`${e}[${i}]`,requireId:!0,textureLimit:7});if(r.has(o.id))throw new Error(`Input Error: ${e}[${i}].id must be unique within filters`);return r.add(o.id),o})},a1=(t,e="compositor")=>n$({shader:t,path:e,requireId:!1,textureLimit:6,allowTween:!0});var c1=t=>JSON.stringify(t??null,function(r,n){return r==="value"&&this?.role==="parameter"?null:n});var u1="__routeGraphicsShaderFilters",Al="__routeGraphicsShaderProgress",$m="__routeGraphicsShaderTime",o$="__routeGraphicsShaderDestroyCleanup",d1=`
1628
+ I€wu¸öôú!3å6³‹âVq£³¹´RN£%y10º:pŠ#\:J:b9Hµ7h_Ž:¢I9 _¼™µV,þ <`});var G={a:U};this.setModule=V=>{t.setModule(Ls,V)},this.getModule=()=>t.getModule(Ls),this.instantiate=()=>(this.getModule().then(V=>WebAssembly.instantiate(V,G)).then(V=>{let q=V.exports;W(q),m=q.g,p(),D(q),r()}),this.ready=new Promise(V=>{r=V}).then(()=>{this.HEAP=m.buffer,this.malloc=O,this.free=ie,this.opus_frame_decoder_create=j,this.opus_frame_decode_float_deinterleaved=N,this.opus_frame_decoder_destroy=z}),this)}function Kn(t={}){Kn.errors||Object.defineProperties(Kn,{errors:{value:new Map([[-1,"OPUS_BAD_ARG: One or more invalid/out of range arguments"],[-2,"OPUS_BUFFER_TOO_SMALL: Not enough bytes allocated in the buffer"],[-3,"OPUS_INTERNAL_ERROR: An internal error was detected"],[-4,"OPUS_INVALID_PACKET: The compressed data passed is corrupted"],[-5,"OPUS_UNIMPLEMENTED: Invalid/unsupported request number"],[-6,"OPUS_INVALID_STATE: An encoder or decoder structure is invalid or already freed"],[-7,"OPUS_ALLOC_FAIL: Memory allocation has failed"]])}}),this._init=()=>new this._WASMAudioDecoderCommon(this).instantiate(this._EmscriptenWASM,this._module).then(u=>{this._common=u,this._inputBytes=0,this._outputSamples=0,this._frameNumber=0,this._input=this._common.allocateTypedArray(this._inputSize,Uint8Array),this._output=this._common.allocateTypedArray(this._outputChannels*this._outputChannelSize,Float32Array);let d=this._common.allocateTypedArray(this._channels,Uint8Array);d.buf.set(this._channelMappingTable),this._decoder=this._common.wasm.opus_frame_decoder_create(this._sampleRate,this._channels,this._streamCount,this._coupledStreamCount,d.ptr,this._preSkip,this._forceStereo)}),Object.defineProperty(this,"ready",{enumerable:!0,get:()=>this._ready}),this.reset=()=>(this.free(),this._init()),this.free=()=>{this._common.free(),this._common.wasm.opus_frame_decoder_destroy(this._decoder),this._common.wasm.free(this._decoder)},this._decode=u=>{if(!(u instanceof Uint8Array))throw Error("Data to decode must be Uint8Array. Instead got "+typeof u);this._input.buf.set(u);let d=this._common.wasm.opus_frame_decode_float_deinterleaved(this._decoder,this._input.ptr,u.length,this._output.ptr),f;return d<0&&(f="libopus "+d+" "+(Kn.errors.get(d)||"Unknown Error"),console.error(f),d=0),{outputBuffer:this._common.getOutputChannels(this._output.buf,this._outputChannels,d),samplesDecoded:d,error:f}},this.decodeFrame=u=>{let d=[],f=this._decode(u);return f.error&&this._common.addError(d,f.error,u.length,this._frameNumber,this._inputBytes,this._outputSamples),this._frameNumber++,this._inputBytes+=u.length,this._outputSamples+=f.samplesDecoded,this._WASMAudioDecoderCommon.getDecodedAudioMultiChannel(d,[f.outputBuffer],this._outputChannels,f.samplesDecoded,this._sampleRate)},this.decodeFrames=u=>{let d=[],f=[],h=0,m=0;for(;m<u.length;){let p=u[m++],g=this._decode(p);d.push(g.outputBuffer),h+=g.samplesDecoded,g.error&&this._common.addError(f,g.error,p.length,this._frameNumber,this._inputBytes,this._outputSamples),this._frameNumber++,this._inputBytes+=p.length,this._outputSamples+=g.samplesDecoded}return this._WASMAudioDecoderCommon.getDecodedAudioMultiChannel(f,d,this._outputChannels,h,this._sampleRate)},this._isWebWorker=Kn.isWebWorker,this._WASMAudioDecoderCommon=Kn.WASMAudioDecoderCommon||wt,this._EmscriptenWASM=Kn.EmscriptenWASM||Ls,this._module=Kn.module;let e=8,r=u=>typeof u=="number",n=t.sampleRate,i=t.channels,o=t.streamCount,s=t.coupledStreamCount,a=t.channelMappingTable,c=t.preSkip,l=t.forceStereo?1:0;if(i>2&&(!r(o)||!r(s)||!Array.isArray(a)))throw new Error("Invalid Opus Decoder Options for multichannel decoding.");return this._sampleRate=[8e3,12e3,16e3,24e3,48e3].includes(n)?n:48e3,this._channels=r(i)?i:2,this._streamCount=r(o)?o:1,this._coupledStreamCount=r(s)?s:this._channels-1,this._channelMappingTable=a||(this._channels===2?[0,1]:[0]),this._preSkip=c||0,this._forceStereo=i<=e&&i!=2?l:0,this._inputSize=32e3*.12*this._channels,this._outputChannelSize=120*48,this._outputChannels=this._forceStereo?2:this._channels,this._ready=this._init(),this}var xl=class extends Pa{constructor(e){super(e,"opus-decoder",Kn,Ls)}async decodeFrame(e){return this.postToDecoder("decodeFrame",e)}async decodeFrames(e){return this.postToDecoder("decodeFrames",e)}};Go(Kn,"OpusDecoder");Go(xl,"OpusDecoderWebWorker");var Z8=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Us=class{constructor(e={}){this._sampleRate=e.sampleRate||48e3,this._speechQualityEnhancement=e.speechQualityEnhancement,this._forceStereo=e.forceStereo!==void 0?e.forceStereo:!1,this._onCodec=r=>{if(r!=="opus")throw new Error("ogg-opus-decoder does not support this codec "+r)},new wt,this._useMLDecoder=["lace","nolace"].includes(this._speechQualityEnhancement),this._decoderLibraryLoaded=this._loadDecoderLibrary(),this._ready=this._init()}_initDecoderClass(){this._decoderClass=this._useMLDecoder?this.OpusMLDecoder:this.OpusDecoder}async _loadDecoderLibrary(){if(this._useMLDecoder)if(await Z8()){let{OpusMLDecoder:r,OpusMLDecoderWebWorker:n}=await Promise.resolve().then(()=>(a3(),s3));this.OpusMLDecoder=r,this.OpusMLDecoderWebWorker=n}else console.warn(`ogg-opus-decoder: This platform does not support WebAssembly SIMD; { speechQualityEnhancements: '${this._speechQualityEnhancement}' } has been disabled`),this._useMLDecoder=!1;this.OpusDecoder=Kn,this.OpusDecoderWebWorker=xl,this._initDecoderClass()}async _init(){this._decoder&&await this._decoder.free(),this._decoder=null,this._decoderReady=null,this._codecParser=new j0("application/ogg",{onCodec:this._onCodec,enableFrameCRC32:!1})}async _instantiateDecoder(e){return this._totalSamplesDecoded=0,this._preSkip=e[r3],this._channels=this._forceStereo?2:e[HE],await this._decoderLibraryLoaded,this._decoder=new this._decoderClass({channels:e[HE],streamCount:e[o3],coupledStreamCount:e[t3],channelMappingTable:e[i3],preSkip:Math.round(this._preSkip/48e3*this._sampleRate),sampleRate:this._sampleRate,speechQualityEnhancement:this._speechQualityEnhancement,forceStereo:this._forceStereo}),this._decoder.ready}get ready(){return this._ready}async reset(){this._ready=this._init(),await this._ready}free(){this._decoder&&this._decoder.free()}async _decode(e){let r=[],n=[],i=[],o=0,s=async()=>{if(r.length){await this._decoderReady;let{channelData:a,samplesDecoded:c,errors:l}=await this._decoder.decodeFrames(r);i.push(a),n.push(...l),o+=c,this._totalSamplesDecoded+=c,r=[]}};for(let a=0;a<e.length;a++){let c=e[a],l=c[gl].map(u=>u[Bd]);if(l.length&&(r.push(...l),this._decoderReady||(this._decoderReady=this._instantiateDecoder(c[gl][0][q0]))),c[K0]){if(await s(),c[e3]!==void 0&&i.length){let u=this._totalSamplesDecoded/this._sampleRate*48e3,d=Math.round((u-c[Q0])/48e3*this._sampleRate),f=i[i.length-1];if(d>0)for(let h=0;h<f.length;h++)f[h]=f[h].subarray(0,f[h].length-d);o-=d,this._totalSamplesDecoded-=d}await this.reset()}}return await s(),[n,i,this._channels,o,this._sampleRate,16]}async decode(e){let r=await this._decode([...this._codecParser.parseChunk(e)]);return wt.getDecodedAudioMultiChannel(...r)}async decodeFile(e){let r=await this._decode([...this._codecParser.parseAll(e)]);return await this.reset(),wt.getDecodedAudioMultiChannel(...r)}async flush(){let e=await this._decode([...this._codecParser.flush()]);return await this.reset(),wt.getDecodedAudioMultiChannel(...e)}};var Im=class extends Us{constructor(e){super(e)}_initDecoderClass(){this._decoderClass=this._useMLDecoder?this.OpusMLDecoderWebWorker:this.OpusDecoderWebWorker}async free(){this._decoder&&await this._decoder.free()}};Go(Us,"OggOpusDecoder");Go(Im,"OggOpusDecoderWebWorker");var e6=new Set(["audio/ogg","application/ogg"]),_l={opus:{decoderPromise:null,queue:Promise.resolve()},vorbis:{decoderPromise:null,queue:Promise.resolve()}},WE=new Map,l3=t=>t instanceof Uint8Array?t:new Uint8Array(t??new ArrayBuffer(0)),c3=(t,e)=>{let r=Array.from(e,i=>i.charCodeAt(0)),n=t.length-r.length;for(let i=0;i<=n;i+=1){let o=!0;for(let s=0;s<r.length;s+=1)if(t[i+s]!==r[s]){o=!1;break}if(o)return!0}return!1},km=t=>{if(WE.has(t))return WE.get(t);let e=!1;try{let r=globalThis.document?.createElement?.("audio");e=typeof r?.canPlayType=="function"&&r.canPlayType(t)!==""}catch{e=!1}return WE.set(t,e),e},t6=t=>typeof t!="string"?"":t.split(";")[0].trim().toLowerCase(),XE=t=>e6.has(t6(t)),u3=t=>{let e=l3(t);return c3(e,"OpusHead")?"opus":c3(e,"vorbis")?"vorbis":"unknown"},r6=t=>t==="opus"?km('audio/ogg; codecs="opus"')||km("audio/ogg"):t==="vorbis"&&km('audio/ogg; codecs="vorbis"')||km("audio/ogg"),n6=({audioContext:t,channelData:e,sampleRate:r,samplesDecoded:n})=>{let i=e.length;if(i===0)throw new Error("Ogg decoder returned no audio channels.");let o=Math.max(0,n??Math.max(...e.map(a=>a.length)));if(o===0)throw new Error("Ogg decoder returned an empty audio buffer.");let s=t.createBuffer(i,o,r);for(let a=0;a<i;a+=1){let c=e[a];s.getChannelData(a).set(c.subarray(0,o))}return s},i6=async()=>(_l.opus.decoderPromise||(_l.opus.decoderPromise=(async()=>{let t=new Us;return await t.ready,t})()),_l.opus.decoderPromise),o6=async()=>(_l.vorbis.decoderPromise||(_l.vorbis.decoderPromise=(async()=>{let t=new Os;return await t.ready,t})()),_l.vorbis.decoderPromise),d3=t=>{if(t==="opus")return i6();if(t==="vorbis")return o6();throw new Error(`Unsupported Ogg codec "${t}".`)},s6=async({codec:t,bytes:e})=>{let r=_l[t];if(!r)throw new Error(`Unsupported Ogg codec "${t}".`);let n=async()=>{let o=await d3(t);try{return await o.decodeFile(e)}finally{await o.reset?.()}},i=r.queue.then(n,n);return r.queue=i.catch(()=>{}),i},h3=async(t={})=>{let e=new Set;for(let r of Object.values(t)){if(!XE(r?.type)||!r?.buffer)continue;let n=u3(r.buffer);n==="unknown"||r6(n)||e.add(n)}await Promise.all([...e].map(r=>d3(r)))},f3=async({arrayBuffer:t,audioContext:e})=>{let r=u3(t),n=l3(t),i=await s6({codec:r,bytes:n});return n6({audioContext:e,channelData:i.channelData??[],sampleRate:i.sampleRate,samplesDecoded:i.samplesDecoded})};var Rm,YE,a6=()=>globalThis.window?.RTGL_AUDIO_DEBUG===!0||globalThis.window?.RTGL_VT_DEBUG===!0,c6=(t,e={})=>{a6()&&console.log(`[AudioContext] ${t}`,e)},l6=()=>{if(Rm)return Rm;let t=globalThis.window?.AudioContext??globalThis.window?.webkitAudioContext;if(!t)throw new Error("AudioContext is not available in this environment.");return Rm=new t,c6("context created",{state:Rm.state}),Rm},u6={get context(){return l6()},nowMs:()=>Date.now(),setTimeout:(t,e)=>globalThis.setTimeout(t,e),clearTimeout:t=>globalThis.clearTimeout(t),setInterval:(t,e)=>globalThis.setInterval(t,e),clearInterval:t=>globalThis.clearInterval(t),queueMicrotask:t=>globalThis.queueMicrotask(t)},d6=t=>{if(!t||typeof t!="object")throw new Error("Audio runtime must be an object.");if(!t.context)throw new Error("Audio runtime must provide a context.");for(let e of["nowMs","setTimeout","clearTimeout","setInterval","clearInterval","queueMicrotask"])if(typeof t[e]!="function")throw new Error(`Audio runtime must provide ${e}().`)},h6=t=>{d6(t),YE=t},f6=()=>{YE=void 0},Ya=()=>YE??u6,Ie=()=>Ya().context;var Fd=Object.create(null),$s=Object.create(null),p6=async t=>{await h3(t)},m6=t=>t?typeof t=="string"?t:t.message||String(t):"Unknown error",p3=(t,e)=>{let r="Unsupported or damaged audio file.",n=`Could not load audio "${t}". ${r}`,i=new Error(n,{cause:e});return i.userMessage=n,i.rootCauseMessage=r,i.details={assetKey:t,assetKind:"audio",phase:"decode",cause:m6(e)},i},g6=async({key:t,arrayBuffer:e,type:r,audioContext:n})=>{try{return await n.decodeAudioData(e.slice(0))}catch(i){if(!XE(r))throw p3(t,i);try{return await f3({arrayBuffer:e,audioContext:n})}catch(o){throw p3(t,o)}}},y6=(t,e,r)=>{if(Fd[t])return Fd[t];if($s[t])return $s[t];if(!e||e.byteLength===0)return;let n=Ie(),i=g6({key:t,arrayBuffer:e,type:r,audioContext:n}).then(o=>($s[t]===i&&(Fd[t]=o),o)).finally(()=>{$s[t]===i&&delete $s[t]});return $s[t]=i,i},x6=t=>Fd[t],_6=t=>$s[t],b6=t=>{let e=!!Fd[t]||!!$s[t];return delete Fd[t],delete $s[t],e},uo={prepareDecoders:p6,load:y6,getAsset:x6,getAssetPromise:_6,unload:b6};var m3=(t,e)=>{let r=t*e/1e3,n=Math.round(r),i=Number.EPSILON*Math.max(1,Math.abs(r))*8;return Math.abs(r-n)<=i?n:Math.ceil(r)},Z0=(t,e)=>{let r=Number(t);if(!Number.isFinite(r)||r<0)throw new Error(`${e} must be a finite non-negative number.`);return r},e_=(t,e)=>{let r=Number(t);if(!Number.isInteger(r)||r<=0)throw new Error(`${e} must be a positive integer.`);return r},jE=async()=>{for(let t=0;t<8;t++)await Promise.resolve()},w6=()=>new Promise(t=>globalThis.setTimeout(t,0)),S6=({durationMs:t,sampleRate:e=48e3,numberOfChannels:r=2,renderQuantumSize:n=128,maxCallbacks:i=1e5,OfflineAudioContextCtor:o=globalThis.OfflineAudioContext}={})=>{let s=Z0(t,"durationMs");if(s===0)throw new Error("durationMs must be greater than zero.");let a=e_(e,"sampleRate"),c=e_(r,"numberOfChannels"),l=e_(n,"renderQuantumSize"),u=e_(i,"maxCallbacks");if(typeof o!="function")throw new Error("OfflineAudioContext is not available in this environment.");let d=m3(s,a),f=new o({numberOfChannels:c,length:d,sampleRate:a}),h=new Set,m=D=>{let G=!1,V=!1,q=!1,Z=()=>{G&&!V&&(!D.loop||q)?h.add(D):h.delete(D)};return D.addEventListener("ended",()=>{V=!0,h.delete(D)},{once:!0}),new Proxy(D,{get(re,de){if(de==="start")return(...Fe)=>{let ce=re.start(...Fe);return G=!0,Z(),ce};if(de==="stop")return(...Fe)=>{let ce=re.stop(...Fe);return q=!0,Z(),ce};let _e=Reflect.get(re,de,re);return typeof _e=="function"?_e.bind(re):_e},set(re,de,_e){let Fe=Reflect.set(re,de,_e,re);return de==="loop"&&Z(),Fe}})},p=new Proxy(f,{get(D,G){if(G==="state")return"running";if(G==="createBufferSource")return()=>m(D.createBufferSource());let V=Reflect.get(D,G,D);return typeof V=="function"?V.bind(D):V}}),g=new Map,x=1,b=1,w=0,S,_=!1,T=!1,v=()=>f.currentTime*1e3,C=D=>{let G=m3(D,a);return Math.ceil(G/l)*l/a*1e3},M=({callback:D,dueTimeMs:G,intervalMs:V=null})=>{if(T)throw new Error("Deterministic audio runtime has been destroyed.");if(typeof D!="function")throw new Error("Scheduled audio callback must be a function.");let q=x++;return g.set(q,{id:q,callback:D,dueTimeMs:Math.max(v(),G),intervalMs:V,order:b++}),q},F=(D,G=0)=>M({callback:D,dueTimeMs:v()+Z0(G,"delayMs")}),R=D=>{g.delete(D)},U=(D,G=0)=>{let V=Z0(G,"intervalMs");if(V===0)throw new Error("intervalMs must be greater than zero.");return M({callback:D,dueTimeMs:v()+V,intervalMs:V})},W=R,j=(D,G)=>M({callback:G,dueTimeMs:Z0(D,"timeMs")}),O=D=>[...g.values()].filter(G=>C(G.dueTimeMs)<=D+1e-7).sort((G,V)=>G.dueTimeMs-V.dueTimeMs||G.order-V.order),N=async D=>{for(;;){if(S)throw S;let G=O(D);if(G.length===0)return;for(let V of G){if(g.get(V.id)!==V)continue;if(w+=1,w>u)throw new Error(`Deterministic audio runtime exceeded ${u} callbacks.`);V.intervalMs===null?g.delete(V.id):V.dueTimeMs+=V.intervalMs;let q=V.callback();if(q!==null&&(typeof q=="object"||typeof q=="function")&&typeof q.then=="function"&&Promise.resolve(q).catch(Z=>{S??=Z}),await jE(),S)throw S}}},z=()=>{let D=Number.POSITIVE_INFINITY;for(let G of g.values())D=Math.min(D,C(G.dueTimeMs));if(h.size>0){let G=Math.round(f.currentTime*a),V=(Math.floor(G/l)+1)*l;D=Math.min(D,V/a*1e3)}return D};return{context:p,offlineContext:f,durationMs:s,sampleRate:a,numberOfChannels:c,nowMs:v,setTimeout:F,clearTimeout:R,setInterval:U,clearInterval:W,queueMicrotask:D=>globalThis.queueMicrotask(D),scheduleAt:j,render:async()=>{if(T)throw new Error("Deterministic audio runtime has been destroyed.");if(_)throw new Error("Deterministic audio runtime can only render once.");_=!0;let D,G=new Set,V=()=>{if(D||S)return;let Z=z();if(!Number.isFinite(Z)||Z>=s-1e-7)return;let re=f.suspend(Z/1e3).then(async()=>{try{await w6(),await jE(),await N(v()),V()}catch(de){D=de}finally{try{await f.resume()}catch(de){D??=de}}}).catch(de=>{D??=de}).finally(()=>{G.delete(re)});G.add(re)};await jE(),await N(0),V();let q=await f.startRendering();if(await Promise.allSettled(G),D||S)throw D??S;return q},destroy:()=>{T=!0,g.clear(),h.clear()},getPendingTaskCount:()=>g.size}};var vr=({type:t,add:e,update:r,delete:n,parse:i,shouldUpdateUnchanged:o})=>({type:t,add:e,update:r,delete:n,parse:i,shouldUpdateUnchanged:o});var qE=({type:t})=>({type:t});var KE=({type:t,add:e,update:r,delete:n})=>({type:t,add:e,update:r,delete:n});var v6={alpha:"alpha",x:"x",y:"y",translateX:"translateX",translateY:"translateY",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation",blurX:"blurX",blurY:"blurY",width:"width",height:"height",uProgress:"uProgress"},T6=/^rect\.(?:width|height|fill\.(?:color|(?:start|end|innerCenter|outerCenter)\.(?:x|y)|(?:innerRadius|outerRadius|scale|rotation)|stops\.\d+\.(?:offset|color))|border\.(?:width|color|alpha)|cornerRadius\.(?:topLeft|topRight|bottomRight|bottomLeft))$/,QE=t=>typeof t=="string"&&T6.test(t),t_=t=>!!v6[t]||QE(t);var _i={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"],blurX:["_routeGraphicsBlur","x"],blurY:["_routeGraphicsBlur","y"],width:["width"],height:["height"],uProgress:["uProgress"]};var ja={RECT:"rect",TEXT:"text",INPUT:"input",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",SPRITESHEET_ANIMATION:"spritesheet-animation",VIDEO:"video"};var Pt={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var g3={color:"black",alpha:1,blur:0,offsetX:2,offsetY:2},E6=.4,A6=t=>{if(typeof t=="number"&&Number.isFinite(t))return Math.max(0,t);if(typeof t=="string"){let e=Number.parseFloat(t);if(Number.isFinite(e))return Math.max(0,e)}return Pt.fontSize},M6=t=>typeof t=="number"&&Number.isFinite(t)?t:0,P6=(t={})=>Math.ceil(A6(t.fontSize)*E6),C6=(t={})=>{let e=typeof t.stroke=="object"&&t.stroke!==null?t.stroke:{};return{...e,color:t.strokeColor??e.color??Pt.strokeColor,width:t.strokeWidth??e.width??Pt.strokeWidth}},I6=t=>{if(t===void 0)return;if(t===null||t===!1)return null;let e=typeof t=="object"&&t!==null?{...g3,...t}:g3,r=e.offsetX,n=e.offsetY,i=Math.hypot(r,n);return{alpha:e.alpha,angle:i===0?0:Math.atan2(n,r),blur:e.blur,color:e.color,distance:i}},k6=t=>t?Math.ceil(Math.max(0,t.blur)+t.distance):0,sn=(t={},e={})=>{let r=e.includeShadow!==!1,{strokeColor:n,strokeWidth:i,stroke:o,shadow:s,...a}=t;delete a.dropShadow;let c={...a,stroke:C6({strokeColor:n,strokeWidth:i,stroke:o})};if(Array.isArray(c.fontFamily)&&(c.fontFamily=[...c.fontFamily]),r){let l=I6(s),u=k6(l),d=Math.max(M6(a.padding),u,P6(a));s!==void 0&&(c.dropShadow=l),d>0&&(c.padding=d)}return c};var jo=(t,e)=>{let r={fill:e?.fill??Pt.fill,fontFamily:e?.fontFamily??Pt.fontFamily,fontSize:e?.fontSize??Pt.fontSize,...e?.fontWeight!==void 0?{fontWeight:e.fontWeight}:{},...e?.fontStyle!==void 0?{fontStyle:e.fontStyle}:{},...e?.letterSpacing!==void 0?{letterSpacing:e.letterSpacing}:{},...e?.whiteSpace!==void 0?{whiteSpace:e.whiteSpace}:{},align:e?.align??Pt.align,lineHeight:e?.lineHeight??Pt.lineHeight,wordWrap:e?.wordWrap??Pt.wordWrap,breakWords:e?.breakWords??Pt.breakWords,strokeColor:e?.strokeColor??Pt.strokeColor,strokeWidth:e?.strokeWidth??Pt.strokeWidth,wordWrapWidth:e?.wordWrapWidth??Pt.wordWrapWidth,...e?.padding!==void 0?{padding:e.padding}:{},...Object.prototype.hasOwnProperty.call(e??{},"shadow")?{shadow:e.shadow}:{}};t.style=sn(r)};var bl=(t=0)=>t*Math.PI/180,Fm=(t=0)=>t*180/Math.PI,w3=new WeakMap,y3=new WeakMap,x3=t=>typeof t=="number"&&Number.isFinite(t)&&t!==0?t:1,Bm=t=>typeof t=="number"&&Number.isFinite(t)?t:1,_3=t=>typeof t=="number"&&Number.isFinite(t)?Math.abs(t):1,R6=(t,e,{scaleMode:r="sign",preserveScaleMagnitude:n=!1}={})=>{if(!t.scale)return;let i=y3.get(t)??{x:!1,y:!1},o=e.scaleX!==void 0||i.x,s=e.scaleY!==void 0||i.y;if(!o&&!s)return;let a=Bm(e.scaleX),c=Bm(e.scaleY),l=r==="full"?a:Math.sign(a),u=r==="full"?c:Math.sign(c),d=_3(t.scale.x),f=_3(t.scale.y);o&&(t.scale.x=n?d*l:l),s&&(t.scale.y=n?f*u:u),y3.set(t,{x:e.scaleX!==void 0,y:e.scaleY!==void 0})},wl=(t,e,{localOriginX:r,localOriginY:n,scaleMode:i="sign",preserveScaleMagnitude:o=!1}={})=>{R6(t,e,{scaleMode:i,preserveScaleMagnitude:o}),Sl(t,e,{localOriginX:r,localOriginY:n})},r_=t=>({x:Math.round((t.x??0)+(t.originX??0)),y:Math.round((t.y??0)+(t.originY??0))}),Dm=t=>{let e=w3.get(t);e&&t.pivot?.set?.(e.x,e.y)},Sl=(t,e,{localOriginX:r,localOriginY:n,baseScaleX:i,baseScaleY:o}={})=>{let s=e.originX??0,a=e.originY??0,c=r??s,l=n??a,u=x3(i??t.scale?.x),d=x3(o??t.scale?.y);w3.set(t,{x:c/u,y:l/d}),Dm(t)},ot=(t,e,{localOriginX:r,localOriginY:n,scaleMode:i="sign",preserveScaleMagnitude:o=!1}={})=>{let s=r_(e);wl(t,e,{localOriginX:r,localOriginY:n,scaleMode:i,preserveScaleMagnitude:o}),t.x=s.x,t.y=s.y,t.rotation=bl(e.rotation??0)},B6=(t,e)=>{let r=e==="x"?"width":"height",n=t.texture?.orig?.[r]??t.texture?.source?.[r];if(Number.isFinite(n)&&n>0)return n;let i=Math.abs(t[r]),o=Math.abs(t.scale?.[e]),s=i/o;return Number.isFinite(s)&&s>0?s:void 0},b3=(t,e,r,n)=>{let i=Bm(r==="x"?e.scaleX:e.scaleY),o=Math.sign(i);if(o===0)return 0;let s=B6(t,r),a=Math.abs(n);if(Number.isFinite(a)&&Number.isFinite(s)&&s>0)return o*a/s;let c=Math.abs(t.scale?.[r]);return o*(Number.isFinite(c)?c:1)},Qn=(t,e,r={})=>{let n=r.width??e.width??t.width,i=r.height??e.height??t.height;return{scaleX:b3(t,e,"x",n),scaleY:b3(t,e,"y",i)}},qe=(t,e={})=>{let r=r_(t),n={x:r.x,y:r.y};return t.scaleX!==void 0&&(n.scaleX=Math.sign(Bm(t.scaleX))),t.scaleY!==void 0&&(n.scaleY=Math.sign(Bm(t.scaleY))),t.rotation!==void 0&&(n.rotation=t.rotation),{...n,...e}};var S3={color:0,alpha:0},F6={x:0,y:0},D6={x:0,y:1},O6={x:.5,y:.5},v3=t=>t==null||t===""||t==="transparent",T3=t=>[...t].sort((e,r)=>e.offset-r.offset),L6=(t,e)=>{if(!t||!e)return t;let r=e.originX??0,n=e.originY??0,i=r_(e),o=bl(e.rotation??0),s=Math.cos(o),a=Math.sin(o),c=t.x-i.x,l=t.y-i.y;return{x:r+c*s+l*a,y:n-c*a+l*s}},n_=(t,e,r,n)=>e.coordinateSpace==="global"?L6(t??n,r):t,qa=t=>{t._rtglFillResource?.destroy(),delete t._rtglFillResource},U6=(t,e)=>v3(t)?S3:typeof t=="string"?t:t.type==="solid"?v3(t.color)?S3:t.color:t.type==="linear-gradient"?new Lr({type:"linear",start:n_(t.start,t,e,F6),end:n_(t.end,t,e,D6),colorStops:T3(t.stops),textureSpace:t.coordinateSpace,textureSize:t.resolution,wrapMode:t.spread==="repeat"?"repeat":"clamp-to-edge"}):t.type==="radial-gradient"?new Lr({type:"radial",center:n_(t.innerCenter,t,e,O6),innerRadius:t.innerRadius,outerCenter:n_(t.outerCenter,t,e),outerRadius:t.outerRadius,colorStops:T3(t.stops),textureSpace:t.coordinateSpace,textureSize:t.resolution,wrapMode:t.spread==="repeat"?"repeat":"clamp-to-edge",scale:t.scale,rotation:t.rotation}):t,i_=(t,e,r)=>{qa(t);let n=U6(e,r);return n instanceof Lr&&(t._rtglFillResource=n),n};var Dd=Object.freeze(["topLeft","topRight","bottomRight","bottomLeft"]),$6=Object.freeze({topLeft:0,topRight:0,bottomRight:0,bottomLeft:0}),G6=new Set(["id","type","width","height","x","y","anchorX","anchorY","originX","originY","alpha","scaleX","scaleY","rotation","fill","border","cornerRadius","blur","filters","hover","click","rightClick","drag","scrollUp","scrollDown"]),N6=new Set(["solid","linear-gradient","radial-gradient"]),V6=new Set(["local","global"]),H6=new Set(["pad","repeat"]),z6=t=>!!t&&typeof t=="object"&&!Array.isArray(t),ho=(t,e)=>{if(!z6(t))throw new Error(`Input Error: ${e} must be an object`)},$i=(t,e,r)=>{for(let n of Object.keys(t))if(!e.has(n))throw new Error(`Input Error: ${r}.${n} is not supported`)},Od=(t,e)=>{if(typeof t!="number"||!Number.isFinite(t))throw new Error(`Input Error: ${e} must be a finite number`)},ZE=(t,e)=>{t!==void 0&&Od(t,e)},Lm=(t,e,r,n)=>{if(Od(t,e),t<r||t>n)throw new Error(`Input Error: ${e} must be between ${r} and ${n}`)},s_=(t,e)=>{if(Od(t,e),t<0)throw new Error(`Input Error: ${e} must be greater than or equal to 0`)},Om=(t,e)=>{if(Od(t,e),t<=0)throw new Error(`Input Error: ${e} must be greater than 0`)},a_=(t,e)=>{if(typeof t!="string"||t.length===0)throw new Error(`Input Error: ${e} must be a non-empty color string`);if(typeof Ce=="function")try{new Ce(t)}catch{throw new Error(`Input Error: ${e} is not a valid color`)}},o_=(t,e)=>{if(ho(t,e),$i(t,new Set(["x","y"]),e),t.x===void 0||t.y===void 0)throw new Error(`Input Error: ${e}.x and ${e}.y are required`);Od(t.x,`${e}.x`),Od(t.y,`${e}.y`)},E3=(t,e)=>{if(!Array.isArray(t)||t.length<2)throw new Error(`Input Error: ${e} must be an array with at least two stops`);let r=-1/0;t.forEach((n,i)=>{let o=`${e}[${i}]`;if(ho(n,o),$i(n,new Set(["offset","color"]),o),n.offset===void 0||n.color===void 0)throw new Error(`Input Error: ${o}.offset and ${o}.color are required`);if(Lm(n.offset,`${o}.offset`,0,1),a_(n.color,`${o}.color`),n.offset<=r)throw new Error(`Input Error: ${e} offsets must be strictly increasing`);r=n.offset})},A3=(t,e)=>{if(t.textureSize!==void 0)throw new Error(`Input Error: ${e}.textureSize is no longer supported; use ${e}.resolution`);if(t.wrapMode!==void 0)throw new Error(`Input Error: ${e}.wrapMode is no longer supported; use ${e}.spread with "pad" or "repeat"`);if(t.coordinateSpace!==void 0&&!V6.has(t.coordinateSpace))throw new Error(`Input Error: ${e}.coordinateSpace must be "local" or "global"`);if(t.resolution!==void 0&&Om(t.resolution,`${e}.resolution`),t.spread!==void 0&&!H6.has(t.spread))throw new Error(`Input Error: ${e}.spread must be "pad" or "repeat"`)},c_=(t,e="fill")=>{if(typeof t=="string"){a_(t,e);return}if(ho(t,e),!N6.has(t.type))throw new Error(`Input Error: ${e}.type must be "solid", "linear-gradient", or "radial-gradient"`);if(t.type==="solid"){if($i(t,new Set(["type","color"]),e),t.color===void 0)throw new Error(`Input Error: ${e}.color is required`);a_(t.color,`${e}.color`);return}if(t.type==="linear-gradient"){$i(t,new Set(["type","start","end","stops","coordinateSpace","resolution","spread","textureSize","wrapMode"]),e),t.start!==void 0&&o_(t.start,`${e}.start`),t.end!==void 0&&o_(t.end,`${e}.end`),E3(t.stops,`${e}.stops`),A3(t,e);return}$i(t,new Set(["type","innerCenter","innerRadius","outerCenter","outerRadius","stops","coordinateSpace","resolution","spread","scale","rotation","textureSize","wrapMode"]),e),t.innerCenter!==void 0&&o_(t.innerCenter,`${e}.innerCenter`),t.outerCenter!==void 0&&o_(t.outerCenter,`${e}.outerCenter`),t.innerRadius!==void 0&&s_(t.innerRadius,`${e}.innerRadius`),t.outerRadius!==void 0&&Om(t.outerRadius,`${e}.outerRadius`),t.scale!==void 0&&Om(t.scale,`${e}.scale`),ZE(t.rotation,`${e}.rotation`),E3(t.stops,`${e}.stops`),A3(t,e)},vl=t=>t===void 0?{...$6}:Object.fromEntries(typeof t=="number"?Dd.map(e=>[e,t]):Dd.map(e=>[e,t[e]??0])),W6=(t,e)=>{if(typeof t=="number"){s_(t,e);return}ho(t,e),$i(t,new Set(Dd),e);for(let r of Dd)t[r]!==void 0&&s_(t[r],`${e}.${r}`)},M3=(t,e)=>{t!==void 0&&ho(t,e)},X6=(t,e,{cursor:r=!1}={})=>{if(t.soundSrc!==void 0&&(typeof t.soundSrc!="string"||t.soundSrc.length===0))throw new Error(`Input Error: ${e}.soundSrc must be a non-empty string`);if(t.soundVolume!==void 0&&Lm(t.soundVolume,`${e}.soundVolume`,0,100),r&&t.cursor!==void 0&&(typeof t.cursor!="string"||t.cursor.length===0))throw new Error(`Input Error: ${e}.cursor must be a non-empty string`);M3(t.payload,`${e}.payload`)},JE=(t,e,{cursor:r=!1}={})=>{ho(t,e),$i(t,new Set(["fill","alpha","soundSrc","soundVolume","payload",...r?["cursor"]:[]]),e),t.fill!==void 0&&c_(t.fill,`${e}.fill`),t.alpha!==void 0&&Lm(t.alpha,`${e}.alpha`,0,1),X6(t,e,{cursor:r})},e1=(t,e)=>{ho(t,e),$i(t,new Set(["payload"]),e),M3(t.payload,`${e}.payload`)},Y6=(t,e)=>{if(ho(t,e),$i(t,new Set(["start","move","end"]),e),!t.start&&!t.move&&!t.end)throw new Error(`Input Error: ${e} must define start, move, or end`);for(let r of["start","move","end"])t[r]!==void 0&&e1(t[r],`${e}.${r}`)},j6=(t,e)=>{ho(t,e),$i(t,new Set(["width","color","alpha"]),e),t.width!==void 0&&s_(t.width,`${e}.width`),t.color!==void 0&&a_(t.color,`${e}.color`),t.alpha!==void 0&&Lm(t.alpha,`${e}.alpha`,0,1)},q6=(t,e)=>{ho(t,e),$i(t,new Set(["x","y","quality","kernelSize","repeatEdgePixels"]),e)},P3=(t,e="rect")=>{if(ho(t,e),$i(t,G6,e),typeof t.id!="string"||t.id.length===0)throw new Error(`Input Error: ${e}.id must be a non-empty string`);if(t.type!=="rect")throw new Error(`Input Error: ${e}.type must be "rect"`);Om(t.width,`${e}.width`),Om(t.height,`${e}.height`);for(let r of["x","y","anchorX","anchorY","originX","originY","rotation"])ZE(t[r],`${e}.${r}`);for(let r of["scaleX","scaleY"])ZE(t[r],`${e}.${r}`);t.alpha!==void 0&&Lm(t.alpha,`${e}.alpha`,0,1),t.fill!==void 0&&c_(t.fill,`${e}.fill`),t.border!==void 0&&j6(t.border,`${e}.border`),t.cornerRadius!==void 0&&W6(t.cornerRadius,`${e}.cornerRadius`),t.blur!==void 0&&q6(t.blur,`${e}.blur`),t.hover!==void 0&&JE(t.hover,`${e}.hover`,{cursor:!0}),t.click!==void 0&&JE(t.click,`${e}.click`),t.rightClick!==void 0&&JE(t.rightClick,`${e}.rightClick`),t.drag!==void 0&&Y6(t.drag,`${e}.drag`),t.scrollUp!==void 0&&e1(t.scrollUp,`${e}.scrollUp`),t.scrollDown!==void 0&&e1(t.scrollDown,`${e}.scrollDown`)};var l_=t=>typeof t=="number"&&Number.isFinite(t)?Math.max(0,t):0,K6=(t,e,r)=>{let n=vl(t),i=l_(e),o=l_(r),s=n.topLeft+n.topRight,a=n.bottomLeft+n.bottomRight,c=n.topLeft+n.bottomLeft,l=n.topRight+n.bottomRight,u=Math.min(1,s>0?i/s:1,a>0?i/a:1,c>0?o/c:1,l>0?o/l:1);return Object.fromEntries(Object.entries(n).map(([d,f])=>[d,Math.max(0,f*u)]))},Q6=(t,e,r,n)=>{let i=l_(e),o=l_(r),s=K6(n,i,o);return Object.values(s).every(a=>a===0)?(t.rect(0,0,i,o),t):(t.moveTo(s.topLeft,0).lineTo(i-s.topRight,0),s.topRight>0&&t.quadraticCurveTo(i,0,i,s.topRight),t.lineTo(i,o-s.bottomRight),s.bottomRight>0&&t.quadraticCurveTo(i,o,i-s.bottomRight,o),t.lineTo(s.bottomLeft,o),s.bottomLeft>0&&t.quadraticCurveTo(0,o,0,o-s.bottomLeft),t.lineTo(0,s.topLeft),s.topLeft>0&&t.quadraticCurveTo(0,0,s.topLeft,0),t.closePath(),t)},C3=(t,e,r=e)=>{t.clear(),Q6(t,e.width,e.height,e.cornerRadius),t.fill(i_(t,e.fill,r)),e.border?.width>0&&t.stroke({color:e.border.color,alpha:e.border.alpha,width:e.border.width})};var Gi="_routeGraphicsRectAppearance",J6=["rightClick","click","hover"],I3=(t,e)=>{for(let r of J6)if(t.active[r]&&t.interactionElement?.[r]?.[e]!==void 0)return t.interactionElement[r][e];return e==="fill"?t.styleRuntime.state.fill:t._baseAlpha},k3=(t,e)=>{t.alpha=I3(e,"alpha")},Ld=(t,e)=>{let n={...e.styleRuntime.state,fill:I3(e,"fill")};C3(t,n,{...e.element,...n}),k3(t,e)},Um=(t,e,r)=>{let n=t[Gi];if(n)n.element=e,n.interactionElement=e,n.styleRuntime=r;else{let i={displayObject:t,element:e,interactionElement:e,styleRuntime:r,_baseAlpha:e.alpha??1,active:{hover:!1,click:!1,rightClick:!1},sync(o,s){this.element=o,this.interactionElement=o,this.styleRuntime=s,this._baseAlpha=o.alpha??1,Ld(t,n)},syncInteractions(o){this.interactionElement=o,Ld(t,n)},setInteractionActive(o,s){this.active[o]!==s&&(this.active[o]=s,Ld(t,n))},notifyBaseStyleChange(){Ld(t,n)},apply(){Ld(t,n)},destroy(){t[Gi]===n&&delete t[Gi]}};n=new Proxy(i,{get(o,s,a){return s==="baseAlpha"?o._baseAlpha:Reflect.get(o,s,a)},set(o,s,a,c){return s==="baseAlpha"?(o._baseAlpha=a,k3(t,n),!0):Reflect.set(o,s,a,c)}}),t[Gi]=n,Ld(t,n)}return n},R3=(t,e,r)=>{let n=t?.[Gi];return n?(n.sync(e,r),n):Um(t,e,r)},B3=(t,e)=>{t?.[Gi]?.syncInteractions(e)},u_=t=>{t?.[Gi]?.notifyBaseStyleChange()},qo=(t,e,r)=>{t?.[Gi]?.setInteractionActive(e,r)};var t1=t=>{t?.[Gi]?.destroy()};var Ka=t=>t==="translateX"||t==="translateY",O3=(t,e,r)=>typeof r!="string"?r:r==="alpha"&&t?.[Gi]?[Gi,"baseAlpha"]:r.startsWith("rect.")?["_routeGraphicsRectStyle",r]:e[r]??r,Ud=(t,e,r,n)=>{let i=O3(t,r,e);if(typeof i=="string"){let s=t[i];return s===void 0?n:e==="rotation"?Fm(s):s}let o=t;for(let s of i){if(o==null)return n;o=o[s]}return o===void 0?n:e==="rotation"?Fm(o):o},Z6=(t,e,r,n)=>{let i=O3(t,r,e),o=e==="rotation"?bl(n):n;if(typeof i=="string")return t[i]=o,t;let s=t;for(let a=0;a<i.length-1;a++){let c=i[a];c in s||(s[c]={}),s=s[c]}return s[i[i.length-1]]=o,t},F3=t=>typeof t=="number"&&Number.isFinite(t),ej=t=>{let e=t?.getLocalBounds?.();return e?.rectangle??e??null},D3=(t,e)=>{let r=e==="x"?t?.width:t?.height;if(F3(r)&&r>0)return r;let n=ej(t),i=e==="x"?n?.width:n?.height,o=e==="x"?t?.scale?.x:t?.scale?.y;return F3(i)&&i>0?Math.abs(i*(o??1)):0},Jn=t=>({x:t?.x??0,y:t?.y??0,width:D3(t,"x"),height:D3(t,"y")}),r1=({object:t,property:e,propertyPathMap:r,subjectState:n,defaultValue:i=0})=>e==="translateX"||e==="translateY"?i:Ud(t,e,r,i),Gs=({object:t,property:e,propertyPathMap:r,subjectState:n,value:i})=>{if(e==="translateX")return t.x=n.x+i*n.width,t;if(e==="translateY")return t.y=n.y+i*n.height,t;let o=Z6(t,e,r,i);return(e==="scaleX"||e==="scaleY")&&Dm(t),o};var n1=new WeakMap,Zn=(t,e)=>{let r=n1.get(t);if(!r){r={cleanups:new Set,disposed:!1},n1.set(t,r);let o=t.destroy;t.destroy=function(...s){return tj(this),o.apply(this,s)}}let n=!1,i=()=>{n||(n=!0,r.cleanups.delete(i),e())};return r.disposed||t.destroyed?i():r.cleanups.add(i),i},tj=t=>{let e=n1.get(t);if(!(!e||e.disposed)){e.disposed=!0;for(let r of[...e.cleanups])try{r()}catch{}}};var rj="8.10.2",nj=["uOutputFrame","uInputSize","uInputPixel","uInputClamp","uGlobalFrame","uOutputTexture"],ij=({filterManager:t,filter:e,input:r,output:n})=>{let i=[],o=t?._filterStack,s=t?._filterStackIndex,a=t?._filterGlobalUniforms,c=t?._globalFilterBindGroup,l=t?.renderer,u=Array.isArray(o)&&Number.isInteger(s)?o[s]:null;if(Array.isArray(o)||i.push("_filterStack"),Number.isInteger(s)||i.push("_filterStackIndex"),a?.uniforms||i.push("_filterGlobalUniforms"),typeof c?.setResource!="function"&&i.push("_globalFilterBindGroup"),u?.bounds||i.push("active filter stack entry"),nj.some(d=>!a?.uniforms?.[d])&&i.push("global filter uniform layout"),(!l?.renderTarget?.rootRenderTarget?.colorTexture?.source||typeof l.renderTarget.getRenderTarget!="function"||typeof l.renderTarget.bind!="function")&&i.push("render target system"),typeof l?.encoder?.draw!="function"&&i.push("renderer encoder"),(!e?._state||!e?.groups)&&i.push("filter draw state"),(!r?.frame||!r?.source?.style)&&i.push("filter input texture"),n==null&&i.push("filter output surface"),i.length>0)throw new Error(`Custom shader meshes are incompatible with the installed Pixi runtime. Route Graphics' Pixi ${rj} adapter could not resolve: ${i.join(", ")}.`);return{filterStack:o,filterStackIndex:s,filterUniforms:a,globalFilterBindGroup:c,renderer:l,filterData:u}},L3=({filterManager:t,filter:e,geometry:r,input:n,output:i,clear:o})=>{let{filterStack:s,filterStackIndex:a,filterUniforms:c,globalFilterBindGroup:l,renderer:u,filterData:d}=ij({filterManager:t,filter:e,input:n,output:i}),f=d.bounds,h=Ze.shared.set(0,0),m=d.outputRenderSurface===i,p=u.renderTarget.rootRenderTarget.colorTexture.source.resolution,g=a-1;for(;g>0&&s[g].skip;)g--;g>0&&s[g].inputTexture&&(p=s[g].inputTexture.source.resolution);let x=c.uniforms,b=x.uOutputFrame,w=x.uInputSize,S=x.uInputPixel,_=x.uInputClamp,T=x.uGlobalFrame,v=x.uOutputTexture;if(m){let F=a;for(;F>0;){F--;let R=s[F];if(!R.skip){h.x=R.bounds.minX,h.y=R.bounds.minY;break}}b[0]=f.minX-h.x,b[1]=f.minY-h.y}else b[0]=0,b[1]=0;b[2]=n.frame.width,b[3]=n.frame.height,w[0]=n.source.width,w[1]=n.source.height,w[2]=1/w[0],w[3]=1/w[1],S[0]=n.source.pixelWidth,S[1]=n.source.pixelHeight,S[2]=1/S[0],S[3]=1/S[1],_[0]=.5*S[2],_[1]=.5*S[3],_[2]=n.frame.width*w[2]-.5*S[2],_[3]=n.frame.height*w[3]-.5*S[3];let C=u.renderTarget.rootRenderTarget.colorTexture;T[0]=h.x*p,T[1]=h.y*p,T[2]=C.source.width*p,T[3]=C.source.height*p,i instanceof X&&(i.source.resource=null);let M=u.renderTarget.getRenderTarget(i);if(u.renderTarget.bind(i,!!o),i instanceof X?(v[0]=i.frame.width,v[1]=i.frame.height):(v[0]=M.width,v[1]=M.height),v[2]=M.isRoot?-1:1,c.update(),u.renderPipes.uniformBatch){let F=u.renderPipes.uniformBatch.getUboResource(c);l.setResource(F,0)}else l.setResource(c,0);l.setResource(n.source,1),l.setResource(n.source.style,2),e.groups[0]=l,u.encoder.draw({geometry:r,shader:e,state:e._state,topology:"triangle-list"}),u.type===Ft.WEBGL&&u.renderTarget.finishRenderPass()};var Qa=(t,e)=>{let r=t.replace(/(\bfn\s+mainVertex\s*\([\s\S]*?)(\)\s*->)/,"$1 $2");return{name:e,vertex:{source:r,entryPoint:"mainVertex"},fragment:{source:r,entryPoint:"mainFragment"}}};var i1="__routeGraphicsManagedFilters",oj=["shadow","blur","shader"],sj=t=>(t[i1]||Object.defineProperty(t,i1,{value:new Map,enumerable:!1,configurable:!0}),t[i1]),aj=t=>t.filters?Array.isArray(t.filters)?t.filters:[t.filters]:[],d_=t=>t?Array.isArray(t)?t.filter(Boolean):[t]:[],cj=(t,e,r)=>{let n=new Set;for(let a of e.values())for(let c of d_(a))n.add(c);for(let a of d_(r))n.add(a);let i=aj(t).filter(a=>!n.has(a)),s=[...oj.flatMap(a=>d_(e.get(a))),...i];t.filters=s.length>0?s:null},lj=t=>{for(let e of d_(t))e.destroy?.()},Tl=(t,e,r)=>{let n=sj(t),i=n.get(e);r?n.set(e,r):n.delete(e),cj(t,n,i),i&&i!==r&&lj(i)};var U3=/^[a-z][A-Za-z0-9]*$/;var uj=new Set(["shader"]),$3=new Set(["normal","add","multiply","screen"]),h_=new Set(["clamp","repeat"]),dj=new Set(["on","off","inherit"]),z3=new Set(["type","id","parameters","uniforms","textures","pipeline","mesh","padding","resolution","antialias","clipToViewport","time","source","passes"]),hj=new Set([...z3,"tween"]),fj=new Set(["id","source","uniforms","textures","pipeline","mesh","padding","resolution","antialias","clipToViewport","time"]),pj=new Set(["blend","textureWrap","mipmap"]),mj=new Set(["grid"]),gj=new Set(["webgl","webgpu"]),yj=new Set(["vertex","fragment"]),xj=new Set(["source"]),_j=new Set(["src","wrap","mipmap"]),bj=new Set(["type","value"]),W3=new WeakMap,G3=new Map([["f32","f32"],["vec2","vec2<f32>"],["vec2<f32>","vec2<f32>"],["vec3","vec3<f32>"],["vec3<f32>","vec3<f32>"],["vec4","vec4<f32>"],["vec4<f32>","vec4<f32>"],["mat3","mat3x3<f32>"],["mat3x3<f32>","mat3x3<f32>"],["mat4","mat4x4<f32>"],["mat4x4<f32>","mat4x4<f32>"]]),wj=new Map([["f32",1],["vec2<f32>",2],["vec3<f32>",3],["vec4<f32>",4],["mat3x3<f32>",9],["mat4x4<f32>",16]]),Sj=new Set(["uTexture","uPrevTexture","uNextTexture","uNextTextureMatrix","uNextTextureClamp","uMaskTexture","uProgress","uTime","uResolution","uSampler","GlobalFilterUniforms","ShaderUniforms","VSOutput","gfu","shaderUniforms","mainVertex","mainFragment","uInputSize","uInputPixel","uInputClamp","uOutputFrame","uGlobalFrame","uOutputTexture"]),X3=t=>!!t&&typeof t=="object"&&!Array.isArray(t),$d=t=>typeof t=="number"&&Number.isFinite(t),Ko=(t,e)=>{if(!X3(t))throw new Error(`Input Error: ${e} must be an object`)},Ns=(t,e,r)=>{for(let n of Object.keys(t))if(!r.has(n))throw new Error(`Input Error: ${e}.${n} is not supported`)},Y3=(t,e)=>(W3.set(t,e),t),El=(t,e="shader")=>W3.get(t)??e,Ja=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new Error(`Input Error: ${e} must be a non-empty string`)},j3=(t,e)=>{if(!U3.test(t))throw new Error(`Input Error: ${e} must match ${U3.source}`)},q3=t=>t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,""),N3=t=>/\bvoid\s+main\s*\(/.test(q3(t)),V3=(t,e,r)=>new RegExp(`@${e}\\s+fn\\s+${r}\\s*\\(`).test(q3(t)),K3=t=>t.charAt(0).toUpperCase()+t.slice(1),s1=t=>`u${K3(t)}`,Q3=t=>`u${K3(t)}Texture`,vj=t=>`${Q3(t)}Sampler`,o1=({key:t,symbol:e,path:r,symbols:n,kind:i})=>{if(Sj.has(e))throw new Error(`Input Error: ${r}.${t} generates reserved shader symbol ${e}`);if(n.has(e))throw new Error(`Input Error: ${r}.${t} generates duplicate shader symbol ${e}`);n.set(e,{key:t,kind:i})},Tj=(t,e)=>{if($d(t))return"f32";if(!Array.isArray(t)||!t.every($d))throw new Error(`Input Error: ${e} must be a finite number or a numeric array`);switch(t.length){case 2:return"vec2<f32>";case 3:return"vec3<f32>";case 4:return"vec4<f32>";case 9:return"mat3x3<f32>";case 16:return"mat4x4<f32>";default:throw new Error(`Input Error: ${e} numeric arrays must have length 2, 3, 4, 9, or 16`)}},Ej=(t,e)=>{Ns(t,e,bj);let r=G3.get(t.type);if(!r)throw new Error(`Input Error: ${e}.type must be one of: ${Array.from(G3.keys()).join(", ")}`);let n=wj.get(r),i=t.value;if(n===1){if(!$d(i))throw new Error(`Input Error: ${e}.value must be a finite number`);return{type:r,value:i}}if(!Array.isArray(i)||i.length!==n||!i.every($d))throw new Error(`Input Error: ${e}.value must be a ${n}-number array for ${r}`);return{type:r,value:[...i]}},Aj=(t,e)=>{if(X3(t)){if(t.type===void 0||t.value===void 0)throw new Error(`Input Error: ${e} typed values must define type and value`);return Ej(t,e)}let r=Tj(t,e);return{type:r,value:r==="f32"?t:[...t]}},H3=(t,e)=>{for(let r of e)t.set(r.symbol,{key:r.key,kind:r.role??"uniform"}),r.samplerSymbol&&t.set(r.samplerSymbol,{key:r.key,kind:"texture sampler"})},J3=(t,e,r,n="uniform")=>t===void 0?[]:(Ko(t,e),Object.keys(t).sort().map(i=>{j3(i,`${e}.${i}`);let o=s1(i);return o1({key:i,symbol:o,path:e,symbols:r,kind:n}),{key:i,symbol:o,role:n,...Aj(t[i],`${e}.${i}`)}})),Mj=(t,e,r,n)=>{if(typeof t=="string")return Ja(t,e),n?{src:t}:{src:t,wrap:r.textureWrap,mipmap:r.mipmap};Ko(t,e),Ns(t,e,_j),Ja(t.src,`${e}.src`);let i=t.wrap??r.textureWrap;if(!h_.has(i))throw new Error(`Input Error: ${e}.wrap must be one of: ${Array.from(h_).join(", ")}`);let o=t.mipmap??r.mipmap;if(typeof o!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{src:t.src,...t.wrap!==void 0||!n?{wrap:i}:{},...t.mipmap!==void 0||!n?{mipmap:o}:{}}},Z3=({textures:t,path:e,symbols:r,maxTextures:n,pipeline:i,preserveInheritedSampling:o=!1})=>{if(t===void 0)return[];Ko(t,e);let s=Object.keys(t).sort();if(s.length>n)throw new Error(`Input Error: ${e} supports at most ${n} custom textures`);return s.map(a=>{j3(a,`${e}.${a}`);let c=Q3(a),l=vj(a);return o1({key:a,symbol:c,path:e,symbols:r,kind:"texture"}),o1({key:a,symbol:l,path:e,symbols:r,kind:"texture sampler"}),{key:a,symbol:c,samplerSymbol:l,...Mj(t[a],`${e}.${a}`,i,o)}})},e$=(t,e,r={})=>{t!==void 0&&(Ko(t,e),Ns(t,e,pj));let n=t?.blend??r.blend??"normal";if(!$3.has(n))throw new Error(`Input Error: ${e}.blend must be one of: ${Array.from($3).join(", ")}`);let i=t?.textureWrap??r.textureWrap??"clamp";if(!h_.has(i))throw new Error(`Input Error: ${e}.textureWrap must be one of: ${Array.from(h_).join(", ")}`);let o=t?.mipmap??r.mipmap??!1;if(typeof o!="boolean")throw new Error(`Input Error: ${e}.mipmap must be a boolean`);return{blend:n,textureWrap:i,mipmap:o}},Pj=(t,e)=>{if(Ko(t,e),Ns(t,e,gj),Ko(t.webgl,`${e}.webgl`),Ns(t.webgl,`${e}.webgl`,yj),Ko(t.webgpu,`${e}.webgpu`),Ns(t.webgpu,`${e}.webgpu`,xj),t.webgl.vertex!==void 0&&(Ja(t.webgl.vertex,`${e}.webgl.vertex`),!N3(t.webgl.vertex)))throw new Error(`Input Error: ${e}.webgl.vertex must define void main()`);if(Ja(t.webgl.fragment,`${e}.webgl.fragment`),Ja(t.webgpu.source,`${e}.webgpu.source`),!N3(t.webgl.fragment))throw new Error(`Input Error: ${e}.webgl.fragment must define void main()`);if(!V3(t.webgpu.source,"vertex","mainVertex")||!V3(t.webgpu.source,"fragment","mainFragment"))throw new Error(`Input Error: ${e}.webgpu.source must define mainVertex and mainFragment`);return{webgl:{...t.webgl.vertex!==void 0?{vertex:t.webgl.vertex}:{},fragment:t.webgl.fragment},webgpu:{source:t.webgpu.source}}},t$=(t,e,r)=>{let n=t??r;if(n===void 0)return{grid:[1,1]};if(Ko(n,e),Ns(n,e,mj),!Array.isArray(n.grid)||n.grid.length!==2||!n.grid.every(i=>Number.isInteger(i)&&i>=1&&i<=512))throw new Error(`Input Error: ${e}.grid must be [columns, rows] with integers from 1 to 512`);return{grid:[n.grid[0],n.grid[1]]}},r$=(t,e,r={})=>{let n=t.padding??r.padding??0;if(!$d(n)||n<0)throw new Error(`Input Error: ${e}.padding must be a finite number >= 0`);let i=t.resolution??r.resolution??1;if(i!=="inherit"&&(!$d(i)||i<=0))throw new Error(`Input Error: ${e}.resolution must be "inherit" or a finite number > 0`);let o=t.antialias??r.antialias??"off";if(typeof o=="boolean"&&(o=o?"on":"off"),!dj.has(o))throw new Error(`Input Error: ${e}.antialias must be on, off, inherit, or a boolean`);let s=t.clipToViewport??r.clipToViewport??!0;if(typeof s!="boolean")throw new Error(`Input Error: ${e}.clipToViewport must be a boolean`);let a=t.time??r.time??!1;if(typeof a!="boolean")throw new Error(`Input Error: ${e}.time must be a boolean`);return{padding:n,resolution:i,antialias:o,clipToViewport:s,time:a}},Cj=({pass:t,index:e,path:r,parameters:n,commonTextures:i,effectPipeline:o,effectOptions:s,effectMesh:a,textureLimit:c})=>{Ko(t,r),Ns(t,r,fj);let l=t.id??`pass${e+1}`;Ja(l,`${r}.id`);let u=e$(t.pipeline,`${r}.pipeline`,o),d=new Map;H3(d,n),H3(d,i);let f=J3(t.uniforms,`${r}.uniforms`,d),h=c-i.length,m=Z3({textures:t.textures,path:`${r}.textures`,symbols:d,maxTextures:h,pipeline:u}),p=i.map(g=>({...g,wrap:g.wrap??u.textureWrap,mipmap:g.mipmap??u.mipmap}));return Y3({id:l,source:Pj(t.source,`${r}.source`),uniforms:[...n,...f].sort((g,x)=>g.key.localeCompare(x.key)),textures:[...p,...m].sort((g,x)=>g.key.localeCompare(x.key)),pipeline:u,mesh:t$(t.mesh,`${r}.mesh`,a),...r$(t,r,s)},r)},n$=({shader:t,path:e,requireId:r,textureLimit:n,allowTween:i=!1})=>{if(Ko(t,e),Ns(t,e,i?hj:z3),!uj.has(t.type))throw new Error(`Input Error: ${e}.type must be shader`);let o={type:"shader"};if(r?(Ja(t.id,`${e}.id`),o.id=t.id):t.id!==void 0&&(Ja(t.id,`${e}.id`),o.id=t.id),t.parameters!==void 0&&t.uniforms!==void 0)throw new Error(`Input Error: ${e} cannot define both parameters and legacy uniforms`);let s=new Map;o.parameters=J3(t.parameters??t.uniforms,t.parameters!==void 0?`${e}.parameters`:`${e}.uniforms`,s,"parameter"),o.uniforms=o.parameters,o.pipeline=e$(t.pipeline,`${e}.pipeline`),o.textures=Z3({textures:t.textures,path:`${e}.textures`,symbols:s,maxTextures:n,pipeline:o.pipeline,preserveInheritedSampling:!0}),o.mesh=t$(t.mesh,`${e}.mesh`),Object.assign(o,r$(t,e));let a=t.passes!==void 0;if(a&&t.source!==void 0)throw new Error(`Input Error: ${e} cannot define both source and passes`);let c;if(a){if(!Array.isArray(t.passes)||t.passes.length===0)throw new Error(`Input Error: ${e}.passes must be a non-empty array`);c=t.passes}else c=[{id:"main",source:t.source}];let l=new Set;return o.passes=c.map((u,d)=>{let f=Cj({pass:u,index:d,path:a?`${e}.passes[${d}]`:e,parameters:o.parameters,commonTextures:o.textures,effectPipeline:o.pipeline,effectOptions:o,effectMesh:o.mesh,textureLimit:n});if(l.has(f.id))throw new Error(`Input Error: ${e}.passes[${d}].id must be unique`);return l.add(f.id),f}),Y3(o,e)},i$=(t,e="filters")=>{if(t===void 0)return;if(!Array.isArray(t))throw new Error(`Input Error: ${e} must be an array`);let r=new Set;return t.map((n,i)=>{let o=n$({shader:n,path:`${e}[${i}]`,requireId:!0,textureLimit:7});if(r.has(o.id))throw new Error(`Input Error: ${e}[${i}].id must be unique within filters`);return r.add(o.id),o})},a1=(t,e="compositor")=>n$({shader:t,path:e,requireId:!1,textureLimit:6,allowTween:!0});var c1=t=>JSON.stringify(t??null,function(r,n){return r==="value"&&this?.role==="parameter"?null:n});var u1="__routeGraphicsShaderFilters",Al="__routeGraphicsShaderProgress",$m="__routeGraphicsShaderTime",o$="__routeGraphicsShaderDestroyCleanup",d1=`
1629
1629
  precision mediump float;
1630
1630
 
1631
1631
  in vec2 aPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "route-graphics",
3
- "version": "1.44.3",
3
+ "version": "1.44.4",
4
4
  "description": "A 2D graphics rendering interface that takes JSON input and renders pixels using PixiJS",
5
5
  "main": "dist/RouteGraphics.js",
6
6
  "type": "module",