route-graphics 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RouteGraphics.js +1 -1
- package/package.json +1 -1
package/dist/RouteGraphics.js
CHANGED
|
@@ -1141,7 +1141,7 @@ ${u}`)}});return await Promise.all(h),o?s[n[0].src]:s}async unload(t){let i=Ie(t
|
|
|
1141
1141
|
};
|
|
1142
1142
|
|
|
1143
1143
|
})();
|
|
1144
|
-
`,Oo=null,mh=class{constructor(){Oo||(Oo=URL.createObjectURL(new Blob([lk],{type:"application/javascript"}))),this.worker=new Worker(Oo)}};mh.revokeObjectURL=function(){Oo&&(URL.revokeObjectURL(Oo),Oo=null)};var P1=0,Cg,Rg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Uo;e.addEventListener("message",i=>{e.terminate(),Uo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Cg===void 0&&(Cg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Cg&&(this._createdWorkers++,t=new mh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[P1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:P1++,id:i})}},Mg=new Rg;ii();var ck=[".jpeg",".jpg",".png",".webp",".avif"],uk=["image/jpeg","image/png","image/webp","image/avif"];async function dk(r,t){let e=await z.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var vu={name:"loadTextures",extension:{type:v.LoadParser,priority:pe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return lr(r,uk)||cr(r,ck)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mg.isImageBitmapSupported()?i=await Mg.loadImageBitmap(r,t):i=await dk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Fo(r),...t.data});return ko(s,e,r)},unload(r){r.destroy(!0)}};C();$f();zf();var C1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fk=C1.map(r=>`video/${r.substring(1)}`);function pk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=gk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function mk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function gk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var R1={name:"loadVideo",extension:{type:v.LoadParser,name:"loadVideo"},test(r){let t=lr(r,fk),e=cr(r,C1);return t||e},async load(r,t,e){let i={...Ys.defaultOptions,resolution:t.data?.resolution||Fo(r),alphaMode:t.data?.alphaMode||await Yl(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),i.muted===!0&&(s.muted=!0),pk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Ys.MIME_TYPES[h]||`video/${h}`}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Ys({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await mk(s),h(ko(c,e,r))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(r){r.destroy(!0)}};C();$s();C();$s();var Tu={extension:{type:v.ResolveParser,name:"resolveTexture"},test:vu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var M1={extension:{type:v.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Tu.parse};$s();Un();Wl();var Su=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new bu,this.cache=bt,this._backgroundLoader=new yu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=es(t),s=Ie(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),bt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ie(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ie(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},ur=new Su;k.handleByList(v.LoadParser,ur.loader.parsers).handleByList(v.ResolveParser,ur.resolver.parsers).handleByList(v.CacheParser,ur.cache.parsers).handleByList(v.DetectionParser,ur.detections);k.add(m1,y1,g1,T1,_1,b1,v1,S1,E1,w1,A1,vu,R1,p1,f1,Tu,M1);var B1={loader:v.LoadParser,resolver:v.ResolveParser,cache:v.CacheParser,detection:v.DetectionParser};k.handle(v.Asset,r=>{let t=r.ref;Object.entries(B1).filter(([e])=>!!t[e]).forEach(([e,i])=>k.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(B1).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});_t();Bn();zs();Dn();var gh=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof A?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ne.shared.add(this.update,this,Br.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof A)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ne.shared.add(this.update,this),this._isConnectedToTicker=!0))}};El();Ht();Vl();var Eu=class extends Ei{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new _e({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function I1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(W(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ha();cs();var Er=class extends Eu{constructor(...t){let e=I1(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ii();_t();Yf();_r();cm();Dn();ha();cs();Df();Ee();var xk=$i(uc(),1);k.add(NS,VS);var yk=new(window.AudioContext||window.webkitAudioContext),Bg={},_k=async(r,t)=>{if(!Bg[r]&&t.byteLength!==0)try{let e=await yk.decodeAudioData(t);Bg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},bk=r=>Bg[r],Lo={load:_k,getAsset:bk};var le=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Ig=({type:r,animate:t})=>({type:r,animate:t});var Fg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var F1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},kg={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var fs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ue={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var dr=(r,t)=>{let e={fill:t?.fill??Ue.fill,fontFamily:t?.fontFamily??Ue.fontFamily,fontSize:t?.fontSize??Ue.fontSize,align:t?.align??Ue.align,lineHeight:t?.lineHeight??Ue.lineHeight,wordWrap:t?.wordWrap??Ue.wordWrap,breakWords:t?.breakWords??Ue.breakWords,strokeColor:t?.strokeColor??Ue.strokeColor,strokeWidth:t?.strokeWidth??Ue.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ue.wordWrapWidth};r.style=e};async function et(r,t,{app:e,element:i,animations:s,signal:o,eventHandler:n}){let a=[];for(let h of s)if(h.targetId===r){let l=t.find(c=>c.type===h.type);if(!l)throw new Error(`No animation plugin found for type: ${h.type}`);a.push(l.animate({app:e,element:i,animation:h,signal:o,eventHandler:n}))}return Promise.all(a)}var k1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new Er({label:e.id}),l=()=>{h.text=e.content,dr(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click,f=e?.rightClick,p={isHovering:!1,isPressed:!1,isRightPressed:!1},m=({isHovering:g,isPressed:b,isRightPressed:y})=>{y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):g&&u?.textStyle?dr(h,u.textStyle):dr(h,e.textStyle)};if(u){let{cursor:g,soundSrc:b,actionPayload:y}=u;h.eventMode="static";let _=()=>{p.isHovering=!0,y&&s&&s("hover",{_event:{id:h.label},...y}),g&&(h.cursor=g),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1}),m(p)},T=()=>{p.isHovering=!1,h.cursor="auto",m(p)};h.on("pointerover",_),h.on("pointerout",T)}if(d){let{soundSrc:g,actionPayload:b}=d;h.eventMode="static";let y=()=>{p.isPressed=!0,m(p)},_=()=>{p.isPressed=!1,m(p),b&&s&&s("click",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isPressed=!1,m(p)};h.on("pointerdown",y),h.on("pointerup",_),h.on("pointerupoutside",T)}if(f){let{soundSrc:g,actionPayload:b}=f;h.eventMode="static";let y=()=>{p.isRightPressed=!0,m(p)},_=()=>{p.isRightPressed=!1,m(p),b&&s&&s("rightclick",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isRightPressed=!1,m(p)};h.on("rightdown",y),h.on("rightup",_),h.on("rightupoutside",T)}t.addChild(h),i&&i.length>0&&(a=!1,await et(e.id,o,{app:r,element:h,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",c)};var G1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.text=i.content,dr(h,i.textStyle),h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m={isHovering:!1,isPressed:!1,isRightPressed:!1},g=({isHovering:b,isPressed:y,isRightPressed:_})=>{_&&p?.textStyle?dr(h,p.textStyle):y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):dr(h,i.textStyle)};if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{m.isHovering=!0,_&&s&&s("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1}),g(m)},E=()=>{m.isHovering=!1,h.cursor="auto",g(m)};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{m.isPressed=!0,g(m)},T=()=>{m.isPressed=!1,g(m),y&&s&&s("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isPressed=!1,g()};h.on("pointerdown",_),h.on("pointerup",T),h.on("pointerupoutside",E)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{m.isRightPressed=!0,g(m)},T=()=>{m.isRightPressed=!1,g(m),y&&s&&s("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isRightPressed=!1,g(m)};h.on("rightdown",_),h.on("rightup",T),h.on("rightupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await et(i.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l=!0),c(),a.removeEventListener("abort",u))};var U1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var O1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var Ae=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===fs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=O1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var L1=({state:r})=>{let t={...Ue,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let{width:e,height:i}=qt.measureText(r.content??"",new Mt(t)),s=Math.round(e),o=Math.round(i);return{...Ae({...r,width:s,height:o}),content:r.content??"",textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var vk=le({type:"text",add:k1,update:G1,delete:U1,parse:L1});var D1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,alpha:p}=e,m=new he;m.label=a;let g=!0,b=()=>{m.clear(),m.rect(0,0,Math.round(c),Math.round(u)).fill(d),m.x=Math.round(h),m.y=Math.round(l),m.alpha=p,f&&m.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},y=async()=>{g||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S=e?.scroll,w=e?.drag;if(_){let{cursor:M,soundSrc:P,actionPayload:R}=_;m.eventMode="static";let B=()=>{R&&o&&o("hover",{_event:{id:m.label},...R}),M&&(m.cursor=M),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{m.cursor="auto"};m.on("pointerover",B),m.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:P}=T;m.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:m.label},...P}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};m.on("pointerup",R)}if(E){let{soundSrc:M,actionPayload:P}=E;m.eventMode="static";let R=()=>{P&&o&&o("rightclick",{_event:{id:m.label},...P}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})};m.on("rightclick",R)}if(S){m.eventMode="static";let M=P=>{if(P.deltaY<0&&S.up){let{actionPayload:R}=S.up;R&&o&&o("scrollup",{_event:{id:m.label},...R})}else if(P.deltaY>0&&S.down){let{actionPayload:R}=S.down;R&&o&&o("scrolldown",{_event:{id:m.label},...R})}};m.on("wheel",M)}if(w){let{start:M,end:P,move:R}=w;m.eventMode="static";let B=()=>{m._isDragging=!0,M&&o&&o("drag-start",{_event:{id:m.label},...typeof M?.actionPayload=="object"?M.actionPayload:{}})},F=()=>{m._isDragging=!1,P&&o&&o("drag-end",{_event:{id:m.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},X=L=>{R&&o&&m._isDragging&&o("drag-move",{_event:{id:m.label,x:L.global.x,y:L.global.y},...typeof R?.actionPayload=="object"?R.actionPayload:{}})};m.on("pointerdown",B),m.on("pointerup",F),m.on("globalpointermove",X),m.on("pointerupoutside",F)}t.addChild(m),i&&i.length>0&&(g=!1,await et(a,s,{app:r,element:m,animations:i,signal:n,eventHandler:o})),g=!0,n.removeEventListener("abort",y)};var N1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.clear(),h.rect(0,0,Math.round(i.width),Math.round(i.height)).fill(i.fill),h.x=Math.round(i.x),h.y=Math.round(i.y),h.alpha=i.alpha,i.border&&h.stroke({color:i.border.color,alpha:i.border.alpha,width:Math.round(i.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m=i?.scroll,g=i?.drag;if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{_&&n&&n("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1})},E=()=>{h.cursor="auto"};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{y&&n&&n("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})};h.on("pointerup",_)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{y&&n&&n("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})};h.on("rightclick",_)}if(m){h.eventMode="static";let b=y=>{if(y.deltaY<0&&m.up){let{actionPayload:_}=m.up;_&&n&&n("scrollup",{_event:{id:h.label},..._})}else if(y.deltaY>0&&m.down){let{actionPayload:_}=m.down;_&&n&&n("scrolldown",{_event:{id:h.label},..._})}};h.on("wheel",b)}if(g){let{start:b,end:y,move:_}=g;h.eventMode="static";let T=()=>{h._isDragging=!0,b&&n&&n("drag-start",{_event:{id:h.label},...typeof b?.actionPayload=="object"?b.actionPayload:{}})},E=()=>{h._isDragging=!1,y&&n&&n("drag-end",{_event:{id:h.label},...typeof y?.actionPayload=="object"?y.actionPayload:{}})},S=w=>{_&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:w.global.x,y:w.global.y},...typeof _?.actionPayload=="object"?_.actionPayload:{}})};h.on("pointerdown",T),h.on("pointerup",E),h.on("globalpointermove",S),h.on("pointerupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var H1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var V1=({state:r})=>{let t=Ae(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,cursor:r.cursor??"",fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var Tk=le({type:"rect",add:D1,update:N1,delete:H1,parse:V1});var W1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?A.from(f):A.EMPTY,g=new kt(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},y=async()=>{a||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:M,isPressed:P,isRightPressed:R})=>{if(R&&E?.src){let B=A.from(E.src);g.texture=B}else if(P&&T?.src){let B=A.from(T.src);g.texture=B}else if(M&&_?.src){let B=A.from(_.src);g.texture=B}else g.texture=m};if(_){let{cursor:M,soundSrc:P,actionPayload:R}=_;g.eventMode="static";let B=()=>{S.isHovering=!0,R&&s&&s("hover",{_event:{id:g.label},...R}),M&&(g.cursor=M),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1}),w(S)},F=()=>{S.isHovering=!1,g.cursor="auto",w(S)};g.on("pointerover",B),g.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:P}=T;g.eventMode="static";let R=()=>{S.isPressed=!0,w(S)},B=()=>{S.isPressed=!1,w(S),P&&s&&s("click",{_event:{id:g.label},...P}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isPressed=!1,w(S)};g.on("pointerdown",R),g.on("pointerup",B),g.on("pointerupoutside",F)}if(E){let{soundSrc:M,actionPayload:P}=E;g.eventMode="static";let R=()=>{S.isRightPressed=!0,w(S)},B=()=>{S.isRightPressed=!1,w(S),P&&s&&s("rightclick",{_event:{id:g.label},...P}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isRightPressed=!1,w(S)};g.on("rightdown",R),g.on("rightup",B),g.on("rightupoutside",F)}t.addChild(g),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:g,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",y)};var z1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){let d=i.src?A.from(i.src):A.EMPTY;h.texture=d,h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let f=i?.hover,p=i?.click,m=i?.rightClick,g={isHovering:!1,isPressed:!1,isRightPressed:!1},b=({isHovering:y,isPressed:_,isRightPressed:T})=>{if(T&&m?.src){let E=A.from(m.src);h.texture=E}else if(_&&p?.src){let E=A.from(p.src);h.texture=E}else if(y&&f?.src){let E=A.from(f.src);h.texture=E}else h.texture=d};if(f){let{cursor:y,soundSrc:_,actionPayload:T}=f;h.eventMode="static";let E=()=>{g.isHovering=!0,T&&n&&n("hover",{_event:{id:h.label},...T}),y&&(h.cursor=y),_&&r.audioStage.add({id:`hover-${Date.now()}`,url:_,loop:!1}),b(g)},S=()=>{g.isHovering=!1,h.cursor="auto",b(g)};h.on("pointerover",E),h.on("pointerout",S)}if(p){let{soundSrc:y,actionPayload:_}=p;h.eventMode="static";let T=()=>{g.isPressed=!0,b(g)},E=()=>{g.isPressed=!1,b(g),_&&n&&n("click",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`click-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isPressed=!1,b(g)};h.on("pointerdown",T),h.on("pointerup",E),h.on("pointerupoutside",S)}if(m){let{soundSrc:y,actionPayload:_}=m;h.eventMode="static";let T=()=>{g.isRightPressed=!0,b(g)},E=()=>{g.isRightPressed=!1,b(g),_&&n&&n("rightclick",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isRightPressed=!1,b(g)};h.on("rightdown",T),h.on("rightup",E),h.on("rightupoutside",S)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var $1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var X1=({state:r})=>({...Ae(r),src:r.src??"",alpha:r.alpha??1,cursor:r.cursor??"",...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Sk=le({type:"sprite",add:W1,update:z1,delete:$1,parse:X1});var j1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,volume:p,loop:m,alpha:g}=e,b=A.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=p/1e3,y.muted=!1,y.play();let _=new kt(b);_.label=h;let T=()=>{_.x=Math.round(l),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=g??1},E=async()=>{a||T()};n.addEventListener("abort",E),T(),t.addChild(_),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:_,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",E)};var Y1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){if(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha??1,e.src!==i.src){let d=h.texture.source.resource;d&&d.pause();let f=A.from(i.src);h.texture=f;let p=f.source.resource;p.muted=!1,p.pause(),p.currentTime=0,p.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var q1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{if(a&&!a.destroyed){let u=a.texture.source.resource;u&&u.pause(),t.removeChild(a),a.destroy()}},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var K1=({state:r})=>({...Ae(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Ek=le({type:"video",add:j1,update:Y1,delete:q1,parse:K1});var Z1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:y,step:_,initialValue:T,originX:E,originY:S,hover:w,change:M}=e,P=new xt;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,B=m?A.from(m):A.EMPTY,F=new kt(B);F.label=`${h}-bar`,F.eventMode="static";let X=p?A.from(p):A.EMPTY,L=new kt(X);L.label=`${h}-thumb`,L.eventMode="static";let nt=T??b,D=y-b,$=St=>{let ut=(St-b)/D;g==="horizontal"?(L.x=ut*(F.width-L.width),L.y=(F.height-L.height)/2):(L.x=(F.width-L.width)/2,L.y=ut*(F.height-L.height))},H=()=>{F.width=u,F.height=d;let St=g==="horizontal"?d-R*2:u-R*2,ut=p?A.from(p):A.EMPTY,yt=ut.width,Ft=ut.height,Qt=St/yt,Jt=St/Ft,De=Math.min(Qt,Jt);L.width=yt*De,L.height=Ft*De,$(nt)},U=async()=>{a||H()};n.addEventListener("abort",U),H();let tt=X,vt=B,gt=!1,Dt=St=>{let ut;if(g==="horizontal"){let Ft=St.x-L.width/2;ut=Math.max(0,Math.min(1,Ft/(F.width-L.width)))}else{let Ft=St.y-L.height/2;ut=Math.max(0,Math.min(1,Ft/(F.height-L.height)))}let yt=b+ut*D;return _>0&&(yt=Math.round((yt-b)/_)*_+b,yt=Math.max(b,Math.min(y,yt))),yt},Nt=St=>{let ut=P.toLocal(St.global),yt=Dt(ut);yt!==nt&&(nt=yt,$(nt),M?.actionPayload&&o&&o("change",{_event:{id:h,value:nt},...M.actionPayload}))},Zt=St=>{gt=!0,Nt(St)},oe=St=>{gt&&Nt(St)},Te=()=>{gt&&(gt=!1)};if(P.on("pointerdown",Zt),P.on("globalpointermove",oe),P.on("pointerup",Te),P.on("pointerupoutside",Te),w){let{cursor:St,soundSrc:ut,thumbSrc:yt,barSrc:Ft}=w,Qt=()=>{St&&(F.cursor=St,L.cursor=St),ut&&r.audioStage.add({id:`hover-${Date.now()}`,url:ut,loop:!1}),yt&&(L.texture=A.from(yt)),Ft&&(F.texture=A.from(Ft))},Jt=()=>{gt||(F.cursor="auto",L.cursor="auto",L.texture=tt,F.texture=vt)};P.on("pointerover",Qt),P.on("pointerout",Jt),P.on("pointerupoutside",Jt)}P.addChild(F),P.addChild(L),t.addChild(P),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:P,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",U)};var Q1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let c=h.getChildByLabel(`${i.id}-bar`),u=h.getChildByLabel(`${i.id}-thumb`);if(c&&u){c.width=i.width,c.height=i.height;let d=0,f=i.direction==="horizontal"?i.height-d*2:i.width-d*2,p=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY,m=p.width||16,g=p.height||16,b=f/m,y=f/g,_=Math.min(b,y);if(u.width=m*_,u.height=g*_,e.barSrc!==i.barSrc){let S=i.barSrc?A.from(i.barSrc):A.EMPTY;c.texture=S}if(e.thumbSrc!==i.thumbSrc){let S=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY;u.texture=S}let T=i.max-i.min,E=(i.initialValue-i.min)/T;i.direction==="horizontal"?(u.x=E*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=E*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:y}=i,_=y??p,T=m-p;h.eventMode="static";let E=L=>{let nt=(L-p)/T;b==="horizontal"?(u.x=nt*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=nt*(c.height-u.height))},S=L=>{let nt;if(b==="horizontal"){let $=L.x-u.width/2;nt=Math.max(0,Math.min(1,$/(c.width-u.width)))}else{let $=L.y-u.height/2;nt=Math.max(0,Math.min(1,$/(c.height-u.height)))}let D=p+nt*T;return g>0&&(D=Math.round((D-p)/g)*g+p,D=Math.max(p,Math.min(m,D))),D},w=u.texture,M=c.texture,P=!1,R=L=>{let nt=h.toLocal(L.global),D=S(nt);D!==_&&(_=D,E(_),f?.actionPayload&&s&&s("change",{_event:{id,value:_},...f.actionPayload}))},B=L=>{P=!0,R(L)},F=L=>{P&&R(L)},X=()=>{P&&(P=!1)};if(h.on("pointerdown",B),h.on("globalpointermove",F),h.on("pointerup",X),h.on("pointerupoutside",X),d){let{cursor:L,soundSrc:nt,thumbSrc:D,barSrc:$}=d,H=()=>{L&&(h.cursor=L,u.cursor=L),nt&&r.audioStage.add({id:`hover-${Date.now()}`,url:nt,loop:!1}),D&&(u.texture=A.from(D)),$&&(c.texture=A.from($))},U=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=w,c.texture=M)};h.on("pointerover",H),h.on("pointerout",U),h.on("pointerupoutside",U)}}}};h&&(o&&o.length>0&&await et(e.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l())};var J1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{if(o?.aborted)return;let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy({children:!0})},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var tP=({state:r})=>{let t=Ae(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue??0,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var wk=le({type:"slider",add:Z1,update:Q1,delete:J1,parse:tP});var xh=({container:r,element:t})=>{let e=0,i=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),i=Math.max(n.height+n.y,i)});let s=t.scroll&&t.height&&i>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new xt({label:`${r.label}-content`});[...r.children].forEach(f=>{n.addChild(f)}),r.addChild(n);let h=new he({label:`${r.label}-clip`}).rect(0,0,t.width||e,t.height||i).fill({color:16711680,alpha:0});r.addChild(h),n.mask=h,r.eventMode="static";let l=0,c=0,u=-(i-(t.height||i)),d=-(e-(t.width||e));r.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}},Gg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.removeAllListeners("wheel")};var eP=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new xt;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let y of u){let _=n.find(T=>T.type===y.type);if(!_)throw new Error(`No plugin found for child element type: ${y.type}`);await _.add({app:r,parent:p,element:y,animations:i,eventHandler:s,animationPlugins:o,animateElements:et,elementPlugins:n,signal:a})}d&&xh({container:p,element:e}),i&&i.length>0&&(m=!1,await et(h,o,{app:r,element:p,animations:i,signal:a,eventHandler:s})),m=!0,a.removeEventListener("abort",b)};var rP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of r)i.add(l.id),s.set(l.id,l);for(let l of t)i.add(l.id),o.set(l.id,l);for(let l of i){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var yh=async({app:r,parent:t,prevASTTree:e,nextASTTree:i,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=rP(e,i,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:r,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:r,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:r,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),Ak(t,i)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},Ak=(r,t)=>{r.children=r.children.sort((e,i)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===i.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1}).map((e,i)=>(e.zIndex=i,e))};var iP=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(i)&&(l.x=Math.round(i.x),l.y=Math.round(i.y),l.label=i.id,l.alpha=i.alpha,e.scroll!==i.scroll?i.scroll?xh({container:l,element:i}):Gg({container:l}):i.scroll&&(Gg({container:l}),xh({container:l,element:i})),JSON.stringify(e.children)!==JSON.stringify(i.children)&&await yh({app:r,parent:i.scroll?l.children.find(f=>f.label===`${i.id}-content`):l,nextASTTree:i.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await et(e.id,n,{app:r,element:l,animations:o,signal:h,eventHandler:s})),c=!0,await u(),h.removeEventListener("abort",d))};var sP=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))},c=async()=>{h||l()};o.addEventListener("abort",c),s&&s.length>0&&(h=!1,await et(e.id,i,{app:r,element:a,animations:s,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var oP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let y=0;y<o.length;y++){let _=y<o.length-1?s:0,T=o[y];y>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let E=t.find(S=>S.type===T.type);E&&(T=E.parse({state:T,parserPlugins:t})),e==="horizontal"?(r.width&&T.width+m>r.width&&!i?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+_,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"?(r.height&&T.height+g>r.height&&!i?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+_,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)):(a=Math.max(T.width+T.x,a),h=Math.max(T.height+T.y,h)),n.push(T)}return{...Ae({...r,width:r.width?r.width:a,height:r.height?r.height:h}),children:n,direction:e,gap:s,scroll:i,rotation:r.rotation??0}};var Pk=le({type:"container",add:eP,update:iP,delete:sP,parse:oP});function Do(r,t){let e=r.text.substring(0,t),s=qt.measureText(e,r.style).width;return r.x+s}var Ck=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},r),o=()=>{clearTimeout(s),i(t.reason)};t?.addEventListener("abort",o,{once:!0})}),No=Ck;var nP=async({parent:r,element:t,signal:e,eventHandler:i})=>{let s=t.speed??50,o=t.revealEffect??"typewriter",n=t?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=new xt;c.label=t.id;let u=new kt(A.EMPTY);if(t?.indicator?.revealing?.src){let d=t.indicator.revealing.src?A.from(t.indicator.revealing.src):A.EMPTY;u=new kt(d),u.width=t.indicator.revealing.width??d.width,u.height=t.indicator.revealing.height??d.height}c.addChild(u),t.x!==void 0&&(c.x=Math.round(t.x)),t.y!==void 0&&(c.y=Math.round(t.y)),t.alpha!==void 0&&(c.alpha=t.alpha),r.addChild(c);for(let d=0;d<t.content.length;d++){let f=t.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(e?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new Er({text:"",style:g,x:Math.round(m.x),y:Math.round(m.y)}),y=null;if(m.furigana){let E=new Mt(m.furigana.textStyle);y=new Er({text:"",style:E,x:Math.round(m.furigana.x),y:Math.round(m.furigana.y)}),c.addChild(y)}c.addChild(b);let _=m.text,T=m.furigana?.text||"";if(a||e?.aborted)b.text=_,u.x=Do(b,_.length-1)+n,y&&(y.text=T);else{let E=T.length;for(let S=0;S<_.length;S++){if(e?.aborted)return;b.text=_.substring(0,S+1),u.x=Do(b,S)+n;let w=Math.round((S+1)/_.length*E);if(y&&(y.text=T.substring(0,w)),S<_.length-1)try{await No(h,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(d<t.content.length-1)try{await No(l,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let d=t.indicator.complete.src?A.from(t.indicator.complete.src):A.EMPTY;u.texture=d,u.width=t.indicator.complete.width??d.width,u.height=t.indicator.complete.height??d.height}i&&t?.complete?.actionPayload&&i("complete",{_event:{id:t.id},...t?.complete?.actionPayload??{}})};var aP=async r=>{let{parent:t,nextElement:e,signal:i,eventHandler:s}=r,o=e.speed??50,n=e.revealEffect??"typewriter",a=e?.indicator?.offset??12,h=n==="none",l=h?0:Math.max(1,Math.floor(1e3/o)),c=h?0:Math.max(1,Math.floor(4e3/o)),u=t.children.find(d=>d.label===e.id);if(u){u.removeChildren();let d=new kt(A.EMPTY);if(e?.indicator?.revealing?.src){let f=e.indicator.revealing.src?A.from(e.indicator.revealing.src):A.EMPTY;d=new kt(f),d.width=e.indicator.revealing.width??f.width,d.height=e.indicator.revealing.height??f.height}u.addChild(d),e.x!==void 0&&(u.x=e.x),e.y!==void 0&&(u.y=e.y),e.alpha!==void 0&&(u.alpha=e.alpha);for(let f=0;f<e.content.length;f++){let p=e.content[f];d.x=a,d.y=p.y+(p.lineMaxHeight-d.height);for(let m=0;m<p.lineParts.length;m++){if(i?.aborted)return;let g=p.lineParts[m],b=new Mt(g.textStyle),y=new Er({text:"",style:b,x:g.x,y:g.y}),_=null;if(g.furigana){let S=new Mt(g.furigana.textStyle);_=new Er({text:"",style:S,x:g.furigana.x,y:g.furigana.y}),u.addChild(_)}u.addChild(y);let T=g.text,E=g.furigana?.text||"";if(h||i?.aborted)y.text=T,d.x=Do(y,T.length-1)+a,_&&(_.text=E);else{let S=E.length;for(let w=0;w<T.length;w++){y.text=T.substring(0,w+1),d.x=Do(y,w)+a;let M=Math.round((w+1)/T.length*S);if(_&&(_.text=E.substring(0,M)),w<T.length-1)try{await No(l,i)}catch(P){if(P.name==="AbortError")return;throw P}}}}if(f<e.content.length-1)try{await No(c,i)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let f=e.indicator.complete.src?A.from(e.indicator.complete.src):A.EMPTY;d.texture=f,d.width=e.indicator.complete.width??f.width,d.height=e.indicator.complete.height??f.height}s&&e?.complete?.actionPayload&&s("complete",{_event:{id:e.id},...e?.complete?.actionPayload??{}})}};var hP=async({parent:r,element:t,signal:e})=>{if(e?.aborted)return;let i=r.getChildByLabel(t.id);if(i){let s=!0,o=()=>{i&&!i.destroyed&&i.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var Rk=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,h=[...r],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},p=qt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=qt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let _=qt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(p.lineWidths[0]-_.width)/2),y:T};b.furigana=E}i.push(b),n=Math.max(n,g.height),s+=Math.round(p.lineWidths[0]),a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},lP=({state:r})=>{let t={...Ue,wordWrap:!0},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),r.width&&(f.wordWrapWidth=r.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Rk(e,i),a=r.width||o,l=Ae({...r,width:a,height:n});if(l.alpha=r.alpha??1,r.indicator){let c=r.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Mk=le({type:"text-revealing",add:nP,update:aP,delete:hP,parse:lP});var wu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Au=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var cP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:p,animation:m,alpha:g}=e,b=p,y=Object.keys(b.frames),_=new wi(A.from(f),b);await _.parse();let T=m.frames.map(M=>_.textures[y[M]]),E=new gh(T);E.label=h,E.animationSpeed=m.animationSpeed??.5,E.loop=m.loop??!0,r.debug?wu(E,h,r.debug):E.play();let S=()=>{E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=g},w=async()=>{a||S()};n.addEventListener("abort",w),S(),t.addChild(E),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:E,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",w)};var uP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=async()=>{if(JSON.stringify(e)!==JSON.stringify(i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,JSON.stringify(e.animation)!==JSON.stringify(i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let d=i.spritesheetData,f=Object.keys(d.frames),p=new wi(A.from(i.spritesheetSrc),d);await p.parse();let m=i.animation.frames.map(g=>p.textures[f[g]]);h.textures=m,r.debug?e.id!==i.id&&(Au(h),wu(h,i.id,r.debug)):h.play()}},u=async()=>{l||await c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),await c(),a.removeEventListener("abort",u))};var dP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{r.debug&&Au(a),a&&!a.destroyed&&(a.stop(),a.destroy())},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var fP=({state:r})=>({...Ae(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Bk=le({type:"animated-sprite",add:cP,update:uP,delete:dP,parse:fP});var Ik={linear:r=>r},Fk=(r,t,e,i)=>r+(t-r)*Ik[i](e),kk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s of t){if(i==null)return e;i=i[s]}return i===void 0?e:i},Gk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s=0;s<t.length-1;s++){let o=t[s];o in i||(i[o]={}),i=i[o]}return i[t[t.length-1]]=e,r},Uk=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(i=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?i=i+s:i=s,t.push({time:e,value:i,easing:n}))}),t},Ok=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let h=(t-i)/(n-i);return Fk(s,a,h,o)}}return r[r.length-1].value},Lk=r=>Math.max.apply(null,r),pP=async({app:r,element:t,animation:e,signal:i,eventHandler:s})=>new Promise((o,n)=>{if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}let{properties:a,complete:h,id:l,targetId:c}=e,u=Object.entries(a).map(([_,T])=>{if(!F1[_])throw new Error(`${_} is not a supported property for transition.`);return{...T,property:_}}),d=u.map(_=>_.keyframes.reduce((T,E)=>T+E.duration||0,0)),f=Lk(d),p={};u.forEach(_=>{p[_.property]=kk(t,_.property)});let m=u.map(_=>{let T=[];_.initialValue!==void 0?T=[{value:_.initialValue}]:T=[{value:p[_.property]}],T=T.concat(_.keyframes);let E=Uk(T);return{property:_.property,timeline:E}}),g=0,b=_=>{m.forEach(({property:T,timeline:E})=>{let S=Ok(E,_);t&&!t.destroyed&&Gk(t,T,S)})};i&&i.addEventListener("abort",()=>{r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"))});let y=_=>{if(g+=_.deltaMS,g>=f){if(r.ticker.remove(y),b(f),s&&h){let T=h?.actionPayload;s("complete",{_event:{id:l,targetId:c},...T??{}})}o();return}b(g)};if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}r?.debug?window.addEventListener("snapShotKeyFrame",_=>{_?.detail?.deltaMS&&y({deltaMS:Number(_.detail.deltaMS)})}):r.ticker.add(y)});var Dk=Ig({type:"tween",animate:pP});var mP=({app:r,element:t,signal:e})=>{if(e?.aborted)return;let i={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||r.audioStage.add(i)},t.delay):r.audioStage.add(i)};var gP=({app:r,prevElement:t,nextElement:e,signal:i})=>{if(!i?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=r.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var xP=({app:r,element:t,signal:e})=>{e?.aborted||r.audioStage.remove(t.id)};var Nk=Fg({type:"sound",add:mP,update:gP,delete:xP});var _h=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ug(r){let t=new he;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Og(r){let t=new he;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Lg(r){let t=new he;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function bh(r,t,e){return r+(t-r)*e}function Cu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function yP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,h=t&255,l=Math.round(bh(i,n,e)),c=Math.round(bh(s,a,e)),u=Math.round(bh(o,h,e));return l<<16|c<<8|u}var Pu=class r{constructor(t,e,i=!1){this.value=i?Cu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},wr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Pu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?yP(e.value,e.next.value,i):bh(e.value,e.next.value,i)}};var Ru=class{static type="alpha";constructor(t){this.list=new wr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Mu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Bu=class{static type="scale";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Iu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Hk=Math.PI/180,Fu=class{static type="speed";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},ku=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Gu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Hk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Alt=Math.PI/180,Uu=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Ou=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Oi=Math.PI/180,Lu=class{static type="rotation";constructor(t){this.minStart=t.minStart*Oi,this.maxStart=t.maxStart*Oi,this.minSpeed=t.minSpeed*Oi,this.maxSpeed=t.maxSpeed*Oi,this.accel=(t.accel??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Du=class{static type="rotationStatic";constructor(t){this.min=t.min*Oi,this.max=t.max*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Nu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var Hu=class{static type="color";constructor(t){this.list=new wr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Vu=class{static type="colorStatic";constructor(t){this.color=Cu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var Wu=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},zu=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Dg=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Ng=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},Vk={rect:Wu,rectangle:Wu,torus:zu,circle:zu,point:Dg,line:Ng};var $u=class{static type="spawnShape";constructor(t){let e=Vk[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},Xu=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var _P=new Map,bP=new Map;function Hg(r,t){_P.set(r,t)}function Pe(r){bP.set(r.type,r)}function vP(r,t){let e=_P.get(r);return e?e(t):null}function TP(r){return bP.get(r)}Hg("circle",Lg);Hg("snowflake",Ug);Hg("raindrop",Og);Pe(Ru);Pe(Mu);Pe(Bu);Pe(Iu);Pe(Fu);Pe(ku);Pe(Gu);Pe(Uu);Pe(Ou);Pe(Lu);Pe(Du);Pe(Nu);Pe(Hu);Pe(Vu);Pe($u);Pe(Xu);var ju=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var vh=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new ju(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=TP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new _h(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function Wk(r,t){let e=new he,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Th=async({app:r,parent:t,element:e,signal:i})=>{if(i?.aborted)return;let s=new xt;s.label=e.id,t.addChild(s);let o=e.width,n=e.height;s.x=e.x??0,s.y=e.y??0;let a={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},h;if(typeof e.texture=="object"&&e.texture.shape)h=Wk(r,e.texture);else{let u=e.texture??"circle";if(h=vP(u,r),!h)try{h=A.from(u)}catch{console.warn(`Failed to load particle texture: ${u}`);return}}a.texture=h;let l=new vh(s,a);if(s.emitter=l,a.recycleOnBounds){let u=Math.min(e.count??100,a.maxParticles);l.spawn(u);let d=l._activeFirst;for(;d;)d.y=l.random()*n,d.age=l.random()*d.maxLife*.8,d=d.next}let c=u=>{if(l.destroyed){r.ticker.remove(c);return}l.update(u.deltaTime/60)};if(s.tickerCallback=c,r?.debug){let u=d=>{if(l.destroyed){window.removeEventListener("snapShotKeyFrame",u);return}d?.detail?.deltaMS&&l.update(Number(d.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",u),s.customTickerHandler=u}else r.ticker.add(c);e.alpha!==void 0&&(s.alpha=e.alpha)};var Yu=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await et(e.id,i,{app:r,element:n,animations:s,signal:o}),a()}};var SP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(c=>c.label===e.id);if(!h){await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a});return}zk(e,i)?(await Yu({app:r,parent:t,element:e,animations:s,animationPlugins:o,eventHandler:n,signal:a}),await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})):(i.alpha!==void 0&&(h.alpha=i.alpha),i.x!==void 0&&(h.x=i.x),i.y!==void 0&&(h.y=i.y))};function zk(r,t){return r.count!==t.count||JSON.stringify(r.texture)!==JSON.stringify(t.texture)||JSON.stringify(r.behaviors)!==JSON.stringify(t.behaviors)||JSON.stringify(r.emitter)!==JSON.stringify(t.emitter)||r.width!==t.width||r.height!==t.height}function EP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function wP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function AP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function PP(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function CP(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function RP(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var MP=({state:r})=>{EP(r),wP(r),AP(r),PP(r),CP(r),RP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var $k=le({type:"particles",add:Th,update:SP,delete:Yu,parse:MP});var BP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let h of r)e.add(h.id),i.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=i.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vg=async({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=BP(t,e),h=[];for(let l of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:r,element:l,signal:s}))}for(let l of o){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:r,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=i.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:r,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),Wg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Wg||{}),qu=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(qu||{}),Z=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Z||{}),Ho=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ho||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),ci=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(ci||{}),it=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(it||{}),N=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(N||{}),fr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(fr||{}),Sh=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sh||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),Qe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Qe||{}),Li=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Li||{}),Ku=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Ku||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),re=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(re||{});var Pt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pt||{}),Xe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Xe||{});var zg={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:zg,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Cf();var Xk=Si.default??Si,Pr=Xk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var bs=$i(FP(),1),OU=$i(uc(),1);var Ex=$i(qR(),1);var KR={};function lt(r,t,e=3){if(KR[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1144
|
+
`,Oo=null,mh=class{constructor(){Oo||(Oo=URL.createObjectURL(new Blob([lk],{type:"application/javascript"}))),this.worker=new Worker(Oo)}};mh.revokeObjectURL=function(){Oo&&(URL.revokeObjectURL(Oo),Oo=null)};var P1=0,Cg,Rg=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{let{worker:e}=new Uo;e.addEventListener("message",i=>{e.terminate(),Uo.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){Cg===void 0&&(Cg=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<Cg&&(this._createdWorkers++,t=new mh().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();let i=new Promise((s,o)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:o})});return this._next(),i}_next(){if(!this._queue.length)return;let t=this._getWorker();if(!t)return;let e=this._queue.pop(),i=e.id;this._resolveHash[P1]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:P1++,id:i})}},Mg=new Rg;ii();var ck=[".jpeg",".jpg",".png",".webp",".avif"],uk=["image/jpeg","image/png","image/webp","image/avif"];async function dk(r,t){let e=await z.get().fetch(r);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${e.status} ${e.statusText}`);let i=await e.blob();return t?.data?.alphaMode==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}var vu={name:"loadTextures",extension:{type:v.LoadParser,priority:pe.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return lr(r,uk)||cr(r,ck)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await Mg.isImageBitmapSupported()?i=await Mg.loadImageBitmap(r,t):i=await dk(r,t):i=await new Promise((o,n)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):(i.onload=()=>{o(i)},i.onerror=n)});let s=new Ve({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||Fo(r),...t.data});return ko(s,e,r)},unload(r){r.destroy(!0)}};C();$f();zf();var C1=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fk=C1.map(r=>`video/${r.substring(1)}`);function pk(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=gk(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function mk(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){o(),t()}function s(n){o(),e(n)}function o(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function gk(r,t=globalThis.location){if(r.startsWith("data:"))return"";t||(t=globalThis.location);let e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}var R1={name:"loadVideo",extension:{type:v.LoadParser,name:"loadVideo"},test(r){let t=lr(r,fk),e=cr(r,C1);return t||e},async load(r,t,e){let i={...Ys.defaultOptions,resolution:t.data?.resolution||Fo(r),alphaMode:t.data?.alphaMode||await Yl(),...t.data},s=document.createElement("video"),o={preload:i.autoLoad!==!1?"auto":void 0,"webkit-playsinline":i.playsinline!==!1?"":void 0,playsinline:i.playsinline!==!1?"":void 0,muted:i.muted===!0?"":void 0,loop:i.loop===!0?"":void 0,autoplay:i.autoPlay!==!1?"":void 0};Object.keys(o).forEach(h=>{let l=o[h];l!==void 0&&s.setAttribute(h,l)}),i.muted===!0&&(s.muted=!0),pk(s,r,i.crossorigin);let n=document.createElement("source"),a;if(r.startsWith("data:"))a=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){let h=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();a=Ys.MIME_TYPES[h]||`video/${h}`}return n.src=r,a&&(n.type=a),new Promise(h=>{let l=async()=>{let c=new Ys({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await mk(s),h(ko(c,e,r))};s.addEventListener("canplay",l),s.appendChild(n)})},unload(r){r.destroy(!0)}};C();$s();C();$s();var Tu={extension:{type:v.ResolveParser,name:"resolveTexture"},test:vu.test,parse:r=>({resolution:parseFloat(Ke.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var M1={extension:{type:v.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Ke.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Tu.parse};$s();Un();Wl();var Su=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Ke,this.loader=new bu,this.cache=bt,this._backgroundLoader=new yu(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){if(this._initialized){O("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let o=t.manifest;typeof o=="string"&&(o=await this.load(o)),this.resolver.addManifest(o)}let e=t.texturePreference?.resolution??1,i=typeof e=="number"?[e]:e,s=await this._detectFormats({preferredFormats:t.texturePreference?.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:s,resolution:i}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();let i=es(t),s=Ie(t).map(a=>{if(typeof a!="string"){let h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),o=this.resolver.resolve(s),n=await this._mapLoadToResolve(o,e);return i?n[s[0]]:n}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);let s=this.resolver.resolveBundle(t),o={},n=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h)},c=n.map(u=>{let d=s[u];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{o[u]=f})});return await Promise.all(c),i?o[t[0]]:o}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);let e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return bt.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=bt.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;let s=await this.loader.load(i,e);this._backgroundLoader.active=!0;let o={};return i.forEach(n=>{let a=s[n.src],h=[n.src];n.alias&&h.push(...n.alias),h.forEach(l=>{o[l]=a}),bt.set(h,a)}),o}async unload(t){this._initialized||await this.init();let e=Ie(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Ie(t);let e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){let e=Object.values(t);e.forEach(i=>{bt.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(let i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}},ur=new Su;k.handleByList(v.LoadParser,ur.loader.parsers).handleByList(v.ResolveParser,ur.resolver.parsers).handleByList(v.CacheParser,ur.cache.parsers).handleByList(v.DetectionParser,ur.detections);k.add(m1,y1,g1,T1,_1,b1,v1,S1,E1,w1,A1,vu,R1,p1,f1,Tu,M1);var B1={loader:v.LoadParser,resolver:v.ResolveParser,cache:v.CacheParser,detection:v.DetectionParser};k.handle(v.Asset,r=>{let t=r.ref;Object.entries(B1).filter(([e])=>!!t[e]).forEach(([e,i])=>k.add(Object.assign(t[e],{extension:t[e].extension??i})))},r=>{let t=r.ref;Object.keys(B1).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});_t();Bn();zs();Dn();var gh=class r extends kt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});let{animationSpeed:i=1,autoPlay:s=!1,autoUpdate:o=!0,loop:n=!0,onComplete:a=null,onFrameChange:h=null,onLoop:l=null,textures:c,updateAnchor:u=!1,...d}=e,[f]=c;super({...d,texture:f instanceof A?f:f.texture}),this._textures=null,this._durations=null,this._autoUpdate=o,this._isConnectedToTicker=!1,this.animationSpeed=i,this.loop=n,this.updateAnchor=u,this.onComplete=a,this.onFrameChange=h,this.onLoop=l,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=c,s&&this.play()}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ne.shared.add(this.update,this,Br.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;let e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let o=this._currentTime%1*this._durations[this.currentFrame];for(o+=i/60*1e3;o<0;)this._currentTime--,o+=this._durations[this.currentFrame];let n=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);o>=this._durations[this.currentFrame];)o-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=o/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){let t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.texture.defaultAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}static fromImages(t){let e=[];for(let i=0;i<t.length;++i)e.push(A.from(t[i]));return new r(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof A)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ne.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ne.shared.add(this.update,this),this._isConnectedToTicker=!0))}};El();Ht();Vl();var Eu=class extends Ei{constructor(t,e){let{text:i,resolution:s,style:o,anchor:n,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i??"",this.style=o,this.resolution=s??null,this.allowChildren=!1,this._anchor=new _e({_onUpdate:()=>{this.onViewUpdate()}}),n&&(this.anchor=n),this.roundPixels=l??!1,a!==void 0&&(this.width=a),h!==void 0&&(this.height=h)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){t||(t={}),this._style?.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}containsPoint(t){let e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x,o=0;return t.x>=s&&t.x<=s+e&&(o=-i*this.anchor.y,t.y>=o&&t.y<=o+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=!0),super.onViewUpdate()}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t?.style)&&this._style.destroy(t),this._style=null,this._text=null}};function I1(r,t){let e=r[0]??{};return(typeof e=="string"||r[1])&&(W(Q,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}ha();cs();var Er=class extends Eu{constructor(...t){let e=I1(t,"Text");super(e,Mt),this.renderPipeId="text"}updateBounds(){let t=this._bounds,e=this._anchor,i=qt.measureText(this._text,this._style),{width:s,height:o}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*o,t.maxY=t.minY+o}};ii();_t();Yf();_r();cm();Dn();ha();cs();Df();Ee();var xk=$i(uc(),1);k.add(NS,VS);var yk=new(window.AudioContext||window.webkitAudioContext),Bg={},_k=async(r,t)=>{if(!Bg[r]&&t.byteLength!==0)try{let e=await yk.decodeAudioData(t);Bg[r]=e}catch(e){console.error(`AudioAsset.load: Failed to decode ${r}:`,e)}},bk=r=>Bg[r],Lo={load:_k,getAsset:bk};var le=({type:r,add:t,update:e,delete:i,parse:s})=>({type:r,add:t,update:e,delete:i,parse:s});var Ig=({type:r,animate:t})=>({type:r,animate:t});var Fg=({type:r,add:t,update:e,delete:i})=>({type:r,add:t,update:e,delete:i});var F1={alpha:"alpha",x:"x",y:"y",scaleX:"scaleX",scaleY:"scaleY",rotation:"rotation"},kg={scaleX:["scale","x"],scaleY:["scale","y"],x:["x"],y:["y"],alpha:["alpha"],rotation:["rotation"]};var fs={RECT:"rect",TEXT:"text",CONTAINER:"container",SPRITE:"sprite",TEXT_REVEALING:"text-revealing",SLIDER:"slider",PARTICLES:"particles",ANIMATED_SPRITE:"animated-sprite",VIDEO:"video"};var Ue={fill:"black",fontFamily:"Arial",fontSize:16,align:"left",lineHeight:1.2,wordWrap:!1,breakWords:!1,strokeColor:"transparent",strokeWidth:0,wordWrapWidth:0};var dr=(r,t)=>{let e={fill:t?.fill??Ue.fill,fontFamily:t?.fontFamily??Ue.fontFamily,fontSize:t?.fontSize??Ue.fontSize,align:t?.align??Ue.align,lineHeight:t?.lineHeight??Ue.lineHeight,wordWrap:t?.wordWrap??Ue.wordWrap,breakWords:t?.breakWords??Ue.breakWords,strokeColor:t?.strokeColor??Ue.strokeColor,strokeWidth:t?.strokeWidth??Ue.strokeWidth,wordWrapWidth:t?.wordWrapWidth??Ue.wordWrapWidth};r.style=e};async function et(r,t,{app:e,element:i,animations:s,signal:o,eventHandler:n}){let a=[];for(let h of s)if(h.targetId===r){let l=t.find(c=>c.type===h.type);if(!l)throw new Error(`No animation plugin found for type: ${h.type}`);a.push(l.animate({app:e,element:i,animation:h,signal:o,eventHandler:n}))}return Promise.all(a)}var k1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,h=new Er({label:e.id}),l=()=>{h.text=e.content,dr(h,e.textStyle),h.alpha=e.alpha,h.x=e.x,h.y=e.y},c=async()=>{a||l()};n.addEventListener("abort",c),l();let u=e?.hover,d=e?.click,f=e?.rightClick,p={isHovering:!1,isPressed:!1,isRightPressed:!1},m=({isHovering:g,isPressed:b,isRightPressed:y})=>{y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):g&&u?.textStyle?dr(h,u.textStyle):dr(h,e.textStyle)};if(u){let{cursor:g,soundSrc:b,actionPayload:y}=u;h.eventMode="static";let _=()=>{p.isHovering=!0,y&&s&&s("hover",{_event:{id:h.label},...y}),g&&(h.cursor=g),b&&r.audioStage.add({id:`hover-${Date.now()}`,url:b,loop:!1}),m(p)},T=()=>{p.isHovering=!1,h.cursor="auto",m(p)};h.on("pointerover",_),h.on("pointerout",T)}if(d){let{soundSrc:g,actionPayload:b}=d;h.eventMode="static";let y=()=>{p.isPressed=!0,m(p)},_=()=>{p.isPressed=!1,m(p),b&&s&&s("click",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`click-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isPressed=!1,m(p)};h.on("pointerdown",y),h.on("pointerup",_),h.on("pointerupoutside",T)}if(f){let{soundSrc:g,actionPayload:b}=f;h.eventMode="static";let y=()=>{p.isRightPressed=!0,m(p)},_=()=>{p.isRightPressed=!1,m(p),b&&s&&s("rightclick",{_event:{id:h.label},...b}),g&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:g,loop:!1})},T=()=>{p.isRightPressed=!1,m(p)};h.on("rightdown",y),h.on("rightup",_),h.on("rightupoutside",T)}t.addChild(h),i&&i.length>0&&(a=!1,await et(e.id,o,{app:r,element:h,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",c)};var G1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.text=i.content,dr(h,i.textStyle),h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m={isHovering:!1,isPressed:!1,isRightPressed:!1},g=({isHovering:b,isPressed:y,isRightPressed:_})=>{_&&p?.textStyle?dr(h,p.textStyle):y&&f?.textStyle?dr(h,f.textStyle):b&&d?.textStyle?dr(h,d.textStyle):dr(h,i.textStyle)};if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{m.isHovering=!0,_&&s&&s("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1}),g(m)},E=()=>{m.isHovering=!1,h.cursor="auto",g(m)};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{m.isPressed=!0,g(m)},T=()=>{m.isPressed=!1,g(m),y&&s&&s("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isPressed=!1,g()};h.on("pointerdown",_),h.on("pointerup",T),h.on("pointerupoutside",E)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{m.isRightPressed=!0,g(m)},T=()=>{m.isRightPressed=!1,g(m),y&&s&&s("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})},E=()=>{m.isRightPressed=!1,g(m)};h.on("rightdown",_),h.on("rightup",T),h.on("rightupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(o&&o.length>0&&(l=!1,await et(i.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l=!0),c(),a.removeEventListener("abort",u))};var U1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var O1=({positionX:r=0,positionY:t=0,width:e,height:i,anchorX:s=0,anchorY:o=0})=>{if(typeof e!="number"||typeof i!="number")throw new Error("Input Error: Width or height is missing");let n={x:e*s,y:i*o},a=r-n.x,h=t-n.y;return{x:a,y:h,originX:n.x,originY:n.y}};var Ae=r=>{if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width or height is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(!r.id)throw new Error("Input Error: Id is missing");let t=r.scaleX?r.scaleX*r.width:r.width,e=r.scaleY?r.scaleY*r.height:r.height;r.type===fs.CONTAINER&&(t=r.width,e=r.height);let{x:i,y:s,originX:o,originY:n}=O1({positionX:r.x,positionY:r.y,width:t,height:e,anchorX:r.anchorX,anchorY:r.anchorY}),a={id:r.id,type:r.type,width:Math.round(t),height:Math.round(e),x:Math.round(i),y:Math.round(s),originX:Math.round(o),originY:Math.round(n),alpha:r.alpha??1};return r.hover&&(a.hover=r.hover),r.click&&(a.click=r.click),a};var L1=({state:r})=>{let t={...Ue,...r.textStyle};t.lineHeight=Math.round(t.fontSize*t.lineHeight),r.width&&(t.wordWrapWidth=r.width,t.wordWrap=!0);let{width:e,height:i}=qt.measureText(r.content??"",new Mt(t)),s=Math.round(e),o=Math.round(i);return{...Ae({...r,width:s,height:o}),content:r.content??"",textStyle:{...t},...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}}};var vk=le({type:"text",add:k1,update:G1,delete:U1,parse:L1});var D1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let{id:a,x:h,y:l,width:c,height:u,fill:d,border:f,alpha:p}=e,m=new he;m.label=a;let g=!0,b=()=>{m.clear(),m.rect(0,0,Math.round(c),Math.round(u)).fill(d),m.x=Math.round(h),m.y=Math.round(l),m.alpha=p,f&&m.stroke({color:f.color,alpha:f.alpha,width:Math.round(f.width)})},y=async()=>{g||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S=e?.scroll,w=e?.drag;if(_){let{cursor:M,soundSrc:P,actionPayload:R}=_;m.eventMode="static";let B=()=>{R&&o&&o("hover",{_event:{id:m.label},...R}),M&&(m.cursor=M),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1})},F=()=>{m.cursor="auto"};m.on("pointerover",B),m.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:P}=T;m.eventMode="static";let R=()=>{P&&o&&o("click",{_event:{id:m.label},...P}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})};m.on("pointerup",R)}if(E){let{soundSrc:M,actionPayload:P}=E;m.eventMode="static";let R=()=>{P&&o&&o("rightclick",{_event:{id:m.label},...P}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})};m.on("rightclick",R)}if(S){m.eventMode="static";let M=P=>{if(P.deltaY<0&&S.up){let{actionPayload:R}=S.up;R&&o&&o("scrollup",{_event:{id:m.label},...R})}else if(P.deltaY>0&&S.down){let{actionPayload:R}=S.down;R&&o&&o("scrolldown",{_event:{id:m.label},...R})}};m.on("wheel",M)}if(w){let{start:M,end:P,move:R}=w;m.eventMode="static";let B=()=>{m._isDragging=!0,M&&o&&o("drag-start",{_event:{id:m.label},...typeof M?.actionPayload=="object"?M.actionPayload:{}})},F=()=>{m._isDragging=!1,P&&o&&o("drag-end",{_event:{id:m.label},...typeof P?.actionPayload=="object"?P.actionPayload:{}})},X=L=>{R&&o&&m._isDragging&&o("drag-move",{_event:{id:m.label,x:L.global.x,y:L.global.y},...typeof R?.actionPayload=="object"?R.actionPayload:{}})};m.on("pointerdown",B),m.on("pointerup",F),m.on("globalpointermove",X),m.on("pointerupoutside",F)}t.addChild(m),i&&i.length>0&&(g=!1,await et(a,s,{app:r,element:m,animations:i,signal:n,eventHandler:o})),g=!0,n.removeEventListener("abort",y)};var N1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.clear(),h.rect(0,0,Math.round(i.width),Math.round(i.height)).fill(i.fill),h.x=Math.round(i.x),h.y=Math.round(i.y),h.alpha=i.alpha,i.border&&h.stroke({color:i.border.color,alpha:i.border.alpha,width:Math.round(i.border.width)}),h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightclick"),h.removeAllListeners("wheel"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),h.removeAllListeners("pointerupoutside");let d=i?.hover,f=i?.click,p=i?.rightClick,m=i?.scroll,g=i?.drag;if(d){let{cursor:b,soundSrc:y,actionPayload:_}=d;h.eventMode="static";let T=()=>{_&&n&&n("hover",{_event:{id:h.label},..._}),b&&(h.cursor=b),y&&r.audioStage.add({id:`hover-${Date.now()}`,url:y,loop:!1})},E=()=>{h.cursor="auto"};h.on("pointerover",T),h.on("pointerout",E)}if(f){let{soundSrc:b,actionPayload:y}=f;h.eventMode="static";let _=()=>{y&&n&&n("click",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`click-${Date.now()}`,url:b,loop:!1})};h.on("pointerup",_)}if(p){let{soundSrc:b,actionPayload:y}=p;h.eventMode="static";let _=()=>{y&&n&&n("rightclick",{_event:{id:h.label},...y}),b&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:b,loop:!1})};h.on("rightclick",_)}if(m){h.eventMode="static";let b=y=>{if(y.deltaY<0&&m.up){let{actionPayload:_}=m.up;_&&n&&n("scrollup",{_event:{id:h.label},..._})}else if(y.deltaY>0&&m.down){let{actionPayload:_}=m.down;_&&n&&n("scrolldown",{_event:{id:h.label},..._})}};h.on("wheel",b)}if(g){let{start:b,end:y,move:_}=g;h.eventMode="static";let T=()=>{h._isDragging=!0,b&&n&&n("drag-start",{_event:{id:h.label},...typeof b?.actionPayload=="object"?b.actionPayload:{}})},E=()=>{h._isDragging=!1,y&&n&&n("drag-end",{_event:{id:h.label},...typeof y?.actionPayload=="object"?y.actionPayload:{}})},S=w=>{_&&n&&h._isDragging&&n("drag-move",{_event:{id:h.label,x:w.global.x,y:w.global.y},...typeof _?.actionPayload=="object"?_.actionPayload:{}})};h.on("pointerdown",T),h.on("pointerup",E),h.on("globalpointermove",S),h.on("pointerupoutside",E)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var H1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var V1=({state:r})=>{let t=Ae(r),e=t;return r.border&&(e={...t,border:{alpha:r.border?.alpha??1,color:r.border?.color??"black",width:r.border?.width??0}}),{...e,cursor:r.cursor??"",fill:r.fill??"white",rotation:r.rotation??0,...r.drag&&{drag:r.drag},...r.rightClick&&{rightClick:r.rightClick},...r.scroll&&{scroll:r.scroll}}};var Tk=le({type:"rect",add:D1,update:N1,delete:H1,parse:V1});var W1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,alpha:p}=e,m=f?A.from(f):A.EMPTY,g=new kt(m);g.label=h;let b=()=>{g.x=Math.round(l),g.y=Math.round(c),g.width=Math.round(u),g.height=Math.round(d),g.alpha=p},y=async()=>{a||b()};n.addEventListener("abort",y),b();let _=e?.hover,T=e?.click,E=e?.rightClick,S={isHovering:!1,isPressed:!1,isRightPressed:!1},w=({isHovering:M,isPressed:P,isRightPressed:R})=>{if(R&&E?.src){let B=A.from(E.src);g.texture=B}else if(P&&T?.src){let B=A.from(T.src);g.texture=B}else if(M&&_?.src){let B=A.from(_.src);g.texture=B}else g.texture=m};if(_){let{cursor:M,soundSrc:P,actionPayload:R}=_;g.eventMode="static";let B=()=>{S.isHovering=!0,R&&s&&s("hover",{_event:{id:g.label},...R}),M&&(g.cursor=M),P&&r.audioStage.add({id:`hover-${Date.now()}`,url:P,loop:!1}),w(S)},F=()=>{S.isHovering=!1,g.cursor="auto",w(S)};g.on("pointerover",B),g.on("pointerout",F)}if(T){let{soundSrc:M,actionPayload:P}=T;g.eventMode="static";let R=()=>{S.isPressed=!0,w(S)},B=()=>{S.isPressed=!1,w(S),P&&s&&s("click",{_event:{id:g.label},...P}),M&&r.audioStage.add({id:`click-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isPressed=!1,w(S)};g.on("pointerdown",R),g.on("pointerup",B),g.on("pointerupoutside",F)}if(E){let{soundSrc:M,actionPayload:P}=E;g.eventMode="static";let R=()=>{S.isRightPressed=!0,w(S)},B=()=>{S.isRightPressed=!1,w(S),P&&s&&s("rightclick",{_event:{id:g.label},...P}),M&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:M,loop:!1})},F=()=>{S.isRightPressed=!1,w(S)};g.on("rightdown",R),g.on("rightup",B),g.on("rightupoutside",F)}t.addChild(g),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:g,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",y)};var z1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){let d=i.src?A.from(i.src):A.EMPTY;h.texture=d,h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerdown"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerup"),h.removeAllListeners("rightdown"),h.removeAllListeners("rightup"),h.removeAllListeners("rightupoutside");let f=i?.hover,p=i?.click,m=i?.rightClick,g={isHovering:!1,isPressed:!1,isRightPressed:!1},b=({isHovering:y,isPressed:_,isRightPressed:T})=>{if(T&&m?.src){let E=A.from(m.src);h.texture=E}else if(_&&p?.src){let E=A.from(p.src);h.texture=E}else if(y&&f?.src){let E=A.from(f.src);h.texture=E}else h.texture=d};if(f){let{cursor:y,soundSrc:_,actionPayload:T}=f;h.eventMode="static";let E=()=>{g.isHovering=!0,T&&n&&n("hover",{_event:{id:h.label},...T}),y&&(h.cursor=y),_&&r.audioStage.add({id:`hover-${Date.now()}`,url:_,loop:!1}),b(g)},S=()=>{g.isHovering=!1,h.cursor="auto",b(g)};h.on("pointerover",E),h.on("pointerout",S)}if(p){let{soundSrc:y,actionPayload:_}=p;h.eventMode="static";let T=()=>{g.isPressed=!0,b(g)},E=()=>{g.isPressed=!1,b(g),_&&n&&n("click",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`click-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isPressed=!1,b(g)};h.on("pointerdown",T),h.on("pointerup",E),h.on("pointerupoutside",S)}if(m){let{soundSrc:y,actionPayload:_}=m;h.eventMode="static";let T=()=>{g.isRightPressed=!0,b(g)},E=()=>{g.isRightPressed=!1,b(g),_&&n&&n("rightclick",{_event:{id:h.label},..._}),y&&r.audioStage.add({id:`rightclick-${Date.now()}`,url:y,loop:!1})},S=()=>{g.isRightPressed=!1,b(g)};h.on("rightdown",T),h.on("rightup",E),h.on("rightupoutside",S)}}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var $1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy()},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var X1=({state:r})=>({...Ae(r),src:r.src??"",alpha:r.alpha??1,cursor:r.cursor??"",...r.hover&&{hover:r.hover},...r.click&&{click:r.click},...r.rightClick&&{rightClick:r.rightClick}});var Sk=le({type:"sprite",add:W1,update:z1,delete:$1,parse:X1});var j1=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,src:f,volume:p,loop:m,alpha:g}=e,b=A.from(f),y=b.source.resource;y.pause(),y.currentTime=0,y.loop=m??!1,y.volume=p/1e3,y.muted=!1,y.play();let _=new kt(b);_.label=h;let T=()=>{_.x=Math.round(l),_.y=Math.round(c),_.width=Math.round(u),_.height=Math.round(d),_.alpha=g??1},E=async()=>{a||T()};n.addEventListener("abort",E),T(),t.addChild(_),i&&i.length>0&&(a=!1,await et(h,o,{app:r,element:_,animations:i,signal:n,eventHandler:s}),a=!0),n.removeEventListener("abort",E)};var Y1=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){if(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha??1,e.src!==i.src){let d=h.texture.source.resource;d&&d.pause();let f=A.from(i.src);h.texture=f;let p=f.source.resource;p.muted=!1,p.pause(),p.currentTime=0,p.play()}h.texture.source.resource.volume=i.volume/1e3,h.texture.source.resource.loop=i.loop??!1}},u=async()=>{l||c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),c(),a.removeEventListener("abort",u))};var q1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{if(a&&!a.destroyed){let u=a.texture.source.resource;u&&u.pause(),t.removeChild(a),a.destroy()}},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var K1=({state:r})=>({...Ae(r),src:r.src,volume:r.volume??1e3,loop:r.loop??!1});var Ek=le({type:"video",add:j1,update:Y1,delete:q1,parse:K1});var Z1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0;if(n?.aborted)return;let{id:h,x:l,y:c,width:u,height:d,alpha:f,thumbSrc:p,barSrc:m,direction:g,min:b,max:y,step:_,initialValue:T,originX:E,originY:S,hover:w,change:M}=e,P=new xt;P.label=h,P.x=l,P.y=c,P.alpha=f,P.sortableChildren=!0,P.eventMode="static";let R=0,B=m?A.from(m):A.EMPTY,F=new kt(B);F.label=`${h}-bar`,F.eventMode="static";let X=p?A.from(p):A.EMPTY,L=new kt(X);L.label=`${h}-thumb`,L.eventMode="static";let nt=T??b,D=y-b,$=St=>{let ut=(St-b)/D;g==="horizontal"?(L.x=ut*(F.width-L.width),L.y=(F.height-L.height)/2):(L.x=(F.width-L.width)/2,L.y=ut*(F.height-L.height))},H=()=>{F.width=u,F.height=d;let St=g==="horizontal"?d-R*2:u-R*2,ut=p?A.from(p):A.EMPTY,yt=ut.width,Ft=ut.height,Qt=St/yt,Jt=St/Ft,De=Math.min(Qt,Jt);L.width=yt*De,L.height=Ft*De,$(nt)},U=async()=>{a||H()};n.addEventListener("abort",U),H();let tt=X,vt=B,gt=!1,Dt=St=>{let ut;if(g==="horizontal"){let Ft=St.x-L.width/2;ut=Math.max(0,Math.min(1,Ft/(F.width-L.width)))}else{let Ft=St.y-L.height/2;ut=Math.max(0,Math.min(1,Ft/(F.height-L.height)))}let yt=b+ut*D;return _>0&&(yt=Math.round((yt-b)/_)*_+b,yt=Math.max(b,Math.min(y,yt))),yt},Nt=St=>{let ut=P.toLocal(St.global),yt=Dt(ut);yt!==nt&&(nt=yt,$(nt),M?.actionPayload&&o&&o("change",{_event:{id:h,value:nt},...M.actionPayload}))},Zt=St=>{gt=!0,Nt(St)},oe=St=>{gt&&Nt(St)},Te=()=>{gt&&(gt=!1)};if(P.on("pointerdown",Zt),P.on("globalpointermove",oe),P.on("pointerup",Te),P.on("pointerupoutside",Te),w){let{cursor:St,soundSrc:ut,thumbSrc:yt,barSrc:Ft}=w,Qt=()=>{St&&(F.cursor=St,L.cursor=St),ut&&r.audioStage.add({id:`hover-${Date.now()}`,url:ut,loop:!1}),yt&&(L.texture=A.from(yt)),Ft&&(F.texture=A.from(Ft))},Jt=()=>{gt||(F.cursor="auto",L.cursor="auto",L.texture=tt,F.texture=vt)};P.on("pointerover",Qt),P.on("pointerout",Jt),P.on("pointerupoutside",Jt)}P.addChild(F),P.addChild(L),t.addChild(P),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:P,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",U)};var Q1=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,signal:a})=>{if(a?.aborted)return;let h=t.children.find(c=>c.label===e.id),l=()=>{if(JSON.stringify(e)!==JSON.stringify(i)){h.x=i.x,h.y=i.y,h.alpha=i.alpha,h.label=i.id,h.pivot.set(i.originX,i.originY);let c=h.getChildByLabel(`${i.id}-bar`),u=h.getChildByLabel(`${i.id}-thumb`);if(c&&u){c.width=i.width,c.height=i.height;let d=0,f=i.direction==="horizontal"?i.height-d*2:i.width-d*2,p=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY,m=p.width||16,g=p.height||16,b=f/m,y=f/g,_=Math.min(b,y);if(u.width=m*_,u.height=g*_,e.barSrc!==i.barSrc){let S=i.barSrc?A.from(i.barSrc):A.EMPTY;c.texture=S}if(e.thumbSrc!==i.thumbSrc){let S=i.thumbSrc?A.from(i.thumbSrc):A.EMPTY;u.texture=S}let T=i.max-i.min,E=(i.initialValue-i.min)/T;i.direction==="horizontal"?(u.x=E*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=E*(c.height-u.height))}if(h.removeAllListeners("pointerover"),h.removeAllListeners("pointerout"),h.removeAllListeners("pointerup"),h.removeAllListeners("pointerupoutside"),h.removeAllListeners("pointerdown"),h.removeAllListeners("globalpointermove"),s){let{hover:d,change:f,min:p,max:m,step:g,direction:b,initialValue:y}=i,_=y??p,T=m-p;h.eventMode="static";let E=L=>{let nt=(L-p)/T;b==="horizontal"?(u.x=nt*(c.width-u.width),u.y=(c.height-u.height)/2):(u.x=(c.width-u.width)/2,u.y=nt*(c.height-u.height))},S=L=>{let nt;if(b==="horizontal"){let $=L.x-u.width/2;nt=Math.max(0,Math.min(1,$/(c.width-u.width)))}else{let $=L.y-u.height/2;nt=Math.max(0,Math.min(1,$/(c.height-u.height)))}let D=p+nt*T;return g>0&&(D=Math.round((D-p)/g)*g+p,D=Math.max(p,Math.min(m,D))),D},w=u.texture,M=c.texture,P=!1,R=L=>{let nt=h.toLocal(L.global),D=S(nt);D!==_&&(_=D,E(_),f?.actionPayload&&s&&s("change",{_event:{id,value:_},...f.actionPayload}))},B=L=>{P=!0,R(L)},F=L=>{P&&R(L)},X=()=>{P&&(P=!1)};if(h.on("pointerdown",B),h.on("globalpointermove",F),h.on("pointerup",X),h.on("pointerupoutside",X),d){let{cursor:L,soundSrc:nt,thumbSrc:D,barSrc:$}=d,H=()=>{L&&(h.cursor=L,u.cursor=L),nt&&r.audioStage.add({id:`hover-${Date.now()}`,url:nt,loop:!1}),D&&(u.texture=A.from(D)),$&&(c.texture=A.from($))},U=()=>{P||(h.cursor="auto",u.cursor="auto",u.texture=w,c.texture=M)};h.on("pointerover",H),h.on("pointerout",U),h.on("pointerupoutside",U)}}}};h&&(o&&o.length>0&&await et(e.id,n,{app:r,element:h,animations:o,signal:a,eventHandler:s}),l())};var J1=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{if(o?.aborted)return;let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&a.destroy({children:!0})},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var tP=({state:r})=>{let t=Ae(r),e=r.min??0,i=r.max??100;if(i<=e)throw new Error("Input error: the max value of a slider must be larger than the min value");return{...t,direction:r.direction??"horizontal",thumbSrc:r.thumbSrc??"",barSrc:r.barSrc??"",alpha:r.alpha??1,min:e,max:i,step:r.step??1,initialValue:r.initialValue??0,...r.hover&&{hover:r.hover},...r.change&&{change:r.change}}};var wk=le({type:"slider",add:Z1,update:Q1,delete:J1,parse:tP});var xh=({container:r,element:t})=>{let e=0,i=0;t.children.forEach(n=>{e=Math.max(n.width+n.x,e),i=Math.max(n.height+n.y,i)});let s=t.scroll&&t.height&&i>t.height,o=t.scroll&&t.width&&e>t.width;if(s||o){let n=new xt({label:`${r.label}-content`});[...r.children].forEach(f=>{n.addChild(f)}),r.addChild(n);let h=new he({label:`${r.label}-clip`}).rect(0,0,t.width||e,t.height||i).fill({color:16711680,alpha:0});r.addChild(h),n.mask=h,r.eventMode="static";let l=0,c=0,u=-(i-(t.height||i)),d=-(e-(t.width||e));r.on("wheel",f=>{if(f.preventDefault(),s&&f.deltaY!==0){let p=l-f.deltaY;p>0?l=0:p<u?l=u:l=p,n.y=l}if(o&&(f.deltaX!==0||f.shiftKey&&f.deltaY!==0)){let p=f.deltaX!==0?f.deltaX:f.deltaY,m=c-p;m>0?c=0:m<d?c=d:c=m,n.x=c}})}},Gg=({container:r})=>{let t=r.children.find(i=>i.label&&i.label.endsWith("-content")),e=r.children.find(i=>i.label&&i.label.endsWith("-clip"));t&&([...t.children].forEach(s=>{s.mask=null,r.addChild(s)}),r.removeChild(t)),e&&r.removeChild(e),r.eventMode="auto",r.removeAllListeners("wheel")};var eP=async({app:r,parent:t,element:e,animations:i,eventHandler:s,animationPlugins:o,elementPlugins:n,signal:a})=>{let{id:h,x:l,y:c,children:u,scroll:d,alpha:f}=e,p=new xt;p.label=h;let m=!0,g=()=>{p.x=Math.round(l),p.y=Math.round(c),p.alpha=f},b=async()=>{m||g()};if(a.addEventListener("abort",b),g(),t.addChild(p),u&&u.length>0)for(let y of u){let _=n.find(T=>T.type===y.type);if(!_)throw new Error(`No plugin found for child element type: ${y.type}`);await _.add({app:r,parent:p,element:y,animations:i,eventHandler:s,animationPlugins:o,animateElements:et,elementPlugins:n,signal:a})}d&&xh({container:p,element:e}),i&&i.length>0&&(m=!1,await et(h,o,{app:r,element:p,animations:i,signal:a,eventHandler:s})),m=!0,a.removeEventListener("abort",b)};var rP=(r,t,e=[])=>{let i=new Set,s=new Map,o=new Map,n=[],a=[],h=[];for(let l of r)i.add(l.id),s.set(l.id,l);for(let l of t)i.add(l.id),o.set(l.id,l);for(let l of i){let c=s.get(l),u=o.get(l);!c&&u?n.push(u):c&&!u?a.push(c):(JSON.stringify(c)!==JSON.stringify(u)||e.find(d=>d.targetId===u.id))&&h.push({prev:c,next:u})}return{toAddElement:n,toDeleteElement:a,toUpdateElement:h}};var yh=async({app:r,parent:t,prevASTTree:e,nextASTTree:i,animations:s,animationPlugins:o,eventHandler:n,elementPlugins:a,signal:h})=>{let{toAddElement:l,toDeleteElement:c,toUpdateElement:u}=rP(e,i,s),d=[];for(let f of c){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.delete({app:r,parent:t,element:f,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}for(let f of l){let p=a.find(m=>m.type===f.type);if(!p)throw new Error(`No plugin found for element type: ${f.type}`);d.push(p.add({app:r,parent:t,element:f,animations:s,eventHandler:n,signal:h,animationPlugins:o,elementPlugins:a}))}for(let{prev:f,next:p}of u){let m=a.find(g=>g.type===p.type);if(!m)throw new Error(`No plugin found for element type: ${p.type}`);d.push(m.update({app:r,parent:t,prevElement:f,nextElement:p,animations:s,animationPlugins:o,eventHandler:n,signal:h,elementPlugins:a}))}try{await Promise.all(d),Ak(t,i)}catch(f){if(h.aborted)console.log("Render aborted, skipping cleanup");else throw f}},Ak=(r,t)=>{r.children=r.children.sort((e,i)=>{let s=t.findIndex(n=>n.id===e.label),o=t.findIndex(n=>n.id===i.label);if(s!==-1&&o!==-1)return s-o;if(s===-1&&o===-1)return 0;if(s===-1)return-1;if(o===-1)return 1}).map((e,i)=>(e.zIndex=i,e))};var iP=async({app:r,parent:t,prevElement:e,nextElement:i,eventHandler:s,animations:o,animationPlugins:n,elementPlugins:a,signal:h})=>{let l=t.children.find(f=>f.label===e.id),c=!0,u=async()=>{JSON.stringify(e)!==JSON.stringify(i)&&(l.x=Math.round(i.x),l.y=Math.round(i.y),l.label=i.id,l.alpha=i.alpha,e.scroll!==i.scroll?i.scroll?xh({container:l,element:i}):Gg({container:l}):i.scroll&&(Gg({container:l}),xh({container:l,element:i})),JSON.stringify(e.children)!==JSON.stringify(i.children)&&await yh({app:r,parent:i.scroll?l.children.find(f=>f.label===`${i.id}-content`):l,nextASTTree:i.children,prevASTTree:e.children,eventHandler:s,elementPlugins:a,animations:o,animationPlugins:n,signal:h}))},d=async()=>{c||await u()};h.addEventListener("abort",d),l&&(o&&o.length>0&&(c=!1,await et(e.id,n,{app:r,element:l,animations:o,signal:h,eventHandler:s})),c=!0,await u(),h.removeEventListener("abort",d))};var sP=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o,eventHandler:n})=>{let a=t.getChildByLabel(e.id);if(a){let h=!0,l=()=>{a&&!a.destroyed&&(t.removeChild(a),a.destroy({children:!0,texture:!0,baseTexture:!0}))},c=async()=>{h||l()};o.addEventListener("abort",c),s&&s.length>0&&(h=!1,await et(e.id,i,{app:r,element:a,animations:s,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var oP=({state:r,parserPlugins:t=[]})=>{let e=r.direction??"",i=!!r.scroll,s=r.gap||0,o=structuredClone(r.children||[]),n=[],a=0,h=0,l=0,c=0,u=0,d=0,f=0,p=0,m=0,g=0;for(let y=0;y<o.length;y++){let _=y<o.length-1?s:0,T=o[y];y>0?e==="horizontal"?(T.x=l,T.y=f):e==="vertical"&&(T.x=p,T.y=c):(e==="horizontal"||e==="vertical")&&(T.x=0,T.y=0);let E=t.find(S=>S.type===T.type);E&&(T=E.parse({state:T,parserPlugins:t})),e==="horizontal"?(r.width&&T.width+m>r.width&&!i?(l=0,m=0,f+=u+s,u=T.height,T.x=0,T.y=f):u=Math.max(u,T.height),l+=T.width+_,m=T.x+T.width,a=Math.max(l,a),h=Math.max(T.height+T.y,h)):e==="vertical"?(r.height&&T.height+g>r.height&&!i?(c=0,g=0,p+=d+s,d=T.width,T.x=p,T.y=0):d=Math.max(d,T.width),c+=T.height+_,g=T.y+T.height,a=Math.max(T.width+T.x,a),h=Math.max(c,h)):(a=Math.max(T.width+T.x,a),h=Math.max(T.height+T.y,h)),n.push(T)}return{...Ae({...r,width:r.width?r.width:a,height:r.height?r.height:h}),children:n,direction:e,gap:s,scroll:i,rotation:r.rotation??0}};var Pk=le({type:"container",add:eP,update:iP,delete:sP,parse:oP});function Do(r,t){let e=r.text.substring(0,t),s=qt.measureText(e,r.style).width;return r.x+s}var Ck=async(r,t)=>new Promise((e,i)=>{if(t?.aborted)return i(new DOMException("The operation was aborted.","AbortError"));let s=setTimeout(()=>{e()},r),o=()=>{clearTimeout(s),i(t.reason)};t?.addEventListener("abort",o,{once:!0})}),No=Ck;var nP=async({parent:r,element:t,signal:e,eventHandler:i})=>{let s=t.speed??50,o=t.revealEffect??"typewriter",n=t?.indicator?.offset??12,a=o==="none",h=a?0:Math.max(1,Math.floor(1e3/s)),l=a?0:Math.max(1,Math.floor(4e3/s)),c=new xt;c.label=t.id;let u=new kt(A.EMPTY);if(t?.indicator?.revealing?.src){let d=t.indicator.revealing.src?A.from(t.indicator.revealing.src):A.EMPTY;u=new kt(d),u.width=t.indicator.revealing.width??d.width,u.height=t.indicator.revealing.height??d.height}c.addChild(u),t.x!==void 0&&(c.x=Math.round(t.x)),t.y!==void 0&&(c.y=Math.round(t.y)),t.alpha!==void 0&&(c.alpha=t.alpha),r.addChild(c);for(let d=0;d<t.content.length;d++){let f=t.content[d];u.x=n,u.y=f.y+(f.lineMaxHeight-u.height);for(let p=0;p<f.lineParts.length;p++){if(e?.aborted)return;let m=f.lineParts[p],g=new Mt(m.textStyle),b=new Er({text:"",style:g,x:Math.round(m.x),y:Math.round(m.y)}),y=null;if(m.furigana){let E=new Mt(m.furigana.textStyle);y=new Er({text:"",style:E,x:Math.round(m.furigana.x),y:Math.round(m.furigana.y)}),c.addChild(y)}c.addChild(b);let _=m.text,T=m.furigana?.text||"";if(a||e?.aborted)b.text=_,u.x=Do(b,_.length-1)+n,y&&(y.text=T);else{let E=T.length;for(let S=0;S<_.length;S++){if(e?.aborted)return;b.text=_.substring(0,S+1),u.x=Do(b,S)+n;let w=Math.round((S+1)/_.length*E);if(y&&(y.text=T.substring(0,w)),S<_.length-1)try{await No(h,e)}catch{if(err.name==="AbortError")return;throw err}}}}if(d<t.content.length-1)try{await No(l,e)}catch{if(err.name==="AbortError")return;throw err}}if(t?.indicator?.complete?.src){let d=t.indicator.complete.src?A.from(t.indicator.complete.src):A.EMPTY;u.texture=d,u.width=t.indicator.complete.width??d.width,u.height=t.indicator.complete.height??d.height}i&&t?.complete?.actionPayload&&i("complete",{_event:{id:t.id},...t?.complete?.actionPayload??{}})};var aP=async r=>{let{parent:t,nextElement:e,signal:i,eventHandler:s}=r,o=e.speed??50,n=e.revealEffect??"typewriter",a=e?.indicator?.offset??12,h=n==="none",l=h?0:Math.max(1,Math.floor(1e3/o)),c=h?0:Math.max(1,Math.floor(4e3/o)),u=t.children.find(d=>d.label===e.id);if(u){u.removeChildren();let d=new kt(A.EMPTY);if(e?.indicator?.revealing?.src){let f=e.indicator.revealing.src?A.from(e.indicator.revealing.src):A.EMPTY;d=new kt(f),d.width=e.indicator.revealing.width??f.width,d.height=e.indicator.revealing.height??f.height}u.addChild(d),e.x!==void 0&&(u.x=e.x),e.y!==void 0&&(u.y=e.y),e.alpha!==void 0&&(u.alpha=e.alpha);for(let f=0;f<e.content.length;f++){let p=e.content[f];d.x=a,d.y=p.y+(p.lineMaxHeight-d.height);for(let m=0;m<p.lineParts.length;m++){if(i?.aborted)return;let g=p.lineParts[m],b=new Mt(g.textStyle),y=new Er({text:"",style:b,x:g.x,y:g.y}),_=null;if(g.furigana){let S=new Mt(g.furigana.textStyle);_=new Er({text:"",style:S,x:g.furigana.x,y:g.furigana.y}),u.addChild(_)}u.addChild(y);let T=g.text,E=g.furigana?.text||"";if(h||i?.aborted)y.text=T,d.x=Do(y,T.length-1)+a,_&&(_.text=E);else{let S=E.length;for(let w=0;w<T.length;w++){y.text=T.substring(0,w+1),d.x=Do(y,w)+a;let M=Math.round((w+1)/T.length*S);if(_&&(_.text=E.substring(0,M)),w<T.length-1)try{await No(l,i)}catch(P){if(P.name==="AbortError")return;throw P}}}}if(f<e.content.length-1)try{await No(c,i)}catch{if(err.name==="AbortError")return;throw err}}if(e?.indicator?.complete?.src){let f=e.indicator.complete.src?A.from(e.indicator.complete.src):A.EMPTY;d.texture=f,d.width=e.indicator.complete.width??f.width,d.height=e.indicator.complete.height??f.height}s&&e?.complete?.actionPayload&&s("complete",{_event:{id:e.id},...e?.complete?.actionPayload??{}})}};var hP=async({parent:r,element:t,signal:e})=>{if(e?.aborted)return;let i=r.getChildByLabel(t.id);if(i){let s=!0,o=()=>{i&&!i.destroyed&&i.destroy({children:!0})},n=async()=>{s||o()};e.addEventListener("abort",n),o(),e.removeEventListener("abort",n)}};var Rk=(r,t)=>{let e=[],i=[],s=0,o=0,n=0,a=0,h=[...r],l=new WeakSet;for(;h.length>0;){let u=h[0];if(!u.text||u.text.length===0){h.shift();continue}let d=Math.round(t-s),f={...u.textStyle,wordWrapWidth:d},p=qt.measureText(u.text,new Mt(f));if(p.lineWidths[0]>d&&i.length>0){e.push({lineParts:[...i],y:o,lineMaxHeight:n}),s=0,o+=n,n=0,i=[];continue}let m=p.lines[0];p.lines.length===1&&u.text.endsWith(" ")&&!m.endsWith(" ")&&(m+=" ");let g=qt.measureText(m,new Mt({...u.textStyle,wordWrap:!1,breakWords:!1})),b={text:m,textStyle:f,height:g.height,x:s,y:o};if(u.furigana&&!l.has(u)){l.add(u);let _=qt.measureText(u.furigana.text,new Mt(u.furigana.textStyle)),T=-_.height+o+2,E={text:u.furigana.text,textStyle:u.furigana.textStyle,x:Math.round(s+(p.lineWidths[0]-_.width)/2),y:T};b.furigana=E}i.push(b),n=Math.max(n,g.height),s+=Math.round(p.lineWidths[0]),a=Math.max(a,s);let y=p.lines.slice(1).join(" ");y&&y.length>0?u.text=y:h.shift()}i.length>0&&e.push({lineParts:i,y:o,lineMaxHeight:n});for(let u=0;u<e.length;u++){let d=e[u].lineMaxHeight;e[u].lineParts=e[u].lineParts.map(f=>{let p=f.height;f.height&&delete f.height;let m=f.y+(d-p),g=f.furigana;return g&&(g.y=g.y-f.y+m),{...f,...g&&{furigana:g},y:m}})}let c=e.length>0?e[e.length-1].y+e[e.length-1].lineMaxHeight:0;return{chunks:e,width:Math.max(a,t),height:c}},lP=({state:r})=>{let t={...Ue,wordWrap:!0,...r.textStyle||{}},e=(r.content||[]).map(c=>{let u={...t,...c.textStyle||{}};u.lineHeight=Math.round(u.lineHeight*u.fontSize),r.width&&(u.wordWrapWidth=r.width,u.wordWrap=!0);let d=null;if(c.furigana){let f={...t,...c.furigana.textStyle||{}};f.lineHeight=Math.round(f.lineHeight*f.fontSize),r.width&&(f.wordWrapWidth=r.width,f.wordWrap=!0),d={text:c.furigana.text,textStyle:f}}return{text:c.text.replace(/ +$/,f=>"\xA0".repeat(f.length)),textStyle:u,...d&&{furigana:d}}}),i=r.width||500,{chunks:s,width:o,height:n}=Rk(e,i),a=r.width||o,l=Ae({...r,width:a,height:n});if(l.alpha=r.alpha??1,r.indicator){let c=r.indicator;l.indicator={revealing:{src:c.revealing?.src??"",width:c.revealing?.width??12,height:c.revealing?.height??12},complete:{src:c.complete?.src??"",width:c.complete?.width??12,height:c.complete?.height??12},offset:c.offset??12}}return{...l,content:s,textStyle:{...t,...r.textStyle||{}},speed:r.speed??50,revealEffect:r.revealEffect??"typewriter",...r.width!==void 0&&{width:r.width},...r.complete&&{complete:r.complete}}};var Mk=le({type:"text-revealing",add:nP,update:aP,delete:hP,parse:lP});var wu=(r,t,e)=>{if(!e)return;let i=s=>{s?.detail?.elementId===t&&typeof s?.detail?.frameIndex=="number"&&r.gotoAndStop(s?.detail?.frameIndex)};window.addEventListener("snapShotAnimatedSpriteFrame",i),r._snapShotKeyFrameHandler=i},Au=r=>{r._snapShotKeyFrameHandler&&(window.removeEventListener("snapShotAnimatedSpriteFrame",r._snapShotKeyFrameHandler),delete r._snapShotKeyFrameHandler)};var cP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,eventHandler:o,signal:n})=>{let a=!0,{id:h,x:l,y:c,width:u,height:d,spritesheetSrc:f,spritesheetData:p,animation:m,alpha:g}=e,b=p,y=Object.keys(b.frames),_=new wi(A.from(f),b);await _.parse();let T=m.frames.map(M=>_.textures[y[M]]),E=new gh(T);E.label=h,E.animationSpeed=m.animationSpeed??.5,E.loop=m.loop??!0,r.debug?wu(E,h,r.debug):E.play();let S=()=>{E.x=Math.round(l),E.y=Math.round(c),E.width=Math.round(u),E.height=Math.round(d),E.alpha=g},w=async()=>{a||S()};n.addEventListener("abort",w),S(),t.addChild(E),i&&i.length>0&&(a=!1,await et(h,s,{app:r,element:E,animations:i,signal:n,eventHandler:o}),a=!0),n.removeEventListener("abort",w)};var uP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(d=>d.label===e.id),l=!0,c=async()=>{if(JSON.stringify(e)!==JSON.stringify(i)&&(h.x=Math.round(i.x),h.y=Math.round(i.y),h.width=Math.round(i.width),h.height=Math.round(i.height),h.alpha=i.alpha,JSON.stringify(e.animation)!==JSON.stringify(i.animation))){h.animationSpeed=i.animation.animationSpeed??.5,h.loop=i.animation.loop??!0;let d=i.spritesheetData,f=Object.keys(d.frames),p=new wi(A.from(i.spritesheetSrc),d);await p.parse();let m=i.animation.frames.map(g=>p.textures[f[g]]);h.textures=m,r.debug?e.id!==i.id&&(Au(h),wu(h,i.id,r.debug)):h.play()}},u=async()=>{l||await c()};a.addEventListener("abort",u),h&&(s&&s.length>0&&(l=!1,await et(e.id,o,{app:r,element:h,animations:s,signal:a,eventHandler:n}),l=!0),await c(),a.removeEventListener("abort",u))};var dP=async({app:r,parent:t,element:e,animations:i,animationPlugins:s,signal:o,eventHandler:n})=>{let a=t.children.find(h=>h.label===e.id);if(a){let h=!0,l=()=>{r.debug&&Au(a),a&&!a.destroyed&&(a.stop(),a.destroy())},c=async()=>{h||l()};o.addEventListener("abort",c),i&&i.length>0&&(h=!1,await et(e.id,s,{app:r,element:a,animations:i,signal:o,eventHandler:n}),h=!0),l(),o.removeEventListener("abort",c)}};var fP=({state:r})=>({...Ae(r),spritesheetSrc:r.spritesheetSrc??"",spritesheetData:{frames:{},meta:{},...r.spritesheetData??{}},animation:{frames:[],animationSpeed:.5,loop:!0,...r.animation??{}},alpha:r.alpha??1});var Bk=le({type:"animated-sprite",add:cP,update:uP,delete:dP,parse:fP});var Ik={linear:r=>r},Fk=(r,t,e,i)=>r+(t-r)*Ik[i](e),kk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s of t){if(i==null)return e;i=i[s]}return i===void 0?e:i},Gk=(r,t,e)=>{typeof t=="string"&&(t=kg[t]);let i=r;for(let s=0;s<t.length-1;s++){let o=t[s];o in i||(i[o]={}),i=i[o]}return i[t[t.length-1]]=e,r},Uk=r=>{let t=[],e=0,i;return r.forEach(({value:s,duration:o,easing:n="linear",relative:a},h)=>{h===0?(i=s,t.push({time:e,value:s,easing:"linear"})):o!==void 0&&n!==void 0&&(e+=o,a?i=i+s:i=s,t.push({time:e,value:i,easing:n}))}),t},Ok=(r,t)=>{if(r.length===0)return 0;if(t<=r[0].time)return r[0].value;if(t>=r[r.length-1].time)return r[r.length-1].value;for(let e=0;e<r.length-1;e++){let{time:i,value:s,easing:o}=r[e],{time:n,value:a}=r[e+1];if(t>=i&&t<=n){let h=(t-i)/(n-i);return Fk(s,a,h,o)}}return r[r.length-1].value},Lk=r=>Math.max.apply(null,r),pP=async({app:r,element:t,animation:e,signal:i,eventHandler:s})=>new Promise((o,n)=>{if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}let{properties:a,complete:h,id:l,targetId:c}=e,u=Object.entries(a).map(([_,T])=>{if(!F1[_])throw new Error(`${_} is not a supported property for transition.`);return{...T,property:_}}),d=u.map(_=>_.keyframes.reduce((T,E)=>T+E.duration||0,0)),f=Lk(d),p={};u.forEach(_=>{p[_.property]=kk(t,_.property)});let m=u.map(_=>{let T=[];_.initialValue!==void 0?T=[{value:_.initialValue}]:T=[{value:p[_.property]}],T=T.concat(_.keyframes);let E=Uk(T);return{property:_.property,timeline:E}}),g=0,b=_=>{m.forEach(({property:T,timeline:E})=>{let S=Ok(E,_);t&&!t.destroyed&&Gk(t,T,S)})};i&&i.addEventListener("abort",()=>{r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"))});let y=_=>{if(g+=_.deltaMS,g>=f){if(r.ticker.remove(y),b(f),s&&h){let T=h?.actionPayload;s("complete",{_event:{id:l,targetId:c},...T??{}})}o();return}b(g)};if(i?.aborted){r.ticker.remove(y),n(new DOMException("Operation aborted","AbortError"));return}r?.debug?window.addEventListener("snapShotKeyFrame",_=>{_?.detail?.deltaMS&&y({deltaMS:Number(_.detail.deltaMS)})}):r.ticker.add(y)});var Dk=Ig({type:"tween",animate:pP});var mP=({app:r,element:t,signal:e})=>{if(e?.aborted)return;let i={id:t.id,url:t.src,loop:t.loop??!1,volume:(t.volume??800)/1e3};t.delay&&t.delay>0?setTimeout(()=>{e?.aborted||r.audioStage.add(i)},t.delay):r.audioStage.add(i)};var gP=({app:r,prevElement:t,nextElement:e,signal:i})=>{if(!i?.aborted&&(t.src!==e.src||t.volume!==e.volume)){let s=r.audioStage.getById(t.id);s&&(s.url=e.src,s.volume=(e.volume??800)/1e3)}};var xP=({app:r,element:t,signal:e})=>{e?.aborted||r.audioStage.remove(t.id)};var Nk=Fg({type:"sound",add:mP,update:gP,delete:xP});var _h=class extends kt{emitter=null;maxLife=0;age=0;oneOverLife=0;get agePercent(){return this.age*this.oneOverLife}velocity={x:0,y:0};rotationSpeed=0;config={};next=null;prev=null;constructor(t){super(),this.emitter=t,this.anchor.set(.5,.5)}init(t){this.maxLife=t,this.age=0,this.oneOverLife=1/t,this.rotation=0,this.position.set(0,0),this.scale.set(1,1),this.tint=16777215,this.alpha=1,this.visible=!0,this.velocity.x=0,this.velocity.y=0,this.rotationSpeed=0,this.config={}}kill(){this.emitter.recycle(this)}destroy(){this.parent&&this.parent.removeChild(this),this.emitter=null,this.next=null,this.prev=null,super.destroy()}};function Ug(r){let t=new he;return t.circle(0,0,3),t.fill({color:16777215}),r.renderer.generateTexture(t)}function Og(r){let t=new he;return t.rect(0,0,1,8),t.fill({color:8965375}),r.renderer.generateTexture(t)}function Lg(r){let t=new he;return t.circle(0,0,4),t.fill({color:16777215}),r.renderer.generateTexture(t)}function bh(r,t,e){return r+(t-r)*e}function Cu(r){if(typeof r=="number")return r;let t=r.replace(/^(#|0x)/,"");return parseInt(t,16)}function yP(r,t,e){let i=r>>16&255,s=r>>8&255,o=r&255,n=t>>16&255,a=t>>8&255,h=t&255,l=Math.round(bh(i,n,e)),c=Math.round(bh(s,a,e)),u=Math.round(bh(o,h,e));return l<<16|c<<8|u}var Pu=class r{constructor(t,e,i=!1){this.value=i?Cu(t):t,this.time=e,this.next=null}static createList(t,e=!1){let i=[...t].sort((n,a)=>n.time-a.time),s=new r(i[0].value,i[0].time,e),o=s;for(let n=1;n<i.length;n++)o.next=new r(i[n].value,i[n].time,e),o=o.next;return s}},wr=class{constructor(t=!1){this.first=null,this.isColor=t,this.ease=null}reset(t){Array.isArray(t)?this.first=Pu.createList(t,this.isColor):this.first=t}getValue(t){if(this.ease&&(t=this.ease(t)),!this.first.next||t<=this.first.time)return this.first.value;let e=this.first;for(;e.next&&e.next.time<t;)e=e.next;if(!e.next||t>=e.next.time)return e.next?e.next.value:e.value;let i=(t-e.time)/(e.next.time-e.time);return this.isColor?yP(e.value,e.next.value,i):bh(e.value,e.next.value,i)}};var Ru=class{static type="alpha";constructor(t){this.list=new wr(!1),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.alpha=i,e=e.next}updateParticle(t,e){t.alpha=this.list.getValue(t.agePercent)}},Mu=class{static type="alphaStatic";constructor(t){this.alpha=t.alpha}initParticles(t){let e=t;for(;e;)e.alpha=this.alpha,e=e.next}updateParticle(t,e){}};var Bu=class{static type="scale";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.scaleMult=i;let s=this.list.getValue(0)*i;e.scale.set(s,s),e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.scaleMult;t.scale.set(i,i)}},Iu=class{static type="scaleStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.scale.set(i,i),e=e.next}}updateParticle(t,e){}};var Hk=Math.PI/180,Fu=class{static type="speed";constructor(t){this.list=new wr(!1),this.list.reset(t.list),this.minMult=t.minMult??1}initParticles(t){let e=t;for(;e;){let i=this.minMult<1?e.emitter.random()*(1-this.minMult)+this.minMult:1;e.config.speedMult=i;let s=this.list.getValue(0)*i;e.velocity.x=Math.cos(e.rotation)*s,e.velocity.y=Math.sin(e.rotation)*s,e=e.next}}updateParticle(t,e){let i=this.list.getValue(t.agePercent)*t.config.speedMult,s=Math.sqrt(t.velocity.x*t.velocity.x+t.velocity.y*t.velocity.y);s>0&&(t.velocity.x=t.velocity.x/s*i,t.velocity.y=t.velocity.y/s*i),t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},ku=class{static type="speedStatic";constructor(t){this.min=t.min,this.max=t.max}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.max-this.min)+this.min;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}},Gu=class{static type="movePoint";constructor(t){this.minSpeed=t.speed.min,this.maxSpeed=t.speed.max,this.direction=t.direction*Hk}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed;e.velocity.x=Math.cos(this.direction)*i,e.velocity.y=Math.sin(this.direction)*i,e=e.next}}updateParticle(t,e){t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Alt=Math.PI/180,Uu=class{static type="acceleration";constructor(t){this.accelX=t.accel.x,this.accelY=t.accel.y,this.minStart=t.minStart,this.maxStart=t.maxStart,this.rotate=t.rotate??!1,this.maxSpeed=t.maxSpeed??0}initParticles(t){let e=t;for(;e;){let i=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart;e.velocity.x=Math.cos(e.rotation)*i,e.velocity.y=Math.sin(e.rotation)*i,e=e.next}}updateParticle(t,e){let i=t.velocity,s=i.x,o=i.y;if(i.x+=this.accelX*e,i.y+=this.accelY*e,this.maxSpeed>0){let n=Math.sqrt(i.x*i.x+i.y*i.y);if(n>this.maxSpeed){let a=this.maxSpeed/n;i.x*=a,i.y*=a}}t.x+=(s+i.x)/2*e,t.y+=(o+i.y)/2*e,this.rotate&&(t.rotation=Math.atan2(i.y,i.x))}},Ou=class{static type="gravity";constructor(t){this.gravity=t.gravity}initParticles(t){}updateParticle(t,e){t.velocity.y+=this.gravity*e,t.x+=t.velocity.x*e,t.y+=t.velocity.y*e}};var Oi=Math.PI/180,Lu=class{static type="rotation";constructor(t){this.minStart=t.minStart*Oi,this.maxStart=t.maxStart*Oi,this.minSpeed=t.minSpeed*Oi,this.maxSpeed=t.maxSpeed*Oi,this.accel=(t.accel??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.maxStart-this.minStart)+this.minStart,e.rotationSpeed=e.emitter.random()*(this.maxSpeed-this.minSpeed)+this.minSpeed,e=e.next}updateParticle(t,e){if(this.accel!==0){let i=t.rotationSpeed;t.rotationSpeed+=this.accel*e,t.rotation+=(i+t.rotationSpeed)/2*e}else t.rotation+=t.rotationSpeed*e}},Du=class{static type="rotationStatic";constructor(t){this.min=t.min*Oi,this.max=t.max*Oi}initParticles(t){let e=t;for(;e;)e.rotation=e.emitter.random()*(this.max-this.min)+this.min,e=e.next}updateParticle(t,e){}},Nu=class{static type="noRotation";constructor(t){this.rotation=(t.rotation??0)*Oi}initParticles(t){let e=t;for(;e;)e.rotation=this.rotation,e=e.next}updateParticle(t,e){t.rotation=this.rotation}};var Hu=class{static type="color";constructor(t){this.list=new wr(!0),this.list.reset(t.list)}initParticles(t){let e=t,i=this.list.getValue(0);for(;e;)e.tint=i,e=e.next}updateParticle(t,e){t.tint=this.list.getValue(t.agePercent)}},Vu=class{static type="colorStatic";constructor(t){this.color=Cu(t.color)}initParticles(t){let e=t;for(;e;)e.tint=this.color,e=e.next}updateParticle(t,e){}};var Wu=class{constructor(t){this.x=t.x,this.y=t.y,this.w=t.w,this.h=t.h}getRandPos(t,e){t.x=this.x+e.random()*this.w,t.y=this.y+e.random()*this.h}},zu=class{constructor(t){this.x=t.x,this.y=t.y,this.radius=t.radius,this.innerRadius=t.innerRadius??0,this.affectRotation=t.affectRotation??!1}getRandPos(t,e){let i=e.random()*Math.PI*2,s=this.radius-this.innerRadius,o=e.random()*s+this.innerRadius;t.x=this.x+Math.cos(i)*o,t.y=this.y+Math.sin(i)*o,this.affectRotation&&(t.rotation=i)}},Dg=class{constructor(t){this.x=t.x,this.y=t.y}getRandPos(t,e){t.x=this.x,t.y=this.y}},Ng=class{constructor(t){this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2}getRandPos(t,e){let i=e.random();t.x=this.x1+(this.x2-this.x1)*i,t.y=this.y1+(this.y2-this.y1)*i}},Vk={rect:Wu,rectangle:Wu,torus:zu,circle:zu,point:Dg,line:Ng};var $u=class{static type="spawnShape";constructor(t){let e=Vk[t.type];if(!e)throw new Error(`Unknown spawn shape type: ${t.type}`);this.shape=new e(t.data)}initParticles(t){let e=t,i={x:0,y:0,rotation:void 0};for(;e;)this.shape.getRandPos(i,e.emitter),e.x=i.x,e.y=i.y,i.rotation!==void 0&&(e.rotation=i.rotation),e=e.next}updateParticle(t,e){}},Xu=class{static type="spawnBurst";constructor(t){this.x=t.x,this.y=t.y,this.spacing=(t.spacing??0)*Math.PI/180,this.startAngle=(t.startAngle??0)*Math.PI/180}initParticles(t){let e=t,i=this.startAngle;for(;e;)e.x=this.x,e.y=this.y,e.rotation=i,i+=this.spacing,e=e.next}updateParticle(t,e){}};var _P=new Map,bP=new Map;function Hg(r,t){_P.set(r,t)}function Pe(r){bP.set(r.type,r)}function vP(r,t){let e=_P.get(r);return e?e(t):null}function TP(r){return bP.get(r)}Hg("circle",Lg);Hg("snowflake",Ug);Hg("raindrop",Og);Pe(Ru);Pe(Mu);Pe(Bu);Pe(Iu);Pe(Fu);Pe(ku);Pe(Gu);Pe(Uu);Pe(Ou);Pe(Lu);Pe(Du);Pe(Nu);Pe(Hu);Pe(Vu);Pe($u);Pe(Xu);var ju=class{constructor(t){this.seed=t,this.state=t}next(){let t=this.state+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}reset(){this.state=this.seed}};var vh=class{container=null;texture=null;_activeFirst=null;_activeLast=null;_poolFirst=null;particleCount=0;maxParticles=1e3;lifetime={min:1,max:2};frequency=.1;particlesPerWave=1;_spawnTimer=0;emitterLifetime=-1;_emitterAge=0;emit=!0;destroyed=!1;initBehaviors=[];updateBehaviors=[];recycleBehaviors=[];spawnBounds=null;recycleOnBounds=!1;rng=null;constructor(t,e){this.container=t,this.init(e)}init(t){if(t.seed!==void 0&&t.seed!==null&&(this.rng=new ju(t.seed)),t.texture&&(this.texture=t.texture),t.lifetime&&(this.lifetime.min=t.lifetime.min??1,this.lifetime.max=t.lifetime.max??t.lifetime.min??2),this.frequency=t.frequency??.1,this.particlesPerWave=t.particlesPerWave??1,this.maxParticles=t.maxParticles??1e3,this.emitterLifetime=t.emitterLifetime??-1,t.spawnBounds&&(this.spawnBounds=t.spawnBounds,this.recycleOnBounds=t.recycleOnBounds??!1),this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[],t.behaviors)for(let e of t.behaviors){let i=TP(e.type);if(!i){console.warn(`Unknown behavior type: ${e.type}`);continue}let s=new i(e.config);s.initParticles&&this.initBehaviors.push(s),s.updateParticle&&this.updateBehaviors.push(s),s.recycleParticle&&this.recycleBehaviors.push(s)}this._spawnTimer=0,this._emitterAge=0,this.emit=t.emit??!0}_createParticle(){let t;return this._poolFirst?(t=this._poolFirst,this._poolFirst=t.next,t.next=null):t=new _h(this),t.texture=this.texture,t}spawn(t){if(this.destroyed||t<=0)return null;let e=this.maxParticles-this.particleCount;if(t=Math.min(t,e),t<=0)return null;let i=null,s=null;for(let o=0;o<t;o++){let n=this._createParticle(),a=this.lifetime.min+this.random()*(this.lifetime.max-this.lifetime.min);n.init(a),i||(i=n),s&&(s.next=n,n.prev=s),s=n,this.container.addChild(n)}for(let o of this.initBehaviors)o.initParticles(i);return this._activeLast?(this._activeLast.next=i,i.prev=this._activeLast):this._activeFirst=i,this._activeLast=s,this.particleCount+=t,i}emitNow(){this.spawn(this.particlesPerWave)}recycle(t){for(let e of this.recycleBehaviors)e.recycleParticle(t);t.prev?t.prev.next=t.next:this._activeFirst=t.next,t.next?t.next.prev=t.prev:this._activeLast=t.prev,t.prev=null,t.next=null,t.parent&&t.parent.removeChild(t),t.next=this._poolFirst,this._poolFirst=t,this.particleCount--}update(t){if(this.destroyed)return;if(this.emitterLifetime>0&&(this._emitterAge+=t,this._emitterAge>=this.emitterLifetime&&(this.emit=!1)),this.emit)if(this.frequency<=0)this.spawn(this.particlesPerWave),this.emit=!1;else for(this._spawnTimer+=t;this._spawnTimer>=this.frequency;)this._spawnTimer-=this.frequency,this.spawn(this.particlesPerWave);let e=this._activeFirst;for(;e;){let i=e.next;if(e.age+=t,e.age>=e.maxLife){this.recycle(e),e=i;continue}if(this.recycleOnBounds&&this.spawnBounds){let s=this.spawnBounds;if(e.x<s.x||e.x>s.x+s.width||e.y<s.y||e.y>s.y+s.height){this.recycle(e),e=i;continue}}for(let s of this.updateBehaviors)s.updateParticle(e,t);e=i}}stop(t=!1){if(this.emit=!1,t)for(;this._activeFirst;)this.recycle(this._activeFirst)}restart(){this._emitterAge=0,this._spawnTimer=0,this.emit=!0}random(){return this.rng?this.rng.next():Math.random()}destroy(){if(this.destroyed)return;this.destroyed=!0,this.emit=!1;let t=this._activeFirst;for(;t;){let e=t.next;t.destroy(),t=e}for(t=this._poolFirst;t;){let e=t.next;t.destroy(),t=e}this._activeFirst=null,this._activeLast=null,this._poolFirst=null,this.initBehaviors=[],this.updateBehaviors=[],this.recycleBehaviors=[]}};function Wk(r,t){let e=new he,i=t.color??"#ffffff";switch(t.shape){case"circle":{let s=t.radius??3;e.circle(0,0,s),e.fill({color:i});break}case"ellipse":{let s=t.width??2,o=t.height??6;e.ellipse(0,0,s/2,o/2),e.fill({color:i});break}case"rect":{let s=t.width??4,o=t.height??4;e.rect(-s/2,-o/2,s,o),e.fill({color:i});break}default:e.circle(0,0,3),e.fill({color:i})}return r.renderer.generateTexture(e)}var Th=async({app:r,parent:t,element:e,signal:i})=>{if(i?.aborted)return;let s=new xt;s.label=e.id,t.addChild(s);let o=e.width,n=e.height;s.x=e.x??0,s.y=e.y??0;let a={lifetime:e.emitter?.lifetime??{min:1,max:2},frequency:e.emitter?.frequency??.1,particlesPerWave:e.emitter?.particlesPerWave??1,maxParticles:e.emitter?.maxParticles??e.count??100,emitterLifetime:e.emitter?.emitterLifetime??-1,spawnBounds:e.emitter?.spawnBounds,recycleOnBounds:e.emitter?.recycleOnBounds??!1,seed:e.emitter?.seed,behaviors:e.behaviors},h;if(typeof e.texture=="object"&&e.texture.shape)h=Wk(r,e.texture);else{let u=e.texture??"circle";if(h=vP(u,r),!h)try{h=A.from(u)}catch{console.warn(`Failed to load particle texture: ${u}`);return}}a.texture=h;let l=new vh(s,a);if(s.emitter=l,a.recycleOnBounds){let u=Math.min(e.count??100,a.maxParticles);l.spawn(u);let d=l._activeFirst;for(;d;)d.y=l.random()*n,d.age=l.random()*d.maxLife*.8,d=d.next}let c=u=>{if(l.destroyed){r.ticker.remove(c);return}l.update(u.deltaTime/60)};if(s.tickerCallback=c,r?.debug){let u=d=>{if(l.destroyed){window.removeEventListener("snapShotKeyFrame",u);return}d?.detail?.deltaMS&&l.update(Number(d.detail.deltaMS)/1e3)};window.addEventListener("snapShotKeyFrame",u),s.customTickerHandler=u}else r.ticker.add(c);e.alpha!==void 0&&(s.alpha=e.alpha)};var Yu=async({app:r,parent:t,element:e,animationPlugins:i,animations:s,signal:o})=>{if(o?.aborted)return;let n=t.getChildByLabel(e.id);if(n){let a=()=>{n&&!n.destroyed&&(n.emitter&&n.emitter.destroy(),n.tickerCallback&&r.ticker.remove(n.tickerCallback),n.customTickerHandler&&window.removeEventListener("snapShotKeyFrame",n.customTickerHandler),n.destroy({children:!0}))};o.addEventListener("abort",()=>{a()}),s&&s.length>0&&await et(e.id,i,{app:r,element:n,animations:s,signal:o}),a()}};var SP=async({app:r,parent:t,prevElement:e,nextElement:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})=>{let h=t.children.find(c=>c.label===e.id);if(!h){await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a});return}zk(e,i)?(await Yu({app:r,parent:t,element:e,animations:s,animationPlugins:o,eventHandler:n,signal:a}),await Th({app:r,parent:t,element:i,animations:s,animationPlugins:o,eventHandler:n,signal:a})):(i.alpha!==void 0&&(h.alpha=i.alpha),i.x!==void 0&&(h.x=i.x),i.y!==void 0&&(h.y=i.y))};function zk(r,t){return r.count!==t.count||JSON.stringify(r.texture)!==JSON.stringify(t.texture)||JSON.stringify(r.behaviors)!==JSON.stringify(t.behaviors)||JSON.stringify(r.emitter)!==JSON.stringify(t.emitter)||r.width!==t.width||r.height!==t.height}function EP(r){if(!r.id)throw new Error("Input Error: Id is missing");if(!Object.values(fs).includes(r.type))throw new Error("Input Error: Type must be one of "+Object.values(fs).join(", "));if(typeof r.width!="number"||typeof r.height!="number")throw new Error("Input Error: Width and height must be numbers");if(r.width<=0||r.height<=0)throw new Error("Input Error: Width and height must be positive")}function wP(r){if(!r.texture)throw new Error("Input Error: Particles require 'texture'");let t=typeof r.texture=="string",e=typeof r.texture=="object"&&r.texture!==null&&!Array.isArray(r.texture);if(!t&&!e)throw new Error("Input Error: texture must be a string or shape object");if(e){if(!r.texture.shape)throw new Error("Input Error: texture object must have 'shape' property");if(!["circle","ellipse","rect"].includes(r.texture.shape))throw new Error(`Input Error: texture.shape must be 'circle', 'ellipse', or 'rect', got '${r.texture.shape}'`)}}function AP(r){if(!r.behaviors)throw new Error("Input Error: Particles require 'behaviors'");if(!Array.isArray(r.behaviors))throw new Error("Input Error: 'behaviors' must be an array");if(r.behaviors.length===0)throw new Error("Input Error: 'behaviors' array cannot be empty");for(let t=0;t<r.behaviors.length;t++){let e=r.behaviors[t];if(typeof e!="object"||e===null||Array.isArray(e))throw new Error(`Input Error: behaviors[${t}] must be an object`);if(!e.type||typeof e.type!="string")throw new Error(`Input Error: behaviors[${t}] must have a 'type' string property`)}}function PP(r){if(!r.emitter)throw new Error("Input Error: Particles require 'emitter'");if(typeof r.emitter!="object"||Array.isArray(r.emitter))throw new Error("Input Error: 'emitter' must be an object");if(!r.emitter.lifetime)throw new Error("Input Error: emitter.lifetime is required");if(typeof r.emitter.lifetime!="object"||Array.isArray(r.emitter.lifetime))throw new Error("Input Error: emitter.lifetime must be an object");if(typeof r.emitter.lifetime.min!="number"||typeof r.emitter.lifetime.max!="number")throw new Error("Input Error: emitter.lifetime.min and max must be numbers");if(r.emitter.lifetime.min<0||r.emitter.lifetime.max<0)throw new Error("Input Error: emitter.lifetime.min and max must be non-negative");if(r.emitter.lifetime.min>r.emitter.lifetime.max)throw new Error("Input Error: emitter.lifetime.min cannot be greater than max")}function CP(r){if(r.emitter.frequency!==void 0){if(typeof r.emitter.frequency!="number")throw new Error("Input Error: emitter.frequency must be a number");if(r.emitter.frequency<0)throw new Error("Input Error: emitter.frequency must be non-negative")}if(r.emitter.particlesPerWave!==void 0){if(typeof r.emitter.particlesPerWave!="number")throw new Error("Input Error: emitter.particlesPerWave must be a number");if(r.emitter.particlesPerWave<=0)throw new Error("Input Error: emitter.particlesPerWave must be positive");if(!Number.isInteger(r.emitter.particlesPerWave))throw new Error("Input Error: emitter.particlesPerWave must be an integer")}if(r.emitter.maxParticles!==void 0){if(typeof r.emitter.maxParticles!="number")throw new Error("Input Error: emitter.maxParticles must be a number");if(r.emitter.maxParticles<=0)throw new Error("Input Error: emitter.maxParticles must be positive");if(!Number.isInteger(r.emitter.maxParticles))throw new Error("Input Error: emitter.maxParticles must be an integer")}}function RP(r){if(r.count!==void 0){if(typeof r.count!="number")throw new Error("Input Error: count must be a number");if(r.count<=0)throw new Error("Input Error: count must be positive");if(!Number.isInteger(r.count))throw new Error("Input Error: count must be an integer")}if(r.alpha!==void 0){if(typeof r.alpha!="number")throw new Error("Input Error: alpha must be a number");if(r.alpha<0||r.alpha>1)throw new Error("Input Error: alpha must be between 0 and 1")}if(r.x!==void 0&&typeof r.x!="number")throw new Error("Input Error: x must be a number");if(r.y!==void 0&&typeof r.y!="number")throw new Error("Input Error: y must be a number")}var MP=({state:r})=>{EP(r),wP(r),AP(r),PP(r),CP(r),RP(r);let t=r.emitter?.maxParticles??r.count??100,e=r.emitter;return e&&e.maxParticles===void 0&&r.count!==void 0&&(e={...e,maxParticles:t}),{id:r.id,type:r.type,count:t,texture:r.texture,behaviors:r.behaviors,emitter:e,x:r.x??0,y:r.y??0,width:r.width,height:r.height,alpha:r.alpha??1}};var $k=le({type:"particles",add:Th,update:SP,delete:Yu,parse:MP});var BP=(r=[],t=[])=>{let e=new Set,i=new Map,s=new Map,o=[],n=[],a=[];for(let h of r)e.add(h.id),i.set(h.id,h);for(let h of t)e.add(h.id),s.set(h.id,h);for(let h of e){let l=i.get(h),c=s.get(h);!l&&c?o.push(c):l&&!c?n.push(l):(l.src!==c.src||l.volume!==c.volume||l.loop!==c.loop||l.delay!==c.delay)&&a.push({prev:l,next:c})}return{toAddElement:o,toDeleteElement:n,toUpdateElement:a}};var Vg=async({app:r,prevAudioTree:t,nextAudioTree:e,audioPlugins:i,signal:s})=>{let{toAddElement:o,toDeleteElement:n,toUpdateElement:a}=BP(t,e),h=[];for(let l of n){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.delete({app:r,element:l,signal:s}))}for(let l of o){let c=i.find(u=>u.type===l.type);if(!c)throw new Error(`No audio plugin found for type: ${l.type}`);h.push(c.add({app:r,element:l,signal:s}))}for(let{prev:l,next:c}of a){let u=i.find(d=>d.type===c.type);if(!u)throw new Error(`No audio plugin found for type: ${c.type}`);h.push(u.update({app:r,prevElement:l,nextElement:c,signal:s}))}await Promise.all(h)};var Ze=(r=>(r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2",r))(Ze||{}),Wg=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS",r))(Wg||{}),qu=(r=>(r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL",r))(qu||{}),Z=(r=>(r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR",r))(Z||{}),Ho=(r=>(r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN",r))(Ho||{}),G=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(G||{}),ci=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(ci||{}),it=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(it||{}),N=(r=>(r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT",r))(N||{}),fr=(r=>(r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR",r))(fr||{}),Sh=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(Sh||{}),Ar=(r=>(r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL",r))(Ar||{}),Qe=(r=>(r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",r))(Qe||{}),Li=(r=>(r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT",r))(Li||{}),Ku=(r=>(r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",r))(Ku||{}),Oe=(r=>(r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp",r))(Oe||{}),re=(r=>(r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR",r))(re||{});var Pt=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Pt||{}),Xe=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Xe||{});var zg={createCanvas:(r,t)=>{let e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};var Y={ADAPTER:zg,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};Cf();var Xk=Si.default??Si,Pr=Xk(globalThis.navigator);Y.RETINA_PREFIX=/@([0-9\.]+)x/;Y.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var bs=$i(FP(),1),OU=$i(uc(),1);var Ex=$i(qR(),1);var KR={};function lt(r,t,e=3){if(KR[t])return;let i=new Error().stack;typeof i>"u"?console.warn("PixiJS Deprecation Warning: ",`${t}
|
|
1145
1145
|
Deprecated since v${r}`):(i=i.split(`
|
|
1146
1146
|
`).splice(e).join(`
|
|
1147
1147
|
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
|