bard-legends-framework 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Vr=Object.create;var Se=Object.defineProperty;var Nr=Object.getOwnPropertyDescriptor;var jr=Object.getOwnPropertyNames;var Hr=Object.getPrototypeOf,Wr=Object.prototype.hasOwnProperty;var h=(o,t)=>Se(o,"name",{value:t,configurable:!0});var Ur=(o,t)=>{for(var e in t)Se(o,e,{get:t[e],enumerable:!0})},ar=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of jr(t))!Wr.call(o,r)&&r!==e&&Se(o,r,{get:()=>t[r],enumerable:!(i=Nr(t,r))||i.enumerable});return o};var C=(o,t,e)=>(e=o!=null?Vr(Hr(o)):{},ar(t||!o||!o.__esModule?Se(e,"default",{value:o,enumerable:!0}):e,o)),$r=o=>ar(Se({},"__esModule",{value:!0}),o);var to={};Ur(to,{AnimationFlicker:()=>Ji,AnimationInterpolationFunctions:()=>K,Animations:()=>S,AnimationsCompletionHandlingType:()=>O,Animator:()=>D,BORDER_MATERIAL_NAME:()=>ut,BardLegendsHardReset:()=>G,BlendMode:()=>Bt,Camera:()=>ie,CameraGateway:()=>Lt,ClosestAvailableSpaceHelper:()=>pe,Container:()=>u,ContainerEventType:()=>Kt,ControllerDecorator:()=>st,ControllerLink:()=>k,Cursor:()=>ri,DEFAULT_RESOLUTION:()=>A,DeltaTime:()=>Fi,DisplayObjectArray:()=>Ri,Entity:()=>J,EntityDecorator:()=>vt,FadeInContent:()=>er,FadeInStateAnimation:()=>Le,FocusingAnimation:()=>ft,Game:()=>w,Graphics:()=>R,ImmovablePhysicsEntity:()=>Yt,KeyboardService:()=>Di,Menu:()=>Ht,MenuEntity:()=>Ai,MouseService:()=>Ct,MouseTargetFocusService:()=>Bi,MouseWheelListenerUI:()=>ce,MovableEntity:()=>Qe,MovablePhysicsEntity:()=>qe,PathFinder:()=>de,PhysicsEntity:()=>b,PhysicsGateway:()=>Ni,PhysicsShapeType:()=>nt,Placeholder:()=>vi,PositionConversionHelper:()=>te,ROTATIONAL_SPEED_LIMIT:()=>ei,ReAnimateHandlingType:()=>F,RichText:()=>Ti,SPEED_LIMIT:()=>ti,Scene:()=>Ot,SceneDecorator:()=>lr,ScrollAreaUI:()=>Mi,ScrollDirection:()=>ht,ScrollMaskUI:()=>Tt,Service:()=>P,ServiceDecorator:()=>d,SingletonEntity:()=>bt,SlideInContent:()=>ir,SlideInContentByIndex:()=>Gi,SlideStateAnimation:()=>We,SlideStateAnimationState:()=>lt,Sprite:()=>q,StateAnimation:()=>Ne,Text:()=>he,UpdatableContainer:()=>Ei,UpdateCycle:()=>y,VectorFieldPathFinder:()=>fe,VectorSet:()=>Rt,View:()=>kt,ViewDecorator:()=>Xe});module.exports=$r(to);var Ye=require("actions-lib");var G=class{static{h(this,"BardLegendsHardReset")}static{this.ƀeq=new Ye.Action}static{this.onHardReset=this.ƀeq.notifier}static hardReset(){Ye.ActionLib.hardReset(),this.ƀeq.trigger()}};var oo=require("reflect-metadata");function d(){return function(o){let t=P.ƀea(o);o.$meta={paramtypes:t,type:"service"}}}h(d,"ServiceDecorator");var P=class{static{h(this,"Service")}static{this.ƀio=new Map}static get(t){let e=this.ƀio.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀia([],t.$meta.paramtypes);e=new t(...i),this.ƀio.set(t,e)}return e}static ƀea(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀia(t,e){let i=[...t];if(e.length>t.length){let s=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...s)}return i}};G.onHardReset.subscribe(()=>{P.ƀio=new Map}).attachToRoot();var k=class{static{h(this,"ControllerLink")}constructor(){this.ƀbl=[],this.ƀhz=[]}trigger(t,...e){let i=this.ƀbl.find(r=>!!r[t]);if(i)return i[t](...e);throw new Error(`ServiceLink: no defined function with the name: "${t}", found in the linked controllers!`)}registerController(t){Reflect.ownKeys(t.constructor.prototype).filter(e=>e!=="constructor").map(e=>e.toString()).forEach(e=>{if(this.ƀhz.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀhz.push(e)}),this.ƀbl.push(t)}};function st(o){return function(t){let e=P.ƀea(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else{let i=P.ƀia([],e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);o.controllerLink.registerController(r)}t.$meta={type:"controller"}}}h(st,"ControllerDecorator");var hr=require("actions-lib");var $t=require("actions-lib");var y=class o{static{h(this,"UpdateCycle")}static{this.ƀac=new $t.Action}static{this.beforeSceneUpdateAction=this.ƀac.notifier}static{this.ƀig=new $t.Action}static{this.sceneUpdateAction=this.ƀig.notifier}static{this.ƀf=new $t.Action}static{this.afterSceneUpdateAction=this.ƀf.notifier}static{this.ƀjr=0}static{this.ƀjy=void 0}static wait(t){let e=this.ƀjr+t;return $t.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i()}).attachToRoot();return()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀjy)this.ƀjy=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀjy=void 0}static triggerUpdateTick(t){this.ƀjy&&(t=this.ƀjy(this.ƀjr,t)),this.ƀjr+=t,this.ƀfo=t,t>0&&(o.ƀac.trigger({time:this.ƀjr,delta:t}),o.ƀig.trigger({time:this.ƀjr,delta:t}),o.ƀf.trigger({time:this.ƀjr,delta:t}))}static get lastDelta(){return this.ƀfo}static{this.ƀfo=0}};G.onHardReset.subscribe(()=>{y.ƀac.clear(),y.ƀig.clear(),y.ƀf.clear(),y.ƀjy=void 0,y.ƀjr=0}).attachToRoot();var V=class o{static{h(this,"EntityStoreHelper")}static{this.ƀav=new Map}static registerEntityClass(t){this.ƀav.set(t.id,new Map)}static registerEntity(t){this.ƀav.get(t.classID).set(t.id,t)}static unregisterEntity(t,e){let i=t.id;this.ƀav.get(i)?.delete(e)}static getEntity(t,e){return this.ƀav.get(t.id)?.get(e)}static getSingleton(t){let e=o.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.ƀav.get(t.id);return Array.from(e.values())}};G.onHardReset.subscribe(()=>{V.ƀav.clear()}).attachToRoot();var xt=class o{static{h(this,"EntityViewsHelper")}static{this.ƀkh=new Map}static registerView(t,e){o.ƀkh.has(e)||o.ƀkh.set(e,[]);let i=o.ƀkh.get(e);i&&i.push(t),V.getEntities(e).forEach(s=>{this.ƀcg(s,t)})}static ƀcg(t,e){try{let i=P.ƀia([this],e.$meta.paramtypes);o.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkg.ƀki.push(r)}catch(i){console.error(i)}}constructor(t){this.ƀcu=t,this.ƀki=[]}createViews(){if(!this.ƀcu.destroyed){let t=o.ƀkh.get(this.ƀcu.constructor);t&&t.forEach(e=>{o.ƀcg(this.ƀcu,e)})}}updateViews(t,e){for(let i=0;i<this.ƀki.length;i++){let r=this.ƀki[i];r.destroyed||r.update(t,e)}}destroyViews(){this.ƀki.forEach(t=>{t.destroy()})}};G.onHardReset.subscribe(()=>{xt.ƀkh=new Map}).attachToRoot();function vt(){return function(o){o.$meta={type:"entity"},V.registerEntityClass(o)}}h(vt,"EntityDecorator");var J=class extends hr.IDAttachable{static{h(this,"Entity")}static getInstanceByID(t){if(t)return V.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=V.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return V.getEntities(this)}constructor(){super(),this.ƀkg=new xt(this),V.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkg.updateViews(t.time,t.delta))}).attach(this)}destroy(){this.destroyed||(this.ƀkg.destroyViews(),V.unregisterEntity(this.constructor,this.id),super.destroy())}attach(t){return super.attach(t),this.ƀkg.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkg.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkg.createViews(),this}update(t,e){}};var bt=class extends J{static{h(this,"SingletonEntity")}static getInstance(){return V.getSingleton(this)}static getInstanceOrFail(){return V.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}"`)}};var zt=require("actions-lib");function lr(){return function(o){return o.$meta={paramtypes:P.ƀea(o),type:"scene"},o}}h(lr,"SceneDecorator");var Ot=class o extends zt.IDAttachable{static{h(this,"Scene")}static{this.ƀif=!1}static{this.ƀb=new zt.Variable(void 0)}static{this.activeScene=this.ƀb.notifier}static getActiveScene(){return o.ƀb.value}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀif)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀif=!0;let i=P.ƀia([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀif=!1,r)).chainToRoot()}constructor(){super(),this.ƀgk=new zt.Action,this.onClose=this.ƀgk.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this)}close(...t){if(o.ƀb.value!==this)throw o.ƀif?new Error("Scene: you cannot close a scene while a scene is transitioning!"):new Error("Internal Error: Scene instance is accessed while it is not the active scene!");let e=t[0];return o.ƀif=!0,this.prepareToClose().map(()=>(super.destroy(),o.ƀb.set(void 0),o.ƀif=!1,this.ƀgk.trigger(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{Ot.ƀb.set(void 0)}).attachToRoot();var cr=require("actions-lib");function Xe(o){return function(t){t.$meta={paramtypes:P.ƀea(t),viewInstances:new Map,entity:o.entity,type:"view"},xt.registerView(t,o.entity)}}h(Xe,"ViewDecorator");var kt=class extends cr.IDAttachable{static{h(this,"View")}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.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.attachToRoot(),this.ƀcv=xt.entityID,this.ƀeg().set(this.ƀcv,this)}destroy(){this.destroyed||(super.destroy(),this.ƀeg().delete(this.ƀcv))}update(t,e){}ƀeg(){return this.constructor.$meta.viewInstances}};var Ke=require("helpers-lib");var Ze=require("helpers-lib"),pr=C(require("p2"));var m=class o{static{h(this,"P2JSHelper")}static aabbToBoundingBox(t){return Ze.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 Ze.Vector(t[0],t[1])}static vectorToArray(t){return[t.x,t.y]}static arePhysicsGroupsCollidable(t,e,i,r){return(t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new pr.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var dr=require("actions-lib");var zr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ot=new k,Jt=class{static{h(this,"PhysicsInternalGateway")}createBody(t,e,i,r,s){return ot.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return ot.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return ot.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return ot.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return ot.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return ot.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return ot.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return ot.trigger("subscribeToPhysicsStep",t,e)}};Jt=zr([d()],Jt);var b=class o extends J{static{h(this,"PhysicsEntity")}static{this.ƀgy=new Map}static{this.ƀhf=new Map}static getFromP2BodyID(t){return o.ƀgy.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀgy.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhf.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhf.values())}get area(){return this.ƀt}get mass(){return this.ƀga}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgl=new dr.Action,this.onCollision=this.ƀgl.notifier,this.type="dynamic",this.ƀt=0,this.ƀga=0,this.ƀax=[],this.physicsWorldID=t,this.ƀhh=P.get(Jt);let r=this.ƀhh.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhh.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhg=this.ƀhh.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhi=this.ƀhh.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhh.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀga=this.p2Body.mass,this.p2Body.position=m.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhh.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!");o.ƀgy.set(this.p2Body.id,this),o.ƀhf.set(this.id,this)}destroy(){this.destroyed||(super.destroy(),this.ƀhh.removeBody(this.physicsWorldID,this.p2Body),o.ƀgy.delete(this.p2Body.id),o.ƀhf.delete(this.id))}canCollideWith(t){return m.arePhysicsGroupsCollidable(this.ƀhg,this.ƀhi,t.ƀhg,t.ƀhi)}ƀip(t){this.ƀax=t,t.length>0&&this.ƀgl.trigger(t)}};var Yt=class extends b{static{h(this,"ImmovablePhysicsEntity")}constructor(t,e){super(t,e,"static"),this.position=m.arrayToVector(this.p2Body.position),this.rotation=new Ke.Radian(this.p2Body.angle)}convertToDTO(){return{entityID:this.id,classID:this.classID,position:this.position,rotation:this.rotation,velocity:Ke.Vector.zero,rotationalSpeed:0}}};var Ce=require("actions-lib"),Xt=require("helpers-lib");var Qe=class extends J{static{h(this,"MovableEntity")}constructor(){super(),this.position=new Ce.Variable(Xt.Vector.zero),this.rotation=new Ce.Variable(Xt.Radian.get0),this.velocity=new Ce.Variable(Xt.Vector.zero),this.rotationalSpeed=new Ce.Variable(0),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjg(t,e)}).attach(this)}ƀjg(t,e){this.position.value=this.position.value.add(this.velocity.value.multiplyNumber(e)),this.rotation.value=new Xt.Radian(this.rotation.value.value+this.rotationalSpeed.value*e)}};var Te=require("actions-lib"),Zt=require("helpers-lib");var qe=class extends b{static{h(this,"MovablePhysicsEntity")}constructor(t,e){super(t,e,"dynamic"),this.position=new Te.Variable(Zt.Vector.zero),this.rotation=new Te.Variable(Zt.Radian.get0),this.velocity=new Te.Variable(Zt.Vector.zero),this.rotationalSpeed=new Te.Variable(0),this.ƀex=!1,this.ƀey=!1,this.ƀfa=!1,this.ƀez=!1,this.ƀhc(),this.ƀfu(),P.get(Jt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjg(i,r)).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}}ƀjg(t,e){this.ƀex=!0,this.ƀey=!0,this.ƀfa=!0,this.ƀez=!0,this.ƀhc()}ƀhc(){this.position.value=m.arrayToVector(this.p2Body.position),this.rotation.value=new Zt.Radian(this.p2Body.angle),this.velocity.value=m.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity}ƀfu(){this.position.subscribe(t=>{this.ƀex?this.ƀex=!1:this.p2Body.position=[t.x,t.y]}).attach(this),this.rotation.subscribe(t=>{this.ƀey?this.ƀey=!1:this.p2Body.angle=t.value}).attach(this),this.velocity.subscribe(t=>{this.ƀfa?this.ƀfa=!1:this.p2Body.velocity=[t.x,t.y]}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀez?this.ƀez=!1:this.p2Body.angularVelocity=t}).attach(this)}};var ti=10.8,ei=10.01,nt;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle"})(nt||(nt={}));var ut="border";var Wt=require("helpers-lib");var Mt=require("helpers-lib");var K=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 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}},kr=class{static{h(this,"AnimationLineer")}start(){}multiplierFunction(t){return K.lineer(t)}},Jr=class{static{h(this,"AnimationEaseIn")}start(){}multiplierFunction(t){return K.easeIn(t)}},Yr=class{static{h(this,"AnimationEaseOut")}start(){}multiplierFunction(t){return K.easeOut(t)}},Xr=class{static{h(this,"AnimationEaseInOut")}start(){}multiplierFunction(t){return K.easeInOut(t)}},Zr=class{static{h(this,"AnimationEaseInOutCubic")}start(){}multiplierFunction(t){return K.easeInOutCubic(t)}},Ji=class{static{h(this,"AnimationFlicker")}start(){this.ƀjs=new Array(10).fill(0),Mt.Random.integerBetween(0,9),this.ƀjs[Mt.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(Mt.Random.integerBetween(0,9),this.ƀjs[Mt.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(Mt.Random.integerBetween(0,9),this.ƀjs[Mt.Random.integerBetween(0,9)]=Math.random())}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjs[e]}},S=class{static{h(this,"Animations")}static{this.lineer=new kr}static{this.easeIn=new Jr}static{this.easeOut=new Yr}static{this.easeInOut=new Xr}static{this.easeInOutCubic=new Zr}};var Dt=require("actions-lib"),ii=require("helpers-lib");var F;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious"})(F||(F={}));var O;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop"})(O||(O={}));var D=class o{static{h(this,"Animator")}static{this.ƀj=new WeakMap}static ƀdh(t){let e=o.ƀj.get(t);return e||(e=new ii.MapToWeakRefs,o.ƀj.set(t,e)),e}get animating(){return this.ƀgu!==void 0}get target(){return this.ƀjj}get value(){return this.ƀka||(this.ƀka=new Dt.Variable(this.ƀjj)),this.ƀka.notifier}constructor(t,e,i){this.ƀjj=t,this.ƀgx={duration:200,animation:S.lineer,reAnimateHandling:F.ThrowError,completionHandling:O.StayInCurrentState,...i},this.ƀk=ii.Comparator.isArray(e)?e:[e],this.ƀfv(t,this.ƀk)}animate(t,e){let i={...this.ƀgx,...e};if(this.ƀgu)switch(i.reAnimateHandling){case F.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case F.IgnoreNewAnimation:return Dt.SingleEvent.instant();case F.CompletePrevious:this.ƀiq(i.completionHandling,this.ƀgu.ƀhr,!0);break;default:{let s=i.reAnimateHandling;throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return Dt.SingleEvent.create(s=>{let n=this.ƀk.reduce((p,f)=>(p[f]={ƀjd:this.ƀjj[f],ƀjl:t[f]},p),{}),a,l={ƀcr:i.duration,ƀcs:0,ƀhr:n,ƀbe:i.completionHandling,ƀl:i.animation,ƀbd:s};if(l.ƀbe!==O.Loop&&this.ƀfh(l)){this.ƀgu=void 0,s();return}else l.ƀl.start();let c=this.ƀgu;return this.ƀgu=l,a=y.beforeSceneUpdateAction.subscribe(p=>{l.ƀcs+=p.delta;let f=l.ƀcs>=l.ƀcr;if(f&&(l.ƀbe===O.Loop?(l.ƀcs%=l.ƀcr,l.ƀl.start(),f=!1):(this.ƀiq(l.ƀbe,l.ƀhr,!1),this.ƀgu=void 0,l.ƀbd())),!f){let g=l.ƀl.multiplierFunction(l.ƀcs/l.ƀcr),E=!1;for(let rt=0;rt<this.ƀk.length;rt++){let yt=this.ƀk[rt],Pe=l.ƀhr[yt],dt=(Pe.ƀjl-Pe.ƀjd)*g+Pe.ƀjd;dt!==this.ƀjj[yt]&&(E=!0,this.ƀjj[yt]=dt)}E&&this.ƀka?.set(this.ƀjj)}}).attachToRoot(),c?.ƀbd(),()=>{a.destroy(),this.ƀgu===l&&(this.ƀjj instanceof Dt.Attachable&&this.ƀjj.destroyed||this.ƀiq(this.ƀgu.ƀbe,this.ƀgu.ƀhr,!0),this.ƀgu=void 0)}})}set(t){let e=!1;for(let i=0;i<this.ƀk.length;i++){let r=this.ƀk[i];this.ƀjj[r]!==t[r]&&(e=!0,this.ƀjj[r]=t[r])}e&&this.ƀka?.set(this.ƀjj),this.ƀgu?.ƀbd()}completeAnimation(t){if(this.ƀgu){t=t??this.ƀgu.ƀbe,this.ƀiq(t,this.ƀgu.ƀhr,!0);let e=this.ƀgu.ƀbd;this.ƀgu=void 0,e()}}ƀfh(t){for(let e=0;e<this.ƀk.length;e++){let i=this.ƀk[e];if(this.ƀjj[i]!==t.ƀhr[i].ƀjl)return!1}return!0}ƀiq(t,e,i){switch(t){case O.ReturnToOriginal:this.ƀic(e);break;case O.StayInCurrentState:i||this.ƀfl(e);break;case O.JumpToEnd:this.ƀfl(e);break;case O.Loop:this.ƀic(e);break;default:{let r=t;throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀic(t){let e=!1;for(let i=0;i<this.ƀk.length;i++){let r=this.ƀk[i];this.ƀjj[r]!==t[r].ƀjd&&(e=!0,this.ƀjj[r]=t[r].ƀjd)}e&&this.ƀka?.set(this.ƀjj)}ƀfl(t){let e=!1;for(let i=0;i<this.ƀk.length;i++){let r=this.ƀk[i];this.ƀjj[r]!==t[r].ƀjl&&(e=!0,this.ƀjj[r]=t[r].ƀjl)}e&&this.ƀka?.set(this.ƀjj)}ƀfv(t,e){let i=o.ƀdh(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this)}}};var Ft=require("helpers-lib");var oi=require("actions-lib"),Q=require("helpers-lib"),ur=C(require("pixi.js"));var Kt;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change"})(Kt||(Kt={}));var ri;(function(o){o.Default="default",o.Pointer="pointer"})(ri||(ri={}));var si=class extends oi.IDAttachable{static{h(this,"ContainerAttributes")}constructor(){super(),this.ƀge=!1,this.ƀda=!1,this.ƀid=1,this.ƀv=1,this.pixiContainer=new ur.Container}get size(){return this.getSize()}set size(t){this.setSize(t)}getSize(){return new Q.Vector(this.pixiContainer.width,this.pixiContainer.height)}setSize(t){return this.pixiContainer.width=t.x,this.pixiContainer.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.pixiContainer.getLocalBounds(),r=new Q.Vector(this.pixiContainer.scale.x,this.pixiContainer.scale.y),s=new Q.Vector(i.x,i.y).multiply(r),n=new Q.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a)}return e?.round!==!1&&(t=t.round({rollHalfsDown:!0})),this.position=t,this}get position(){return new Q.Vector(this.pixiContainer.x,this.pixiContainer.y)}set position(t){this.pixiContainer.position=t}get x(){return this.pixiContainer.x}set x(t){this.pixiContainer.x=t}get y(){return this.pixiContainer.y}set y(t){this.pixiContainer.y=t}on(t,e){let i=h(r=>e(),"handle");return this.pixiContainer.on(t,i),new oi.ActionSubscription(()=>{this.pixiContainer.off(t,i)})}setRotation(t){return this.rotation=t,this}get rotation(){return new Q.Radian(this.pixiContainer.rotation)}set rotation(t){this.pixiContainer.rotation=t.value}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new Q.Radian(t)}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.pixiContainer.zIndex}set zIndex(t){this.pixiContainer.zIndex=t}setSkewX(t){return this.skewX=t,this}get skewX(){return new Q.Radian(this.pixiContainer.skew.x)}set skewX(t){this.pixiContainer.skew.x=t.value}setSkewY(t){return this.skewY=t,this}get skewY(){return new Q.Radian(this.pixiContainer.skew.y)}set skewY(t){this.pixiContainer.skew.y=t.value}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.pixiContainer.sortableChildren}set sortableChildren(t){this.pixiContainer.sortableChildren=t}setAlpha(t){return this.pixiContainer.alpha=t,this}get alpha(){return this.pixiContainer.alpha}set alpha(t){this.pixiContainer.alpha=t}setInteractive(t){return this.interactive=t,this}get interactive(){return this.pixiContainer.interactive}set interactive(t){t?this.pixiContainer.eventMode="dynamic":this.pixiContainer.eventMode="none"}setCursor(t){return this.cursor=t,this}get cursor(){return this.pixiContainer.cursor}set cursor(t){this.pixiContainer.cursor=t}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.pixiContainer.addChild(t.pixiContainer),this.pixiContainer.mask=t.getMask(),this.ƀfy=t):(this.ƀfy&&this.pixiContainer.removeChild(this.ƀfy.pixiContainer),this.pixiContainer.mask=null),this}hitTest(t){if(this.pixiContainer.parent)if(this.pixiContainer.hitArea){let e=this.pixiContainer.toLocal(t);return this.pixiContainer.hitArea.contains(e.x,e.y)}else return this.pixiContainer.getBounds().contains(t.x,t.y);else return!1}setMirror(t=!1){return this.mirror=t,this}get mirror(){return this.ƀge}set mirror(t){this.ƀge=t,this.ƀjz()}setFlip(t=!1){return this.flip=t,this}get flip(){return this.ƀda}set flip(t){this.ƀda=t,this.ƀjz()}setScale(t){return this.scale=t,this}get scale(){return this.ƀid}set scale(t){this.ƀid=t,this.ƀjz()}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀv}set aspectRatio(t){this.ƀv=t,this.ƀjz()}ƀjz(){this.pixiContainer.scale.set(this.ƀid,this.ƀid),this.ƀv<1?this.pixiContainer.scale.x*=this.ƀv:this.ƀv>1&&(this.pixiContainer.scale.y/=this.ƀv),this.ƀge&&(this.pixiContainer.scale.x*=-1),this.ƀda&&(this.pixiContainer.scale.y*=-1)}};var hi=require("helpers-lib"),mr=C(require("pixi.js"));var _n=require("pixi.js"),A=2,Bt;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge"})(Bt||(Bt={}));var Gt=require("helpers-lib"),Ee=C(require("pixi.js"));var Qt=require("helpers-lib");var ni=class{static{h(this,"GaussianValuesHelper")}static ƀdf(t,e){let i=e*e,r=1/(Qt.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=Qt.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return!0}),n=1/i,a=s.map(l=>l*n);return this.ƀbq(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=Qt.ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀdf(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbq(e)}}static ƀbq(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r})}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i})}return e}};var fr=class Yi extends Ee.Filter{static{h(this,"BlurFilterPass")}static ƀef(){return`
1
+ 'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),W=require('p2'),V=require('pixi.js'),scriptEngineLib=require('script-engine-lib');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__default=/*#__PURE__*/_interopDefault(W);var V__namespace=/*#__PURE__*/_interopNamespace(V);var cr=Object.defineProperty;var h=(o,t)=>cr(o,"name",{value:t,configurable:true});var G=class{static{h(this,"BardLegendsHardReset");}static{this.ƀeq=new actionsLib.Action;}static{this.onHardReset=this.ƀeq.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀeq.trigger();}};function d(){return function(o){let t=P.ƀea(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var P=class{static{h(this,"Service");}static{this.ƀio=new Map;}static get(t){let e=this.ƀio.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀia([],t.$meta.paramtypes);e=new t(...i),this.ƀio.set(t,e);}return e}static ƀea(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀia(t,e){let i=[...t];if(e.length>t.length){let s=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...s);}return i}};G.onHardReset.subscribe(()=>{P.ƀio=new Map;}).attachToRoot();var U=class{static{h(this,"ControllerLink");}constructor(){this.ƀbl=[],this.ƀhz=[];}trigger(t,...e){let i=this.ƀbl.find(r=>!!r[t]);if(i)return i[t](...e);throw new Error(`ServiceLink: no defined function with the name: "${t}", found in the linked controllers!`)}registerController(t){Reflect.ownKeys(t.constructor.prototype).filter(e=>e!=="constructor").map(e=>e.toString()).forEach(e=>{if(this.ƀhz.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀhz.push(e);}),this.ƀbl.push(t);}};function et(o){return function(t){let e=P.ƀea(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=P.ƀia([],e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);o.controllerLink.registerController(r);}t.$meta={type:"controller"};}}h(et,"ControllerDecorator");var y=class o{static{h(this,"UpdateCycle");}static{this.ƀac=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀac.notifier;}static{this.ƀig=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀig.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀjr=0;}static{this.ƀjy=void 0;}static wait(t){let e=this.ƀjr+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀjy)this.ƀjy=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀjy=void 0;}static triggerUpdateTick(t){this.ƀjy&&(t=this.ƀjy(this.ƀjr,t)),this.ƀjr+=t,this.ƀfo=t,t>0&&(o.ƀac.trigger({time:this.ƀjr,delta:t}),o.ƀig.trigger({time:this.ƀjr,delta:t}),o.ƀf.trigger({time:this.ƀjr,delta:t}));}static get lastDelta(){return this.ƀfo}static{this.ƀfo=0;}};G.onHardReset.subscribe(()=>{y.ƀac.clear(),y.ƀig.clear(),y.ƀf.clear(),y.ƀjy=void 0,y.ƀjr=0;}).attachToRoot();var F=class o{static{h(this,"EntityStoreHelper");}static{this.ƀav=new Map;}static registerEntityClass(t){this.ƀav.set(t.id,new Map);}static registerEntity(t){this.ƀav.get(t.classID).set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀav.get(i)?.delete(e);}static getEntity(t,e){return this.ƀav.get(t.id)?.get(e)}static getSingleton(t){let e=o.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.ƀav.get(t.id);return Array.from(e.values())}};G.onHardReset.subscribe(()=>{F.ƀav.clear();}).attachToRoot();var at=class o{static{h(this,"EntityViewsHelper");}static{this.ƀkh=new Map;}static registerView(t,e){o.ƀkh.has(e)||o.ƀkh.set(e,[]);let i=o.ƀkh.get(e);i&&i.push(t),F.getEntities(e).forEach(s=>{this.ƀcg(s,t);});}static ƀcg(t,e){try{let i=P.ƀia([this],e.$meta.paramtypes);o.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkg.ƀki.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcu=t,this.ƀki=[];}createViews(){if(!this.ƀcu.destroyed){let t=o.ƀkh.get(this.ƀcu.constructor);t&&t.forEach(e=>{o.ƀcg(this.ƀcu,e);});}}updateViews(t,e){for(let i=0;i<this.ƀki.length;i++){let r=this.ƀki[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀki.forEach(t=>{t.destroy();});}};G.onHardReset.subscribe(()=>{at.ƀkh=new Map;}).attachToRoot();function mt(){return function(o){o.$meta={type:"entity"},F.registerEntityClass(o);}}h(mt,"EntityDecorator");var $=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return F.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=F.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return F.getEntities(this)}constructor(){super(),this.ƀkg=new at(this),F.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkg.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkg.destroyViews(),F.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkg.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkg.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkg.createViews(),this}update(t,e){}};var gt=class extends ${static{h(this,"SingletonEntity");}static getInstance(){return F.getSingleton(this)}static getInstanceOrFail(){return F.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}"`)}};function wr(){return function(o){return o.$meta={paramtypes:P.ƀea(o),type:"scene"},o}}h(wr,"SceneDecorator");var St=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀif=false;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return o.ƀb.value}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀif)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀif=true;let i=P.ƀia([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀif=false,r)).chainToRoot()}constructor(){super(),this.ƀgk=new actionsLib.Action,this.onClose=this.ƀgk.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw o.ƀif?new Error("Scene: you cannot close a scene while a scene is transitioning!"):new Error("Internal Error: Scene instance is accessed while it is not the active scene!");let e=t[0];return o.ƀif=true,this.prepareToClose().map(()=>(super.destroy(),o.ƀb.set(void 0),o.ƀif=false,this.ƀgk.trigger(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{St.ƀb.set(void 0);}).attachToRoot();function Xe(o){return function(t){t.$meta={paramtypes:P.ƀea(t),viewInstances:new Map,entity:o.entity,type:"view"},at.registerView(t,o.entity);}}h(Xe,"ViewDecorator");var Ut=class extends actionsLib.IDAttachable{static{h(this,"View");}static getInstance(t){return this.$meta.entity.validateID(t)?this.$meta.viewInstances.get(t):void 0}static getInstanceOrFail(t){if(!this.$meta.entity.validateID(t))throw new Error(`View: getInstance is called with entity id: "${t}", that is not belonging to the class: "${this.$meta.entity}"`);let i=this.$meta.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.attachToRoot(),this.ƀcv=at.entityID,this.ƀeg().set(this.ƀcv,this);}destroy(){this.destroyed||(super.destroy(),this.ƀeg().delete(this.ƀcv));}update(t,e){}ƀeg(){return this.constructor.$meta.viewInstances}};var m=class o{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,r){return (t&r)!==0&&(i&e)!==0}static canCollideWith(t,e){return t.shapes.some(i=>e.shapes.some(r=>o.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new W__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var Sr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Y=new U,Ct=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,s){return Y.trigger("createBody",t,e,i,r,s)}getMaterial(t,e){return Y.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return Y.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return Y.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return Y.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,s){return Y.trigger("addBody",t,e,i,r,s)}removeBody(t,e){return Y.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return Y.trigger("subscribeToPhysicsStep",t,e)}};Ct=Sr([d()],Ct);var b=class o extends ${static{h(this,"PhysicsEntity");}static{this.ƀgy=new Map;}static{this.ƀhf=new Map;}static getFromP2BodyID(t){return o.ƀgy.get(t)}static getFromP2BodyIDOrFail(t){let e=o.ƀgy.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=o.ƀhf.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(o.ƀhf.values())}get area(){return this.ƀt}get mass(){return this.ƀga}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgl=new actionsLib.Action,this.onCollision=this.ƀgl.notifier,this.type="dynamic",this.ƀt=0,this.ƀga=0,this.ƀax=[],this.physicsWorldID=t,this.ƀhh=P.get(Ct);let r=this.ƀhh.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),s=this.ƀhh.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhg=this.ƀhh.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhi=this.ƀhh.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhh.createBody(this.physicsWorldID,e,r,s,this.type),this.ƀt=this.p2Body.getArea(),this.ƀga=this.p2Body.mass,this.p2Body.position=m.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhh.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!");o.ƀgy.set(this.p2Body.id,this),o.ƀhf.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhh.removeBody(this.physicsWorldID,this.p2Body),o.ƀgy.delete(this.p2Body.id),o.ƀhf.delete(this.id));}canCollideWith(t){return m.arePhysicsGroupsCollidable(this.ƀhg,this.ƀhi,t.ƀhg,t.ƀhi)}ƀip(t){this.ƀax=t,t.length>0&&this.ƀgl.trigger(t);}};var $t=class extends b{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 Ze=class extends ${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),y.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjg(t,e);}).attach(this);}ƀjg(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 Ke=class extends b{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.ƀex=false,this.ƀey=false,this.ƀfa=false,this.ƀez=false,this.ƀhc(),this.ƀfu(),P.get(Ct).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjg(i,r)).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}}ƀjg(t,e){this.ƀex=true,this.ƀey=true,this.ƀfa=true,this.ƀez=true,this.ƀhc();}ƀhc(){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;}ƀfu(){this.position.subscribe(t=>{this.ƀex?this.ƀex=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀey?this.ƀey=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.angularVelocity=t;}).attach(this);}};var Qe=10.8,qe=10.01;exports.PhysicsShapeType=void 0;(function(o){o[o.Point=1]="Point",o[o.Circle=2]="Circle",o[o.Polygon=3]="Polygon",o[o.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var ht="border";var X=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 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}},Rr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return X.lineer(t)}},Ir=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return X.easeIn(t)}},Ar=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return X.easeOut(t)}},Or=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return X.easeInOut(t)}},Mr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return X.easeInOutCubic(t)}},Oi=class{static{h(this,"AnimationFlicker");}start(){this.ƀjs=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀjs[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀjs[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀjs[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjs[e]}},S=class{static{h(this,"Animations");}static{this.lineer=new Rr;}static{this.easeIn=new Ir;}static{this.easeOut=new Ar;}static{this.easeInOut=new Or;}static{this.easeInOutCubic=new Mr;}};exports.ReAnimateHandlingType=void 0;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var O=class o{static{h(this,"Animator");}static{this.ƀj=new WeakMap;}static ƀdh(t){let e=o.ƀj.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀj.set(t,e)),e}get animating(){return this.ƀgu!==void 0}get target(){return this.ƀjj}get value(){return this.ƀka||(this.ƀka=new actionsLib.Variable(this.ƀjj)),this.ƀka.notifier}constructor(t,e,i){this.ƀjj=t,this.ƀgx={duration:200,animation:S.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀk=helpersLib.Comparator.isArray(e)?e:[e],this.ƀfv(t,this.ƀk);}animate(t,e){let i={...this.ƀgx,...e};if(this.ƀgu)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();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀiq(i.completionHandling,this.ƀgu.ƀhr,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(s=>{let n=this.ƀk.reduce((p,f)=>(p[f]={ƀjd:this.ƀjj[f],ƀjl:t[f]},p),{}),a,l={ƀcr:i.duration,ƀcs:0,ƀhr:n,ƀbe:i.completionHandling,ƀl:i.animation,ƀbd:s};if(l.ƀbe!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfh(l)){this.ƀgu=void 0,s();return}else l.ƀl.start();let c=this.ƀgu;return this.ƀgu=l,a=y.beforeSceneUpdateAction.subscribe(p=>{l.ƀcs+=p.delta;let f=l.ƀcs>=l.ƀcr;if(f&&(l.ƀbe===exports.AnimationsCompletionHandlingType.Loop?(l.ƀcs%=l.ƀcr,l.ƀl.start(),f=false):(this.ƀiq(l.ƀbe,l.ƀhr,false),this.ƀgu=void 0,l.ƀbd())),!f){let g=l.ƀl.multiplierFunction(l.ƀcs/l.ƀcr),T=false;for(let J=0;J<this.ƀk.length;J++){let ot=this.ƀk[J],Wt=l.ƀhr[ot],tt=(Wt.ƀjl-Wt.ƀjd)*g+Wt.ƀjd;tt!==this.ƀjj[ot]&&(T=true,this.ƀjj[ot]=tt);}T&&this.ƀka?.set(this.ƀjj);}}).attachToRoot(),c?.ƀbd(),()=>{a.destroy(),this.ƀgu===l&&(this.ƀjj instanceof actionsLib.Attachable&&this.ƀjj.destroyed||this.ƀiq(this.ƀgu.ƀbe,this.ƀgu.ƀhr,true),this.ƀgu=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀk.length;i++){let r=this.ƀk[i];this.ƀjj[r]!==t[r]&&(e=true,this.ƀjj[r]=t[r]);}e&&this.ƀka?.set(this.ƀjj),this.ƀgu?.ƀbd();}completeAnimation(t){if(this.ƀgu){t=t??this.ƀgu.ƀbe,this.ƀiq(t,this.ƀgu.ƀhr,true);let e=this.ƀgu.ƀbd;this.ƀgu=void 0,e();}}ƀfh(t){for(let e=0;e<this.ƀk.length;e++){let i=this.ƀk[e];if(this.ƀjj[i]!==t.ƀhr[i].ƀjl)return false}return true}ƀiq(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:this.ƀic(e);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀfl(e);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀfl(e);break;case exports.AnimationsCompletionHandlingType.Loop:this.ƀic(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀic(t){let e=false;for(let i=0;i<this.ƀk.length;i++){let r=this.ƀk[i];this.ƀjj[r]!==t[r].ƀjd&&(e=true,this.ƀjj[r]=t[r].ƀjd);}e&&this.ƀka?.set(this.ƀjj);}ƀfl(t){let e=false;for(let i=0;i<this.ƀk.length;i++){let r=this.ƀk[i];this.ƀjj[r]!==t[r].ƀjl&&(e=true,this.ƀjj[r]=t[r].ƀjl);}e&&this.ƀka?.set(this.ƀjj);}ƀfv(t,e){let i=o.ƀdh(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};exports.ContainerEventType=void 0;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var fe=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀge=false,this.ƀda=false,this.ƀid=1,this.ƀv=1,this.pixiContainer=new V__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.pixiContainer.width,this.pixiContainer.height)}setSize(t){return this.pixiContainer.width=t.x,this.pixiContainer.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.pixiContainer.getLocalBounds(),r=new helpersLib.Vector(this.pixiContainer.scale.x,this.pixiContainer.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.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.pixiContainer.x,this.pixiContainer.y)}set position(t){this.pixiContainer.position=t;}get x(){return this.pixiContainer.x}set x(t){this.pixiContainer.x=t;}get y(){return this.pixiContainer.y}set y(t){this.pixiContainer.y=t;}on(t,e){let i=h(r=>e(),"handle");return this.pixiContainer.on(t,i),new actionsLib.ActionSubscription(()=>{this.pixiContainer.off(t,i);})}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.pixiContainer.rotation)}set rotation(t){this.pixiContainer.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.pixiContainer.zIndex}set zIndex(t){this.pixiContainer.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.pixiContainer.skew.x)}set skewX(t){this.pixiContainer.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.pixiContainer.skew.y)}set skewY(t){this.pixiContainer.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.pixiContainer.sortableChildren}set sortableChildren(t){this.pixiContainer.sortableChildren=t;}setAlpha(t){return this.pixiContainer.alpha=t,this}get alpha(){return this.pixiContainer.alpha}set alpha(t){this.pixiContainer.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.pixiContainer.interactive}set interactive(t){t?this.pixiContainer.eventMode="dynamic":this.pixiContainer.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.pixiContainer.cursor}set cursor(t){this.pixiContainer.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.pixiContainer.addChild(t.pixiContainer),this.pixiContainer.mask=t.getMask(),this.ƀfy=t):(this.ƀfy&&this.pixiContainer.removeChild(this.ƀfy.pixiContainer),this.pixiContainer.mask=null),this}hitTest(t){if(this.pixiContainer.parent)if(this.pixiContainer.hitArea){let e=this.pixiContainer.toLocal(t);return this.pixiContainer.hitArea.contains(e.x,e.y)}else return this.pixiContainer.getBounds().contains(t.x,t.y);else return false}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀge}set mirror(t){this.ƀge=t,this.ƀjz();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀda}set flip(t){this.ƀda=t,this.ƀjz();}setScale(t){return this.scale=t,this}get scale(){return this.ƀid}set scale(t){this.ƀid=t,this.ƀjz();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀv}set aspectRatio(t){this.ƀv=t,this.ƀjz();}ƀjz(){this.pixiContainer.scale.set(this.ƀid,this.ƀid),this.ƀv<1?this.pixiContainer.scale.x*=this.ƀv:this.ƀv>1&&(this.pixiContainer.scale.y/=this.ƀv),this.ƀge&&(this.pixiContainer.scale.x*=-1),this.ƀda&&(this.pixiContainer.scale.y*=-1);}};var R=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var me=class{static{h(this,"GaussianValuesHelper");}static ƀdf(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbq(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(r=>this.ƀdf(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbq(e)}}static ƀbq(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Bi=class ei extends V__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀef(){return `
2
2
  attribute vec2 aVertexPosition;
3
3
  attribute vec2 aTextureCoord;
4
4
 
@@ -22,14 +22,14 @@
22
22
  }
23
23
 
24
24
  void main() {
25
- gl_FragColor = texture2D(uSampler, vTextureCoord) * ${Gt.NumberHelper.toFloatString(t[0].multiplier)};
25
+ gl_FragColor = texture2D(uSampler, vTextureCoord) * ${helpersLib.NumberHelper.toFloatString(t[0].multiplier)};
26
26
  float offset;`;for(let r=1;r<t.length;r++){let s=`vec2(${e?"offset, 0.0":"0.0, offset"})`;i+=`
27
27
 
28
- offset = ${Gt.NumberHelper.toFloatString(t[r].offset)} * pixelSize;
29
- iterate(${s}, ${Gt.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);
30
- iterate(${s} * -1.0, ${Gt.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);`}return i+=`
28
+ offset = ${helpersLib.NumberHelper.toFloatString(t[r].offset)} * pixelSize;
29
+ iterate(${s}, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);
30
+ iterate(${s} * -1.0, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);`;}return i+=`
31
31
  }
32
- `,i}constructor(t,e){super(Yi.ƀef(),Yi.ƀdo(ni.getValuesForLinearSamplingGauss(t),e)),this.ƀet=e,this.resolution=A}apply(t,e,i,r){this.uniforms.pixelSize=this.ƀet?1/(e.width*A):1/(e.height*A),t.applyFilter(this,e,i,r)}},qt=class extends Ee.Filter{static{h(this,"BlurFilter")}constructor(t=new Gt.Vector(2,2)){if(super(),this.ƀjh=t,this.resolution=A,this.ƀjh=t.multiplyNumber(A).floor(),this.ƀjh.x<0||this.ƀjh.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀjh.x>100||this.ƀjh.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀev=new fr(this.ƀjh.x,!0),this.ƀke=new fr(this.ƀjh.y,!1),this.padding=Math.max(this.ƀjh.x,this.ƀjh.y)}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀke.apply(t,e,s,Ee.CLEAR_MODES.CLEAR),this.ƀev.apply(t,s,i,r),t.returnFilterTexture(s)}get blendMode(){return this.ƀev.blendMode}set blendMode(t){this.ƀev.blendMode=t,this.ƀke.blendMode=t}};var ai=class{static{h(this,"Filters")}get red(){return this.ƀhv}set red(t){this.ƀhv=t,this.ƀhw()}get green(){return this.ƀej}set green(t){this.ƀej=t,this.ƀhw()}get blue(){return this.ƀaf}set blue(t){this.ƀaf=t,this.ƀhw()}get brightness(){return this.ƀak}set brightness(t){this.ƀak=t,this.ƀhw()}get contrast(){return this.ƀbk}set contrast(t){this.ƀbk=t,this.ƀhw()}get blur(){return this.ƀag}set blur(t){let e=hi.Comparator.isNumber(t)?new hi.Vector(t,t):t;(this.ƀag&&e&&!this.ƀag.isEqual(e)||this.ƀag&&!e||!this.ƀag&&e)&&(this.ƀag=e,this.ƀah&&(this.ƀah.destroy(),this.ƀah=void 0),e&&(this.ƀah=new qt(e),this.ƀgo()))}constructor(t){this.ƀbg=t,this.ƀhv=1,this.ƀej=1,this.ƀaf=1,this.ƀak=1,this.ƀbk=1,this.ƀgo()}removeColorFilter(){this.ƀaz?.destroy(),this.ƀaz=void 0,this.ƀgo()}ƀhw(){this.ƀhv===1&&this.ƀej===1&&this.ƀaf===1&&this.ƀak===1&&this.ƀbk===1?this.ƀaz&&(this.ƀaz.destroy(),this.ƀaz=void 0,this.ƀgo()):(this.ƀaz||(this.ƀaz=new mr.ColorMatrixFilter,this.ƀaz.resolution=A,this.ƀgo()),this.ƀaz.matrix=[this.ƀhv*this.ƀbk,0,0,0,this.ƀak-1,0,this.ƀej*this.ƀbk,0,0,this.ƀak-1,0,0,this.ƀaf*this.ƀbk,0,this.ƀak-1,0,0,0,1,0])}ƀgo(){let t=[];this.ƀah&&t.push(this.ƀah),this.ƀaz&&t.push(this.ƀaz),this.ƀbg.filters=t}};var u=class o extends si{static{h(this,"Container")}static{this.allContainers=new Map}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:!1,cropOverflowingParts:!1},o.allContainers.set(this.id,this),this.filters=new ai(this.pixiContainer)}destroy(){this.destroyed||(super.destroy(),o.allContainers.delete(this.id),!this.pixiContainer.destroyed&&this.pixiContainer.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(Ft.Comparator.isNumber(t)){if(i=o.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let r={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(r.addUnder?i.addChildTo.pixiContainer.addChildAt(this.pixiContainer,0):i.addChildTo.pixiContainer.addChild(this.pixiContainer),r.cropOverflowingParts)if(i)this.pixiContainer.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}get boundingBox(){let t=this.pixiContainer.getLocalBounds();return new Ft.Rectangle(new Ft.Vector(t.x,t.y),new Ft.Vector(t.x+t.width,t.y+t.height))}};var at=require("helpers-lib"),U=C(require("pixi.js"));var Ae=require("actions-lib"),re=require("helpers-lib"),xr=C(require("pixi.js"));var gr=require("helpers-lib"),li=C(require("pixi.js"));var _=class{static{h(this,"GameAssets")}static{this.ƀib=new Map}static{this.ƀo=0}static getAsset(t){let e=this.ƀib.get(t);if(e)return e;throw new Error(`Game Assets: Resource not found! Key: "${t}"`)}static insertAsset(t,e){return e||(e=`a-${this.ƀo++}`),this.ƀib.set(e,t),e}static destroyAsset(t){let e=this.ƀib.get(t);e&&(e.destroy(!0),this.ƀib.delete(t))}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(s=>{if(!gr.Comparator.isString(s.url))throw new Error(`GameAssets: source url should be a string: ${s.url}`);let n=e.get(s.url);n?n.push(s.id):(e.set(s.url,[s.id]),i.push({url:s.url,callback:h(a=>{if(a instanceof li.Texture&&(a.id=s.id),n=e.get(s.url),n)n.forEach(l=>{this.ƀib.set(l,a)});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${s}`)},"callback")}))});let r=performance.now();return Promise.all(i.map(s=>li.Assets.load(s.url))).then(s=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-r)/1e3," seconds"),s.forEach((a,l)=>{i[l].callback(a)})}).catch(s=>{throw new Error(`GameAssets: during asset loading, an error occured: ${s}`)})}};var ci=require("helpers-lib"),di=C(require("pixi.js"));var te=class{static{h(this,"PositionConversionHelper")}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=ci.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}static normalizePolygonByAnchor(t,e,i){let r=new ci.Vector(e.x*i.x,e.y*i.y);return t.map(s=>s.map(n=>r.to(ci.Vector.fromVec2(n))))}},pi=class{static{h(this,"CompositeHitArea")}constructor(t,e,i){this.ƀiv=t.map(r=>new di.Polygon(r.map(s=>new di.Point(s.x,s.y))))}contains(t,e){return this.ƀiv.some(i=>i.contains(t,e))}};var Kr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},_t=new k,Lt=class{static{h(this,"CameraGateway")}createCamera(){return _t.trigger("createCamera")}update(t,e){return _t.trigger("update",t,e)}setPosition(t){return _t.trigger("setPosition",t)}setTransition(t){return _t.trigger("setTransition",t)}getCameraPosition(){return _t.trigger("getCameraPosition")}};Lt=Kr([d()],Lt);var Qr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ui=new k,Re=class{static{h(this,"CameraViewGateway")}getLayers(){return ui.trigger("getLayers")}appear(t,e){return ui.trigger("appear",t,e)}};Re=Qr([d()],Re);var yr;(function(o){o.BackgroundScreen="backgroundScreen",o.Background="background",o.Main="main",o.Foreground="foreground",o.ForegroundScreen="foregroundScreen"})(yr||(yr={}));var ft;(function(o){o[o.Instant=1]="Instant",o[o.EaseInOut=2]="EaseInOut",o[o.EaseOut=3]="EaseOut"})(ft||(ft={}));var wr=require("actions-lib"),Pt=require("helpers-lib");var Ie=require("actions-lib"),Xi=require("helpers-lib");var qr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},H=class extends bt{static{h(this,"CameraEntity")}constructor(){super(...arguments),this.position=new Ie.Variable(Xi.Vector.zero),this.offset=new Ie.Variable(Xi.Vector.zero),this.targetPosition=new Ie.Variable(void 0),this.focusingNewTargetInfo=new Ie.Variable(void 0)}};H=qr([vt()],H);var ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},es=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ee=class extends kt{static{h(this,"CameraView")}constructor(t){super(),this.ƀcu=t,this.ƀie=new u().setAlpha(0).displayParent(w.instance.stage).attach(this),this.ƀad=R.createRectangle(new Pt.Vector(1,1),Pt.ColorHelper.black).toSprite({cache:!0}).setAlpha(0).displayParent(w.instance.stage).attach(this),this.ƀab=new u().displayParent(this.ƀie).attach(this),this.ƀap=new u().displayParent(this.ƀie).attach(this),this.ƀde=new u().setSortableChildren(!0).displayParent(this.ƀie).attach(this),this.ƀao=new u().setSortableChildren(!0).displayParent(this.ƀap).attach(this),this.ƀdd=new u().setSortableChildren(!0).setZIndex(20).displayParent(this.ƀao).attach(this),this.ƀfx=new u().setSortableChildren(!0).setZIndex(10).displayParent(this.ƀao).attach(this),this.ƀaa=new u().setZIndex(0).displayParent(this.ƀao).attach(this),this.ƀh=new D(this.ƀie,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:F.CompletePrevious,completionHandling:O.StayInCurrentState}),this.ƀae=new D(this.ƀad,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:F.CompletePrevious,completionHandling:O.StayInCurrentState}),w.instance.screenSize.subscribe(e=>{this.ƀad.aspectRatio=e.x/e.y,this.ƀad.scale=Math.max(e.x,e.y),this.ƀad.setPosition(Pt.Vector.zero,{holdFrom:Pt.Vector.zero})}).attach(this),w.instance.setScreenPositionToStagePositionFunction(e=>new Pt.Vector(e.x-this.ƀao.position.x-this.ƀap.position.x,e.y-this.ƀao.position.y-this.ƀap.position.y)),this.ƀcu.position.subscribe(e=>{this.ƀao.position=this.ƀbp(e)}).attach(this),this.ƀcu.offset.subscribe(e=>{this.ƀap.position=e}).attach(this),this.appear(!0,"alpha")}destroy(){this.destroyed||(super.destroy(),w.instance.resetScreenPositionToStagePositionFunction())}getLayers(){return{backgroundScreen:this.ƀab.id,background:this.ƀaa.id,main:this.ƀfx.id,foreground:this.ƀdd.id,foregroundScreen:this.ƀde.id}}appear(t,e){switch(e){case"alpha":return this.ƀae.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),this.ƀh.animate({alpha:t?1:0}).chain(this);case"pureBlack":return this.ƀh.set({alpha:1}),this.ƀae.set({alpha:t?1:0}),this.ƀae.animate({alpha:t?0:1}).chain(this);case"instant":return this.ƀh.set({alpha:t?1:0}),this.ƀae.set({alpha:t?0:1}),wr.SingleEvent.instant();default:{let i=e;throw new Error('Switch ended with value "never".')}}}ƀbp(t){return Pt.Vector.fromTo(t,w.instance.getScreenSizeCenter())}};ee=ts([Xe({entity:H}),es("design:paramtypes",[H])],ee);var fi=require("helpers-lib");var is=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},rs=1500,mi=class{static{h(this,"CameraService")}createCamera(){return new H().attachToRoot()}getCameraPosition(){let t=H.getInstanceOrFail();return fi.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=H.getInstanceOrFail();e.targetPosition.value=t}setTransition(t){let e=H.getInstanceOrFail();e.focusingNewTargetInfo.value={time:w.time,duration:t?.duration??rs,position:e.position.value,roundPosition:t?.roundPosition??!1,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??ft.Instant}}update(t,e){let i=H.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfj(i,r,t):i.position.value=r)}ƀfj(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===ft.Instant)this.ƀbb(t,e);else{let s=(i-r.time)/r.duration;if(s>=1)this.ƀbb(t,e);else{let n;r.focusingAnimation===ft.EaseInOut?n=K.easeInOut(s):r.focusingAnimation===ft.EaseOut?n=K.easeOut(s):n=1;let a=r.position.lerp(e,n);r.roundPosition&&(Math.abs(a.x-r.position.x)>=r.roundPositionThreshold&&(a=new fi.Vector(Math.round(a.x),a.y)),Math.abs(a.y-r.position.y)>=r.roundPositionThreshold&&(a=new fi.Vector(a.x,Math.round(a.y)))),t.position.value=a}}}ƀbb(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0}};mi=is([d()],mi);var ss=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},os=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Zi=class{static{h(this,"CameraController")}constructor(t){this.ƀaq=t}createCamera(){return this.ƀaq.createCamera().id}update(t,e){this.ƀaq.update(t,e)}setPosition(t){this.ƀaq.setPosition(t)}setTransition(t){this.ƀaq.setTransition(t)}getCameraPosition(){return this.ƀaq.getCameraPosition()}};Zi=ss([st({controllerLink:_t}),os("design:paramtypes",[mi])],Zi);var ns=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ki=class{static{h(this,"CameraViewController")}getLayers(){let t=H.getInstanceOrFail().id;return ee.getInstanceOrFail(t).getLayers()}appear(t,e){let i=H.getInstanceOrFail().id;return ee.getInstanceOrFail(i).appear(t,e)}};Ki=ns([st({controllerLink:ui})],Ki);var ie=class{static{h(this,"Camera")}get position(){return this.ƀan.getCameraPosition()}constructor(){this.ƀan=P.get(Lt),this.ƀar=P.get(Re),this.ƀan.createCamera(),this.layers=this.ƀar.getLayers()}setPosition(t){this.ƀan.setPosition(t)}setTransition(t){this.ƀan.setTransition(t)}appear(t,e="alpha"){return this.ƀar.appear(t,e)}};var w=class o{static{h(this,"Game")}static get instance(){return this.ƀfg}static{this.pause=Ae.Reducer.createOr()}static get camera(){return this.ƀam}static get time(){return y.ƀjr}static get setupOptions(){return this.ƀit}getScreenSize(){return this.ƀij.value}getScreenSizeCenter(){return this.ƀik.value}constructor(t){if(this.ƀij=new Ae.Variable(re.Vector.zero),this.screenSize=this.ƀij.notifier,this.ƀik=new Ae.Variable(re.Vector.zero),this.screenSizeCenter=this.ƀik.notifier,this.devMode=!1,this.resetScreenPositionToStagePositionFunction(),o.ƀfg)throw new Error("There can be only one Game instance!");this.ƀbf={screenResolution:void 0,devMode:!1,backgroundColor:re.ColorHelper.black,...t},this.devMode=this.ƀbf.devMode||!1,this.ƀhm=new xr.Application({backgroundColor:this.ƀbf.backgroundColor,autoStart:!1,antialias:A<1.5,resolution:A,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0})}async setup(t){o.ƀit=t,document.body.appendChild(this.ƀhm.view),await Promise.all([_.loadGameAssets(t.assetDefinitions)]),o.ƀfg=this,this.stage=new u().attachToRoot(),this.stage.pixiContainer=this.ƀhm.stage,this.renderer=this.ƀhm.renderer,this.ƀis(),this.stage.sortableChildren=!0,globalThis.ƀa=this.ƀhm,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀis())}),o.ƀam=new ie,this.ƀhm.start(),this.ƀhm.ticker.add(()=>{y.triggerUpdateTick(this.ƀhm.ticker.deltaMS)})}setResolution(t){this.ƀhm.renderer.resolution=t,this.ƀhm.renderer.resize(this.ƀhm.screen.width,this.ƀhm.screen.height)}screenPositonToStagePosition(t){let e=te.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.getScreenSizeCenter());return this.ƀii(e)}setScreenPositionToStagePositionFunction(t){this.ƀii=t}resetScreenPositionToStagePositionFunction(){this.ƀii=t=>t}destroyAsset(t){_.destroyAsset(t)}ƀis(){let t=new re.Vector(this.ƀhm.screen.width,this.ƀhm.screen.height);this.ƀij.value=t,this.ƀik.value=t.multiplyNumber(.5).round()}};var St=require("helpers-lib"),Y=C(require("pixi.js"));var Vt=require("helpers-lib"),Oe=C(require("pixi.js"));var se=require("helpers-lib"),oe=C(require("pixi.js"));var mt=require("helpers-lib"),vr=C(require("pixi.js"));var gi=class o extends vr.Filter{static{h(this,"ExpandWithColorFilter")}static ƀef(){return`
32
+ `,i}constructor(t,e){super(ei.ƀef(),ei.ƀdo(me.getValuesForLinearSamplingGauss(t),e)),this.ƀet=e,this.resolution=R;}apply(t,e,i,r){this.uniforms.pixelSize=this.ƀet?1/(e.width*R):1/(e.height*R),t.applyFilter(this,e,i,r);}},Rt=class extends V__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super(),this.ƀjh=t,this.resolution=R,this.ƀjh=t.multiplyNumber(R).floor(),this.ƀjh.x<0||this.ƀjh.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀjh.x>100||this.ƀjh.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀev=new Bi(this.ƀjh.x,true),this.ƀke=new Bi(this.ƀjh.y,false),this.padding=Math.max(this.ƀjh.x,this.ƀjh.y);}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀke.apply(t,e,s,V__namespace.CLEAR_MODES.CLEAR),this.ƀev.apply(t,s,i,r),t.returnFilterTexture(s);}get blendMode(){return this.ƀev.blendMode}set blendMode(t){this.ƀev.blendMode=t,this.ƀke.blendMode=t;}};var ye=class{static{h(this,"Filters");}get red(){return this.ƀhv}set red(t){this.ƀhv=t,this.ƀhw();}get green(){return this.ƀej}set green(t){this.ƀej=t,this.ƀhw();}get blue(){return this.ƀaf}set blue(t){this.ƀaf=t,this.ƀhw();}get brightness(){return this.ƀak}set brightness(t){this.ƀak=t,this.ƀhw();}get contrast(){return this.ƀbk}set contrast(t){this.ƀbk=t,this.ƀhw();}get blur(){return this.ƀag}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀag&&e&&!this.ƀag.isEqual(e)||this.ƀag&&!e||!this.ƀag&&e)&&(this.ƀag=e,this.ƀah&&(this.ƀah.destroy(),this.ƀah=void 0),e&&(this.ƀah=new Rt(e),this.ƀgo()));}constructor(t){this.ƀbg=t,this.ƀhv=1,this.ƀej=1,this.ƀaf=1,this.ƀak=1,this.ƀbk=1,this.ƀgo();}removeColorFilter(){this.ƀaz?.destroy(),this.ƀaz=void 0,this.ƀgo();}ƀhw(){this.ƀhv===1&&this.ƀej===1&&this.ƀaf===1&&this.ƀak===1&&this.ƀbk===1?this.ƀaz&&(this.ƀaz.destroy(),this.ƀaz=void 0,this.ƀgo()):(this.ƀaz||(this.ƀaz=new V__namespace.ColorMatrixFilter,this.ƀaz.resolution=R,this.ƀgo()),this.ƀaz.matrix=[this.ƀhv*this.ƀbk,0,0,0,this.ƀak-1,0,this.ƀej*this.ƀbk,0,0,this.ƀak-1,0,0,this.ƀaf*this.ƀbk,0,this.ƀak-1,0,0,0,1,0]);}ƀgo(){let t=[];this.ƀah&&t.push(this.ƀah),this.ƀaz&&t.push(this.ƀaz),this.ƀbg.filters=t;}};var u=class o extends fe{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},o.allContainers.set(this.id,this),this.filters=new ye(this.pixiContainer);}destroy(){this.destroyed||(super.destroy(),o.allContainers.delete(this.id),!this.pixiContainer.destroyed&&this.pixiContainer.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=o.allContainers.get(t),!i)throw new Error(`Container: parent not found! id: ${t}`)}else i=t;let r={addUnder:i.defaultChildOptions.addUnder,cropOverflowingParts:i.defaultChildOptions.cropOverflowingParts,...e};if(r.addUnder?i.addChildTo.pixiContainer.addChildAt(this.pixiContainer,0):i.addChildTo.pixiContainer.addChild(this.pixiContainer),r.cropOverflowingParts)if(i)this.pixiContainer.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}get boundingBox(){let t=this.pixiContainer.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}};var M=class{static{h(this,"GameAssets");}static{this.ƀib=new Map;}static{this.ƀo=0;}static getAsset(t){let e=this.ƀib.get(t);if(e)return e;throw new Error(`Game Assets: Resource not found! Key: "${t}"`)}static insertAsset(t,e){return e||(e=`a-${this.ƀo++}`),this.ƀib.set(e,t),e}static destroyAsset(t){let e=this.ƀib.get(t);e&&(e.destroy(true),this.ƀib.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(s=>{if(!helpersLib.Comparator.isString(s.url))throw new Error(`GameAssets: source url should be a string: ${s.url}`);let n=e.get(s.url);n?n.push(s.id):(e.set(s.url,[s.id]),i.push({url:s.url,callback:h(a=>{if(a instanceof V__namespace.Texture&&(a.id=s.id),n=e.get(s.url),n)n.forEach(l=>{this.ƀib.set(l,a);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${s}`)},"callback")}));});let r=performance.now();return Promise.all(i.map(s=>V__namespace.Assets.load(s.url))).then(s=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-r)/1e3," seconds"),s.forEach((a,l)=>{i[l].callback(a);});}).catch(s=>{throw new Error(`GameAssets: during asset loading, an error occured: ${s}`)})}};var Yt=class{static{h(this,"PositionConversionHelper");}static includeScaleInScreenPosition(t,e,i){if(e!==1){let r=helpersLib.Vector.fromTo(i,t).multiplyNumber(1/e);return i.add(r)}else return t}static normalizePolygonByAnchor(t,e,i){let r=new helpersLib.Vector(e.x*i.x,e.y*i.y);return t.map(s=>s.map(n=>r.to(helpersLib.Vector.fromVec2(n))))}},xe=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀiv=t.map(r=>new V__namespace.Polygon(r.map(s=>new V__namespace.Point(s.x,s.y))));}contains(t,e){return this.ƀiv.some(i=>i.contains(t,e))}};var Jr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},yt=new U;exports.CameraGateway=class It{static{h(this,"CameraGateway");}createCamera(){return yt.trigger("createCamera")}update(t,e){return yt.trigger("update",t,e)}setPosition(t){return yt.trigger("setPosition",t)}setTransition(t){return yt.trigger("setTransition",t)}getCameraPosition(){return yt.trigger("getCameraPosition")}};exports.CameraGateway=Jr([d()],exports.CameraGateway);var Yr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},be=new U,Xt=class{static{h(this,"CameraViewGateway");}getLayers(){return be.trigger("getLayers")}appear(t,e){return be.trigger("appear",t,e)}};Xt=Yr([d()],Xt);var _i;(function(o){o.BackgroundScreen="backgroundScreen",o.Background="background",o.Main="main",o.Foreground="foreground",o.ForegroundScreen="foregroundScreen";})(_i||(_i={}));exports.FocusingAnimation=void 0;(function(o){o[o.Instant=1]="Instant",o[o.EaseInOut=2]="EaseInOut",o[o.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var Xr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},L=class extends gt{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);}};L=Xr([mt()],L);var Zr=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Kr=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},At=class extends Ut{static{h(this,"CameraView");}constructor(t){super(),this.ƀcu=t,this.ƀie=new u().setAlpha(0).displayParent(w.instance.stage).attach(this),this.ƀad=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(w.instance.stage).attach(this),this.ƀab=new u().displayParent(this.ƀie).attach(this),this.ƀap=new u().displayParent(this.ƀie).attach(this),this.ƀde=new u().setSortableChildren(true).displayParent(this.ƀie).attach(this),this.ƀao=new u().setSortableChildren(true).displayParent(this.ƀap).attach(this),this.ƀdd=new u().setSortableChildren(true).setZIndex(20).displayParent(this.ƀao).attach(this),this.ƀfx=new u().setSortableChildren(true).setZIndex(10).displayParent(this.ƀao).attach(this),this.ƀaa=new u().setZIndex(0).displayParent(this.ƀao).attach(this),this.ƀh=new O(this.ƀie,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀae=new O(this.ƀad,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),w.instance.screenSize.subscribe(e=>{this.ƀad.aspectRatio=e.x/e.y,this.ƀad.scale=Math.max(e.x,e.y),this.ƀad.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),w.instance.setScreenPositionToStagePositionFunction(e=>new helpersLib.Vector(e.x-this.ƀao.position.x-this.ƀap.position.x,e.y-this.ƀao.position.y-this.ƀap.position.y)),this.ƀcu.position.subscribe(e=>{this.ƀao.position=this.ƀbp(e);}).attach(this),this.ƀcu.offset.subscribe(e=>{this.ƀap.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),w.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀab.id,background:this.ƀaa.id,main:this.ƀfx.id,foreground:this.ƀdd.id,foregroundScreen:this.ƀde.id}}appear(t,e){switch(e){case "alpha":return this.ƀae.set({alpha:0}),this.ƀh.set({alpha:t?0:1}),this.ƀh.animate({alpha:t?1:0}).chain(this);case "pureBlack":return this.ƀh.set({alpha:1}),this.ƀae.set({alpha:t?1:0}),this.ƀae.animate({alpha:t?0:1}).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀae.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error('Switch ended with value "never".')}}}ƀbp(t){return helpersLib.Vector.fromTo(t,w.instance.getScreenSizeCenter())}};At=Zr([Xe({entity:L}),Kr("design:paramtypes",[L])],At);var ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},es=1500,Se=class{static{h(this,"CameraService");}createCamera(){return new L().attachToRoot()}getCameraPosition(){let t=L.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=L.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=L.getInstanceOrFail();e.focusingNewTargetInfo.value={time:w.time,duration:t?.duration??es,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=L.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfj(i,r,t):i.position.value=r);}ƀfj(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbb(t,e);else {let s=(i-r.time)/r.duration;if(s>=1)this.ƀbb(t,e);else {let n;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=X.easeInOut(s):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=X.easeOut(s):n=1;let a=r.position.lerp(e,n);r.roundPosition&&(Math.abs(a.x-r.position.x)>=r.roundPositionThreshold&&(a=new helpersLib.Vector(Math.round(a.x),a.y)),Math.abs(a.y-r.position.y)>=r.roundPositionThreshold&&(a=new helpersLib.Vector(a.x,Math.round(a.y)))),t.position.value=a;}}}ƀbb(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Se=ts([d()],Se);var is=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},rs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},si=class{static{h(this,"CameraController");}constructor(t){this.ƀaq=t;}createCamera(){return this.ƀaq.createCamera().id}update(t,e){this.ƀaq.update(t,e);}setPosition(t){this.ƀaq.setPosition(t);}setTransition(t){this.ƀaq.setTransition(t);}getCameraPosition(){return this.ƀaq.getCameraPosition()}};si=is([et({controllerLink:yt}),rs("design:paramtypes",[Se])],si);var ss=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},oi=class{static{h(this,"CameraViewController");}getLayers(){let t=L.getInstanceOrFail().id;return At.getInstanceOrFail(t).getLayers()}appear(t,e){let i=L.getInstanceOrFail().id;return At.getInstanceOrFail(i).appear(t,e)}};oi=ss([et({controllerLink:be})],oi);var Kt=class{static{h(this,"Camera");}get position(){return this.ƀan.getCameraPosition()}constructor(){this.ƀan=P.get(exports.CameraGateway),this.ƀar=P.get(Xt),this.ƀan.createCamera(),this.layers=this.ƀar.getLayers();}setPosition(t){this.ƀan.setPosition(t);}setTransition(t){this.ƀan.setTransition(t);}appear(t,e="alpha"){return this.ƀar.appear(t,e)}};var w=class o{static{h(this,"Game");}static get instance(){return this.ƀfg}static{this.pause=actionsLib.Reducer.createOr();}static get camera(){return this.ƀam}static get time(){return y.ƀjr}static get setupOptions(){return this.ƀit}getScreenSize(){return this.ƀij.value}getScreenSizeCenter(){return this.ƀik.value}constructor(t){if(this.ƀij=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀij.notifier,this.ƀik=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀik.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),o.ƀfg)throw new Error("There can be only one Game instance!");this.ƀbf={screenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,...t},this.devMode=this.ƀbf.devMode||false,this.ƀhm=new V__namespace.Application({backgroundColor:this.ƀbf.backgroundColor,autoStart:false,antialias:R<1.5,resolution:R,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0});}async setup(t){o.ƀit=t,document.body.appendChild(this.ƀhm.view),await Promise.all([M.loadGameAssets(t.assetDefinitions)]),o.ƀfg=this,this.stage=new u().attachToRoot(),this.stage.pixiContainer=this.ƀhm.stage,this.renderer=this.ƀhm.renderer,this.ƀis(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀhm,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀis());}),o.ƀam=new Kt,this.ƀhm.start(),this.ƀhm.ticker.add(()=>{y.triggerUpdateTick(this.ƀhm.ticker.deltaMS);});}setResolution(t){this.ƀhm.renderer.resolution=t,this.ƀhm.renderer.resize(this.ƀhm.screen.width,this.ƀhm.screen.height);}screenPositonToStagePosition(t){let e=Yt.includeScaleInScreenPosition(t,o.instance.stage.scale,o.instance.getScreenSizeCenter());return this.ƀii(e)}setScreenPositionToStagePositionFunction(t){this.ƀii=t;}resetScreenPositionToStagePositionFunction(){this.ƀii=t=>t;}destroyAsset(t){M.destroyAsset(t);}ƀis(){let t=new helpersLib.Vector(this.ƀhm.screen.width,this.ƀhm.screen.height);this.ƀij.value=t,this.ƀik.value=t.multiplyNumber(.5).round();}};var Te=class o extends V__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀef(){return `
33
33
  attribute vec2 aVertexPosition;
34
34
  attribute vec2 aTextureCoord;
35
35
 
@@ -52,8 +52,8 @@
52
52
  void main(void) {
53
53
  float highestAlpha = 0.0;`;return t>0?e+=`
54
54
 
55
- for (float x = -${mt.NumberHelper.toFloatString(t)}; x <= ${mt.NumberHelper.toFloatString(t)}; x++) {
56
- for (float y = -${mt.NumberHelper.toFloatString(t)}; y <= ${mt.NumberHelper.toFloatString(t)}; y++) {
55
+ for (float x = -${helpersLib.NumberHelper.toFloatString(t)}; x <= ${helpersLib.NumberHelper.toFloatString(t)}; x++) {
56
+ for (float y = -${helpersLib.NumberHelper.toFloatString(t)}; y <= ${helpersLib.NumberHelper.toFloatString(t)}; y++) {
57
57
  vec4 neighborColor = texture2D(uSampler, vTextureCoord + vec2(x * pixelSize.x, y * pixelSize.y));
58
58
  float distance = x * x + y * y;
59
59
  highestAlpha = max(highestAlpha, neighborColor.a * step(distance, expandSquared));
@@ -64,4 +64,4 @@
64
64
  highestAlpha = centerColor.a;`,e+=`
65
65
 
66
66
  gl_FragColor = vec4(color, 1.0) * highestAlpha;
67
- }`,e}constructor(t,e){if(super(o.ƀef(),o.ƀdo(t*A)),this.ƀcw=t,this.resolution=A,this.ƀcw=t*A,this.ƀcw<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcw>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");mt.Comparator.isInteger(this.ƀcw)||(this.ƀcw=Math.floor(this.ƀcw));let i=mt.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcw*this.ƀcw,this.padding=this.ƀcw}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*A),1/(e.height*A)]),t.applyFilter(this,e,i,r)}};var yi=class extends oe.Filter{static{h(this,"GlowFilter")}constructor(t){super(),this.resolution=A;let e={blurRadius:1,expand:0,color:se.ColorHelper.white,blendMode:Bt.Screen,...t};this.ƀcx=new gi(e.expand,e.color);let i=se.Comparator.isNumber(e.blurRadius)?new se.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀah=new qt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀah.blendMode=oe.BLEND_MODES.SCREEN}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀcx.apply(t,e,s,oe.CLEAR_MODES.CLEAR),this.ƀah.apply(t,s,i,r),t.returnFilterTexture(s)}};var Me=class o{static{h(this,"GlowSpriteGenerator")}static{this.ƀei=new Map}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),s=Vt.Comparator.isNumber(r.blurRadius)?new Vt.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀdq(t.texture,s,r.expand,r.color,i),a=new Oe.Sprite(n);return this.ƀir(a,Vt.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀdq(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(o.ƀei.has(n))return o.ƀei.get(n);{let a=this.ƀdr(t,e,i,r);return o.ƀei.set(n,a),a}}else return this.ƀdr(t,e,i,r)}static ƀdr(t,e,i,r){let s=new Oe.Sprite(t);this.ƀcz(s,Math.max(e.x,e.y)+i),s.filters=[new yi({blurRadius:e,expand:i,color:r})];let n=w.instance.renderer.generateTexture(s);return n.id=_.insertAsset(n),s.destroy(),n}static ƀir(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,s=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,s)}static ƀcz(t,e){if(t.isSprite){let s=new Oe.Graphics;t.addChild(s)}let i=t.width,r=t.height;t.calculateBounds=function(){this._bounds.clear(),this._bounds.addFrame(this.transform,-e,-e,i+e,r+e)}}static ƀbc(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:Vt.ColorHelper.white,blendMode:Bt.Add};return t&&(e={...e,...t}),e}};G.onHardReset.subscribe(()=>{Me.ƀei.clear()}).attachToRoot();var q=class o extends u{static{h(this,"Sprite")}static createByName(t){let e=w.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.pixiContainer,i=e.parent;i&&i.removeChild(e);let r=w.instance.renderer.generateTexture(e,{resolution:2,scaleMode:Y.SCALE_MODES.LINEAR,multisample:Y.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:_.insertAsset(r),scale:t.scale,size:t.size,anchor:St.Vector.zero,boundingShapes:void 0,destroyAssetOnDestroy:!0};return new o(n,{ignoreAnchor:!0})}constructor(t,e={}){if(super(),this.ƀjq=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀiz=t,this.pixiSprite=new Y.Sprite(_.getAsset(t.id)),this.pixiContainer.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.ƀfz?.destroy(),this.ƀaj?.destroy(),this.ƀiz.destroyAssetOnDestroy&&(_.destroyAsset(this.ƀiz.id),this.ƀhn&&_.destroyAsset(this.ƀhn.texture.id)),this.ƀhn&&!this.ƀhn.destroyed&&this.ƀhn.destroy())}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjq}set textureScale(t){this.ƀjq=t,this.pixiSprite.scale.set(t)}get size(){return new St.Vector(this.pixiSprite.width,this.pixiSprite.height)}getMask(){return this.pixiSprite}set interactive(t){super.interactive=t,t&&this.ƀiz.boundingShapes&&!this.pixiContainer.hitArea&&(this.pixiContainer.hitArea=new pi(this.ƀiz.boundingShapes,this.size,St.Vector.fromVec2(this.ƀiz.anchor)))}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===Y.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=Y.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=Y.MIPMAP_MODES.OFF}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 Y.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.ƀhn)return this.ƀhn.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀhn)this.ƀhn.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=St.Vector.fromVec2(this.ƀiz.anchor).to(t);return new St.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀhn&&(this.ƀhn.destroy(),this.ƀhn=void 0),t&&(this.ƀhn=Me.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀiz.destroyAssetOnDestroy),this.ƀhn.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀhn.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.pixiContainer.addChild(this.ƀhn)),this}showBoundingShape(t){return t?this.ƀaj||(this.ƀaj=this.ƀbs().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀaj&&(this.ƀaj.destroy(),this.ƀaj=void 0),this}getBoundingMask(){if(!this.ƀfz){if(!this.ƀiz.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀfz=this.ƀbs(),this.ƀfz.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀfz.pixiSprite.renderable=!1,this.ƀfz.displayParent(this)}return this.ƀfz}ƀbs(){if(!this.ƀiz.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return R.createPolygon(this.ƀiz.boundingShapes,St.ColorHelper.white).toSprite().attach(this)}download(){let t=w.instance.renderer.extract.canvas(this.pixiContainer);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}};var xi=require("helpers-lib");var wi=class{static{h(this,"DashedLineHelper")}static getLines(t,e,i){let r=xi.Vector.fromTo(t,e),s=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,f=Math.floor(c/p),g=c-p*f;f>=1&&g<i.dashLength&&(g+=p,f--);let E=s.normalize(g/2),rt=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(E)}),l=l.add(E),f>0){let yt=s.normalize(i.dashLength);xi.ArrayHelper.createEmptyArray(f).forEach(()=>{l=l.add(rt),a.push({from:l,to:l.add(yt)}),l=l.add(yt)})}return l=l.add(rt),a.push({from:l,to:l.add(E)}),a}};var R=class o extends u{static{h(this,"Graphics")}static{this.ƀcq=new Map}static createArrow(t,e){let i=new U.Graphics,r=[[{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}]];return i.beginFill(e),r.forEach(s=>{i.drawPolygon(s.map(n=>new U.Point(n.x,n.y)))}),i.endFill(),new o(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let r={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:at.ColorHelper.white,...i},s=new U.Graphics;return s.lineStyle(r.width,r.color),wi.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y)}),new o(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new U.Graphics;return r.lineStyle(2,i),r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.lineStyle(1,i),r.beginFill(at.ColorHelper.white),r.drawCircle(t.x,t.y,3),r.endFill(),new o(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new U.Graphics;return r.beginFill(i),r.drawRect(0,0,t.x,e),r.drawRect(0,e,e,t.y-e*2),r.drawRect(t.x-e,e,e,t.y-e*2),r.drawRect(0,t.y-e,t.x,e),r.endFill(),new o(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=at.ColorHelper.white){let i=new U.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new U.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new U.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new U.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new U.Point(n.x,n.y)))}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new U.Graphics,s=new at.Radian(at.PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=s.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p)}return r.endFill(),new o(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.pixiContainer.addChild(t),this.pixiGraphics=t,this.ƀal=e}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy())}toSprite(t){let e={cacheName:this.ƀal,keepBounds:!0,cache:!1,...t},i=this.ƀec(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},boundingShapes:void 0,destroyAssetOnDestroy:!e.cache},s=new q(r,{texturePosition:i.bounds,ignoreAnchor:!0});return this.attachToRoot(),this.destroy(),s}ƀec(t,e){if(e){let i=o.ƀcq.get(t);return i||(i=this.ƀce(),o.ƀcq.set(t,i)),i}else return this.ƀce()}ƀce(){let t=w.instance.renderer.generateTexture(this.pixiGraphics);t.id=_.insertAsset(t);let e=this.pixiGraphics.getBounds();return{assetID:t.id,bounds:new at.Vector(e.x,e.y)}}};var br=C(require("pixi.js"));var vi=class extends u{static{h(this,"Placeholder")}constructor(t){super(),this.ƀho=new br.Graphics,this.ƀho.beginFill(0,1e-9),this.ƀho.drawRect(0,0,t.x,t.y),this.ƀho.endFill(),this.pixiContainer.addChild(this.ƀho)}destroy(){this.destroyed||(super.destroy(),this.ƀho.destroy())}};var ae=C(require("pixi.js")),Pr=require("script-engine-lib");var Nt=require("helpers-lib");var ne=class{static{h(this,"TextStyleConverter")}static getPixiTextStyle(t){let e={color:Nt.ColorHelper.white,align:"center",fontFamily:"Arial",fontStyle:"normal",fontSize:18,lineHeight:void 0,wordWrapWidth:void 0,lineThrough:!1,...t},i=t?.dropShadow===!0?{}:t?.dropShadow,r={};if(i){let s={blur:4,angle:Nt.Radian.get60,distance:10,color:Nt.ColorHelper.black,alpha:.5,...i};r={dropShadow:!0,dropShadowBlur:s.blur,dropShadowAngle:s.angle.value,dropShadowDistance:s.distance,dropShadowColor:Nt.ColorHelper.rgbToHex(s.color),dropShadowAlpha:s.alpha}}return{fontFamily:e.fontFamily,fill:Nt.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,...r}}};var bi=class{static{h(this,"RichTextDataInConverter")}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=Pr.RichTextSeparator.process(t,i),s=this.ƀfc(r,e),n=this.ƀr(s);return this.ƀix(n)}static ƀfc(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=ne.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdm(a.tags,e,i),p=s(l,c),f=ae.TextMetrics.measureText(" ",new ae.TextStyle(p),!1);return{text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:f.width}})}static ƀdm(t,e,i){let r=t.join("+");if(i.has(r))return{style:i.get(r),cacheKey:r};let s=this.ƀba(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀba(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:n,...a}=i;return a}static ƀr(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth})})}),e.push(i),e}static ƀix(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(s=>this.ƀiy(s.text).map(a=>{let l=new ae.TextStyle(s.pixiStyle),c=ae.TextMetrics.measureText(a,l,!1);return{text:a,whitespace:a.trim()==="",style:{cacheKey:s.cacheKey,style:s.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:s.spaceWidth}}}));e.push(r)}),e}static ƀiy(t){if(t==="")return[""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let n=t[s],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a)}return i&&e.push(i),e}};var Qi=require("helpers-lib");var Pi=class{static{h(this,"ConsistentSpaceTextWrapper")}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,s)=>{if(e.isSpaceAvailable(new Qi.Vector(r.style.width,r.style.height)))if(r.whitespace&&s===i.length-2){let n=i[i.length-1];e.isSpaceAvailable(new Qi.Vector(n.style.width+r.style.width,n.style.height))?e.insertWord(r):this.ƀkm(r,e)}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀkm(r,e):(e.newLine(),e.insertWord(r))}),e.newLine()}),e.print()}static ƀkm(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),r=Math.max(0,Math.min(i,t.text.length-1));if(r>0){let n={text:" ".repeat(r),whitespace:!0,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n)}e.newLine();let s=t.text.length-r-1;if(s>0){let n={text:" ".repeat(s),whitespace:!0,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n)}}};var M=require("helpers-lib");var Si=class{static{h(this,"RichTextTypewriter")}get lineIsEmpty(){return this.ƀch.length===0}get remainingWidth(){return this.ƀkl-this.ƀcj}constructor(t,e){if(this.ƀkl=t,this.ƀfr=[],this.ƀch=[],this.ƀcj=0,this.ƀfq=new M.Vector(0,0),this.ƀci=0,this.ƀeu=e?.horizontalAlignment??"left",this.ƀkd=e?.verticalAlignment??"bottom",e?.rectangleCutOption){if(e.rectangleCutOption.position.x<0||e.rectangleCutOption.position.x>=this.ƀkl||e.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀck={direction:e.rectangleCutOption.direction,rectangle:this.ƀbo(e.rectangleCutOption)}}}isSpaceAvailable(t){let e=Math.max(this.ƀci,t.y),i=this.ƀdu(this.ƀfq.y,this.ƀfq.y+e);return this.ƀcj+t.x<=i}insertWord(t){let e=Math.max(this.ƀci,t.style.height);if(this.ƀch.length===0){let i=this.ƀdv(this.ƀfq.y,this.ƀfq.y+e);this.ƀfq=new M.Vector(i,this.ƀfq.y),this.ƀcj=this.ƀfq.x}this.ƀch.push({chunk:t,position:new M.Vector(this.ƀcj,this.ƀfq.y)}),this.ƀci=e,this.ƀcj+=t.style.width}newLine(){let t=this.ƀfq.y+this.ƀci,e=this.ƀdv(t,t);this.ƀdb(),this.ƀfq=new M.Vector(e,t),this.ƀcj=this.ƀfq.x,this.ƀci=0}print(){return this.ƀdb(),this.ƀfr}ƀdb(){this.ƀch.length>0&&(this.ƀfr.push(this.ƀg(this.ƀch)),this.ƀch=[])}ƀg(t){return t=this.ƀkf(t),t=this.ƀew(t),t}ƀew(t){if(this.ƀeu==="left")return t;let e=this.ƀfq.y+this.ƀci,i=this.ƀdv(this.ƀfq.y,e),s=this.ƀdu(this.ƀfq.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀeu==="center"?a=(s-n)/2:a=s-n,t.map(l=>(l={chunk:l.chunk,position:new M.Vector(l.position.x+a,l.position.y)},l))}ƀkf(t){let e=Math.max(...t.map(r=>r.chunk.style.ascent)),i=Math.max(...t.map(r=>r.chunk.style.descent));return t.map(r=>{let s;switch(this.ƀkd){case"top":s=i-r.chunk.style.descent;break;case"center":s=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case"bottom":s=e-r.chunk.style.ascent;break}return r={chunk:r.chunk,position:new M.Vector(r.position.x,r.position.y+s)},r})}ƀdv(t,e){return this.ƀck&&(this.ƀck.direction==="topLeft"||this.ƀck.direction==="bottomLeft")&&(this.ƀck.rectangle.isPointInside(new M.Vector(0,t),{includeEdges:!1})||this.ƀck.rectangle.isPointInside(new M.Vector(0,e),{includeEdges:!1}))?this.ƀck.rectangle.bottomRight.x:0}ƀdu(t,e){return this.ƀck&&(this.ƀck.direction==="topRight"||this.ƀck.direction==="bottomRight")&&(this.ƀck.rectangle.isPointInside(new M.Vector(this.ƀkl,t),{includeEdges:!1})||this.ƀck.rectangle.isPointInside(new M.Vector(this.ƀkl,e),{includeEdges:!1}))?this.ƀck.rectangle.topLeft.x:this.ƀkl}ƀbo(t){let e,i;switch(t.direction){case"topRight":e=new M.Vector(t.position.x,-1/0),i=new M.Vector(1/0,t.position.y);break;case"topLeft":e=new M.Vector(-1/0,-1/0),i=t.position;break;case"bottomRight":e=t.position,i=new M.Vector(1/0,1/0);break;case"bottomLeft":e=new M.Vector(-1/0,t.position.y),i=new M.Vector(t.position.x,1/0);break}return new M.Rectangle(e,i)}};var Ci=class{static{h(this,"RichTextDataOutConverter")}static process(t){return t=this.ƀgd(t),t=this.ƀjw(t),this.ƀau(t)}static ƀgd(t){return t.map(e=>{let i=[],r,s=!0;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,s=n.chunk.whitespace;else{let a=r.chunk.text+n.chunk.text;s=n.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position}}}),r&&i.push(r),i})}static ƀjw(t){return t.map(e=>{if(e.length===0)return[];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let r=i.chunk.text.length,s=i.chunk.text.trimEnd();r!==s.length?e.push({chunk:{text:s,whitespace:!1,style:{...i.chunk.style,width:i.chunk.style.width-(r-s.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i)}return e})}static ƀau(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 De=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=bi.process(t,e),r=new Si(e.default.wordWrapWidth??1/0,{rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=Pi.wrapText(i,r);return Ci.process(s)}};var Be=require("helpers-lib"),tt=C(require("pixi.js"));var as=1,Sr=1/as,he=class extends u{static{h(this,"Text")}get ƀjo(){if(!this.ƀjp){let t=new tt.TextStyle(this.ƀhq);this.ƀjp=tt.TextMetrics.measureText(this.ƀjn,t)}return this.ƀjp}get ascent(){return this.ƀjo.fontProperties.ascent}constructor(t,e){super(),this.ƀhq=ne.getPixiTextStyle(e),this.setText(t)}destroy(){this.destroyed||(super.destroy(),!this.ƀhp.destroyed&&this.ƀhp.destroy())}setAnchor(t){return this.anchor=t,this}get anchor(){return new Be.Vector(this.ƀhp.anchor.x,this.ƀhp.anchor.y)}set anchor(t){this.ƀhp.anchor.set(t.x,t.y)}setPosition(t,e){if(e?.holdFrom){let i=this.ƀhq.dropShadowDistance??0,r=new Be.Vector(e.holdFrom.x*i,e.holdFrom.y*i);t=t.add(r)}return super.setPosition(t,e),this}setText(t){return this.ƀjn!==t&&(this.ƀjn=t,this.ƀhx()),this}setColor(t){let e=Be.ColorHelper.rgbToHex(t);return this.ƀhq.fill!==e&&(this.ƀhq.fill=e,this.ƀhx()),this}ƀhx(){this.ƀhp?.destroy(),this.ƀji?.destroy(),this.ƀji=void 0,this.ƀjp=void 0;let t=new tt.TextStyle(this.ƀhq);this.ƀhp=new tt.Text(this.ƀjn,t),this.ƀhp.scale.set(Sr,Sr),this.pixiContainer.addChild(this.ƀhp),this.ƀhq.lineThrough&&(this.ƀji=this.ƀe(this.ƀhp,this.ƀhq.fill),this.pixiContainer.addChild(this.ƀji))}ƀe(t,e){let i=tt.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new tt.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=tt.TextMetrics.measureText(l,t.style),f=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,g=0;t.style.align==="center"?g=0+(t.width-p.width)*.5:t.style.align==="right"&&(g=0+t.width-p.width),g=Math.floor(g),n.moveTo(Math.floor(g),f),n.lineTo(Math.floor(g+p.width),f),a+=p.lineHeight}),n.endFill(),n}};var Ti=class extends u{static{h(this,"RichText")}constructor(t,e){super(),De.process(t,e).forEach(r=>new he(r.text,r.style).setPosition(r.position).displayParent(this).attach(this))}};var Ei=class extends u{static{h(this,"UpdatableContainer")}},Ri=class extends u{static{h(this,"DisplayObjectArray")}constructor(t,e){super(),this.ƀbu=t,this.ƀcn=new Map,this.ƀgx={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e}}set(t){let e=new Set(this.ƀcn.values()),i=0;t.forEach((r,s)=>{let n=this.ƀgx.trackBy(r,s),a;this.ƀcn.has(n)?(a=this.ƀcn.get(n),e.delete(a),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀcn.set(n,a)),this.ƀgx.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀgx.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀgx.positioning.spacing)}),e.forEach(r=>{r.destroy()})}};var Ge=require("actions-lib"),jt=require("helpers-lib");var Ht=class o extends u{static{h(this,"Menu")}static{this.ƀju=!1}static closeAll(){return o.ƀgw?o.ƀgw.close():Ge.SingleEvent.instant()}constructor(t,e){super(),this.ƀgp=new Ge.SingleAction,this.onOpen=this.ƀgp.notifier,this.ƀgk=new Ge.SingleAction,this.onClose=this.ƀgk.notifier;let i={closeOnBackgroundClick:!0,appearAnimationDuration:150,darkeningAlpha:.3,...e};this.setZIndex(100).setAlpha(0),this.ƀn=new D(this,"alpha",{animation:S.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:F.CompletePrevious,completionHandling:O.StayInCurrentState}),this.ƀz=R.createRectangle(new jt.Vector(1,1),jt.ColorHelper.black).toSprite({cache:!0}).setAlpha(i.darkeningAlpha).setInteractive(!0).displayParent(this).attach(this),this.ƀgc=q.createByName(t).setPosition(new jt.Vector(0,0)).setInteractive(!0).displayParent(this).attach(this),w.instance.screenSize.subscribe(r=>{this.ƀz.aspectRatio=r.x/r.y,this.ƀz.scale=Math.max(r.x,r.y),this.ƀz.setPosition(jt.Vector.zero,{holdFrom:jt.Vector.half}),this.setPosition(r.multiplyNumber(.5))}).attach(this),o.ƀgw=this,this.onDestroy().tap(()=>{o.ƀgw=void 0}).attachToRoot(),i.closeOnBackgroundClick&&this.ƀz.on(Kt.Click,()=>{o.ƀju||this.ƀp(!1)}).attach(this),this.ƀp(!0)}getBoundingMask(){return this.ƀgc.getBoundingMask()}close(){return this.ƀp(!1)}ƀp(t){if(o.ƀju)throw new Error("WindowUI: cannot iterate while in transition");return o.ƀju=!0,this.ƀn.animate({alpha:t?1:0}).chain(this).tap(()=>{o.ƀju=!1,t?this.ƀgp.resolve():(this.ƀgk.resolve(),this.destroy())}).chainToRoot()}};var Ii=require("actions-lib");var Ai=class extends bt{static{h(this,"MenuEntity")}constructor(t,e){super(),this.ƀgn=new Ii.SingleAction,this.onCreate=this.ƀgn.notifier,this.ƀgp=new Ii.SingleAction,this.onOpen=this.ƀgp.notifier,this.ƀgk=new Ii.SingleAction,this.onClose=this.ƀgk.notifier,Ht.closeAll().tap(()=>{if(!Ot.getActiveScene())throw new Error("WindowEntity: constructor is called when there is no active scene!");w.pause.effect(!0).attach(this),this.ƀgc=new Ht(t,e).displayParent(w.camera.layers.foregroundScreen).attach(this),this.ƀgn.resolve(this.ƀgc),this.ƀgc.onOpen.subscribe(()=>this.ƀgp.resolve()).attach(this),this.ƀgc.onClose.subscribe(()=>{this.ƀgk.resolve(),this.destroy()}).attach(this)}).attach(this)}close(){if(this.ƀgc){let t=this.onClose.toSingleEvent().destroyIfNotAttached();return this.ƀgc.close(),t}else return this.onCreate.asyncMapQueue(()=>this.close()).singleChain(this)}};var Cr=require("actions-lib"),Tr=C(require("pixi.js"));var le=require("actions-lib"),Fe=require("helpers-lib");var hs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ls=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ct=class{static{h(this,"MouseService")}get initialMouseMoveHappened(){return this.ƀfe.value}getStagePosition(){return this.ƀja.value}getScreenPosition(){return this.ƀih.value}getMainButtonState(){return this.ƀfw.value}getSecondaryButtonState(){return this.ƀin.value}constructor(){this.ƀfe=new le.Variable(!1),this.onInitialMouseMove=this.ƀfe.notifier,this.ƀja=new le.Variable(Fe.Vector.zero,{notifyOnChange:!0}),this.stagePosition=this.ƀja.notifier,this.ƀih=new le.Variable(Fe.Vector.zero,{notifyOnChange:!0}),this.screenPosition=this.ƀih.notifier,this.ƀfw=new le.Variable(!1),this.mainButtonState=this.ƀfw.notifier,this.ƀin=new le.Variable(!1),this.secondaryButtonState=this.ƀin.notifier,this.ƀjb(),window.addEventListener("mousedown",t=>{t.button===0?this.ƀfw.value=!0:t.button===2&&(this.ƀin.value=!0)}),window.addEventListener("mouseup",t=>{t.button===0?this.ƀfw.value=!1:t.button===2&&(this.ƀin.value=!1)}),window.addEventListener("blur",()=>{this.ƀfw.value=!1,this.ƀin.value=!1})}ƀjb(){let t=Fe.Vector.zero;window.addEventListener("mousemove",e=>{t=new Fe.Vector(e.clientX,e.clientY),this.ƀfe.value=!0}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀih.value=t}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=w.instance.screenPositonToStagePosition(this.ƀih.value);e.isEqual(this.ƀja.value)?w.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀih.value.x,clientY:this.ƀih.value.y,pointerType:"mouse"})):this.ƀja.value=e}).attachToRoot()}};Ct=hs([d(),ls("design:paramtypes",[])],Ct);var ce=class extends u{static{h(this,"MouseWheelListenerUI")}constructor(t){super(),this.ƀgt=new Cr.Action,this.onWheel=this.ƀgt.notifier,this.ƀep=(e=>{let i=P.get(Ct).getScreenPosition(),r=this.ƀkk.getBounds();i.x>=r.x&&i.x<=r.x+r.width&&i.y>=r.y&&i.y<=r.y+r.height&&this.ƀgt.trigger(e.deltaY)}).bind(this),this.ƀkk=new Tr.Graphics,this.ƀkk.beginFill(0,1e-9),this.ƀkk.drawRect(0,0,t.x,t.y),this.ƀkk.endFill(),this.pixiContainer.addChild(this.ƀkk),window.addEventListener("wheel",this.ƀep)}destroy(){this.destroyed||(super.destroy(),this.ƀkk.destroy(),window.removeEventListener("wheel",this.ƀep))}};var Ir=require("helpers-lib");var Er=require("helpers-lib");var cs=.65,ps=.01,Oi=class{static{h(this,"SmoothScroller")}get scrollHeight(){return this.ƀil}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀgz=i,this.ƀiw=r,this.ƀff=!1,this.ƀil=e-i*2,this.ƀbh.y=i,this.ƀjj=i}onWheel(t){this.setTarget(this.ƀjj-t*cs)}scrollToTop(){this.setTarget(1/0)}scrollToBottom(){this.setTarget(-1/0)}setTarget(t){this.ƀjj=Er.NumberHelper.clamp(t,this.ƀu-this.ƀgz-this.contentSize.y,this.ƀgz)}jumpToTarget(){this.ƀbh.y=this.ƀjj}update(t){let e=this.contentSize;if(e.y<=this.ƀil){switch(this.ƀiw){case"start":this.ƀjj=this.ƀgz;break;case"center":this.ƀjj=(this.ƀu-e.y)*.5;break;case"end":this.ƀjj=this.ƀu-e.y-this.ƀgz;break}this.ƀff||(this.ƀbh.y=this.ƀjj)}this.ƀff=!0;let i=this.ƀjj-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*ps*t}};var I=require("helpers-lib"),Rr=C(require("pixi.js"));var qi=class{static{h(this,"AnimationEaseInOutFlatter")}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},Tt=class o extends u{static{h(this,"ScrollMaskUI")}static{this.ƀcq=new Map}constructor(t,e,i,r=ht.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 s=new u;r===ht.Horizontal?this.ƀby(e,i,s):this.ƀcf(e,i,s),this.ƀfz=q.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀfz)}ƀcf(t,e,i){e>0&&this.ƀbv(new I.Vector(t.x,e)).displayParent(i).attach(i),R.createRectangle(new I.Vector(t.x,t.y-e*2),I.ColorHelper.white).toSprite().setPosition(new I.Vector(0,e),{round:!1}).displayParent(i).attach(i),e>0&&this.ƀbv(new I.Vector(t.x,e)).setPosition(new I.Vector(t.x,t.y),{round:!1}).setRotation(I.Radian.get180).displayParent(i).attach(i)}ƀby(t,e,i){e>0&&this.ƀbv(new I.Vector(t.y,e)).setPosition(new I.Vector(0,t.y),{round:!1}).setRotation(I.Radian.get270).displayParent(i).attach(i),R.createRectangle(new I.Vector(t.x-e*2,t.y),I.ColorHelper.white).toSprite().setPosition(new I.Vector(e,0),{round:!1}).displayParent(i).attach(i),e>0&&this.ƀbv(new I.Vector(t.y,e)).setPosition(new I.Vector(t.x,0),{round:!1}).setRotation(I.Radian.get90).displayParent(i).attach(i)}ƀbv(t){let i={id:this.ƀbw(t.y),scale:1,size:t,anchor:{x:0,y:0},boundingShapes:void 0};return new q(i,{textureSize:t,ignoreAnchor:!0})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcq.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let n=new qi;I.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1)});let a=Rr.Texture.from(r);i=_.insertAsset(a),o.ƀcq.set(e,i)}else throw new Error("Canvas context is null")}return i}};var ds=15,Mi=class extends u{static{h(this,"ScrollAreaUI")}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀim.contentSize}constructor(t,e={}){super();let i={padding:ds,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 r=new u().displayParent(this).attach(this);new Tt(r,t,i.padding).attach(this);let s=new u().displayParent(r).attach(this);this.ƀim=new Oi(s,t.y,i.padding,i.smallContentAlign),this.ƀbi=new Ir.Vector(t.x,this.ƀim.scrollHeight),new ce(t).displayParent(r).attach(this).onWheel.subscribe(a=>this.ƀim.onWheel(a)).attach(this),y.afterSceneUpdateAction.subscribe(a=>this.ƀim.update(a.delta)).attach(this),this.addChildTo=s}scrollToTop(t){this.ƀim.scrollToTop(),t?.instant&&this.ƀim.jumpToTarget()}scrollToBottom(t){this.ƀim.scrollToBottom(),t?.instant&&this.ƀim.jumpToTarget()}};var tr=require("actions-lib");var us=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},fs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Di=class{static{h(this,"KeyboardService")}constructor(){this.ƀfm=new tr.Action,this.keyPressed=this.ƀfm.notifier,this.ƀfn=new tr.Action,this.keyReleased=this.ƀfn.notifier,this.ƀft=new Set,this.ƀfs=new Set,window.addEventListener("keydown",t=>{this.ƀft.add(t.key),this.ƀfs.add(t.key),!t.repeat&&this.ƀfm.trigger(t.key)}),window.addEventListener("keyup",t=>{this.ƀft.delete(t.key),this.ƀfn.trigger(t.key)}),window.addEventListener("blur",()=>{this.ƀft.clear()}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfs.clear()}).attachToRoot()}isKeyDown(t){return this.ƀft.has(t)}isKeyJustPressed(t){return this.ƀfs.has(t)}};Di=us([d(),fs("design:paramtypes",[])],Di);var Ar=require("actions-lib"),Or=require("helpers-lib");var ms=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},gs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Bi=class{static{h(this,"MouseTargetFocusService")}get focusedInLastFrame(){return this.ƀdc}get lastFocusedPosition(){return this.ƀfp}constructor(t){this.ƀgf=t,this.ƀgr=new Ar.Action,this.onTargetFocus=this.ƀgr.notifier,this.ƀjt=0,this.ƀjv=!1,this.ƀdc=!1,this.ƀfp=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀjx(e.delta)).attachToRoot()}ƀjx(t){if(this.ƀgg){let e=this.ƀeb(this.ƀgf.getStagePosition(),this.ƀgg);this.ƀhb===void 0?this.ƀhb=e:this.ƀat(e,t)}this.ƀgg=this.ƀgf.getStagePosition()}ƀat(t,e){this.ƀhb-t>10?(this.ƀjt=Math.max(250,this.ƀjt),this.ƀjv=!0):this.ƀjt>1e3&&(this.ƀjv=!0);let i=this.ƀjt>=300&&this.ƀjv;this.ƀfk(i,t,e)}ƀfk(t,e,i){(t||e>this.ƀhb)&&(this.ƀhb=e),t?(this.ƀjv=!1,this.ƀjt=0,this.ƀdc=!0,this.ƀfp=this.ƀgf.getStagePosition(),this.ƀgr.trigger(this.ƀfp)):(this.ƀjt+=i,this.ƀdc=!1)}ƀeb(t,e){let i=Or.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};Bi=ms([d(),gs("design:paramtypes",[Ct])],Bi);var _e=require("actions-lib");var x;(function(o){o[o.Hidden=1]="Hidden",o[o.Visible=2]="Visible",o[o.Appearing=3]="Appearing",o[o.Disappearing=4]="Disappearing",o[o.DisappearToChange=5]="DisappearToChange"})(x||(x={}));var Le=class extends _e.Attachable{static{h(this,"FadeInStateAnimation")}get currentState(){return{value:this.ƀi.value,state:this.ƀje,queuedState:this.ƀhs,animationState:this.ƀm}}constructor(t){super(),this.ƀi={value:0},this.ƀm=x.Hidden,this.ƀgq=new _e.Action,this.ƀgs=new _e.Action,this.ƀgx={duration:500,animation:S.lineer,...t},this.ƀi.value=0,this.ƀn=new D(this.ƀi,"value",{duration:this.ƀgx.duration,animation:this.ƀgx.animation,reAnimateHandling:F.CompletePrevious,completionHandling:O.StayInCurrentState}),this.ƀn.value.subscribe(()=>{this.ƀi.value!==1&&this.ƀi.value!==0&&this.ƀgs.trigger(this.ƀi.value)}).attach(this)}setState(t,e){if(e?.instant){this.ƀn.completeAnimation(),this.ƀm=t!==void 0?x.Visible:x.Hidden,this.ƀhs=void 0;let i=t!==void 0?1:0,r=this.ƀje!==t;r&&(this.ƀje=t,this.ƀgq.trigger(this.ƀje)),(r||this.ƀi.value!==i)&&(this.ƀi.value=i,this.ƀgs.trigger(this.ƀi.value))}else switch(this.ƀm){case x.Hidden:t!==void 0&&(this.ƀm=x.Appearing,this.ƀhs=void 0,this.ƀje=t,this.ƀgq.trigger(this.ƀje),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this));break;case x.Visible:t===void 0?(this.ƀm=x.Disappearing,this.ƀhs=void 0,this.ƀn.animate({value:0}).tap(()=>this.ƀgm()).attach(this)):t!==this.ƀje&&(this.ƀm=x.DisappearToChange,this.ƀhs=t,this.ƀn.animate({value:0}).tap(()=>this.ƀgm()).attach(this));break;case x.Appearing:t===void 0?(this.ƀm=x.Disappearing,this.ƀhs=void 0,this.ƀn.animate({value:0},{duration:this.ƀi.value*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):t!==this.ƀje&&(this.ƀi.value>0?(this.ƀm=x.DisappearToChange,this.ƀhs=t,this.ƀn.animate({value:0},{duration:this.ƀi.value*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):(this.ƀhs=void 0,this.ƀje=t,this.ƀgq.trigger(this.ƀje)));break;case x.Disappearing:t===this.ƀje?(this.ƀm=x.Appearing,this.ƀn.animate({value:1},{duration:(1-this.ƀi.value)*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):t!==void 0&&(this.ƀm=x.DisappearToChange,this.ƀhs=t);break;case x.DisappearToChange:t===void 0?(this.ƀm=x.Disappearing,this.ƀhs=void 0):t===this.ƀje?(this.ƀm=x.Appearing,this.ƀhs=void 0,this.ƀn.animate({value:1},{duration:(1-this.ƀi.value)*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):t!==this.ƀhs&&(this.ƀhs=t);break}}ƀgm(){switch(this.ƀm){case x.Appearing:this.ƀi.value===1&&(this.ƀm=x.Visible,this.ƀgs.trigger(this.ƀi.value));break;case x.Disappearing:if(this.ƀhs!==void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearing should not have a queued value");this.ƀi.value===0&&(this.ƀm=x.Hidden,this.ƀje=void 0,this.ƀgq.trigger(this.ƀje),this.ƀgs.trigger(this.ƀi.value));break;case x.DisappearToChange:if(this.ƀhs===void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearToChange should always have a queued value");this.ƀi.value===0&&(this.ƀm=x.Appearing,this.ƀje=this.ƀhs,this.ƀhs=void 0,this.ƀgq.trigger(this.ƀje),this.ƀgs.trigger(this.ƀi.value),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this));break;case x.Hidden:case x.Visible:return}}onStateChange(t){return this.ƀgq.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀgs.subscribe(e=>t(e)).attach(this),this}};var er=class extends u{static{h(this,"FadeInContent")}constructor(t,e){super(),this.ƀbu=t;let i={duration:200,animation:S.easeInOut,...e};this.alpha=0,this.ƀjf=new Le(i).onStateChange(r=>{this.ƀbh?.destroy(),this.ƀbh=void 0,r!==void 0&&(this.ƀbh=new u().displayParent(this).attach(this),this.ƀbu({state:r,container:this.ƀbh}))}).onValueChange(r=>{this.alpha=r}).attach(this)}setState(t,e){return this.ƀjf.setState(t,e),this}};var Et=require("helpers-lib");var je=require("actions-lib"),He=require("helpers-lib");var Ve=require("actions-lib");var B;(function(o){o[o.Idle=1]="Idle",o[o.Transitioning=2]="Transitioning",o[o.Reverting=3]="Reverting"})(B||(B={}));var Ne=class extends Ve.Attachable{static{h(this,"StateAnimation")}get currentState(){return{value:this.ƀi.value,state:this.ƀje,nextState:this.ƀgi,queuedState:this.ƀhs,animationState:this.ƀm}}constructor(t){super(),this.ƀi={value:0},this.ƀm=B.Idle,this.ƀgq=new Ve.Action,this.ƀgs=new Ve.Action,this.ƀgx={duration:500,animation:S.lineer,...t},this.ƀn=new D(this.ƀi,"value",{duration:this.ƀgx.duration,animation:this.ƀgx.animation,reAnimateHandling:F.CompletePrevious,completionHandling:O.StayInCurrentState}),this.ƀn.value.subscribe(()=>{this.ƀi.value!==1&&this.ƀi.value!==0&&this.ƀgs.trigger(this.ƀi.value)}).attach(this)}setState(t,e){if(this.ƀje===void 0)this.ƀje=t,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀgs.trigger(this.ƀi.value);else if(e?.instant)this.ƀn.completeAnimation(),this.ƀm=B.Idle,this.ƀje=t,this.ƀgi=void 0,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀgs.trigger(this.ƀi.value);else switch(this.ƀm){case B.Idle:t!==this.ƀje&&(this.ƀm=B.Transitioning,this.ƀgi=t,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀgs.trigger(this.ƀi.value),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this));break;case B.Transitioning:t!==this.ƀgi&&(t===this.ƀje?(this.ƀm=B.Reverting,this.ƀn.animate({value:0},{duration:this.ƀi.value*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):this.ƀhs=t);break;case B.Reverting:t!==this.ƀje&&(t===this.ƀgi?(this.ƀm=B.Transitioning,this.ƀn.animate({value:1},{duration:(1-this.ƀi.value)*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):this.ƀhs=t);break}}ƀgm(){switch(this.ƀm){case B.Transitioning:this.ƀi.value===1&&(this.ƀi.value=0,this.ƀhs!==void 0?(this.ƀm=B.Transitioning,this.ƀje=this.ƀgi,this.ƀgi=this.ƀhs,this.ƀhs=void 0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this)):(this.ƀm=B.Idle,this.ƀje=this.ƀgi,this.ƀgi=void 0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi})),this.ƀgs.trigger(this.ƀi.value));break;case B.Reverting:if(this.ƀje===void 0)throw new Error("StateAnimation: state must be defined when reverting!");this.ƀi.value===0&&(this.ƀhs!==void 0?(this.ƀm=B.Transitioning,this.ƀgi=this.ƀhs,this.ƀhs=void 0,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this)):(this.ƀm=B.Idle,this.ƀgi=void 0,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi})),this.ƀgs.trigger(this.ƀi.value));break;case B.Idle:break}}onStateChange(t){return this.ƀgq.subscribe(e=>t(e.state,e.nextState)).attach(this),this}onValueChange(t){return this.ƀgs.subscribe(e=>t(e)).attach(this),this}};var lt;(function(o){o[o.Appear=1]="Appear",o[o.Disappear=2]="Disappear"})(lt||(lt={}));var T;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting"})(T||(T={}));var We=class extends je.Attachable{static{h(this,"SlideStateAnimation")}constructor(t){super(),this.ƀm=T.Idle,this.ƀgq=new je.Action,this.ƀgs=new je.Action,this.ƀgx={duration:500,animation:S.easeInOutCubic,...t},this.ƀjf=new Ne({duration:this.ƀgx.duration,animation:this.ƀgx.animation}).onStateChange((e,i)=>this.ƀen(e,i)).onValueChange(e=>this.ƀeo(e)).attach(this)}setIndex(t,e){if(!He.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfd===void 0?(this.ƀfd=t,this.ƀgq.trigger({state:lt.Appear,index:t}),this.ƀjf.setState(t,e)):this.ƀfd!==t?this.ƀgh!==t?this.ƀm===T.Idle?(this.ƀm=t>this.ƀfd?T.TransitionForward:T.TransitionBackward,this.ƀgh=t,this.ƀgq.trigger({state:lt.Appear,index:this.ƀgh}),this.ƀjf.setState(t,e)):this.ƀjf.setState(t,e):this.ƀm===T.Reverting&&this.ƀgh===t&&(this.ƀm=t>this.ƀfd?T.TransitionForward:T.TransitionBackward,this.ƀjf.setState(t,e)):(this.ƀm===T.TransitionForward||this.ƀm===T.TransitionBackward)&&(this.ƀm=T.Reverting,this.ƀjf.setState(t,e))}ƀen(t,e){switch(this.ƀfd!==void 0&&this.ƀfd!==t&&this.ƀfd!==e&&this.ƀgq.trigger({state:lt.Disappear,index:this.ƀfd}),this.ƀgh!==void 0&&this.ƀgh!==t&&this.ƀgh!==e&&this.ƀgq.trigger({state:lt.Disappear,index:this.ƀgh}),e!==void 0&&e!==this.ƀfd&&e!==this.ƀgh&&this.ƀgq.trigger({state:lt.Appear,index:e}),this.ƀm){case T.TransitionForward:case T.TransitionBackward:e===void 0?(this.ƀm=T.Idle,this.ƀfd=this.ƀgh,this.ƀgh=void 0):this.ƀfd!==t&&this.ƀel(t,e);break;case T.Reverting:e===void 0?(this.ƀm=T.Idle,this.ƀgh=void 0):this.ƀfd!==e&&this.ƀel(t,e);break}}ƀeo(t){let e=1;(this.ƀm===T.TransitionBackward||this.ƀm===T.Reverting&&this.ƀfd!==void 0&&this.ƀgh!==void 0&&this.ƀfd>this.ƀgh)&&(e=-1),(this.ƀm===T.Idle||t!==0)&&this.ƀgs.trigger({value:He.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfd}),this.ƀgh!==void 0&&this.ƀgs.trigger({value:He.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgh})}ƀel(t,e){this.ƀfd=t,this.ƀgh=e,this.ƀgs.trigger({value:0,index:this.ƀfd}),this.ƀm=this.ƀfd<this.ƀgh?T.TransitionForward:T.TransitionBackward}onStateChange(t){return this.ƀgq.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgs.subscribe(e=>t(e.value,e.index)).attach(this),this}};var ht;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical"})(ht||(ht={}));var Gi=class extends u{static{h(this,"SlideInContentByIndex")}constructor(t,e){super(),this.ƀbu=t,this.ƀcl="x",this.ƀbj=new Map,this.ƀgx={duration:300,animation:S.easeInOutCubic,size:new Et.Vector(500,500),margin:20,direction:ht.Horizontal,...e};let i=this.ƀgx.direction===ht.Horizontal?new Et.Vector(this.ƀgx.size.x+this.ƀgx.margin*2,this.ƀgx.size.y):new Et.Vector(this.ƀgx.size.x,this.ƀgx.size.y+this.ƀgx.margin*2),r=new u().setPosition(this.ƀgx.direction===ht.Horizontal?new Et.Vector(-this.ƀgx.margin,0):new Et.Vector(0,-this.ƀgx.margin),{round:!1}).displayParent(this).attach(this);this.ƀbz(i,this.ƀgx.margin,this.ƀgx.direction,r),this.ƀcl=this.ƀgx.direction===ht.Horizontal?"x":"y",this.ƀjf=new We({duration:this.ƀgx.duration,animation:this.ƀgx.animation}).onStateChange((s,n)=>{if(s===lt.Appear){let a=new u().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbu({index:n,container:a})}else{let a=this.ƀbj.get(n);a&&(a.destroy(),this.ƀbj.delete(n))}}).onValueChange((s,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcl]=i[this.ƀcl]*s+this.ƀgx.margin,a.setPosition(Et.Vector.fromVec2(l),{round:!1})}}).attach(this),this.addChildTo=r}setIndex(t,e){return this.ƀjf.setIndex(t,e),this}ƀbz(t,e,i,r){new Tt(r,new Et.Vector(t.x,t.y),e,i).attach(this)}},ir=class extends Gi{static{h(this,"SlideInContent")}constructor(t,e,i){super(r=>{let s=this.indexToItem.get(r.index);if(s)e({index:r.index,item:s,container:r.container});else throw new Error(`SlideInContent: The item with index '${r.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((r,s)=>{this.itemToIndex.set(r,s),this.indexToItem.set(s,r)})}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 Rt=class{static{h(this,"VectorSet")}constructor(){this.ƀkb=new Map}add(t){let e=this.ƀkb.get(t.x);e||(e=new Set,this.ƀkb.set(t.x,e)),e.add(t.y)}has(t){let e=this.ƀkb.get(t.x);return e?e.has(t.y):!1}delete(t){let e=this.ƀkb.get(t.x);return e?e.delete(t.y):!1}};var Fi=class{static{h(this,"DeltaTime")}static adjustMultiplier(t,e){return Math.pow(t,e)}};var W=require("helpers-lib");var _i=require("helpers-lib");var L=class{static{h(this,"PositionToGridPositionConverter")}static areaToGridArea(t,e){return new _i.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 _i.Vector(.5,.5)).multiplyNumber(e)}};var pe=class{static{h(this,"ClosestAvailableSpaceHelper")}static findByConvertingGridSpace(t,e,i){let r=new W.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=L.areaToGridArea(e,i);if(this.ƀas(t,s))return W.Vector.zero;let n=t.movePositionInsideGrid(s.topLeft),a=W.Vector.fromTo(s.topLeft,n),l=this.find(t,n,r);if(l){let c=l.add(a),p=W.Vector.fromTo(s.topLeft.multiplyNumber(i),e.topLeft);return new W.Vector(c.x*i+((r.x+1)*i-e.size.x)/2-p.x,c.y*i+((r.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let r=new Rt,s=new W.Queue(e);for(;s.notEmpty;){let n=s.pop();r.add(n);let a=new W.Rectangle(n,n.add(i));if(this.ƀas(t,a))return W.Vector.fromTo(e,n);t.getNeighborPositions(n,W.GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l)})}}static ƀas(t,e){if(!t.isAreaWithinBounds(e))return!1;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let r=e.topLeft.x;r<=e.bottomRight.x;r++)if(!t.get(new W.Vector(r,i)))return!1;return!0}};var ue=require("helpers-lib");var Mr=class{static{h(this,"PathfinderNode")}constructor(t,e,i,r=void 0){this.position=t,this.distanceFromStart=e,this.distanceToEnd=i,this.parent=r,this.closed=!1}get pathLength(){return this.distanceFromStart+this.distanceToEnd}isEqual(t){return ue.Vector.isEqual(this.position,t)}createSolutionPath(t){let e=[this.position],i=this.parent;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}getDistance(t){return this.position.getDistance(t)}},ys=class{static{h(this,"PathfinderGrid")}constructor(t,e){this.ƀek=t,this.ƀjc=e,this.ƀgv=new ue.BinaryHeap("min"),this.ƀaw=[],this.ƀgj=new ue.Grid({size:t.size,defaultValue:void 0});let i=new Mr(this.ƀjc,0,Number.MAX_SAFE_INTEGER);this.ƀgv.add(i.pathLength,i)}get hasOpenNodes(){return this.ƀgv.size>0}getNeighbors(t,e){return this.ƀek.getNeighborPositions(t.position,e).filter(i=>this.ƀek.get(i)).map(i=>this.ƀgj.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀgv.pop();return this.ƀgv.delete(t),t.closed=!0,this.ƀaw.push(t),t}changeNodeCost(t,e,i,r){this.ƀgv.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀgv.add(t.pathLength,t)}getBestClosedNode(){return this.ƀaw.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new Mr(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgj.set(t,e),this.ƀgv.add(e.pathLength,e),e}},de=class{static{h(this,"PathFinder")}static findPath(t,e,i,r){let s=new ys(t,e);for(;s.hasOpenNodes;){let n=s.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(!0);let a=s.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&s.changeNodeCost(l,c,i,n)}}return s.getBestClosedNode().createSolutionPath(!1)}};var N=require("helpers-lib");var fe=class{static{h(this,"VectorFieldPathFinder")}constructor(t,e){this.ƀjk=t,this.ƀw=e,this.ƀer=this.ƀdt(this.ƀw.size),this.ƀkj=new N.Grid({size:this.ƀw.size,defaultValue:this.ƀer}),this.ƀcm=new N.Grid({size:this.ƀw.size,defaultValue:void 0});let i=new Rt,r=new N.Queue;for(this.ƀdi(this.ƀw.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀkj.set(n,0),r.add(n)});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀkj.getOrFail(n);this.ƀdy(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀkj.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀkj.set(l.position,p),r.add(l.position))}})}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjk)){if(t=this.ƀkj.movePositionInsideGrid(t),this.ƀcm.has(t))return this.ƀcm.get(t);{let e=this.ƀdy(t,this.ƀw),i;return this.ƀkj.getOrFail(t)>=this.ƀer?e.some(s=>this.ƀw.get(s.position))&&(e.some(n=>!this.ƀw.get(n.position))?i=this.ƀdn(e):i=this.ƀdj(t,e)):i=this.ƀdj(t,e),this.ƀcm.set(t,i),i}}}ƀdn(t){let e=t.filter(i=>this.ƀw.get(i.position)).map(i=>i.direction.radian);return N.Radian.getAverage(...e)}ƀdj(t,e){let i=e.filter(r=>this.ƀkj.getOrFail(r.position)<this.ƀer).reduce((r,s)=>{let n=this.ƀkj.getOrFail(s.position)+s.distance;return n<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀer}).bestDirections;return this.ƀed(i,t)}ƀed(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),N.Vector.zero);if(i.isZero()||!this.ƀfi(e,i))return N.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfi(t,e){let i=t.add(this.ƀkc(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀdy(t,e){return this.ƀkj.getNeighborDirections(t,N.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdi(t){let e=[];for(let i=t.topLeft.y;i<=t.bottomRight.y;i++)for(let r=t.topLeft.x;r<=t.bottomRight.x;r++)e.push(new N.Vector(r,i));return e}ƀkc(t){let e=t.normalize().round();return new N.Vector(e.x,e.y)}ƀdt(t){return(t.x+t.y)*20}};var Ue=require("actions-lib"),Dr=require("helpers-lib"),Br=C(require("p2"));var ws=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends J{static{h(this,"PhysicsWorldEntity")}constructor(t,e,i,r,s,n,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 Ue.Variable(!1),this.lastP2Time=new Ue.Variable(0),this.onPhysicsStep=new Ue.Action,this.mapSize=t,this.mapSizeCenter=this.mapSize.multiplyNumber(.5),this.modifyUpdateCycle=e,this.p2World=i,this.materials=r,this.materialDefinitions=s,this.physicsBodyGroupToP2Group=n,this.physicsBodyGroupToP2Mask=a}};v=ws([vt(),xs("design:paramtypes",[Dr.Vector,Boolean,Br.default.World,Map,Map,Map,Map])],v);var Vi=require("helpers-lib");var vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ct=class{static{h(this,"PhysicsBodyGroupService")}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<n),r.set(s,0)}),e.map(([s,n])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(s),l=r.get(n),c=i.get(s),p=i.get(n);r.set(s,a|p),r.set(n,l|c)}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),s=t.physicsBodyGroupToP2Mask.get(e),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return(s&n)!==0&&(a&r)!==0}};ct=vs([d()],ct);var bs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ps=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Li=class{static{h(this,"AvailabilityGridCacheService")}constructor(t){this.ƀhe=t}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhe.canCollide(t,a,e)&&i.push({grid:n,cellSize:s})})}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let s=t.availabilityGridCache.get(e);s||(s=new Map,t.availabilityGridCache.set(e,s)),s.set(i,r)}clear(t){t.availabilityGridCache.clear()}};Li=bs([d(),Ps("design:paramtypes",[ct])],Li);var Ss=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Cs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},It=class{static{h(this,"AvailabilityGridService")}constructor(t,e){this.ƀhe=t,this.ƀx=e}onBodyAdded(t,e,i){e.aabbNeedsUpdate=!0,e.updateAABB();let r=m.aabbToBoundingBox(e.aabb);this.ƀx.getCollidableGrids(t,i).forEach(s=>{let n=L.areaToGridArea(r,s.cellSize);s.grid.setArea(n,!1)})}findClosestAvailableSpace(t,e,i,r=me){return e.aabbNeedsUpdate=!0,e.updateAABB(),pe.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),m.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbx(t,e,i){let r=new Vi.Grid({size:new Vi.Vector(Math.floor(t.mapSize.x/e),Math.floor(t.mapSize.y/e)),defaultValue:!0});return t.p2World.bodies.forEach(s=>{let n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀhe.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀds(s,e);r.setArea(a,!1)}}),r}ƀds(t,e){let i=m.aabbToBoundingBox(t.aabb);return L.areaToGridArea(i,e)}};It=Ss([d(),Cs("design:paramtypes",[ct,Li])],It);var Ts=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Es=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},me=50,ge=class{static{h(this,"PathFinderService")}constructor(t){this.ƀhd=t}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=Wt.GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=me);let n=v.getInstanceByIDOrFail(t),a,l;Wt.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=m.arrayToVector(l.position)):a=i;let c=L.positionToGridPosition(e,s.gridCellSize),p=L.positionToGridPosition(a,s.gridCellSize),f=this.ƀhd.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let E=m.aabbToBoundingBox(l.aabb),rt=L.areaToGridArea(E,s.gridCellSize);f.setArea(rt,!0)}let g=de.findPath(f,c,p,s.neighborType);return g.path=g.path.map(E=>L.gridPositionToPosition(E,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=me){let n=v.getInstanceByIDOrFail(t),a;if(Wt.Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=m.aabbToBoundingBox(g.p2Body.aabb)}else a=new Wt.Rectangle(i,i);let l=L.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhd.getAvilabilityGrid(n,s,r);p=new fe(l,g),n.vectorFieldCache.set(c,p)}let f=L.positionToGridPosition(e,s);return p.getDirectionToTarget(f)}};ge=Ts([d(),Es("design:paramtypes",[It])],ge);var Rs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},X=new k,Ni=class{static{h(this,"PhysicsGateway")}createPhysicsWorld(t){return X.trigger("createPhysicsWorld",t)}getMapSize(t){return X.trigger("getMapSize",t)}setPaused(t,e){return X.trigger("setPaused",t,e)}hitTest(t,e){return X.trigger("hitTest",t,e)}findPath(t,e,i,r,s){return X.trigger("findPath",t,e,i,r,s)}findPathDirection(t,e,i,r){return X.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return X.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,s,n){return X.trigger("createExplosion",t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return X.trigger("createElipticExplosion",t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=me){return X.trigger("printPathfindingTestGrid",t,e,i,r,s,n)}};Ni=Rs([d()],Ni);var rr=require("helpers-lib"),Gr=C(require("p2"));var j=require("helpers-lib"),gt=C(require("p2"));var Is=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},As=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},pt=class{static{h(this,"TestVisualsService")}constructor(t,e){this.ƀy=t,this.ƀha=e}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀy.getAvilabilityGrid(a,n,r).map((c,p)=>({position:L.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀha.findPathDirection(t,c.position,i,r),f;p===void 0?f=R.createRectangleBorders(new j.Vector(8,8),2,j.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:!1}).attach(a):f=R.createArrow(25,c.availability?j.ColorHelper.green:j.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:!1}).setRotation(p).attach(a),new D(f,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>f.destroy()).attach(f)}})}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);R.createCircle(s,j.ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:!1}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?j.ColorHelper.red:j.ColorHelper.white;R.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t)}),new D(a,"alpha",{duration:n,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a)}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new u().displayParent(e).setAlpha(.5).attach(t);R.createElipse(n,j.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:!1}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let f=p.hits.length>0?j.ColorHelper.red:j.ColorHelper.white;R.createVector(p.line.from,p.line.to,f).toSprite().displayParent(l).attach(t)}),new D(l,"alpha",{duration:a,animation:S.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l)}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??m.arrayToVector(t.position),s=i?.overrideRotation??new j.Radian(t.angle),n=i?.color??j.ColorHelper.blue,a=new u().displayParent(e).setPosition(r,{round:!1}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcp(c,n).displayParent(a).attachToRoot()}),new D(a,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a)}ƀcp(t,e){switch(t.type){case gt.default.Shape.PARTICLE:throw new Error("Not implemented");case gt.default.Shape.LINE:throw new Error("Not implemented");case gt.default.Shape.PLANE:throw new Error("Not implemented");case gt.default.Shape.CIRCLE:throw new Error("Not implemented");case gt.default.Shape.CAPSULE:throw new Error("Not implemented");case gt.default.Shape.BOX:throw new Error("Not implemented");case gt.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case gt.default.Shape.CONVEX:return this.ƀco(t,e);default:throw new Error("Not implemented")}}ƀco(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return R.createPolygon(i,e).toSprite()}};pt=Is([d(),As("design:paramtypes",[It,ge])],pt);var Os=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ms=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ji=class{static{h(this,"HitTestService")}constructor(t){this.ƀjm=t}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=m.cloneP2Body(t);this.ƀs(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdg(s)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>m.cloneP2Body(l.p2Body)),a=!1;if(n.length!==0){let l=new Gr.default.World;l.addBody(s),n.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===s||c.bodyB===s),l.clear()}if(e?.testLayerID){let l=a?rr.ColorHelper.red:rr.ColorHelper.green;this.ƀjm.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l})}return a}ƀs(t,e){e?.overridePosition&&(t.position=m.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value)}ƀdg(t){return t.aabbNeedsUpdate=!0,t.updateAABB(),t.aabb}};ji=Os([d(),Ms("design:paramtypes",[pt])],ji);var _r=C(require("p2"));var Ds=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Hi=class{static{h(this,"CollisionsService")}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀhy(t,i)})})}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[]}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀhy(t,r)}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀem(r.p2Body),r.entity.ƀip(t.collisionReports.get(s)||[])}),t.bodiesInContactWith.clear(),t.collisionReports.clear()}ƀem(t){let e=m.arrayToVector(t.velocity);e.length>10.8&&(e=e.normalize(10.8),t.velocity=m.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-10.01),10.01)}ƀhy(t,e){let i=b.getFromP2BodyID(e.bodyA.id),r=b.getFromP2BodyID(e.bodyB.id);if(i&&r){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:r});let s=t.collisionReports.get(e.bodyA.id)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdl(i,r,e);s.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,n)}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e)}ƀdl(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),n=m.arrayToVector(i.contactPointA),a=m.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀdz(i);return{collisionDetailsA:this.ƀdk(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdk(s,i.bodyB.mass,a,c,e.area)}}ƀdk(t,e,i,r,s){let n,a=i.add(t.position);return{body:t,getPositionReletiveToObject:h(()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀdz(t){let e=m.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return{normalA:e,normalB:i}}};Hi=Ds([d()],Hi);var et=require("helpers-lib");var Bs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Gs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Wi=class extends Yt{static{h(this,"BorderEntity")}constructor(t,e){super(t,e)}};Wi=Bs([vt(),Gs("design:paramtypes",[Number,Object])],Wi);var Fs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Z=1e4,Ui=class{static{h(this,"BorderService")}createBorders(t,e,i){this.ƀbr(t,new et.Vector(e.x/2,-Z/2),new et.Vector(e.x+Z*2,Z),i),this.ƀbr(t,new et.Vector(e.x/2,e.y+Z/2),new et.Vector(e.x+Z*2,Z),i),this.ƀbr(t,new et.Vector(-Z/2,e.y/2),new et.Vector(Z,e.y+Z*2),i),this.ƀbr(t,new et.Vector(e.x+Z/2,e.y/2),new et.Vector(Z,e.y+Z*2),i)}ƀbr(t,e,i,r){return new Wi(t,{shapeDefinition:{materialName:ut,group:r,shapeType:nt.Rectangle,shapeData:i},position:e,rotation:et.Radian.get0,addInEmptySpace:!1,includeOnPathfinding:!0}).attachByID(t)}};Ui=Fs([d()],Ui);var $e=C(require("p2"));var _s=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Fr=new $e.default.Material,Ls={id:ut,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},ye=class{static{h(this,"MaterialsService")}createMaterials(t,e,i,r){let s=new Map,n=new Map;if(i.forEach(a=>{s.set(a.id,new $e.default.Material),n.set(a.id,a)}),s.has(ut))throw new Error(`Material with name ${ut} cannot be defined, pick another name for the material.`);return s.set(ut,Fr),n.set(ut,Ls),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdx(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdw(e,i.materialDefinitions)}ƀdx(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdw(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,r,s){this.ƀdp(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀdx(n.materialA,s),l=this.ƀdx(n.materialB,s);t.addContactMaterial(new $e.default.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness}))}),this.ƀd(t,e,i,s)}ƀdp(t,e){let i=new Map;e.forEach(s=>{let n=i.get(s.materialA);n||(n=new Map,i.set(s.materialA,n)),n.set(s.materialB,s)});let r=[];return t.forEach((s,n)=>{for(let a=n;a<t.length;a++){let l=t[a],c=i.get(s)?.get(l);c?r.push(c):r.push({materialA:s,materialB:l,friction:0,bounciness:0,stiffness:1e6})}}),r}ƀd(t,e,i,r){i.forEach(s=>{let n=this.ƀdx(s.id,r);t.addContactMaterial(new $e.default.ContactMaterial(n,Fr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness}))})}};ye=_s([d()],ye);var Vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ns=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},we=class{static{h(this,"PhysicsWorldService")}constructor(t,e,i,r,s){this.ƀgb=t,this.ƀai=e,this.ƀy=i,this.ƀay=r,this.ƀhe=s}createPhysicsWorld(t){let e=new _r.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgb.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhe.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&y.cleanUpdateModifier()}).attachToRoot(),this.ƀai.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀay.registerPhysicsWorld(a),t.modifyUpdateCycle?y.registerUpdateModifier((l,c)=>this.ƀjg(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjg(a,l,c)}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀy.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),!0):!1}else return n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),!0}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e)}ƀjg(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 r=e+i;this.ƀay.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t)}};we=Vs([d(),Ns("design:paramtypes",[ye,Ui,It,Hi,ct])],we);var $=require("helpers-lib");var Ut=C(require("p2"));var js=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xe=class{static{h(this,"RayCastingService")}castClosest(t,e,i){let r=new Ut.default.RaycastResult,s=new Ut.default.Ray({mode:Ut.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(r,s),r.hasHit())return this.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new Ut.default.Ray({mode:Ut.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(n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbm(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbm(n,e))},"callback")});return t.p2World.raycast(new Ut.default.RaycastResult,s),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=m.arrayToVector(t.normal),s,n,a;return{body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};xe=js([d()],xe);var Hs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},At=class{static{h(this,"ImpactService")}applyImpulse(t,e,i,r){let s=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(m.vectorToArray(s),n)}};At=Hs([d()],At);var Lr=require("helpers-lib");var Ws=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ve=class{static{h(this,"RayCastHitConverterService")}toExplosionHits(t,e=!0){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let n=i.get(s.body);if(n){let a=s.fraction<n.closestRaycastHit.fraction?s:n.closestRaycastHit;n.rayCastHits.push(s),i.set(s.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.isExternal&&s.isExternal(),explosionCenter:s.line.from})}else{let a=s.isExternal();i.set(s.body,{hitCount:1,closestRaycastHit:s,rayCastHits:[s],isExternal:a,explosionCenter:s.line.from})}})}),[...i.values()].map(r=>this.ƀbn(r,t.length))}ƀbn(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return{body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:!0,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=m.arrayToVector(t.closestRaycastHit.body.position);return{body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:!1,normal:Lr.Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};ve=Ws([d()],ve);var Us=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},$s=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},zs=15,$i=class{static{h(this,"ElipticExplosionService")}constructor(t,e,i,r){this.ƀhu=t,this.ƀjm=e,this.ƀht=i,this.ƀfb=r}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,s,a?.hitOnlyClosest===!0,l),p=this.ƀht.toExplosionHits(c,!1);return this.ƀq(p,n),a?.testLayerID&&this.ƀjm.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(f=>{let{p2Body:g,...E}=f;return E})}ƀcc(t,e,i,r,s,n){let a=[],l=e.vector,c=e.add($.Radian.get90).vector,p=c.normalize(i.x);a.push(new $.Line(t,t.add(p))),a.push(new $.Line(t,t.add(p.multiplyNumber(-1))));let f=l.normalize(i.y);a.push(new $.Line(t,t.add(f))),a.push(new $.Line(t,t.add(f.multiplyNumber(-1))));let g=Math.round(i.y/zs),E=i.y/(g*2+1)*2,rt=l.normalize(E),yt=i.x,Pe=Math.pow(i.y,2);return $.ArrayHelper.createIntegerArray(g).forEach(wt=>{let dt=E*(wt+1),nr=rt.multiplyNumber(wt+1),ze=c.normalize(this.ƀeh(yt,Pe,dt)),ke=t.add(nr);a.push(new $.Line(ke,ke.add(ze))),a.push(new $.Line(ke,ke.add(ze.multiplyNumber(-1))));let Je=t.add(nr.multiplyNumber(-1));a.push(new $.Line(Je,Je.add(ze))),a.push(new $.Line(Je,Je.add(ze.multiplyNumber(-1))))}),a.map(wt=>{if(s){let dt=this.ƀhu.castClosest(n,wt,r);return{line:wt,hits:dt?[dt]:[]}}else{let dt=this.ƀhu.castAllFirstContacts(n,wt,r);return{line:wt,hits:dt}}})}ƀeh(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀq(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfb.applyImpulse(r.body,r.hitPosition(),s,n)})})}};$i=Us([d(),$s("design:paramtypes",[xe,pt,ve,At])],$i);var it=require("helpers-lib");var ks=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Js=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},zi=class{static{h(this,"ExplosionService")}constructor(t,e,i,r){this.ƀhu=t,this.ƀjm=e,this.ƀht=i,this.ƀfb=r}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀee(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===!0,a),p=this.ƀht.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀjm.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,s,n){let a=new it.Radian(it.PI_360/r),l=new it.Vector(0,-e),c=a.vector;return it.ArrayHelper.createEmptyArray(r).map(()=>{let p=t.add(l);return l=l.rotate(c),new it.Line(t,p)}).map(p=>{if(s){let f=this.ƀhu.castClosest(n,p,i);return{line:p,hits:f?[f]:[]}}else{let f=this.ƀhu.castAllFirstContacts(n,p,i);return{line:p,hits:f}}})}ƀq(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfb.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l)});else{let a=it.Vector.fromTo(t,m.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfb.applyImpulse(n.p2Body,n.getHitPosition(),a,c)}})}ƀee(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};zi=ks([d(),Js("design:paramtypes",[xe,pt,ve,At])],zi);var Ys=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},be=class{static{h(this,"PhysicsQueryService")}getMapSize(t){let e=v.getInstanceByIDOrFail(t);return{dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return v.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};be=Ys([d()],be);var Xs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Zs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},sr=class{static{h(this,"PhysicsController")}constructor(t,e,i,r,s,n,a,l){this.ƀhl=t,this.ƀha=e,this.ƀjm=i,this.ƀcy=r,this.ƀct=s,this.ƀes=n,this.ƀhk=a,this.ƀfb=l}createPhysicsWorld(t){return this.ƀhl.createPhysicsWorld(t)}getMapSize(t){return this.ƀhk.getMapSize(t)}setPaused(t,e){this.ƀhl.setPaused(t,e)}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀes.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀha.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀha.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfb.applyImpulse(s.p2Body,e,i,r)}createExplosion(t,e,i,r,s,n){return this.ƀcy.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀct.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n){this.ƀjm.printPathfindingTestGrid(t,e,i,r,s,n)}};sr=Xs([st({controllerLink:X}),Zs("design:paramtypes",[we,ge,pt,zi,$i,ji,be,At])],sr);var z=C(require("p2"));var Ks=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ki=class{static{h(this,"ShapeCreationService")}createBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(!n.physicsBodyGroupToP2Group.has(e.shapeDefinition.group))throw new Error(`Physics body group "${e.shapeDefinition.group}" not found`);switch(e.shapeDefinition.shapeType){case nt.Point:return this.ƀbt(n,void 0,i,r,e.shapeDefinition.group,s);case nt.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case nt.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case nt.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s)}}ƀbt(t,e,i,r,s,n){let a=new z.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new z.default.Body({type:n==="dynamic"?z.default.Body.DYNAMIC:z.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new z.default.Convex({vertices:g.map(E=>[E.x,E.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,E)=>g+E.area,0),f=new z.default.Body({type:n==="dynamic"?z.default.Body.DYNAMIC:z.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>f.addShape(g)),f.setDensity(r.density),f}ƀcd(t,e,i,r,s,n){let a=new z.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new z.default.Body({type:n==="dynamic"?z.default.Body.DYNAMIC:z.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};ki=Ks([d()],ki);var Qs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},qs=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},or=class{static{h(this,"PhysicsInternalController")}constructor(t,e,i,r,s){this.ƀhl=t,this.ƀhj=e,this.ƀiu=i,this.ƀhk=r,this.ƀhe=s}createBody(t,e,i,r,s){return this.ƀiu.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀhj.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀhj.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhe.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhe.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhl.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhl.removeBody(t,e)}subscribeToPhysicsStep(t,e){return this.ƀhk.subscribeToPhysicsStep(t,e)}};or=Qs([st({controllerLink:ot}),qs("design:paramtypes",[we,ye,ki,be,ct])],or);0&&(module.exports={AnimationFlicker,AnimationInterpolationFunctions,Animations,AnimationsCompletionHandlingType,Animator,BORDER_MATERIAL_NAME,BardLegendsHardReset,BlendMode,Camera,CameraGateway,ClosestAvailableSpaceHelper,Container,ContainerEventType,ControllerDecorator,ControllerLink,Cursor,DEFAULT_RESOLUTION,DeltaTime,DisplayObjectArray,Entity,EntityDecorator,FadeInContent,FadeInStateAnimation,FocusingAnimation,Game,Graphics,ImmovablePhysicsEntity,KeyboardService,Menu,MenuEntity,MouseService,MouseTargetFocusService,MouseWheelListenerUI,MovableEntity,MovablePhysicsEntity,PathFinder,PhysicsEntity,PhysicsGateway,PhysicsShapeType,Placeholder,PositionConversionHelper,ROTATIONAL_SPEED_LIMIT,ReAnimateHandlingType,RichText,SPEED_LIMIT,Scene,SceneDecorator,ScrollAreaUI,ScrollDirection,ScrollMaskUI,Service,ServiceDecorator,SingletonEntity,SlideInContent,SlideInContentByIndex,SlideStateAnimation,SlideStateAnimationState,Sprite,StateAnimation,Text,UpdatableContainer,UpdateCycle,VectorFieldPathFinder,VectorSet,View,ViewDecorator});
67
+ }`,e}constructor(t,e){if(super(o.ƀef(),o.ƀdo(t*R)),this.ƀcw=t,this.resolution=R,this.ƀcw=t*R,this.ƀcw<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcw>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀcw)||(this.ƀcw=Math.floor(this.ƀcw));let i=helpersLib.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcw*this.ƀcw,this.padding=this.ƀcw;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*R),1/(e.height*R)]),t.applyFilter(this,e,i,r);}};var Ee=class extends V__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=R;let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Screen,...t};this.ƀcx=new Te(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀah=new Rt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀah.blendMode=V__namespace.BLEND_MODES.SCREEN;}apply(t,e,i,r){let s=t.getFilterTexture();this.ƀcx.apply(t,e,s,V__namespace.CLEAR_MODES.CLEAR),this.ƀah.apply(t,s,i,r),t.returnFilterTexture(s);}};var qt=class o{static{h(this,"GlowSpriteGenerator");}static{this.ƀei=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),s=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀdq(t.texture,s,r.expand,r.color,i),a=new V__namespace.Sprite(n);return this.ƀir(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(s.x,s.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀdq(t,e,i,r,s){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(s){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(o.ƀei.has(n))return o.ƀei.get(n);{let a=this.ƀdr(t,e,i,r);return o.ƀei.set(n,a),a}}else return this.ƀdr(t,e,i,r)}static ƀdr(t,e,i,r){let s=new V__namespace.Sprite(t);this.ƀcz(s,Math.max(e.x,e.y)+i),s.filters=[new Ee({blurRadius:e,expand:i,color:r})];let n=w.instance.renderer.generateTexture(s);return n.id=M.insertAsset(n),s.destroy(),n}static ƀir(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,s=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,s);}static ƀcz(t,e){if(t.isSprite){let s=new V__namespace.Graphics;t.addChild(s);}let i=t.width,r=t.height;t.calculateBounds=function(){this._bounds.clear(),this._bounds.addFrame(this.transform,-e,-e,i+e,r+e);};}static ƀbc(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Add};return t&&(e={...e,...t}),e}};G.onHardReset.subscribe(()=>{qt.ƀei.clear();}).attachToRoot();var Z=class o extends u{static{h(this,"Sprite");}static createByName(t){let e=w.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new o(e)}static createSnapshotSprite(t){let e=t.pixiContainer,i=e.parent;i&&i.removeChild(e);let r=w.instance.renderer.generateTexture(e,{resolution:2,scaleMode:V__namespace.SCALE_MODES.LINEAR,multisample:V__namespace.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:M.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,boundingShapes:void 0,destroyAssetOnDestroy:true};return new o(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀjq=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀiz=t,this.pixiSprite=new V__namespace.Sprite(M.getAsset(t.id)),this.pixiContainer.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.ƀfz?.destroy(),this.ƀaj?.destroy(),this.ƀiz.destroyAssetOnDestroy&&(M.destroyAsset(this.ƀiz.id),this.ƀhn&&M.destroyAsset(this.ƀhn.texture.id)),this.ƀhn&&!this.ƀhn.destroyed&&this.ƀhn.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjq}set textureScale(t){this.ƀjq=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.ƀiz.boundingShapes&&!this.pixiContainer.hitArea&&(this.pixiContainer.hitArea=new xe(this.ƀiz.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀiz.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===V__namespace.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=V__namespace.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=V__namespace.MIPMAP_MODES.OFF;}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 V__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.ƀhn)return this.ƀhn.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀhn)this.ƀhn.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀiz.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀhn&&(this.ƀhn.destroy(),this.ƀhn=void 0),t&&(this.ƀhn=qt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀiz.destroyAssetOnDestroy),this.ƀhn.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀhn.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.pixiContainer.addChild(this.ƀhn)),this}showBoundingShape(t){return t?this.ƀaj||(this.ƀaj=this.ƀbs().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀaj&&(this.ƀaj.destroy(),this.ƀaj=void 0),this}getBoundingMask(){if(!this.ƀfz){if(!this.ƀiz.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀfz=this.ƀbs(),this.ƀfz.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀfz.pixiSprite.renderable=false,this.ƀfz.displayParent(this);}return this.ƀfz}ƀbs(){if(!this.ƀiz.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀiz.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=w.instance.renderer.extract.canvas(this.pixiContainer);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}};var Re=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),s=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(s.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(s.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,f=Math.floor(c/p),g=c-p*f;f>=1&&g<i.dashLength&&(g+=p,f--);let T=s.normalize(g/2),J=s.normalize(i.dashGap);if(a.push({from:l,to:l.add(T)}),l=l.add(T),f>0){let ot=s.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(f).forEach(()=>{l=l.add(J),a.push({from:l,to:l.add(ot)}),l=l.add(ot);});}return l=l.add(J),a.push({from:l,to:l.add(T)}),a}};var E=class o extends u{static{h(this,"Graphics");}static{this.ƀcq=new Map;}static createArrow(t,e){let i=new V__namespace.Graphics,r=[[{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}]];return i.beginFill(e),r.forEach(s=>{i.drawPolygon(s.map(n=>new V__namespace.Point(n.x,n.y)));}),i.endFill(),new o(i,JSON.stringify({type:"arrow",size:t,color:e}))}static createDashedLine(t,e,i){let r={width:2,dashLength:10,dashGap:4,lineStartGap:0,lineEndGap:0,color:helpersLib.ColorHelper.white,...i},s=new V__namespace.Graphics;return s.lineStyle(r.width,r.color),Re.getLines(t,e,r).forEach(a=>{s.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new o(s,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new V__namespace.Graphics;return r.lineStyle(2,i),r.moveTo(t.x,t.y),r.lineTo(e.x,e.y),r.lineStyle(1,i),r.beginFill(helpersLib.ColorHelper.white),r.drawCircle(t.x,t.y,3),r.endFill(),new o(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new V__namespace.Graphics;return r.beginFill(i),r.drawRect(0,0,t.x,e),r.drawRect(0,e,e,t.y-e*2),r.drawRect(t.x-e,e,e,t.y-e*2),r.drawRect(0,t.y-e,t.x,e),r.endFill(),new o(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new V__namespace.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new V__namespace.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new o(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new V__namespace.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new o(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new V__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(s=>{i.drawPolygon(s.map(n=>new V__namespace.Point(n.x,n.y)));}),i.endFill(),new o(i,r)}static createRegularPolygon(t,e,i){let r=new V__namespace.Graphics,s=new helpersLib.Radian(helpersLib.PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=s.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.endFill(),new o(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.pixiContainer.addChild(t),this.pixiGraphics=t,this.ƀal=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀal,cache:false,...t},i=this.ƀec(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},boundingShapes:void 0,destroyAssetOnDestroy:!e.cache},s=new Z(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),s}ƀec(t,e){if(e){let i=o.ƀcq.get(t);return i||(i=this.ƀce(),o.ƀcq.set(t,i)),i}else return this.ƀce()}ƀce(){let t=w.instance.renderer.generateTexture(this.pixiGraphics);t.id=M.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var hi=class extends u{static{h(this,"Placeholder");}constructor(t){super(),this.ƀho=new V__namespace.Graphics,this.ƀho.beginFill(0,1e-9),this.ƀho.drawRect(0,0,t.x,t.y),this.ƀho.endFill(),this.pixiContainer.addChild(this.ƀho);}destroy(){this.destroyed||(super.destroy(),this.ƀho.destroy());}};var Mt=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,r={};if(i){let s={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};r={dropShadow:true,dropShadowBlur:s.blur,dropShadowAngle:s.angle.value,dropShadowDistance:s.distance,dropShadowColor:helpersLib.ColorHelper.rgbToHex(s.color),dropShadowAlpha:s.alpha};}return {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,...r}}};var Ae=class{static{h(this,"RichTextDataInConverter");}static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=scriptEngineLib.RichTextSeparator.process(t,i),s=this.ƀfc(r,e),n=this.ƀr(s);return this.ƀix(n)}static ƀfc(t,e){let i=new Map,r=new Map,s=h((a,l)=>{if(r.has(l))return r.get(l);let c=Mt.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdm(a.tags,e,i),p=s(l,c),f=V__namespace.TextMetrics.measureText(" ",new V__namespace.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:f.width}})}static ƀdm(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let s=this.ƀba(t,e);return i.set(r,s),{style:s,cacheKey:r}}static ƀba(t,e){let i={...e.default};for(let l of t)e.styles&&e.styles[l]&&(i={...i,...e.styles[l]});let{wordWrapWidth:r,align:s,dropShadow:n,...a}=i;return a}static ƀr(t){let e=[],i=[];return t.forEach((r,s)=>{r.text.split(/\r?\n/).forEach((a,l)=>{l>0&&(e.push(i),i=[]),i.push({text:a,cacheKey:r.cacheKey,style:r.style,pixiStyle:r.pixiStyle,spaceWidth:r.spaceWidth});});}),e.push(i),e}static ƀix(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(s=>this.ƀiy(s.text).map(a=>{let l=new V__namespace.TextStyle(s.pixiStyle),c=V__namespace.TextMetrics.measureText(a,l,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:s.cacheKey,style:s.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:s.spaceWidth}}}));e.push(r);}),e}static ƀiy(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let s=0;s<t.length;s++){let n=t[s],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Oe=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,s)=>{if(e.isSpaceAvailable(new helpersLib.Vector(r.style.width,r.style.height)))if(r.whitespace&&s===i.length-2){let n=i[i.length-1];e.isSpaceAvailable(new helpersLib.Vector(n.style.width+r.style.width,n.style.height))?e.insertWord(r):this.ƀkm(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀkm(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀkm(t,e){let i=Math.max(0,Math.floor(e.remainingWidth/t.style.spaceWidth)),r=Math.max(0,Math.min(i,t.text.length-1));if(r>0){let n={text:" ".repeat(r),whitespace:true,style:{...t.style,width:r*t.style.spaceWidth}};e.insertWord(n);}e.newLine();let s=t.text.length-r-1;if(s>0){let n={text:" ".repeat(s),whitespace:true,style:{...t.style,width:s*t.style.spaceWidth}};e.insertWord(n);}}};var Me=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀch.length===0}get remainingWidth(){return this.ƀkl-this.ƀcj}constructor(t,e){if(this.ƀkl=t,this.ƀfr=[],this.ƀch=[],this.ƀcj=0,this.ƀfq=new helpersLib.Vector(0,0),this.ƀci=0,this.ƀeu=e?.horizontalAlignment??"left",this.ƀkd=e?.verticalAlignment??"bottom",e?.rectangleCutOption){if(e.rectangleCutOption.position.x<0||e.rectangleCutOption.position.x>=this.ƀkl||e.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀck={direction:e.rectangleCutOption.direction,rectangle:this.ƀbo(e.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀci,t.y),i=this.ƀdu(this.ƀfq.y,this.ƀfq.y+e);return this.ƀcj+t.x<=i}insertWord(t){let e=Math.max(this.ƀci,t.style.height);if(this.ƀch.length===0){let i=this.ƀdv(this.ƀfq.y,this.ƀfq.y+e);this.ƀfq=new helpersLib.Vector(i,this.ƀfq.y),this.ƀcj=this.ƀfq.x;}this.ƀch.push({chunk:t,position:new helpersLib.Vector(this.ƀcj,this.ƀfq.y)}),this.ƀci=e,this.ƀcj+=t.style.width;}newLine(){let t=this.ƀfq.y+this.ƀci,e=this.ƀdv(t,t);this.ƀdb(),this.ƀfq=new helpersLib.Vector(e,t),this.ƀcj=this.ƀfq.x,this.ƀci=0;}print(){return this.ƀdb(),this.ƀfr}ƀdb(){this.ƀch.length>0&&(this.ƀfr.push(this.ƀg(this.ƀch)),this.ƀch=[]);}ƀg(t){return t=this.ƀkf(t),t=this.ƀew(t),t}ƀew(t){if(this.ƀeu==="left")return t;let e=this.ƀfq.y+this.ƀci,i=this.ƀdv(this.ƀfq.y,e),s=this.ƀdu(this.ƀfq.y,e)-i,n=Math.min(s,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀeu==="center"?a=(s-n)/2:a=s-n,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀkf(t){let e=Math.max(...t.map(r=>r.chunk.style.ascent)),i=Math.max(...t.map(r=>r.chunk.style.descent));return t.map(r=>{let s;switch(this.ƀkd){case "top":s=i-r.chunk.style.descent;break;case "center":s=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":s=e-r.chunk.style.ascent;break}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+s)},r})}ƀdv(t,e){return this.ƀck&&(this.ƀck.direction==="topLeft"||this.ƀck.direction==="bottomLeft")&&(this.ƀck.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀck.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀck.rectangle.bottomRight.x:0}ƀdu(t,e){return this.ƀck&&(this.ƀck.direction==="topRight"||this.ƀck.direction==="bottomRight")&&(this.ƀck.rectangle.isPointInside(new helpersLib.Vector(this.ƀkl,t),{includeEdges:false})||this.ƀck.rectangle.isPointInside(new helpersLib.Vector(this.ƀkl,e),{includeEdges:false}))?this.ƀck.rectangle.topLeft.x:this.ƀkl}ƀbo(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}return new helpersLib.Rectangle(e,i)}};var De=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgd(t),t=this.ƀjw(t),this.ƀau(t)}static ƀgd(t){return t.map(e=>{let i=[],r,s=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,s=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;s=n.chunk.whitespace&&s,r={chunk:{text:a,whitespace:s,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀjw(t){return t.map(e=>{if(e.length===0)return [];let i=e.pop();if(!i.chunk.whitespace||i.chunk.text===""){let r=i.chunk.text.length,s=i.chunk.text.trimEnd();r!==s.length?e.push({chunk:{text:s,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-s.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀau(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 ee=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=Ae.process(t,e),r=new Me(e.default.wordWrapWidth??1/0,{rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),s=Oe.wrapText(i,r);return De.process(s)}};var Cs=1,zi=1/Cs,ie=class extends u{static{h(this,"Text");}get ƀjo(){if(!this.ƀjp){let t=new V__namespace.TextStyle(this.ƀhq);this.ƀjp=V__namespace.TextMetrics.measureText(this.ƀjn,t);}return this.ƀjp}get ascent(){return this.ƀjo.fontProperties.ascent}constructor(t,e){super(),this.ƀhq=Mt.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhp.destroyed&&this.ƀhp.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀhp.anchor.x,this.ƀhp.anchor.y)}set anchor(t){this.ƀhp.anchor.set(t.x,t.y);}setPosition(t,e){if(e?.holdFrom){let i=this.ƀhq.dropShadowDistance??0,r=new helpersLib.Vector(e.holdFrom.x*i,e.holdFrom.y*i);t=t.add(r);}return super.setPosition(t,e),this}setText(t){return this.ƀjn!==t&&(this.ƀjn=t,this.ƀhx()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀhq.fill!==e&&(this.ƀhq.fill=e,this.ƀhx()),this}ƀhx(){this.ƀhp?.destroy(),this.ƀji?.destroy(),this.ƀji=void 0,this.ƀjp=void 0;let t=new V__namespace.TextStyle(this.ƀhq);this.ƀhp=new V__namespace.Text(this.ƀjn,t),this.ƀhp.scale.set(zi,zi),this.pixiContainer.addChild(this.ƀhp),this.ƀhq.lineThrough&&(this.ƀji=this.ƀe(this.ƀhp,this.ƀhq.fill),this.pixiContainer.addChild(this.ƀji));}ƀe(t,e){let i=V__namespace.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),s=r%2*.5,n=new V__namespace.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=V__namespace.TextMetrics.measureText(l,t.style),f=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+s,g=0;t.style.align==="center"?g=0+(t.width-p.width)*.5:t.style.align==="right"&&(g=0+t.width-p.width),g=Math.floor(g),n.moveTo(Math.floor(g),f),n.lineTo(Math.floor(g+p.width),f),a+=p.lineHeight;}),n.endFill(),n}};var li=class extends u{static{h(this,"RichText");}constructor(t,e){super(),ee.process(t,e).forEach(r=>new ie(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var ci=class extends u{static{h(this,"UpdatableContainer");}},pi=class extends u{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbu=t,this.ƀcn=new Map,this.ƀgx={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀcn.values()),i=0;t.forEach((r,s)=>{let n=this.ƀgx.trackBy(r,s),a;this.ƀcn.has(n)?(a=this.ƀcn.get(n),e.delete(a),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀcn.set(n,a)),this.ƀgx.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀgx.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀgx.positioning.spacing);}),e.forEach(r=>{r.destroy();});}};var Bt=class o extends u{static{h(this,"Menu");}static{this.ƀju=false;}static closeAll(){return o.ƀgw?o.ƀgw.close():actionsLib.SingleEvent.instant()}constructor(t,e){super(),this.ƀgp=new actionsLib.SingleAction,this.onOpen=this.ƀgp.notifier,this.ƀgk=new actionsLib.SingleAction,this.onClose=this.ƀgk.notifier;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,darkeningAlpha:.3,...e};this.setZIndex(100).setAlpha(0),this.ƀn=new O(this,"alpha",{animation:S.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀz=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.darkeningAlpha).setInteractive(true).displayParent(this).attach(this),this.ƀgc=Z.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),w.instance.screenSize.subscribe(r=>{this.ƀz.aspectRatio=r.x/r.y,this.ƀz.scale=Math.max(r.x,r.y),this.ƀz.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(r.multiplyNumber(.5));}).attach(this),o.ƀgw=this,this.onDestroy().tap(()=>{o.ƀgw=void 0;}).attachToRoot(),i.closeOnBackgroundClick&&this.ƀz.on(exports.ContainerEventType.Click,()=>{o.ƀju||this.ƀp(false);}).attach(this),this.ƀp(true);}getBoundingMask(){return this.ƀgc.getBoundingMask()}close(){return this.ƀp(false)}ƀp(t){if(o.ƀju)throw new Error("WindowUI: cannot iterate while in transition");return o.ƀju=true,this.ƀn.animate({alpha:t?1:0}).chain(this).tap(()=>{o.ƀju=false,t?this.ƀgp.resolve():(this.ƀgk.resolve(),this.destroy());}).chainToRoot()}};var ui=class extends gt{static{h(this,"MenuEntity");}constructor(t,e){super(),this.ƀgn=new actionsLib.SingleAction,this.onCreate=this.ƀgn.notifier,this.ƀgp=new actionsLib.SingleAction,this.onOpen=this.ƀgp.notifier,this.ƀgk=new actionsLib.SingleAction,this.onClose=this.ƀgk.notifier,Bt.closeAll().tap(()=>{if(!St.getActiveScene())throw new Error("WindowEntity: constructor is called when there is no active scene!");w.pause.effect(true).attach(this),this.ƀgc=new Bt(t,e).displayParent(w.camera.layers.foregroundScreen).attach(this),this.ƀgn.resolve(this.ƀgc),this.ƀgc.onOpen.subscribe(()=>this.ƀgp.resolve()).attach(this),this.ƀgc.onClose.subscribe(()=>{this.destroy(),this.ƀgk.resolve();}).attach(this);}).attach(this);}close(){if(this.ƀgc){let t=this.onClose.toSingleEvent().destroyIfNotAttached();return this.ƀgc.close(),t}else return this.onCreate.asyncMapQueue(()=>this.close()).singleChain(this)}};var Rs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Is=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseService=class wt{static{h(this,"MouseService");}get initialMouseMoveHappened(){return this.ƀfe.value}getStagePosition(){return this.ƀja.value}getScreenPosition(){return this.ƀih.value}getMainButtonState(){return this.ƀfw.value}getSecondaryButtonState(){return this.ƀin.value}constructor(){this.ƀfe=new actionsLib.Variable(false),this.onInitialMouseMove=this.ƀfe.notifier,this.ƀja=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀja.notifier,this.ƀih=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀih.notifier,this.ƀfw=new actionsLib.Variable(false),this.mainButtonState=this.ƀfw.notifier,this.ƀin=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀin.notifier,this.ƀjb(),window.addEventListener("mousedown",t=>{t.button===0?this.ƀfw.value=true:t.button===2&&(this.ƀin.value=true);}),window.addEventListener("mouseup",t=>{t.button===0?this.ƀfw.value=false:t.button===2&&(this.ƀin.value=false);}),window.addEventListener("blur",()=>{this.ƀfw.value=false,this.ƀin.value=false;});}ƀjb(){let t=helpersLib.Vector.zero;window.addEventListener("mousemove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfe.value=true;}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀih.value=t;}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=w.instance.screenPositonToStagePosition(this.ƀih.value);e.isEqual(this.ƀja.value)?w.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀih.value.x,clientY:this.ƀih.value.y,pointerType:"mouse"})):this.ƀja.value=e;}).attachToRoot();}};exports.MouseService=Rs([d(),Is("design:paramtypes",[])],exports.MouseService);var se=class extends u{static{h(this,"MouseWheelListenerUI");}constructor(t){super(),this.ƀgt=new actionsLib.Action,this.onWheel=this.ƀgt.notifier,this.ƀep=(e=>{let i=P.get(exports.MouseService).getScreenPosition(),r=this.ƀkk.getBounds();i.x>=r.x&&i.x<=r.x+r.width&&i.y>=r.y&&i.y<=r.y+r.height&&this.ƀgt.trigger(e.deltaY);}).bind(this),this.ƀkk=new V__namespace.Graphics,this.ƀkk.beginFill(0,1e-9),this.ƀkk.drawRect(0,0,t.x,t.y),this.ƀkk.endFill(),this.pixiContainer.addChild(this.ƀkk),window.addEventListener("wheel",this.ƀep);}destroy(){this.destroyed||(super.destroy(),this.ƀkk.destroy(),window.removeEventListener("wheel",this.ƀep));}};var Ms=.65,Ds=.01,Fe=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀil}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀu=e,this.ƀgz=i,this.ƀiw=r,this.ƀff=false,this.ƀil=e-i*2,this.ƀbh.y=i,this.ƀjj=i;}onWheel(t){this.setTarget(this.ƀjj-t*Ms);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjj=helpersLib.NumberHelper.clamp(t,this.ƀu-this.ƀgz-this.contentSize.y,this.ƀgz);}jumpToTarget(){this.ƀbh.y=this.ƀjj;}update(t){let e=this.contentSize;if(e.y<=this.ƀil){switch(this.ƀiw){case "start":this.ƀjj=this.ƀgz;break;case "center":this.ƀjj=(this.ƀu-e.y)*.5;break;case "end":this.ƀjj=this.ƀu-e.y-this.ƀgz;break}this.ƀff||(this.ƀbh.y=this.ƀjj);}this.ƀff=true;let i=this.ƀjj-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*Ds*t;}};var mi=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},xt=class o extends u{static{h(this,"ScrollMaskUI");}static{this.ƀcq=new Map;}constructor(t,e,i,r=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 s=new u;r===exports.ScrollDirection.Horizontal?this.ƀby(e,i,s):this.ƀcf(e,i,s),this.ƀfz=Z.createSnapshotSprite(s).attach(this),s.destroy(),t.setMask(this.ƀfz);}ƀcf(t,e,i){e>0&&this.ƀbv(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),E.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.ƀbv(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀby(t,e,i){e>0&&this.ƀbv(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),E.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.ƀbv(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbv(t){let i={id:this.ƀbw(t.y),scale:1,size:t,anchor:{x:0,y:0},boundingShapes:void 0};return new Z(i,{textureSize:t,ignoreAnchor:true})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=o.ƀcq.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let s=r.getContext("2d");if(s){let n=new mi;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;s.fillStyle=c,s.fillRect(0,l,1,1);});let a=V__namespace.Texture.from(r);i=M.insertAsset(a),o.ƀcq.set(e,i);}else throw new Error("Canvas context is null")}return i}};var Fs=15,gi=class extends u{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀim.contentSize}constructor(t,e={}){super();let i={padding:Fs,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 r=new u().displayParent(this).attach(this);new xt(r,t,i.padding).attach(this);let s=new u().displayParent(r).attach(this);this.ƀim=new Fe(s,t.y,i.padding,i.smallContentAlign),this.ƀbi=new helpersLib.Vector(t.x,this.ƀim.scrollHeight),new se(t).displayParent(r).attach(this).onWheel.subscribe(a=>this.ƀim.onWheel(a)).attach(this),y.afterSceneUpdateAction.subscribe(a=>this.ƀim.update(a.delta)).attach(this),this.addChildTo=s;}scrollToTop(t){this.ƀim.scrollToTop(),t?.instant&&this.ƀim.jumpToTarget();}scrollToBottom(t){this.ƀim.scrollToBottom(),t?.instant&&this.ƀim.jumpToTarget();}};var _s=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ls=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.KeyboardService=class yi{static{h(this,"KeyboardService");}constructor(){this.ƀfm=new actionsLib.Action,this.keyPressed=this.ƀfm.notifier,this.ƀfn=new actionsLib.Action,this.keyReleased=this.ƀfn.notifier,this.ƀft=new Set,this.ƀfs=new Set,window.addEventListener("keydown",t=>{this.ƀft.add(t.key),this.ƀfs.add(t.key),!t.repeat&&this.ƀfm.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀft.delete(t.key),this.ƀfn.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀft.clear();}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfs.clear();}).attachToRoot();}isKeyDown(t){return this.ƀft.has(t)}isKeyJustPressed(t){return this.ƀfs.has(t)}};exports.KeyboardService=_s([d(),Ls("design:paramtypes",[])],exports.KeyboardService);var Vs=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ns=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)};exports.MouseTargetFocusService=class wi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀdc}get lastFocusedPosition(){return this.ƀfp}constructor(t){this.ƀgf=t,this.ƀgr=new actionsLib.Action,this.onTargetFocus=this.ƀgr.notifier,this.ƀjt=0,this.ƀjv=false,this.ƀdc=false,this.ƀfp=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀjx(e.delta)).attachToRoot();}ƀjx(t){if(this.ƀgg){let e=this.ƀeb(this.ƀgf.getStagePosition(),this.ƀgg);this.ƀhb===void 0?this.ƀhb=e:this.ƀat(e,t);}this.ƀgg=this.ƀgf.getStagePosition();}ƀat(t,e){this.ƀhb-t>10?(this.ƀjt=Math.max(250,this.ƀjt),this.ƀjv=true):this.ƀjt>1e3&&(this.ƀjv=true);let i=this.ƀjt>=300&&this.ƀjv;this.ƀfk(i,t,e);}ƀfk(t,e,i){(t||e>this.ƀhb)&&(this.ƀhb=e),t?(this.ƀjv=false,this.ƀjt=0,this.ƀdc=true,this.ƀfp=this.ƀgf.getStagePosition(),this.ƀgr.trigger(this.ƀfp)):(this.ƀjt+=i,this.ƀdc=false);}ƀeb(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Vs([d(),Ns("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var x;(function(o){o[o.Hidden=1]="Hidden",o[o.Visible=2]="Visible",o[o.Appearing=3]="Appearing",o[o.Disappearing=4]="Disappearing",o[o.DisappearToChange=5]="DisappearToChange";})(x||(x={}));var _e=class extends actionsLib.Attachable{static{h(this,"FadeInStateAnimation");}get currentState(){return {value:this.ƀi.value,state:this.ƀje,queuedState:this.ƀhs,animationState:this.ƀm}}constructor(t){super(),this.ƀi={value:0},this.ƀm=x.Hidden,this.ƀgq=new actionsLib.Action,this.ƀgs=new actionsLib.Action,this.ƀgx={duration:500,animation:S.lineer,...t},this.ƀi.value=0,this.ƀn=new O(this.ƀi,"value",{duration:this.ƀgx.duration,animation:this.ƀgx.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀn.value.subscribe(()=>{this.ƀi.value!==1&&this.ƀi.value!==0&&this.ƀgs.trigger(this.ƀi.value);}).attach(this);}setState(t,e){if(e?.instant){this.ƀn.completeAnimation(),this.ƀm=t!==void 0?x.Visible:x.Hidden,this.ƀhs=void 0;let i=t!==void 0?1:0,r=this.ƀje!==t;r&&(this.ƀje=t,this.ƀgq.trigger(this.ƀje)),(r||this.ƀi.value!==i)&&(this.ƀi.value=i,this.ƀgs.trigger(this.ƀi.value));}else switch(this.ƀm){case x.Hidden:t!==void 0&&(this.ƀm=x.Appearing,this.ƀhs=void 0,this.ƀje=t,this.ƀgq.trigger(this.ƀje),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this));break;case x.Visible:t===void 0?(this.ƀm=x.Disappearing,this.ƀhs=void 0,this.ƀn.animate({value:0}).tap(()=>this.ƀgm()).attach(this)):t!==this.ƀje&&(this.ƀm=x.DisappearToChange,this.ƀhs=t,this.ƀn.animate({value:0}).tap(()=>this.ƀgm()).attach(this));break;case x.Appearing:t===void 0?(this.ƀm=x.Disappearing,this.ƀhs=void 0,this.ƀn.animate({value:0},{duration:this.ƀi.value*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):t!==this.ƀje&&(this.ƀi.value>0?(this.ƀm=x.DisappearToChange,this.ƀhs=t,this.ƀn.animate({value:0},{duration:this.ƀi.value*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):(this.ƀhs=void 0,this.ƀje=t,this.ƀgq.trigger(this.ƀje)));break;case x.Disappearing:t===this.ƀje?(this.ƀm=x.Appearing,this.ƀn.animate({value:1},{duration:(1-this.ƀi.value)*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):t!==void 0&&(this.ƀm=x.DisappearToChange,this.ƀhs=t);break;case x.DisappearToChange:t===void 0?(this.ƀm=x.Disappearing,this.ƀhs=void 0):t===this.ƀje?(this.ƀm=x.Appearing,this.ƀhs=void 0,this.ƀn.animate({value:1},{duration:(1-this.ƀi.value)*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):t!==this.ƀhs&&(this.ƀhs=t);break}}ƀgm(){switch(this.ƀm){case x.Appearing:this.ƀi.value===1&&(this.ƀm=x.Visible,this.ƀgs.trigger(this.ƀi.value));break;case x.Disappearing:if(this.ƀhs!==void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearing should not have a queued value");this.ƀi.value===0&&(this.ƀm=x.Hidden,this.ƀje=void 0,this.ƀgq.trigger(this.ƀje),this.ƀgs.trigger(this.ƀi.value));break;case x.DisappearToChange:if(this.ƀhs===void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearToChange should always have a queued value");this.ƀi.value===0&&(this.ƀm=x.Appearing,this.ƀje=this.ƀhs,this.ƀhs=void 0,this.ƀgq.trigger(this.ƀje),this.ƀgs.trigger(this.ƀi.value),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this));break;case x.Hidden:case x.Visible:return}}onStateChange(t){return this.ƀgq.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀgs.subscribe(e=>t(e)).attach(this),this}};var Qi=class extends u{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀbu=t;let i={duration:200,animation:S.easeInOut,...e};this.alpha=0,this.ƀjf=new _e(i).onStateChange(r=>{this.ƀbh?.destroy(),this.ƀbh=void 0,r!==void 0&&(this.ƀbh=new u().displayParent(this).attach(this),this.ƀbu({state:r,container:this.ƀbh}));}).onValueChange(r=>{this.alpha=r;}).attach(this);}setState(t,e){return this.ƀjf.setState(t,e),this}};var A;(function(o){o[o.Idle=1]="Idle",o[o.Transitioning=2]="Transitioning",o[o.Reverting=3]="Reverting";})(A||(A={}));var Le=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}get currentState(){return {value:this.ƀi.value,state:this.ƀje,nextState:this.ƀgi,queuedState:this.ƀhs,animationState:this.ƀm}}constructor(t){super(),this.ƀi={value:0},this.ƀm=A.Idle,this.ƀgq=new actionsLib.Action,this.ƀgs=new actionsLib.Action,this.ƀgx={duration:500,animation:S.lineer,...t},this.ƀn=new O(this.ƀi,"value",{duration:this.ƀgx.duration,animation:this.ƀgx.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀn.value.subscribe(()=>{this.ƀi.value!==1&&this.ƀi.value!==0&&this.ƀgs.trigger(this.ƀi.value);}).attach(this);}setState(t,e){if(this.ƀje===void 0)this.ƀje=t,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀgs.trigger(this.ƀi.value);else if(e?.instant)this.ƀn.completeAnimation(),this.ƀm=A.Idle,this.ƀje=t,this.ƀgi=void 0,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀgs.trigger(this.ƀi.value);else switch(this.ƀm){case A.Idle:t!==this.ƀje&&(this.ƀm=A.Transitioning,this.ƀgi=t,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀgs.trigger(this.ƀi.value),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this));break;case A.Transitioning:t!==this.ƀgi&&(t===this.ƀje?(this.ƀm=A.Reverting,this.ƀn.animate({value:0},{duration:this.ƀi.value*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):this.ƀhs=t);break;case A.Reverting:t!==this.ƀje&&(t===this.ƀgi?(this.ƀm=A.Transitioning,this.ƀn.animate({value:1},{duration:(1-this.ƀi.value)*this.ƀgx.duration}).tap(()=>this.ƀgm()).attach(this)):this.ƀhs=t);break}}ƀgm(){switch(this.ƀm){case A.Transitioning:this.ƀi.value===1&&(this.ƀi.value=0,this.ƀhs!==void 0?(this.ƀm=A.Transitioning,this.ƀje=this.ƀgi,this.ƀgi=this.ƀhs,this.ƀhs=void 0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this)):(this.ƀm=A.Idle,this.ƀje=this.ƀgi,this.ƀgi=void 0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi})),this.ƀgs.trigger(this.ƀi.value));break;case A.Reverting:if(this.ƀje===void 0)throw new Error("StateAnimation: state must be defined when reverting!");this.ƀi.value===0&&(this.ƀhs!==void 0?(this.ƀm=A.Transitioning,this.ƀgi=this.ƀhs,this.ƀhs=void 0,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi}),this.ƀn.animate({value:1}).tap(()=>this.ƀgm()).attach(this)):(this.ƀm=A.Idle,this.ƀgi=void 0,this.ƀi.value=0,this.ƀgq.trigger({state:this.ƀje,nextState:this.ƀgi})),this.ƀgs.trigger(this.ƀi.value));break;case A.Idle:break}}onStateChange(t){return this.ƀgq.subscribe(e=>t(e.state,e.nextState)).attach(this),this}onValueChange(t){return this.ƀgs.subscribe(e=>t(e)).attach(this),this}};exports.SlideStateAnimationState=void 0;(function(o){o[o.Appear=1]="Appear",o[o.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var C;(function(o){o[o.Idle=1]="Idle",o[o.TransitionForward=2]="TransitionForward",o[o.TransitionBackward=3]="TransitionBackward",o[o.Reverting=4]="Reverting";})(C||(C={}));var Ve=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀm=C.Idle,this.ƀgq=new actionsLib.Action,this.ƀgs=new actionsLib.Action,this.ƀgx={duration:500,animation:S.easeInOutCubic,...t},this.ƀjf=new Le({duration:this.ƀgx.duration,animation:this.ƀgx.animation}).onStateChange((e,i)=>this.ƀen(e,i)).onValueChange(e=>this.ƀeo(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfd===void 0?(this.ƀfd=t,this.ƀgq.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀjf.setState(t,e)):this.ƀfd!==t?this.ƀgh!==t?this.ƀm===C.Idle?(this.ƀm=t>this.ƀfd?C.TransitionForward:C.TransitionBackward,this.ƀgh=t,this.ƀgq.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀgh}),this.ƀjf.setState(t,e)):this.ƀjf.setState(t,e):this.ƀm===C.Reverting&&this.ƀgh===t&&(this.ƀm=t>this.ƀfd?C.TransitionForward:C.TransitionBackward,this.ƀjf.setState(t,e)):(this.ƀm===C.TransitionForward||this.ƀm===C.TransitionBackward)&&(this.ƀm=C.Reverting,this.ƀjf.setState(t,e));}ƀen(t,e){switch(this.ƀfd!==void 0&&this.ƀfd!==t&&this.ƀfd!==e&&this.ƀgq.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfd}),this.ƀgh!==void 0&&this.ƀgh!==t&&this.ƀgh!==e&&this.ƀgq.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgh}),e!==void 0&&e!==this.ƀfd&&e!==this.ƀgh&&this.ƀgq.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀm){case C.TransitionForward:case C.TransitionBackward:e===void 0?(this.ƀm=C.Idle,this.ƀfd=this.ƀgh,this.ƀgh=void 0):this.ƀfd!==t&&this.ƀel(t,e);break;case C.Reverting:e===void 0?(this.ƀm=C.Idle,this.ƀgh=void 0):this.ƀfd!==e&&this.ƀel(t,e);break}}ƀeo(t){let e=1;(this.ƀm===C.TransitionBackward||this.ƀm===C.Reverting&&this.ƀfd!==void 0&&this.ƀgh!==void 0&&this.ƀfd>this.ƀgh)&&(e=-1),(this.ƀm===C.Idle||t!==0)&&this.ƀgs.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfd}),this.ƀgh!==void 0&&this.ƀgs.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgh});}ƀel(t,e){this.ƀfd=t,this.ƀgh=e,this.ƀgs.trigger({value:0,index:this.ƀfd}),this.ƀm=this.ƀfd<this.ƀgh?C.TransitionForward:C.TransitionBackward;}onStateChange(t){return this.ƀgq.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgs.subscribe(e=>t(e.value,e.index)).attach(this),this}};exports.ScrollDirection=void 0;(function(o){o[o.Horizontal=1]="Horizontal",o[o.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var xi=class extends u{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbu=t,this.ƀcl="x",this.ƀbj=new Map,this.ƀgx={duration:300,animation:S.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀgx.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀgx.size.x+this.ƀgx.margin*2,this.ƀgx.size.y):new helpersLib.Vector(this.ƀgx.size.x,this.ƀgx.size.y+this.ƀgx.margin*2),r=new u().setPosition(this.ƀgx.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀgx.margin,0):new helpersLib.Vector(0,-this.ƀgx.margin),{round:false}).displayParent(this).attach(this);this.ƀbz(i,this.ƀgx.margin,this.ƀgx.direction,r),this.ƀcl=this.ƀgx.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀjf=new Ve({duration:this.ƀgx.duration,animation:this.ƀgx.animation}).onStateChange((s,n)=>{if(s===exports.SlideStateAnimationState.Appear){let a=new u().displayParent(this).attach(this);this.ƀbj.set(n,a),this.ƀbu({index:n,container:a});}else {let a=this.ƀbj.get(n);a&&(a.destroy(),this.ƀbj.delete(n));}}).onValueChange((s,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcl]=i[this.ƀcl]*s+this.ƀgx.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjf.setIndex(t,e),this}ƀbz(t,e,i,r){new xt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},ir=class extends xi{static{h(this,"SlideInContent");}constructor(t,e,i){super(r=>{let s=this.indexToItem.get(r.index);if(s)e({index:r.index,item:s,container:r.container});else throw new Error(`SlideInContent: The item with index '${r.index}' is not part of the items list`)},i),this.itemToIndex=new Map,this.indexToItem=new Map,t.forEach((r,s)=>{this.itemToIndex.set(r,s),this.indexToItem.set(s,r);});}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 bt=class{static{h(this,"VectorSet");}constructor(){this.ƀkb=new Map;}add(t){let e=this.ƀkb.get(t.x);e||(e=new Set,this.ƀkb.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkb.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkb.get(t.x);return e?e.delete(t.y):false}};var vi=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var B=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 oe=class{static{h(this,"ClosestAvailableSpaceHelper");}static findByConvertingGridSpace(t,e,i){let r=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),s=B.areaToGridArea(e,i);if(this.ƀas(t,s))return helpersLib.Vector.zero;let n=t.movePositionInsideGrid(s.topLeft),a=helpersLib.Vector.fromTo(s.topLeft,n),l=this.find(t,n,r);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(s.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(c.x*i+((r.x+1)*i-e.size.x)/2-p.x,c.y*i+((r.y+1)*i-e.size.y)/2-p.y)}}static find(t,e,i){let r=new bt,s=new helpersLib.Queue(e);for(;s.notEmpty;){let n=s.pop();r.add(n);let a=new helpersLib.Rectangle(n,n.add(i));if(this.ƀas(t,a))return helpersLib.Vector.fromTo(e,n);t.getNeighborPositions(n,helpersLib.GridNeighborType.Ortogonal).forEach(l=>{r.has(l)||s.add(l);});}}static ƀas(t,e){if(!t.isAreaWithinBounds(e))return false;for(let i=e.topLeft.y;i<=e.bottomRight.y;i++)for(let r=e.topLeft.x;r<=e.bottomRight.x;r++)if(!t.get(new helpersLib.Vector(r,i)))return false;return true}};var rr=class{static{h(this,"PathfinderNode");}constructor(t,e,i,r=void 0){this.position=t,this.distanceFromStart=e,this.distanceToEnd=i,this.parent=r,this.closed=false;}get pathLength(){return this.distanceFromStart+this.distanceToEnd}isEqual(t){return helpersLib.Vector.isEqual(this.position,t)}createSolutionPath(t){let e=[this.position],i=this.parent;for(;i!==void 0;)e.push(i.position),i=i.parent;return e.reverse(),{directPathAvailable:t,path:e}}getDistance(t){return this.position.getDistance(t)}},to=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀek=t,this.ƀjc=e,this.ƀgv=new helpersLib.BinaryHeap("min"),this.ƀaw=[],this.ƀgj=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new rr(this.ƀjc,0,Number.MAX_SAFE_INTEGER);this.ƀgv.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀgv.size>0}getNeighbors(t,e){return this.ƀek.getNeighborPositions(t.position,e).filter(i=>this.ƀek.get(i)).map(i=>this.ƀgj.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀgv.pop();return this.ƀgv.delete(t),t.closed=true,this.ƀaw.push(t),t}changeNodeCost(t,e,i,r){this.ƀgv.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀgv.add(t.pathLength,t);}getBestClosedNode(){return this.ƀaw.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new rr(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgj.set(t,e),this.ƀgv.add(e.pathLength,e),e}},ne=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let s=new to(t,e);for(;s.hasOpenNodes;){let n=s.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=s.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&s.changeNodeCost(l,c,i,n);}}return s.getBestClosedNode().createSolutionPath(false)}};var ae=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀjk=t,this.ƀw=e,this.ƀer=this.ƀdt(this.ƀw.size),this.ƀkj=new helpersLib.Grid({size:this.ƀw.size,defaultValue:this.ƀer}),this.ƀcm=new helpersLib.Grid({size:this.ƀw.size,defaultValue:void 0});let i=new bt,r=new helpersLib.Queue;for(this.ƀdi(this.ƀw.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀkj.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀkj.getOrFail(n);this.ƀdy(n,this.ƀw).forEach(l=>{if(!i.has(l.position)){let c=this.ƀkj.getOrFail(l.position),p=a+l.distance;this.ƀw.getOrFail(l.position)&&p<c&&(this.ƀkj.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjk)){if(t=this.ƀkj.movePositionInsideGrid(t),this.ƀcm.has(t))return this.ƀcm.get(t);{let e=this.ƀdy(t,this.ƀw),i;return this.ƀkj.getOrFail(t)>=this.ƀer?e.some(s=>this.ƀw.get(s.position))&&(e.some(n=>!this.ƀw.get(n.position))?i=this.ƀdn(e):i=this.ƀdj(t,e)):i=this.ƀdj(t,e),this.ƀcm.set(t,i),i}}}ƀdn(t){let e=t.filter(i=>this.ƀw.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdj(t,e){let i=e.filter(r=>this.ƀkj.getOrFail(r.position)<this.ƀer).reduce((r,s)=>{let n=this.ƀkj.getOrFail(s.position)+s.distance;return n<r.bestWeight?(r.bestDirections=[s.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(s.direction),r},{bestDirections:[],bestWeight:this.ƀer}).bestDirections;return this.ƀed(i,t)}ƀed(t,e){if(t.length>0){let i=t.reduce((r,s)=>r.add(s),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfi(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfi(t,e){let i=t.add(this.ƀkc(e));return this.ƀw.isPointWithinBounds(i)&&this.ƀw.getOrFail(i)}ƀdy(t,e){return this.ƀkj.getNeighborDirections(t,helpersLib.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdi(t){let e=[];for(let i=t.topLeft.y;i<=t.bottomRight.y;i++)for(let r=t.topLeft.x;r<=t.bottomRight.x;r++)e.push(new helpersLib.Vector(r,i));return e}ƀkc(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀdt(t){return (t.x+t.y)*20}};var oo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},no=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},v=class extends ${static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,s,n,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=r,this.materialDefinitions=s,this.physicsBodyGroupToP2Group=n,this.physicsBodyGroupToP2Mask=a;}};v=oo([mt(),no("design:paramtypes",[helpersLib.Vector,Boolean,W__default.default.World,Map,Map,Map,Map])],v);var co=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},K=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((s,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(s,1<<n),r.set(s,0);}),e.map(([s,n])=>{if(!i.has(s))throw new Error(`Physics body group "${s}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(s),l=r.get(n),c=i.get(s),p=i.get(n);r.set(s,a|p),r.set(n,l|c);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return v.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),s=t.physicsBodyGroupToP2Mask.get(e),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (s&n)!==0&&(a&r)!==0}};K=co([d()],K);var po=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},uo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ne=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhe=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,s)=>{r.forEach((n,a)=>{this.ƀhe.canCollide(t,a,e)&&i.push({grid:n,cellSize:s});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let s=t.availabilityGridCache.get(e);s||(s=new Map,t.availabilityGridCache.set(e,s)),s.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ne=po([d(),uo("design:paramtypes",[K])],Ne);var fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},mo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ct=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀhe=t,this.ƀx=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=m.aabbToBoundingBox(e.aabb);this.ƀx.getCollidableGrids(t,i).forEach(s=>{let n=B.areaToGridArea(r,s.cellSize);s.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Gt){return e.aabbNeedsUpdate=true,e.updateAABB(),oe.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),m.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀx.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀx.set(t,e,i,r)),r}ƀbx(t,e,i){let r=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(s=>{let n=b.getFromP2BodyIDOrFail(s.id);if(n.includeInPathfinding&&this.ƀhe.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀds(s,e);r.setArea(a,false);}}),r}ƀds(t,e){let i=m.aabbToBoundingBox(t.aabb);return B.areaToGridArea(i,e)}};ct=fo([d(),mo("design:paramtypes",[K,Ne])],ct);var wo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},xo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Gt=50,Ft=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhd=t;}findPathAStar(t,e,i,r,s){s||(s={}),s.neighborType===void 0&&(s.neighborType=helpersLib.GridNeighborType.Ortogonal),s.gridCellSize===void 0&&(s.gridCellSize=Gt);let n=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=m.arrayToVector(l.position)):a=i;let c=B.positionToGridPosition(e,s.gridCellSize),p=B.positionToGridPosition(a,s.gridCellSize),f=this.ƀhd.getAvilabilityGrid(n,s.gridCellSize,r);if(l){let T=m.aabbToBoundingBox(l.aabb),J=B.areaToGridArea(T,s.gridCellSize);f.setArea(J,true);}let g=ne.findPath(f,c,p,s.neighborType);return g.path=g.path.map(T=>B.gridPositionToPosition(T,s.gridCellSize)),g}findPathDirection(t,e,i,r,s=Gt){let n=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=m.aabbToBoundingBox(g.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=B.areaToGridArea(a,s),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhd.getAvilabilityGrid(n,s,r);p=new ae(l,g),n.vectorFieldCache.set(c,p);}let f=B.positionToGridPosition(e,s);return p.getDirectionToTarget(f)}};Ft=wo([d(),xo("design:paramtypes",[ct])],Ft);var Po=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},j=new U;exports.PhysicsGateway=class Pi{static{h(this,"PhysicsGateway");}createPhysicsWorld(t){return j.trigger("createPhysicsWorld",t)}getMapSize(t){return j.trigger("getMapSize",t)}setPaused(t,e){return j.trigger("setPaused",t,e)}hitTest(t,e){return j.trigger("hitTest",t,e)}findPath(t,e,i,r,s){return j.trigger("findPath",t,e,i,r,s)}findPathDirection(t,e,i,r){return j.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return j.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,s,n){return j.trigger("createExplosion",t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return j.trigger("createElipticExplosion",t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n=Gt){return j.trigger("printPathfindingTestGrid",t,e,i,r,s,n)}};exports.PhysicsGateway=Po([d()],exports.PhysicsGateway);var So=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Co=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀy=t,this.ƀha=e;}printPathfindingTestGrid(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t);this.ƀy.getAvilabilityGrid(a,n,r).map((c,p)=>({position:B.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(s)){let p=this.ƀha.findPathDirection(t,c.position,i,r),f;p===void 0?f=E.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):f=E.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:S.easeIn}).animate({alpha:0}).tap(()=>f.destroy()).attach(f);}});}createExplosionDebugVisual(t,e,i,r,s,n=300){let a=new u().displayParent(e).setAlpha(.5).attach(t);E.createCircle(s,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:false}).setAlpha(.5).attach(t),i.forEach(c=>{let p=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;E.createVector(r,c.line.to,p).toSprite().displayParent(a).attach(t);}),new O(a,"alpha",{duration:n,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,s,n,a=300){let l=new u().displayParent(e).setAlpha(.5).attach(t);E.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attach(t),i.forEach(p=>{let f=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;E.createVector(p.line.from,p.line.to,f).toSprite().displayParent(l).attach(t);}),new O(l,"alpha",{duration:a,animation:S.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??m.arrayToVector(t.position),s=i?.overrideRotation??new helpersLib.Radian(t.angle),n=i?.color??helpersLib.ColorHelper.blue,a=new u().displayParent(e).setPosition(r,{round:false}).setRotation(s).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcp(c,n).displayParent(a).attachToRoot();}),new O(a,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcp(t,e){switch(t.type){case W__default.default.Shape.PARTICLE:throw new Error("Not implemented");case W__default.default.Shape.LINE:throw new Error("Not implemented");case W__default.default.Shape.PLANE:throw new Error("Not implemented");case W__default.default.Shape.CIRCLE:throw new Error("Not implemented");case W__default.default.Shape.CAPSULE:throw new Error("Not implemented");case W__default.default.Shape.BOX:throw new Error("Not implemented");case W__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case W__default.default.Shape.CONVEX:return this.ƀco(t,e);default:throw new Error("Not implemented")}}ƀco(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};q=So([d(),Co("design:paramtypes",[ct,Ft])],q);var Ro=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Io=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},je=class{static{h(this,"HitTestService");}constructor(t){this.ƀjm=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),s=m.cloneP2Body(t);this.ƀs(s,e);let n=i.broadphase.aabbQuery(i,this.ƀdg(s)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>m.cloneP2Body(l.p2Body)),a=false;if(n.length!==0){let l=new W__default.default.World;l.addBody(s),n.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===s||c.bodyB===s),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀjm.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀs(t,e){e?.overridePosition&&(t.position=m.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdg(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};je=Ro([d(),Io("design:paramtypes",[q])],je);var Oo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},He=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀhy(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀhy(t,r);}),t.bodiesInContactWith.forEach((r,s)=>{this.ƀem(r.p2Body),r.entity.ƀip(t.collisionReports.get(s)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀem(t){let e=m.arrayToVector(t.velocity);e.length>10.8&&(e=e.normalize(10.8),t.velocity=m.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-10.01),10.01);}ƀhy(t,e){let i=b.getFromP2BodyID(e.bodyA.id),r=b.getFromP2BodyID(e.bodyB.id);if(i&&r){t.bodiesInContactWith.set(e.bodyA.id,{p2Body:e.bodyA,entity:i}),t.bodiesInContactWith.set(e.bodyB.id,{p2Body:e.bodyB,entity:r});let s=t.collisionReports.get(e.bodyA.id)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdl(i,r,e);s.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,s),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdl(t,e,i){let r=t.convertToDTO(),s=e.convertToDTO(),n=m.arrayToVector(i.contactPointA),a=m.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀdz(i);return {collisionDetailsA:this.ƀdk(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdk(s,i.bodyB.mass,a,c,e.area)}}ƀdk(t,e,i,r,s){let n,a=i.add(t.position);return {body:t,getPositionReletiveToObject:h(()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),"getPositionReletiveToObject"),getPositionOnWorld:h(()=>(a||(a=i.add(t.position)),a),"getPositionOnWorld"),position:i,mass:e,area:s,normal:r}}ƀdz(t){let e=m.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};He=Oo([d()],He);var Mo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Do=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},We=class extends $t{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};We=Mo([mt(),Do("design:paramtypes",[Number,Object])],We);var Bo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},H=1e4,Ue=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbr(t,new helpersLib.Vector(e.x/2,-H/2),new helpersLib.Vector(e.x+H*2,H),i),this.ƀbr(t,new helpersLib.Vector(e.x/2,e.y+H/2),new helpersLib.Vector(e.x+H*2,H),i),this.ƀbr(t,new helpersLib.Vector(-H/2,e.y/2),new helpersLib.Vector(H,e.y+H*2),i),this.ƀbr(t,new helpersLib.Vector(e.x+H/2,e.y/2),new helpersLib.Vector(H,e.y+H*2),i);}ƀbr(t,e,i,r){return new We(t,{shapeDefinition:{materialName:ht,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Ue=Bo([d()],Ue);var Fo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},hr=new W__default.default.Material,_o={id:ht,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},_t=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let s=new Map,n=new Map;if(i.forEach(a=>{s.set(a.id,new W__default.default.Material),n.set(a.id,a);}),s.has(ht))throw new Error(`Material with name ${ht} cannot be defined, pick another name for the material.`);return s.set(ht,hr),n.set(ht,_o),this.ƀc(t,e,i,r,s),{materials:s,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdx(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdw(e,i.materialDefinitions)}ƀdx(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdw(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,r,s){this.ƀdp(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀdx(n.materialA,s),l=this.ƀdx(n.materialB,s);t.addContactMaterial(new W__default.default.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness}));}),this.ƀd(t,e,i,s);}ƀdp(t,e){let i=new Map;e.forEach(s=>{let n=i.get(s.materialA);n||(n=new Map,i.set(s.materialA,n)),n.set(s.materialB,s);});let r=[];return t.forEach((s,n)=>{for(let a=n;a<t.length;a++){let l=t[a],c=i.get(s)?.get(l);c?r.push(c):r.push({materialA:s,materialB:l,friction:0,bounciness:0,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(s=>{let n=this.ƀdx(s.id,r);t.addContactMaterial(new W__default.default.ContactMaterial(n,hr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness}));});}};_t=Fo([d()],_t);var Lo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Vo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Lt=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,s){this.ƀgb=t,this.ƀai=e,this.ƀy=i,this.ƀay=r,this.ƀhe=s;}createPhysicsWorld(t){let e=new W__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgb.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:s,physicsBodyGroupToP2Mask:n}=this.ƀhe.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,s,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&y.cleanUpdateModifier();}).attachToRoot(),this.ƀai.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀay.registerPhysicsWorld(a),t.modifyUpdateCycle?y.registerUpdateModifier((l,c)=>this.ƀjg(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjg(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀy.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),s&&this.ƀy.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀjg(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 r=e+i;this.ƀay.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){v.getInstanceByIDOrFail(e).paused.set(t);}};Lt=Lo([d(),Vo("design:paramtypes",[_t,Ue,ct,He,K])],Lt);var jo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Nt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new W__default.default.RaycastResult,s=new W__default.default.Ray({mode:W__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(r,s),r.hasHit())return this.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,s=new W__default.default.Ray({mode:W__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(n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbm(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbm(n,e));},"callback")});return t.p2World.raycast(new W__default.default.RaycastResult,s),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=m.arrayToVector(t.normal),s,n,a;return {body:t.body,hitPosition:h(()=>(s===void 0&&(s=e.from.lerp(e.to,i)),s),"hitPosition"),hitDistance:h(()=>(n===void 0&&(n=e.length*i),n),"hitDistance"),isExternal:h(()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),"isExternal"),normal:r,fraction:i,line:e}}};Nt=jo([d()],Nt);var Ho=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},ut=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let s=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(m.vectorToArray(s),n);}};ut=Ho([d()],ut);var Wo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},jt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(s=>{let n=i.get(s.body);if(n){let a=s.fraction<n.closestRaycastHit.fraction?s:n.closestRaycastHit;n.rayCastHits.push(s),i.set(s.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.isExternal&&s.isExternal(),explosionCenter:s.line.from});}else {let a=s.isExternal();i.set(s.body,{hitCount:1,closestRaycastHit:s,rayCastHits:[s],isExternal:a,explosionCenter:s.line.from});}});}),[...i.values()].map(r=>this.ƀbn(r,t.length))}ƀbn(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:true,normal:t.closestRaycastHit.normal,fraction:t.closestRaycastHit.fraction,ratioOfHits:i,raycastResults:r,getHitPosition:t.closestRaycastHit.hitPosition,getHitDistance:t.closestRaycastHit.hitDistance};{let s=m.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(s,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};jt=Wo([d()],jt);var $o=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},zo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Yo=15,ze=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀhu=t,this.ƀjm=e,this.ƀht=i,this.ƀfb=r;}createElipticExplosion(t,e,i,r,s,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,s,a?.hitOnlyClosest===true,l),p=this.ƀht.toExplosionHits(c,false);return this.ƀq(p,n),a?.testLayerID&&this.ƀjm.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(f=>{let{p2Body:g,...T}=f;return T})}ƀcc(t,e,i,r,s,n){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 g=Math.round(i.y/Yo),T=i.y/(g*2+1)*2,J=l.normalize(T),ot=i.x,Wt=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(nt=>{let tt=T*(nt+1),Ti=J.multiplyNumber(nt+1),he=c.normalize(this.ƀeh(ot,Wt,tt)),le=t.add(Ti);a.push(new helpersLib.Line(le,le.add(he))),a.push(new helpersLib.Line(le,le.add(he.multiplyNumber(-1))));let ce=t.add(Ti.multiplyNumber(-1));a.push(new helpersLib.Line(ce,ce.add(he))),a.push(new helpersLib.Line(ce,ce.add(he.multiplyNumber(-1))));}),a.map(nt=>{if(s){let tt=this.ƀhu.castClosest(n,nt,r);return {line:nt,hits:tt?[tt]:[]}}else {let tt=this.ƀhu.castAllFirstContacts(n,nt,r);return {line:nt,hits:tt}}})}ƀeh(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀq(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let s,n;r.isExternal()?(s=r.line.fromTo,n=e*2):(s=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfb.applyImpulse(r.body,r.hitPosition(),s,n);});});}};ze=$o([d(),zo("design:paramtypes",[Nt,q,jt,ut])],ze);var Xo=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Zo=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},ke=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀhu=t,this.ƀjm=e,this.ƀht=i,this.ƀfb=r;}createExplosion(t,e,i,r,s,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀee(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀht.toExplosionHits(c);return this.ƀq(e,i,s,l,p),n?.testLayerID&&this.ƀjm.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,s,n){let a=new helpersLib.Radian(helpersLib.PI_360/r),l=new helpersLib.Vector(0,-e),c=a.vector;return helpersLib.ArrayHelper.createEmptyArray(r).map(()=>{let p=t.add(l);return l=l.rotate(c),new helpersLib.Line(t,p)}).map(p=>{if(s){let f=this.ƀhu.castClosest(n,p,i);return {line:p,hits:f?[f]:[]}}else {let f=this.ƀhu.castAllFirstContacts(n,p,i);return {line:p,hits:f}}})}ƀq(t,e,i,r,s){s.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀfb.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,m.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀfb.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀee(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};ke=Xo([d(),Zo("design:paramtypes",[Nt,q,jt,ut])],ke);var en=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Ht=class{static{h(this,"PhysicsQueryService");}getMapSize(t){let e=v.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return v.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};Ht=en([d()],Ht);var rn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},sn=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Si=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,s,n,a,l){this.ƀhl=t,this.ƀha=e,this.ƀjm=i,this.ƀcy=r,this.ƀct=s,this.ƀes=n,this.ƀhk=a,this.ƀfb=l;}createPhysicsWorld(t){return this.ƀhl.createPhysicsWorld(t)}getMapSize(t){return this.ƀhk.getMapSize(t)}setPaused(t,e){this.ƀhl.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀes.hitTest(i.p2Body,e)}findPath(t,e,i,r,s){return this.ƀha.findPathAStar(t,e,i,r,{neighborType:s})}findPathDirection(t,e,i,r){return this.ƀha.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let s=b.getPhysicsInstanceOrFail(t);this.ƀfb.applyImpulse(s.p2Body,e,i,r);}createExplosion(t,e,i,r,s,n){return this.ƀcy.createExplosion(t,e,i,r,s,n)}createElipticExplosion(t,e,i,r,s,n,a){return this.ƀct.createElipticExplosion(t,e,i,r,s,n,a)}printPathfindingTestGrid(t,e,i,r,s,n){this.ƀjm.printPathfindingTestGrid(t,e,i,r,s,n);}};Si=rn([et({controllerLink:j}),sn("design:paramtypes",[Lt,Ft,q,ke,ze,je,Ht,ut])],Si);var on=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},Je=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,s){let n=v.getInstanceByIDOrFail(t);if(!n.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.ƀbt(n,void 0,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s);case exports.PhysicsShapeType.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,s)}}ƀbt(t,e,i,r,s,n){let a=new W__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s),radius:e});a.material=i;let l=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,s,n){let a=t.physicsBodyGroupToP2Group.get(s),l=t.physicsBodyGroupToP2Mask.get(s),c=e.map(g=>new W__default.default.Convex({vertices:g.map(T=>[T.x,T.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,T)=>g+T.area,0),f=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>f.addShape(g)),f.setDensity(r.density),f}ƀcd(t,e,i,r,s,n){let a=new W__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(s),collisionMask:t.physicsBodyGroupToP2Mask.get(s)});a.material=i;let l=e.x*e.y,c=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};Je=on([d()],Je);var nn=function(o,t,e,i){var r=arguments.length,s=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(n=o[a])&&(s=(r<3?n(s):r>3?n(t,e,s):n(t,e))||s);return r>3&&s&&Object.defineProperty(t,e,s),s},an=function(o,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(o,t)},Ci=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,s){this.ƀhl=t,this.ƀhj=e,this.ƀiu=i,this.ƀhk=r,this.ƀhe=s;}createBody(t,e,i,r,s){return this.ƀiu.createBody(t,e,i,r,s)}getMaterial(t,e){return this.ƀhj.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀhj.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhe.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhe.getMaskConstant(t,e)}addBody(t,e,i,r,s){return this.ƀhl.addBody(t,e,i,r,s)}removeBody(t,e){this.ƀhl.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhk.subscribeToPhysicsStep(t,e)}};Ci=nn([et({controllerLink:Y}),an("design:paramtypes",[Lt,_t,Je,Ht,K])],Ci);exports.AnimationFlicker=Oi;exports.AnimationInterpolationFunctions=X;exports.Animations=S;exports.Animator=O;exports.BORDER_MATERIAL_NAME=ht;exports.BardLegendsHardReset=G;exports.Camera=Kt;exports.ClosestAvailableSpaceHelper=oe;exports.Container=u;exports.ControllerDecorator=et;exports.ControllerLink=U;exports.DEFAULT_RESOLUTION=R;exports.DeltaTime=vi;exports.DisplayObjectArray=pi;exports.Entity=$;exports.EntityDecorator=mt;exports.FadeInContent=Qi;exports.FadeInStateAnimation=_e;exports.Game=w;exports.Graphics=E;exports.ImmovablePhysicsEntity=$t;exports.Menu=Bt;exports.MenuEntity=ui;exports.MouseWheelListenerUI=se;exports.MovableEntity=Ze;exports.MovablePhysicsEntity=Ke;exports.PathFinder=ne;exports.PhysicsEntity=b;exports.Placeholder=hi;exports.PositionConversionHelper=Yt;exports.ROTATIONAL_SPEED_LIMIT=qe;exports.RichText=li;exports.SPEED_LIMIT=Qe;exports.Scene=St;exports.SceneDecorator=wr;exports.ScrollAreaUI=gi;exports.ScrollMaskUI=xt;exports.Service=P;exports.ServiceDecorator=d;exports.SingletonEntity=gt;exports.SlideInContent=ir;exports.SlideInContentByIndex=xi;exports.SlideStateAnimation=Ve;exports.Sprite=Z;exports.StateAnimation=Le;exports.Text=ie;exports.UpdatableContainer=ci;exports.UpdateCycle=y;exports.VectorFieldPathFinder=ae;exports.VectorSet=bt;exports.View=Ut;exports.ViewDecorator=Xe;