@drincs/pixi-vn 1.1.2 → 1.2.0
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/canvas/CanvasManager.cjs +1 -1
- package/dist/canvas/CanvasManager.js +1 -1
- package/dist/canvas/CanvasManagerStatic.cjs +1 -1
- package/dist/canvas/CanvasManagerStatic.js +1 -1
- package/dist/canvas/components/Container.cjs +1 -1
- package/dist/canvas/components/Container.js +1 -1
- package/dist/canvas/components/ImageContainer.cjs +1 -1
- package/dist/canvas/components/ImageContainer.js +1 -1
- package/dist/canvas/components/ImageSprite.cjs +2 -2
- package/dist/canvas/components/ImageSprite.js +2 -2
- package/dist/canvas/components/Sprite.cjs +1 -1
- package/dist/canvas/components/Sprite.js +1 -1
- package/dist/canvas/components/Text.cjs +1 -1
- package/dist/canvas/components/Text.js +1 -1
- package/dist/canvas/components/VideoSprite.cjs +2 -2
- package/dist/canvas/components/VideoSprite.js +2 -2
- package/dist/canvas/decorators/canvas-element-decorator.cjs +1 -1
- package/dist/canvas/decorators/canvas-element-decorator.js +1 -1
- package/dist/canvas/decorators/event-decorator.cjs +1 -1
- package/dist/canvas/decorators/event-decorator.js +1 -1
- package/dist/canvas/functions/canvas-effect.cjs +1 -1
- package/dist/canvas/functions/canvas-effect.js +1 -1
- package/dist/canvas/functions/canvas-import-utility.cjs +1 -1
- package/dist/canvas/functions/canvas-import-utility.js +1 -1
- package/dist/canvas/functions/canvas-transition.cjs +1 -1
- package/dist/canvas/functions/canvas-transition.js +1 -1
- package/dist/canvas/functions/image-container-utility.cjs +1 -1
- package/dist/canvas/functions/image-container-utility.js +1 -1
- package/dist/canvas/functions/image-utility.cjs +1 -1
- package/dist/canvas/functions/image-utility.js +1 -1
- package/dist/canvas/functions/video-utility.cjs +1 -1
- package/dist/canvas/functions/video-utility.js +1 -1
- package/dist/canvas/index.cjs +1 -1
- package/dist/canvas/index.js +1 -1
- package/dist/canvas/tickers/classes/TickerBase.cjs +1 -1
- package/dist/canvas/tickers/classes/TickerBase.js +1 -1
- package/dist/canvas/tickers/components/FadeAlphaTicker.cjs +1 -1
- package/dist/canvas/tickers/components/FadeAlphaTicker.js +1 -1
- package/dist/canvas/tickers/components/MoveTicker.cjs +1 -1
- package/dist/canvas/tickers/components/MoveTicker.js +1 -1
- package/dist/canvas/tickers/components/RotateTicker.cjs +1 -1
- package/dist/canvas/tickers/components/RotateTicker.js +1 -1
- package/dist/canvas/tickers/components/ZoomTicker.cjs +1 -1
- package/dist/canvas/tickers/components/ZoomTicker.js +1 -1
- package/dist/canvas/tickers/decorators/ticker-decorator.cjs +1 -1
- package/dist/canvas/tickers/decorators/ticker-decorator.js +1 -1
- package/dist/canvas/tickers/functions/ticker-texture-utility.cjs +1 -1
- package/dist/canvas/tickers/functions/ticker-texture-utility.js +1 -1
- package/dist/canvas/tickers/index.cjs +1 -1
- package/dist/canvas/tickers/index.js +1 -1
- package/dist/character/classes/CharacterBaseModel.cjs +17 -17
- package/dist/character/classes/CharacterBaseModel.js +17 -17
- package/dist/character/classes/CharacterStoredClass.cjs +16 -16
- package/dist/character/classes/CharacterStoredClass.js +16 -16
- package/dist/character/decorators/character-decorator.cjs +1 -1
- package/dist/character/decorators/character-decorator.js +1 -1
- package/dist/character/index.cjs +16 -16
- package/dist/character/index.js +16 -16
- package/dist/classes/CachedMap.cjs +1 -1
- package/dist/classes/CachedMap.d.cts +1 -1
- package/dist/classes/CachedMap.d.ts +1 -1
- package/dist/classes/CachedMap.js +1 -1
- package/dist/classes/index.cjs +1 -1
- package/dist/classes/index.js +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.d.cts +5 -1
- package/dist/constants.d.ts +5 -1
- package/dist/constants.js +1 -1
- package/dist/history/HistoryManager.cjs +2 -2
- package/dist/history/HistoryManager.d.cts +24 -13
- package/dist/history/HistoryManager.d.ts +24 -13
- package/dist/history/HistoryManager.js +2 -2
- package/dist/history/HistoryManagerStatic.cjs +1 -1
- package/dist/history/HistoryManagerStatic.d.cts +9 -8
- package/dist/history/HistoryManagerStatic.d.ts +9 -8
- package/dist/history/HistoryManagerStatic.js +1 -1
- package/dist/history/index.cjs +2 -2
- package/dist/history/index.d.cts +4 -2
- package/dist/history/index.d.ts +4 -2
- package/dist/history/index.js +2 -2
- package/dist/history/interfaces/HistoryManagerInterface.d.cts +54 -11
- package/dist/history/interfaces/HistoryManagerInterface.d.ts +54 -11
- package/dist/{index-CWhYJ7yq.d.ts → index-CvpVN1rC.d.ts} +3 -3
- package/dist/{index-CVn6zVij.d.cts → index-DCnX_VPi.d.cts} +3 -3
- package/dist/index.cjs +73 -73
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +73 -73
- package/dist/narration/NarrationManager.cjs +16 -16
- package/dist/narration/NarrationManager.d.cts +1 -1
- package/dist/narration/NarrationManager.d.ts +1 -1
- package/dist/narration/NarrationManager.js +16 -16
- package/dist/narration/NarrationManagerStatic.cjs +1 -1
- package/dist/narration/NarrationManagerStatic.js +1 -1
- package/dist/narration/classes/ChoiceMenuOption.cjs +1 -1
- package/dist/narration/classes/ChoiceMenuOption.js +1 -1
- package/dist/narration/decorators/RegisteredLabels.cjs +1 -1
- package/dist/narration/decorators/RegisteredLabels.js +1 -1
- package/dist/narration/decorators/newLabel.cjs +1 -1
- package/dist/narration/decorators/newLabel.js +1 -1
- package/dist/narration/index.cjs +17 -17
- package/dist/narration/index.d.cts +2 -2
- package/dist/narration/index.d.ts +2 -2
- package/dist/narration/index.js +17 -17
- package/dist/narration/interfaces/HistoryStep.d.cts +5 -5
- package/dist/narration/interfaces/HistoryStep.d.ts +5 -5
- package/dist/narration/interfaces/{NarrativeHistory.d.cts → NarrationHistory.d.cts} +2 -2
- package/dist/narration/interfaces/{NarrativeHistory.d.ts → NarrationHistory.d.ts} +2 -2
- package/dist/narration/interfaces/NarrationManagerInterface.d.cts +1 -1
- package/dist/narration/interfaces/NarrationManagerInterface.d.ts +1 -1
- package/dist/pixi-devtools/additionalPositionsProperties.cjs +1 -1
- package/dist/pixi-devtools/additionalPositionsProperties.js +1 -1
- package/dist/pixi-vn.d.d.cts +44 -1
- package/dist/pixi-vn.d.d.ts +44 -1
- package/dist/storage/StorageManager.cjs +1 -1
- package/dist/storage/StorageManager.js +1 -1
- package/dist/storage/StorageManagerStatic.cjs +1 -1
- package/dist/storage/StorageManagerStatic.js +1 -1
- package/dist/storage/classes/StoredClassModel.cjs +1 -1
- package/dist/storage/classes/StoredClassModel.js +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.js +1 -1
- package/dist/utils/diff-utility.d.cts +2 -2
- package/dist/utils/diff-utility.d.ts +2 -2
- package/package.json +3 -3
- /package/dist/narration/interfaces/{NarrativeHistory.cjs → NarrationHistory.cjs} +0 -0
- /package/dist/narration/interfaces/{NarrativeHistory.js → NarrationHistory.js} +0 -0
|
@@ -617,4 +617,4 @@ ${u}`)}});return await Promise.all(h),n?s[o[0].src]:s}async unload(t){let i=Ct(t
|
|
|
617
617
|
};
|
|
618
618
|
|
|
619
619
|
})();
|
|
620
|
-
`,Qr=null,ds=class{constructor(){Qr||(Qr=URL.createObjectURL(new Blob([Jy],{type:"application/javascript"}))),this.worker=new Worker(Qr);}};ds.revokeObjectURL=function(){Qr&&(URL.revokeObjectURL(Qr),Qr=null);};var $g=0,vl,Tl=class{constructor(){this._initialized=false,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 Zr;e.addEventListener("message",i=>{e.terminate(),Zr.revokeObjectURL(),t(i.data);});}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=true);}_getWorker(){vl===void 0&&(vl=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return !t&&this._createdWorkers<vl&&(this._createdWorkers++,t=new ds().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,n)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:n});});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[$g]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:$g++,id:i});}},wl=new Tl;_e();var tb=[".jpeg",".jpg",".png",".webp",".avif"],eb=["image/jpeg","image/png","image/webp","image/avif"];async function rb(r,t){let e=await W.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 xo={name:"loadTextures",extension:{type:T.LoadParser,priority:mt.High,name:"loadTextures"},config:{preferWorkers:true,preferCreateImageBitmap:true,crossOrigin:"anonymous"},test(r){return Yt(r,eb)||Xt(r,tb)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await wl.isImageBitmapSupported()?i=await wl.loadImageBitmap(r,t):i=await rb(r,t):i=await new Promise((n,o)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?n(i):(i.onload=()=>{n(i);},i.onerror=o);});let s=new kt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||jr(r),...t.data});return Kr(s,e,r)},unload(r){r.destroy(true);}};A();Ra();Fa();var Yg=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],ib=Yg.map(r=>`video/${r.substring(1)}`);function sb(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=ob(t):e!==false&&(r.crossOrigin=typeof e=="string"?e:"anonymous");}function nb(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){n(),t();}function s(o){n(),e(o);}function n(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s);}})}function ob(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 Xg={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=Yt(r,ib),e=Xt(r,Yg);return t||e},async load(r,t,e){let i={...yr.defaultOptions,resolution:t.data?.resolution||jr(r),alphaMode:t.data?.alphaMode||await nn(),...t.data},s=document.createElement("video"),n={preload:i.autoLoad!==false?"auto":void 0,"webkit-playsinline":i.playsinline!==false?"":void 0,playsinline:i.playsinline!==false?"":void 0,muted:i.muted===true?"":void 0,loop:i.loop===true?"":void 0,autoplay:i.autoPlay!==false?"":void 0};Object.keys(n).forEach(h=>{let l=n[h];l!==void 0&&s.setAttribute(h,l);}),i.muted===true&&(s.muted=true),sb(s,r,i.crossorigin);let o=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=yr.MIME_TYPES[h]||`video/${h}`;}return o.src=r,a&&(o.type=a),new Promise(h=>{let l=async()=>{let c=new yr({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await nb(s),h(Kr(c,e,r));};s.addEventListener("canplay",l),s.appendChild(o);})},unload(r){r.destroy(true);}};A();gr();A();gr();var _o={extension:{type:T.ResolveParser,name:"resolveTexture"},test:xo.test,parse:r=>({resolution:parseFloat(Wt.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var jg={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Wt.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:_o.parse};gr();Ii();Js();var yo=class{constructor(){this._detections=[],this._initialized=false,this.resolver=new Wt,this.loader=new go,this.cache=j,this._backgroundLoader=new po(this.loader),this._backgroundLoader.active=true,this.reset();}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=true,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let n=t.manifest;typeof n=="string"&&(n=await this.load(n)),this.resolver.addManifest(n);}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=Ze(t),s=Ct(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}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e);}async loadBundle(t,e){this._initialized||await this.init();let i=false;typeof t=="string"&&(i=true,t=[t]);let s=this.resolver.resolveBundle(t),n={},o=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h);},c=o.map(u=>{let f=s[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{n[u]=d;})});return await Promise.all(c),i?n[t[0]]:n}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=false;}get(t){if(typeof t=="string")return j.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=j.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=false;let s=await this.loader.load(i,e);this._backgroundLoader.active=true;let n={};return i.forEach(o=>{let a=s[o.src],h=[o.src];o.alias&&h.push(...o.alias),h.forEach(l=>{n[l]=a;}),j.set(h,a);}),n}async unload(t){this._initialized||await this.init();let e=Ct(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=Ct(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=>{j.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];});});}},Ut=new yo;R.handleByList(T.LoadParser,Ut.loader.parsers).handleByList(T.ResolveParser,Ut.resolver.parsers).handleByList(T.CacheParser,Ut.cache.parsers).handleByList(T.DetectionParser,Ut.detections);R.add(Rg,Dg,kg,zg,Ug,Lg,Og,Wg,Vg,Hg,Ng,xo,Xg,Fg,Ig,_o,jg);var Kg={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};R.handle(T.Asset,r=>{let t=r.ref;Object.entries(Kg).filter(([e])=>!!t[e]).forEach(([e,i])=>R.add(Object.assign(t[e],{extension:t[e].extension??i})));},r=>{let t=r.ref;Object.keys(Kg).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]));});Bs();ht();Qs();var bo=class extends Ae{constructor(t,e){let{text:i,resolution:s,style:n,anchor:o,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=s??null,this.allowChildren=false,this._anchor=new yt({_onUpdate:()=>{this.onViewUpdate();}}),o&&(this.anchor=o),this.roundPixels=l??false,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,n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){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 qg(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(D(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}to();Wr();var fs=class extends bo{constructor(...t){let e=qg(t,"Text");super(e,Dt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=$t.measureText(this._text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n;}};_e();gt();at();Da();fr();Ca();Ai();Lt();Me();Ms(dh());R.add(Cg,Bg);var ce={};Sx(ce,{DistortionFilter:()=>vo,EqualizerFilter:()=>jt,Filter:()=>ft,MonoFilter:()=>To,ReverbFilter:()=>wo,StereoFilter:()=>So,StreamFilter:()=>Po,TelephoneFilter:()=>Ao});var Zg;function Qg(r){return Zg=r,r}function K(){return Zg}var ft=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var vo=class extends ft{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),n=Math.PI/180,o=0,a;for(;o<i;++o)a=o*2/i-1,s[o]=(3+e)*a*20*n/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var ut=class{static setParamValue(t,e){if(t.setValueAtTime){let i=K().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var q=class extends ft{constructor(r=0,t=0,e=0,i=0,s=0,n=0,o=0,a=0,h=0,l=0){let c=[],u=[{f:q.F32,type:"lowshelf",gain:r},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:i},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:n},{f:q.F2K,type:"peaking",gain:o},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(c=u.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,ut.setParamValue(d.Q,1),d.frequency.value=f.f,ut.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);ut.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(q.F32,r);}get f32(){return this.getGain(q.F32)}set f64(r){this.setGain(q.F64,r);}get f64(){return this.getGain(q.F64)}set f125(r){this.setGain(q.F125,r);}get f125(){return this.getGain(q.F125)}set f250(r){this.setGain(q.F250,r);}get f250(){return this.getGain(q.F250)}set f500(r){this.setGain(q.F500,r);}get f500(){return this.getGain(q.F500)}set f1k(r){this.setGain(q.F1K,r);}get f1k(){return this.getGain(q.F1K)}set f2k(r){this.setGain(q.F2K,r);}get f2k(){return this.getGain(q.F2K)}set f4k(r){this.setGain(q.F4K,r);}get f4k(){return this.getGain(q.F4K)}set f8k(r){this.setGain(q.F8K,r);}get f8k(){return this.getGain(q.F8K)}set f16k(r){this.setGain(q.F16K,r);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(r=>{ut.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},jt=q;jt.F32=32;jt.F64=64;jt.F125=125;jt.F250=250;jt.F500=500;jt.F1K=1e3;jt.F2K=2e3;jt.F4K=4e3;jt.F8K=8e3;jt.F16K=16e3;var To=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var wo=class extends ft{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),n=s.getChannelData(0),o=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var So=class extends ft{constructor(t=0){let e,i,s;if(!K().useLegacy){let{audioContext:n}=K().context;n.createStereoPanner?(e=n.createStereoPanner(),s=e):(i=n.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?ut.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Po=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Ao=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context,s=i.createBiquadFilter(),n=i.createBiquadFilter(),o=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",ut.setParamValue(s.frequency,2e3),n.type="lowpass",ut.setParamValue(n.frequency,2e3),o.type="highpass",ut.setParamValue(o.frequency,500),a.type="highpass",ut.setParamValue(a.frequency,500),s.connect(n),n.connect(o),o.connect(a),t=s,e=a;}super(t,e);}};var ps=class extends Y{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var hb=0,Sl=class extends Y{constructor(r){super(),this.id=hb++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:n,muted:o}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!s,this._muted=o,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Sl.PADDING),this._end=Math.min(this._end+Sl.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=Sl;Mo.PADDING=.1;var ms=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},n=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},o=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",n),e.removeEventListener("error",o);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",n,false),e.addEventListener("error",o,false),e.load();}};var gs=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var nr=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Pl=["audio/mpeg","audio/ogg"],or={};function Jg(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;nr.forEach(n=>{let o=e.canPlayType(`audio/${n}`).replace(s,""),a=t[n]?e.canPlayType(t[n]).replace(s,""):"";i[n]=!!o||!!a;}),Object.assign(or,i);}Jg();var cb=0,xs=class extends Y{constructor(t){super(),this.id=cb++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);ut.setParamValue(this._gain.gain,n*s*i),ut.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:n,volume:o,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=o,this._loop=!!n,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let n=this._duration,o;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;o=(this._source.loopStart+this._elapsed%a)/n;}else o=this._elapsed%n/n;this._progress=o,this.emit("progress",this._progress,n);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var ar=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var tx=class extends ar{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(tx.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,ut.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Co=tx;Co.BUFFER_SIZE=0;var hr=class{init(t){this.parent=t,this._nodes=new Co(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new xs(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await W.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,n)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=n;let o=this.parent.autoPlayStart();e&&e(null,this.parent,o);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var Jr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=K().useLegacy?new ms:new hr;return new Jr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:et.extname(e).slice(1)})).filter(({ext:e})=>or[e]).sort((e,i)=>nr.indexOf(e.ext)-nr.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new gs(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let n=this._sprites[s];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,n)=>{this._preload((o,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,o?n(o):(e.loaded&&e.loaded(o,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(Jr._pool.length>0){let r=Jr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Jr._pool.indexOf(r)<0&&Jr._pool.push(r);}},Ge=Jr;Ge._pool=[];var ti=class r extends ar{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new Y,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=n=>{e(new Error(n?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,n=>{e(null,n);},i);s&&s.catch(i);}};var Eo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new ti),this._htmlAudioContext=new ps,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return ti.AudioContext!==null}add(t,e){if(typeof t=="object"){let n={};for(let o in t){let a=this._getOptions(t[o],e);n[o]=this.add(o,a);}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof Ge)return this._sounds[t]=e,e;let i=this._getOptions(e),s=Ge.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var ex=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=et.basename(t,et.extname(t))),e},rx={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...nr.filter(t=>or[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:mt.High},test(r){let t=et.extname(r).slice(1);return !!or[t]||Pl.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>Ge.from({...t.data,url:r,preload:true,loaded(n,o){n?s(n):i(o),t.data?.loaded?.(n,o);}}));return K().add(ex(t),e),e},async unload(r,t){K().remove(ex(t));}}};R.add(rx);Qg(new Eo);({DistortionFilter:ce.DistortionFilter,EqualizerFilter:ce.EqualizerFilter,MonoFilter:ce.MonoFilter,ReverbFilter:ce.ReverbFilter,StereoFilter:ce.StereoFilter,StreamFilter:ce.StreamFilter,TelephoneFilter:ce.TelephoneFilter});var ix=["webm","mp4","ogv","mov","avi","wmv","flv","mkv","3gp","mpg","mpeg","m4v","f4v","m2v","asf","vob","ts","m2ts","mts","divx","xvid","rm","rmvb","dat","swf","mpv","mxf","vcd","svcd","dvd","dv","3g2","m2p","m2ts","m2v","m4v","mpe","mpg","mpv2","ogm","qt","rm","ts","vob","wmv","xvid","flv","mkv","mov","mp4","webm","avi","ogv","m4v","f4v","m2v","asf","vob","ts","m2ts","mts","divx","xvid","rm","rmvb","dat","swf","mpv","mxf","vcd","svcd","dvd","dv","3g2","m2p","m2ts","m2v","m4v","mpe","mpg","mpv2","ogm","qt","rm","ts","vob","wmv","xvid","flv","mkv","mov","mp4","webm","avi","ogv","m4v","f4v","m2v","asf","vob"];var ei="Container",Bo="ImageContainer",Al="Image",ri="Sprite",sx="Text",Ml="Video";var J;(s=>(s.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),s.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),s.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),s.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(J||={});var ii=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ox=new Set,Cl=typeof process=="object"&&process?process:{},ax=(r,t,e,i)=>{typeof Cl.emitWarning=="function"?Cl.emitWarning(r,t,e,i):console.error(`[${e}] ${t}: ${r}`);},Io=globalThis.AbortController,nx=globalThis.AbortSignal;if(typeof Io>"u"){nx=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Io=class{constructor(){t();}signal=new nx;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let r=Cl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,ax("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var fb=r=>!ox.has(r),De=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),hx=r=>De(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?si:null:null,si=class extends Array{constructor(t){super(t),this.fill(0);}},El=class r{heap;length;static#h=false;static create(t){let e=hx(t);if(!e)return [];r.#h=true;let i=new r(t,e);return r.#h=false,i}constructor(t,e){if(!r.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Fo=class r{#h;#u;#m;#M;#g;#I;#F;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#n;#_;#o;#y;#b;#f;#v;#A;#c;#R;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#n},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#D(e,i,s,n),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#w(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#I}get memoMethod(){return this.#F}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:w,ignoreFetchAbort:S}=t;if(e!==0&&!De(e))throw new TypeError("max option must be a nonnegative integer");let I=e?hx(e):Array;if(!I)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=p,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#F=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#I=_,this.#A=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new I(e),this.#d=new I(e),this.#a=0,this.#n=0,this.#_=El.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#M=c),typeof u=="function"?(this.#g=u,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#v=!!this.#m,this.#R=!!this.#M,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#u!==0&&!De(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!De(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#H();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=De(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!De(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let F="LRU_CACHE_UNBOUNDED";fb(F)&&(ox.add(F),ax("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,r));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new si(this.#h),e=new si(this.#h);this.#f=t,this.#b=e,this.#L=(n,o,a=ii.now())=>{if(e[n]=o!==0?a:0,t[n]=o,o!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(n)&&this.#S(this.#r[n],"expire");},o+1);h.unref&&h.unref();}},this.#C=n=>{e[n]=t[n]!==0?ii.now():0;},this.#P=(n,o)=>{if(t[o]){let a=t[o],h=e[o];if(!a||!h)return;n.ttl=a,n.start=h,n.now=i||s();let l=n.now-h;n.remainingTTL=a-l;}};let i=0,s=()=>{let n=ii.now();if(this.ttlResolution>0){i=n;let o=setTimeout(()=>i=0,this.ttlResolution);o.unref&&o.unref();}return n};this.getRemainingTTL=n=>{let o=this.#i.get(n);if(o===void 0)return 0;let a=t[o],h=e[o];if(!a||!h)return 1/0;let l=(i||s())-h;return a-l},this.#p=n=>{let o=e[n],a=t[n];return !!a&&!!o&&(i||s())-o>a};}#C=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#H(){let t=new si(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,i,s,n)=>{if(this.#e(i))return 0;if(!De(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!De(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#k=(e,i,s)=>{if(t[e]=i,this.#u){let n=this.#u-t[e];for(;this.#x>n;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#x);};}#E=t=>{};#k=(t,e,i)=>{};#O=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#n;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#w({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#n));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#w())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#w()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#w())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#T()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#r[i],this))return this.get(this.#r[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#r[i],this);}}rforEach(t,e=this){for(let i of this.#w()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#r[i],this);}}purgeStale(){let t=false;for(let e of this.#w({allowStale:true}))this.#p(e)&&(this.#S(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#f&&this.#b){let o=this.#f[e],a=this.#b[e];if(o&&a){let h=o-(ii.now()-a);n.ttl=h,n.start=Date.now();}}return this.#y&&(n.size=this.#y[e]),n}dump(){let t=[];for(let e of this.#T({allowStale:true})){let i=this.#r[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let o={value:n};if(this.#f&&this.#b){o.ttl=this.#f[e];let a=ii.now()-this.#b[e];o.start=Math.floor(Date.now()-a);}this.#y&&(o.size=this.#y[e]),t.unshift([i,o]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=ii.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#O(t,e,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#S(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#n:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#n]=u,this.#d[u]=this.#n,this.#n=u,this.#s++,this.#k(u,c,h),h&&(h.set="add"),l=false,this.#R&&this.#M?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#A&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!o&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#o?.push([d,t,"set"]));}else o||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#o?.push([f,t,"set"]));if(this.#E(u),this.#k(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#R&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,n),h&&this.#P(h,u)),!o&&this.#c&&this.#o){let f=this.#o,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#o){let t=this.#o,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,i=this.#r[e],s=this.#t[e];return this.#A&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,i,"evict"),this.#c&&this.#o?.push([s,i,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#n=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#i.get(t);if(n!==void 0){let o=this.#t[n];if(this.#e(o)&&o.__staleWhileFetching===void 0)return false;if(this.#p(n))s&&(s.has="stale",this.#P(s,n));else return i&&this.#C(n),s&&(s.has="hit",this.#P(s,n)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!i&&this.#p(s))return;let n=this.#t[s];return this.#e(n)?n.__staleWhileFetching:n}#D(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let o=new Io,{signal:a}=i;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let h={signal:o.signal,options:i,context:s},l=(x,g=false)=>{let{aborted:_}=o.signal,y=i.ignoreFetchAbort&&x!==void 0;if(i.status&&(_&&!g?(i.status.fetchAborted=true,i.status.fetchError=o.signal.reason,y&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),_&&!y&&!g)return u(o.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#S(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=o.signal,_=g&&i.allowStaleOnFetchAbort,y=_||i.allowStaleOnFetchRejection,v=y||i.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#S(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return i.status&&b.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#I?.(t,n,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(x(void 0),i.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};i.status&&(i.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=p,p}#e(t){if(!this.#A)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Io}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#A)return _&&(_.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:_});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#D(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let C=i&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?P.__staleWhileFetching:P.__returned=P}let w=this.#p(b);if(!g&&!w)return _&&(_.fetch="hit"),this.#B(b),s&&this.#C(b),_&&this.#P(_,b),P;let S=this.#D(t,b,v,x),F=S.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=w?"stale":"refresh",F&&w&&(_.returnedStale=true)),F?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#F;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...o}=e,a=this.get(t,o);if(!n&&a!==void 0)return a;let h=i(t,a,{options:o,context:s});return this.set(t,h,o),h}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return o&&this.#P(o,a),this.#p(a)?(o&&(o.get="stale"),l?(o&&i&&h.__staleWhileFetching!==void 0&&(o.returnedStale=true),i?h.__staleWhileFetching:void 0):(n||this.#S(t,"expire"),o&&i&&(o.returnedStale=true),i?h:void 0)):(o&&(o.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#C(a),h))}else o&&(o.get="miss");}#W(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#n&&(t===this.#a?this.#a=this.#l[t]:this.#W(this.#d[t],this.#l[t]),this.#W(this.#n,t),this.#n=t);}delete(t){return this.#S(t,"delete")}#S(t,e){let i=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(i=true,this.#s===1)this.#V(e);else {this.#E(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(n,t,e),this.#c&&this.#o?.push([n,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#n)this.#n=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let o=this.#d[s];this.#l[o]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#o?.length){let s=this.#o,n;for(;n=s?.shift();)this.#g?.(...n);}return i}clear(){return this.#V("delete")}#V(t){for(let e of this.#w({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(i,s,t),this.#c&&this.#o?.push([i,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#n=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#o){let e=this.#o,i;for(;i=e?.shift();)this.#g?.(...i);}}};var Ue=class{cache;map=new Map;constructor(t){this.cache=new Fo({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}get keys(){return this.map.keys}get values(){return this.map.values}};var _s=new Ue({cacheSize:5});var lx;(s=>{function r(n,o){o||(o=n.name),_s.get(o)&&J.warn(`CanvasElement "${o}" already registered`),n.prototype.pixivnId=o,_s.set(o,n);}s.add=r;function t(n){try{let o=_s.get(n);if(!o){J.error(`CanvasElement "${n}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new o,o}catch(o){J.error(`Error while getting CanvasElement "${n}"`,o);return}}s.get=t;function e(){return Array.from(_s.values())}s.values=e;function i(n){return _s.has(n)}s.has=i;})(lx||={});var Kt=lx;var qt=class r{static init(t){r._getScreen=t.getScreen;}static _getScreen;static get screen(){return r._getScreen()}};function ni(r,t,e,i,s,n=0){return i=i*(s?-1:1),r==="width"?t*(qt.screen.width-e)+i+n*e+(s?e:0):t*(qt.screen.height-e)+i+n*e+(s?e:0)}function ue(r,t,e,i,s,n=0){return i=i*(s?-1:1),r==="width"?(t-i-n*e-(s?e:0))/(qt.screen.width-e):(t-i-n*e-(s?e:0))/(qt.screen.height-e)}function oi(r,t){return r==="width"?t*qt.screen.width:t*qt.screen.height}function de(r,t){return r==="width"?t/qt.screen.width:t/qt.screen.height}function xt(r,t){if(t=t%360,t<0&&(t+=360),t===0)return {x:r.x,y:r.y};if(t===90)return {x:-r.y,y:r.x};if(t===180)return {x:-r.x,y:-r.y};if(t===270)return {x:r.y,y:-r.x};if(t>0&&t<90){let e=t*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.x*i-r.y*s,y:r.x*s+r.y*i}}else if(t>90&&t<180){let e=(t-90)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.y*s-r.x*i,y:r.y*i-r.x*s}}else if(t>180&&t<270){let e=(t-180)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.x*i+r.y*s,y:-r.x*s-r.y*i}}else if(t>270&&t<360){let e=(t-270)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.y*s-r.x*i,y:-r.y*i-r.x*s}}return {x:0,y:0}}function Le(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?t:i===90||i===270?e:Math.abs(t*Math.cos(i*Math.PI/180))+Math.abs(e*Math.sin(i*Math.PI/180))}function Oe(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?e:i===90||i===270?t:Math.abs(e*Math.cos(i*Math.PI/180))+Math.abs(t*Math.sin(i*Math.PI/180))}var pb=new RegExp(`(${ix.join("|")})$`);function cx(r){let t=Ut.cache.has(r)?Ut.get(r):null;return t instanceof M&&(r=t.source?.label||r),pb.test(r)}function lr(r){return r&&(typeof r.align!="number"&&(r.xAlign!=null&&(r.align===void 0?(r.align={x:r.xAlign},delete r.xAlign):(r.align.x=r.xAlign,delete r.xAlign)),r.yAlign!=null&&(r.align===void 0?(r.align={y:r.yAlign},delete r.yAlign):(r.align.y=r.yAlign,delete r.yAlign))),typeof r.percentagePosition!="number"&&(r.xPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={x:r.xPercentagePosition},delete r.xPercentagePosition):(r.percentagePosition.x=r.xPercentagePosition,delete r.xPercentagePosition)),r.yPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={y:r.yPercentagePosition},delete r.yPercentagePosition):(r.percentagePosition.y=r.yPercentagePosition,delete r.yPercentagePosition))),r)}var ai=new Ue({cacheSize:5});var ux;(n=>{function r(o,a){a||(a=o.name),ai.get(a)&&J.info(`Event "${a}" already exists, it will be overwritten`),o.prototype.id=a,ai.set(a,o);}n.add=r;function t(o){try{let a=ai.get(o);if(!a){J.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){J.error(`Error while getting Event "${o}"`,a);return}}n.get=t;function e(o){try{let a=ai.get(o);if(!a){J.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){J.error(`Error while getting Event "${o}"`,a);return}}n.getInstance=e;function i(){return Array.from(ai.values())}n.values=i;function s(o){return ai.has(o)}n.has=s;})(ux||={});var ys=ux;async function dx(r){let t=mb(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function mb(r){try{let t=Kt.get(r);return t?new t:void 0}catch(t){J.error(`Error while getting CanvasElement ${r}`,t);return}}function gb(r){return "memory"in r?r.memory:r instanceof fs?_b(r):r instanceof vt?vs(r):bs(r)}function xb(r){return {width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function fx(r,t){return {url:r.source.label,alias:t===r.source.label?void 0:t}}function bs(r,t){let e=yb(r,ei),s=t?.childrenExport||false?r.children.sort((n,o)=>r.getChildIndex(n)-r.getChildIndex(o)).map(n=>gb(n)):[];return {pixivnId:e,elements:s,...xb(r)}}function vs(r){let t=bs(r),e=t.pixivnId??ri,i=mx(r),s="textureAlias"in r?fx(r.texture,r.textureAlias):fx(r.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function _b(r){let t=bs(r),e=t.pixivnId??sx,i=mx(r);return {...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:bb(r.style),roundPixels:r.roundPixels,onEvents:i}}function yb(r,t){return Object.prototype.hasOwnProperty.call(r,"pixivnId")?r.pixivnId:t}function mx(r){return "onEvents"in r?r.onEvents:{}}function px(r,t){if(typeof r!="object"||r===null)return r;J.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,r);}function bb(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:px(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:px(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}var hi=class extends Rt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||ei;}pixivnId=ei;get memory(){return bs(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ts(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await dx(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ys.getInstance(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):J.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Kt.add(hi,ei);async function Ts(r,t,e){let i=e?.ignoreScale||false,s=e?.end;"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),!i&&"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),s&&await s(),i||("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}async function ws(r){if(r!=="EMPTY"){if(!r){J.error("Texture not found",r);return}if(Ut.cache.has(r)){let t=Ut.get(r);if(t)return t}return Ut.load(r).then(t=>{if(!t){J.error("Texture not found",r);return}if(!(t instanceof M)){J.error("File not is a file",r);return}return t}).catch(t=>{J.error("Error loading file",t);})}}var li=class r extends vt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||ri;}pixivnId=ri;_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}set textureAlias(t){this._textureAlias=t;}get memory(){return vs(this)}set memory(t){}async setMemory(t){return this.memory=t,await Bl(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ys.getInstance(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):J.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}static from(t,e){let i=vt.from(t,e),s=new r;return s.texture=i.texture,s}};Kt.add(li,ri);async function Bl(r,t,e){let i=e?.ignoreTexture||false;if(await Ts(r,t),!i){if("textureImage"in t&&t.textureImage&&t.textureImage.image){let n=await ws(t.textureImage.image);n&&(r.texture=n);}if("textureData"in t&&(t.textureData.alias&&(r.textureAlias=t.textureData.alias),t.textureData.url!=="EMPTY")){let n=t.textureData.url;t.textureData.alias&&Ut.resolver.hasKey(t.textureData.alias)&&(n=t.textureData.alias);let o=await ws(n);o&&(r.texture=o);}}let s=e?.half;if(s&&await s(),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let n in t.onEvents){let o=t.onEvents[n],a=ys.get(o);a&&r.onEvent(n,a);}}var fe=class r extends li{pixivnId=Al;constructor(t,e){t=lr(t);let i,s;t&&"align"in t&&t?.align!==void 0&&(i=t.align,delete t.align),t&&"percentagePosition"in t&&t?.percentagePosition!==void 0&&(s=t.percentagePosition,delete t.percentagePosition),super(t),e&&(this.textureAlias=e),i&&(this.align=i),s&&(this.percentagePosition=s);}get memory(){return {...vs(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition,loadIsStarted:this._loadIsStarted}}set memory(t){}async setMemory(t){this.memory=t,await Il(this,t),this.reloadPosition();}static from(t,e){let i=vt.from(t,e),s=new r;return s.texture=i.texture,s}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,ws(this.textureAlias).then(t=>{this._loadIsStarted=false,t&&(this.texture=t);}).catch(t=>{this._loadIsStarted=false,J.error("Error into ImageSprite.load()",t);})}set texture(t){super.texture=t,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}_align=void 0;set align(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof t=="number"?(this._align.x=t,this._align.y=t):(t.x!==void 0&&(this._align.x=t.x),t.y!==void 0&&(this._align.y=t.y)),this.reloadPosition();}get align(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return {x:ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x),y:ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}}set xAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=t,this.reloadPosition();}get xAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x)}set yAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=t,this.reloadPosition();}get yAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof t=="number"?(this._percentagePosition.x=t,this._percentagePosition.y=t):(t.x!==void 0&&(this._percentagePosition.x=t.x),t.y!==void 0&&(this._percentagePosition.y=t.y)),this.reloadPosition();}get percentagePosition(){return {x:de("width",this.x),y:de("height",this.y)}}get xPercentagePosition(){return de("width",this.x)}set xPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=t,this.reloadPosition();}get yPercentagePosition(){return de("height",this.y)}set yPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=t,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){return this._align?{x:this._align.x||0,y:this._align.y||0,type:"align"}:this._percentagePosition?{x:this._percentagePosition.x||0,y:this._percentagePosition.y||0,type:"percentage"}:{x:this.x,y:this.y,type:"pixel"}}set positionInfo(t){t.type==="align"?this.align={x:t.x,y:t.y}:t.type==="percentage"?this.percentagePosition={x:t.x,y:t.y}:this.position.set(t.x,t.y);}reloadPosition(){if(this._align){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);this._align.x!==void 0&&(super.x=ni("width",this._align.x,Le(this),t.x,e.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=ni("height",this._align.y,Oe(this),t.y,e.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=oi("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=oi("height",this._percentagePosition.y)));}get position(){return super.position}set position(t){this._align=void 0,this._percentagePosition=void 0,super.position=t;}get x(){return super.x}set x(t){this._align=void 0,this._percentagePosition=void 0,super.x=t;}get y(){return super.y}set y(t){this._align=void 0,this._percentagePosition=void 0,super.y=t;}};Kt.add(fe,Al);async function Il(r,t,e){let i=e?.ignoreTexture||false;return t=lr(t),await Bl(r,t,{half:async()=>{"align"in t&&t.align!==void 0&&(r.align=t.align),"percentagePosition"in t&&t.percentagePosition!==void 0&&(r.percentagePosition=t.percentagePosition),i||"imageLink"in t&&t.imageLink!==void 0&&(r.textureAlias=t.imageLink),"loadIsStarted"in t&&t.loadIsStarted&&await r.load();},ignoreTexture:e?.ignoreTexture})}var ci=class r extends fe{constructor(t,e){let i,s,n;t&&"loop"in t&&t?.loop!==void 0&&(i=t.loop,delete t.loop),t&&"paused"in t&&t?.paused!==void 0&&(s=t.paused,delete t.paused),t&&"currentTime"in t&&t?.currentTime!==void 0&&(n=t.currentTime,delete t.currentTime),super(t,e),i&&(this.loop=i),s&&(this.paused=s),n&&(this.currentTime=n);}pixivnId=Ml;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}set memory(t){}async setMemory(t){return this.memory=t,await vb(this,t)}static from(t,e){let i=vt.from(t,e),s=new r;return s.texture=i.texture,s}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(t){this._looop=t,this.texture?.source?.resource&&(this.texture.source.resource.loop=t);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(t){t?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(t){let e=this.duration;e&&t>=e&&(t=0),this._currentTime=t,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=t);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};Kt.add(ci,Ml);async function vb(r,t,e){await Il(r,t,{ignoreTexture:e?.ignoreTexture}),"loop"in t&&t.loop!==void 0&&(r.loop=t.loop),"currentTime"in t&&t.currentTime!==void 0&&(r.currentTime=t.currentTime),"paused"in t&&t.paused!==void 0&&(r.paused=t.paused);}var ui=class extends hi{constructor(t,e=[]){t=lr(t);let i,s,n;t&&"anchor"in t&&t?.anchor!==void 0&&(n=t.anchor,delete t.anchor),t&&"align"in t&&t?.align!==void 0&&(i=t.align,delete t.align),t&&"percentagePosition"in t&&t?.percentagePosition!==void 0&&(s=t.percentagePosition,delete t.percentagePosition),super(t),t=lr(t),e&&e.forEach(o=>{let a;cx(o)?a=new ci(void 0,o):a=new fe(void 0,o),this.addChild(a);}),n&&(this.anchor=n),i&&(this.align=i),s&&(this.percentagePosition=s);}get memory(){return {...super.memory,pixivnId:Bo,anchor:this._anchor,align:this._align,percentagePosition:this._percentagePosition,loadIsStarted:this._loadIsStarted}}set memory(t){}async setMemory(t){this.memory=t,await this.importChildren(t),await Tb(this,t),this.reloadAnchor(),this.reloadPosition();}pixivnId=Bo;_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){this._loadIsStarted=true;let t=Array(this.children.length);for(let e=0;e<this.children.length;e++)t[e]=this.children[e].load();return Promise.all(t).then(()=>{this._loadIsStarted=false,this.reloadAnchor(),this.reloadPosition();}).catch(e=>{this._loadIsStarted=false,J.error("Error into ImageContainer.load()",e);})}get texture(){return this.children.length>0?this.children[0].texture:new M}get haveEmptyTexture(){return this.children.some(t=>t.texture._source.label==="EMPTY")}_anchor;get anchor(){let t=super.pivot.x/this.width,e=super.pivot.y/this.height;return {x:t,y:e}}set anchor(t){typeof t=="number"?this._anchor={x:t,y:t}:this._anchor=t,this.reloadAnchor();}reloadAnchor(){this._anchor&&super.pivot.set(this._anchor.x*this.width,this._anchor.y*this.height);}get pivot(){return super.pivot}set pivot(t){this._anchor=void 0,super.pivot=t;}_align=void 0;set align(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof t=="number"?(this._align.x=t,this._align.y=t):(t.x!==void 0&&(this._align.x=t.x),t.y!==void 0&&(this._align.y=t.y)),this.reloadPosition();}get align(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return {x:ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x),y:ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}}set xAlign(t){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.x=t,this.reloadPosition();}get xAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x)}set yAlign(t){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.y=t,this.reloadPosition();}get yAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof t=="number"?(this._percentagePosition.x=t,this._percentagePosition.y=t):(t.x!==void 0&&(this._percentagePosition.x=t.x),t.y!==void 0&&(this._percentagePosition.y=t.y)),this.reloadPosition();}get percentagePosition(){return {x:de("width",this.x),y:de("height",this.y)}}set xPercentagePosition(t){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=t,this.reloadPosition();}get xPercentagePosition(){return de("width",this.x)}set yPercentagePosition(t){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=t,this.reloadPosition();}get yPercentagePosition(){return de("height",this.y)}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){return this._align?{x:this._align.x||0,y:this._align.y||0,type:"align"}:this._percentagePosition?{x:this._percentagePosition.x||0,y:this._percentagePosition.y||0,type:"percentage"}:{x:this.x,y:this.y,type:"pixel"}}set positionInfo(t){t.type==="align"?this.align={x:t.x,y:t.y}:t.type==="percentage"?this.percentagePosition={x:t.x,y:t.y}:this.position.set(t.x,t.y);}reloadPosition(){if(this._align){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);this._align.x!==void 0&&(super.x=ni("width",this._align.x,Le(this),t.x,e.x<0)),this._align.y!==void 0&&(super.y=ni("height",this._align.y,Oe(this),t.y,e.y<0));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=oi("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=oi("height",this._percentagePosition.y)));}get position(){return super.position}set position(t){this._align=void 0,this._percentagePosition=void 0,super.position=t;}get x(){return super.x}set x(t){this._align=void 0,this._percentagePosition=void 0,super.x=t;}get y(){return super.y}set y(t){this._align=void 0,this._percentagePosition=void 0,super.y=t;}};Kt.add(ui,Bo);async function Tb(r,t,e){t=lr(t),Ts(r,t,{...e,end:async()=>{"anchor"in t&&t.anchor!==void 0&&(r.anchor=t.anchor),"align"in t&&t.align!==void 0&&(r.align=t.align),"percentagePosition"in t&&t.percentagePosition!==void 0&&(r.percentagePosition=t.percentagePosition),"loadIsStarted"in t&&t.loadIsStarted&&await r.load();}});}function dz(r){return (r instanceof fe||r instanceof ui)&&r.haveEmptyTexture?false:!(r instanceof vt&&r.texture?.label=="EMPTY")}exports.checkIfTextureNotIsEmpty=dz;
|
|
620
|
+
`,Qr=null,ds=class{constructor(){Qr||(Qr=URL.createObjectURL(new Blob([Jy],{type:"application/javascript"}))),this.worker=new Worker(Qr);}};ds.revokeObjectURL=function(){Qr&&(URL.revokeObjectURL(Qr),Qr=null);};var $g=0,vl,Tl=class{constructor(){this._initialized=false,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 Zr;e.addEventListener("message",i=>{e.terminate(),Zr.revokeObjectURL(),t(i.data);});}),this._isImageBitmapSupported)}loadImageBitmap(t,e){return this._run("loadImageBitmap",[t,e?.data?.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=true);}_getWorker(){vl===void 0&&(vl=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return !t&&this._createdWorkers<vl&&(this._createdWorkers++,t=new ds().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,n)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:n});});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[$g]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:$g++,id:i});}},wl=new Tl;_e();var tb=[".jpeg",".jpg",".png",".webp",".avif"],eb=["image/jpeg","image/png","image/webp","image/avif"];async function rb(r,t){let e=await W.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 xo={name:"loadTextures",extension:{type:T.LoadParser,priority:mt.High,name:"loadTextures"},config:{preferWorkers:true,preferCreateImageBitmap:true,crossOrigin:"anonymous"},test(r){return Yt(r,eb)||Xt(r,tb)},async load(r,t,e){let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await wl.isImageBitmapSupported()?i=await wl.loadImageBitmap(r,t):i=await rb(r,t):i=await new Promise((n,o)=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?n(i):(i.onload=()=>{n(i);},i.onerror=o);});let s=new kt({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:t.data?.resolution||jr(r),...t.data});return Kr(s,e,r)},unload(r){r.destroy(true);}};A();Ra();Fa();var Yg=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],ib=Yg.map(r=>`video/${r.substring(1)}`);function sb(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=ob(t):e!==false&&(r.crossOrigin=typeof e=="string"?e:"anonymous");}function nb(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){n(),t();}function s(o){n(),e(o);}function n(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s);}})}function ob(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 Xg={name:"loadVideo",extension:{type:T.LoadParser,name:"loadVideo"},test(r){let t=Yt(r,ib),e=Xt(r,Yg);return t||e},async load(r,t,e){let i={...yr.defaultOptions,resolution:t.data?.resolution||jr(r),alphaMode:t.data?.alphaMode||await nn(),...t.data},s=document.createElement("video"),n={preload:i.autoLoad!==false?"auto":void 0,"webkit-playsinline":i.playsinline!==false?"":void 0,playsinline:i.playsinline!==false?"":void 0,muted:i.muted===true?"":void 0,loop:i.loop===true?"":void 0,autoplay:i.autoPlay!==false?"":void 0};Object.keys(n).forEach(h=>{let l=n[h];l!==void 0&&s.setAttribute(h,l);}),i.muted===true&&(s.muted=true),sb(s,r,i.crossorigin);let o=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=yr.MIME_TYPES[h]||`video/${h}`;}return o.src=r,a&&(o.type=a),new Promise(h=>{let l=async()=>{let c=new yr({...i,resource:s});s.removeEventListener("canplay",l),t.data.preload&&await nb(s),h(Kr(c,e,r));};s.addEventListener("canplay",l),s.appendChild(o);})},unload(r){r.destroy(true);}};A();gr();A();gr();var _o={extension:{type:T.ResolveParser,name:"resolveTexture"},test:xo.test,parse:r=>({resolution:parseFloat(Wt.RETINA_PREFIX.exec(r)?.[1]??"1"),format:r.split(".").pop(),src:r})};var jg={extension:{type:T.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Wt.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:_o.parse};gr();Ii();Js();var yo=class{constructor(){this._detections=[],this._initialized=false,this.resolver=new Wt,this.loader=new go,this.cache=j,this._backgroundLoader=new po(this.loader),this._backgroundLoader.active=true,this.reset();}async init(t={}){if(this._initialized){G("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=true,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let n=t.manifest;typeof n=="string"&&(n=await this.load(n)),this.resolver.addManifest(n);}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=Ze(t),s=Ct(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}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e);}async loadBundle(t,e){this._initialized||await this.init();let i=false;typeof t=="string"&&(i=true,t=[t]);let s=this.resolver.resolveBundle(t),n={},o=Object.keys(s),a=0,h=0,l=()=>{e?.(++a/h);},c=o.map(u=>{let f=s[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{n[u]=d;})});return await Promise.all(c),i?n[t[0]]:n}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=false;}get(t){if(typeof t=="string")return j.get(t);let e={};for(let i=0;i<t.length;i++)e[i]=j.get(t[i]);return e}async _mapLoadToResolve(t,e){let i=[...new Set(Object.values(t))];this._backgroundLoader.active=false;let s=await this.loader.load(i,e);this._backgroundLoader.active=true;let n={};return i.forEach(o=>{let a=s[o.src],h=[o.src];o.alias&&h.push(...o.alias),h.forEach(l=>{n[l]=a;}),j.set(h,a);}),n}async unload(t){this._initialized||await this.init();let e=Ct(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=Ct(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=>{j.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];});});}},Ut=new yo;R.handleByList(T.LoadParser,Ut.loader.parsers).handleByList(T.ResolveParser,Ut.resolver.parsers).handleByList(T.CacheParser,Ut.cache.parsers).handleByList(T.DetectionParser,Ut.detections);R.add(Rg,Dg,kg,zg,Ug,Lg,Og,Wg,Vg,Hg,Ng,xo,Xg,Fg,Ig,_o,jg);var Kg={loader:T.LoadParser,resolver:T.ResolveParser,cache:T.CacheParser,detection:T.DetectionParser};R.handle(T.Asset,r=>{let t=r.ref;Object.entries(Kg).filter(([e])=>!!t[e]).forEach(([e,i])=>R.add(Object.assign(t[e],{extension:t[e].extension??i})));},r=>{let t=r.ref;Object.keys(Kg).filter(e=>!!t[e]).forEach(e=>R.remove(t[e]));});Bs();ht();Qs();var bo=class extends Ae{constructor(t,e){let{text:i,resolution:s,style:n,anchor:o,width:a,height:h,roundPixels:l,...c}=t;super({...c}),this.batched=true,this._resolution=null,this._autoResolution=true,this._didTextUpdate=true,this._styleClass=e,this.text=i??"",this.style=n,this.resolution=s??null,this.allowChildren=false,this._anchor=new yt({_onUpdate:()=>{this.onViewUpdate();}}),o&&(this.anchor=o),this.roundPixels=l??false,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,n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){this.didViewUpdate||(this._didTextUpdate=true),super.onViewUpdate();}_getKey(){return `${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=false){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 qg(r,t){let e=r[0]??{};return (typeof e=="string"||r[1])&&(D(O,`use new ${t}({ text: "hi!", style }) instead`),e={text:e,style:r[1]}),e}to();Wr();var fs=class extends bo{constructor(...t){let e=qg(t,"Text");super(e,Dt),this.renderPipeId="text";}updateBounds(){let t=this._bounds,e=this._anchor,i=$t.measureText(this._text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n;}};_e();gt();at();Da();fr();Ca();Ai();Lt();Me();Ms(dh());R.add(Cg,Bg);var ce={};Sx(ce,{DistortionFilter:()=>vo,EqualizerFilter:()=>jt,Filter:()=>ft,MonoFilter:()=>To,ReverbFilter:()=>wo,StereoFilter:()=>So,StreamFilter:()=>Po,TelephoneFilter:()=>Ao});var Zg;function Qg(r){return Zg=r,r}function K(){return Zg}var ft=class{constructor(t,e){this.init(t,e);}init(t,e){this.destination=t,this.source=e||t;}connect(t){this.source?.connect(t);}disconnect(){this.source?.disconnect();}destroy(){this.disconnect(),this.destination=null,this.source=null;}};var vo=class extends ft{constructor(t=0){let e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createWaveShaper();}super(e),this._distortion=e,this.amount=t;}set amount(t){if(this._amount=t,K().useLegacy)return;let e=t*1e3,i=44100,s=new Float32Array(i),n=Math.PI/180,o=0,a;for(;o<i;++o)a=o*2/i-1,s[o]=(3+e)*a*20*n/(Math.PI+e*Math.abs(a));this._distortion.curve=s,this._distortion.oversample="4x";}get amount(){return this._amount}destroy(){this._distortion=null,super.destroy();}};var ut=class{static setParamValue(t,e){if(t.setValueAtTime){let i=K().context;t.setValueAtTime(e,i.audioContext.currentTime);}else t.value=e;return e}};var q=class extends ft{constructor(r=0,t=0,e=0,i=0,s=0,n=0,o=0,a=0,h=0,l=0){let c=[],u=[{f:q.F32,type:"lowshelf",gain:r},{f:q.F64,type:"peaking",gain:t},{f:q.F125,type:"peaking",gain:e},{f:q.F250,type:"peaking",gain:i},{f:q.F500,type:"peaking",gain:s},{f:q.F1K,type:"peaking",gain:n},{f:q.F2K,type:"peaking",gain:o},{f:q.F4K,type:"peaking",gain:a},{f:q.F8K,type:"peaking",gain:h},{f:q.F16K,type:"highshelf",gain:l}];K().useLegacy||(c=u.map(f=>{let d=K().context.audioContext.createBiquadFilter();return d.type=f.type,ut.setParamValue(d.Q,1),d.frequency.value=f.f,ut.setParamValue(d.gain,f.gain),d})),super(c[0],c[c.length-1]),this.bands=c,this.bandsMap={};for(let f=0;f<this.bands.length;f++){let d=this.bands[f];f>0&&this.bands[f-1].connect(d),this.bandsMap[d.frequency.value]=d;}}setGain(r,t=0){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);ut.setParamValue(this.bandsMap[r].gain,t);}getGain(r){if(!this.bandsMap[r])throw new Error(`No band found for frequency ${r}`);return this.bandsMap[r].gain.value}set f32(r){this.setGain(q.F32,r);}get f32(){return this.getGain(q.F32)}set f64(r){this.setGain(q.F64,r);}get f64(){return this.getGain(q.F64)}set f125(r){this.setGain(q.F125,r);}get f125(){return this.getGain(q.F125)}set f250(r){this.setGain(q.F250,r);}get f250(){return this.getGain(q.F250)}set f500(r){this.setGain(q.F500,r);}get f500(){return this.getGain(q.F500)}set f1k(r){this.setGain(q.F1K,r);}get f1k(){return this.getGain(q.F1K)}set f2k(r){this.setGain(q.F2K,r);}get f2k(){return this.getGain(q.F2K)}set f4k(r){this.setGain(q.F4K,r);}get f4k(){return this.getGain(q.F4K)}set f8k(r){this.setGain(q.F8K,r);}get f8k(){return this.getGain(q.F8K)}set f16k(r){this.setGain(q.F16K,r);}get f16k(){return this.getGain(q.F16K)}reset(){this.bands.forEach(r=>{ut.setParamValue(r.gain,0);});}destroy(){this.bands.forEach(r=>{r.disconnect();}),this.bands=null,this.bandsMap=null;}},jt=q;jt.F32=32;jt.F64=64;jt.F125=125;jt.F250=250;jt.F500=500;jt.F1K=1e3;jt.F2K=2e3;jt.F4K=4e3;jt.F8K=8e3;jt.F16K=16e3;var To=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;e=i.createChannelSplitter(),t=i.createChannelMerger(),t.connect(e);}super(t,e),this._merger=t;}destroy(){this._merger?.disconnect(),this._merger=null,super.destroy();}};var wo=class extends ft{constructor(t=3,e=2,i=false){super(null),this._seconds=this._clamp(t,1,50),this._decay=this._clamp(e,0,100),this._reverse=i,this._rebuild();}_clamp(t,e,i){return Math.min(i,Math.max(e,t))}get seconds(){return this._seconds}set seconds(t){this._seconds=this._clamp(t,1,50),this._rebuild();}get decay(){return this._decay}set decay(t){this._decay=this._clamp(t,0,100),this._rebuild();}get reverse(){return this._reverse}set reverse(t){this._reverse=t,this._rebuild();}_rebuild(){if(K().useLegacy)return;let{audioContext:t}=K().context,e=t.sampleRate,i=e*this._seconds,s=t.createBuffer(2,i,e),n=s.getChannelData(0),o=s.getChannelData(1),a;for(let l=0;l<i;l++)a=this._reverse?i-l:l,n[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay),o[l]=(Math.random()*2-1)*Math.pow(1-a/i,this._decay);let h=t.createConvolver();h.buffer=s,this.init(h);}};var So=class extends ft{constructor(t=0){let e,i,s;if(!K().useLegacy){let{audioContext:n}=K().context;n.createStereoPanner?(e=n.createStereoPanner(),s=e):(i=n.createPanner(),i.panningModel="equalpower",s=i);}super(s),this._stereo=e,this._panner=i,this.pan=t;}set pan(t){this._pan=t,this._stereo?ut.setParamValue(this._stereo.pan,t):this._panner&&this._panner.setPosition(t,0,1-Math.abs(t));}get pan(){return this._pan}destroy(){super.destroy(),this._stereo=null,this._panner=null;}};var Po=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context;t=i.createMediaStreamDestination(),e=i.createMediaStreamSource(t.stream);}super(t,e),this._stream=t?.stream;}get stream(){return this._stream}destroy(){this._stream=null,super.destroy();}};var Ao=class extends ft{constructor(){let t,e;if(!K().useLegacy){let{audioContext:i}=K().context,s=i.createBiquadFilter(),n=i.createBiquadFilter(),o=i.createBiquadFilter(),a=i.createBiquadFilter();s.type="lowpass",ut.setParamValue(s.frequency,2e3),n.type="lowpass",ut.setParamValue(n.frequency,2e3),o.type="highpass",ut.setParamValue(o.frequency,500),a.type="highpass",ut.setParamValue(a.frequency,500),s.connect(n),n.connect(o),o.connect(a),t=s,e=a;}super(t,e);}};var ps=class extends Y{constructor(){super(...arguments),this.speed=1,this.muted=false,this.volume=1,this.paused=false;}refresh(){this.emit("refresh");}refreshPaused(){this.emit("refreshPaused");}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(t){console.warn("HTML Audio does not support filters");}get audioContext(){return console.warn("HTML Audio does not support audioContext"),null}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this.paused}destroy(){this.removeAllListeners();}};var hb=0,Sl=class extends Y{constructor(r){super(),this.id=hb++,this.init(r);}set(r,t){if(this[r]===void 0)throw new Error(`Property with name ${r} does not exist.`);switch(r){case "speed":this.speed=t;break;case "volume":this.volume=t;break;case "paused":this.paused=t;break;case "loop":this.loop=t;break;case "muted":this.muted=t;break}return this}get progress(){let{currentTime:r}=this._source;return r/this._duration}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}_onPlay(){this._playing=true;}_onPause(){this._playing=false;}init(r){this._playing=false,this._duration=r.source.duration;let t=this._source=r.source.cloneNode(false);t.src=r.parent.url,t.onplay=this._onPlay.bind(this),t.onpause=this._onPause.bind(this),r.context.on("refresh",this.refresh,this),r.context.on("refreshPaused",this.refreshPaused,this),this._media=r;}_internalStop(){this._source&&this._playing&&(this._source.onended=null,this._source.pause());}stop(){this._internalStop(),this._source&&this.emit("stop");}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get filters(){return console.warn("HTML Audio does not support filters"),null}set filters(r){console.warn("HTML Audio does not support filters");}refresh(){let r=this._media.context,t=this._media.parent;this._source.loop=this._loop||t.loop;let e=r.volume*(r.muted?0:1),i=t.volume*(t.muted?0:1),s=this._volume*(this._muted?0:1);this._source.volume=s*e*i,this._source.playbackRate=this._speed*r.speed*t.speed;}refreshPaused(){let r=this._media.context,t=this._media.parent,e=this._paused||t.paused||r.paused;e!==this._pausedReal&&(this._pausedReal=e,e?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._source.currentTime,end:this._end,volume:this._volume,speed:this._speed,loop:this._loop})),this.emit("pause",e));}play(r){let{start:t,end:e,speed:i,loop:s,volume:n,muted:o}=r;e&&console.assert(e>t,"End time is before start time"),this._speed=i,this._volume=n,this._loop=!!s,this._muted=o,this.refresh(),this.loop&&e!==null&&(console.warn('Looping not support when specifying an "end" time'),this.loop=false),this._start=t,this._end=e||this._duration,this._start=Math.max(0,this._start-Sl.PADDING),this._end=Math.min(this._end+Sl.PADDING,this._duration),this._source.onloadedmetadata=()=>{this._source&&(this._source.currentTime=t,this._source.onloadedmetadata=null,this.emit("progress",t/this._duration,this._duration),dt.shared.add(this._onUpdate,this));},this._source.onended=this._onComplete.bind(this),this._source.play(),this.emit("start");}_onUpdate(){this.emit("progress",this.progress,this._duration),this._source.currentTime>=this._end&&!this._source.loop&&this._onComplete();}_onComplete(){dt.shared.remove(this._onUpdate,this),this._internalStop(),this.emit("progress",1,this._duration),this.emit("end",this);}destroy(){dt.shared.remove(this._onUpdate,this),this.removeAllListeners();let r=this._source;r&&(r.onended=null,r.onplay=null,r.onpause=null,this._internalStop()),this._source=null,this._speed=1,this._volume=1,this._loop=false,this._end=null,this._start=0,this._duration=0,this._playing=false,this._pausedReal=false,this._paused=false,this._muted=false,this._media&&(this._media.context.off("refresh",this.refresh,this),this._media.context.off("refreshPaused",this.refreshPaused,this),this._media=null);}toString(){return `[HTMLAudioInstance id=${this.id}]`}},Mo=Sl;Mo.PADDING=.1;var ms=class extends Y{init(t){this.parent=t,this._source=t.options.source||new Audio,t.url&&(this._source.src=t.url);}create(){return new Mo(this)}get isPlayable(){return !!this._source&&this._source.readyState===4}get duration(){return this._source.duration}get context(){return this.parent.context}get filters(){return null}set filters(t){console.warn("HTML Audio does not support filters");}destroy(){this.removeAllListeners(),this.parent=null,this._source&&(this._source.src="",this._source.load(),this._source=null);}get source(){return this._source}load(t){let e=this._source,i=this.parent;if(e.readyState===4){i.isLoaded=true;let h=i.autoPlayStart();t&&setTimeout(()=>{t(null,i,h);},0);return}if(!i.url){t(new Error("sound.url or sound.source must be set"));return}e.src=i.url;let s=()=>{a(),i.isLoaded=true;let h=i.autoPlayStart();t&&t(null,i,h);},n=()=>{a(),t&&t(new Error("Sound loading has been aborted"));},o=()=>{a();let h=`Failed to load audio element (code: ${e.error.code})`;t?t(new Error(h)):console.error(h);},a=()=>{e.removeEventListener("canplaythrough",s),e.removeEventListener("load",s),e.removeEventListener("abort",n),e.removeEventListener("error",o);};e.addEventListener("canplaythrough",s,false),e.addEventListener("load",s,false),e.addEventListener("abort",n,false),e.addEventListener("error",o,false),e.load();}};var gs=class{constructor(t,e){this.parent=t,Object.assign(this,e),this.duration=this.end-this.start,console.assert(this.duration>0,"End time must be after start time");}play(t){return this.parent.play({complete:t,speed:this.speed||this.parent.speed,end:this.end,start:this.start,loop:this.loop})}destroy(){this.parent=null;}};var nr=["ogg","oga","opus","m4a","mp3","mpeg","wav","aiff","wma","mid","caf"],Pl=["audio/mpeg","audio/ogg"],or={};function Jg(r){let t={m4a:"audio/mp4",oga:"audio/ogg",opus:'audio/ogg; codecs="opus"',caf:'audio/x-caf; codecs="opus"',...{}},e=document.createElement("audio"),i={},s=/^no$/;nr.forEach(n=>{let o=e.canPlayType(`audio/${n}`).replace(s,""),a=t[n]?e.canPlayType(t[n]).replace(s,""):"";i[n]=!!o||!!a;}),Object.assign(or,i);}Jg();var cb=0,xs=class extends Y{constructor(t){super(),this.id=cb++,this._media=null,this._paused=false,this._muted=false,this._elapsed=0,this.init(t);}set(t,e){if(this[t]===void 0)throw new Error(`Property with name ${t} does not exist.`);switch(t){case "speed":this.speed=e;break;case "volume":this.volume=e;break;case "muted":this.muted=e;break;case "loop":this.loop=e;break;case "paused":this.paused=e;break}return this}stop(){this._source&&(this._internalStop(),this.emit("stop"));}get speed(){return this._speed}set speed(t){this._speed=t,this.refresh(),this._update(true);}get volume(){return this._volume}set volume(t){this._volume=t,this.refresh();}get muted(){return this._muted}set muted(t){this._muted=t,this.refresh();}get loop(){return this._loop}set loop(t){this._loop=t,this.refresh();}get filters(){return this._filters}set filters(t){this._filters&&(this._filters?.filter(e=>e).forEach(e=>e.disconnect()),this._filters=null,this._source.connect(this._gain)),this._filters=t?.length?t.slice(0):null,this.refresh();}refresh(){if(!this._source)return;let t=this._media.context,e=this._media.parent;this._source.loop=this._loop||e.loop;let i=t.volume*(t.muted?0:1),s=e.volume*(e.muted?0:1),n=this._volume*(this._muted?0:1);ut.setParamValue(this._gain.gain,n*s*i),ut.setParamValue(this._source.playbackRate,this._speed*e.speed*t.speed),this.applyFilters();}applyFilters(){if(this._filters?.length){this._source.disconnect();let t=this._source;this._filters.forEach(e=>{t.connect(e.destination),t=e;}),t.connect(this._gain);}}refreshPaused(){let t=this._media.context,e=this._media.parent,i=this._paused||e.paused||t.paused;i!==this._pausedReal&&(this._pausedReal=i,i?(this._internalStop(),this.emit("paused")):(this.emit("resumed"),this.play({start:this._elapsed%this._duration,end:this._end,speed:this._speed,loop:this._loop,volume:this._volume})),this.emit("pause",i));}play(t){let{start:e,end:i,speed:s,loop:n,volume:o,muted:a,filters:h}=t;i&&console.assert(i>e,"End time is before start time"),this._paused=false;let{source:l,gain:c}=this._media.nodes.cloneBufferSource();this._source=l,this._gain=c,this._speed=s,this._volume=o,this._loop=!!n,this._muted=a,this._filters=h,this.refresh();let u=this._source.buffer.duration;this._duration=u,this._end=i,this._lastUpdate=this._now(),this._elapsed=e,this._source.onended=this._onComplete.bind(this),this._loop?(this._source.loopEnd=i,this._source.loopStart=e,this._source.start(0,e)):i?this._source.start(0,e,i-e):this._source.start(0,e),this.emit("start"),this._update(true),this.enableTicker(true);}enableTicker(t){dt.shared.remove(this._updateListener,this),t&&dt.shared.add(this._updateListener,this);}get progress(){return this._progress}get paused(){return this._paused}set paused(t){this._paused=t,this.refreshPaused();}destroy(){this.removeAllListeners(),this._internalStop(),this._gain&&(this._gain.disconnect(),this._gain=null),this._media&&(this._media.context.events.off("refresh",this.refresh,this),this._media.context.events.off("refreshPaused",this.refreshPaused,this),this._media=null),this._filters?.forEach(t=>t.disconnect()),this._filters=null,this._end=null,this._speed=1,this._volume=1,this._loop=false,this._elapsed=0,this._duration=0,this._paused=false,this._muted=false,this._pausedReal=false;}toString(){return `[WebAudioInstance id=${this.id}]`}_now(){return this._media.context.audioContext.currentTime}_updateListener(){this._update();}_update(t=false){if(this._source){let e=this._now(),i=e-this._lastUpdate;if(i>0||t){let s=this._source.playbackRate.value;this._elapsed+=i*s,this._lastUpdate=e;let n=this._duration,o;if(this._source.loopStart){let a=this._source.loopEnd-this._source.loopStart;o=(this._source.loopStart+this._elapsed%a)/n;}else o=this._elapsed%n/n;this._progress=o,this.emit("progress",this._progress,n);}}}init(t){this._media=t,t.context.events.on("refresh",this.refresh,this),t.context.events.on("refreshPaused",this.refreshPaused,this);}_internalStop(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.stop(0),this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null;}}_onComplete(){if(this._source){this.enableTicker(false),this._source.onended=null,this._source.disconnect();try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}}this._source=null,this._progress=1,this.emit("progress",1,this._duration),this.emit("end",this);}};var ar=class{constructor(t,e){this._output=e,this._input=t;}get destination(){return this._input}get filters(){return this._filters}set filters(t){if(this._filters&&(this._filters.forEach(e=>{e&&e.disconnect();}),this._filters=null,this._input.connect(this._output)),t&&t.length){this._filters=t.slice(0),this._input.disconnect();let e=null;t.forEach(i=>{e===null?this._input.connect(i.destination):e.connect(i.destination),e=i;}),e.connect(this._output);}}destroy(){this.filters=null,this._input=null,this._output=null;}};var tx=class extends ar{constructor(r){let t=r.audioContext,e=t.createBufferSource(),i=t.createGain(),s=t.createAnalyser();e.connect(s),s.connect(i),i.connect(r.destination),super(s,i),this.context=r,this.bufferSource=e,this.gain=i,this.analyser=s;}get script(){return this._script||(this._script=this.context.audioContext.createScriptProcessor(tx.BUFFER_SIZE),this._script.connect(this.context.destination)),this._script}destroy(){super.destroy(),this.bufferSource.disconnect(),this._script&&this._script.disconnect(),this.gain.disconnect(),this.analyser.disconnect(),this.bufferSource=null,this._script=null,this.gain=null,this.analyser=null,this.context=null;}cloneBufferSource(){let r=this.bufferSource,t=this.context.audioContext.createBufferSource();t.buffer=r.buffer,ut.setParamValue(t.playbackRate,r.playbackRate.value),t.loop=r.loop;let e=this.context.audioContext.createGain();return t.connect(e),e.connect(this.destination),{source:t,gain:e}}get bufferSize(){return this.script.bufferSize}},Co=tx;Co.BUFFER_SIZE=0;var hr=class{init(t){this.parent=t,this._nodes=new Co(this.context),this._source=this._nodes.bufferSource,this.source=t.options.source;}destroy(){this.parent=null,this._nodes.destroy(),this._nodes=null;try{this._source.buffer=null;}catch(t){console.warn("Failed to set AudioBufferSourceNode.buffer to null:",t);}this._source=null,this.source=null;}create(){return new xs(this)}get context(){return this.parent.context}get isPlayable(){return !!this._source&&!!this._source.buffer}get filters(){return this._nodes.filters}set filters(t){this._nodes.filters=t;}get duration(){return console.assert(this.isPlayable,"Sound not yet playable, no duration"),this._source.buffer.duration}get buffer(){return this._source.buffer}set buffer(t){this._source.buffer=t;}get nodes(){return this._nodes}load(t){this.source?this._decode(this.source,t):this.parent.url?this._loadUrl(t):t?t(new Error("sound.url or sound.source must be set")):console.error("sound.url or sound.source must be set");}async _loadUrl(t){let e=this.parent.url,i=await W.get().fetch(e);this._decode(await i.arrayBuffer(),t);}_decode(t,e){let i=(s,n)=>{if(s)e&&e(s);else {this.parent.isLoaded=true,this.buffer=n;let o=this.parent.autoPlayStart();e&&e(null,this.parent,o);}};t instanceof AudioBuffer?i(null,t):this.parent.context.decode(t,i);}};var Jr=class{static from(r){let t={};typeof r=="string"?t.url=r:r instanceof ArrayBuffer||r instanceof AudioBuffer||r instanceof HTMLAudioElement?t.source=r:Array.isArray(r)?t.url=r:t=r,t={autoPlay:false,singleInstance:false,url:null,source:null,preload:false,volume:1,speed:1,complete:null,loaded:null,loop:false,...t},Object.freeze(t);let e=K().useLegacy?new ms:new hr;return new Jr(e,t)}constructor(r,t){this.media=r,this.options=t,this._instances=[],this._sprites={},this.media.init(this);let e=t.complete;this._autoPlayOptions=e?{complete:e}:null,this.isLoaded=false,this._preloadQueue=null,this.isPlaying=false,this.autoPlay=t.autoPlay,this.singleInstance=t.singleInstance,this.preload=t.preload||this.autoPlay,this.url=Array.isArray(t.url)?this.preferUrl(t.url):t.url,this.speed=t.speed,this.volume=t.volume,this.loop=t.loop,t.sprites&&this.addSprites(t.sprites),this.preload&&this._preload(t.loaded);}preferUrl(r){let[t]=r.map(e=>({url:e,ext:et.extname(e).slice(1)})).filter(({ext:e})=>or[e]).sort((e,i)=>nr.indexOf(e.ext)-nr.indexOf(i.ext));if(!t)throw new Error("No supported file type found");return t.url}get context(){return K().context}pause(){return this.isPlaying=false,this.paused=true,this}resume(){return this.isPlaying=this._instances.length>0,this.paused=false,this}get paused(){return this._paused}set paused(r){this._paused=r,this.refreshPaused();}get speed(){return this._speed}set speed(r){this._speed=r,this.refresh();}get filters(){return this.media.filters}set filters(r){this.media.filters=r;}addSprites(r,t){if(typeof r=="object"){let i={};for(let s in r)i[s]=this.addSprites(s,r[s]);return i}console.assert(!this._sprites[r],`Alias ${r} is already taken`);let e=new gs(this,t);return this._sprites[r]=e,e}destroy(){this._removeInstances(),this.removeSprites(),this.media.destroy(),this.media=null,this._sprites=null,this._instances=null;}removeSprites(r){if(r){let t=this._sprites[r];t!==void 0&&(t.destroy(),delete this._sprites[r]);}else for(let t in this._sprites)this.removeSprites(t);return this}get isPlayable(){return this.isLoaded&&this.media&&this.media.isPlayable}stop(){if(!this.isPlayable)return this.autoPlay=false,this._autoPlayOptions=null,this;this.isPlaying=false;for(let r=this._instances.length-1;r>=0;r--)this._instances[r].stop();return this}play(r,t){let e;if(typeof r=="string"?e={sprite:r,loop:this.loop,complete:t}:typeof r=="function"?(e={},e.complete=r):e=r,e={complete:null,loaded:null,sprite:null,end:null,start:0,volume:1,speed:1,muted:false,loop:false,...e||{}},e.sprite){let s=e.sprite;console.assert(!!this._sprites[s],`Alias ${s} is not available`);let n=this._sprites[s];e.start=n.start+(e.start||0),e.end=n.end,e.speed=n.speed||1,e.loop=n.loop||e.loop,delete e.sprite;}if(e.offset&&(e.start=e.offset),!this.isLoaded)return this._preloadQueue?new Promise(s=>{this._preloadQueue.push(()=>{s(this.play(e));});}):(this._preloadQueue=[],this.autoPlay=true,this._autoPlayOptions=e,new Promise((s,n)=>{this._preload((o,a,h)=>{this._preloadQueue.forEach(l=>l()),this._preloadQueue=null,o?n(o):(e.loaded&&e.loaded(o,a,h),s(h));});}));(this.singleInstance||e.singleInstance)&&this._removeInstances();let i=this._createInstance();return this._instances.push(i),this.isPlaying=true,i.once("end",()=>{e.complete&&e.complete(this),this._onComplete(i);}),i.once("stop",()=>{this._onComplete(i);}),i.play(e),i}refresh(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refresh();}refreshPaused(){let r=this._instances.length;for(let t=0;t<r;t++)this._instances[t].refreshPaused();}get volume(){return this._volume}set volume(r){this._volume=r,this.refresh();}get muted(){return this._muted}set muted(r){this._muted=r,this.refresh();}get loop(){return this._loop}set loop(r){this._loop=r,this.refresh();}_preload(r){this.media.load(r);}get instances(){return this._instances}get sprites(){return this._sprites}get duration(){return this.media.duration}autoPlayStart(){let r;return this.autoPlay&&(r=this.play(this._autoPlayOptions)),r}_removeInstances(){for(let r=this._instances.length-1;r>=0;r--)this._poolInstance(this._instances[r]);this._instances.length=0;}_onComplete(r){if(this._instances){let t=this._instances.indexOf(r);t>-1&&this._instances.splice(t,1),this.isPlaying=this._instances.length>0;}this._poolInstance(r);}_createInstance(){if(Jr._pool.length>0){let r=Jr._pool.pop();return r.init(this.media),r}return this.media.create()}_poolInstance(r){r.destroy(),Jr._pool.indexOf(r)<0&&Jr._pool.push(r);}},Ge=Jr;Ge._pool=[];var ti=class r extends ar{constructor(){let t=window,e=new r.AudioContext,i=e.createDynamicsCompressor(),s=e.createAnalyser();s.connect(i),i.connect(e.destination),super(s,i),this.autoPause=true,this._ctx=e,this._offlineCtx=new r.OfflineAudioContext(1,2,t.OfflineAudioContext?Math.max(8e3,Math.min(96e3,e.sampleRate)):44100),this.compressor=i,this.analyser=s,this.events=new Y,this.volume=1,this.speed=1,this.muted=false,this.paused=false,this._locked=e.state==="suspended"&&("ontouchstart"in globalThis||"onclick"in globalThis),this._locked&&(this._unlock(),this._unlock=this._unlock.bind(this),document.addEventListener("mousedown",this._unlock,true),document.addEventListener("touchstart",this._unlock,true),document.addEventListener("touchend",this._unlock,true)),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),globalThis.addEventListener("focus",this.onFocus),globalThis.addEventListener("blur",this.onBlur);}onFocus(){if(!this.autoPause)return;let t=this._ctx.state;(t==="suspended"||t==="interrupted"||!this._locked)&&(this.paused=this._pausedOnBlur,this.refreshPaused());}onBlur(){this.autoPause&&(this._locked||(this._pausedOnBlur=this._paused,this.paused=true,this.refreshPaused()));}_unlock(){this._locked&&(this.playEmptySound(),this._ctx.state==="running"&&(document.removeEventListener("mousedown",this._unlock,true),document.removeEventListener("touchend",this._unlock,true),document.removeEventListener("touchstart",this._unlock,true),this._locked=false));}playEmptySound(){let t=this._ctx.createBufferSource();t.buffer=this._ctx.createBuffer(1,1,22050),t.connect(this._ctx.destination),t.start(0,0,0),t.context.state==="suspended"&&t.context.resume();}static get AudioContext(){let t=window;return t.AudioContext||t.webkitAudioContext||null}static get OfflineAudioContext(){let t=window;return t.OfflineAudioContext||t.webkitOfflineAudioContext||null}destroy(){super.destroy();let t=this._ctx;typeof t.close<"u"&&t.close(),globalThis.removeEventListener("focus",this.onFocus),globalThis.removeEventListener("blur",this.onBlur),this.events.removeAllListeners(),this.analyser.disconnect(),this.compressor.disconnect(),this.analyser=null,this.compressor=null,this.events=null,this._offlineCtx=null,this._ctx=null;}get audioContext(){return this._ctx}get offlineContext(){return this._offlineCtx}set paused(t){t&&this._ctx.state==="running"?this._ctx.suspend():!t&&this._ctx.state==="suspended"&&this._ctx.resume(),this._paused=t;}get paused(){return this._paused}refresh(){this.events.emit("refresh");}refreshPaused(){this.events.emit("refreshPaused");}toggleMute(){return this.muted=!this.muted,this.refresh(),this.muted}togglePause(){return this.paused=!this.paused,this.refreshPaused(),this._paused}decode(t,e){let i=n=>{e(new Error(n?.message||"Unable to decode file"));},s=this._offlineCtx.decodeAudioData(t,n=>{e(null,n);},i);s&&s.catch(i);}};var Eo=class{constructor(){this.init();}init(){return this.supported&&(this._webAudioContext=new ti),this._htmlAudioContext=new ps,this._sounds={},this.useLegacy=!this.supported,this}get context(){return this._context}get filtersAll(){return this.useLegacy?[]:this._context.filters}set filtersAll(t){this.useLegacy||(this._context.filters=t);}get supported(){return ti.AudioContext!==null}add(t,e){if(typeof t=="object"){let n={};for(let o in t){let a=this._getOptions(t[o],e);n[o]=this.add(o,a);}return n}if(console.assert(!this._sounds[t],`Sound with alias ${t} already exists.`),e instanceof Ge)return this._sounds[t]=e,e;let i=this._getOptions(e),s=Ge.from(i);return this._sounds[t]=s,s}_getOptions(t,e){let i;return typeof t=="string"?i={url:t}:Array.isArray(t)?i={url:t}:t instanceof ArrayBuffer||t instanceof AudioBuffer||t instanceof HTMLAudioElement?i={source:t}:i=t,i={...i,...e||{}},i}get useLegacy(){return this._useLegacy}set useLegacy(t){this._useLegacy=t,this._context=!t&&this.supported?this._webAudioContext:this._htmlAudioContext;}get disableAutoPause(){return !this._webAudioContext.autoPause}set disableAutoPause(t){this._webAudioContext.autoPause=!t;}remove(t){return this.exists(t,true),this._sounds[t].destroy(),delete this._sounds[t],this}get volumeAll(){return this._context.volume}set volumeAll(t){this._context.volume=t,this._context.refresh();}get speedAll(){return this._context.speed}set speedAll(t){this._context.speed=t,this._context.refresh();}togglePauseAll(){return this._context.togglePause()}pauseAll(){return this._context.paused=true,this._context.refreshPaused(),this}resumeAll(){return this._context.paused=false,this._context.refreshPaused(),this}toggleMuteAll(){return this._context.toggleMute()}muteAll(){return this._context.muted=true,this._context.refresh(),this}unmuteAll(){return this._context.muted=false,this._context.refresh(),this}removeAll(){for(let t in this._sounds)this._sounds[t].destroy(),delete this._sounds[t];return this}stopAll(){for(let t in this._sounds)this._sounds[t].stop();return this}exists(t,e=false){let i=!!this._sounds[t];return e&&console.assert(i,`No sound matching alias '${t}'.`),i}isPlaying(){for(let t in this._sounds)if(this._sounds[t].isPlaying)return true;return false}find(t){return this.exists(t,true),this._sounds[t]}play(t,e){return this.find(t).play(e)}stop(t){return this.find(t).stop()}pause(t){return this.find(t).pause()}resume(t){return this.find(t).resume()}volume(t,e){let i=this.find(t);return e!==void 0&&(i.volume=e),i.volume}speed(t,e){let i=this.find(t);return e!==void 0&&(i.speed=e),i.speed}duration(t){return this.find(t).duration}close(){return this.removeAll(),this._sounds=null,this._webAudioContext&&(this._webAudioContext.destroy(),this._webAudioContext=null),this._htmlAudioContext&&(this._htmlAudioContext.destroy(),this._htmlAudioContext=null),this._context=null,this}};var ex=r=>{let t=r.src,e=r?.alias?.[0];return (!e||r.src===e)&&(e=et.basename(t,et.extname(t))),e},rx={extension:T.Asset,detection:{test:async()=>true,add:async r=>[...r,...nr.filter(t=>or[t])],remove:async r=>r.filter(t=>r.includes(t))},loader:{name:"sound",extension:{type:[T.LoadParser],priority:mt.High},test(r){let t=et.extname(r).slice(1);return !!or[t]||Pl.some(e=>r.startsWith(`data:${e}`))},async load(r,t){let e=await new Promise((i,s)=>Ge.from({...t.data,url:r,preload:true,loaded(n,o){n?s(n):i(o),t.data?.loaded?.(n,o);}}));return K().add(ex(t),e),e},async unload(r,t){K().remove(ex(t));}}};R.add(rx);Qg(new Eo);({DistortionFilter:ce.DistortionFilter,EqualizerFilter:ce.EqualizerFilter,MonoFilter:ce.MonoFilter,ReverbFilter:ce.ReverbFilter,StereoFilter:ce.StereoFilter,StreamFilter:ce.StreamFilter,TelephoneFilter:ce.TelephoneFilter});var ix=["webm","mp4","ogv","mov","avi","wmv","flv","mkv","3gp","mpg","mpeg","m4v","f4v","m2v","asf","vob","ts","m2ts","mts","divx","xvid","rm","rmvb","dat","swf","mpv","mxf","vcd","svcd","dvd","dv","3g2","m2p","m2ts","m2v","m4v","mpe","mpg","mpv2","ogm","qt","rm","ts","vob","wmv","xvid","flv","mkv","mov","mp4","webm","avi","ogv","m4v","f4v","m2v","asf","vob","ts","m2ts","mts","divx","xvid","rm","rmvb","dat","swf","mpv","mxf","vcd","svcd","dvd","dv","3g2","m2p","m2ts","m2v","m4v","mpe","mpg","mpv2","ogm","qt","rm","ts","vob","wmv","xvid","flv","mkv","mov","mp4","webm","avi","ogv","m4v","f4v","m2v","asf","vob"];var ei="Container",Bo="ImageContainer",Al="Image",ri="Sprite",sx="Text",Ml="Video";var J;(s=>(s.log=(n,...o)=>console.log(`[Pixi\u2019VN] ${n}`,...o),s.warn=(n,...o)=>console.warn(`[Pixi\u2019VN] ${n}`,...o),s.error=(n,...o)=>console.error(`[Pixi\u2019VN] ${n}`,...o),s.info=(n,...o)=>console.info(`[Pixi\u2019VN] ${n}`,...o)))(J||={});var ii=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ox=new Set,Cl=typeof process=="object"&&process?process:{},ax=(r,t,e,i)=>{typeof Cl.emitWarning=="function"?Cl.emitWarning(r,t,e,i):console.error(`[${e}] ${t}: ${r}`);},Io=globalThis.AbortController,nx=globalThis.AbortSignal;if(typeof Io>"u"){nx=class{onabort;_onabort=[];reason;aborted=false;addEventListener(i,s){this._onabort.push(s);}},Io=class{constructor(){t();}signal=new nx;abort(i){if(!this.signal.aborted){this.signal.reason=i,this.signal.aborted=true;for(let s of this.signal._onabort)s(i);this.signal.onabort?.(i);}}};let r=Cl.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{r&&(r=false,ax("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t));};}var fb=r=>!ox.has(r),De=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),hx=r=>De(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?si:null:null,si=class extends Array{constructor(t){super(t),this.fill(0);}},El=class r{heap;length;static#h=false;static create(t){let e=hx(t);if(!e)return [];r.#h=true;let i=new r(t,e);return r.#h=false,i}constructor(t,e){if(!r.#h)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0;}push(t){this.heap[this.length++]=t;}pop(){return this.heap[--this.length]}},Fo=class r{#h;#u;#m;#M;#g;#I;#F;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#x;#i;#r;#t;#l;#d;#a;#n;#_;#o;#y;#b;#f;#v;#A;#c;#R;static unsafeExposeInternals(t){return {starts:t.#b,ttls:t.#f,sizes:t.#y,keyMap:t.#i,keyList:t.#r,valList:t.#t,next:t.#l,prev:t.#d,get head(){return t.#a},get tail(){return t.#n},free:t.#_,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#D(e,i,s,n),moveToTail:e=>t.#B(e),indexes:e=>t.#T(e),rindexes:e=>t.#w(e),isStale:e=>t.#p(e)}}get max(){return this.#h}get maxSize(){return this.#u}get calculatedSize(){return this.#x}get size(){return this.#s}get fetchMethod(){return this.#I}get memoMethod(){return this.#F}get dispose(){return this.#m}get onInsert(){return this.#M}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:h,dispose:l,onInsert:c,disposeAfter:u,noDisposeOnSet:f,noUpdateTTL:d,maxSize:p=0,maxEntrySize:x=0,sizeCalculation:g,fetchMethod:_,memoMethod:y,noDeleteOnFetchRejection:v,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:P,allowStaleOnFetchAbort:w,ignoreFetchAbort:S}=t;if(e!==0&&!De(e))throw new TypeError("max option must be a nonnegative integer");let I=e?hx(e):Array;if(!I)throw new Error("invalid max value: "+e);if(this.#h=e,this.#u=p,this.maxEntrySize=x||this.#u,this.sizeCalculation=g,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#F=y,_!==void 0&&typeof _!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#I=_,this.#A=!!_,this.#i=new Map,this.#r=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new I(e),this.#d=new I(e),this.#a=0,this.#n=0,this.#_=El.create(e),this.#s=0,this.#x=0,typeof l=="function"&&(this.#m=l),typeof c=="function"&&(this.#M=c),typeof u=="function"?(this.#g=u,this.#o=[]):(this.#g=void 0,this.#o=void 0),this.#v=!!this.#m,this.#R=!!this.#M,this.#c=!!this.#g,this.noDisposeOnSet=!!f,this.noUpdateTTL=!!d,this.noDeleteOnFetchRejection=!!v,this.allowStaleOnFetchRejection=!!P,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(this.#u!==0&&!De(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!De(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#H();}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=De(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!De(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#U();}if(this.#h===0&&this.ttl===0&&this.#u===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#h&&!this.#u){let F="LRU_CACHE_UNBOUNDED";fb(F)&&(ox.add(F),ax("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",F,r));}}getRemainingTTL(t){return this.#i.has(t)?1/0:0}#U(){let t=new si(this.#h),e=new si(this.#h);this.#f=t,this.#b=e,this.#L=(n,o,a=ii.now())=>{if(e[n]=o!==0?a:0,t[n]=o,o!==0&&this.ttlAutopurge){let h=setTimeout(()=>{this.#p(n)&&this.#S(this.#r[n],"expire");},o+1);h.unref&&h.unref();}},this.#C=n=>{e[n]=t[n]!==0?ii.now():0;},this.#P=(n,o)=>{if(t[o]){let a=t[o],h=e[o];if(!a||!h)return;n.ttl=a,n.start=h,n.now=i||s();let l=n.now-h;n.remainingTTL=a-l;}};let i=0,s=()=>{let n=ii.now();if(this.ttlResolution>0){i=n;let o=setTimeout(()=>i=0,this.ttlResolution);o.unref&&o.unref();}return n};this.getRemainingTTL=n=>{let o=this.#i.get(n);if(o===void 0)return 0;let a=t[o],h=e[o];if(!a||!h)return 1/0;let l=(i||s())-h;return a-l},this.#p=n=>{let o=e[n],a=t[n];return !!a&&!!o&&(i||s())-o>a};}#C=()=>{};#P=()=>{};#L=()=>{};#p=()=>false;#H(){let t=new si(this.#h);this.#x=0,this.#y=t,this.#E=e=>{this.#x-=t[e],t[e]=0;},this.#O=(e,i,s,n)=>{if(this.#e(i))return 0;if(!De(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!De(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#k=(e,i,s)=>{if(t[e]=i,this.#u){let n=this.#u-t[e];for(;this.#x>n;)this.#G(true);}this.#x+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#x);};}#E=t=>{};#k=(t,e,i)=>{};#O=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#T({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#n;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#a));)e=this.#d[e];}*#w({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#a;!(!this.#z(e)||((t||!this.#p(e))&&(yield e),e===this.#n));)e=this.#l[e];}#z(t){return t!==void 0&&this.#i.get(this.#r[t])===t}*entries(){for(let t of this.#T())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*rentries(){for(let t of this.#w())this.#t[t]!==void 0&&this.#r[t]!==void 0&&!this.#e(this.#t[t])&&(yield [this.#r[t],this.#t[t]]);}*keys(){for(let t of this.#T()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*rkeys(){for(let t of this.#w()){let e=this.#r[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e);}}*values(){for(let t of this.#T())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}*rvalues(){for(let t of this.#w())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t]);}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#T()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#r[i],this))return this.get(this.#r[i],e)}}forEach(t,e=this){for(let i of this.#T()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#r[i],this);}}rforEach(t,e=this){for(let i of this.#w()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#r[i],this);}}purgeStale(){let t=false;for(let e of this.#w({allowStale:true}))this.#p(e)&&(this.#S(this.#r[e],"expire"),t=true);return t}info(t){let e=this.#i.get(t);if(e===void 0)return;let i=this.#t[e],s=this.#e(i)?i.__staleWhileFetching:i;if(s===void 0)return;let n={value:s};if(this.#f&&this.#b){let o=this.#f[e],a=this.#b[e];if(o&&a){let h=o-(ii.now()-a);n.ttl=h,n.start=Date.now();}}return this.#y&&(n.size=this.#y[e]),n}dump(){let t=[];for(let e of this.#T({allowStale:true})){let i=this.#r[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let o={value:n};if(this.#f&&this.#b){o.ttl=this.#f[e];let a=ii.now()-this.#b[e];o.start=Math.floor(Date.now()-a);}this.#y&&(o.size=this.#y[e]),t.unshift([i,o]);}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=ii.now()-s;}this.set(e,i.value,i);}}set(t,e,i={}){if(e===void 0)return this.delete(t),this;let{ttl:s=this.ttl,start:n,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:h}=i,{noUpdateTTL:l=this.noUpdateTTL}=i,c=this.#O(t,e,i.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=true),this.#S(t,"set"),this;let u=this.#s===0?void 0:this.#i.get(t);if(u===void 0)u=this.#s===0?this.#n:this.#_.length!==0?this.#_.pop():this.#s===this.#h?this.#G(false):this.#s,this.#r[u]=t,this.#t[u]=e,this.#i.set(t,u),this.#l[this.#n]=u,this.#d[u]=this.#n,this.#n=u,this.#s++,this.#k(u,c,h),h&&(h.set="add"),l=false,this.#R&&this.#M?.(e,t,"add");else {this.#B(u);let f=this.#t[u];if(e!==f){if(this.#A&&this.#e(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=f;d!==void 0&&!o&&(this.#v&&this.#m?.(d,t,"set"),this.#c&&this.#o?.push([d,t,"set"]));}else o||(this.#v&&this.#m?.(f,t,"set"),this.#c&&this.#o?.push([f,t,"set"]));if(this.#E(u),this.#k(u,c,h),this.#t[u]=e,h){h.set="replace";let d=f&&this.#e(f)?f.__staleWhileFetching:f;d!==void 0&&(h.oldValue=d);}}else h&&(h.set="update");this.#R&&this.onInsert?.(e,t,e===f?"update":"replace");}if(s!==0&&!this.#f&&this.#U(),this.#f&&(l||this.#L(u,s,n),h&&this.#P(h,u)),!o&&this.#c&&this.#o){let f=this.#o,d;for(;d=f?.shift();)this.#g?.(...d);}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#a];if(this.#G(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#c&&this.#o){let t=this.#o,e;for(;e=t?.shift();)this.#g?.(...e);}}}#G(t){let e=this.#a,i=this.#r[e],s=this.#t[e];return this.#A&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(s,i,"evict"),this.#c&&this.#o?.push([s,i,"evict"])),this.#E(e),t&&(this.#r[e]=void 0,this.#t[e]=void 0,this.#_.push(e)),this.#s===1?(this.#a=this.#n=0,this.#_.length=0):this.#a=this.#l[e],this.#i.delete(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#i.get(t);if(n!==void 0){let o=this.#t[n];if(this.#e(o)&&o.__staleWhileFetching===void 0)return false;if(this.#p(n))s&&(s.has="stale",this.#P(s,n));else return i&&this.#C(n),s&&(s.has="hit",this.#P(s,n)),true}else s&&(s.has="miss");return false}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#i.get(t);if(s===void 0||!i&&this.#p(s))return;let n=this.#t[s];return this.#e(n)?n.__staleWhileFetching:n}#D(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let o=new Io,{signal:a}=i;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let h={signal:o.signal,options:i,context:s},l=(x,g=false)=>{let{aborted:_}=o.signal,y=i.ignoreFetchAbort&&x!==void 0;if(i.status&&(_&&!g?(i.status.fetchAborted=true,i.status.fetchError=o.signal.reason,y&&(i.status.fetchAbortIgnored=true)):i.status.fetchResolved=true),_&&!y&&!g)return u(o.signal.reason);let v=d;return this.#t[e]===d&&(x===void 0?v.__staleWhileFetching?this.#t[e]=v.__staleWhileFetching:this.#S(t,"fetch"):(i.status&&(i.status.fetchUpdated=true),this.set(t,x,h.options))),x},c=x=>(i.status&&(i.status.fetchRejected=true,i.status.fetchError=x),u(x)),u=x=>{let{aborted:g}=o.signal,_=g&&i.allowStaleOnFetchAbort,y=_||i.allowStaleOnFetchRejection,v=y||i.noDeleteOnFetchRejection,b=d;if(this.#t[e]===d&&(!v||b.__staleWhileFetching===void 0?this.#S(t,"fetch"):_||(this.#t[e]=b.__staleWhileFetching)),y)return i.status&&b.__staleWhileFetching!==void 0&&(i.status.returnedStale=true),b.__staleWhileFetching;if(b.__returned===b)throw x},f=(x,g)=>{let _=this.#I?.(t,n,h);_&&_ instanceof Promise&&_.then(y=>x(y===void 0?void 0:y),g),o.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(x(void 0),i.allowStaleOnFetchAbort&&(x=y=>l(y,true)));});};i.status&&(i.status.fetchDispatched=true);let d=new Promise(f).then(l,c),p=Object.assign(d,{__abortController:o,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,p,{...h.options,status:void 0}),e=this.#i.get(t)):this.#t[e]=p,p}#e(t){if(!this.#A)return false;let e=t;return !!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof Io}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:h=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:u=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:x,forceRefresh:g=false,status:_,signal:y}=e;if(!this.#A)return _&&(_.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:_});let v={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:o,noDisposeOnSet:a,size:h,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:u,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:p,ignoreFetchAbort:d,status:_,signal:y},b=this.#i.get(t);if(b===void 0){_&&(_.fetch="miss");let P=this.#D(t,b,v,x);return P.__returned=P}else {let P=this.#t[b];if(this.#e(P)){let C=i&&P.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",C&&(_.returnedStale=true)),C?P.__staleWhileFetching:P.__returned=P}let w=this.#p(b);if(!g&&!w)return _&&(_.fetch="hit"),this.#B(b),s&&this.#C(b),_&&this.#P(_,b),P;let S=this.#D(t,b,v,x),F=S.__staleWhileFetching!==void 0&&i;return _&&(_.fetch=w?"stale":"refresh",F&&w&&(_.returnedStale=true)),F?S.__staleWhileFetching:S.__returned=S}}async forceFetch(t,e={}){let i=await this.fetch(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let i=this.#F;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,forceRefresh:n,...o}=e,a=this.get(t,o);if(!n&&a!==void 0)return a;let h=i(t,a,{options:o,context:s});return this.set(t,h,o),h}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:o}=e,a=this.#i.get(t);if(a!==void 0){let h=this.#t[a],l=this.#e(h);return o&&this.#P(o,a),this.#p(a)?(o&&(o.get="stale"),l?(o&&i&&h.__staleWhileFetching!==void 0&&(o.returnedStale=true),i?h.__staleWhileFetching:void 0):(n||this.#S(t,"expire"),o&&i&&(o.returnedStale=true),i?h:void 0)):(o&&(o.get="hit"),l?h.__staleWhileFetching:(this.#B(a),s&&this.#C(a),h))}else o&&(o.get="miss");}#W(t,e){this.#d[e]=t,this.#l[t]=e;}#B(t){t!==this.#n&&(t===this.#a?this.#a=this.#l[t]:this.#W(this.#d[t],this.#l[t]),this.#W(this.#n,t),this.#n=t);}delete(t){return this.#S(t,"delete")}#S(t,e){let i=false;if(this.#s!==0){let s=this.#i.get(t);if(s!==void 0)if(i=true,this.#s===1)this.#V(e);else {this.#E(s);let n=this.#t[s];if(this.#e(n)?n.__abortController.abort(new Error("deleted")):(this.#v||this.#c)&&(this.#v&&this.#m?.(n,t,e),this.#c&&this.#o?.push([n,t,e])),this.#i.delete(t),this.#r[s]=void 0,this.#t[s]=void 0,s===this.#n)this.#n=this.#d[s];else if(s===this.#a)this.#a=this.#l[s];else {let o=this.#d[s];this.#l[o]=this.#l[s];let a=this.#l[s];this.#d[a]=this.#d[s];}this.#s--,this.#_.push(s);}}if(this.#c&&this.#o?.length){let s=this.#o,n;for(;n=s?.shift();)this.#g?.(...n);}return i}clear(){return this.#V("delete")}#V(t){for(let e of this.#w({allowStale:true})){let i=this.#t[e];if(this.#e(i))i.__abortController.abort(new Error("deleted"));else {let s=this.#r[e];this.#v&&this.#m?.(i,s,t),this.#c&&this.#o?.push([i,s,t]);}}if(this.#i.clear(),this.#t.fill(void 0),this.#r.fill(void 0),this.#f&&this.#b&&(this.#f.fill(0),this.#b.fill(0)),this.#y&&this.#y.fill(0),this.#a=0,this.#n=0,this.#_.length=0,this.#x=0,this.#s=0,this.#c&&this.#o){let e=this.#o,i;for(;i=e?.shift();)this.#g?.(...i);}}};var Ue=class{cache;map=new Map;constructor(t){this.cache=new Fo({max:t.cacheSize}),this.map=new Map;}get[Symbol.iterator](){return this.map[Symbol.iterator]}get[Symbol.toStringTag](){return this.map[Symbol.toStringTag]}clear(){return this.cache.clear(),this.map.clear()}delete(t){let e=this.map.delete(t);return e&&this.cache.delete(t),e}get forEach(){return this.map.forEach}get(t){let e=this.cache.get(t);return e||this.map.get(t)}has(t){return this.map.has(t)}set(t,e){return this.map.set(t,e),this.cache.set(t,e),this}get size(){return this.map.size}get entries(){return this.map.entries}keys(){return this.map.keys()}get values(){return this.map.values}};var _s=new Ue({cacheSize:5});var lx;(s=>{function r(n,o){o||(o=n.name),_s.get(o)&&J.warn(`CanvasElement "${o}" already registered`),n.prototype.pixivnId=o,_s.set(o,n);}s.add=r;function t(n){try{let o=_s.get(n);if(!o){J.error(`CanvasElement "${n}" not found, did you forget to register it with the canvasComponentDecorator?`);return}return new o,o}catch(o){J.error(`Error while getting CanvasElement "${n}"`,o);return}}s.get=t;function e(){return Array.from(_s.values())}s.values=e;function i(n){return _s.has(n)}s.has=i;})(lx||={});var Kt=lx;var qt=class r{static init(t){r._getScreen=t.getScreen;}static _getScreen;static get screen(){return r._getScreen()}};function ni(r,t,e,i,s,n=0){return i=i*(s?-1:1),r==="width"?t*(qt.screen.width-e)+i+n*e+(s?e:0):t*(qt.screen.height-e)+i+n*e+(s?e:0)}function ue(r,t,e,i,s,n=0){return i=i*(s?-1:1),r==="width"?(t-i-n*e-(s?e:0))/(qt.screen.width-e):(t-i-n*e-(s?e:0))/(qt.screen.height-e)}function oi(r,t){return r==="width"?t*qt.screen.width:t*qt.screen.height}function de(r,t){return r==="width"?t/qt.screen.width:t/qt.screen.height}function xt(r,t){if(t=t%360,t<0&&(t+=360),t===0)return {x:r.x,y:r.y};if(t===90)return {x:-r.y,y:r.x};if(t===180)return {x:-r.x,y:-r.y};if(t===270)return {x:r.y,y:-r.x};if(t>0&&t<90){let e=t*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.x*i-r.y*s,y:r.x*s+r.y*i}}else if(t>90&&t<180){let e=(t-90)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.y*s-r.x*i,y:r.y*i-r.x*s}}else if(t>180&&t<270){let e=(t-180)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:-r.x*i+r.y*s,y:-r.x*s-r.y*i}}else if(t>270&&t<360){let e=(t-270)*Math.PI/180,i=Math.cos(e),s=Math.sin(e);return {x:r.y*s-r.x*i,y:-r.y*i-r.x*s}}return {x:0,y:0}}function Le(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?t:i===90||i===270?e:Math.abs(t*Math.cos(i*Math.PI/180))+Math.abs(e*Math.sin(i*Math.PI/180))}function Oe(r){let t=r.width,e=r.height,i=r.angle%360;return i<0&&(i+=360),i===0||i===180?e:i===90||i===270?t:Math.abs(e*Math.cos(i*Math.PI/180))+Math.abs(t*Math.sin(i*Math.PI/180))}var pb=new RegExp(`(${ix.join("|")})$`);function cx(r){let t=Ut.cache.has(r)?Ut.get(r):null;return t instanceof M&&(r=t.source?.label||r),pb.test(r)}function lr(r){return r&&(typeof r.align!="number"&&(r.xAlign!=null&&(r.align===void 0?(r.align={x:r.xAlign},delete r.xAlign):(r.align.x=r.xAlign,delete r.xAlign)),r.yAlign!=null&&(r.align===void 0?(r.align={y:r.yAlign},delete r.yAlign):(r.align.y=r.yAlign,delete r.yAlign))),typeof r.percentagePosition!="number"&&(r.xPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={x:r.xPercentagePosition},delete r.xPercentagePosition):(r.percentagePosition.x=r.xPercentagePosition,delete r.xPercentagePosition)),r.yPercentagePosition!=null&&(r.percentagePosition===void 0?(r.percentagePosition={y:r.yPercentagePosition},delete r.yPercentagePosition):(r.percentagePosition.y=r.yPercentagePosition,delete r.yPercentagePosition))),r)}var ai=new Ue({cacheSize:5});var ux;(n=>{function r(o,a){a||(a=o.name),ai.get(a)&&J.info(`Event "${a}" already exists, it will be overwritten`),o.prototype.id=a,ai.set(a,o);}n.add=r;function t(o){try{let a=ai.get(o);if(!a){J.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return new a,a}catch(a){J.error(`Error while getting Event "${o}"`,a);return}}n.get=t;function e(o){try{let a=ai.get(o);if(!a){J.error(`Event "${o}" not found, did you forget to register it with the eventDecorator?`);return}return new a}catch(a){J.error(`Error while getting Event "${o}"`,a);return}}n.getInstance=e;function i(){return Array.from(ai.values())}n.values=i;function s(o){return ai.has(o)}n.has=s;})(ux||={});var ys=ux;async function dx(r){let t=mb(r.pixivnId);if(t)await t.setMemory(r);else throw new Error("[Pixi\u2019VN] The element "+r.pixivnId+" could not be created");return t}function mb(r){try{let t=Kt.get(r);return t?new t:void 0}catch(t){J.error(`Error while getting CanvasElement ${r}`,t);return}}function gb(r){return "memory"in r?r.memory:r instanceof fs?_b(r):r instanceof vt?vs(r):bs(r)}function xb(r){return {width:r.width,height:r.height,isRenderGroup:r.isRenderGroup,blendMode:r.blendMode,tint:r.tint,alpha:r.alpha,angle:r.angle,renderable:r.renderable,rotation:r.rotation,scale:{x:r.scale.x,y:r.scale.y},pivot:{x:r.pivot.x,y:r.pivot.y},position:{x:r.position.x,y:r.position.y},skew:{x:r.skew.x,y:r.skew.y},visible:r.visible,x:r.x,y:r.y,boundsArea:r.boundsArea,cursor:r.cursor,eventMode:r.eventMode,interactive:r.interactive,interactiveChildren:r.interactiveChildren,hitArea:r.hitArea}}function fx(r,t){return {url:r.source.label,alias:t===r.source.label?void 0:t}}function bs(r,t){let e=yb(r,ei),s=t?.childrenExport||false?r.children.sort((n,o)=>r.getChildIndex(n)-r.getChildIndex(o)).map(n=>gb(n)):[];return {pixivnId:e,elements:s,...xb(r)}}function vs(r){let t=bs(r),e=t.pixivnId??ri,i=mx(r),s="textureAlias"in r?fx(r.texture,r.textureAlias):fx(r.texture);return {...t,pixivnId:e,textureData:s,anchor:{x:r.anchor.x,y:r.anchor.y},roundPixels:r.roundPixels,onEvents:i}}function _b(r){let t=bs(r),e=t.pixivnId??sx,i=mx(r);return {...t,pixivnId:e,anchor:{x:r.anchor.x,y:r.anchor.y},text:r.text,resolution:r.resolution,style:bb(r.style),roundPixels:r.roundPixels,onEvents:i}}function yb(r,t){return Object.prototype.hasOwnProperty.call(r,"pixivnId")?r.pixivnId:t}function mx(r){return "onEvents"in r?r.onEvents:{}}function px(r,t){if(typeof r!="object"||r===null)return r;J.warn(`Unsupported property type for Text.style.${t}: FillGradient or FillPattern.`,r);}function bb(r){return {align:r.align,breakWords:r.breakWords,dropShadow:r.dropShadow,fill:px(r.stroke,"fill"),fontFamily:r.fontFamily,fontSize:r.fontSize,fontStyle:r.fontStyle,fontVariant:r.fontVariant,fontWeight:r.fontWeight,leading:r.leading,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,padding:r.padding,stroke:px(r.stroke,"stroke"),textBaseline:r.textBaseline,trim:r.trim,whiteSpace:r.whiteSpace,wordWrap:r.wordWrap,wordWrapWidth:r.wordWrapWidth}}var hi=class extends Rt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||ei;}pixivnId=ei;get memory(){return bs(this,{childrenExport:true})}set memory(t){}async setMemory(t){return this.memory=t,await this.importChildren(t),await Ts(this,t)}async importChildren(t){for(let e=0;e<t.elements.length;e++){let i=t.elements[e],s=await dx(i);this.addChild(s);}}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ys.getInstance(i);return this._onEvents[t]=i,s?super.on(t,()=>{s.fn(t,this);}):J.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}};Kt.add(hi,ei);async function Ts(r,t,e){let i=e?.ignoreScale||false,s=e?.end;"isRenderGroup"in t&&t.isRenderGroup!==void 0&&(r.isRenderGroup=t.isRenderGroup),"blendMode"in t&&t.blendMode!==void 0&&(r.blendMode=t.blendMode),"tint"in t&&t.tint!==void 0&&(r.tint=t.tint),"alpha"in t&&t.alpha!==void 0&&(r.alpha=t.alpha),"angle"in t&&t.angle!==void 0&&(r.angle=t.angle),"renderable"in t&&t.renderable!==void 0&&(r.renderable=t.renderable),"rotation"in t&&t.rotation!==void 0&&(r.rotation=t.rotation),!i&&"scale"in t&&t.scale!==void 0&&(typeof t.scale=="number"?r.scale.set(t.scale,t.scale):r.scale.set(t.scale.x,t.scale.y)),"pivot"in t&&t.pivot!==void 0&&(typeof t.pivot=="number"?r.pivot.set(t.pivot,t.pivot):r.pivot.set(t.pivot.x,t.pivot.y)),"position"in t&&t.position!==void 0&&r.position.set(t.position.x,t.position.y),"skew"in t&&t.skew!==void 0&&r.skew.set(t.skew.x,t.skew.y),"visible"in t&&t.visible!==void 0&&(r.visible=t.visible),"x"in t&&t.x!==void 0&&(r.x=t.x),"y"in t&&t.y!==void 0&&(r.y=t.y),"boundsArea"in t&&t.boundsArea!==void 0&&(r.boundsArea=t.boundsArea),"cursor"in t&&t.cursor!==void 0&&(r.cursor=t.cursor),"eventMode"in t&&t.eventMode!==void 0&&(r.eventMode=t.eventMode),"interactive"in t&&t.interactive!==void 0&&(r.interactive=t.interactive),"interactiveChildren"in t&&t.interactiveChildren!==void 0&&(r.interactiveChildren=t.interactiveChildren),"hitArea"in t&&t.hitArea!==void 0&&(r.hitArea=t.hitArea),s&&await s(),i||("width"in t&&t.width!==void 0&&(r.width=t.width),"height"in t&&t.height!==void 0&&(r.height=t.height));}async function ws(r){if(r!=="EMPTY"){if(!r){J.error("Texture not found",r);return}if(Ut.cache.has(r)){let t=Ut.get(r);if(t)return t}return Ut.load(r).then(t=>{if(!t){J.error("Texture not found",r);return}if(!(t instanceof M)){J.error("File not is a file",r);return}return t}).catch(t=>{J.error("Error loading file",t);})}}var li=class r extends vt{constructor(t){super(t),this.pixivnId=this.constructor.prototype.pixivnId||ri;}pixivnId=ri;_textureAlias;get textureAlias(){return this._textureAlias?this._textureAlias:this.texture.source.label}set textureAlias(t){this._textureAlias=t;}get memory(){return vs(this)}set memory(t){}async setMemory(t){return this.memory=t,await Bl(this,t)}_onEvents={};get onEvents(){return this._onEvents}onEvent(t,e){let i=e.prototype.id,s=ys.getInstance(i);return this._onEvents[t]=i,s?(super.on(t,()=>{s.fn(t,this);}),this.interactive||(this.interactive=true,this.eventMode="dynamic")):J.error(`Event ${i} not found`),this}on(t,e,i){return super.on(t,e,i)}static from(t,e){let i=vt.from(t,e),s=new r;return s.texture=i.texture,s}};Kt.add(li,ri);async function Bl(r,t,e){let i=e?.ignoreTexture||false;if(await Ts(r,t),!i){if("textureImage"in t&&t.textureImage&&t.textureImage.image){let n=await ws(t.textureImage.image);n&&(r.texture=n);}if("textureData"in t&&(t.textureData.alias&&(r.textureAlias=t.textureData.alias),t.textureData.url!=="EMPTY")){let n=t.textureData.url;t.textureData.alias&&Ut.resolver.hasKey(t.textureData.alias)&&(n=t.textureData.alias);let o=await ws(n);o&&(r.texture=o);}}let s=e?.half;if(s&&await s(),"anchor"in t&&t.anchor!==void 0&&(typeof t.anchor=="number"?r.anchor.set(t.anchor,t.anchor):r.anchor.set(t.anchor.x,t.anchor.y)),"roundPixels"in t&&t.roundPixels!==void 0&&(r.roundPixels=t.roundPixels),"onEvents"in t)for(let n in t.onEvents){let o=t.onEvents[n],a=ys.get(o);a&&r.onEvent(n,a);}}var fe=class r extends li{pixivnId=Al;constructor(t,e){t=lr(t);let i,s;t&&"align"in t&&t?.align!==void 0&&(i=t.align,delete t.align),t&&"percentagePosition"in t&&t?.percentagePosition!==void 0&&(s=t.percentagePosition,delete t.percentagePosition),super(t),e&&(this.textureAlias=e),i&&(this.align=i),s&&(this.percentagePosition=s);}get memory(){return {...vs(this),pixivnId:this.pixivnId,align:this._align,percentagePosition:this._percentagePosition,loadIsStarted:this._loadIsStarted}}set memory(t){}async setMemory(t){this.memory=t,await Il(this,t),this.reloadPosition();}static from(t,e){let i=vt.from(t,e),s=new r;return s.texture=i.texture,s}_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){return this._loadIsStarted=true,ws(this.textureAlias).then(t=>{this._loadIsStarted=false,t&&(this.texture=t);}).catch(t=>{this._loadIsStarted=false,J.error("Error into ImageSprite.load()",t);})}set texture(t){super.texture=t,this.reloadPosition();}get texture(){return super.texture}get haveEmptyTexture(){return this.texture._source.label==="EMPTY"}_align=void 0;set align(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof t=="number"?(this._align.x=t,this._align.y=t):(t.x!==void 0&&(this._align.x=t.x),t.y!==void 0&&(this._align.y=t.y)),this.reloadPosition();}get align(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return {x:ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x),y:ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}}set xAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.x=t,this.reloadPosition();}get xAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x)}set yAlign(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),this._align.y=t,this.reloadPosition();}get yAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof t=="number"?(this._percentagePosition.x=t,this._percentagePosition.y=t):(t.x!==void 0&&(this._percentagePosition.x=t.x),t.y!==void 0&&(this._percentagePosition.y=t.y)),this.reloadPosition();}get percentagePosition(){return {x:de("width",this.x),y:de("height",this.y)}}get xPercentagePosition(){return de("width",this.x)}set xPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=t,this.reloadPosition();}get yPercentagePosition(){return de("height",this.y)}set yPercentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=t,this.reloadPosition();}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){return this._align?{x:this._align.x||0,y:this._align.y||0,type:"align"}:this._percentagePosition?{x:this._percentagePosition.x||0,y:this._percentagePosition.y||0,type:"percentage"}:{x:this.x,y:this.y,type:"pixel"}}set positionInfo(t){t.type==="align"?this.align={x:t.x,y:t.y}:t.type==="percentage"?this.percentagePosition={x:t.x,y:t.y}:this.position.set(t.x,t.y);}reloadPosition(){if(this._align){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);this._align.x!==void 0&&(super.x=ni("width",this._align.x,Le(this),t.x,e.x<0,this.anchor.x)),this._align.y!==void 0&&(super.y=ni("height",this._align.y,Oe(this),t.y,e.y<0,this.anchor.y));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=oi("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=oi("height",this._percentagePosition.y)));}get position(){return super.position}set position(t){this._align=void 0,this._percentagePosition=void 0,super.position=t;}get x(){return super.x}set x(t){this._align=void 0,this._percentagePosition=void 0,super.x=t;}get y(){return super.y}set y(t){this._align=void 0,this._percentagePosition=void 0,super.y=t;}};Kt.add(fe,Al);async function Il(r,t,e){let i=e?.ignoreTexture||false;return t=lr(t),await Bl(r,t,{half:async()=>{"align"in t&&t.align!==void 0&&(r.align=t.align),"percentagePosition"in t&&t.percentagePosition!==void 0&&(r.percentagePosition=t.percentagePosition),i||"imageLink"in t&&t.imageLink!==void 0&&(r.textureAlias=t.imageLink),"loadIsStarted"in t&&t.loadIsStarted&&await r.load();},ignoreTexture:e?.ignoreTexture})}var ci=class r extends fe{constructor(t,e){let i,s,n;t&&"loop"in t&&t?.loop!==void 0&&(i=t.loop,delete t.loop),t&&"paused"in t&&t?.paused!==void 0&&(s=t.paused,delete t.paused),t&&"currentTime"in t&&t?.currentTime!==void 0&&(n=t.currentTime,delete t.currentTime),super(t,e),i&&(this.loop=i),s&&(this.paused=s),n&&(this.currentTime=n);}pixivnId=Ml;get memory(){return {...super.memory,pixivnId:this.pixivnId,loop:this.loop,paused:this._paused,currentTime:this.currentTime}}set memory(t){}async setMemory(t){return this.memory=t,await vb(this,t)}static from(t,e){let i=vt.from(t,e),s=new r;return s.texture=i.texture,s}async load(){await super.load(),this.loop=this._looop,this.currentTime=this._currentTime,this.paused=this._paused;}_looop=false;get loop(){return this.texture?.source?.resource?.loop||false}set loop(t){this._looop=t,this.texture?.source?.resource&&(this.texture.source.resource.loop=t);}_paused=false;get paused(){return this.texture?.source?.resource?.paused||false}set paused(t){t?this.pause():this.play();}pause(){this._paused=true,this.texture?.source?.resource&&this.texture.source.resource.pause();}play(){this._paused=false,this.texture?.source?.resource&&this.texture.source.resource.play();}_currentTime=0;get currentTime(){return this.texture?.source?.resource?.currentTime||0}set currentTime(t){let e=this.duration;e&&t>=e&&(t=0),this._currentTime=t,this.texture?.source?.resource&&(this.texture.source.resource.currentTime=t);}restart(){this.currentTime=0;}get duration(){if(this.texture?.source?.resource)return this.texture.source.resource.duration||0}};Kt.add(ci,Ml);async function vb(r,t,e){await Il(r,t,{ignoreTexture:e?.ignoreTexture}),"loop"in t&&t.loop!==void 0&&(r.loop=t.loop),"currentTime"in t&&t.currentTime!==void 0&&(r.currentTime=t.currentTime),"paused"in t&&t.paused!==void 0&&(r.paused=t.paused);}var ui=class extends hi{constructor(t,e=[]){t=lr(t);let i,s,n;t&&"anchor"in t&&t?.anchor!==void 0&&(n=t.anchor,delete t.anchor),t&&"align"in t&&t?.align!==void 0&&(i=t.align,delete t.align),t&&"percentagePosition"in t&&t?.percentagePosition!==void 0&&(s=t.percentagePosition,delete t.percentagePosition),super(t),t=lr(t),e&&e.forEach(o=>{let a;cx(o)?a=new ci(void 0,o):a=new fe(void 0,o),this.addChild(a);}),n&&(this.anchor=n),i&&(this.align=i),s&&(this.percentagePosition=s);}get memory(){return {...super.memory,pixivnId:Bo,anchor:this._anchor,align:this._align,percentagePosition:this._percentagePosition,loadIsStarted:this._loadIsStarted}}set memory(t){}async setMemory(t){this.memory=t,await this.importChildren(t),await Tb(this,t),this.reloadAnchor(),this.reloadPosition();}pixivnId=Bo;_loadIsStarted=false;get loadIsStarted(){return this._loadIsStarted}async load(){this._loadIsStarted=true;let t=Array(this.children.length);for(let e=0;e<this.children.length;e++)t[e]=this.children[e].load();return Promise.all(t).then(()=>{this._loadIsStarted=false,this.reloadAnchor(),this.reloadPosition();}).catch(e=>{this._loadIsStarted=false,J.error("Error into ImageContainer.load()",e);})}get texture(){return this.children.length>0?this.children[0].texture:new M}get haveEmptyTexture(){return this.children.some(t=>t.texture._source.label==="EMPTY")}_anchor;get anchor(){let t=super.pivot.x/this.width,e=super.pivot.y/this.height;return {x:t,y:e}}set anchor(t){typeof t=="number"?this._anchor={x:t,y:t}:this._anchor=t,this.reloadAnchor();}reloadAnchor(){this._anchor&&super.pivot.set(this._anchor.x*this.width,this._anchor.y*this.height);}get pivot(){return super.pivot}set pivot(t){this._anchor=void 0,super.pivot=t;}_align=void 0;set align(t){this._percentagePosition=void 0,this._align===void 0&&(this._align={}),typeof t=="number"?(this._align.x=t,this._align.y=t):(t.x!==void 0&&(this._align.x=t.x),t.y!==void 0&&(this._align.y=t.y)),this.reloadPosition();}get align(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return {x:ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x),y:ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}}set xAlign(t){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.x=t,this.reloadPosition();}get xAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("width",this.x,Le(this),t.x,e.x<0,this.anchor.x)}set yAlign(t){this._percentagePosition&&(this._percentagePosition=void 0),this._align===void 0&&(this._align={}),this._align.y=t,this.reloadPosition();}get yAlign(){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);return ue("height",this.y,Oe(this),t.y,e.y<0,this.anchor.y)}_percentagePosition=void 0;set percentagePosition(t){this._align=void 0,this._percentagePosition===void 0&&(this._percentagePosition={}),typeof t=="number"?(this._percentagePosition.x=t,this._percentagePosition.y=t):(t.x!==void 0&&(this._percentagePosition.x=t.x),t.y!==void 0&&(this._percentagePosition.y=t.y)),this.reloadPosition();}get percentagePosition(){return {x:de("width",this.x),y:de("height",this.y)}}set xPercentagePosition(t){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.x=t,this.reloadPosition();}get xPercentagePosition(){return de("width",this.x)}set yPercentagePosition(t){this._align&&(this._align=void 0),this._percentagePosition===void 0&&(this._percentagePosition={}),this._percentagePosition.y=t,this.reloadPosition();}get yPercentagePosition(){return de("height",this.y)}get positionType(){return this._align?"align":this._percentagePosition?"percentage":"pixel"}get positionInfo(){return this._align?{x:this._align.x||0,y:this._align.y||0,type:"align"}:this._percentagePosition?{x:this._percentagePosition.x||0,y:this._percentagePosition.y||0,type:"percentage"}:{x:this.x,y:this.y,type:"pixel"}}set positionInfo(t){t.type==="align"?this.align={x:t.x,y:t.y}:t.type==="percentage"?this.percentagePosition={x:t.x,y:t.y}:this.position.set(t.x,t.y);}reloadPosition(){if(this._align){let t=xt(this.pivot,this.angle),e=xt(this.scale,this.angle);this._align.x!==void 0&&(super.x=ni("width",this._align.x,Le(this),t.x,e.x<0)),this._align.y!==void 0&&(super.y=ni("height",this._align.y,Oe(this),t.y,e.y<0));}else this._percentagePosition&&(this._percentagePosition.x!==void 0&&(super.x=oi("width",this._percentagePosition.x)),this._percentagePosition.y!==void 0&&(super.y=oi("height",this._percentagePosition.y)));}get position(){return super.position}set position(t){this._align=void 0,this._percentagePosition=void 0,super.position=t;}get x(){return super.x}set x(t){this._align=void 0,this._percentagePosition=void 0,super.x=t;}get y(){return super.y}set y(t){this._align=void 0,this._percentagePosition=void 0,super.y=t;}};Kt.add(ui,Bo);async function Tb(r,t,e){t=lr(t),Ts(r,t,{...e,end:async()=>{"anchor"in t&&t.anchor!==void 0&&(r.anchor=t.anchor),"align"in t&&t.align!==void 0&&(r.align=t.align),"percentagePosition"in t&&t.percentagePosition!==void 0&&(r.percentagePosition=t.percentagePosition),"loadIsStarted"in t&&t.loadIsStarted&&await r.load();}});}function dz(r){return (r instanceof fe||r instanceof ui)&&r.haveEmptyTexture?false:!(r instanceof vt&&r.texture?.label=="EMPTY")}exports.checkIfTextureNotIsEmpty=dz;
|