bard-legends-framework 1.11.3 → 1.11.5
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/AGENTS.md +61 -4
- package/dist/index.d.mts +113 -71
- package/dist/index.d.ts +113 -71
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),U=require('pixi.js');require('pixi.js/advanced-blend-modes');var scriptEngineLib=require('script-engine-lib'),X=require('p2');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var U__namespace=/*#__PURE__*/_interopNamespace(U);var X__default=/*#__PURE__*/_interopDefault(X);var Sr=Object.defineProperty;var h=(n,t)=>Sr(n,"name",{value:t,configurable:true});function ht(){return class{static{h(this,"GatewayBase");}}}h(ht,"Gateway");function Vi(n,t){let e=n.prototype,i=Object.getPrototypeOf(t);for(let s of Reflect.ownKeys(i)){if(typeof s!="string"||s==="constructor")continue;let r=t[s];if(typeof r=="function"){if(Object.prototype.hasOwnProperty.call(e,s))throw new Error(`Gateway "${n.name}": method "${s}" is already registered by another controller.`);e[s]=r.bind(t);}}}h(Vi,"bindControllerToGateway");var I=class{static{h(this,"BardLegendsHardReset");}static{this.ƀfd=new actionsLib.Action;}static{this.onHardReset=this.ƀfd.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀfd.trigger();}};function u(){return function(n){E.ƀgy.set(n,{paramtypes:E.ƀen(n)});}}h(u,"ServiceDecorator");var E=class n{static{h(this,"Service");}static{this.ƀgy=new WeakMap;}static{this.ƀjq=new Map;}static get(t){let e=this.ƀjq.get(t);if(!e){let i=n.ƀgy.get(t);if(!i)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let s=this.ƀjf(i.paramtypes);e=new t(...s),this.ƀjq.set(t,e);}return e}static ƀen(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjf(t){return t.map(i=>{if(i&&n.ƀgy.has(i))return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};I.onHardReset.subscribe(()=>{E.ƀgy=new WeakMap,E.ƀjq=new Map;}).attachToRoot();function lt(n){return function(t){let e=E.ƀen(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=E.ƀjf(e);i.some(r=>r===void 0)&&console.error(i,e,t.name);let s=new t(...i);Vi(n,s);}}}h(lt,"ControllerDecorator");var g=class n{static{h(this,"UpdateCycle");}static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀjj=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀjj.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀlh=0;}static{this.ƀlp=void 0;}static wait(t){let e=this.ƀlh+t;return actionsLib.SingleEvent.create(i=>{let s=n.beforeSceneUpdateAction.subscribe(r=>{r.time>=e&&i();}).attachToRoot();return ()=>s.destroy()})}static registerUpdateModifier(t){if(!this.ƀlp)this.ƀlp=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlp=void 0;}static triggerUpdateTick(t){this.ƀlp&&(t=this.ƀlp(this.ƀlh,t)),this.ƀlh+=t,this.ƀge=t,t>0&&(n.ƀad.trigger({time:this.ƀlh,delta:t}),n.ƀjj.trigger({time:this.ƀlh,delta:t}),n.ƀf.trigger({time:this.ƀlh,delta:t}));}static get lastDelta(){return this.ƀge}static{this.ƀge=0;}};I.onHardReset.subscribe(()=>{g.ƀad.clear(),g.ƀjj.clear(),g.ƀf.clear(),g.ƀlp=void 0,g.ƀlh=0;}).attachToRoot();var B=class n{static{h(this,"EntityStoreHelper");}static{this.ƀaz=new Map;}static registerEntityClass(t){this.ƀaz.set(t.id,new Map);}static registerEntity(t){let e=this.ƀaz.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀaz.get(i)?.delete(e);}static getEntity(t,e){return this.ƀaz.get(t.id)?.get(e)}static getSingleton(t){let e=n.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀaz.get(t.id);return Array.from(e.values())}};I.onHardReset.subscribe(()=>{B.ƀaz.clear();}).attachToRoot();function oi(n){return function(t){Z.ƀgy.set(t,{paramtypes:E.ƀen(t),viewInstances:new Map,entity:n.entity}),ft.registerView(t,n.entity);}}h(oi,"ViewDecorator");var Z=class n extends actionsLib.IDAttachable{static{h(this,"View");}static{this.ƀgy=new WeakMap;}static getInstance(t){let e=n.ƀgy.get(this);if(!(!e||!e.entity.validateID(t)))return e.viewInstances.get(t)}static getInstanceOrFail(t){let e=n.ƀgy.get(this);if(!e||!e.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${e?.entity}"`);let i=e.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.update=()=>{},this.attachToRoot(),this.ƀdg=ft.entityID,this.ƀes().set(this.ƀdg,this);}destroy(){this.destroyed||(super.destroy(),this.ƀes().delete(this.ƀdg));}ƀes(){let t=n.ƀgy.get(this.constructor);if(!t)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${this.constructor.name}"`);return t.viewInstances}};I.onHardReset.subscribe(()=>{Z.ƀgy=new WeakMap;}).attachToRoot();var ft=class n{static{h(this,"EntityViewsHelper");}static{this.ƀly=new Map;}static registerView(t,e){n.ƀly.has(e)||n.ƀly.set(e,[]);let i=n.ƀly.get(e);i&&i.push(t),B.getEntities(e).forEach(r=>{this.ƀcl(r,t);});}static ƀcl(t,e){try{let i=Z.ƀgy.get(e);if(!i)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${e.name}"`);let s=E.ƀjf(i.paramtypes.slice(1));n.entityID=t.id;let r=new e(t,...s);t.destroyed?r.destroy():t.ƀlx.ƀlz.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdf=t,this.ƀlz=[];}createViews(){if(!this.ƀdf.destroyed){let t=n.ƀly.get(this.ƀdf.constructor);t&&t.forEach(e=>{n.ƀcl(this.ƀdf,e);});}}updateViews(t,e){for(let i=0;i<this.ƀlz.length;i++){let s=this.ƀlz[i];s.destroyed||s.update(t,e);}}destroyViews(){this.ƀlz.forEach(t=>{t.destroy();});}};I.onHardReset.subscribe(()=>{ft.ƀly=new Map;}).attachToRoot();function Rt(){return function(n){B.registerEntityClass(n);}}h(Rt,"EntityDecorator");var Q=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return B.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=B.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return B.getEntities(this)}constructor(){super(),this.ƀlx=new ft(this),B.registerEntity(this),g.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.ƀln(t.time,t.delta),this.ƀlx.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀlx.destroyViews(),B.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀlx.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀlx.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀlx.createViews(),this}ƀln(t,e){}};var It=class n extends Q{static{h(this,"SingletonEntity");}static{this.ƀcm=new WeakMap;}static ƀeb(t){let e=n.ƀcm.get(t);return e||(e=new actionsLib.SingleAction,n.ƀcm.set(t,e)),e}static ƀlm(t){n.ƀcm.delete(t);}static getInstanceAsync(){let t=B.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):n.ƀeb(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(r=>{e({type:"open",value:r}),r.onDestroy().tap(()=>{e({type:"close",value:r}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return B.getSingleton(this)}static getInstanceOrFail(){return B.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>n.ƀlm(this.constructor)).attachToRoot(),n.ƀeb(this.constructor).resolve(this);}};function _r(){return function(n){return Nt.ƀgy.set(n,{paramtypes:E.ƀen(n)}),n}}h(_r,"SceneDecorator");var Nt=class n extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀgy=new WeakMap;}static{this.ƀfx=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀfx.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!n.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return n.ƀb.value}static cancelActiveScene(){return n.ƀb.value?n.ƀb.value.ƀj("cancel"):actionsLib.SingleEvent.instant()}static isActive(){return n.ƀb.value instanceof this}static getInstance(){return n.ƀb.value instanceof this?n.ƀb.value:void 0}static getInstanceOrFail(){if(!n.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(n.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${n.ƀb.value}"!`);return n.ƀb.value}static open(...t){if(n.ƀfx.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(n.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=n.ƀgy.get(this);if(!e)throw new Error(`Scene: scene class is not decorated by @SceneDecorator(), class: "${this.name}"`);let i=t[0];n.ƀfx.value=true;let s=E.ƀjf(e.paramtypes),r=new this(...s).attachToRoot();return n.ƀb.set(r),r.init(i).map(()=>(n.ƀfx.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhj=new actionsLib.SingleAction,this.onClose=this.ƀhj.notifier,g.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(n.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(n.ƀfx.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");n.ƀfx.value=true;let e=t[0];return this.ƀj(e).map(()=>(this.ƀhj.resolve(e),e)).chainToRoot()}ƀj(t){return this.prepareToClose(t).tap(()=>{super.destroy(),n.ƀb.set(void 0),n.ƀfx.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};I.onHardReset.subscribe(()=>{Nt.ƀgy=new WeakMap,Nt.ƀb.set(void 0);}).attachToRoot();var W=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Vr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return W.lineer(t)}},Nr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return W.easeIn(t)}},Fr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return W.easeOut(t)}},Lr=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return W.easeInOut(t)}},Hr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return W.easeInCubic(t)}},jr=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return W.easeOutCubic(t)}},Wr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return W.easeInOutCubic(t)}},Ur=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return W.blink(t)}},Fi=class{static{h(this,"AnimationFlicker");}start(){this.ƀli=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀli[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀli[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀli[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀli[e]}},b=class{static{h(this,"Animations");}static{this.lineer=new Vr;}static{this.easeIn=new Nr;}static{this.easeOut=new Fr;}static{this.easeInOut=new Lr;}static{this.easeInCubic=new Hr;}static{this.easeOutCubic=new jr;}static{this.easeInOutCubic=new Wr;}static{this.blink=new Ur;}};exports.ReAnimateHandlingType=void 0;(function(n){n[n.ThrowError=1]="ThrowError",n[n.IgnoreNewAnimation=2]="IgnoreNewAnimation",n[n.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(n){n[n.ReturnToOriginal=1]="ReturnToOriginal",n[n.StayInCurrentState=2]="StayInCurrentState",n[n.JumpToEnd=3]="JumpToEnd",n[n.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var O=class n{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdv(t){let e=n.ƀl.get(t);return e||(e=new helpersLib.MapToWeakRefs,n.ƀl.set(t,e)),e}get animating(){return this.ƀhs!==void 0}get target(){return this.ƀky}get value(){return this.ƀls||(this.ƀls=new actionsLib.Variable(this.ƀky)),this.ƀls.notifier}get paused(){return this.ƀia!==void 0}set paused(t){this.ƀia=t?true:void 0;}constructor(t,e,i){this.ƀfy=false,this.ƀkd=false,this.ƀky=t,this.ƀhu={duration:200,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀm=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgl(t,this.ƀm);}animate(t,e){let i={...this.ƀhu,...e},s=this.ƀhs;if(this.ƀhs)switch(i.reAnimateHandling){case exports.ReAnimateHandlingType.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case exports.ReAnimateHandlingType.IgnoreNewAnimation:return actionsLib.SingleEvent.instant().notIdle();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀjs(i.completionHandling,this.ƀhs.ƀiv,true);break;default:{throw new Error}}return actionsLib.SingleEvent.create(o=>{this.ƀfy&&(this.ƀkd=true);let a={};for(let c of this.ƀm)a[c]={ƀks:this.ƀky[c],ƀlb:t[c]};let l={ƀda:i.duration,ƀdb:0,ƀiv:a,ƀbk:i.completionHandling,ƀn:i.animation,ƀbj:o};if(l.ƀbk!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfv(l)){this.ƀhs=void 0,o(),s?.ƀbj(),this.ƀba();return}return l.ƀn.start(),this.ƀhs=l,this.ƀde(),s?.ƀbj(),()=>{this.ƀhs===l&&(this.ƀky instanceof actionsLib.Attachable&&this.ƀky.destroyed||this.ƀjs(l.ƀbk,l.ƀiv,true),this.ƀhs=void 0,this.ƀba());}}).notIdle()}set(t){this.ƀmf(e=>t[e]),this.ƀhs?.ƀbj();}completeAnimation(t){if(this.ƀhs){t=t??this.ƀhs.ƀbk,this.ƀjs(t,this.ƀhs.ƀiv,true);let e=this.ƀhs.ƀbj;this.ƀhs=void 0,e();}}ƀde(){this.ƀlo||(this.ƀlo=g.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀia){this.ƀfy=true;try{let e=this.ƀhs;if(!e)return;if(e.ƀdb+=t.delta,e.ƀdb>=e.ƀda)if(e.ƀbk===exports.AnimationsCompletionHandlingType.Loop)e.ƀdb%=e.ƀda,e.ƀn.start();else {this.ƀjs(e.ƀbk,e.ƀiv,!1),this.ƀhs=void 0,e.ƀbj(),this.ƀba();return}let i=e.ƀn.multiplierFunction(e.ƀdb/e.ƀda);this.ƀmf(s=>{let r=e.ƀiv[s];return (r.ƀlb-r.ƀks)*i+r.ƀks});}finally{this.ƀfy=false,this.ƀkd&&(this.ƀkd=false,this.ƀcs(),this.ƀde());}}}).attachToRoot());}ƀfv(t){return this.ƀm.every(e=>this.ƀky[e]===t.ƀiv[e].ƀlb)}ƀjs(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀmf(s=>e[s].ƀks);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀmf(s=>e[s].ƀlb);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀmf(s=>e[s].ƀlb);break;default:{throw new Error}}}ƀmf(t){let e=false;for(let i of this.ƀm){let s=t(i);this.ƀky[i]!==s&&(e=true,this.ƀky[i]=s);}e&&this.ƀls?.set(this.ƀky);}ƀba(){this.ƀhs||this.ƀcs();}ƀcs(){this.ƀlo?.destroy(),this.ƀlo=void 0;}ƀgl(t,e){let i=n.ƀdv(t);for(let s of e){if(i.has(s))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${s}"`);i.set(s,this);}}};exports.ContainerEventType=void 0;(function(n){n.Click="click",n.MouseOver="mouseover",n.MouseOut="mouseout",n.PointerDown="pointerdown",n.PointerUp="pointerup",n.PointerUpOutside="pointerupoutside",n.PointerMove="pointermove",n.PointerCancel="pointercancel",n.PointerOver="pointerover",n.PointerOut="pointerout",n.PointerEnter="pointerenter",n.PointerLeave="pointerleave",n.Added="added",n.Removed="removed",n.Update="update",n.Change="change",n.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(n){n.Default="default",n.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var Pe=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgz=false,this.ƀdn=false,this.ƀjh=1,this.ƀw=1,this.ƀin=new U__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀin.width,this.ƀin.height)}setSize(t){return this.ƀin.width=t.x,this.ƀin.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀin.getLocalBounds(),s=new helpersLib.Vector(this.ƀin.scale.x,this.ƀin.scale.y),r=new helpersLib.Vector(i.x,i.y).multiply(s),o=new helpersLib.Vector(i.width,i.height).multiply(s),a=r.add(o.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀin.x,this.ƀin.y)}set position(t){this.ƀin.position=t;}get x(){return this.ƀin.x}set x(t){this.ƀin.x=t;}get y(){return this.ƀin.y}set y(t){this.ƀin.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(s=>{if(t===exports.ContainerEventType.Wheel){let o=s.deltaY;e({deltaY:o});}else e(void 0);},"handle");return this.ƀin.on(t,i),()=>this.ƀin.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀin.rotation)}set rotation(t){this.ƀin.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new helpersLib.Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀin.zIndex}set zIndex(t){this.ƀin.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀin.skew.x)}set skewX(t){this.ƀin.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀin.skew.y)}set skewY(t){this.ƀin.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀin.sortableChildren}set sortableChildren(t){this.ƀin.sortableChildren=t;}setAlpha(t){return this.ƀin.alpha=t,this}get alpha(){return this.ƀin.alpha}set alpha(t){this.ƀin.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀin.eventMode==="dynamic"}set interactive(t){t?this.ƀin.eventMode="dynamic":this.ƀin.eventMode="none";}setRenderGroup(t=true){return this.ƀin.isRenderGroup=t,this}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀin.cursor}set cursor(t){this.ƀin.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀin.addChild(t.ƀin),this.ƀin.mask=t.getMask(),this.ƀgo=t):(this.ƀgo&&this.ƀin.removeChild(this.ƀgo.ƀin),this.ƀin.mask=null),this}hitTest(t){if(this.ƀin.parent)if(this.ƀin.hitArea){let e=this.ƀin.toLocal(t);return this.ƀin.hitArea.contains(e.x,e.y)}else return this.ƀin.getBounds().containsPoint(t.x,t.y);else return false}get boundingBox(){let t=this.ƀin.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return this.ƀin.measurable=!t,this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgz}set mirror(t){this.ƀgz=t,this.ƀlq();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdn}set flip(t){this.ƀdn=t,this.ƀlq();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjh}set scale(t){this.ƀjh=t,this.ƀlq();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀlq();}ƀlq(){this.ƀin.scale.set(this.ƀjh,this.ƀjh),this.ƀw<1?this.ƀin.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀin.scale.y/=this.ƀw),this.ƀgz&&(this.ƀin.scale.x*=-1),this.ƀdn&&(this.ƀin.scale.y*=-1);}};var k=2;var Se=class{static{h(this,"GaussianValuesHelper");}static ƀdt(t,e){let i=e*e,s=1/(helpersLib.PI_360*i),r=-(t*t)/(2*i);return s*Math.exp(r)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),s=.005*i,r=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<s)i-=l*2;else return true}),o=1/i,a=r.map(l=>l*o);return this.ƀbv(a)}static getValuesForLinearSamplingGauss(t){if(t===0)return [{offset:0,multiplier:1}];if(t===1)return [{offset:0,multiplier:.5},{offset:1,multiplier:.25}];{let e=helpersLib.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(s=>this.ƀdt(s,t*.4)),i=e.reduce((s,r)=>s+r,0);return i=i*2-e[0],e=e.map(s=>s/i),this.ƀbv(e)}}static ƀbv(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let s=t[i]+t[i+1],r=i+t[i+1]/s;e.push({offset:r,multiplier:s});}if(t.length%2===0){let i=t[t.length-1],s=t.length-1;e.push({offset:s,multiplier:i});}return e}};var ji=class Wi extends U__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀec(t,e){let i=e?"uInputPixel.z":"uInputPixel.w",s=`
|
|
1
|
+
'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),W=require('pixi.js');require('pixi.js/advanced-blend-modes'),require('@pixi/layout');var scriptEngineLib=require('script-engine-lib'),components=require('@pixi/layout/components'),X=require('p2');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var W__namespace=/*#__PURE__*/_interopNamespace(W);var X__default=/*#__PURE__*/_interopDefault(X);var Tr=Object.defineProperty;var h=(n,t)=>Tr(n,"name",{value:t,configurable:true});function ht(){return class{static{h(this,"GatewayBase");}}}h(ht,"Gateway");function be(n,t){let e=n.prototype,i=Object.getPrototypeOf(t),s=[];for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let o=t[r];if(typeof o=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${n.name}": method "${r}" is already registered by another controller.`);e[r]=o.bind(t),s.push(r);}}return s}h(be,"bindControllerToGateway");var T=class{static{h(this,"BardLegendsTestingHelper");}static{this.ƀff=new actionsLib.Action;}static{this.onHardReset=this.ƀff.notifier;}static{this.ƀhc=[];}static hardReset(){actionsLib.ActionLib.hardReset();for(let t of this.ƀhc)for(let e of t.keys)delete t.gatewayPrototype[e];this.ƀhc=[],this.ƀff.trigger();}static bindMockControllerToGateway(t,e){let i=be(t,e);this.ƀhc.push({gatewayPrototype:t.prototype,keys:i});}};function u(){return function(n){E.ƀha.set(n,{paramtypes:E.ƀep(n)});}}h(u,"ServiceDecorator");var E=class n{static{h(this,"Service");}static{this.ƀha=new WeakMap;}static{this.ƀjv=new Map;}static get(t){let e=this.ƀjv.get(t);if(!e){let i=n.ƀha.get(t);if(!i)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let s=this.ƀjk(i.paramtypes);e=new t(...s),this.ƀjv.set(t,e);}return e}static ƀep(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjk(t){return t.map(i=>{if(i&&n.ƀha.has(i))return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};T.onHardReset.subscribe(()=>{E.ƀjv=new Map;}).attachToRoot();function lt(n){return function(t){let e=E.ƀep(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=E.ƀjk(e);i.some(r=>r===void 0)&&console.error(i,e,t.name);let s=new t(...i);be(n,s);}}}h(lt,"ControllerDecorator");var g=class n{static{h(this,"UpdateCycle");}static{this.ƀae=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀae.notifier;}static{this.ƀjo=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀjo.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀlm=0;}static{this.ƀlu=void 0;}static wait(t){let e=this.ƀlm+t;return actionsLib.SingleEvent.create(i=>{let s=n.beforeSceneUpdateAction.subscribe(r=>{r.time>=e&&i();}).attachToRoot();return ()=>s.destroy()})}static registerUpdateModifier(t){if(!this.ƀlu)this.ƀlu=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlu=void 0;}static triggerUpdateTick(t){this.ƀlu&&(t=this.ƀlu(this.ƀlm,t)),this.ƀlm+=t,this.ƀgg=t,t>0&&(n.ƀae.trigger({time:this.ƀlm,delta:t}),n.ƀjo.trigger({time:this.ƀlm,delta:t}),n.ƀf.trigger({time:this.ƀlm,delta:t}));}static get lastDelta(){return this.ƀgg}static{this.ƀgg=0;}};T.onHardReset.subscribe(()=>{g.ƀae.clear(),g.ƀjo.clear(),g.ƀf.clear(),g.ƀlu=void 0,g.ƀlm=0;}).attachToRoot();var D=class n{static{h(this,"EntityStoreHelper");}static{this.ƀba=new Map;}static{this.ƀji=new Set;}static registerEntityClass(t){this.ƀji.add(t),this.ƀba.set(t.id,new Map);}static registerEntity(t){let e=this.ƀba.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀba.get(i)?.delete(e);}static getEntity(t,e){return this.ƀba.get(t.id)?.get(e)}static getSingleton(t){let e=n.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀba.get(t.id);return Array.from(e.values())}};T.onHardReset.subscribe(()=>{D.ƀba.clear();for(let n of D.ƀji)D.ƀba.set(n.id,new Map);}).attachToRoot();function oi(n){return function(t){Z.ƀha.set(t,{paramtypes:E.ƀep(t),viewInstances:new Map,entity:n.entity}),ft.registerView(t,n.entity);}}h(oi,"ViewDecorator");var Z=class n extends actionsLib.IDAttachable{static{h(this,"View");}static{this.ƀha=new WeakMap;}static getInstance(t){let e=n.ƀha.get(this);if(!(!e||!e.entity.validateID(t)))return e.viewInstances.get(t)}static getInstanceOrFail(t){let e=n.ƀha.get(this);if(!e||!e.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${e?.entity}"`);let i=e.viewInstances.get(t);if(!i)throw new Error(`View: getInstanceOrFail is called with entity id: "${t}", that is not found!`);return i}constructor(){super(),this.update=()=>{},this.attachToRoot(),this.ƀdh=ft.entityID,this.ƀeu().set(this.ƀdh,this);}destroy(){this.destroyed||(super.destroy(),this.ƀeu().delete(this.ƀdh));}ƀeu(){let t=n.ƀha.get(this.constructor);if(!t)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${this.constructor.name}"`);return t.viewInstances}};T.onHardReset.subscribe(()=>{Z.ƀha=new WeakMap;}).attachToRoot();var ft=class n{static{h(this,"EntityViewsHelper");}static{this.ƀmd=new Map;}static registerView(t,e){n.ƀmd.has(e)||n.ƀmd.set(e,[]);let i=n.ƀmd.get(e);i&&i.push(t),D.getEntities(e).forEach(r=>{this.ƀcm(r,t);});}static ƀcm(t,e){try{let i=Z.ƀha.get(e);if(!i)throw new Error(`View: view class is not decorated by @ViewDecorator(), class: "${e.name}"`);let s=E.ƀjk(i.paramtypes.slice(1));n.entityID=t.id;let r=new e(t,...s);t.destroyed?r.destroy():t.ƀmc.ƀme.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdg=t,this.ƀme=[];}createViews(){if(!this.ƀdg.destroyed){let t=n.ƀmd.get(this.ƀdg.constructor);t&&t.forEach(e=>{n.ƀcm(this.ƀdg,e);});}}updateViews(t,e){for(let i=0;i<this.ƀme.length;i++){let s=this.ƀme[i];s.destroyed||s.update(t,e);}}destroyViews(){this.ƀme.forEach(t=>{t.destroy();});}};T.onHardReset.subscribe(()=>{ft.ƀmd=new Map;}).attachToRoot();function It(){return function(n){D.registerEntityClass(n);}}h(It,"EntityDecorator");var Q=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return D.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=D.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return D.getEntities(this)}constructor(){super(),this.ƀmc=new ft(this),D.registerEntity(this),g.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.ƀls(t.time,t.delta),this.ƀmc.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmc.destroyViews(),D.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmc.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmc.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmc.createViews(),this}ƀls(t,e){}};var dt=class n extends Q{static{h(this,"SingletonEntity");}static{this.ƀcn=new WeakMap;}static ƀec(t){let e=n.ƀcn.get(t);return e||(e=new actionsLib.SingleAction,n.ƀcn.set(t,e)),e}static ƀlr(t){n.ƀcn.delete(t);}static getInstanceAsync(){let t=D.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):n.ƀec(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(r=>{e({type:"open",value:r}),r.onDestroy().tap(()=>{e({type:"close",value:r}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return D.getSingleton(this)}static getInstanceOrFail(){return D.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>n.ƀlr(this.constructor)).attachToRoot(),n.ƀec(this.constructor).resolve(this);}};T.onHardReset.subscribe(()=>{dt.ƀcn=new WeakMap;}).attachToRoot();function Vr(){return function(n){return Vt.ƀha.set(n,{paramtypes:E.ƀep(n)}),n}}h(Vr,"SceneDecorator");var Vt=class n extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀha=new WeakMap;}static{this.ƀfz=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀfz.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!n.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return n.ƀb.value}static cancelActiveScene(){return n.ƀb.value?n.ƀb.value.ƀj("cancel"):actionsLib.SingleEvent.instant()}static isActive(){return n.ƀb.value instanceof this}static getInstance(){return n.ƀb.value instanceof this?n.ƀb.value:void 0}static getInstanceOrFail(){if(!n.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(n.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${n.ƀb.value}"!`);return n.ƀb.value}static open(...t){if(n.ƀfz.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(n.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=n.ƀha.get(this);if(!e)throw new Error(`Scene: scene class is not decorated by @SceneDecorator(), class: "${this.name}"`);let i=t[0];n.ƀfz.value=true;let s=E.ƀjk(e.paramtypes),r=new this(...s).attachToRoot();return n.ƀb.set(r),r.init(i).map(()=>(n.ƀfz.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhm=new actionsLib.SingleAction,this.onClose=this.ƀhm.notifier,g.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(n.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(n.ƀfz.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");n.ƀfz.value=true;let e=t[0];return this.ƀj(e).map(()=>(this.ƀhm.resolve(e),e)).chainToRoot()}ƀj(t){return this.prepareToClose(t).tap(()=>{super.destroy(),n.ƀb.set(void 0),n.ƀfz.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};T.onHardReset.subscribe(()=>{Vt.ƀha=new WeakMap,Vt.ƀb.set(void 0);}).attachToRoot();var U=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Nr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return U.lineer(t)}},Fr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return U.easeIn(t)}},Lr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return U.easeOut(t)}},Hr=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return U.easeInOut(t)}},jr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return U.easeInCubic(t)}},Ur=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return U.easeOutCubic(t)}},Wr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return U.easeInOutCubic(t)}},$r=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return U.blink(t)}},Fi=class{static{h(this,"AnimationFlicker");}start(){this.ƀln=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀln[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀln[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀln[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀln[e]}},b=class{static{h(this,"Animations");}static{this.lineer=new Nr;}static{this.easeIn=new Fr;}static{this.easeOut=new Lr;}static{this.easeInOut=new Hr;}static{this.easeInCubic=new jr;}static{this.easeOutCubic=new Ur;}static{this.easeInOutCubic=new Wr;}static{this.blink=new $r;}};exports.ReAnimateHandlingType=void 0;(function(n){n[n.ThrowError=1]="ThrowError",n[n.IgnoreNewAnimation=2]="IgnoreNewAnimation",n[n.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(n){n[n.ReturnToOriginal=1]="ReturnToOriginal",n[n.StayInCurrentState=2]="StayInCurrentState",n[n.JumpToEnd=3]="JumpToEnd",n[n.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var O=class n{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdw(t){let e=n.ƀl.get(t);return e||(e=new helpersLib.MapToWeakRefs,n.ƀl.set(t,e)),e}get animating(){return this.ƀhv!==void 0}get target(){return this.ƀld}get value(){return this.ƀlx||(this.ƀlx=new actionsLib.Variable(this.ƀld)),this.ƀlx.notifier}get paused(){return this.ƀid!==void 0}set paused(t){this.ƀid=t?true:void 0;}constructor(t,e,i){this.ƀga=false,this.ƀki=false,this.ƀld=t,this.ƀhx={duration:200,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀm=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgn(t,this.ƀm);}animate(t,e){let i={...this.ƀhx,...e},s=this.ƀhv;if(this.ƀhv)switch(i.reAnimateHandling){case exports.ReAnimateHandlingType.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case exports.ReAnimateHandlingType.IgnoreNewAnimation:return actionsLib.SingleEvent.instant().notIdle();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀjx(i.completionHandling,this.ƀhv.ƀiz,true);break;default:{throw new Error}}return actionsLib.SingleEvent.create(o=>{this.ƀga&&(this.ƀki=true);let a={};for(let c of this.ƀm)a[c]={ƀkx:this.ƀld[c],ƀlg:t[c]};let l={ƀdb:i.duration,ƀdc:0,ƀiz:a,ƀbl:i.completionHandling,ƀn:i.animation,ƀbk:o};if(l.ƀbl!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfx(l)){this.ƀhv=void 0,o(),s?.ƀbk(),this.ƀbb();return}return l.ƀn.start(),this.ƀhv=l,this.ƀdf(),s?.ƀbk(),()=>{this.ƀhv===l&&(this.ƀld instanceof actionsLib.Attachable&&this.ƀld.destroyed||this.ƀjx(l.ƀbl,l.ƀiz,true),this.ƀhv=void 0,this.ƀbb());}}).notIdle()}set(t){this.ƀmk(e=>t[e]),this.ƀhv?.ƀbk();}completeAnimation(t){if(this.ƀhv){t=t??this.ƀhv.ƀbl,this.ƀjx(t,this.ƀhv.ƀiz,true);let e=this.ƀhv.ƀbk;this.ƀhv=void 0,e();}}ƀdf(){this.ƀlt||(this.ƀlt=g.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀid){this.ƀga=true;try{let e=this.ƀhv;if(!e)return;if(e.ƀdc+=t.delta,e.ƀdc>=e.ƀdb)if(e.ƀbl===exports.AnimationsCompletionHandlingType.Loop)e.ƀdc%=e.ƀdb,e.ƀn.start();else {this.ƀjx(e.ƀbl,e.ƀiz,!1),this.ƀhv=void 0,e.ƀbk(),this.ƀbb();return}let i=e.ƀn.multiplierFunction(e.ƀdc/e.ƀdb);this.ƀmk(s=>{let r=e.ƀiz[s];return (r.ƀlg-r.ƀkx)*i+r.ƀkx});}finally{this.ƀga=false,this.ƀki&&(this.ƀki=false,this.ƀct(),this.ƀdf());}}}).attachToRoot());}ƀfx(t){return this.ƀm.every(e=>this.ƀld[e]===t.ƀiz[e].ƀlg)}ƀjx(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀmk(s=>e[s].ƀkx);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀmk(s=>e[s].ƀlg);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀmk(s=>e[s].ƀlg);break;default:{throw new Error}}}ƀmk(t){let e=false;for(let i of this.ƀm){let s=t(i);this.ƀld[i]!==s&&(e=true,this.ƀld[i]=s);}e&&this.ƀlx?.set(this.ƀld);}ƀbb(){this.ƀhv||this.ƀct();}ƀct(){this.ƀlt?.destroy(),this.ƀlt=void 0;}ƀgn(t,e){let i=n.ƀdw(t);for(let s of e){if(i.has(s))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${s}"`);i.set(s,this);}}};var Pe=class extends actionsLib.IDAttachable{static{h(this,"DisplayObjectAttributes");}constructor(t){super(),this.ƀir=t,this.ƀhb=false,this.ƀdo=false,this.ƀjm=1,this.ƀx=1;}setPosition(t,e){return e?.holdFrom&&(t=t.subtract(this.ƀej(e.holdFrom))),e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀir.x,this.ƀir.y)}set position(t){this.ƀir.x=t.x,this.ƀir.y=t.y;}get x(){return this.ƀir.x}set x(t){this.ƀir.x=t;}get y(){return this.ƀir.y}set y(t){this.ƀir.y=t;}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀir.rotation)}set rotation(t){this.ƀir.rotation=t.value;}get rotationValue(){return this.ƀir.rotation}set rotationValue(t){this.ƀir.rotation=t;}setAlpha(t){return this.alpha=t,this}get alpha(){return this.ƀir.alpha}set alpha(t){this.ƀir.alpha=t;}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhb}set mirror(t){this.ƀhb=t,this.ƀlv();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdo}set flip(t){this.ƀdo=t,this.ƀlv();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjm}set scale(t){this.ƀjm=t,this.ƀlv();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀx}set aspectRatio(t){this.ƀx=t,this.ƀlv();}ƀlv(){let t=this.ƀjm,e=this.ƀjm;this.ƀx<1?t*=this.ƀx:this.ƀx>1&&(e/=this.ƀx),this.ƀhb&&(t*=-1),this.ƀdo&&(e*=-1),this.ƀu(t,e);}};var k=2;var Se=class{static{h(this,"GaussianValuesHelper");}static ƀdu(t,e){let i=e*e,s=1/(helpersLib.PI_360*i),r=-(t*t)/(2*i);return s*Math.exp(r)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),s=.005*i,r=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<s)i-=l*2;else return true}),o=1/i,a=r.map(l=>l*o);return this.ƀbw(a)}static getValuesForLinearSamplingGauss(t){if(t===0)return [{offset:0,multiplier:1}];if(t===1)return [{offset:0,multiplier:.5},{offset:1,multiplier:.25}];{let e=helpersLib.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(s=>this.ƀdu(s,t*.4)),i=e.reduce((s,r)=>s+r,0);return i=i*2-e[0],e=e.map(s=>s/i),this.ƀbw(e)}}static ƀbw(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let s=t[i]+t[i+1],r=i+t[i+1]/s;e.push({offset:r,multiplier:s});}if(t.length%2===0){let i=t[t.length-1],s=t.length-1;e.push({offset:s,multiplier:i});}return e}};var Hi=class ji extends W__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀed(t,e){let i=e?"uInputPixel.z":"uInputPixel.w",s=`
|
|
2
2
|
in vec2 vTextureCoord;
|
|
3
3
|
out vec4 finalColor;
|
|
4
4
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
iterate(${o}, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, finalColor);
|
|
19
19
|
iterate(${o} * -1.0, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, finalColor);`;}return s+=`
|
|
20
20
|
}
|
|
21
|
-
`,s}constructor(t,e){super({glProgram:U__namespace.GlProgram.from({vertex:U__namespace.defaultFilterVert,fragment:Wi.ƀec(Se.getValuesForLinearSamplingGauss(t),e)}),resolution:k});}},Ht=class extends U__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super({resolution:k,compatibleRenderers:U__namespace.RendererType.WEBGL}),this.ƀkw=t,this.ƀkw=t.multiplyNumber(k).floor(),this.ƀkw.x<0||this.ƀkw.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀkw.x>100||this.ƀkw.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀfj=new ji(this.ƀkw.x,true),this.ƀlv=new ji(this.ƀkw.y,false),this.padding=Math.max(this.ƀkw.x,this.ƀkw.y);}apply(t,e,i,s){let r=U__namespace.TexturePool.getSameSizeTexture(e);this.ƀlv.apply(t,e,r,true),this.ƀfj.apply(t,r,i,s),U__namespace.TexturePool.returnTexture(r);}get blendMode(){return this.ƀfj.blendMode}set blendMode(t){this.ƀfj&&(this.ƀfj.blendMode=t,this.ƀlv.blendMode=t);}};var Te=class{static{h(this,"Filters");}get red(){return this.ƀiz}set red(t){this.ƀiz=t,this.ƀja();}get green(){return this.ƀev}set green(t){this.ƀev=t,this.ƀja();}get blue(){return this.ƀah}set blue(t){this.ƀah=t,this.ƀja();}get brightness(){return this.ƀam}set brightness(t){this.ƀam=t,this.ƀja();}get contrast(){return this.ƀbq}set contrast(t){this.ƀbq=t,this.ƀja();}get blur(){return this.ƀai}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀai&&e&&!this.ƀai.isEqual(e)||this.ƀai&&!e||!this.ƀai&&e)&&(this.ƀai=e,this.ƀaj&&(this.ƀaj.destroy(),this.ƀaj=void 0),e&&(this.ƀaj=new Ht(e),this.ƀhn()));}constructor(t){this.ƀbm=t,this.ƀiz=1,this.ƀev=1,this.ƀah=1,this.ƀam=1,this.ƀbq=1,this.ƀhn();}removeColorFilter(){this.ƀbf?.destroy(),this.ƀbf=void 0,this.ƀhn();}ƀja(){this.ƀiz===1&&this.ƀev===1&&this.ƀah===1&&this.ƀam===1&&this.ƀbq===1?this.ƀbf&&(this.ƀbf.destroy(),this.ƀbf=void 0,this.ƀhn()):(this.ƀbf||(this.ƀbf=new U__namespace.ColorMatrixFilter,this.ƀbf.resolution=k,this.ƀhn()),this.ƀbf.matrix=[this.ƀiz*this.ƀbq,0,0,0,this.ƀam-1,0,this.ƀev*this.ƀbq,0,0,this.ƀam-1,0,0,this.ƀah*this.ƀbq,0,this.ƀam-1,0,0,0,1,0]);}ƀhn(){let t=[];this.ƀaj&&t.push(this.ƀaj),this.ƀbf&&t.push(this.ƀbf),this.ƀbm.filters=t;}};var d=class n extends Pe{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},n.allContainers.set(this.id,this),this.filters=new Te(this.ƀin);}destroy(){this.destroyed||(super.destroy(),n.allContainers.delete(this.id),!this.ƀin.destroyed&&this.ƀin.destroy());}getBoundingMask(){if(this.addChildTo!==this)return this.addChildTo.getBoundingMask();throw new Error(`Container: bounding mask cannot be used without bounding shapes. Display Object: "${this.id}"!`)}displayParent(t,e){let i;if(helpersLib.Comparator.isNumber(t)){if(i=n.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let s={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(s.addUnder?i.addChildTo.ƀin.addChildAt(this.ƀin,0):i.addChildTo.ƀin.addChild(this.ƀin),s.cropOverflowingParts)if(i)this.ƀin.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}};var jt=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}onStateChange(t){return this.ƀhp.subscribe(e=>t(e.item,e.nextItem)).attach(this),this}onValueChange(t){return this.ƀhr.subscribe(e=>t(e)).attach(this),this}get state(){return {value:this.ƀk.value,item:this.ƀfz,nextItem:this.ƀhh,queuedItem:this.ƀiw,animationState:this.ƀo}}get paused(){return this.ƀp.paused}set paused(t){this.ƀp.paused=t;}constructor(t){super(),this.ƀk={value:0},this.ƀo="idle",this.ƀhp=new actionsLib.Action,this.ƀhr=new actionsLib.Action,this.ƀhu={duration:500,animation:b.lineer,...t},this.ƀp=new O(this.ƀk,"value",{duration:this.ƀhu.duration,animation:this.ƀhu.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀp.value.subscribe(()=>{this.ƀk.value!==1&&this.ƀk.value!==0&&this.ƀhr.trigger(this.ƀk.value);}).attach(this);}setItem(t,e){if(this.ƀfz===void 0)this.ƀfz=t,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh}),this.ƀhr.trigger(this.ƀk.value);else if(e?.instant)this.ƀp.completeAnimation(),this.ƀo="idle",this.ƀfz=t,this.ƀhh=void 0,this.ƀiw=void 0,this.ƀk.value=0,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh}),this.ƀhr.trigger(this.ƀk.value);else switch(this.ƀo){case "idle":t!==this.ƀfz&&(this.ƀo="transitioning",this.ƀhh=t,this.ƀk.value=0,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh}),this.ƀhr.trigger(this.ƀk.value),this.ƀp.animate({value:1}).tap(()=>this.ƀhl()).attach(this));break;case "transitioning":t===this.ƀfz?(this.ƀiw=void 0,this.ƀo="reverting",this.ƀp.animate({value:0},{duration:this.ƀk.value*this.ƀhu.duration}).tap(()=>this.ƀhl()).attach(this)):t===this.ƀhh?this.ƀiw=void 0:this.ƀiw=t;break;case "reverting":t===this.ƀhh?(this.ƀiw=void 0,this.ƀo="transitioning",this.ƀp.animate({value:1},{duration:(1-this.ƀk.value)*this.ƀhu.duration}).tap(()=>this.ƀhl()).attach(this)):t===this.ƀfz?this.ƀiw=void 0:this.ƀiw=t;break;default:{this.ƀo;throw new Error}}}ƀhl(){switch(this.ƀo){case "transitioning":this.ƀk.value===1&&(this.ƀk.value=0,this.ƀiw!==void 0?(this.ƀo="transitioning",this.ƀfz=this.ƀhh,this.ƀhh=this.ƀiw,this.ƀiw=void 0,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh}),this.ƀp.animate({value:1}).tap(()=>this.ƀhl()).attach(this)):(this.ƀo="idle",this.ƀfz=this.ƀhh,this.ƀhh=void 0,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh})),this.ƀhr.trigger(this.ƀk.value));break;case "reverting":if(this.ƀfz===void 0)throw new Error("StateAnimation: item must be defined when reverting!");this.ƀk.value===0&&(this.ƀiw!==void 0?(this.ƀo="transitioning",this.ƀhh=this.ƀiw,this.ƀiw=void 0,this.ƀk.value=0,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh}),this.ƀp.animate({value:1}).tap(()=>this.ƀhl()).attach(this)):(this.ƀo="idle",this.ƀhh=void 0,this.ƀk.value=0,this.ƀhp.trigger({item:this.ƀfz,nextItem:this.ƀhh})),this.ƀhr.trigger(this.ƀk.value));break;case "idle":break;default:{this.ƀo;throw new Error}}}};var J=Symbol("empty"),Re=class extends actionsLib.Attachable{static{h(this,"ThroughEmptyStateAnimation");}onStateChange(t){return this.ƀhp.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀhr.subscribe(e=>t(e)).attach(this),this}get state(){let t=this.ƀkt.state.queuedItem;return {value:this.ƀls,item:this.ƀfz,nextItem:this.ƀo==="appearing"?this.ƀfz:void 0,queuedItem:t===J?void 0:t,animationState:this.ƀo}}constructor(t){super(),this.ƀls=0,this.ƀo="hidden",this.ƀhp=new actionsLib.Action,this.ƀhr=new actionsLib.Action,this.ƀkt=new jt(t).onStateChange((e,i)=>this.ƀex(e,i)).onValueChange(e=>this.ƀfc(e)).attach(this),this.ƀkt.setItem(J);}setItem(t,e){if(e?.instant){this.ƀo=t!==void 0?"appearing":"disappearing",this.ƀkt.setItem(t??J,{instant:true});return}switch(this.ƀo){case "hidden":t!==void 0&&(this.ƀo="appearing",this.ƀkt.setItem(t));break;case "visible":t===void 0?(this.ƀo="disappearing",this.ƀkt.setItem(J)):t!==this.ƀfz&&(this.ƀo="disappearToChange",this.ƀkt.setItem(J),this.ƀkt.setItem(t));break;case "appearing":t===void 0?(this.ƀo="disappearing",this.ƀkt.setItem(J)):t!==this.ƀfz&&(this.ƀls>0?(this.ƀo="disappearToChange",this.ƀkt.setItem(J),this.ƀkt.setItem(t)):(this.ƀkt.setItem(J,{instant:true}),this.ƀkt.setItem(t)));break;case "disappearing":t!==void 0&&t===this.ƀfz?(this.ƀo="appearing",this.ƀkt.setItem(t)):t!==void 0&&(this.ƀo="disappearToChange",this.ƀkt.setItem(t));break;case "disappearToChange":t===void 0?(this.ƀo="disappearing",this.ƀkt.setItem(J)):t===this.ƀfz?(this.ƀo="appearing",this.ƀkt.setItem(t)):this.ƀkt.setItem(t);break;default:{this.ƀo;throw new Error}}}ƀex(t,e){if(e!==void 0){e!==J&&e!==this.ƀfz&&(this.ƀfz=e,this.ƀo="appearing",this.ƀhp.trigger(this.ƀfz),this.ƀls!==0&&(this.ƀls=0,this.ƀhr.trigger(0)));return}if(t===J)this.ƀo==="disappearing"&&(this.ƀfz=void 0,this.ƀo="hidden",this.ƀls=0,this.ƀhp.trigger(void 0),this.ƀhr.trigger(0));else {let i=t!==this.ƀfz;this.ƀfz=t,this.ƀo="visible",i&&this.ƀhp.trigger(this.ƀfz),(i||this.ƀls!==1)&&(this.ƀls=1,this.ƀhr.trigger(1));}}ƀfc(t){let e=this.ƀkt.state.nextItem;if(e===void 0)return;let i=e===J?1-t:t;i!==this.ƀls&&(this.ƀls=i,i!==0&&i!==1&&this.ƀhr.trigger(i));}};var zi=class extends d{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀbz=t;let i={duration:200,animation:b.easeInOut,...e};this.alpha=0,this.ƀkt=new Re(i).onStateChange(s=>{this.ƀbn?.destroy(),this.ƀbn=void 0,s!==void 0&&(this.ƀbn=new d().displayParent(this).attach(this),this.ƀbz({state:s,container:this.ƀbn}));}).onValueChange(s=>{this.alpha=s;}).attach(this);}setState(t,e){return this.ƀkt.setItem(t,e),this}};var G=class{static{h(this,"GameAssets");}static{this.ƀjg=new Map;}static{this.ƀq=0;}static getAsset(t){let e=this.ƀjg.get(t);if(e)return e;throw new Error(`Game Assets: Resource not found! Key: "${t}"`)}static insertAsset(t,e){let i=e||`a-${this.ƀq++}`;return this.ƀjg.set(i,t),i}static destroyAsset(t){let e=this.ƀjg.get(t);e&&(e.source.removeAllListeners("change"),e.destroy(true),this.ƀjg.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(r=>{if(!helpersLib.Comparator.isString(r.url))throw new Error(`GameAssets: source url should be a string: ${r.url}`);let o=e.get(r.url),a=r.id;o?o.push(a):(e.set(r.url,[a]),i.push({url:r.url,callback:h(l=>{if(l instanceof U__namespace.Texture&&(l.id=a),o=e.get(r.url),o)o.forEach(c=>{this.ƀjg.set(c,l);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${r}`)},"callback")}));});let s=performance.now();return Promise.all(i.map(r=>U__namespace.Assets.load(r.url))).then(r=>{let o=performance.now();console.info("Asset load completed in: ",Math.round(o-s)/1e3," seconds"),r.forEach((a,l)=>{i[l].callback(a);});}).catch(r=>{throw new Error(`GameAssets: during asset loading, an error occured: ${r}`)})}};var Ae=class n extends U__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀec(t){let e=`
|
|
21
|
+
`,s}constructor(t,e){super({glProgram:W__namespace.GlProgram.from({vertex:W__namespace.defaultFilterVert,fragment:ji.ƀed(Se.getValuesForLinearSamplingGauss(t),e)}),resolution:k});}},Ft=class extends W__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super({resolution:k,compatibleRenderers:W__namespace.RendererType.WEBGL}),this.ƀlb=t,this.ƀlb=t.multiplyNumber(k).floor(),this.ƀlb.x<0||this.ƀlb.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀlb.x>100||this.ƀlb.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀfl=new Hi(this.ƀlb.x,true),this.ƀma=new Hi(this.ƀlb.y,false),this.padding=Math.max(this.ƀlb.x,this.ƀlb.y);}apply(t,e,i,s){let r=W__namespace.TexturePool.getSameSizeTexture(e);this.ƀma.apply(t,e,r,true),this.ƀfl.apply(t,r,i,s),W__namespace.TexturePool.returnTexture(r);}get blendMode(){return this.ƀfl.blendMode}set blendMode(t){this.ƀfl&&(this.ƀfl.blendMode=t,this.ƀma.blendMode=t);}};var Ee=class{static{h(this,"Filters");}get red(){return this.ƀjd}set red(t){this.ƀjd=t,this.ƀje();}get green(){return this.ƀex}set green(t){this.ƀex=t,this.ƀje();}get blue(){return this.ƀai}set blue(t){this.ƀai=t,this.ƀje();}get brightness(){return this.ƀan}set brightness(t){this.ƀan=t,this.ƀje();}get contrast(){return this.ƀbr}set contrast(t){this.ƀbr=t,this.ƀje();}get blur(){return this.ƀaj}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀaj&&e&&!this.ƀaj.isEqual(e)||this.ƀaj&&!e||!this.ƀaj&&e)&&(this.ƀaj=e,this.ƀak&&(this.ƀak.destroy(),this.ƀak=void 0),e&&(this.ƀak=new Ft(e),this.ƀhq()));}constructor(t){this.ƀbn=t,this.ƀjd=1,this.ƀex=1,this.ƀai=1,this.ƀan=1,this.ƀbr=1,this.ƀhq();}removeColorFilter(){this.ƀbg?.destroy(),this.ƀbg=void 0,this.ƀhq();}ƀje(){this.ƀjd===1&&this.ƀex===1&&this.ƀai===1&&this.ƀan===1&&this.ƀbr===1?this.ƀbg&&(this.ƀbg.destroy(),this.ƀbg=void 0,this.ƀhq()):(this.ƀbg||(this.ƀbg=new W__namespace.ColorMatrixFilter,this.ƀbg.resolution=k,this.ƀhq()),this.ƀbg.matrix=[this.ƀjd*this.ƀbr,0,0,0,this.ƀan-1,0,this.ƀex*this.ƀbr,0,0,this.ƀan-1,0,0,this.ƀai*this.ƀbr,0,this.ƀan-1,0,0,0,1,0]);}ƀhq(){let t=[];this.ƀak&&t.push(this.ƀak),this.ƀbg&&t.push(this.ƀbg),this.ƀbn.filters=t;}};exports.ContainerEventType=void 0;(function(n){n.Click="click",n.MouseOver="mouseover",n.MouseOut="mouseout",n.PointerDown="pointerdown",n.PointerUp="pointerup",n.PointerUpOutside="pointerupoutside",n.PointerMove="pointermove",n.PointerCancel="pointercancel",n.PointerOver="pointerover",n.PointerOut="pointerout",n.PointerEnter="pointerenter",n.PointerLeave="pointerleave",n.Added="added",n.Removed="removed",n.Update="update",n.Change="change",n.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(n){n.Default="default",n.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var d=class n extends Pe{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(t=new W__namespace.Container){super(t),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},this.ƀiq=t,n.allContainers.set(this.id,this),this.filters=new Ee(this.ƀiq);}destroy(){this.destroyed||(super.destroy(),n.allContainers.delete(this.id),!this.ƀiq.destroyed&&this.ƀiq.destroy());}ƀu(t,e){this.ƀiq.scale.set(t,e);}ƀej(t){let e=this.ƀiq.getLocalBounds(),i=new helpersLib.Vector(this.ƀiq.scale.x,this.ƀiq.scale.y),s=new helpersLib.Vector(e.x,e.y).multiply(i),r=new helpersLib.Vector(e.width,e.height).multiply(i);return s.add(r.multiply(t))}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀiq.width,this.ƀiq.height)}setSize(t){return this.ƀiq.width=t.x,this.ƀiq.height=t.y,this}setLayout(t={}){return this.ƀiq.layout={isLeaf:true,width:"intrinsic",height:"intrinsic",...t},this}on(t){return actionsLib.Sequence.create(e=>{let i=h(s=>{if(t===exports.ContainerEventType.Wheel){let o=s.deltaY;e({deltaY:o});}else e(void 0);},"handle");return this.ƀiq.on(t,i),()=>this.ƀiq.off(t,i)}).notIdle()}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀiq.zIndex}set zIndex(t){this.ƀiq.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀiq.skew.x)}set skewX(t){this.ƀiq.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀiq.skew.y)}set skewY(t){this.ƀiq.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀiq.sortableChildren}set sortableChildren(t){this.ƀiq.sortableChildren=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀiq.eventMode==="dynamic"}set interactive(t){t?this.ƀiq.eventMode="dynamic":this.ƀiq.eventMode="none";}setRenderGroup(t=true){return this.ƀiq.isRenderGroup=t,this}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀiq.cursor}set cursor(t){this.ƀiq.cursor=t;}getMask(){throw new Error("Container: mask is not available!")}setMask(t){return t?(this.ƀiq.addChild(t.ƀiq),this.ƀiq.mask=t.getMask(),this.ƀgq=t):(this.ƀgq&&this.ƀiq.removeChild(this.ƀgq.ƀiq),this.ƀiq.mask=null),this}hitTest(t){if(this.ƀiq.parent)if(this.ƀiq.hitArea){let e=this.ƀiq.toLocal(t);return this.ƀiq.hitArea.contains(e.x,e.y)}else return this.ƀiq.getBounds().containsPoint(t.x,t.y);else return false}get boundingBox(){let t=this.ƀiq.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return this.ƀiq.measurable=!t,this}getBoundingMask(){if(this.addChildTo!==this)return this.addChildTo.getBoundingMask();throw new Error(`Container: bounding mask cannot be used without bounding shapes. Display Object: "${this.id}"!`)}displayParent(t,e){let i;if(helpersLib.Comparator.isNumber(t)){if(i=n.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let s={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(s.addUnder?i.addChildTo.ƀiq.addChildAt(this.ƀiq,0):i.addChildTo.ƀiq.addChild(this.ƀiq),s.cropOverflowingParts)if(i)this.ƀiq.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}};var jt=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}onStateChange(t){return this.ƀhs.subscribe(e=>t(e.item,e.nextItem)).attach(this),this}onValueChange(t){return this.ƀhu.subscribe(e=>t(e)).attach(this),this}get state(){return {value:this.ƀk.value,item:this.ƀgb,nextItem:this.ƀhk,queuedItem:this.ƀja,animationState:this.ƀo}}get paused(){return this.ƀp.paused}set paused(t){this.ƀp.paused=t;}constructor(t){super(),this.ƀk={value:0},this.ƀo="idle",this.ƀhs=new actionsLib.Action,this.ƀhu=new actionsLib.Action,this.ƀhx={duration:500,animation:b.lineer,...t},this.ƀp=new O(this.ƀk,"value",{duration:this.ƀhx.duration,animation:this.ƀhx.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀp.value.subscribe(()=>{this.ƀk.value!==1&&this.ƀk.value!==0&&this.ƀhu.trigger(this.ƀk.value);}).attach(this);}setItem(t,e){if(this.ƀgb===void 0)this.ƀgb=t,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk}),this.ƀhu.trigger(this.ƀk.value);else if(e?.instant)this.ƀp.completeAnimation(),this.ƀo="idle",this.ƀgb=t,this.ƀhk=void 0,this.ƀja=void 0,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk}),this.ƀhu.trigger(this.ƀk.value);else switch(this.ƀo){case "idle":t!==this.ƀgb&&(this.ƀo="transitioning",this.ƀhk=t,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk}),this.ƀhu.trigger(this.ƀk.value),this.ƀp.animate({value:1}).tap(()=>this.ƀho()).attach(this));break;case "transitioning":t===this.ƀgb?(this.ƀja=void 0,this.ƀo="reverting",this.ƀp.animate({value:0},{duration:this.ƀk.value*this.ƀhx.duration}).tap(()=>this.ƀho()).attach(this)):t===this.ƀhk?this.ƀja=void 0:this.ƀja=t;break;case "reverting":t===this.ƀhk?(this.ƀja=void 0,this.ƀo="transitioning",this.ƀp.animate({value:1},{duration:(1-this.ƀk.value)*this.ƀhx.duration}).tap(()=>this.ƀho()).attach(this)):t===this.ƀgb?this.ƀja=void 0:this.ƀja=t;break;default:{this.ƀo;throw new Error}}}ƀho(){switch(this.ƀo){case "transitioning":this.ƀk.value===1&&(this.ƀk.value=0,this.ƀja!==void 0?(this.ƀo="transitioning",this.ƀgb=this.ƀhk,this.ƀhk=this.ƀja,this.ƀja=void 0,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk}),this.ƀp.animate({value:1}).tap(()=>this.ƀho()).attach(this)):(this.ƀo="idle",this.ƀgb=this.ƀhk,this.ƀhk=void 0,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk})),this.ƀhu.trigger(this.ƀk.value));break;case "reverting":if(this.ƀgb===void 0)throw new Error("StateAnimation: item must be defined when reverting!");this.ƀk.value===0&&(this.ƀja!==void 0?(this.ƀo="transitioning",this.ƀhk=this.ƀja,this.ƀja=void 0,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk}),this.ƀp.animate({value:1}).tap(()=>this.ƀho()).attach(this)):(this.ƀo="idle",this.ƀhk=void 0,this.ƀk.value=0,this.ƀhs.trigger({item:this.ƀgb,nextItem:this.ƀhk})),this.ƀhu.trigger(this.ƀk.value));break;case "idle":break;default:{this.ƀo;throw new Error}}}};var J=Symbol("empty"),Re=class extends actionsLib.Attachable{static{h(this,"ThroughEmptyStateAnimation");}onStateChange(t){return this.ƀhs.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀhu.subscribe(e=>t(e)).attach(this),this}get state(){let t=this.ƀky.state.queuedItem;return {value:this.ƀlx,item:this.ƀgb,nextItem:this.ƀo==="appearing"?this.ƀgb:void 0,queuedItem:t===J?void 0:t,animationState:this.ƀo}}constructor(t){super(),this.ƀlx=0,this.ƀo="hidden",this.ƀhs=new actionsLib.Action,this.ƀhu=new actionsLib.Action,this.ƀky=new jt(t).onStateChange((e,i)=>this.ƀez(e,i)).onValueChange(e=>this.ƀfe(e)).attach(this),this.ƀky.setItem(J);}setItem(t,e){if(e?.instant){this.ƀo=t!==void 0?"appearing":"disappearing",this.ƀky.setItem(t??J,{instant:true});return}switch(this.ƀo){case "hidden":t!==void 0&&(this.ƀo="appearing",this.ƀky.setItem(t));break;case "visible":t===void 0?(this.ƀo="disappearing",this.ƀky.setItem(J)):t!==this.ƀgb&&(this.ƀo="disappearToChange",this.ƀky.setItem(J),this.ƀky.setItem(t));break;case "appearing":t===void 0?(this.ƀo="disappearing",this.ƀky.setItem(J)):t!==this.ƀgb&&(this.ƀlx>0?(this.ƀo="disappearToChange",this.ƀky.setItem(J),this.ƀky.setItem(t)):(this.ƀky.setItem(J,{instant:true}),this.ƀky.setItem(t)));break;case "disappearing":t!==void 0&&t===this.ƀgb?(this.ƀo="appearing",this.ƀky.setItem(t)):t!==void 0&&(this.ƀo="disappearToChange",this.ƀky.setItem(t));break;case "disappearToChange":t===void 0?(this.ƀo="disappearing",this.ƀky.setItem(J)):t===this.ƀgb?(this.ƀo="appearing",this.ƀky.setItem(t)):this.ƀky.setItem(t);break;default:{this.ƀo;throw new Error}}}ƀez(t,e){if(e!==void 0){e!==J&&e!==this.ƀgb&&(this.ƀgb=e,this.ƀo="appearing",this.ƀhs.trigger(this.ƀgb),this.ƀlx!==0&&(this.ƀlx=0,this.ƀhu.trigger(0)));return}if(t===J)this.ƀo==="disappearing"&&(this.ƀgb=void 0,this.ƀo="hidden",this.ƀlx=0,this.ƀhs.trigger(void 0),this.ƀhu.trigger(0));else {let i=t!==this.ƀgb;this.ƀgb=t,this.ƀo="visible",i&&this.ƀhs.trigger(this.ƀgb),(i||this.ƀlx!==1)&&(this.ƀlx=1,this.ƀhu.trigger(1));}}ƀfe(t){let e=this.ƀky.state.nextItem;if(e===void 0)return;let i=e===J?1-t:t;i!==this.ƀlx&&(this.ƀlx=i,i!==0&&i!==1&&this.ƀhu.trigger(i));}};var Ji=class extends d{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀca=t;let i={duration:200,animation:b.easeInOut,...e};this.alpha=0,this.ƀky=new Re(i).onStateChange(s=>{this.ƀbo?.destroy(),this.ƀbo=void 0,s!==void 0&&(this.ƀbo=new d().displayParent(this).attach(this),this.ƀca({state:s,container:this.ƀbo}));}).onValueChange(s=>{this.alpha=s;}).attach(this);}setState(t,e){return this.ƀky.setItem(t,e),this}};var G=class{static{h(this,"GameAssets");}static{this.ƀjl=new Map;}static{this.ƀq=0;}static getAsset(t){let e=this.ƀjl.get(t);if(e)return e;throw new Error(`Game Assets: Resource not found! Key: "${t}"`)}static insertAsset(t,e){let i=e||`a-${this.ƀq++}`;return this.ƀjl.set(i,t),i}static destroyAsset(t){let e=this.ƀjl.get(t);e&&(e.source.removeAllListeners("change"),e.destroy(true),this.ƀjl.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(r=>{if(!helpersLib.Comparator.isString(r.url))throw new Error(`GameAssets: source url should be a string: ${r.url}`);let o=e.get(r.url),a=r.id;o?o.push(a):(e.set(r.url,[a]),i.push({url:r.url,callback:h(l=>{if(l instanceof W__namespace.Texture&&(l.id=a),o=e.get(r.url),o)o.forEach(c=>{this.ƀjl.set(c,l);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${r}`)},"callback")}));});let s=performance.now();return Promise.all(i.map(r=>W__namespace.Assets.load(r.url))).then(r=>{let o=performance.now();console.info("Asset load completed in: ",Math.round(o-s)/1e3," seconds"),r.forEach((a,l)=>{i[l].callback(a);});}).catch(r=>{throw new Error(`GameAssets: during asset loading, an error occured: ${r}`)})}};var Ae=class n extends W__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀed(t){let e=`
|
|
22
22
|
in vec2 vTextureCoord;
|
|
23
23
|
out vec4 finalColor;
|
|
24
24
|
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
highestAlpha = centerColor.a;`,e+=`
|
|
43
43
|
|
|
44
44
|
finalColor = vec4(uColor, 1.0) * highestAlpha;
|
|
45
|
-
}`,e}constructor(t,e){if(super({glProgram:U__namespace.GlProgram.from({vertex:U__namespace.defaultFilterVert,fragment:n.ƀec(t*k)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:k}),this.ƀdh=t,this.ƀdh=t*k,this.ƀdh<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdh>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdh)||(this.ƀdh=Math.floor(this.ƀdh));let i=helpersLib.ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdh*this.ƀdh,this.padding=this.ƀdh;}};var Oe=class extends U__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:k,compatibleRenderers:U__namespace.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,...t};this.ƀdi=new Ae(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀaj=new Ht(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀaj.blendMode="add";}apply(t,e,i,s){let r=U__namespace.TexturePool.getSameSizeTexture(e);this.ƀdi.apply(t,e,r,true),this.ƀaj.apply(t,r,i,s),U__namespace.TexturePool.returnTexture(r);}};var re=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀeu=new Map;}static createGlowSpriteFromSprite(t,e,i){let s=this.ƀbi(e),r=helpersLib.Comparator.isNumber(s.blurRadius)?new helpersLib.Vector(s.blurRadius,s.blurRadius):s.blurRadius,o=this.ƀee(t.texture,r,s.expand,s.color,i),a=new U__namespace.Sprite(o);return this.ƀjt(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(r.x,r.y)+s.expand),a.alpha=s.glowAlpha,a.blendMode=s.blendMode,a}static ƀee(t,e,i,s,r){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(r){let o=`${t.id}-${i}-${e.x}-${e.y}-${s.r}-${s.g}-${s.b}`;if(n.ƀeu.has(o))return n.ƀeu.get(o);{let a=this.ƀef(t,e,i,s);return n.ƀeu.set(o,a),a}}else return this.ƀef(t,e,i,s)}static ƀef(t,e,i,s){let r=new U__namespace.Sprite(t);r.filters=[new Oe({blurRadius:e,expand:i,color:s})];let o=new U__namespace.Container;o.addChild(r);let a=Math.max(e.x,e.y)+i,l=x.instance.renderer.generateTexture({target:o,frame:new U__namespace.Rectangle(-a,-a,r.width+a*2,r.height+a*2)});return l.id=G.insertAsset(l),o.destroy({children:true}),l}static ƀjt(t,e,i){let s=(i+(t.width-i*2)*e.x)/t.width,r=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(s,r);}static ƀbi(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};I.onHardReset.subscribe(()=>{re.ƀeu.clear();}).attachToRoot();var et=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀin,i=e.parent;i&&i.removeChild(e);let s=x.instance.renderer.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}});i&&i.addChild(e);let o={id:G.insertAsset(s),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new n(o,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀlg=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀkm=t,this.pixiSprite=new U__namespace.Sprite(G.getAsset(t.id)),this.ƀin.addChild(this.pixiSprite),this.setTextureScale(t.scale),e.textureSize&&(this.pixiSprite.width=e.textureSize.x,this.pixiSprite.height=e.textureSize.y),e.texturePosition&&this.pixiSprite.position.set(e.texturePosition.x,e.texturePosition.y),e.ignoreAnchor||this.pixiSprite.anchor.set(t.anchor.x,t.anchor.y);}destroy(){this.destroyed||(super.destroy(),this.ƀkm.destroyAssetOnDestroy&&(G.destroyAsset(this.ƀkm.id),this.ƀio&&G.destroyAsset(this.ƀio.texture.id)),this.ƀgp?.destroy(),this.ƀal?.destroy(),this.ƀio&&!this.ƀio.destroyed&&this.ƀio.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀlg}set textureScale(t){this.ƀlg=t,this.pixiSprite.scale.set(t);}get size(){return new helpersLib.Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀkm.boundingShapes&&!this.ƀin.hitArea&&(this.ƀin.hitArea=new ms(this.ƀkm.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀkm.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new U__namespace.Color(this.pixiSprite.tint).toRgb()}set tint(t){this.pixiSprite.tint=t;}setShapeAlpha(t){return this.pixiSprite.alpha=t,this}get shapeAlpha(){return this.pixiSprite.alpha}set shapeAlpha(t){this.pixiSprite.alpha=t;}setGlowAlpha(t){return this.glowAlpha=t,this}get glowAlpha(){if(this.ƀio)return this.ƀio.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀio)this.ƀio.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀkm.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀio&&(this.ƀio.destroy(),this.ƀio=void 0),t&&(this.ƀio=re.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀkm.destroyAssetOnDestroy),this.ƀio.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀio.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀin.addChild(this.ƀio)),this}showBoundingShape(t){return t?this.ƀal||(this.ƀal=this.ƀbx().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀal&&(this.ƀal.destroy(),this.ƀal=void 0),this}getBoundingMask(){if(!this.ƀgp){if(!this.ƀkm.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgp=this.ƀbx(),this.ƀgp.displayParent(this);}return this.ƀgp}ƀbx(){if(!this.ƀkm.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return A.createPolygon(this.ƀkm.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀin);if(!t.toBlob)throw new Error("Sprite: canvas.toBlob is undefined!");return t.toBlob(e=>{if(!e)throw new Error("Sprite: blob is undefined!");let i=document.createElement("a");document.body.append(i),i.download="sprite.png",i.href=URL.createObjectURL(e),i.click(),i.remove();},"image/png"),this}},ms=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀkc=t.map(s=>new U__namespace.Polygon(s.map(r=>new U__namespace.Point(r.x,r.y))));}contains(t,e){return this.ƀkc.some(i=>i.contains(t,e))}};var Me=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let s=helpersLib.Vector.fromTo(t,e),r=s.normalize(),o=s.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(r.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(r.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,f=Math.floor(c/p),y=c-p*f;f>=1&&y<i.dashLength&&(y+=p,f--);let v=r.normalize(y/2),w=r.normalize(i.dashGap);if(a.push({from:l,to:l.add(v)}),l=l.add(v),f>0){let M=r.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(f).forEach(()=>{l=l.add(w),a.push({from:l,to:l.add(M)}),l=l.add(M);});}return l=l.add(w),a.push({from:l,to:l.add(v)}),a}};var A=class n extends d{static{h(this,"Graphics");}static{this.ƀcz=new Map;}static createArrow(t,e){let i=new U__namespace.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(r=>{i.poly(r.map(o=>new U__namespace.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let s={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},r=new U__namespace.Graphics;return Me.getLines(t,e,s).forEach(a=>{r.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),r.stroke({width:s.width,color:s.color}),new n(r,JSON.stringify({type:"dashedLine",from:t,to:e,options:s}))}static createVector(t,e,i){let s=new U__namespace.Graphics;return s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke({width:2,color:i}),s.circle(t.x,t.y,3),s.fill(helpersLib.ColorHelper.white),s.stroke({width:1,color:i}),new n(s,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let s=new U__namespace.Graphics;return s.rect(0,0,t.x,e),s.rect(0,e,e,t.y-e*2),s.rect(t.x-e,e,e,t.y-e*2),s.rect(0,t.y-e,t.x,e),s.fill(i),new n(s,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new U__namespace.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new U__namespace.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new U__namespace.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new U__namespace.Graphics,s=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(r=>{i.poly(r.map(o=>new U__namespace.Point(o.x,o.y))).fill(e);}),new n(i,s)}static createRegularPolygon(t,e,i){let s=new U__namespace.Graphics,r=new helpersLib.Radian(helpersLib.PI_360/t);s.moveTo(e,0);for(let o=1;o<=t;o++){let l=r.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;s.lineTo(c,p);}return s.fill(i),new n(s,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀin.addChild(t),this.pixiGraphics=t,this.ƀao=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀao,cache:false,...t},i=this.ƀeq(e.cacheName,e.cache),s={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},r=new et(s,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),r}ƀeq(t,e){if(e){let i=n.ƀcz.get(t);return i||(i=this.ƀcj(),n.ƀcz.set(t,i)),i}else return this.ƀcj()}ƀcj(){let t=x.instance.renderer.generateTexture(this.pixiGraphics);t.id=G.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var li=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Mt=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀcz=new Map;}constructor(t,e,i,s=exports.ScrollDirection.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let r=new d;s===exports.ScrollDirection.Horizontal?this.ƀcd(e,i,r):this.ƀck(e,i,r),this.ƀgp=et.createSnapshotSprite(r).attach(this),r.destroy(),t.setMask(this.ƀgp);}ƀck(t,e,i){e>0&&this.ƀca(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),A.createRectangle(new helpersLib.Vector(t.x,t.y-e*2),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀca(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀcd(t,e,i){e>0&&this.ƀca(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),A.createRectangle(new helpersLib.Vector(t.x-e*2,t.y),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀca(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀca(t){let i={id:this.ƀcb(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new et(i,{textureSize:t,ignoreAnchor:true})}ƀcb(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀcz.get(e);if(!i){let s=document.createElement("canvas");s.width=1,s.height=t;let r=s.getContext("2d");if(r){let o=new li;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;r.fillStyle=c,r.fillRect(0,l,1,1);});let a=U__namespace.Texture.from(s);i=G.insertAsset(a),n.ƀcz.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var De=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhp.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀhr.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀkt.state.value,item:this.ƀfr,nextItem:this.ƀhg,queuedItem:this.ƀkt.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhp=new actionsLib.Action,this.ƀhr=new actionsLib.Action,this.ƀhu={duration:500,animation:b.easeInOutCubic,...t},this.ƀkt=new jt({duration:this.ƀhu.duration,animation:this.ƀhu.animation}).onStateChange((e,i)=>this.ƀex(e,i)).onValueChange(e=>this.ƀfc(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfr===void 0?(this.ƀfr=t,this.ƀhp.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀkt.setItem(t,e)):this.ƀfr!==t?this.ƀhg!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀfr?"transitionForward":"transitionBackward",this.ƀhg=t,this.ƀhp.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀhg}),this.ƀkt.setItem(t,e)):this.ƀkt.setItem(t,e):this.ƀo==="reverting"&&this.ƀhg===t&&(this.ƀo=t>this.ƀfr?"transitionForward":"transitionBackward",this.ƀkt.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀkt.setItem(t,e));}ƀex(t,e){switch(this.ƀfr!==void 0&&this.ƀfr!==t&&this.ƀfr!==e&&this.ƀhp.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfr}),this.ƀhg!==void 0&&this.ƀhg!==t&&this.ƀhg!==e&&this.ƀhp.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀhg}),e!==void 0&&e!==this.ƀfr&&e!==this.ƀhg&&this.ƀhp.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀfr=this.ƀhg,this.ƀhg=void 0):this.ƀfr!==t&&this.ƀey(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhg=void 0):this.ƀfr!==e&&this.ƀey(t,e);break;default:{this.ƀo;throw new Error}}}ƀey(t,e){this.ƀfr=t,this.ƀhg=e,this.ƀhr.trigger({value:0,index:this.ƀfr}),this.ƀo=this.ƀfr<this.ƀhg?"transitionForward":"transitionBackward";}ƀfc(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀfr!==void 0&&this.ƀhg!==void 0&&this.ƀfr>this.ƀhg)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀhr.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfr}),this.ƀhg!==void 0&&this.ƀhr.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhg});}};exports.ScrollDirection=void 0;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var ci=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbz=t,this.ƀcv="x",this.ƀbp=new Map,this.ƀhu={duration:300,animation:b.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhu.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhu.size.x+this.ƀhu.margin*2,this.ƀhu.size.y):new helpersLib.Vector(this.ƀhu.size.x,this.ƀhu.size.y+this.ƀhu.margin*2),s=new d().setPosition(this.ƀhu.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhu.margin,0):new helpersLib.Vector(0,-this.ƀhu.margin),{round:false}).displayParent(this).attach(this);this.ƀce(i,this.ƀhu.margin,this.ƀhu.direction,s),this.ƀcv=this.ƀhu.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀkt=new De({duration:this.ƀhu.duration,animation:this.ƀhu.animation}).onStateChange((r,o)=>{if(r===exports.SlideStateAnimationState.Appear){let a=new d().displayParent(this).attach(this);this.ƀbp.set(o,a),this.ƀbz({index:o,container:a});}else {let a=this.ƀbp.get(o);a&&(a.destroy(),this.ƀbp.delete(o));}}).onValueChange((r,o)=>{let a=this.ƀbp.get(o);if(a){let l={x:0,y:0};l[this.ƀcv]=i[this.ƀcv]*r+this.ƀhu.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=s;}setIndex(t,e){return this.ƀkt.setIndex(t,e),this}ƀce(t,e,i,s){new Mt(s,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},Qi=class extends ci{static{h(this,"SlideInContent");}constructor(t,e,i){super(s=>{let r=this.indexToItem.get(s.index);if(r)e({index:s.index,item:r,container:s.container});else throw new Error(`SlideInContent: The item with index '${s.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((s,r)=>{this.itemToIndex.set(s,r),this.indexToItem.set(r,s);});}setItem(t,e){let i=this.itemToIndex.get(t);if(i!==void 0)this.setIndex(i,e);else throw new Error(`SlideInContent: The item '${t}' is not part of the items list`);return this}};var oe=class{static{h(this,"VectorSet");}constructor(){this.ƀlt=new Map;}add(t){let e=this.ƀlt.get(t.x);e||(e=new Set,this.ƀlt.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀlt.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀlt.get(t.x);return e?e.delete(t.y):false}};var pi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var _=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new helpersLib.Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new helpersLib.Vector(.5,.5)).multiplyNumber(e)}};var ne=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let s=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),r=_.areaToGridArea(e,i);if(this.ƀaw(t,r))return helpersLib.Vector.zero;let o=t.movePositionInsideGrid(r.topLeft),a=helpersLib.Vector.fromTo(r.topLeft,o),l=this.find(t,o,s);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(r.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((s.x+1)*i-e.size.x)/2-p.x,c.y*i+((s.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let s=new oe,r=new helpersLib.Queue(e);for(;r.notEmpty;){let o=r.pop();s.add(o);let a=new helpersLib.Rectangle(o,o.add(i));if(this.ƀaw(t,a))return helpersLib.Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{s.has(l)||r.add(l);});}}static ƀaw(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let s=e.topLeft.x;s<=e.bottomRight.x;s++)if(!t.get(new helpersLib.Vector(s,i)))return false;return true}};var qi=Math.SQRT2-1,Os=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Ms=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,s){this.ƀew=t,this.ƀla=i,this.ƀhf=s,this.ƀht=new helpersLib.BinaryHeap("min"),this.ƀhi=new helpersLib.Grid({size:t.size,defaultValue:void 0});let r=this.ƀcf(e);r.distanceFromStart=0,this.ƀht.add(r.pathLength,r),this.ƀae=r;}get hasOpenNodes(){return this.ƀht.size>0}getNeighbors(t){let e=[];for(let i of this.ƀew.getNeighborPositions(t.position,this.ƀhf))if(this.ƀew.get(i)){let s=this.ƀhi.get(i)??this.ƀcf(i);s.closed||e.push(s);}return e}popLowestPathCostNode(){let t=this.ƀht.pop();return t.closed=true,t.distanceToEnd<this.ƀae.distanceToEnd&&(this.ƀae=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀht.updatePriority(t,t.pathLength)||this.ƀht.add(t.pathLength,t);}getBestClosedNode(){return this.ƀae}ƀcf(t){let e=Math.abs(t.x-this.ƀla.x),i=Math.abs(t.y-this.ƀla.y),s=this.ƀhf==="orthogonal"?e+i:e>i?e+qi*i:i+qi*e,r=new Os(t,s);return this.ƀhi.isPointWithinBounds(t)&&this.ƀhi.set(t,r),r}},ae=class{static{h(this,"PathFinder");}static findPath(t,e,i,s){let r=new Ms(t,e,i,s);for(;r.hasOpenNodes;){let o=r.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of r.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&r.changeNodeCost(a,l,o);}}return r.getBestClosedNode().createSolutionPath(false)}};var Ut=[-1,0,0,1,-1,-1,1,1],$t=[0,-1,1,0,-1,1,-1,1],er=[10,10,10,10,14,14,14,14],ui=Ut.map((n,t)=>new helpersLib.Vector(n,$t[t]).radian),he=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀkz=t;let i=e.width,s=e.height,r=this.ƀeh(e.size);this.ƀmc=i,this.ƀff=s,this.ƀfg=r;let o=i*s,a=new Uint8Array(o),l=new Int32Array(o),c=e.snapshot();for(let w=0;w<s;w++){let M=c[w],L=w*i;for(let R=0;R<i;R++)M[R]?(a[L+R]=1,l[L+R]=r):l[L+R]=-1;}this.ƀy=a,this.ƀmb=l,this.ƀcu=new Uint8Array(o),this.ƀct=new Array(o);let p=[-1,-i,i,1,-i-1,i-1,-i+1,i+1],f=new Array(r),y=e.cropAreaOutsideOfTheGrid(t),v=[];for(let w=y.topLeft.y;w<=y.bottomRight.y;w++)for(let M=y.topLeft.x;M<=y.bottomRight.x;M++)l[w*i+M]=0,v.push(w*i+M);f[0]=v;for(let w=0;w<r;w++){let M=f[w];if(M){f[w]=void 0;for(let L=0;L<M.length;L++){let R=M[L];if(l[R]!==w)continue;let K=R%i;if(K>0&&K<i-1&&R>=i&&R<o-i){let Vt=w+10,$=w+14;for(let H=0;H<8;H++){let j=R+p[H],at=H<4?Vt:$;if(at<l[j]){l[j]=at;let Tt=f[at];Tt?Tt.push(j):f[at]=[j];}}}else {let Vt=(R-K)/i;for(let $=0;$<8;$++){let H=K+Ut[$],j=Vt+$t[$];if(H<0||j<0||H>=i||j>=s)continue;let at=j*i+H,Tt=w+er[$];if(Tt<l[at]){l[at]=Tt;let _i=f[Tt];_i?_i.push(at):f[Tt]=[at];}}}}}}for(let w=0;w<o;w++)l[w]===-1&&(l[w]=r);}getDirectionToTarget(t){if(t.isInsideRectangle(this.ƀkz))return;let e=this.ƀmc,i=Math.round(t.x),s=Math.round(t.y);i=Math.max(0,Math.min(e-1,i)),s=Math.max(0,Math.min(this.ƀff-1,s));let r=s*e+i;if(this.ƀcu[r]===1)return this.ƀct[r];let o=this.ƀap(i,s,r);return this.ƀcu[r]=1,this.ƀct[r]=o,o}ƀap(t,e,i){let s=this.ƀmc,r=this.ƀff,o=[];for(let a=0;a<8;a++){let l=t+Ut[a],c=e+$t[a];l>=0&&c>=0&&l<s&&c<r&&o.push(a);}if(this.ƀmb[i]>=this.ƀfg){let a=o.filter(l=>this.ƀy[(e+$t[l])*s+t+Ut[l]]===1);if(a.length===0)return;if(a.length<o.length)return helpersLib.Radian.getAverage(...a.map(l=>ui[l]))}return this.ƀdx(t,e,o)}ƀdx(t,e,i){let s=this.ƀmc,r=[],o=this.ƀfg;for(let v=0;v<i.length;v++){let w=i[v],M=this.ƀmb[(e+$t[w])*s+t+Ut[w]];if(M>=this.ƀfg)continue;let L=M+er[w];L<o?(r.length=0,r.push(w),o=L):L===o&&r.push(w);}if(r.length===0)return;let a=0,l=0;for(let v=0;v<r.length;v++)a+=Ut[r[v]],l+=$t[r[v]];if(a===0&&l===0)return ui[helpersLib.Random.pickRandomElement(r)];let c=1/Math.sqrt(a*a+l*l),p=t+Math.round(a*c),f=e+Math.round(l*c);return p>=0&&f>=0&&p<s&&f<this.ƀff&&this.ƀy[f*s+p]===1?new helpersLib.Vector(a,l).radian:ui[helpersLib.Random.pickRandomElement(r)]}get t(){let t=[];for(let e=0;e<this.ƀff;e++){let i=new Array(this.ƀmc);for(let s=0;s<this.ƀmc;s++)i[s]=this.ƀmb[e*this.ƀmc+s];t.push(i);}return new helpersLib.Grid(t)}ƀeh(t){return (t.x+t.y)*20}};var T=class n{static{h(this,"AudioAssets");}static{this.ƀan=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀan.set(e.id,i))));}static createSource(t){let e=n.ƀdw(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀdw(t){let e=this.ƀan.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};I.onHardReset.subscribe(()=>{T.context=new AudioContext,T.ƀan.clear();}).attachToRoot();var rt=1e3,it=class n{static{h(this,"Audio");}static ƀjw(){return this.ƀfu=new n,this.ƀfu}constructor(){this.ƀgs=T.context.createGain(),this.ƀgr=T.context.createGain(),this.ƀhe=T.context.createGain(),this.ƀkf=T.context.createGain(),this.ƀgs.connect(T.context.destination),this.ƀgr.connect(this.ƀgs),this.ƀhe.connect(this.ƀgr),this.ƀkf.connect(this.ƀgr),this.ƀgt=new O(this.ƀgs.gain,"value",{duration:500*2,animation:b.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀgt.set({value:0});}setVolumes(t){this.ƀgr.gain.value=t.master,this.ƀhe.gain.value=t.music,this.ƀkf.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgt.set({value:t?0:1}),this.ƀgt.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgt.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error}}}};I.onHardReset.subscribe(()=>{it.ƀjw();}).attachToRoot();var _s=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.CameraGateway=class mt extends ht(){static{h(this,"CameraGateway");}};exports.CameraGateway=_s([u()],exports.CameraGateway);var Vs=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Gt=class extends ht(){static{h(this,"CameraViewGateway");}};Gt=Vs([u()],Gt);var rr;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(rr||(rr={}));exports.FocusingAnimation=void 0;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var le=class{static{h(this,"Camera");}get position(){return this.ƀar.getCameraPosition()}constructor(){this.ƀar=E.get(exports.CameraGateway),this.ƀav=E.get(Gt),this.ƀar.createCamera(),this.layers=this.ƀav.getLayers();}setPosition(t){this.ƀar.setPosition(t);}setTransition(t){this.ƀar.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀav.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀav.screenPositonToStagePosition(t)}};var x=class n{static{h(this,"Game");}static get instance(){return this.ƀfu}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀaq}static get audio(){return this.ƀx}static appear(t,e){let i=e?.audio??"ease",s=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,s,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return g.ƀlh}static get setupOptions(){return this.ƀjz}constructor(t){if(this.ƀjl=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀjl.notifier,this.ƀjm=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀjm.notifier,this.devMode=false,n.ƀfu)throw new Error("There can be only one Game instance!");this.ƀbl={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbl.devMode||false,this.ƀim=new U__namespace.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?T.context.suspend():T.context.resume();}).attachToRoot();}async setup(t){n.ƀjz=t;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbl.backgroundColor,autoStart:false,antialias:this.ƀbl.antialias,resolution:this.ƀbl.resolution,width:this.ƀbl.screenResolution?.width,height:this.ƀbl.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀim.init(e);let i=document.body.appendChild(this.ƀim.canvas);this.ƀjv(i),await Promise.all([G.loadGameAssets(t.spriteAssetDefinitions),G.loadGameAssets(t.fontAssetDefinitions),T.load(t.soundAssetDefinitions)]),n.ƀfu=this,this.renderer=this.ƀim.renderer,globalThis.ƀa=this.ƀim,this.ƀfa(),n.ƀaq=new le,n.ƀx=it.ƀjw(),this.ƀim.start(),this.ƀim.ticker.add(()=>{n.freeze.value||g.triggerUpdateTick(this.ƀim.ticker.deltaMS);});}setResolution(t){if(this.ƀim.renderer.resolution!==t){this.ƀim.renderer.resolution=t;let e=this.ƀep();this.ƀim.renderer.resize(e.x,e.y);}}ƀfa(){this.ƀdd(),this.ƀju(),window.addEventListener("resize",t=>{this.ƀdd(),this.ƀju();});}ƀdd(){let t=this.ƀep();(t.x!==this.ƀim.screen.width||t.y!==this.ƀim.screen.height)&&this.ƀim.renderer.resize(t.x,t.y);}ƀju(){let t=new helpersLib.Vector(this.ƀim.screen.width,this.ƀim.screen.height);this.ƀjl.value=t,this.ƀjm.value=t.multiplyNumber(.5).round();}ƀep(){let t=this.ƀbl.screenResolution?.width??window.innerWidth,e=this.ƀbl.screenResolution?.height??window.innerHeight;return this.ƀbl.maxScreenResolution&&(t=Math.min(t,this.ƀbl.maxScreenResolution.width),e=Math.min(e,this.ƀbl.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀjv(t){this.ƀbl.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbl.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbl.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var ce=class n extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=x.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀds.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀds.gain.value=t,this}constructor(t,e){super(),this.ƀkg=t,this.ƀds=T.context.createGain(),this.ƀds.connect(it.ƀfu.ƀkf),this.ƀfe=this.ƀds,e?.volume!==void 0&&(this.volume=e.volume),this.ƀis(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀkv(),this.ƀds?.disconnect());}ƀlr(){this.ƀfe.disconnect(),this.ƀfe.connect(it.ƀfu.ƀhe);}ƀis(t){this.ƀkv();let e=this.ƀkg.loop;if(this.ƀkp=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀkg.duration),e){let i=e.from,s=e.to;this.ƀit({soundID:this.ƀkg.id,start:this.ƀkp,end:this.ƀkp<i?i:s,loop:false,onComplete:h(()=>{this.ƀkj.disconnect(),this.ƀit({soundID:this.ƀkg.id,start:i,end:s,loop:true});},"onComplete")});}else this.ƀit({soundID:this.ƀkg.id,start:this.ƀkp,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀkv(){this.ƀkj&&(this.ƀkj.onended=null,this.ƀkj.stop(),this.ƀkj.disconnect());}ƀit(t){this.ƀkj=T.createSource(t.soundID),this.ƀkj.connect(this.ƀds),t.onComplete&&(this.ƀkj.onended=t.onComplete),t.loop?(this.ƀkj.loop=true,this.ƀkj.loopStart=t.start,this.ƀkj.loopEnd=t.end??this.ƀkj.buffer.duration,this.ƀkj.start(0,t.start)):this.ƀkj.start(0,t.start,t.end?t.end-t.start:void 0);}};var Us=800,_e=-128,gt=class n extends ce{static{h(this,"AdvancedSound");}static createByName(t,e){let i=x.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀlh=new actionsLib.Variable(0),this.time=this.ƀlh.notifier,this.ƀkr=T.context.currentTime-this.ƀkp,this.ƀlh.value=this.ƀkp,g.beforeSceneUpdateAction.subscribe(()=>{this.ƀlh.value=T.context.currentTime-this.ƀkr;}).attach(this),this.ƀfe.disconnect(),this.ƀjx(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀjy(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfe.connect(it.ƀfu.ƀkf);}ƀjx(t=0){this.ƀdl=T.context.createGain(),this.ƀdl.gain.value=1-t,this.ƀdk=new O(this.ƀdl.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfe.connect(this.ƀdl),this.ƀfe=this.ƀdl;}ƀjy(t=0){this.ƀhc=T.context.createBiquadFilter(),this.ƀhc.type="highshelf",this.ƀhc.frequency.value=Us,this.ƀhc.gain.value=t*_e,this.ƀhd=new O(this.ƀhc.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfe.connect(this.ƀhc),this.ƀfe=this.ƀhc;}close(){return this.ƀbc?this.onDestroy():(this.ƀbc=true,this.fade(1,rt).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?actionsLib.SingleEvent.createDestroyed():actionsLib.SingleEvent.create(e=>{let i=this.time.filter(s=>s>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdk.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdl.gain.value;return e===0?(this.ƀdk.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdk.animate({value:1-t},{duration:e,animation:i?b.easeOut:b.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhd.set({value:t*_e});}muffle(t,e=500){return t=helpersLib.NumberHelper.clamp(t,0,1),e===0?(this.ƀhd.set({value:t*_e}),actionsLib.SingleEvent.instant()):this.ƀhd.animate({value:t*_e},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdl.disconnect(),this.ƀhc.disconnect()),super.destroy();}};var pe=class n extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=x.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀki.value.type){case "paused":return this.ƀki.value.value.time;case "playing":return this.ƀki.value.value.time.value;default:{this.ƀki.value;throw new Error}}}get volume(){return this.ƀki.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀki.value.value.volume=t,this}constructor(t,e){super(),this.ƀhu={stopPlayingOnPause:true,...e},this.ƀkh=t.id;let i;if(this.ƀhu.stopPlayingOnPause&&x.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let s=new gt(t,this.ƀhu).attach(this);s.ƀlr(),i={type:"playing",value:s};}this.ƀki=new actionsLib.Variable(i),this.ƀhu.stopPlayingOnPause&&(this.ƀhz=x.pause.subscribe(s=>this.ƀez(s)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀki.asyncDropOngoing((s,r)=>{switch(s.type){case "paused":r.drop();break;case "playing":return s.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbc?this.onDestroy():(this.ƀbc=true,this.ƀhz?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀki.value.type==="playing"?this.ƀki.value.value.close():actionsLib.SingleEvent.instant(),this.ƀdm?.onDestroy()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀez(t){if(t){if(this.ƀki.value.type==="playing"){let e=this.ƀki.value.value;this.ƀki.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdm=e,actionsLib.ActionLib.all([e.fade(1,rt),e.muffle(1,rt)]).tap(()=>{this.ƀdm=void 0,e.destroy();}).attach(this);}}else if(this.ƀki.value.type==="paused"){let{volume:e,time:i}=this.ƀki.value.value,s=gt.createByName(this.ƀkh,{volume:e,time:i,fade:1,muffle:1}).attach(this);s.ƀlr(),actionsLib.ActionLib.all([s.fade(0,rt),s.muffle(0,rt)]).attach(this),this.ƀki.value={type:"playing",value:s};}}};var di=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀiu?this.ƀiu.time:0}get volume(){return this.ƀma}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀma=t,this.ƀiu&&(this.ƀiu.volume=t),this.ƀhy&&(this.ƀhy.volume=t),this}constructor(t){super(),this.ƀma=1,this.ƀhu={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀma=this.ƀhu.volume,this.ƀhu.playWhenPaused&&this.ƀka(this.ƀhu.playWhenPaused);}play(t){if(this.ƀbc)throw new Error("Play is called while music player is destroyed.");return this.ƀcp=t,actionsLib.SingleEvent.instant().async(()=>{let e=this.ƀiu;if(e)return this.ƀiu=void 0,e.close()}).map(()=>{if(this.ƀcp===t)return this.ƀiu=pe.createByName(t,{stopPlayingOnPause:this.ƀhu.stopPlayingOnPause,volume:this.ƀma}).attach(this),this.ƀiu}).chain(this)}stop(){return actionsLib.SingleEvent.instant().async(()=>{let t=this.ƀiu;if(t)return t.close().tap(()=>{t===this.ƀiu&&(this.ƀiu=void 0);})}).chain(this)}close(){return this.ƀbc?this.onDestroy():(this.ƀbc=true,this.ƀhz?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀiu?.close()??actionsLib.SingleEvent.instant(),this.ƀhy?.close()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀka(t){this.ƀhz=x.pause.toSequence().asyncDropOngoing(e=>e&&g.wait(rt).map(()=>e)).tap(e=>{if(e)this.ƀhy=gt.createByName(t,{fade:1,volume:this.ƀma}).attach(this),this.ƀhy.ƀlr(),this.ƀhy.fade(0);else if(this.ƀhy){let i=this.ƀhy;this.ƀhy.fade(1).tap(()=>i.destroy()).attach(this),this.ƀhy=void 0;}}).attach(this);}};var mi=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀip=new U__namespace.Graphics,this.ƀip.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀin.addChild(this.ƀip);}destroy(){this.destroyed||(super.destroy(),this.ƀip.destroy());}};var zt=class{static{h(this,"TextStyleConverter");}static getPixiTextStyle(t){let e={color:helpersLib.ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:false,...t},i=t?.dropShadow===true?{}:t?.dropShadow,s={};if(i){let r={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};s={dropShadow:{blur:r.blur,angle:r.angle.value,distance:r.distance,color:helpersLib.ColorHelper.rgbToHex(r.color),alpha:r.alpha}};}return helpersLib.JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:helpersLib.ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...s})}};var Fe=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),s=scriptEngineLib.RichTextSeparator.process(t,i),r=this.ƀfq(s,e),o=this.ƀs(r);return this.ƀkk(o)}static ƀfq(t,e){let i=new Map,s=new Map,r=h((a,l)=>{if(s.has(l))return s.get(l);let c=zt.getPixiTextStyle(a);return s.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀea(a.tags,e,i),p=r(l,c),f=U__namespace.CanvasTextMetrics.measureText(" ",new U__namespace.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:f.width}})}static ƀea(t,e,i){let s=t.join("+");if(i.has(s))return {style:i.get(s),cacheKey:s};let r=this.ƀbg(t,e);return i.set(s,r),{style:r,cacheKey:s}}static ƀbg(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:s,align:r,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((s,r)=>{s.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:s.cacheKey,style:s.style,pixiStyle:s.pixiStyle,spaceWidth:s.spaceWidth});});}),e.push(i),e}static ƀkk(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let s=i.flatMap(r=>this.ƀkl(r.text).map(a=>{let l=new U__namespace.TextStyle(r.pixiStyle),c=U__namespace.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:r.cacheKey,style:r.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:r.spaceWidth}}}));e.push(s);}),e}static ƀkl(t){if(t==="")return [""];let e=[],i="",s=t[0]===" ";for(let r=0;r<t.length;r++){let o=t[r],a=o===" ";a===s?i+=o:(e.push(i),i=o,s=a);}return i&&e.push(i),e}};var Le=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀcn.length===0}get remainingWidth(){return this.ƀmd-this.ƀcq}constructor(t,e){this.ƀmd=t,this.ƀgh=[],this.ƀcn=[],this.ƀcq=0,this.ƀgg=new helpersLib.Vector(0,0),this.ƀco=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfi=i.horizontalAlignment,this.ƀlu=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmd||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcr={direction:i.rectangleCutOption.direction,rectangle:this.ƀbt(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀco,t.y),i=this.ƀei(this.ƀgg.y,this.ƀgg.y+e);return this.ƀcq+t.x<=i}insertWord(t){let e=Math.max(this.ƀco,t.style.height);if(this.ƀcn.length===0){let i=this.ƀej(this.ƀgg.y,this.ƀgg.y+e);this.ƀgg=new helpersLib.Vector(i,this.ƀgg.y),this.ƀcq=this.ƀgg.x;}this.ƀcn.push({chunk:t,position:new helpersLib.Vector(this.ƀcq,this.ƀgg.y)}),this.ƀco=e,this.ƀcq+=t.style.width;}newLine(){let t=this.ƀgg.y+this.ƀco,e=this.ƀej(t,t);this.ƀdo(),this.ƀgg=new helpersLib.Vector(e,t),this.ƀcq=this.ƀgg.x,this.ƀco=0;}print(){return this.ƀdo(),this.ƀgh}ƀdo(){this.ƀcn.length>0&&(this.ƀgh.push(this.ƀg(this.ƀcn)),this.ƀcn=[]);}ƀg(t){return t=this.ƀlw(t),t=this.ƀfk(t),t}ƀfk(t){if(this.ƀfi==="left")return t;let e=this.ƀgg.y+this.ƀco,i=this.ƀej(this.ƀgg.y,e),r=this.ƀei(this.ƀgg.y,e)-i,o=Math.min(r,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfi==="center"?a=(r-o)/2:a=r-o,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀlw(t){let e=Math.max(...t.map(s=>s.chunk.style.ascent)),i=Math.max(...t.map(s=>s.chunk.style.descent));return t.map(s=>{let r;switch(this.ƀlu){case "top":r=i-s.chunk.style.descent;break;case "center":r=(i-s.chunk.style.descent+e-s.chunk.style.ascent)*.5;break;case "bottom":r=e-s.chunk.style.ascent;break;default:{this.ƀlu;throw new Error}}return s={chunk:s.chunk,position:new helpersLib.Vector(s.position.x,s.position.y+r)},s})}ƀej(t,e){return this.ƀcr&&(this.ƀcr.direction==="topLeft"||this.ƀcr.direction==="bottomLeft")&&(this.ƀcr.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcr.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcr.rectangle.bottomRight.x:0}ƀei(t,e){return this.ƀcr&&(this.ƀcr.direction==="topRight"||this.ƀcr.direction==="bottomRight")&&(this.ƀcr.rectangle.isPointInside(new helpersLib.Vector(this.ƀmd,t),{includeEdges:false})||this.ƀcr.rectangle.isPointInside(new helpersLib.Vector(this.ƀmd,e),{includeEdges:false}))?this.ƀcr.rectangle.topLeft.x:this.ƀmd}ƀbt(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new helpersLib.Rectangle(e,i)}};var He=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((s,r)=>{if(e.isSpaceAvailable(new helpersLib.Vector(s.style.width,s.style.height)))if(s.whitespace&&r===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(o.style.width+s.style.width,o.style.height))?e.insertWord(s):this.ƀme(s,e);}else e.insertWord(s);else e.lineIsEmpty?e.insertWord(s):s.whitespace?this.ƀme(s,e):(e.newLine(),e.insertWord(s));}),e.newLine();}),e.print()}static ƀme(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),s=Math.max(0,Math.min(i,t.text.length-1));if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let r=t.text.length-s-1;if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}}};var je=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgx(t),t=this.ƀll(t),this.ƀay(t)}static ƀgx(t){return t.map(e=>{let i=[],s,r=true;return e.forEach(o=>{if(!s||s.chunk.style.cacheKey!==o.chunk.style.cacheKey)s&&i.push(s),s=o,r=o.chunk.whitespace;else {let a=s.chunk.text+o.chunk.text;r=o.chunk.whitespace&&r,s={chunk:{text:a,whitespace:r,style:{...s.chunk.style,width:s.chunk.style.width+o.chunk.style.width}},position:s.position};}}),s&&i.push(s),i})}static ƀll(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let s=i.chunk.text.length,r=i.chunk.text.trimEnd();s!==r.length?e.push({chunk:{text:r,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(s-r.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀay(t){return t.flatMap(e=>e.map(i=>({text:i.chunk.text,style:i.chunk.style.style,position:i.position}))).filter(e=>e.text.trim()!=="")}};var fe=class{static{h(this,"RichTextToPlaneText");}static process(t,e){if(e.default.wordWrapWidth===void 0){if(e.default.align==="right"||e.default.align==="center")throw new Error("wordWrapWidth is required for right or center alignment");if(e.rectangleCut&&(e.rectangleCut.direction==="topRight"||e.rectangleCut.direction==="bottomRight"))throw new Error("wordWrapWidth is required for topRight or bottomRight rectangle cut")}let i=Fe.process(t,e),s=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),r=new Le(e.default.wordWrapWidth??1/0,s),o=He.wrapText(i,r);return je.process(o)}};var eo=1,lr=1/eo,de=class extends d{static{h(this,"Text");}get ƀle(){if(!this.ƀlf){let t=new U__namespace.TextStyle(this.ƀir);this.ƀlf=U__namespace.CanvasTextMetrics.measureText(this.ƀld,t);}return this.ƀlf}get ascent(){return this.ƀle.fontProperties.ascent}constructor(t,e){super(),this.ƀir=zt.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀiq.destroyed&&this.ƀiq.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀiq.anchor.x,this.ƀiq.anchor.y)}set anchor(t){this.ƀi=t,this.ƀiq.anchor.set(t.x,t.y),this.ƀje();}setText(t){return this.ƀld!==t&&(this.ƀld=t,this.ƀjb()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀir.fill!==e&&(this.ƀir.fill=e,this.ƀjb()),this}ƀjb(){this.ƀiq?.destroy(),this.ƀkx?.destroy(),this.ƀkx=void 0,this.ƀlf=void 0;let t=new U__namespace.TextStyle(this.ƀir);this.ƀiq=new U__namespace.Text({text:this.ƀld,style:t}),this.ƀi&&this.ƀiq.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀje(),this.ƀiq.scale.set(lr,lr),this.ƀin.addChild(this.ƀiq),this.ƀir.lineThrough&&(this.ƀkx=this.ƀe(this.ƀiq,this.ƀir.fill),this.ƀin.addChild(this.ƀkx));}ƀje(){let t=U__namespace.CanvasTextMetrics.measureText(this.ƀld,new U__namespace.TextStyle({...this.ƀir,dropShadow:false})),e=-this.ƀiq.anchor.x*t.width,i=-this.ƀiq.anchor.y*t.height;this.ƀiq.boundsArea=new U__namespace.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=U__namespace.CanvasTextMetrics.measureText(t.text,t.style),s=Math.max(1,Math.round(i.lineHeight*.07)),r=s%2*.5,o=new U__namespace.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=U__namespace.CanvasTextMetrics.measureText(l,t.style),f=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+r,y=0;t.style.align==="center"?y=0+(t.width-p.width)*.5:t.style.align==="right"&&(y=0+t.width-p.width),y=Math.floor(y),o.moveTo(Math.floor(y),f),o.lineTo(Math.floor(y+p.width),f),a+=p.lineHeight;}),o.stroke({width:s,color:e}),o}};var yi=class extends d{static{h(this,"RichText");}constructor(t,e){super(),fe.process(t,e).forEach(s=>new de(s.text,s.style).setPosition(s.position).displayParent(this).attach(this));}};var gi=class extends d{static{h(this,"UpdatableContainer");}},wi=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbz=t,this.ƀcw=new Map,this.ƀhu={trackBy:h((i,s)=>s,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcw.keys()),i=0;t.forEach((s,r)=>{let o=this.ƀhu.trackBy(s,r),a;this.ƀcw.has(o)?(a=this.ƀcw.get(o),e.delete(o),a.update(s)):(a=this.ƀbz(s).displayParent(this).attach(this),this.ƀcw.set(o,a)),this.ƀhu.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhu.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhu.positioning.spacing);}),e.forEach(s=>{this.ƀcw.get(s).destroy(),this.ƀcw.delete(s);});}};var me=class n extends d{static{h(this,"MenuUI");}static{this.ƀfw=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfw.notifier;}constructor(t,e){super(),this.ƀhm=new actionsLib.SingleAction,this.onCreate=this.ƀhm.notifier,this.ƀho=new actionsLib.SingleAction,this.onOpen=this.ƀho.notifier,this.ƀhj=new actionsLib.SingleAction,this.onClose=this.ƀhj.notifier,this.ƀbc=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new O(this,"alpha",{animation:b.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let s=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgv=et.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(o=>{s.aspectRatio=o.x/o.y,s.scale=Math.max(o.x,o.y),s.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀhm.resolve();let r=n.ƀfw.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀho.resolve(),r.destroy(),i.closeOnBackgroundClick&&s.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgv.getBoundingMask()}close(){if(!this.ƀbc){this.ƀbc=true;let t=n.ƀfw.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhj.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var vi=class extends It{static{h(this,"MenuEntity");}static subscribeIsOpen(){return actionsLib.ActionLib.merge(this.continuesSubscription().map(t=>t.type==="open"),actionsLib.SingleEvent.instant(this.getInstance()!==void 0))}constructor(t){super(),this.ƀhu=t,queueMicrotask(()=>{if(!this.ƀgw)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjd(t){this.ƀgw=t,this.ƀgw.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgw.onCreate.toSingleEvent()}onOpen(){return this.ƀgw.onOpen.toSingleEvent()}onClose(){return this.ƀgw.onClose.toSingleEvent()}close(){return this.ƀgw.close()}};var bi=class extends Z{static{h(this,"MenuView");}constructor(t,e,i){super();let s=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhu.closeOnBackgroundClick}),r=new me(e,s).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀjd(r);let o=new actionsLib.SingleAction;r.onCreate.subscribe(()=>o.resolve(r)).attach(this),this.onCreate=o.notifier,this.onOpen=r.onOpen.notifier,this.onClose=r.onClose.notifier;}};var lo=.65,co=.01,Ue=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjn}get contentSize(){return this.ƀbn.size.ceil()}constructor(t,e,i,s){this.ƀbn=t,this.ƀv=e,this.ƀhw=i,this.ƀke=s,this.ƀft=false,this.ƀjn=e-i*2,this.ƀbn.y=i,this.ƀky=i;}onWheel(t){this.setTarget(this.ƀky-t*lo);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀky=helpersLib.NumberHelper.clamp(t,this.ƀv-this.ƀhw-this.contentSize.y,this.ƀhw);}jumpToTarget(){this.ƀbn.y=this.ƀky;}update(t){let e=this.contentSize;if(e.y<=this.ƀjn){switch(this.ƀke){case "start":this.ƀky=this.ƀhw;break;case "center":this.ƀky=(this.ƀv-e.y)*.5;break;case "end":this.ƀky=this.ƀv-e.y-this.ƀhw;break;default:{this.ƀke;throw new Error}}this.ƀft||(this.ƀbn.y=this.ƀky);}this.ƀft=true;let i=this.ƀky-this.ƀbn.y;this.ƀbn.y=this.ƀbn.y+i*co*t;}};var uo=15,Pi=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbo}get contentSize(){return this.ƀjo.contentSize}constructor(t,e={}){super();let i={padding:uo,smallContentAlign:"start",...e};if(i.padding<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(i.padding>t.y*.5)throw new Error("The padding of the scroll mask cannot be higher than half of the size of the area");let s=new d().displayParent(this).attach(this);new Mt(s,t,i.padding).attach(this);let r=new U__namespace.Graphics;r.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),s.ƀin.addChild(r);let o=new d().displayParent(s).attach(this);this.ƀjo=new Ue(o,t.y,i.padding,i.smallContentAlign),this.ƀbo=new helpersLib.Vector(t.x,this.ƀjo.scrollHeight),r.eventMode="dynamic",r.addEventListener("wheel",a=>{this.ƀjo.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀin.addEventListener("wheel",a=>{this.ƀjo.onWheel(a.deltaY);}),g.afterSceneUpdateAction.subscribe(a=>this.ƀjo.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀjo.scrollToTop(),t?.instant&&this.ƀjo.jumpToTarget();}scrollToBottom(t){this.ƀjo.scrollToBottom(),t?.instant&&this.ƀjo.jumpToTarget();}};var fo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},F=class extends It{static{h(this,"CameraEntity");}constructor(){super(...arguments),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.offset=new actionsLib.Variable(helpersLib.Vector.zero),this.targetPosition=new actionsLib.Variable(void 0),this.focusingNewTargetInfo=new actionsLib.Variable(void 0);}};F=fo([Rt()],F);var mo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},yo=1500,ke=class{static{h(this,"CameraService");}createCamera(){return new F().attachToRoot()}getCameraPosition(){let t=F.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=F.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=F.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??yo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=F.getInstanceOrFail(),s=i.targetPosition.value;s&&(i.focusingNewTargetInfo.value?this.ƀga(i,s,t):i.position.value=s);}ƀga(t,e,i){let s=t.focusingNewTargetInfo.value;if(s.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbh(t,e);else {let r=(i-s.time)/s.duration;if(r>=1)this.ƀbh(t,e);else {let o;s.focusingAnimation===exports.FocusingAnimation.EaseInOut?o=W.easeInOut(r):s.focusingAnimation===exports.FocusingAnimation.EaseOut?o=W.easeOut(r):o=1;let a=s.position.lerp(e,o);s.roundPosition&&(Math.abs(a.x-s.position.x)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-s.position.y)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbh(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};ke=mo([u()],ke);var go=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},wo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ei=class{static{h(this,"CameraController");}constructor(t){this.ƀau=t;}createCamera(){return this.ƀau.createCamera().id}update(t,e){this.ƀau.update(t,e);}setPosition(t){this.ƀau.setPosition(t);}setTransition(t){this.ƀau.setTransition(t);}getCameraPosition(){return this.ƀau.getCameraPosition()}};Ei=go([lt(exports.CameraGateway),wo("design:paramtypes",[ke])],Ei);var ze=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let s=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(s)}else return t}};var vo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},bo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},_t=class extends Z{static{h(this,"CameraView");}constructor(t){super(),this.ƀdf=t,this.ƀkn=(()=>{let e=new d().attach(this);return e.ƀin=x.instance.ƀim.stage,e})(),this.ƀji=new d().setAlpha(0).displayParent(this.ƀkn).attach(this),this.ƀaf=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀkn).attach(this),this.ƀac=new d().displayParent(this.ƀji).attach(this),this.ƀat=new d().displayParent(this.ƀji).attach(this),this.ƀdr=new d().setSortableChildren(true).displayParent(this.ƀji).attach(this),this.ƀas=new d().setSortableChildren(true).displayParent(this.ƀat).attach(this),this.ƀdq=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀas).attach(this),this.ƀgn=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀas).attach(this),this.ƀab=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀas).attach(this),this.ƀh=new O(this.ƀji,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀag=new O(this.ƀaf,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),x.instance.screenSize.subscribe(e=>{this.ƀaf.aspectRatio=e.x/e.y,this.ƀaf.scale=Math.max(e.x,e.y),this.ƀaf.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdf.position.subscribe(e=>{this.ƀas.position=this.ƀbu(e);}).attach(this),this.ƀdf.offset.subscribe(e=>{this.ƀat.position=e;}).attach(this),this.ƀag.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=ze.includeScaleInScreenPosition(t,this.ƀkn.scale,x.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀas.position.x-this.ƀat.position.x,e.y-this.ƀas.position.y-this.ƀat.position.y)}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀgn.id,foreground:this.ƀdq.id,foregroundScreen:this.ƀdr.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀag.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().async(()=>i>0&&g.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀag.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().async(()=>i>0&&g.wait(i),"tap").async(()=>this.ƀag.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀag.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error}}}ƀbu(t){return helpersLib.Vector.fromTo(t,x.instance.screenSizeCenter.value)}};_t=vo([oi({entity:F}),bo("design:paramtypes",[F])],_t);var So=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ri=class{static{h(this,"CameraViewController");}getLayers(){let t=F.getInstanceOrFail().id;return _t.getInstanceOrFail(t).getLayers()}appear(t,e,i){let s=F.getInstanceOrFail().id;return _t.getInstanceOrFail(s).appear(t,e,i)}screenPositonToStagePosition(t){let e=F.getInstanceOrFail().id;return _t.getInstanceOrFail(e).screenPositonToStagePosition(t)}};Ri=So([lt(Gt)],Ri);var Eo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},To=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.KeyboardService=class Ii{static{h(this,"KeyboardService");}constructor(){this.ƀgc=new actionsLib.Action,this.keyPressed=this.ƀgc.notifier,this.ƀgd=new actionsLib.Action,this.keyReleased=this.ƀgd.notifier,this.ƀgj=new Set,this.ƀgi=new Set,window.addEventListener("keydown",t=>{this.ƀgj.add(t.code),this.ƀgi.add(t.code),!t.repeat&&this.ƀgc.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgj.delete(t.code),this.ƀgd.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgj.clear();}),g.afterSceneUpdateAction.subscribe(()=>this.ƀgi.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgi:this.ƀgj).has(t)}};exports.KeyboardService=Eo([u(),To("design:paramtypes",[])],exports.KeyboardService);var Ro=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Io=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseService=class we{static{h(this,"MouseService");}constructor(){this.ƀfs=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀfs.notifier,this.ƀko=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀko.notifier,this.ƀjk=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjk.notifier,this.ƀgm=new actionsLib.Variable(false),this.mainButtonState=this.ƀgm.notifier,this.ƀjp=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀjp.notifier,this.ƀkq(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgm.value=true:t.button===2&&(this.ƀjp.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgm.value=false:t.button===2&&(this.ƀjp.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgm.value=false,this.ƀjp.value=false;},{capture:true});}ƀkq(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfs.value=true;},{capture:true}),g.beforeSceneUpdateAction.subscribe(()=>{this.ƀjk.value=this.ƀbb(t);}).attachToRoot(),g.afterSceneUpdateAction.subscribe(()=>{this.ƀko.value=x.camera.screenPositonToStagePosition(this.ƀjk.value);}).attachToRoot();}ƀbb(t){let i=x.instance.renderer.canvas.getBoundingClientRect(),s=i.width,r=i.height;if(s<=0||r<=0)return helpersLib.Vector.zero;let o=x.instance.renderer.screen,a=(t.x-i.left)/s*o.width,l=(t.y-i.top)/r*o.height;return a=helpersLib.NumberHelper.clamp(a,0,o.width),l=helpersLib.NumberHelper.clamp(l,0,o.height),new helpersLib.Vector(a,l)}};exports.MouseService=Ro([u(),Io("design:paramtypes",[])],exports.MouseService);var Co=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ao=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseTargetFocusService=class Ci{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdp}get lastFocusedPosition(){return this.ƀgf}constructor(t){this.ƀha=t,this.ƀhq=new actionsLib.Action,this.onTargetFocus=this.ƀhq.notifier,this.ƀlj=0,this.ƀlk=false,this.ƀdp=false,this.ƀgf=void 0,g.beforeSceneUpdateAction.subscribe(e=>this.ƀln(e.delta)).attachToRoot();}ƀln(t){if(this.ƀhb){let e=this.ƀeo(this.ƀha.stagePosition.value,this.ƀhb);this.ƀib===void 0?this.ƀib=e:this.ƀax(e,t);}this.ƀhb=this.ƀha.stagePosition.value;}ƀax(t,e){this.ƀib-t>10?(this.ƀlj=Math.max(250,this.ƀlj),this.ƀlk=true):this.ƀlj>1e3&&(this.ƀlk=true);let i=this.ƀlj>=300&&this.ƀlk;this.ƀgb(i,t,e);}ƀgb(t,e,i){(t||e>this.ƀib)&&(this.ƀib=e),t?(this.ƀlk=false,this.ƀlj=0,this.ƀdp=true,this.ƀgf=this.ƀha.stagePosition.value,this.ƀhq.trigger(this.ƀgf)):(this.ƀlj+=i,this.ƀdp=false);}ƀeo(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Co([u(),Ao("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Ai=10.8,Oi=10.01;exports.PhysicsShapeType=void 0;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var m=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,s){return (t&s)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(s=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,s.collisionGroup,s.collisionMask)))}static cloneP2Body(t){let e=new X__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var wt="border";var _o=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.PhysicsGateway=class xe extends ht(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=_o([u()],exports.PhysicsGateway);var Vo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},xt=class extends ht(){static{h(this,"PhysicsInternalGateway");}};xt=Vo([u()],xt);var S=class n extends Q{static{h(this,"PhysicsEntity");}static{this.ƀhv=new Map;}static{this.ƀif=new Map;}static getFromP2BodyID(t){return n.ƀhv.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀhv.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀif.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀif.values())}get area(){return this.ƀu}get mass(){return this.ƀgq}get collisions(){return this.ƀbd}constructor(t,e,i){super(),this.ƀhk=new actionsLib.Action,this.onCollision=this.ƀhk.notifier,this.type="dynamic",this.ƀu=0,this.ƀgq=0,this.ƀbd=[],this.physicsWorldID=t,this.ƀih=E.get(xt);let s=this.ƀih.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),r=this.ƀih.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀig=this.ƀih.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀii=this.ƀih.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀih.createBody(this.physicsWorldID,e,s,r,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgq=this.p2Body.mass,this.p2Body.position=m.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀih.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀhv.set(this.p2Body.id,this),n.ƀif.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀih.removeBody(this.physicsWorldID,this.p2Body),n.ƀhv.delete(this.p2Body.id),n.ƀif.delete(this.id));}canCollideWith(t){return m.arePhysicsGroupsCollidable(this.ƀig,this.ƀii,t.ƀig,t.ƀii)}ƀjr(t){this.ƀbd=t,t.length>0&&this.ƀhk.trigger(t);}};var ve=class extends S{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=m.arrayToVector(this.p2Body.position),this.rotation=new helpersLib.Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:helpersLib.Vector.zero,rotationalSpeed:0}}};var Mi=class extends Q{static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),g.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀku(t,e);}).attach(this);}ƀku(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new helpersLib.Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Di=class extends S{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),this.ƀfl=false,this.ƀfm=false,this.ƀfo=false,this.ƀfn=false,this.ƀic(),this.ƀgk(),E.get(xt).subscribeToPhysicsStep(t,({time:i,delta:s})=>this.ƀku(i,s)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀku(t,e){this.ƀfl=true,this.ƀfm=true,this.ƀfo=true,this.ƀfn=true,this.ƀic();}ƀic(){this.position.value=m.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=m.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgk(){this.position.subscribe(t=>{this.ƀfl?this.ƀfl=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfm?this.ƀfm=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfn?this.ƀfn=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Ho=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},P=class extends Q{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,s,r,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new actionsLib.Variable(false),this.lastP2Time=new actionsLib.Variable(0),this.onPhysicsStep=new actionsLib.Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=s,this.materialDefinitions=r,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};P=Ho([Rt(),jo("design:paramtypes",[helpersLib.Vector,Boolean,X__default.default.World,Map,Map,Map,Map])],P);var ko=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},st=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,s=new Map;return t.map((r,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(r,1<<o),s.set(r,0);}),e.map(([r,o])=>{if(!i.has(r))throw new Error(`Physics body group "${r}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=s.get(r),l=s.get(o),c=i.get(r),p=i.get(o);s.set(r,a|p),s.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:s}}getGroupConstant(t,e){return P.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return P.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let s=t.physicsBodyGroupToP2Group.get(e),r=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (r&o)!==0&&(a&s)!==0}};st=ko([u()],st);var zo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Jo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀie=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((s,r)=>{s.forEach((o,a)=>{this.ƀie.canCollide(t,a,e)&&i.push({grid:o,cellSize:r});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,s){let r=t.availabilityGridCache.get(e);r||(r=new Map,t.availabilityGridCache.set(e,r)),r.set(i,s);}clear(t){t.availabilityGridCache.clear();}};Xe=zo([u(),Jo("design:paramtypes",[st])],Xe);var Yo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Xo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},vt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀie=t,this.ƀz=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let s=m.aabbToBoundingBox(e.aabb);this.ƀz.getCollidableGrids(t,i).forEach(r=>{let o=_.areaToGridArea(s,r.cellSize);r.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,s=50){return e.aabbNeedsUpdate=true,e.updateAABB(),ne.findByConvertingGridSpace(this.getAvilabilityGrid(t,s,i),m.aabbToBoundingBox(e.aabb),s)}getAvilabilityGrid(t,e,i){let s=this.ƀz.get(t,e,i);return s||(s=this.ƀcc(t,e,i),this.ƀz.set(t,e,i,s)),s}ƀcc(t,e,i){let s=new helpersLib.Grid({size:new helpersLib.Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(r=>{let o=S.getFromP2BodyIDOrFail(r.id);if(o.includeInPathfinding&&this.ƀie.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀeg(r,e);s.setArea(a,false);}}),s}ƀeg(t,e){let i=m.aabbToBoundingBox(t.aabb);return _.areaToGridArea(i,e)}};vt=Yo([u(),Xo("design:paramtypes",[st,Xe])],vt);var Qo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},qo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Kt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀid=t;}findPathAStar(t,e,i,s,r){r||(r={}),r.neighborType===void 0&&(r.neighborType="orthogonal"),r.gridCellSize===void 0&&(r.gridCellSize=50);let o=P.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=S.getPhysicsInstanceOrFail(i).p2Body,a=m.arrayToVector(l.position)):a=i;let c=_.positionToGridPosition(e,r.gridCellSize),p=_.positionToGridPosition(a,r.gridCellSize),f=this.ƀid.getAvilabilityGrid(o,r.gridCellSize,s);if(l){let v=m.aabbToBoundingBox(l.aabb),w=_.areaToGridArea(v,r.gridCellSize);f.setArea(w,true);}let y=ae.findPath(f,c,p,r.neighborType);return y.path=y.path.map(v=>_.gridPositionToPosition(v,r.gridCellSize)),y}findPathDirection(t,e,i,s,r=50){let o=P.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let y=S.getPhysicsInstanceOrFail(i);a=m.aabbToBoundingBox(y.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=_.areaToGridArea(a,r),c=JSON.stringify({targetGridArea:l,collidableWithGroup:s}),p=o.vectorFieldCache.get(c);if(!p){let y=this.ƀid.getAvilabilityGrid(o,r,s);p=new he(l,y),o.vectorFieldCache.set(c,p);}let f=_.positionToGridPosition(e,r);return p.getDirectionToTarget(f)}};Kt=Qo([u(),qo("design:paramtypes",[vt])],Kt);var en=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},rn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},nt=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀaa=t,this.ƀhx=e;}printPathfindingTestGrid(t,e,i,s,r,o){let a=P.getInstanceByIDOrFail(t);this.ƀaa.getAvilabilityGrid(a,o,s).map((c,p)=>({position:_.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(r)){let p=this.ƀhx.findPathDirection(t,c.position,i,s),f;p===void 0?f=A.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):f=A.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new O(f,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>f.destroy()).attach(f);}});}createExplosionDebugVisual(t,e,i,s,r,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);A.createCircle(r,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(s,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(s,c.line.to,p).toSprite().displayParent(a).attach(t);}),new O(a,"alpha",{duration:o,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,s,r,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);A.createElipse(o,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attach(t),i.forEach(p=>{let f=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(p.line.from,p.line.to,f).toSprite().displayParent(l).attach(t);}),new O(l,"alpha",{duration:a,animation:b.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let s=i?.overridePosition??m.arrayToVector(t.position),r=i?.overrideRotation??new helpersLib.Radian(t.angle),o=i?.color??helpersLib.ColorHelper.blue,a=new d().displayParent(e).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcy(c,o).displayParent(a).attachToRoot();}),new O(a,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcy(t,e){switch(t.type){case X__default.default.Shape.PARTICLE:throw new Error("Not implemented");case X__default.default.Shape.LINE:throw new Error("Not implemented");case X__default.default.Shape.PLANE:throw new Error("Not implemented");case X__default.default.Shape.CIRCLE:throw new Error("Not implemented");case X__default.default.Shape.CAPSULE:throw new Error("Not implemented");case X__default.default.Shape.BOX:throw new Error("Not implemented");case X__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case X__default.default.Shape.CONVEX:return this.ƀcx(t,e);default:{t.type;throw new Error}}}ƀcx(t,e){let i=[t.vertices.map(s=>({x:s[0],y:s[1]}))];return A.createPolygon(i,e).toSprite()}};nt=en([u(),rn("design:paramtypes",[vt,Kt])],nt);var nn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},an=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ke=class{static{h(this,"HitTestService");}constructor(t){this.ƀlc=t;}hitTest(t,e){let i=t.world,s=S.getFromP2BodyIDOrFail(t.id),r=m.cloneP2Body(t);this.ƀt(r,e);let o=i.broadphase.aabbQuery(i,this.ƀdu(r)).map(l=>S.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>s.canCollideWith(l)).map(l=>m.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new X__default.default.World;l.addBody(r),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===r||c.bodyB===r),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀlc.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=m.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdu(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Ke=nn([u(),an("design:paramtypes",[nt])],Ke);var ln=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ze=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀjc(t,i);});});}step(t,e,i){S.getPhysicsEntities().forEach(s=>{s.ƀbd=[];}),t.p2World.narrowphase.contactEquations.forEach(s=>{this.ƀjc(t,s);}),t.bodiesInContactWith.forEach((s,r)=>{this.ƀfb(s.p2Body),s.entity.ƀjr(t.collisionReports.get(r)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfb(t){let e=m.arrayToVector(t.velocity);e.length>Ai&&(e=e.normalize(Ai),t.velocity=m.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Oi),Oi);}ƀjc(t,e){let i=S.getFromP2BodyID(e.bodyA.id),s=S.getFromP2BodyID(e.bodyB.id);if(i&&s){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:s});let r=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdz(i,s,e);r.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,r),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdz(t,e,i){let s=t.convertToDTO(),r=e.convertToDTO(),o=m.arrayToVector(i.contactPointA),a=m.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀem(i);return {collisionDetailsA:this.ƀdy(s,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀdy(r,i.bodyB.mass,a,c,e.area)}}ƀdy(t,e,i,s,r){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:r,normal:s}}ƀem(t){let e=m.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ze=ln([u()],Ze);var cn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Qe=class extends ve{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};Qe=cn([Rt(),pn("design:paramtypes",[Number,Object])],Qe);var un=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Y=1e4,qe=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbw(t,new helpersLib.Vector(e.x/2,-Y/2),new helpersLib.Vector(e.x+Y*2,Y),i),this.ƀbw(t,new helpersLib.Vector(e.x/2,e.y+Y/2),new helpersLib.Vector(e.x+Y*2,Y),i),this.ƀbw(t,new helpersLib.Vector(-Y/2,e.y/2),new helpersLib.Vector(Y,e.y+Y*2),i),this.ƀbw(t,new helpersLib.Vector(e.x+Y/2,e.y/2),new helpersLib.Vector(Y,e.y+Y*2),i);}ƀbw(t,e,i,s){return new Qe(t,{shapeDefinition:{materialName:wt,group:s,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};qe=un([u()],qe);var dn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},br=new X__default.default.Material,mn={id:wt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Zt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,s){let r=new Map,o=new Map;if(i.forEach(a=>{r.set(a.id,new X__default.default.Material),o.set(a.id,a);}),r.has(wt))throw new Error(`Material with name ${wt} cannot be defined, pick another name for the material.`);return r.set(wt,br),o.set(wt,mn),this.ƀc(t,e,i,s,r),{materials:r,materialDefinitions:o}}getMaterial(t,e){let i=P.getInstanceByIDOrFail(t);return this.ƀel(e,i.materials)}getMaterialDefinition(t,e){let i=P.getInstanceByIDOrFail(t);return this.ƀek(e,i.materialDefinitions)}ƀel(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀek(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material definition with name ${t}.`);return i}ƀc(t,e,i,s,r){this.ƀed(i.map(o=>o.id),s).forEach(o=>{let a=this.ƀel(o.materialA,r),l=this.ƀel(o.materialB,r);t.addContactMaterial(new X__default.default.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,r);}ƀed(t,e){let i=new Map;e.forEach(r=>{let o=i.get(r.materialA);o||(o=new Map,i.set(r.materialA,o)),o.set(r.materialB,r);});let s=[];return t.forEach((r,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(r)?.get(l);c?s.push(c):s.push({materialA:r,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),s}ƀd(t,e,i,s){i.forEach(r=>{let o=this.ƀel(r.id,s);t.addContactMaterial(new X__default.default.ContactMaterial(o,br,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Zt=dn([u()],Zt);var yn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},gn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Qt=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,s,r){this.ƀgu=t,this.ƀak=e,this.ƀaa=i,this.ƀbe=s,this.ƀie=r;}createPhysicsWorld(t){let e=new X__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:s}=this.ƀgu.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:r,physicsBodyGroupToP2Mask:o}=this.ƀie.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new P(t.mapSize,t.modifyUpdateCycle,e,i,s,r,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&g.cleanUpdateModifier();}).attachToRoot(),this.ƀak.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbe.registerPhysicsWorld(a),t.modifyUpdateCycle?g.registerUpdateModifier((l,c)=>this.ƀku(a,l,c)):g.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀku(a,l,c);}).attach(a),a.id}addBody(t,e,i,s,r){let o=P.getInstanceByIDOrFail(t);if(i){let a=this.ƀaa.findClosestAvailableSpace(o,e,s);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),r&&this.ƀaa.onBodyAdded(o,e,s),true):false}else return o.p2World.addBody(e),r&&this.ƀaa.onBodyAdded(o,e,s),true}removeBody(t,e){P.getInstanceByID(t)?.p2World.removeBody(e);}ƀku(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let s=e+i;this.ƀbe.step(t,s,i),t.onPhysicsStep.trigger({time:s,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){P.getInstanceByIDOrFail(e).paused.set(t);}};Qt=yn([u(),gn("design:paramtypes",[Zt,qe,vt,Ze,st])],Qt);var xn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},te=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let s=new X__default.default.RaycastResult,r=new X__default.default.Ray({mode:X__default.default.Ray.CLOSEST,from:m.vectorToArray(e.from),to:m.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(s,r),s.hasHit())return this.ƀbr(s,e)}castAllFirstContacts(t,e,i){let s=new Map,r=new X__default.default.Ray({mode:X__default.default.Ray.ALL,from:m.vectorToArray(e.from),to:m.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=s.get(o.body);!s.has(o.body)||o.fraction<a.fraction?s.set(o.body,this.ƀbr(o,e)):o.fraction===a.fraction&&a.isExternal()&&s.set(o.body,this.ƀbr(o,e));},"callback")});return t.p2World.raycast(new X__default.default.RaycastResult,r),Array.from(s.values())}ƀbr(t,e){let i=t.fraction,s=m.arrayToVector(t.normal),r,o,a;return {body:t.body,hitPosition:h(()=>(r===void 0&&(r=e.from.lerp(e.to,i)),r),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(s)<0),a),"isExternal"),normal:s,fraction:i,line:e}}};te=xn([u()],te);var vn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},St=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,s){let r=i.normalize(s),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(m.vectorToArray(r),o);}};St=vn([u()],St);var bn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ee=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(s=>{s.hits.forEach(r=>{let o=i.get(r.body);if(o){let a=r.fraction<o.closestRaycastHit.fraction?r:o.closestRaycastHit;o.rayCastHits.push(r),i.set(r.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&r.isExternal(),explosionCenter:r.line.from});}else {let a=r.isExternal();i.set(r.body,{hitCount:1,closestRaycastHit:r,rayCastHits:[r],isExternal:a,explosionCenter:r.line.from});}});}),[...i.values()].map(s=>this.ƀbs(s,t.length))}ƀbs(t,e){let i=t.hitCount/e,s=t.rayCastHits;if(t.isExternal)return {body:S.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:s,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let r=m.arrayToVector(t.closestRaycastHit.body.position);return {body:S.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(r,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:s,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};ee=bn([u()],ee);var Sn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},En=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},In=15,ei=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,s){this.ƀiy=t,this.ƀlc=e,this.ƀix=i,this.ƀfp=s;}createElipticExplosion(t,e,i,s,r,o,a){let l=P.getInstanceByIDOrFail(t),c=this.ƀch(e,i,s,r,a?.hitOnlyClosest===true,l),p=this.ƀix.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀlc.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,s,a.debugRayDuration),p.map(f=>{let{p2Body:y,...v}=f;return v})}ƀch(t,e,i,s,r,o){let a=[],l=e.vector,c=e.add(helpersLib.Radian.get90).vector,p=c.normalize(i.x);a.push(new helpersLib.Line(t,t.add(p))),a.push(new helpersLib.Line(t,t.add(p.multiplyNumber(-1))));let f=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(f))),a.push(new helpersLib.Line(t,t.add(f.multiplyNumber(-1))));let y=Math.round(i.y/In),v=i.y/(y*2+1)*2,w=l.normalize(v),M=i.x,L=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(y).forEach(R=>{let K=v*(R+1),Vt=w.multiplyNumber(R+1),$=c.normalize(this.ƀet(M,L,K)),H=t.add(Vt);a.push(new helpersLib.Line(H,H.add($))),a.push(new helpersLib.Line(H,H.add($.multiplyNumber(-1))));let j=t.add(Vt.multiplyNumber(-1));a.push(new helpersLib.Line(j,j.add($))),a.push(new helpersLib.Line(j,j.add($.multiplyNumber(-1))));}),a.map(R=>{if(r){let K=this.ƀiy.castClosest(o,R,s);return {line:R,hits:K?[K]:[]}}else {let K=this.ƀiy.castAllFirstContacts(o,R,s);return {line:R,hits:K}}})}ƀet(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(s=>{let r,o;s.isExternal()?(r=s.line.fromTo,o=e*2):(r=s.line.fromTo.multiplyNumber(-1),o=e*(1-s.fraction)*8),this.ƀfp.applyImpulse(s.body,s.hitPosition(),r,o);});});}};ei=Sn([u(),En("design:paramtypes",[te,nt,ee,St])],ei);var Cn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},An=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ii=class{static{h(this,"ExplosionService");}constructor(t,e,i,s){this.ƀiy=t,this.ƀlc=e,this.ƀix=i,this.ƀfp=s;}createExplosion(t,e,i,s,r,o){let a=P.getInstanceByIDOrFail(t),l=this.ƀer(i),c=this.ƀch(e,i,s,l,o?.hitOnlyClosest===true,a),p=this.ƀix.toExplosionHits(c);return this.ƀr(e,i,r,l,p),o?.testLayerID&&this.ƀlc.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀch(t,e,i,s,r,o){let a=new helpersLib.Radian(helpersLib.PI_360/s),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(s).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(r){let f=this.ƀiy.castClosest(o,p,i);return {line:p,hits:f?[f]:[]}}else {let f=this.ƀiy.castAllFirstContacts(o,p,i);return {line:p,hits:f}}})}ƀr(t,e,i,s,r){r.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfp.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,m.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*s*l/2;this.ƀfp.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀer(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};ii=Cn([u(),An("design:paramtypes",[te,nt,ee,St])],ii);var Gn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ie=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=P.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return P.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};ie=Gn([u()],ie);var _n=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Vn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Bi=class{static{h(this,"PhysicsController");}constructor(t,e,i,s,r,o,a,l){this.ƀil=t,this.ƀhx=e,this.ƀlc=i,this.ƀdj=s,this.ƀdc=r,this.ƀfh=o,this.ƀik=a,this.ƀfp=l;}createPhysicsWorld(t){return this.ƀil.createPhysicsWorld(t)}getMapSize(t){return this.ƀik.getMapSize(t)}setPaused(t,e){this.ƀil.setPaused(t,e);}hitTest(t,e){let i=S.getPhysicsInstanceOrFail(t);return this.ƀfh.hitTest(i.p2Body,e)}findPath(t,e,i,s,r){return this.ƀhx.findPathAStar(t,e,i,s,{neighborType:r})}findPathDirection(t,e,i,s){return this.ƀhx.findPathDirection(t,e,i,s)}applyImpulse(t,e,i,s){let r=S.getPhysicsInstanceOrFail(t);this.ƀfp.applyImpulse(r.p2Body,e,i,s);}createExplosion(t,e,i,s,r,o){return this.ƀdj.createExplosion(t,e,i,s,r,o)}createElipticExplosion(t,e,i,s,r,o,a){return this.ƀdc.createElipticExplosion(t,e,i,s,r,o,a)}printPathfindingTestGrid(t,e,i,s,r,o=50){this.ƀlc.printPathfindingTestGrid(t,e,i,s,r,o);}};Bi=_n([lt(exports.PhysicsGateway),Vn("design:paramtypes",[Qt,Kt,nt,ii,ei,Ke,ie,St])],Bi);var Nn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ri=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,s,r){let o=P.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case exports.PhysicsShapeType.Point:return this.ƀby(o,void 0,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Circle:return this.ƀby(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Polygon:return this.ƀcg(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Rectangle:return this.ƀci(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀby(t,e,i,s,r,o){let a=new X__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r),radius:e});a.material=i;let l=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:s.density,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return l.addShape(a),l}ƀcg(t,e,i,s,r,o){let a=t.physicsBodyGroupToP2Group.get(r),l=t.physicsBodyGroupToP2Mask.get(r),c=e.map(y=>new X__default.default.Convex({vertices:y.map(v=>[v.x,v.y]),collisionGroup:a,collisionMask:l})).map(y=>(y.material=i,y)),p=c.reduce((y,v)=>y+v.area,0),f=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:p,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.forEach(y=>f.addShape(y)),f.setDensity(s.density),f}ƀci(t,e,i,s,r,o){let a=new X__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r)});a.material=i;let l=e.x*e.y,c=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:l,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.addShape(a),c.setDensity(s.density),c}};ri=Nn([u()],ri);var Fn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ln=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Gi=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,s,r){this.ƀil=t,this.ƀij=e,this.ƀkb=i,this.ƀik=s,this.ƀie=r;}createBody(t,e,i,s,r){return this.ƀkb.createBody(t,e,i,s,r)}getMaterial(t,e){return this.ƀij.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀij.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀie.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀie.getMaskConstant(t,e)}addBody(t,e,i,s,r){return this.ƀil.addBody(t,e,i,s,r)}removeBody(t,e){this.ƀil.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀik.subscribeToPhysicsStep(t,e)}};Gi=Fn([lt(xt),Ln("design:paramtypes",[Qt,Zt,ri,ie,st])],Gi);exports.AdvancedSound=gt;exports.AnimationFlicker=Fi;exports.AnimationInterpolationFunctions=W;exports.Animations=b;exports.Animator=O;exports.BORDER_MATERIAL_NAME=wt;exports.BardLegendsHardReset=I;exports.Camera=le;exports.ClosestAvailableSpaceHelper=ne;exports.Container=d;exports.ControllerDecorator=lt;exports.DEFAULT_SHADER_RESOLUTION=k;exports.DeltaTime=pi;exports.DisplayObjectArray=wi;exports.Entity=Q;exports.EntityDecorator=Rt;exports.FadeInContent=zi;exports.Game=x;exports.Gateway=ht;exports.Graphics=A;exports.ImmovablePhysicsEntity=ve;exports.MenuEntity=vi;exports.MenuUI=me;exports.MenuView=bi;exports.MovableEntity=Mi;exports.MovablePhysicsEntity=Di;exports.Music=pe;exports.MusicPlayer=di;exports.PathFinder=ae;exports.PhysicsEntity=S;exports.Placeholder=mi;exports.ROTATIONAL_SPEED_LIMIT=Oi;exports.RichText=yi;exports.SOUND_TRANSITION_DURATION=rt;exports.SPEED_LIMIT=Ai;exports.Scene=Nt;exports.SceneDecorator=_r;exports.ScrollAreaUI=Pi;exports.ScrollMaskUI=Mt;exports.Service=E;exports.ServiceDecorator=u;exports.SingletonEntity=It;exports.SlideInContent=Qi;exports.SlideInContentByIndex=ci;exports.SlideStateAnimation=De;exports.Sound=ce;exports.Sprite=et;exports.StateAnimation=jt;exports.Text=de;exports.ThroughEmptyStateAnimation=Re;exports.UpdatableContainer=gi;exports.UpdateCycle=g;exports.VectorFieldPathFinder=he;exports.VectorSet=oe;exports.View=Z;exports.ViewDecorator=oi;
|
|
45
|
+
}`,e}constructor(t,e){if(super({glProgram:W__namespace.GlProgram.from({vertex:W__namespace.defaultFilterVert,fragment:n.ƀed(t*k)}),resources:{expandUniforms:{uColor:{value:new Float32Array(3),type:"vec3<f32>"},uExpandSquared:{value:0,type:"f32"}}},resolution:k}),this.ƀdi=t,this.ƀdi=t*k,this.ƀdi<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀdi>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀdi)||(this.ƀdi=Math.floor(this.ƀdi));let i=helpersLib.ColorHelper.normalize(e);this.resources.expandUniforms.uniforms.uColor=new Float32Array([i.red,i.green,i.blue]),this.resources.expandUniforms.uniforms.uExpandSquared=this.ƀdi*this.ƀdi,this.padding=this.ƀdi;}};var Oe=class extends W__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super({resolution:k,compatibleRenderers:W__namespace.RendererType.WEBGL});let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,...t};this.ƀdj=new Ae(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀak=new Ft(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀak.blendMode="add";}apply(t,e,i,s){let r=W__namespace.TexturePool.getSameSizeTexture(e);this.ƀdj.apply(t,e,r,true),this.ƀak.apply(t,r,i,s),W__namespace.TexturePool.returnTexture(r);}};var re=class n{static{h(this,"GlowSpriteGenerator");}static{this.ƀew=new Map;}static createGlowSpriteFromSprite(t,e,i){let s=this.ƀbj(e),r=helpersLib.Comparator.isNumber(s.blurRadius)?new helpersLib.Vector(s.blurRadius,s.blurRadius):s.blurRadius,o=this.ƀef(t.texture,r,s.expand,s.color,i),a=new W__namespace.Sprite(o);return this.ƀjy(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(r.x,r.y)+s.expand),a.alpha=s.glowAlpha,a.blendMode=s.blendMode,a}static ƀef(t,e,i,s,r){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(r){let o=`${t.id}-${i}-${e.x}-${e.y}-${s.r}-${s.g}-${s.b}`;if(n.ƀew.has(o))return n.ƀew.get(o);{let a=this.ƀeg(t,e,i,s);return n.ƀew.set(o,a),a}}else return this.ƀeg(t,e,i,s)}static ƀeg(t,e,i,s){let r=new W__namespace.Sprite(t);r.filters=[new Oe({blurRadius:e,expand:i,color:s})];let o=new W__namespace.Container;o.addChild(r);let a=Math.max(e.x,e.y)+i,l=x.instance.generateTexture({target:o,frame:new W__namespace.Rectangle(-a,-a,r.width+a*2,r.height+a*2)});return l.id=G.insertAsset(l),o.destroy({children:true}),l}static ƀjy(t,e,i){let s=(i+(t.width-i*2)*e.x)/t.width,r=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(s,r);}static ƀbj(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:"add"};return t&&(e={...e,...t}),e}};T.onHardReset.subscribe(()=>{re.ƀew.clear();}).attachToRoot();var et=class n extends d{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new n(e)}static createSnapshotSprite(t){let e=t.ƀiq,i=e.parent;i&&i.removeChild(e);let s=x.instance.generateTexture({target:e,resolution:2,antialias:true,textureSourceOptions:{scaleMode:"linear"}});i&&i.addChild(e);let o={id:G.insertAsset(s),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new n(o,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀll=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀkr=t,this.pixiSprite=new W__namespace.Sprite(G.getAsset(t.id)),this.ƀiq.addChild(this.pixiSprite),this.setTextureScale(t.scale),e.textureSize&&(this.pixiSprite.width=e.textureSize.x,this.pixiSprite.height=e.textureSize.y),e.texturePosition&&this.pixiSprite.position.set(e.texturePosition.x,e.texturePosition.y),e.ignoreAnchor||this.pixiSprite.anchor.set(t.anchor.x,t.anchor.y);}destroy(){this.destroyed||(super.destroy(),this.ƀkr.destroyAssetOnDestroy&&(G.destroyAsset(this.ƀkr.id),this.ƀis&&G.destroyAsset(this.ƀis.texture.id)),this.ƀgr?.destroy(),this.ƀam?.destroy(),this.ƀis&&!this.ƀis.destroyed&&this.ƀis.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀll}set textureScale(t){this.ƀll=t,this.pixiSprite.scale.set(t);}get size(){return new helpersLib.Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀkr.boundingShapes&&!this.ƀiq.hitArea&&(this.ƀiq.hitArea=new ws(this.ƀkr.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀkr.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.source.autoGenerateMipmaps}set mipmap(t){this.pixiSprite.texture.source.autoGenerateMipmaps=t;}setBlendMode(t){return this.blendMode=t,this}get blendMode(){return this.pixiSprite.blendMode}set blendMode(t){this.pixiSprite.blendMode=t;}setTint(t){return this.tint=t,this}get tint(){return new W__namespace.Color(this.pixiSprite.tint).toRgb()}set tint(t){this.pixiSprite.tint=t;}setShapeAlpha(t){return this.pixiSprite.alpha=t,this}get shapeAlpha(){return this.pixiSprite.alpha}set shapeAlpha(t){this.pixiSprite.alpha=t;}setGlowAlpha(t){return this.glowAlpha=t,this}get glowAlpha(){if(this.ƀis)return this.ƀis.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀis)this.ƀis.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀkr.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀis&&(this.ƀis.destroy(),this.ƀis=void 0),t&&(this.ƀis=re.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀkr.destroyAssetOnDestroy),this.ƀis.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀis.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀiq.addChild(this.ƀis)),this}showBoundingShape(t){return t?this.ƀam||(this.ƀam=this.ƀby().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀam&&(this.ƀam.destroy(),this.ƀam=void 0),this}getBoundingMask(){if(!this.ƀgr){if(!this.ƀkr.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgr=this.ƀby(),this.ƀgr.displayParent(this);}return this.ƀgr}ƀby(){if(!this.ƀkr.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return A.createPolygon(this.ƀkr.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀiq);if(!t.toBlob)throw new Error("Sprite: canvas.toBlob is undefined!");return t.toBlob(e=>{if(!e)throw new Error("Sprite: blob is undefined!");let i=document.createElement("a");document.body.append(i),i.download="sprite.png",i.href=URL.createObjectURL(e),i.click(),i.remove();},"image/png"),this}},ws=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀkh=t.map(s=>new W__namespace.Polygon(s.map(r=>new W__namespace.Point(r.x,r.y))));}contains(t,e){return this.ƀkh.some(i=>i.contains(t,e))}};var Me=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let s=helpersLib.Vector.fromTo(t,e),r=s.normalize(),o=s.length-i.lineStartGap-i.lineEndGap,a=[];if(o<=0)return a;let l=t.add(r.normalize(i.lineStartGap));if(o<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(r.normalize(o))}),a;let c=o-i.dashGap,p=i.dashLength+i.dashGap,f=Math.floor(c/p),y=c-p*f;f>=1&&y<i.dashLength&&(y+=p,f--);let v=r.normalize(y/2),w=r.normalize(i.dashGap);if(a.push({from:l,to:l.add(v)}),l=l.add(v),f>0){let M=r.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(f).forEach(()=>{l=l.add(w),a.push({from:l,to:l.add(M)}),l=l.add(M);});}return l=l.add(w),a.push({from:l,to:l.add(v)}),a}};var A=class n extends d{static{h(this,"Graphics");}static{this.ƀda=new Map;}static createArrow(t,e){let i=new W__namespace.Graphics;return [[{x:0,y:-t/2},{x:t*3/8,y:-t/8},{x:t/4,y:0},{x:0,y:-t/4},{x:-t/4,y:0},{x:-t*3/8,y:-t/8}],[{x:0,y:-t/4},{x:t/8-t/30,y:-t/8-t/30},{x:t/8-t/30,y:t*7/16},{x:-t/8+t/30,y:t*7/16},{x:-t/8+t/30,y:-t/8-t/30}]].forEach(r=>{i.poly(r.map(o=>new W__namespace.Point(o.x,o.y))).fill(e);}),new n(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let s={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},r=new W__namespace.Graphics;return Me.getLines(t,e,s).forEach(a=>{r.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),r.stroke({width:s.width,color:s.color}),new n(r,JSON.stringify({type:"dashedLine",from:t,to:e,options:s}))}static createVector(t,e,i){let s=new W__namespace.Graphics;return s.moveTo(t.x,t.y),s.lineTo(e.x,e.y),s.stroke({width:2,color:i}),s.circle(t.x,t.y,3),s.fill(helpersLib.ColorHelper.white),s.stroke({width:1,color:i}),new n(s,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let s=new W__namespace.Graphics;return s.rect(0,0,t.x,e),s.rect(0,e,e,t.y-e*2),s.rect(t.x-e,e,e,t.y-e*2),s.rect(0,t.y-e,t.x,e),s.fill(i),new n(s,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new W__namespace.Graphics;return i.rect(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new W__namespace.Graphics;return i.circle(0,0,t).fill(e),new n(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new W__namespace.Graphics;return i.ellipse(0,0,t.x,t.y).fill(e),new n(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new W__namespace.Graphics,s=JSON.stringify({type:"polygon",polygon:t,color:e});return t.forEach(r=>{i.poly(r.map(o=>new W__namespace.Point(o.x,o.y))).fill(e);}),new n(i,s)}static createRegularPolygon(t,e,i){let s=new W__namespace.Graphics,r=new helpersLib.Radian(helpersLib.PI_360/t);s.moveTo(e,0);for(let o=1;o<=t;o++){let l=r.multiply(o).vector.normalize(e),c=e+l.x,p=e+l.y;s.lineTo(c,p);}return s.fill(i),new n(s,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀiq.addChild(t),this.pixiGraphics=t,this.ƀap=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀap,cache:false,...t},i=this.ƀes(e.cacheName,e.cache),s={id:i.textureID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},r=new et(s,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),r}ƀes(t,e){if(e){let i=n.ƀda.get(t);return i||(i=this.ƀck(),n.ƀda.set(t,i)),i}else return this.ƀck()}ƀck(){let t=x.instance.generateTexture(this.pixiGraphics);t.id=G.insertAsset(t);let e=this.pixiGraphics.getBounds();return {textureID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var li=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Ot=class n extends d{static{h(this,"ScrollMaskUI");}static{this.ƀda=new Map;}constructor(t,e,i,s=exports.ScrollDirection.Vertical){if(super(),i<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(e.y<i*2)throw new Error(`The height of the scroll mask cannot be lower than '${i*2}'`);let r=new d;s===exports.ScrollDirection.Horizontal?this.ƀce(e,i,r):this.ƀcl(e,i,r),this.ƀgr=et.createSnapshotSprite(r).attach(this),r.destroy(),t.setMask(this.ƀgr);}ƀcl(t,e,i){e>0&&this.ƀcb(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),A.createRectangle(new helpersLib.Vector(t.x,t.y-e*2),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(0,e),{round:false}).displayParent(i).attach(i),e>0&&this.ƀcb(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀce(t,e,i){e>0&&this.ƀcb(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),A.createRectangle(new helpersLib.Vector(t.x-e*2,t.y),helpersLib.ColorHelper.white).toSprite().setPosition(new helpersLib.Vector(e,0),{round:false}).displayParent(i).attach(i),e>0&&this.ƀcb(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀcb(t){let i={id:this.ƀcc(t.y),scale:1,size:t,anchor:{x:0,y:0}};return new et(i,{textureSize:t,ignoreAnchor:true})}ƀcc(t){let e=JSON.stringify({type:"gradient",length:t}),i=n.ƀda.get(e);if(!i){let s=document.createElement("canvas");s.width=1,s.height=t;let r=s.getContext("2d");if(r){let o=new li;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${o.multiplierFunction(l/t)})`;r.fillStyle=c,r.fillRect(0,l,1,1);});let a=W__namespace.Texture.from(s);i=G.insertAsset(a),n.ƀda.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(n){n[n.Appear=1]="Appear",n[n.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var De=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}onStateChange(t){return this.ƀhs.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀhu.subscribe(e=>t(e.value,e.index)).attach(this),this}get state(){return {value:this.ƀky.state.value,item:this.ƀft,nextItem:this.ƀhj,queuedItem:this.ƀky.state.queuedItem,animationState:this.ƀo}}constructor(t){super(),this.ƀo="idle",this.ƀhs=new actionsLib.Action,this.ƀhu=new actionsLib.Action,this.ƀhx={duration:500,animation:b.easeInOutCubic,...t},this.ƀky=new jt({duration:this.ƀhx.duration,animation:this.ƀhx.animation}).onStateChange((e,i)=>this.ƀez(e,i)).onValueChange(e=>this.ƀfe(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀft===void 0?(this.ƀft=t,this.ƀhs.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀky.setItem(t,e)):this.ƀft!==t?this.ƀhj!==t?this.ƀo==="idle"?(this.ƀo=t>this.ƀft?"transitionForward":"transitionBackward",this.ƀhj=t,this.ƀhs.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀhj}),this.ƀky.setItem(t,e)):this.ƀky.setItem(t,e):this.ƀo==="reverting"&&this.ƀhj===t&&(this.ƀo=t>this.ƀft?"transitionForward":"transitionBackward",this.ƀky.setItem(t,e)):(this.ƀo==="transitionForward"||this.ƀo==="transitionBackward")&&(this.ƀo="reverting",this.ƀky.setItem(t,e));}ƀez(t,e){switch(this.ƀft!==void 0&&this.ƀft!==t&&this.ƀft!==e&&this.ƀhs.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀft}),this.ƀhj!==void 0&&this.ƀhj!==t&&this.ƀhj!==e&&this.ƀhs.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀhj}),e!==void 0&&e!==this.ƀft&&e!==this.ƀhj&&this.ƀhs.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀo){case "idle":break;case "transitionForward":case "transitionBackward":e===void 0?(this.ƀo="idle",this.ƀft=this.ƀhj,this.ƀhj=void 0):this.ƀft!==t&&this.ƀfa(t,e);break;case "reverting":e===void 0?(this.ƀo="idle",this.ƀhj=void 0):this.ƀft!==e&&this.ƀfa(t,e);break;default:{this.ƀo;throw new Error}}}ƀfa(t,e){this.ƀft=t,this.ƀhj=e,this.ƀhu.trigger({value:0,index:this.ƀft}),this.ƀo=this.ƀft<this.ƀhj?"transitionForward":"transitionBackward";}ƀfe(t){let e=1;(this.ƀo==="transitionBackward"||this.ƀo==="reverting"&&this.ƀft!==void 0&&this.ƀhj!==void 0&&this.ƀft>this.ƀhj)&&(e=-1),(this.ƀo==="idle"||t!==0)&&this.ƀhu.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀft}),this.ƀhj!==void 0&&this.ƀhu.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀhj});}};exports.ScrollDirection=void 0;(function(n){n[n.Horizontal=1]="Horizontal",n[n.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var ci=class extends d{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀca=t,this.ƀcw="x",this.ƀbq=new Map,this.ƀhx={duration:300,animation:b.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhx.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhx.size.x+this.ƀhx.margin*2,this.ƀhx.size.y):new helpersLib.Vector(this.ƀhx.size.x,this.ƀhx.size.y+this.ƀhx.margin*2),s=new d().setPosition(this.ƀhx.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhx.margin,0):new helpersLib.Vector(0,-this.ƀhx.margin),{round:false}).displayParent(this).attach(this);this.ƀcf(i,this.ƀhx.margin,this.ƀhx.direction,s),this.ƀcw=this.ƀhx.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀky=new De({duration:this.ƀhx.duration,animation:this.ƀhx.animation}).onStateChange((r,o)=>{if(r===exports.SlideStateAnimationState.Appear){let a=new d().displayParent(this).attach(this);this.ƀbq.set(o,a),this.ƀca({index:o,container:a});}else {let a=this.ƀbq.get(o);a&&(a.destroy(),this.ƀbq.delete(o));}}).onValueChange((r,o)=>{let a=this.ƀbq.get(o);if(a){let l={x:0,y:0};l[this.ƀcw]=i[this.ƀcw]*r+this.ƀhx.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=s;}setIndex(t,e){return this.ƀky.setIndex(t,e),this}ƀcf(t,e,i,s){new Ot(s,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},qi=class extends ci{static{h(this,"SlideInContent");}constructor(t,e,i){super(s=>{let r=this.indexToItem.get(s.index);if(r)e({index:s.index,item:r,container:s.container});else throw new Error(`SlideInContent: The item with index '${s.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((s,r)=>{this.itemToIndex.set(s,r),this.indexToItem.set(r,s);});}setItem(t,e){let i=this.itemToIndex.get(t);if(i!==void 0)this.setIndex(i,e);else throw new Error(`SlideInContent: The item '${t}' is not part of the items list`);return this}};var oe=class{static{h(this,"VectorSet");}constructor(){this.ƀly=new Map;}add(t){let e=this.ƀly.get(t.x);e||(e=new Set,this.ƀly.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀly.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀly.get(t.x);return e?e.delete(t.y):false}};var pi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var _=class{static{h(this,"PositionToGridPositionConverter");}static areaToGridArea(t,e){return new helpersLib.Rectangle(this.positionToGridPosition(t.topLeft,e),this.positionToGridPosition(t.bottomRight,e))}static positionToGridPosition(t,e){return t.divideNumber(e).floor()}static gridPositionToPosition(t,e){return t.add(new helpersLib.Vector(.5,.5)).multiplyNumber(e)}};var ne=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let s=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),r=_.areaToGridArea(e,i);if(this.ƀax(t,r))return helpersLib.Vector.zero;let o=t.movePositionInsideGrid(r.topLeft),a=helpersLib.Vector.fromTo(r.topLeft,o),l=this.find(t,o,s);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(r.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((s.x+1)*i-e.size.x)/2-p.x,c.y*i+((s.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let s=new oe,r=new helpersLib.Queue(e);for(;r.notEmpty;){let o=r.pop();s.add(o);let a=new helpersLib.Rectangle(o,o.add(i));if(this.ƀax(t,a))return helpersLib.Vector.fromTo(e,o);t.getNeighborPositions(o,"orthogonal").forEach(l=>{s.has(l)||r.add(l);});}}static ƀax(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let s=e.topLeft.x;s<=e.bottomRight.x;s++)if(!t.get(new helpersLib.Vector(s,i)))return false;return true}};var tr=Math.SQRT2-1,Bs=class{static{h(this,"PathfinderNode");}constructor(t,e){this.position=t,this.distanceToEnd=e,this.closed=false,this.distanceFromStart=Number.MAX_SAFE_INTEGER,this.parent=void 0;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}getStepCost(t){return this.position.x!==t.position.x&&this.position.y!==t.position.y?Math.SQRT2:1}createSolutionPath(t){let e=[],i=this;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}},Gs=class{static{h(this,"PathfinderGrid");}constructor(t,e,i,s){this.ƀey=t,this.ƀlf=i,this.ƀhi=s,this.ƀhw=new helpersLib.BinaryHeap("min"),this.ƀhl=new helpersLib.Grid({size:t.size,defaultValue:void 0});let r=this.ƀcg(e);r.distanceFromStart=0,this.ƀhw.add(r.pathLength,r),this.ƀaf=r;}get hasOpenNodes(){return this.ƀhw.size>0}getNeighbors(t){let e=[];for(let i of this.ƀey.getNeighborPositions(t.position,this.ƀhi))if(this.ƀey.get(i)){let s=this.ƀhl.get(i)??this.ƀcg(i);s.closed||e.push(s);}return e}popLowestPathCostNode(){let t=this.ƀhw.pop();return t.closed=true,t.distanceToEnd<this.ƀaf.distanceToEnd&&(this.ƀaf=t),t}changeNodeCost(t,e,i){t.distanceFromStart=e,t.parent=i,this.ƀhw.updatePriority(t,t.pathLength)||this.ƀhw.add(t.pathLength,t);}getBestClosedNode(){return this.ƀaf}ƀcg(t){let e=Math.abs(t.x-this.ƀlf.x),i=Math.abs(t.y-this.ƀlf.y),s=this.ƀhi==="orthogonal"?e+i:e>i?e+tr*i:i+tr*e,r=new Bs(t,s);return this.ƀhl.isPointWithinBounds(t)&&this.ƀhl.set(t,r),r}},ae=class{static{h(this,"PathFinder");}static findPath(t,e,i,s){let r=new Gs(t,e,i,s);for(;r.hasOpenNodes;){let o=r.popLowestPathCostNode();if(o.position.isEqual(i))return o.createSolutionPath(true);for(let a of r.getNeighbors(o)){let l=o.distanceFromStart+o.getStepCost(a);l<a.distanceFromStart&&r.changeNodeCost(a,l,o);}}return r.getBestClosedNode().createSolutionPath(false)}};var Wt=[-1,0,0,1,-1,-1,1,1],$t=[0,-1,1,0,-1,1,-1,1],ir=[10,10,10,10,14,14,14,14],ui=Wt.map((n,t)=>new helpersLib.Vector(n,$t[t]).radian),he=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀle=t;let i=e.width,s=e.height,r=this.ƀei(e.size);this.ƀmh=i,this.ƀfh=s,this.ƀfi=r;let o=i*s,a=new Uint8Array(o),l=new Int32Array(o),c=e.snapshot();for(let w=0;w<s;w++){let M=c[w],L=w*i;for(let I=0;I<i;I++)M[I]?(a[L+I]=1,l[L+I]=r):l[L+I]=-1;}this.ƀz=a,this.ƀmg=l,this.ƀcv=new Uint8Array(o),this.ƀcu=new Array(o);let p=[-1,-i,i,1,-i-1,i-1,-i+1,i+1],f=new Array(r),y=e.cropAreaOutsideOfTheGrid(t),v=[];for(let w=y.topLeft.y;w<=y.bottomRight.y;w++)for(let M=y.topLeft.x;M<=y.bottomRight.x;M++)l[w*i+M]=0,v.push(w*i+M);f[0]=v;for(let w=0;w<r;w++){let M=f[w];if(M){f[w]=void 0;for(let L=0;L<M.length;L++){let I=M[L];if(l[I]!==w)continue;let K=I%i;if(K>0&&K<i-1&&I>=i&&I<o-i){let _t=w+10,$=w+14;for(let H=0;H<8;H++){let j=I+p[H],at=H<4?_t:$;if(at<l[j]){l[j]=at;let Rt=f[at];Rt?Rt.push(j):f[at]=[j];}}}else {let _t=(I-K)/i;for(let $=0;$<8;$++){let H=K+Wt[$],j=_t+$t[$];if(H<0||j<0||H>=i||j>=s)continue;let at=j*i+H,Rt=w+ir[$];if(Rt<l[at]){l[at]=Rt;let Vi=f[Rt];Vi?Vi.push(at):f[Rt]=[at];}}}}}}for(let w=0;w<o;w++)l[w]===-1&&(l[w]=r);}getDirectionToTarget(t){if(t.isInsideRectangle(this.ƀle))return;let e=this.ƀmh,i=Math.round(t.x),s=Math.round(t.y);i=Math.max(0,Math.min(e-1,i)),s=Math.max(0,Math.min(this.ƀfh-1,s));let r=s*e+i;if(this.ƀcv[r]===1)return this.ƀcu[r];let o=this.ƀaq(i,s,r);return this.ƀcv[r]=1,this.ƀcu[r]=o,o}ƀaq(t,e,i){let s=this.ƀmh,r=this.ƀfh,o=[];for(let a=0;a<8;a++){let l=t+Wt[a],c=e+$t[a];l>=0&&c>=0&&l<s&&c<r&&o.push(a);}if(this.ƀmg[i]>=this.ƀfi){let a=o.filter(l=>this.ƀz[(e+$t[l])*s+t+Wt[l]]===1);if(a.length===0)return;if(a.length<o.length)return helpersLib.Radian.getAverage(...a.map(l=>ui[l]))}return this.ƀdy(t,e,o)}ƀdy(t,e,i){let s=this.ƀmh,r=[],o=this.ƀfi;for(let v=0;v<i.length;v++){let w=i[v],M=this.ƀmg[(e+$t[w])*s+t+Wt[w]];if(M>=this.ƀfi)continue;let L=M+ir[w];L<o?(r.length=0,r.push(w),o=L):L===o&&r.push(w);}if(r.length===0)return;let a=0,l=0;for(let v=0;v<r.length;v++)a+=Wt[r[v]],l+=$t[r[v]];if(a===0&&l===0)return ui[helpersLib.Random.pickRandomElement(r)];let c=1/Math.sqrt(a*a+l*l),p=t+Math.round(a*c),f=e+Math.round(l*c);return p>=0&&f>=0&&p<s&&f<this.ƀfh&&this.ƀz[f*s+p]===1?new helpersLib.Vector(a,l).radian:ui[helpersLib.Random.pickRandomElement(r)]}get t(){let t=[];for(let e=0;e<this.ƀfh;e++){let i=new Array(this.ƀmh);for(let s=0;s<this.ƀmh;s++)i[s]=this.ƀmg[e*this.ƀmh+s];t.push(i);}return new helpersLib.Grid(t)}ƀei(t){return (t.x+t.y)*20}};var R=class n{static{h(this,"AudioAssets");}static{this.ƀao=new Map;}static{this.context=new AudioContext;}static async load(t){await Promise.all(t.map(e=>fetch(e.url).then(i=>i.arrayBuffer()).then(i=>this.context.decodeAudioData(i)).then(i=>this.ƀao.set(e.id,i))));}static createSource(t){let e=n.ƀdx(t),i=n.context.createBufferSource();return i.buffer=e,i}static ƀdx(t){let e=this.ƀao.get(t);if(!e)throw new Error(`Audio: Sound with id ${t} was not loaded.`);return e}};T.onHardReset.subscribe(()=>{R.context=new AudioContext,R.ƀao.clear();}).attachToRoot();var rt=1e3,it=class n{static{h(this,"Audio");}static ƀkb(){return this.ƀfw=new n,this.ƀfw}constructor(){this.ƀgu=R.context.createGain(),this.ƀgt=R.context.createGain(),this.ƀhh=R.context.createGain(),this.ƀkk=R.context.createGain(),this.ƀgu.connect(R.context.destination),this.ƀgt.connect(this.ƀgu),this.ƀhh.connect(this.ƀgt),this.ƀkk.connect(this.ƀgt),this.ƀgv=new O(this.ƀgu.gain,"value",{duration:500*2,animation:b.easeIn,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀgv.set({value:0});}setVolumes(t){this.ƀgt.gain.value=t.master,this.ƀhh.gain.value=t.music,this.ƀkk.gain.value=t.sound;}appear(t,e="ease"){switch(e){case "ease":return this.ƀgv.set({value:t?0:1}),this.ƀgv.animate({value:t?1:0}).chainToRoot();case "instant":return this.ƀgv.set({value:t?1:0}),actionsLib.SingleEvent.instant();default:{throw new Error}}}};T.onHardReset.subscribe(()=>{it.ƀkb();}).attachToRoot();var Fs=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.CameraGateway=class yt extends ht(){static{h(this,"CameraGateway");}};exports.CameraGateway=Fs([u()],exports.CameraGateway);var Ls=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Bt=class extends ht(){static{h(this,"CameraViewGateway");}};Bt=Ls([u()],Bt);var sr;(function(n){n.BackgroundScreen="backgroundScreen",n.Background="background",n.Main="main",n.Foreground="foreground",n.ForegroundScreen="foregroundScreen";})(sr||(sr={}));exports.FocusingAnimation=void 0;(function(n){n[n.Instant=1]="Instant",n[n.EaseInOut=2]="EaseInOut",n[n.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var le=class{static{h(this,"Camera");}get position(){return this.ƀas.getCameraPosition()}constructor(){this.ƀas=E.get(exports.CameraGateway),this.ƀaw=E.get(Bt),this.ƀas.createCamera(),this.layers=this.ƀaw.getLayers();}setPosition(t){this.ƀas.setPosition(t);}setTransition(t){this.ƀas.setTransition(t);}appear(t,e="alpha",i=0){return this.ƀaw.appear(t,e,i)}screenPositonToStagePosition(t){return this.ƀaw.screenPositonToStagePosition(t)}};var x=class n{static{h(this,"Game");}static get instance(){return this.ƀfw}static{this.pause=actionsLib.Reducer.createOr();}static{this.freeze=actionsLib.Reducer.createOr();}static get camera(){return this.ƀar}static get audio(){return this.ƀy}static appear(t,e){let i=e?.audio??"ease",s=e?.camera??"alpha";return actionsLib.ActionLib.all([this.audio.appear(t,i),this.camera.appear(t,s,i!=="instant"?0:500)]).mapToVoid().chainToRoot()}static get time(){return g.ƀlm}static get setupOptions(){return this.ƀke}constructor(t){if(this.ƀjq=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀjq.notifier,this.ƀjr=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀjr.notifier,this.devMode=false,n.ƀfw)throw new Error("There can be only one Game instance!");this.ƀbm={screenResolution:void 0,maxScreenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbm.devMode||false,this.ƀip=new W__namespace.Application;let e=n.pause.effect(false).attachToRoot();n.freeze.subscribe(i=>{e.update(i),i?R.context.suspend():R.context.resume();}).attachToRoot();}async setup(t){n.ƀke=t;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbm.backgroundColor,autoStart:false,antialias:this.ƀbm.antialias,resolution:this.ƀbm.resolution,width:this.ƀbm.screenResolution?.width,height:this.ƀbm.screenResolution?.height,useBackBuffer:true,powerPreference:"high-performance",eventFeatures:{globalMove:false}});await this.ƀip.init(e);let i=document.body.appendChild(this.ƀip.canvas);this.ƀka(i),await Promise.all([G.loadGameAssets(t.spriteAssetDefinitions),G.loadGameAssets(t.fontAssetDefinitions),R.load(t.soundAssetDefinitions)]),n.ƀfw=this,this.renderer=this.ƀip.renderer,globalThis.ƀa=this.ƀip,this.ƀfc(),n.ƀar=new le,n.ƀy=it.ƀkb(),this.ƀip.start(),this.ƀip.ticker.add(()=>{n.freeze.value||g.triggerUpdateTick(this.ƀip.ticker.deltaMS);}),this.devMode&&await this.renderer.layout.enableDebug(true);}generateTexture(t){let e=this.renderer.layout,i=e.autoUpdate;e.autoUpdate=false;let s=this.renderer.generateTexture(t);return e.autoUpdate=i,s}setResolution(t){if(this.ƀip.renderer.resolution!==t){this.ƀip.renderer.resolution=t;let e=this.ƀer();this.ƀip.renderer.resize(e.x,e.y);}}ƀfc(){this.ƀde(),this.ƀjz(),window.addEventListener("resize",t=>{this.ƀde(),this.ƀjz();});}ƀde(){let t=this.ƀer();(t.x!==this.ƀip.screen.width||t.y!==this.ƀip.screen.height)&&this.ƀip.renderer.resize(t.x,t.y);}ƀjz(){let t=new helpersLib.Vector(this.ƀip.screen.width,this.ƀip.screen.height);this.ƀjq.value=t,this.ƀjr.value=t.multiplyNumber(.5).round();}ƀer(){let t=this.ƀbm.screenResolution?.width??window.innerWidth,e=this.ƀbm.screenResolution?.height??window.innerHeight;return this.ƀbm.maxScreenResolution&&(t=Math.min(t,this.ƀbm.maxScreenResolution.width),e=Math.min(e,this.ƀbm.maxScreenResolution.height)),new helpersLib.Vector(t,e)}ƀka(t){this.ƀbm.maxScreenResolution&&(t.style.maxWidth=`${this.ƀbm.maxScreenResolution?.width}px`,t.style.maxHeight=`${this.ƀbm.maxScreenResolution?.height}px`),t.style.width="100%",t.style.height="100%";}};var ce=class n extends actionsLib.IDAttachable{static{h(this,"Sound");}static createByName(t,e){let i=x.setupOptions.soundDefinitions[t];if(!i)throw new Error(`Sound: Could not find sound definition with name ${t}.`);return new n(i,e)}get volume(){return this.ƀdt.gain.value}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀdt.gain.value=t,this}constructor(t,e){super(),this.ƀkl=t,this.ƀdt=R.context.createGain(),this.ƀdt.connect(it.ƀfw.ƀkk),this.ƀfg=this.ƀdt,e?.volume!==void 0&&(this.volume=e.volume),this.ƀiw(e?.time??0);}destroy(){this.destroyed||(super.destroy(),this.ƀla(),this.ƀdt?.disconnect());}ƀlw(){this.ƀfg.disconnect(),this.ƀfg.connect(it.ƀfw.ƀhh);}ƀiw(t){this.ƀla();let e=this.ƀkl.loop;if(this.ƀku=helpersLib.NumberHelper.clamp(t,0,e?e.to:this.ƀkl.duration),e){let i=e.from,s=e.to;this.ƀix({soundID:this.ƀkl.id,start:this.ƀku,end:this.ƀku<i?i:s,loop:false,onComplete:h(()=>{this.ƀko.disconnect(),this.ƀix({soundID:this.ƀkl.id,start:i,end:s,loop:true});},"onComplete")});}else this.ƀix({soundID:this.ƀkl.id,start:this.ƀku,end:void 0,loop:false,onComplete:h(()=>this.destroy(),"onComplete")});}ƀla(){this.ƀko&&(this.ƀko.onended=null,this.ƀko.stop(),this.ƀko.disconnect());}ƀix(t){this.ƀko=R.createSource(t.soundID),this.ƀko.connect(this.ƀdt),t.onComplete&&(this.ƀko.onended=t.onComplete),t.loop?(this.ƀko.loop=true,this.ƀko.loopStart=t.start,this.ƀko.loopEnd=t.end??this.ƀko.buffer.duration,this.ƀko.start(0,t.start)):this.ƀko.start(0,t.start,t.end?t.end-t.start:void 0);}};var zs=800,_e=-128,wt=class n extends ce{static{h(this,"AdvancedSound");}static createByName(t,e){let i=x.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}constructor(t,e){super(t,e),this.ƀlm=new actionsLib.Variable(0),this.time=this.ƀlm.notifier,this.ƀkw=R.context.currentTime-this.ƀku,this.ƀlm.value=this.ƀku,g.beforeSceneUpdateAction.subscribe(()=>{this.ƀlm.value=R.context.currentTime-this.ƀkw;}).attach(this),this.ƀfg.disconnect(),this.ƀkc(e?.fade?helpersLib.NumberHelper.clamp(e.fade,0,1):0),this.ƀkd(e?.muffle?helpersLib.NumberHelper.clamp(e.muffle,0,1):0),this.ƀfg.connect(it.ƀfw.ƀkk);}ƀkc(t=0){this.ƀdm=R.context.createGain(),this.ƀdm.gain.value=1-t,this.ƀdl=new O(this.ƀdm.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfg.connect(this.ƀdm),this.ƀfg=this.ƀdm;}ƀkd(t=0){this.ƀhf=R.context.createBiquadFilter(),this.ƀhf.type="highshelf",this.ƀhf.frequency.value=zs,this.ƀhf.gain.value=t*_e,this.ƀhg=new O(this.ƀhf.gain,"value",{duration:500,animation:b.lineer,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀfg.connect(this.ƀhf),this.ƀfg=this.ƀhf;}close(){return this.ƀbd?this.onDestroy():(this.ƀbd=true,this.fade(1,rt).notIdle().chain(this).tap(()=>this.destroy()).chainToRoot())}notifyOnTime(t){return this.time.value>t?actionsLib.SingleEvent.createDestroyed():actionsLib.SingleEvent.create(e=>{let i=this.time.filter(s=>s>=t).tap(()=>e()).attach(this);return ()=>i.destroy()})}setFade(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀdl.set({value:1-t});}fade(t,e=500){t=helpersLib.NumberHelper.clamp(t,0,1);let i=t>1-this.ƀdm.gain.value;return e===0?(this.ƀdl.set({value:1-t}),actionsLib.SingleEvent.instant()):this.ƀdl.animate({value:1-t},{duration:e,animation:i?b.easeOut:b.easeIn}).chain(this)}setMuffle(t){t=helpersLib.NumberHelper.clamp(t,0,1),this.ƀhg.set({value:t*_e});}muffle(t,e=500){return t=helpersLib.NumberHelper.clamp(t,0,1),e===0?(this.ƀhg.set({value:t*_e}),actionsLib.SingleEvent.instant()):this.ƀhg.animate({value:t*_e},{duration:e}).chain(this)}destroy(){this.destroyed||(this.ƀdm.disconnect(),this.ƀhf.disconnect()),super.destroy();}};var pe=class n extends actionsLib.IDAttachable{static{h(this,"Music");}static createByName(t,e){let i=x.setupOptions.soundDefinitions[t];if(!i)throw new Error(`AdvancedSound: Could not find sound definition with name ${t}.`);return new n(i,e)}get time(){switch(this.ƀkn.value.type){case "paused":return this.ƀkn.value.value.time;case "playing":return this.ƀkn.value.value.time.value;default:{this.ƀkn.value;throw new Error}}}get volume(){return this.ƀkn.value.value.volume}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀkn.value.value.volume=t,this}constructor(t,e){super(),this.ƀhx={stopPlayingOnPause:true,...e},this.ƀkm=t.id;let i;if(this.ƀhx.stopPlayingOnPause&&x.pause.value)i={type:"paused",value:{time:0,volume:1}};else {let s=new wt(t,this.ƀhx).attach(this);s.ƀlw(),i={type:"playing",value:s};}this.ƀkn=new actionsLib.Variable(i),this.ƀhx.stopPlayingOnPause&&(this.ƀic=x.pause.subscribe(s=>this.ƀfb(s)).attach(this));}notifyOnTime(t){return actionsLib.SingleEvent.create(e=>{let i=this.ƀkn.asyncDropOngoing((s,r)=>{switch(s.type){case "paused":r.drop();break;case "playing":return s.value.notifyOnTime(t);default:{throw new Error}}}).toSingleEvent().tap(()=>e()).attach(this);return ()=>i.destroy()})}close(){return this.ƀbd?this.onDestroy():(this.ƀbd=true,this.ƀic?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀkn.value.type==="playing"?this.ƀkn.value.value.close():actionsLib.SingleEvent.instant(),this.ƀdn?.onDestroy()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀfb(t){if(t){if(this.ƀkn.value.type==="playing"){let e=this.ƀkn.value.value;this.ƀkn.value={type:"paused",value:{time:e.time.value,volume:e.volume}},this.ƀdn=e,actionsLib.ActionLib.all([e.fade(1,rt),e.muffle(1,rt)]).tap(()=>{this.ƀdn=void 0,e.destroy();}).attach(this);}}else if(this.ƀkn.value.type==="paused"){let{volume:e,time:i}=this.ƀkn.value.value,s=wt.createByName(this.ƀkm,{volume:e,time:i,fade:1,muffle:1}).attach(this);s.ƀlw(),actionsLib.ActionLib.all([s.fade(0,rt),s.muffle(0,rt)]).attach(this),this.ƀkn.value={type:"playing",value:s};}}};var di=class extends actionsLib.IDAttachable{static{h(this,"MusicPlayer");}get time(){return this.ƀiy?this.ƀiy.time:0}get volume(){return this.ƀmf}set volume(t){this.setVolume(t);}setVolume(t){return this.ƀmf=t,this.ƀiy&&(this.ƀiy.volume=t),this.ƀib&&(this.ƀib.volume=t),this}constructor(t){super(),this.ƀmf=1,this.ƀhx={stopPlayingOnPause:true,playWhenPaused:void 0,volume:1,...t},this.ƀmf=this.ƀhx.volume,this.ƀhx.playWhenPaused&&this.ƀkf(this.ƀhx.playWhenPaused);}play(t){if(this.ƀbd)throw new Error("Play is called while music player is destroyed.");return this.ƀcq=t,actionsLib.SingleEvent.instant().async(()=>{let e=this.ƀiy;if(e)return this.ƀiy=void 0,e.close()}).map(()=>{if(this.ƀcq===t)return this.ƀiy=pe.createByName(t,{stopPlayingOnPause:this.ƀhx.stopPlayingOnPause,volume:this.ƀmf}).attach(this),this.ƀiy}).chain(this)}stop(){return actionsLib.SingleEvent.instant().async(()=>{let t=this.ƀiy;if(t)return t.close().tap(()=>{t===this.ƀiy&&(this.ƀiy=void 0);})}).chain(this)}close(){return this.ƀbd?this.onDestroy():(this.ƀbd=true,this.ƀic?.destroy(),actionsLib.SingleEvent.instant().async(()=>actionsLib.ActionLib.all([this.ƀiy?.close()??actionsLib.SingleEvent.instant(),this.ƀib?.close()??actionsLib.SingleEvent.instant()]),"tap").chain(this).tap(()=>this.destroy()).chainToRoot())}ƀkf(t){this.ƀic=x.pause.toSequence().asyncDropOngoing(e=>e&&g.wait(rt).map(()=>e)).tap(e=>{if(e)this.ƀib=wt.createByName(t,{fade:1,volume:this.ƀmf}).attach(this),this.ƀib.ƀlw(),this.ƀib.fade(0);else if(this.ƀib){let i=this.ƀib;this.ƀib.fade(1).tap(()=>i.destroy()).attach(this),this.ƀib=void 0;}}).attach(this);}};var mi=class extends d{static{h(this,"Placeholder");}constructor(t){super(),this.ƀit=new W__namespace.Graphics,this.ƀit.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),this.ƀiq.addChild(this.ƀit);}destroy(){this.destroyed||(super.destroy(),this.ƀit.destroy());}};var zt=class{static{h(this,"TextStyleConverter");}static getPixiTextStyle(t){let e={color:helpersLib.ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:false,...t},i=t?.dropShadow===true?{}:t?.dropShadow,s={};if(i){let r={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};s={dropShadow:{blur:r.blur,angle:r.angle.value,distance:r.distance,color:helpersLib.ColorHelper.rgbToHex(r.color),alpha:r.alpha}};}return helpersLib.JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:helpersLib.ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...s})}};var Fe=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),s=scriptEngineLib.RichTextSeparator.process(t,i),r=this.ƀfs(s,e),o=this.ƀs(r);return this.ƀkp(o)}static ƀfs(t,e){let i=new Map,s=new Map,r=h((a,l)=>{if(s.has(l))return s.get(l);let c=zt.getPixiTextStyle(a);return s.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀeb(a.tags,e,i),p=r(l,c),f=W__namespace.CanvasTextMetrics.measureText(" ",new W__namespace.TextStyle(p),void 0,false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:f.width}})}static ƀeb(t,e,i){let s=t.join("+");if(i.has(s))return {style:i.get(s),cacheKey:s};let r=this.ƀbh(t,e);return i.set(s,r),{style:r,cacheKey:s}}static ƀbh(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:s,align:r,dropShadow:o,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((s,r)=>{s.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:s.cacheKey,style:s.style,pixiStyle:s.pixiStyle,spaceWidth:s.spaceWidth});});}),e.push(i),e}static ƀkp(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let s=i.flatMap(r=>this.ƀkq(r.text).map(a=>{let l=new W__namespace.TextStyle(r.pixiStyle),c=W__namespace.CanvasTextMetrics.measureText(a,l,void 0,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:r.cacheKey,style:r.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:r.spaceWidth}}}));e.push(s);}),e}static ƀkq(t){if(t==="")return [""];let e=[],i="",s=t[0]===" ";for(let r=0;r<t.length;r++){let o=t[r],a=o===" ";a===s?i+=o:(e.push(i),i=o,s=a);}return i&&e.push(i),e}};var Le=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀco.length===0}get remainingWidth(){return this.ƀmi-this.ƀcr}constructor(t,e){this.ƀmi=t,this.ƀgj=[],this.ƀco=[],this.ƀcr=0,this.ƀgi=new helpersLib.Vector(0,0),this.ƀcp=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀfk=i.horizontalAlignment,this.ƀlz=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀmi||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcs={direction:i.rectangleCutOption.direction,rectangle:this.ƀbu(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcp,t.y),i=this.ƀek(this.ƀgi.y,this.ƀgi.y+e);return this.ƀcr+t.x<=i}insertWord(t){let e=Math.max(this.ƀcp,t.style.height);if(this.ƀco.length===0){let i=this.ƀel(this.ƀgi.y,this.ƀgi.y+e);this.ƀgi=new helpersLib.Vector(i,this.ƀgi.y),this.ƀcr=this.ƀgi.x;}this.ƀco.push({chunk:t,position:new helpersLib.Vector(this.ƀcr,this.ƀgi.y)}),this.ƀcp=e,this.ƀcr+=t.style.width;}newLine(){let t=this.ƀgi.y+this.ƀcp,e=this.ƀel(t,t);this.ƀdp(),this.ƀgi=new helpersLib.Vector(e,t),this.ƀcr=this.ƀgi.x,this.ƀcp=0;}print(){return this.ƀdp(),this.ƀgj}ƀdp(){this.ƀco.length>0&&(this.ƀgj.push(this.ƀg(this.ƀco)),this.ƀco=[]);}ƀg(t){return t=this.ƀmb(t),t=this.ƀfm(t),t}ƀfm(t){if(this.ƀfk==="left")return t;let e=this.ƀgi.y+this.ƀcp,i=this.ƀel(this.ƀgi.y,e),r=this.ƀek(this.ƀgi.y,e)-i,o=Math.min(r,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀfk==="center"?a=(r-o)/2:a=r-o,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀmb(t){let e=Math.max(...t.map(s=>s.chunk.style.ascent)),i=Math.max(...t.map(s=>s.chunk.style.descent));return t.map(s=>{let r;switch(this.ƀlz){case "top":r=i-s.chunk.style.descent;break;case "center":r=(i-s.chunk.style.descent+e-s.chunk.style.ascent)*.5;break;case "bottom":r=e-s.chunk.style.ascent;break;default:{this.ƀlz;throw new Error}}return s={chunk:s.chunk,position:new helpersLib.Vector(s.position.x,s.position.y+r)},s})}ƀel(t,e){return this.ƀcs&&(this.ƀcs.direction==="topLeft"||this.ƀcs.direction==="bottomLeft")&&(this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcs.rectangle.bottomRight.x:0}ƀek(t,e){return this.ƀcs&&(this.ƀcs.direction==="topRight"||this.ƀcs.direction==="bottomRight")&&(this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(this.ƀmi,t),{includeEdges:false})||this.ƀcs.rectangle.isPointInside(new helpersLib.Vector(this.ƀmi,e),{includeEdges:false}))?this.ƀcs.rectangle.topLeft.x:this.ƀmi}ƀbu(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error}}return new helpersLib.Rectangle(e,i)}};var He=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((s,r)=>{if(e.isSpaceAvailable(new helpersLib.Vector(s.style.width,s.style.height)))if(s.whitespace&&r===i.length-2){let o=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(o.style.width+s.style.width,o.style.height))?e.insertWord(s):this.ƀmj(s,e);}else e.insertWord(s);else e.lineIsEmpty?e.insertWord(s):s.whitespace?this.ƀmj(s,e):(e.newLine(),e.insertWord(s));}),e.newLine();}),e.print()}static ƀmj(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),s=Math.max(0,Math.min(i,t.text.length-1));if(s>0){let o={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(o);}e.newLine();let r=t.text.length-s-1;if(r>0){let o={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(o);}}};var je=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgz(t),t=this.ƀlq(t),this.ƀaz(t)}static ƀgz(t){return t.map(e=>{let i=[],s,r=true;return e.forEach(o=>{if(!s||s.chunk.style.cacheKey!==o.chunk.style.cacheKey)s&&i.push(s),s=o,r=o.chunk.whitespace;else {let a=s.chunk.text+o.chunk.text;r=o.chunk.whitespace&&r,s={chunk:{text:a,whitespace:r,style:{...s.chunk.style,width:s.chunk.style.width+o.chunk.style.width}},position:s.position};}}),s&&i.push(s),i})}static ƀlq(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let s=i.chunk.text.length,r=i.chunk.text.trimEnd();s!==r.length?e.push({chunk:{text:r,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(s-r.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀaz(t){return t.flatMap(e=>e.map(i=>({text:i.chunk.text,style:i.chunk.style.style,position:i.position}))).filter(e=>e.text.trim()!=="")}};var fe=class{static{h(this,"RichTextToPlaneText");}static process(t,e){if(e.default.wordWrapWidth===void 0){if(e.default.align==="right"||e.default.align==="center")throw new Error("wordWrapWidth is required for right or center alignment");if(e.rectangleCut&&(e.rectangleCut.direction==="topRight"||e.rectangleCut.direction==="bottomRight"))throw new Error("wordWrapWidth is required for topRight or bottomRight rectangle cut")}let i=Fe.process(t,e),s=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),r=new Le(e.default.wordWrapWidth??1/0,s),o=He.wrapText(i,r);return je.process(o)}};var so=1,cr=1/so,de=class extends d{static{h(this,"Text");}get ƀlj(){if(!this.ƀlk){let t=new W__namespace.TextStyle(this.ƀiv);this.ƀlk=W__namespace.CanvasTextMetrics.measureText(this.ƀli,t);}return this.ƀlk}get ascent(){return this.ƀlj.fontProperties.ascent}constructor(t,e){super(),this.ƀiv=zt.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀiu.destroyed&&this.ƀiu.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀiu.anchor.x,this.ƀiu.anchor.y)}set anchor(t){this.ƀi=t,this.ƀiu.anchor.set(t.x,t.y),this.ƀjj();}setText(t){return this.ƀli!==t&&(this.ƀli=t,this.ƀjf()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀiv.fill!==e&&(this.ƀiv.fill=e,this.ƀjf()),this}ƀjf(){this.ƀiu?.destroy(),this.ƀlc?.destroy(),this.ƀlc=void 0,this.ƀlk=void 0;let t=new W__namespace.TextStyle(this.ƀiv);this.ƀiu=new W__namespace.Text({text:this.ƀli,style:t}),this.ƀi&&this.ƀiu.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀjj(),this.ƀiu.scale.set(cr,cr),this.ƀiq.addChild(this.ƀiu),this.ƀiv.lineThrough&&(this.ƀlc=this.ƀe(this.ƀiu,this.ƀiv.fill),this.ƀiq.addChild(this.ƀlc));}ƀjj(){let t=W__namespace.CanvasTextMetrics.measureText(this.ƀli,new W__namespace.TextStyle({...this.ƀiv,dropShadow:false})),e=-this.ƀiu.anchor.x*t.width,i=-this.ƀiu.anchor.y*t.height;this.ƀiu.boundsArea=new W__namespace.Rectangle(e,i,t.width,t.height);}ƀe(t,e){let i=W__namespace.CanvasTextMetrics.measureText(t.text,t.style),s=Math.max(1,Math.round(i.lineHeight*.07)),r=s%2*.5,o=new W__namespace.Graphics,a=0;return i.lines.forEach((l,c)=>{let p=W__namespace.CanvasTextMetrics.measureText(l,t.style),f=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+r,y=0;t.style.align==="center"?y=0+(t.width-p.width)*.5:t.style.align==="right"&&(y=0+t.width-p.width),y=Math.floor(y),o.moveTo(Math.floor(y),f),o.lineTo(Math.floor(y+p.width),f),a+=p.lineHeight;}),o.stroke({width:s,color:e}),o}};var yi=class extends d{static{h(this,"RichText");}constructor(t,e){super(),fe.process(t,e).forEach(s=>new de(s.text,s.style).setPosition(s.position).displayParent(this).attach(this));}};var gi=class extends d{static{h(this,"UpdatableContainer");}},wi=class extends d{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀca=t,this.ƀcx=new Map,this.ƀhx={trackBy:h((i,s)=>s,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcx.keys()),i=0;t.forEach((s,r)=>{let o=this.ƀhx.trackBy(s,r),a;this.ƀcx.has(o)?(a=this.ƀcx.get(o),e.delete(o),a.update(s)):(a=this.ƀca(s).displayParent(this).attach(this),this.ƀcx.set(o,a)),this.ƀhx.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhx.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhx.positioning.spacing);}),e.forEach(s=>{this.ƀcx.get(s).destroy(),this.ƀcx.delete(s);});}};var me=class n extends d{static{h(this,"MenuUI");}static{this.ƀfy=actionsLib.Reducer.createExistenceChecker();}static{this.isAnyMenuTransitioning=this.ƀfy.notifier;}constructor(t,e){super(),this.ƀhp=new actionsLib.SingleAction,this.onCreate=this.ƀhp.notifier,this.ƀhr=new actionsLib.SingleAction,this.onOpen=this.ƀhr.notifier,this.ƀhm=new actionsLib.SingleAction,this.onClose=this.ƀhm.notifier,this.ƀbd=false;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.setAlpha(0),this.ƀp=new O(this,"alpha",{animation:b.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let s=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgx=et.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(o=>{s.aspectRatio=o.x/o.y,s.scale=Math.max(o.x,o.y),s.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),this.ƀhp.resolve();let r=n.ƀfy.effect().attach(this);this.ƀp.animate({alpha:1}).chain(this).tap(()=>{this.ƀhr.resolve(),r.destroy(),i.closeOnBackgroundClick&&s.on(exports.ContainerEventType.Click).take(1).tap(()=>this.close()).attach(this);}).attachToRoot();}getBoundingMask(){return this.ƀgx.getBoundingMask()}close(){if(!this.ƀbd){this.ƀbd=true;let t=n.ƀfy.effect().attach(this);this.ƀp.animate({alpha:0}).chain(this).map(()=>{this.ƀhm.resolve(),t.destroy(),this.destroy();}).chainToRoot();}return this.onClose.toSingleEvent()}};var vi=class extends dt{static{h(this,"MenuEntity");}static subscribeIsOpen(){return actionsLib.ActionLib.merge(this.continuesSubscription().map(t=>t.type==="open"),actionsLib.SingleEvent.instant(this.getInstance()!==void 0))}constructor(t){super(),this.ƀhx=t,queueMicrotask(()=>{if(!this.ƀgy)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀjh(t){this.ƀgy=t,this.ƀgy.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgy.onCreate.toSingleEvent()}onOpen(){return this.ƀgy.onOpen.toSingleEvent()}onClose(){return this.ƀgy.onClose.toSingleEvent()}close(){return this.ƀgy.close()}};var bi=class extends Z{static{h(this,"MenuView");}constructor(t,e,i){super();let s=helpersLib.JsonHelper.removeUndefinedProperties({appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhx.closeOnBackgroundClick}),r=new me(e,s).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀjh(r);let o=new actionsLib.SingleAction;r.onCreate.subscribe(()=>o.resolve(r)).attach(this),this.onCreate=o.notifier,this.onOpen=r.onOpen.notifier,this.onClose=r.onClose.notifier;}};var uo=.65,fo=.01,We=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀjs}get contentSize(){return this.ƀbo.size.ceil()}constructor(t,e,i,s){this.ƀbo=t,this.ƀw=e,this.ƀhz=i,this.ƀkj=s,this.ƀfv=false,this.ƀjs=e-i*2,this.ƀbo.y=i,this.ƀld=i;}onWheel(t){this.setTarget(this.ƀld-t*uo);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀld=helpersLib.NumberHelper.clamp(t,this.ƀw-this.ƀhz-this.contentSize.y,this.ƀhz);}jumpToTarget(){this.ƀbo.y=this.ƀld;}update(t){let e=this.contentSize;if(e.y<=this.ƀjs){switch(this.ƀkj){case "start":this.ƀld=this.ƀhz;break;case "center":this.ƀld=(this.ƀw-e.y)*.5;break;case "end":this.ƀld=this.ƀw-e.y-this.ƀhz;break;default:{this.ƀkj;throw new Error}}this.ƀfv||(this.ƀbo.y=this.ƀld);}this.ƀfv=true;let i=this.ƀld-this.ƀbo.y;this.ƀbo.y=this.ƀbo.y+i*fo*t;}};var yo=15,Pi=class extends d{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbp}get contentSize(){return this.ƀjt.contentSize}constructor(t,e={}){super();let i={padding:yo,smallContentAlign:"start",...e};if(i.padding<0)throw new Error("The padding of the scroll mask cannot be lower than '0'");if(i.padding>t.y*.5)throw new Error("The padding of the scroll mask cannot be higher than half of the size of the area");let s=new d().displayParent(this).attach(this);new Ot(s,t,i.padding).attach(this);let r=new W__namespace.Graphics;r.rect(0,0,t.x,t.y).fill({color:0,alpha:1e-9}),s.ƀiq.addChild(r);let o=new d().displayParent(s).attach(this);this.ƀjt=new We(o,t.y,i.padding,i.smallContentAlign),this.ƀbp=new helpersLib.Vector(t.x,this.ƀjt.scrollHeight),r.eventMode="dynamic",r.addEventListener("wheel",a=>{this.ƀjt.onWheel(a.deltaY);}),o.setInteractive(true),o.ƀiq.addEventListener("wheel",a=>{this.ƀjt.onWheel(a.deltaY);}),g.afterSceneUpdateAction.subscribe(a=>this.ƀjt.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀjt.scrollToTop(),t?.instant&&this.ƀjt.jumpToTarget();}scrollToBottom(t){this.ƀjt.scrollToBottom(),t?.instant&&this.ƀjt.jumpToTarget();}};var Si=class extends d{static{h(this,"LayoutContainer");}constructor(t={}){super(new components.LayoutContainer),this.ƀiq.layout={isLeaf:false,...t};}setLayout(t){return this.ƀiq.layout=t,this}debug(){return this.ƀiq.layout={debug:true},this}debugBackground(){return this.ƀiq.layout={backgroundColor:"#3080FF"},this}};var wo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},F=class extends dt{static{h(this,"CameraEntity");}constructor(){super(...arguments),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.offset=new actionsLib.Variable(helpersLib.Vector.zero),this.targetPosition=new actionsLib.Variable(void 0),this.focusingNewTargetInfo=new actionsLib.Variable(void 0);}};F=wo([It()],F);var xo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},vo=1500,ke=class{static{h(this,"CameraService");}createCamera(){return new F().attachToRoot()}getCameraPosition(){let t=F.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=F.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=F.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??vo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=F.getInstanceOrFail(),s=i.targetPosition.value;s&&(i.focusingNewTargetInfo.value?this.ƀgc(i,s,t):i.position.value=s);}ƀgc(t,e,i){let s=t.focusingNewTargetInfo.value;if(s.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbi(t,e);else {let r=(i-s.time)/s.duration;if(r>=1)this.ƀbi(t,e);else {let o;s.focusingAnimation===exports.FocusingAnimation.EaseInOut?o=U.easeInOut(r):s.focusingAnimation===exports.FocusingAnimation.EaseOut?o=U.easeOut(r):o=1;let a=s.position.lerp(e,o);s.roundPosition&&(Math.abs(a.x-s.position.x)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-s.position.y)>=s.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbi(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};ke=xo([u()],ke);var bo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Po=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ei=class{static{h(this,"CameraController");}constructor(t){this.ƀav=t;}createCamera(){return this.ƀav.createCamera().id}update(t,e){this.ƀav.update(t,e);}setPosition(t){this.ƀav.setPosition(t);}setTransition(t){this.ƀav.setTransition(t);}getCameraPosition(){return this.ƀav.getCameraPosition()}};Ei=bo([lt(exports.CameraGateway),Po("design:paramtypes",[ke])],Ei);var ze=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let s=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(s)}else return t}};var To=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Eo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Gt=class extends Z{static{h(this,"CameraView");}constructor(t){super(),this.ƀdg=t,this.ƀks=(()=>{let e=new d().attach(this);return e.ƀiq=x.instance.ƀip.stage,e})(),this.ƀjn=new d().setAlpha(0).displayParent(this.ƀks).attach(this),this.ƀag=A.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(this.ƀks).attach(this),this.ƀad=new d().displayParent(this.ƀjn).attach(this),this.ƀau=new d().displayParent(this.ƀjn).attach(this),this.ƀds=new d().setSortableChildren(true).displayParent(this.ƀjn).attach(this),this.ƀat=new d().setSortableChildren(true).displayParent(this.ƀau).attach(this),this.ƀdr=new d().setSortableChildren(true).setRenderGroup().setZIndex(20).displayParent(this.ƀat).attach(this),this.ƀgp=new d().setSortableChildren(true).setRenderGroup().setZIndex(10).displayParent(this.ƀat).attach(this),this.ƀac=new d().setRenderGroup().setZIndex(0).displayParent(this.ƀat).attach(this),this.ƀh=new O(this.ƀjn,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀah=new O(this.ƀag,"alpha",{duration:500,animation:b.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),x.instance.screenSize.subscribe(e=>{this.ƀag.aspectRatio=e.x/e.y,this.ƀag.scale=Math.max(e.x,e.y),this.ƀag.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),this.ƀdg.position.subscribe(e=>{this.ƀat.position=this.ƀbv(e);}).attach(this),this.ƀdg.offset.subscribe(e=>{this.ƀau.position=e;}).attach(this),this.ƀah.set({alpha:0}),this.ƀh.set({alpha:0});}screenPositonToStagePosition(t){let e=ze.includeScaleInScreenPosition(t,this.ƀks.scale,x.instance.screenSizeCenter.value);return new helpersLib.Vector(e.x-this.ƀat.position.x-this.ƀau.position.x,e.y-this.ƀat.position.y-this.ƀau.position.y)}getLayers(){return {backgroundScreen:this.ƀad.id,background:this.ƀac.id,main:this.ƀgp.id,foreground:this.ƀdr.id,foregroundScreen:this.ƀds.id}}appear(t,e,i){switch(e){case "alpha":return this.ƀah.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),actionsLib.SingleEvent.instant().async(()=>i>0&&g.wait(i),"tap").async(()=>this.ƀh.animate({alpha:t?1:0})).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀah.set({alpha:t?1:0}),actionsLib.SingleEvent.instant().async(()=>i>0&&g.wait(i),"tap").async(()=>this.ƀah.animate({alpha:t?0:1})).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀah.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error}}}ƀbv(t){return helpersLib.Vector.fromTo(t,x.instance.screenSizeCenter.value)}};Gt=To([oi({entity:F}),Eo("design:paramtypes",[F])],Gt);var Io=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ii=class{static{h(this,"CameraViewController");}getLayers(){let t=F.getInstanceOrFail().id;return Gt.getInstanceOrFail(t).getLayers()}appear(t,e,i){let s=F.getInstanceOrFail().id;return Gt.getInstanceOrFail(s).appear(t,e,i)}screenPositonToStagePosition(t){let e=F.getInstanceOrFail().id;return Gt.getInstanceOrFail(e).screenPositonToStagePosition(t)}};Ii=Io([lt(Bt)],Ii);var Co=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ao=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.KeyboardService=class Ci{static{h(this,"KeyboardService");}constructor(){this.ƀge=new actionsLib.Action,this.keyPressed=this.ƀge.notifier,this.ƀgf=new actionsLib.Action,this.keyReleased=this.ƀgf.notifier,this.ƀgl=new Set,this.ƀgk=new Set,window.addEventListener("keydown",t=>{this.ƀgl.add(t.code),this.ƀgk.add(t.code),!t.repeat&&this.ƀge.trigger({key:t.key,code:t.code});}),window.addEventListener("keyup",t=>{this.ƀgl.delete(t.code),this.ƀgf.trigger({key:t.key,code:t.code});}),window.addEventListener("blur",()=>{this.ƀgl.clear();}),g.afterSceneUpdateAction.subscribe(()=>this.ƀgk.clear()).attachToRoot();}isKeyDown(t,e){return (e?.onlyPressedThisFrame?this.ƀgk:this.ƀgl).has(t)}};exports.KeyboardService=Co([u(),Ao("design:paramtypes",[])],exports.KeyboardService);var Oo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Mo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseService=class we{static{h(this,"MouseService");}constructor(){this.ƀfu=new actionsLib.Variable(false),this.initialMouseMovementHappened=this.ƀfu.notifier,this.ƀkt=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀkt.notifier,this.ƀjp=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀjp.notifier,this.ƀgo=new actionsLib.Variable(false),this.mainButtonState=this.ƀgo.notifier,this.ƀju=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀju.notifier,this.ƀkv(),window.addEventListener("pointerdown",t=>{t.button===0?this.ƀgo.value=true:t.button===2&&(this.ƀju.value=true);},{capture:true}),window.addEventListener("pointerup",t=>{t.button===0?this.ƀgo.value=false:t.button===2&&(this.ƀju.value=false);},{capture:true}),window.addEventListener("blur",()=>{this.ƀgo.value=false,this.ƀju.value=false;},{capture:true});}ƀkv(){let t=helpersLib.Vector.zero;window.addEventListener("pointermove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfu.value=true;},{capture:true}),g.beforeSceneUpdateAction.subscribe(()=>{this.ƀjp.value=this.ƀbc(t);}).attachToRoot(),g.afterSceneUpdateAction.subscribe(()=>{this.ƀkt.value=x.camera.screenPositonToStagePosition(this.ƀjp.value);}).attachToRoot();}ƀbc(t){let i=x.instance.renderer.canvas.getBoundingClientRect(),s=i.width,r=i.height;if(s<=0||r<=0)return helpersLib.Vector.zero;let o=x.instance.renderer.screen,a=(t.x-i.left)/s*o.width,l=(t.y-i.top)/r*o.height;return a=helpersLib.NumberHelper.clamp(a,0,o.width),l=helpersLib.NumberHelper.clamp(l,0,o.height),new helpersLib.Vector(a,l)}};exports.MouseService=Oo([u(),Mo("design:paramtypes",[])],exports.MouseService);var Do=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Bo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)};exports.MouseTargetFocusService=class Ai{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdq}get lastFocusedPosition(){return this.ƀgh}constructor(t){this.ƀhd=t,this.ƀht=new actionsLib.Action,this.onTargetFocus=this.ƀht.notifier,this.ƀlo=0,this.ƀlp=false,this.ƀdq=false,this.ƀgh=void 0,g.beforeSceneUpdateAction.subscribe(e=>this.ƀls(e.delta)).attachToRoot();}ƀls(t){if(this.ƀhe){let e=this.ƀeq(this.ƀhd.stagePosition.value,this.ƀhe);this.ƀie===void 0?this.ƀie=e:this.ƀay(e,t);}this.ƀhe=this.ƀhd.stagePosition.value;}ƀay(t,e){this.ƀie-t>10?(this.ƀlo=Math.max(250,this.ƀlo),this.ƀlp=true):this.ƀlo>1e3&&(this.ƀlp=true);let i=this.ƀlo>=300&&this.ƀlp;this.ƀgd(i,t,e);}ƀgd(t,e,i){(t||e>this.ƀie)&&(this.ƀie=e),t?(this.ƀlp=false,this.ƀlo=0,this.ƀdq=true,this.ƀgh=this.ƀhd.stagePosition.value,this.ƀht.trigger(this.ƀgh)):(this.ƀlo+=i,this.ƀdq=false);}ƀeq(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Do([u(),Bo("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Oi=10.8,Mi=10.01;exports.PhysicsShapeType=void 0;(function(n){n[n.Point=1]="Point",n[n.Circle=2]="Circle",n[n.Polygon=3]="Polygon",n[n.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var m=class n{static{h(this,"P2JSHelper");}static aabbToBoundingBox(t){return helpersLib.Rectangle.fromRect({topLeft:{x:t.lowerBound[0],y:t.lowerBound[1]},bottomRight:{x:t.upperBound[0],y:t.upperBound[1]}})}static arrayToVector(t){return new helpersLib.Vector(t[0],t[1])}static vectorToArray(t){return [t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,s){return (t&s)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(s=>n.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,s.collisionGroup,s.collisionMask)))}static cloneP2Body(t){let e=new X__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var xt="border";var Lo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r};exports.PhysicsGateway=class xe extends ht(){static{h(this,"PhysicsGateway");}};exports.PhysicsGateway=Lo([u()],exports.PhysicsGateway);var Ho=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},vt=class extends ht(){static{h(this,"PhysicsInternalGateway");}};vt=Ho([u()],vt);var S=class n extends Q{static{h(this,"PhysicsEntity");}static{this.ƀhy=new Map;}static{this.ƀii=new Map;}static getFromP2BodyID(t){return n.ƀhy.get(t)}static getFromP2BodyIDOrFail(t){let e=n.ƀhy.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=n.ƀii.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(n.ƀii.values())}get area(){return this.ƀv}get mass(){return this.ƀgs}get collisions(){return this.ƀbe}constructor(t,e,i){super(),this.ƀhn=new actionsLib.Action,this.onCollision=this.ƀhn.notifier,this.type="dynamic",this.ƀv=0,this.ƀgs=0,this.ƀbe=[],this.physicsWorldID=t,this.ƀik=E.get(vt);let s=this.ƀik.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),r=this.ƀik.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀij=this.ƀik.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀil=this.ƀik.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀik.createBody(this.physicsWorldID,e,s,r,this.type),this.ƀv=this.p2Body.getArea(),this.ƀgs=this.p2Body.mass,this.p2Body.position=m.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀik.addBody(this.physicsWorldID,this.p2Body,e.addInEmptySpace,e.shapeDefinition.group,e.includeOnPathfinding))throw new Error("PhysicsEntity was not able to be added to the world!");n.ƀhy.set(this.p2Body.id,this),n.ƀii.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀik.removeBody(this.physicsWorldID,this.p2Body),n.ƀhy.delete(this.p2Body.id),n.ƀii.delete(this.id));}canCollideWith(t){return m.arePhysicsGroupsCollidable(this.ƀij,this.ƀil,t.ƀij,t.ƀil)}ƀjw(t){this.ƀbe=t,t.length>0&&this.ƀhn.trigger(t);}};var ve=class extends S{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=m.arrayToVector(this.p2Body.position),this.rotation=new helpersLib.Radian(this.p2Body.angle);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:helpersLib.Vector.zero,rotationalSpeed:0}}};var Di=class extends Q{static{h(this,"MovableEntity");}constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),g.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀkz(t,e);}).attach(this);}ƀkz(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new helpersLib.Radian(this.rotation.value.value+this.rotationalSpeed.value*e);}};var Bi=class extends S{static{h(this,"MovablePhysicsEntity");}constructor(t,e){super(t,e,"dynamic"),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),this.ƀfn=false,this.ƀfo=false,this.ƀfq=false,this.ƀfp=false,this.ƀif(),this.ƀgm(),E.get(vt).subscribeToPhysicsStep(t,({time:i,delta:s})=>this.ƀkz(i,s)).attach(this);}convertToDTO(){return {entityID:this.id,classID:this.classID,position:this.position.value,rotation:this.rotation.value,velocity:this.velocity.value,rotationalSpeed:this.rotationalSpeed.value}}ƀkz(t,e){this.ƀfn=true,this.ƀfo=true,this.ƀfq=true,this.ƀfp=true,this.ƀif();}ƀif(){this.position.value=m.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=m.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀgm(){this.position.subscribe(t=>{this.ƀfn?this.ƀfn=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfo?this.ƀfo=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfq?this.ƀfq=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfp?this.ƀfp=false:this.p2Body.angularVelocity=t;}).attach(this);}};var $o=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ko=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},P=class extends Q{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,s,r,o,a){super(),this.materialDefinitions=new Map,this.physicsBodyGroupToP2Group=new Map,this.physicsBodyGroupToP2Mask=new Map,this.availabilityGridCache=new Map,this.vectorFieldCache=new Map,this.bodiesInContactWith=new Map,this.collisionReports=new Map,this.paused=new actionsLib.Variable(false),this.lastP2Time=new actionsLib.Variable(0),this.onPhysicsStep=new actionsLib.Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=s,this.materialDefinitions=r,this.physicsBodyGroupToP2Group=o,this.physicsBodyGroupToP2Mask=a;}};P=$o([It(),ko("design:paramtypes",[helpersLib.Vector,Boolean,X__default.default.World,Map,Map,Map,Map])],P);var Xo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},st=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,s=new Map;return t.map((r,o)=>{if(o>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(r,1<<o),s.set(r,0);}),e.map(([r,o])=>{if(!i.has(r))throw new Error(`Physics body group "${r}" not found`);if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);let a=s.get(r),l=s.get(o),c=i.get(r),p=i.get(o);s.set(r,a|p),s.set(o,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:s}}getGroupConstant(t,e){return P.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return P.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let s=t.physicsBodyGroupToP2Group.get(e),r=t.physicsBodyGroupToP2Mask.get(e),o=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (r&o)!==0&&(a&s)!==0}};st=Xo([u()],st);var Ko=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Zo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Xe=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀih=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((s,r)=>{s.forEach((o,a)=>{this.ƀih.canCollide(t,a,e)&&i.push({grid:o,cellSize:r});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,s){let r=t.availabilityGridCache.get(e);r||(r=new Map,t.availabilityGridCache.set(e,r)),r.set(i,s);}clear(t){t.availabilityGridCache.clear();}};Xe=Ko([u(),Zo("design:paramtypes",[st])],Xe);var Qo=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},qo=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},bt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀih=t,this.ƀaa=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let s=m.aabbToBoundingBox(e.aabb);this.ƀaa.getCollidableGrids(t,i).forEach(r=>{let o=_.areaToGridArea(s,r.cellSize);r.grid.setArea(o,false);});}findClosestAvailableSpace(t,e,i,s=50){return e.aabbNeedsUpdate=true,e.updateAABB(),ne.findByConvertingGridSpace(this.getAvilabilityGrid(t,s,i),m.aabbToBoundingBox(e.aabb),s)}getAvilabilityGrid(t,e,i){let s=this.ƀaa.get(t,e,i);return s||(s=this.ƀcd(t,e,i),this.ƀaa.set(t,e,i,s)),s}ƀcd(t,e,i){let s=new helpersLib.Grid({size:new helpersLib.Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:true});return t.p2World.bodies.forEach(r=>{let o=S.getFromP2BodyIDOrFail(r.id);if(o.includeInPathfinding&&this.ƀih.canCollide(t,o.physicsBodyGroup,i)){let a=this.ƀeh(r,e);s.setArea(a,false);}}),s}ƀeh(t,e){let i=m.aabbToBoundingBox(t.aabb);return _.areaToGridArea(i,e)}};bt=Qo([u(),qo("design:paramtypes",[st,Xe])],bt);var rn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},sn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Kt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀig=t;}findPathAStar(t,e,i,s,r){r||(r={}),r.neighborType===void 0&&(r.neighborType="orthogonal"),r.gridCellSize===void 0&&(r.gridCellSize=50);let o=P.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=S.getPhysicsInstanceOrFail(i).p2Body,a=m.arrayToVector(l.position)):a=i;let c=_.positionToGridPosition(e,r.gridCellSize),p=_.positionToGridPosition(a,r.gridCellSize),f=this.ƀig.getAvilabilityGrid(o,r.gridCellSize,s);if(l){let v=m.aabbToBoundingBox(l.aabb),w=_.areaToGridArea(v,r.gridCellSize);f.setArea(w,true);}let y=ae.findPath(f,c,p,r.neighborType);return y.path=y.path.map(v=>_.gridPositionToPosition(v,r.gridCellSize)),y}findPathDirection(t,e,i,s,r=50){let o=P.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let y=S.getPhysicsInstanceOrFail(i);a=m.aabbToBoundingBox(y.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=_.areaToGridArea(a,r),c=JSON.stringify({targetGridArea:l,collidableWithGroup:s}),p=o.vectorFieldCache.get(c);if(!p){let y=this.ƀig.getAvilabilityGrid(o,r,s);p=new he(l,y),o.vectorFieldCache.set(c,p);}let f=_.positionToGridPosition(e,r);return p.getDirectionToTarget(f)}};Kt=rn([u(),sn("design:paramtypes",[bt])],Kt);var nn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},an=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},nt=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀab=t,this.ƀia=e;}printPathfindingTestGrid(t,e,i,s,r,o){let a=P.getInstanceByIDOrFail(t);this.ƀab.getAvilabilityGrid(a,o,s).map((c,p)=>({position:_.gridPositionToPosition(p,o),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(r)){let p=this.ƀia.findPathDirection(t,c.position,i,s),f;p===void 0?f=A.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):f=A.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new O(f,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>f.destroy()).attach(f);}});}createExplosionDebugVisual(t,e,i,s,r,o=300){let a=new d().displayParent(e).setAlpha(.5).attach(t);A.createCircle(r,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(s,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(s,c.line.to,p).toSprite().displayParent(a).attach(t);}),new O(a,"alpha",{duration:o,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,s,r,o,a=300){let l=new d().displayParent(e).setAlpha(.5).attach(t);A.createElipse(o,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attach(t),i.forEach(p=>{let f=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;A.createVector(p.line.from,p.line.to,f).toSprite().displayParent(l).attach(t);}),new O(l,"alpha",{duration:a,animation:b.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let s=i?.overridePosition??m.arrayToVector(t.position),r=i?.overrideRotation??new helpersLib.Radian(t.angle),o=i?.color??helpersLib.ColorHelper.blue,a=new d().displayParent(e).setPosition(s,{round:false}).setRotation(r).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcz(c,o).displayParent(a).attachToRoot();}),new O(a,"alpha",{duration:1e3,animation:b.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcz(t,e){switch(t.type){case X__default.default.Shape.PARTICLE:throw new Error("Not implemented");case X__default.default.Shape.LINE:throw new Error("Not implemented");case X__default.default.Shape.PLANE:throw new Error("Not implemented");case X__default.default.Shape.CIRCLE:throw new Error("Not implemented");case X__default.default.Shape.CAPSULE:throw new Error("Not implemented");case X__default.default.Shape.BOX:throw new Error("Not implemented");case X__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case X__default.default.Shape.CONVEX:return this.ƀcy(t,e);default:{t.type;throw new Error}}}ƀcy(t,e){let i=[t.vertices.map(s=>({x:s[0],y:s[1]}))];return A.createPolygon(i,e).toSprite()}};nt=nn([u(),an("design:paramtypes",[bt,Kt])],nt);var cn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},pn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Ke=class{static{h(this,"HitTestService");}constructor(t){this.ƀlh=t;}hitTest(t,e){let i=t.world,s=S.getFromP2BodyIDOrFail(t.id),r=m.cloneP2Body(t);this.ƀt(r,e);let o=i.broadphase.aabbQuery(i,this.ƀdv(r)).map(l=>S.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>s.canCollideWith(l)).map(l=>m.cloneP2Body(l.p2Body)),a=false;if(o.length!==0){let l=new X__default.default.World;l.addBody(r),o.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===r||c.bodyB===r),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀlh.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=m.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdv(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Ke=cn([u(),pn("design:paramtypes",[nt])],Ke);var fn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Ze=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀjg(t,i);});});}step(t,e,i){S.getPhysicsEntities().forEach(s=>{s.ƀbe=[];}),t.p2World.narrowphase.contactEquations.forEach(s=>{this.ƀjg(t,s);}),t.bodiesInContactWith.forEach((s,r)=>{this.ƀfd(s.p2Body),s.entity.ƀjw(t.collisionReports.get(r)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀfd(t){let e=m.arrayToVector(t.velocity);e.length>Oi&&(e=e.normalize(Oi),t.velocity=m.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Mi),Mi);}ƀjg(t,e){let i=S.getFromP2BodyID(e.bodyA.id),s=S.getFromP2BodyID(e.bodyB.id);if(i&&s){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:s});let r=t.collisionReports.get(e.bodyA.id)||[],o=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀea(i,s,e);r.push({self:a,target:l}),o.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,r),t.collisionReports.set(e.bodyB.id,o);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀea(t,e,i){let s=t.convertToDTO(),r=e.convertToDTO(),o=m.arrayToVector(i.contactPointA),a=m.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀeo(i);return {collisionDetailsA:this.ƀdz(s,i.bodyA.mass,o,l,t.area),collisionDetailsB:this.ƀdz(r,i.bodyB.mass,a,c,e.area)}}ƀdz(t,e,i,s,r){let o,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(o||(o=i.rotate(t.rotation.multiply(-1).vector)),o),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:r,normal:s}}ƀeo(t){let e=m.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ze=fn([u()],Ze);var dn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},mn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Qe=class extends ve{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};Qe=dn([It(),mn("design:paramtypes",[Number,Object])],Qe);var yn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Y=1e4,qe=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbx(t,new helpersLib.Vector(e.x/2,-Y/2),new helpersLib.Vector(e.x+Y*2,Y),i),this.ƀbx(t,new helpersLib.Vector(e.x/2,e.y+Y/2),new helpersLib.Vector(e.x+Y*2,Y),i),this.ƀbx(t,new helpersLib.Vector(-Y/2,e.y/2),new helpersLib.Vector(Y,e.y+Y*2),i),this.ƀbx(t,new helpersLib.Vector(e.x+Y/2,e.y/2),new helpersLib.Vector(Y,e.y+Y*2),i);}ƀbx(t,e,i,s){return new Qe(t,{shapeDefinition:{materialName:xt,group:s,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};qe=yn([u()],qe);var wn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Pr=new X__default.default.Material,xn={id:xt,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Zt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,s){let r=new Map,o=new Map;if(i.forEach(a=>{r.set(a.id,new X__default.default.Material),o.set(a.id,a);}),r.has(xt))throw new Error(`Material with name ${xt} cannot be defined, pick another name for the material.`);return r.set(xt,Pr),o.set(xt,xn),this.ƀc(t,e,i,s,r),{materials:r,materialDefinitions:o}}getMaterial(t,e){let i=P.getInstanceByIDOrFail(t);return this.ƀen(e,i.materials)}getMaterialDefinition(t,e){let i=P.getInstanceByIDOrFail(t);return this.ƀem(e,i.materialDefinitions)}ƀen(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀem(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material definition with name ${t}.`);return i}ƀc(t,e,i,s,r){this.ƀee(i.map(o=>o.id),s).forEach(o=>{let a=this.ƀen(o.materialA,r),l=this.ƀen(o.materialB,r);t.addContactMaterial(new X__default.default.ContactMaterial(a,l,{friction:o.friction,restitution:o.bounciness,stiffness:o.stiffness,relaxation:o.relaxation}));}),this.ƀd(t,e,i,r);}ƀee(t,e){let i=new Map;e.forEach(r=>{let o=i.get(r.materialA);o||(o=new Map,i.set(r.materialA,o)),o.set(r.materialB,r);});let s=[];return t.forEach((r,o)=>{for(let a=o;a<t.length;a++){let l=t[a],c=i.get(r)?.get(l);c?s.push(c):s.push({materialA:r,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),s}ƀd(t,e,i,s){i.forEach(r=>{let o=this.ƀen(r.id,s);t.addContactMaterial(new X__default.default.ContactMaterial(o,Pr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Zt=wn([u()],Zt);var vn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},bn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Qt=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,s,r){this.ƀgw=t,this.ƀal=e,this.ƀab=i,this.ƀbf=s,this.ƀih=r;}createPhysicsWorld(t){let e=new X__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:s}=this.ƀgw.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:r,physicsBodyGroupToP2Mask:o}=this.ƀih.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new P(t.mapSize,t.modifyUpdateCycle,e,i,s,r,o).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&g.cleanUpdateModifier();}).attachToRoot(),this.ƀal.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀbf.registerPhysicsWorld(a),t.modifyUpdateCycle?g.registerUpdateModifier((l,c)=>this.ƀkz(a,l,c)):g.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀkz(a,l,c);}).attach(a),a.id}addBody(t,e,i,s,r){let o=P.getInstanceByIDOrFail(t);if(i){let a=this.ƀab.findClosestAvailableSpace(o,e,s);return a?(e.position[0]+=a.x,e.position[1]+=a.y,o.p2World.addBody(e),r&&this.ƀab.onBodyAdded(o,e,s),true):false}else return o.p2World.addBody(e),r&&this.ƀab.onBodyAdded(o,e,s),true}removeBody(t,e){P.getInstanceByID(t)?.p2World.removeBody(e);}ƀkz(t,e,i){if(!t.paused.value){t.availabilityGridCache.clear(),t.vectorFieldCache.clear(),t.p2World.step(i,i,i),t.modifyUpdateCycle&&(i=t.p2World.time-t.lastP2Time.value);let s=e+i;this.ƀbf.step(t,s,i),t.onPhysicsStep.trigger({time:s,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){P.getInstanceByIDOrFail(e).paused.set(t);}};Qt=vn([u(),bn("design:paramtypes",[Zt,qe,bt,Ze,st])],Qt);var Sn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},te=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let s=new X__default.default.RaycastResult,r=new X__default.default.Ray({mode:X__default.default.Ray.CLOSEST,from:m.vectorToArray(e.from),to:m.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(s,r),s.hasHit())return this.ƀbs(s,e)}castAllFirstContacts(t,e,i){let s=new Map,r=new X__default.default.Ray({mode:X__default.default.Ray.ALL,from:m.vectorToArray(e.from),to:m.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:h(o=>{let a=s.get(o.body);!s.has(o.body)||o.fraction<a.fraction?s.set(o.body,this.ƀbs(o,e)):o.fraction===a.fraction&&a.isExternal()&&s.set(o.body,this.ƀbs(o,e));},"callback")});return t.p2World.raycast(new X__default.default.RaycastResult,r),Array.from(s.values())}ƀbs(t,e){let i=t.fraction,s=m.arrayToVector(t.normal),r,o,a;return {body:t.body,hitPosition:h(()=>(r===void 0&&(r=e.from.lerp(e.to,i)),r),"hitPosition"),hitDistance:h(()=>(o===void 0&&(o=e.length*i),o),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(s)<0),a),"isExternal"),normal:s,fraction:i,line:e}}};te=Sn([u()],te);var Tn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Tt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,s){let r=i.normalize(s),o=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(m.vectorToArray(r),o);}};Tt=Tn([u()],Tt);var En=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ee=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(s=>{s.hits.forEach(r=>{let o=i.get(r.body);if(o){let a=r.fraction<o.closestRaycastHit.fraction?r:o.closestRaycastHit;o.rayCastHits.push(r),i.set(r.body,{hitCount:o.hitCount+1,closestRaycastHit:a,rayCastHits:o.rayCastHits,isExternal:e?o.isExternal:o.isExternal&&r.isExternal(),explosionCenter:r.line.from});}else {let a=r.isExternal();i.set(r.body,{hitCount:1,closestRaycastHit:r,rayCastHits:[r],isExternal:a,explosionCenter:r.line.from});}});}),[...i.values()].map(s=>this.ƀbt(s,t.length))}ƀbt(t,e){let i=t.hitCount/e,s=t.rayCastHits;if(t.isExternal)return {body:S.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:s,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let r=m.arrayToVector(t.closestRaycastHit.body.position);return {body:S.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(r,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:s,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};ee=En([u()],ee);var In=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Cn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Mn=15,ei=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,s){this.ƀjc=t,this.ƀlh=e,this.ƀjb=i,this.ƀfr=s;}createElipticExplosion(t,e,i,s,r,o,a){let l=P.getInstanceByIDOrFail(t),c=this.ƀci(e,i,s,r,a?.hitOnlyClosest===true,l),p=this.ƀjb.toExplosionHits(c,false);return this.ƀr(p,o),a?.testLayerID&&this.ƀlh.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,s,a.debugRayDuration),p.map(f=>{let{p2Body:y,...v}=f;return v})}ƀci(t,e,i,s,r,o){let a=[],l=e.vector,c=e.add(helpersLib.Radian.get90).vector,p=c.normalize(i.x);a.push(new helpersLib.Line(t,t.add(p))),a.push(new helpersLib.Line(t,t.add(p.multiplyNumber(-1))));let f=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(f))),a.push(new helpersLib.Line(t,t.add(f.multiplyNumber(-1))));let y=Math.round(i.y/Mn),v=i.y/(y*2+1)*2,w=l.normalize(v),M=i.x,L=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(y).forEach(I=>{let K=v*(I+1),_t=w.multiplyNumber(I+1),$=c.normalize(this.ƀev(M,L,K)),H=t.add(_t);a.push(new helpersLib.Line(H,H.add($))),a.push(new helpersLib.Line(H,H.add($.multiplyNumber(-1))));let j=t.add(_t.multiplyNumber(-1));a.push(new helpersLib.Line(j,j.add($))),a.push(new helpersLib.Line(j,j.add($.multiplyNumber(-1))));}),a.map(I=>{if(r){let K=this.ƀjc.castClosest(o,I,s);return {line:I,hits:K?[K]:[]}}else {let K=this.ƀjc.castAllFirstContacts(o,I,s);return {line:I,hits:K}}})}ƀev(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(s=>{let r,o;s.isExternal()?(r=s.line.fromTo,o=e*2):(r=s.line.fromTo.multiplyNumber(-1),o=e*(1-s.fraction)*8),this.ƀfr.applyImpulse(s.body,s.hitPosition(),r,o);});});}};ei=In([u(),Cn("design:paramtypes",[te,nt,ee,Tt])],ei);var Dn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Bn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},ii=class{static{h(this,"ExplosionService");}constructor(t,e,i,s){this.ƀjc=t,this.ƀlh=e,this.ƀjb=i,this.ƀfr=s;}createExplosion(t,e,i,s,r,o){let a=P.getInstanceByIDOrFail(t),l=this.ƀet(i),c=this.ƀci(e,i,s,l,o?.hitOnlyClosest===true,a),p=this.ƀjb.toExplosionHits(c);return this.ƀr(e,i,r,l,p),o?.testLayerID&&this.ƀlh.createExplosionDebugVisual(a,o.testLayerID,c,e,i,o.debugRayDuration),p}ƀci(t,e,i,s,r,o){let a=new helpersLib.Radian(helpersLib.PI_360/s),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(s).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(r){let f=this.ƀjc.castClosest(o,p,i);return {line:p,hits:f?[f]:[]}}else {let f=this.ƀjc.castAllFirstContacts(o,p,i);return {line:p,hits:f}}})}ƀr(t,e,i,s,r){r.forEach(o=>{if(o.isExternal)o.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfr.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,m.arrayToVector(o.p2Body.position)),l=a.length/e,c=i*s*l/2;this.ƀfr.applyImpulse(o.p2Body,o.getHitPosition(),a,c);}});}ƀet(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};ii=Dn([u(),Bn("design:paramtypes",[te,nt,ee,Tt])],ii);var Fn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ie=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=P.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return P.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};ie=Fn([u()],ie);var Ln=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Hn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},Gi=class{static{h(this,"PhysicsController");}constructor(t,e,i,s,r,o,a,l){this.ƀio=t,this.ƀia=e,this.ƀlh=i,this.ƀdk=s,this.ƀdd=r,this.ƀfj=o,this.ƀin=a,this.ƀfr=l;}createPhysicsWorld(t){return this.ƀio.createPhysicsWorld(t)}getMapSize(t){return this.ƀin.getMapSize(t)}setPaused(t,e){this.ƀio.setPaused(t,e);}hitTest(t,e){let i=S.getPhysicsInstanceOrFail(t);return this.ƀfj.hitTest(i.p2Body,e)}findPath(t,e,i,s,r){return this.ƀia.findPathAStar(t,e,i,s,{neighborType:r})}findPathDirection(t,e,i,s){return this.ƀia.findPathDirection(t,e,i,s)}applyImpulse(t,e,i,s){let r=S.getPhysicsInstanceOrFail(t);this.ƀfr.applyImpulse(r.p2Body,e,i,s);}createExplosion(t,e,i,s,r,o){return this.ƀdk.createExplosion(t,e,i,s,r,o)}createElipticExplosion(t,e,i,s,r,o,a){return this.ƀdd.createElipticExplosion(t,e,i,s,r,o,a)}printPathfindingTestGrid(t,e,i,s,r,o=50){this.ƀlh.printPathfindingTestGrid(t,e,i,s,r,o);}};Gi=Ln([lt(exports.PhysicsGateway),Hn("design:paramtypes",[Qt,Kt,nt,ii,ei,Ke,ie,Tt])],Gi);var jn=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},ri=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,s,r){let o=P.getInstanceByIDOrFail(t);if(!o.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case exports.PhysicsShapeType.Point:return this.ƀbz(o,void 0,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Circle:return this.ƀbz(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Polygon:return this.ƀch(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);case exports.PhysicsShapeType.Rectangle:return this.ƀcj(o,e.shapeDefinition.shapeData,i,s,e.shapeDefinition.group,r);default:{e.shapeDefinition.shapeType;throw new Error}}}ƀbz(t,e,i,s,r,o){let a=new X__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r),radius:e});a.material=i;let l=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:s.density,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return l.addShape(a),l}ƀch(t,e,i,s,r,o){let a=t.physicsBodyGroupToP2Group.get(r),l=t.physicsBodyGroupToP2Mask.get(r),c=e.map(y=>new X__default.default.Convex({vertices:y.map(v=>[v.x,v.y]),collisionGroup:a,collisionMask:l})).map(y=>(y.material=i,y)),p=c.reduce((y,v)=>y+v.area,0),f=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:p,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.forEach(y=>f.addShape(y)),f.setDensity(s.density),f}ƀcj(t,e,i,s,r,o){let a=new X__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(r),collisionMask:t.physicsBodyGroupToP2Mask.get(r)});a.material=i;let l=e.x*e.y,c=new X__default.default.Body({type:o==="dynamic"?X__default.default.Body.DYNAMIC:X__default.default.Body.STATIC,mass:l,damping:s.velocityDrag,angularDamping:s.rotationalDrag});return c.addShape(a),c.setDensity(s.density),c}};ri=jn([u()],ri);var Un=function(n,t,e,i){var s=arguments.length,r=s<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(n,t,e,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(r=(s<3?o(r):s>3?o(t,e,r):o(t,e))||r);return s>3&&r&&Object.defineProperty(t,e,r),r},Wn=function(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)},_i=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,s,r){this.ƀio=t,this.ƀim=e,this.ƀkg=i,this.ƀin=s,this.ƀih=r;}createBody(t,e,i,s,r){return this.ƀkg.createBody(t,e,i,s,r)}getMaterial(t,e){return this.ƀim.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀim.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀih.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀih.getMaskConstant(t,e)}addBody(t,e,i,s,r){return this.ƀio.addBody(t,e,i,s,r)}removeBody(t,e){this.ƀio.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀin.subscribeToPhysicsStep(t,e)}};_i=Un([lt(vt),Wn("design:paramtypes",[Qt,Zt,ri,ie,st])],_i);exports.AdvancedSound=wt;exports.AnimationFlicker=Fi;exports.AnimationInterpolationFunctions=U;exports.Animations=b;exports.Animator=O;exports.BORDER_MATERIAL_NAME=xt;exports.BardLegendsTestingHelper=T;exports.Camera=le;exports.ClosestAvailableSpaceHelper=ne;exports.Container=d;exports.ControllerDecorator=lt;exports.DEFAULT_SHADER_RESOLUTION=k;exports.DeltaTime=pi;exports.DisplayObjectArray=wi;exports.Entity=Q;exports.EntityDecorator=It;exports.FadeInContent=Ji;exports.Game=x;exports.Gateway=ht;exports.Graphics=A;exports.ImmovablePhysicsEntity=ve;exports.LayoutContainer=Si;exports.MenuEntity=vi;exports.MenuUI=me;exports.MenuView=bi;exports.MovableEntity=Di;exports.MovablePhysicsEntity=Bi;exports.Music=pe;exports.MusicPlayer=di;exports.PathFinder=ae;exports.PhysicsEntity=S;exports.Placeholder=mi;exports.ROTATIONAL_SPEED_LIMIT=Mi;exports.RichText=yi;exports.SOUND_TRANSITION_DURATION=rt;exports.SPEED_LIMIT=Oi;exports.Scene=Vt;exports.SceneDecorator=Vr;exports.ScrollAreaUI=Pi;exports.ScrollMaskUI=Ot;exports.Service=E;exports.ServiceDecorator=u;exports.SingletonEntity=dt;exports.SlideInContent=qi;exports.SlideInContentByIndex=ci;exports.SlideStateAnimation=De;exports.Sound=ce;exports.Sprite=et;exports.StateAnimation=jt;exports.Text=de;exports.ThroughEmptyStateAnimation=Re;exports.UpdatableContainer=gi;exports.UpdateCycle=g;exports.VectorFieldPathFinder=he;exports.VectorSet=oe;exports.View=Z;exports.ViewDecorator=oi;
|