bard-legends-framework 1.3.0 → 1.3.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 actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),V=require('pixi.js'),scriptEngineLib=require('script-engine-lib'),W=require('p2');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var V__namespace=/*#__PURE__*/_interopNamespace(V);var W__default=/*#__PURE__*/_interopDefault(W);var B=class{static{this.ƀes=new actionsLib.Action;}static{this.onHardReset=this.ƀes.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀes.trigger();}};function p(){return function(s){let t=b.ƀec(s);s.$meta={paramtypes:t,type:"service"};}}var b=class{static{this.ƀit=new Map;}static get(t){let e=this.ƀit.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀif([],t.$meta.paramtypes);e=new t(...i),this.ƀit.set(t,e);}return e}static ƀec(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e}static ƀif(t,e){let i=[...t];if(e.length>t.length){let o=e.slice(t.length).map(n=>{if(n&&n.$meta?.type==="service")return this.get(n)});i.push(...o);}return i}};B.onHardReset.subscribe(()=>{b.ƀit=new Map;}).attachToRoot();var U=class{constructor(){this.ƀbm=[],this.ƀid=[];}trigger(t,...e){let i=this.ƀbm.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.ƀid.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀid.push(e);}),this.ƀbm.push(t);}};function Q(s){return function(t){let e=b.ƀec(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=b.ƀif([],e);i.some(o=>o===void 0)&&console.error(i,e,t.name);let r=new t(...i);s.controllerLink.registerController(r);}t.$meta={type:"controller"};}}var g=class s{static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀil=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀil.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀjx=0;}static{this.ƀkf=void 0;}static wait(t){let e=this.ƀjx+t;return actionsLib.SingleEvent.create(i=>{let r=s.beforeSceneUpdateAction.subscribe(o=>{o.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkf)this.ƀkf=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkf=void 0;}static triggerUpdateTick(t){this.ƀkf&&(t=this.ƀkf(this.ƀjx,t)),this.ƀjx+=t,this.ƀfr=t,t>0&&(s.ƀad.trigger({time:this.ƀjx,delta:t}),s.ƀil.trigger({time:this.ƀjx,delta:t}),s.ƀf.trigger({time:this.ƀjx,delta:t}));}static get lastDelta(){return this.ƀfr}static{this.ƀfr=0;}};B.onHardReset.subscribe(()=>{g.ƀad.clear(),g.ƀil.clear(),g.ƀf.clear(),g.ƀkf=void 0,g.ƀjx=0;}).attachToRoot();var G=class s{static{this.ƀaw=new Map;}static registerEntityClass(t){this.ƀaw.set(t.id,new Map);}static registerEntity(t){this.ƀaw.get(t.classID).set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀaw.get(i)?.delete(e);}static getEntity(t,e){return this.ƀaw.get(t.id)?.get(e)}static getSingleton(t){let e=s.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.ƀaw.get(t.id);return Array.from(e.values())}};B.onHardReset.subscribe(()=>{G.ƀaw.clear();}).attachToRoot();function Xe(s){return function(t){t.$meta={paramtypes:b.ƀec(t),viewInstances:new Map,entity:s.entity,type:"view"},it.registerView(t,s.entity);}}var Ht=class extends actionsLib.IDAttachable{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.ƀcx=it.entityID,this.ƀei().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀei().delete(this.ƀcx));}update(t,e){}ƀei(){return this.constructor.$meta.viewInstances}};var it=class s{static{this.ƀko=new Map;}static registerView(t,e){s.ƀko.has(e)||s.ƀko.set(e,[]);let i=s.ƀko.get(e);i&&i.push(t),G.getEntities(e).forEach(o=>{this.ƀch(o,t);});}static ƀch(t,e){try{let i=b.ƀif([this],e.$meta.paramtypes);s.entityID=t.id;let r=new e(t,...i.slice(1));t.destroyed?r.destroy():t.ƀkn.ƀkp.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀkp=[];}createViews(){if(!this.ƀcw.destroyed){let t=s.ƀko.get(this.ƀcw.constructor);t&&t.forEach(e=>{s.ƀch(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀkp.length;i++){let r=this.ƀkp[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀkp.forEach(t=>{t.destroy();});}};B.onHardReset.subscribe(()=>{it.ƀko=new Map;}).attachToRoot();function pt(){return function(s){s.$meta={type:"entity"},G.registerEntityClass(s);}}var $=class extends actionsLib.IDAttachable{static getInstanceByID(t){if(t)return G.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=G.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return G.getEntities(this)}constructor(){super(),this.ƀkn=new it(this),G.registerEntity(this),g.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀkn.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀkn.destroyViews(),G.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀkn.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀkn.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀkn.createViews(),this}update(t,e){}};var ft=class extends ${static getInstance(){return G.getSingleton(this)}static getInstanceOrFail(){return G.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 vr(){return function(s){return s.$meta={paramtypes:b.ƀec(s),type:"scene"},s}}var St=class s extends actionsLib.IDAttachable{static{this.ƀik=false;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return s.ƀb.value}static getActiveSceneOrFail(){if(!s.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return s.ƀb.value}static isActive(){return s.ƀb.value instanceof this}static getInstance(){return s.ƀb.value instanceof this?s.ƀb.value:void 0}static getInstanceOrFail(){if(!s.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(s.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${s.ƀb.value}"!`);return s.ƀb.value}static open(...t){if(s.ƀik)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(s.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];s.ƀik=true;let i=b.ƀif([],this.$meta.paramtypes),r=new this(...i).attachToRoot();return s.ƀb.set(r),r.init(e).map(()=>(s.ƀik=false,r)).chainToRoot()}constructor(){super(),this.ƀgn=new actionsLib.SingleAction,this.onClose=this.ƀgn.notifier,g.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(s.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(s.ƀik)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");s.ƀik=true;let e=t[0];return this.prepareToClose().map(()=>(super.destroy(),s.ƀb.set(void 0),s.ƀik=false,this.ƀgn.resolve(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};B.onHardReset.subscribe(()=>{St.ƀb.set(void 0);}).attachToRoot();exports.ContainerEventType=void 0;(function(s){s.Click="click",s.MouseOver="mouseover",s.MouseOut="mouseout",s.PointerDown="pointerdown",s.PointerUp="pointerup",s.PointerUpOutside="pointerupoutside",s.PointerMove="pointermove",s.PointerCancel="pointercancel",s.PointerOver="pointerover",s.PointerOut="pointerout",s.PointerEnter="pointerenter",s.PointerLeave="pointerleave",s.Added="added",s.Removed="removed",s.Update="update",s.Change="change";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(s){s.Default="default",s.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ce=class extends actionsLib.IDAttachable{constructor(){super(),this.ƀgh=false,this.ƀdc=false,this.ƀii=1,this.ƀw=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),o=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=o.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){return actionsLib.Sequence.create(e=>{let i=r=>e();return this.pixiContainer.on(t,i),()=>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.ƀgb=t):(this.ƀgb&&this.pixiContainer.removeChild(this.ƀgb.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}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))}ignoreBounds(t=true){return t?(this.ƀhb||(this.ƀhb=this.pixiContainer.calculateBounds),this.pixiContainer.calculateBounds=()=>this.pixiContainer._bounds.clear()):this.ƀhb&&(this.pixiContainer.calculateBounds=this.ƀhb),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgh}set mirror(t){this.ƀgh=t,this.ƀkg();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkg();}setScale(t){return this.scale=t,this}get scale(){return this.ƀii}set scale(t){this.ƀii=t,this.ƀkg();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀkg();}ƀkg(){this.pixiContainer.scale.set(this.ƀii,this.ƀii),this.ƀw<1?this.pixiContainer.scale.x*=this.ƀw:this.ƀw>1&&(this.pixiContainer.scale.y/=this.ƀw),this.ƀgh&&(this.pixiContainer.scale.x*=-1),this.ƀdc&&(this.pixiContainer.scale.y*=-1);}};var I=2;exports.BlendMode=void 0;(function(s){s[s.Normal=0]="Normal",s[s.Add=1]="Add",s[s.Screen=3]="Screen",s[s.Luminosity=16]="Luminosity",s[s.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var pe=class{static ƀdh(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),o=-(t*t)/(2*i);return r*Math.exp(o)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,o=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(h=>{if(h<r)i-=h*2;else return true}),n=1/i,a=o.map(h=>h*n);return this.ƀbr(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.ƀdh(r,t*.4)),i=e.reduce((r,o)=>r+o,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbr(e)}}static ƀbr(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],o=i+t[i+1]/r;e.push({offset:o,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 de=class s extends V__namespace.Filter{static ƀeh(){return `
1
+ 'use strict';var actionsLib=require('actions-lib');require('reflect-metadata');var helpersLib=require('helpers-lib'),L=require('pixi.js'),scriptEngineLib=require('script-engine-lib'),U=require('p2');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var L__namespace=/*#__PURE__*/_interopNamespace(L);var U__default=/*#__PURE__*/_interopDefault(U);var hr=Object.defineProperty;var h=(s,t)=>hr(s,"name",{value:t,configurable:true});var G=class{static{h(this,"BardLegendsHardReset");}static{this.ƀeu=new actionsLib.Action;}static{this.onHardReset=this.ƀeu.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀeu.trigger();}};function d(){return function(s){let t=T.ƀed(s);s.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var T=class{static{h(this,"Service");}static{this.ƀiy=new Map;}static get(t){let e=this.ƀiy.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀik(t.$meta.paramtypes);e=new t(...i),this.ƀiy.set(t,e);}return e}static ƀed(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀik(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};G.onHardReset.subscribe(()=>{T.ƀiy=new Map;}).attachToRoot();var $=class{static{h(this,"ControllerLink");}constructor(){this.ƀbl=[],this.ƀii=[];}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.ƀii.includes(e))throw new Error(`ServiceLink: the function is already registered, function name: "${e}"`);this.ƀii.push(e);}),this.ƀbl.push(t);}};function q(s){return function(t){let e=T.ƀed(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=T.ƀik(e);i.some(o=>o===void 0)&&console.error(i,e,t.name);let r=new t(...i);s.controllerLink.registerController(r);}t.$meta={type:"controller"};}}h(q,"ControllerDecorator");var y=class s{static{h(this,"UpdateCycle");}static{this.ƀac=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀac.notifier;}static{this.ƀiq=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀiq.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀkc=0;}static{this.ƀkk=void 0;}static wait(t){let e=this.ƀkc+t;return actionsLib.SingleEvent.create(i=>{let r=s.beforeSceneUpdateAction.subscribe(o=>{o.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀkk)this.ƀkk=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀkk=void 0;}static triggerUpdateTick(t){this.ƀkk&&(t=this.ƀkk(this.ƀkc,t)),this.ƀkc+=t,this.ƀft=t,t>0&&(s.ƀac.trigger({time:this.ƀkc,delta:t}),s.ƀiq.trigger({time:this.ƀkc,delta:t}),s.ƀf.trigger({time:this.ƀkc,delta:t}));}static get lastDelta(){return this.ƀft}static{this.ƀft=0;}};G.onHardReset.subscribe(()=>{y.ƀac.clear(),y.ƀiq.clear(),y.ƀf.clear(),y.ƀkk=void 0,y.ƀkc=0;}).attachToRoot();var _=class s{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=s.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(()=>{_.ƀav.clear();}).attachToRoot();function Je(s){return function(t){t.$meta={paramtypes:T.ƀed(t),viewInstances:new Map,entity:s.entity,type:"view"},rt.registerView(t,s.entity);}}h(Je,"ViewDecorator");var dt=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.ƀcx=rt.entityID,this.ƀej().set(this.ƀcx,this);}destroy(){this.destroyed||(super.destroy(),this.ƀej().delete(this.ƀcx));}update(t,e){}ƀej(){return this.constructor.$meta.viewInstances}};var rt=class s{static{h(this,"EntityViewsHelper");}static{this.ƀkt=new Map;}static registerView(t,e){s.ƀkt.has(e)||s.ƀkt.set(e,[]);let i=s.ƀkt.get(e);i&&i.push(t),_.getEntities(e).forEach(o=>{this.ƀcg(o,t);});}static ƀcg(t,e){try{let i=T.ƀik(e.$meta.paramtypes.slice(1));s.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀks.ƀku.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀcw=t,this.ƀku=[];}createViews(){if(!this.ƀcw.destroyed){let t=s.ƀkt.get(this.ƀcw.constructor);t&&t.forEach(e=>{s.ƀcg(this.ƀcw,e);});}}updateViews(t,e){for(let i=0;i<this.ƀku.length;i++){let r=this.ƀku[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀku.forEach(t=>{t.destroy();});}};G.onHardReset.subscribe(()=>{rt.ƀkt=new Map;}).attachToRoot();function ft(){return function(s){s.$meta={type:"entity"},_.registerEntityClass(s);}}h(ft,"EntityDecorator");var k=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return _.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=_.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return _.getEntities(this)}constructor(){super(),this.ƀks=new rt(this),_.registerEntity(this),y.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀks.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀks.destroyViews(),_.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀks.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀks.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀks.createViews(),this}update(t,e){}};var ut=class extends k{static{h(this,"SingletonEntity");}static getInstance(){return _.getSingleton(this)}static getInstanceOrFail(){return _.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 yr(){return function(s){return s.$meta={paramtypes:T.ƀed(s),type:"scene"},s}}h(yr,"SceneDecorator");var he=class s extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀip=false;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveScene(){return s.ƀb.value}static getActiveSceneOrFail(){if(!s.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return s.ƀb.value}static isActive(){return s.ƀb.value instanceof this}static getInstance(){return s.ƀb.value instanceof this?s.ƀb.value:void 0}static getInstanceOrFail(){if(!s.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(s.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${s.ƀb.value}"!`);return s.ƀb.value}static open(...t){if(s.ƀip)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(s.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];s.ƀip=true;let i=T.ƀik(this.$meta.paramtypes),r=new this(...i).attachToRoot();return s.ƀb.set(r),r.init(e).map(()=>(s.ƀip=false,r)).chainToRoot()}constructor(){super(),this.ƀgr=new actionsLib.SingleAction,this.onClose=this.ƀgr.notifier,y.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(s.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(s.ƀip)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");s.ƀip=true;let e=t[0];return this.prepareToClose().map(()=>(super.destroy(),s.ƀb.set(void 0),s.ƀip=false,this.ƀgr.resolve(e),e)).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};G.onHardReset.subscribe(()=>{he.ƀb.set(void 0);}).attachToRoot();exports.ContainerEventType=void 0;(function(s){s.Click="click",s.MouseOver="mouseover",s.MouseOut="mouseout",s.PointerDown="pointerdown",s.PointerUp="pointerup",s.PointerUpOutside="pointerupoutside",s.PointerMove="pointermove",s.PointerCancel="pointercancel",s.PointerOver="pointerover",s.PointerOut="pointerout",s.PointerEnter="pointerenter",s.PointerLeave="pointerleave",s.Added="added",s.Removed="removed",s.Update="update",s.Change="change";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(s){s.Default="default",s.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ce=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀgl=false,this.ƀdc=false,this.ƀin=1,this.ƀw=1,this.ƀhu=new L__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀhu.width,this.ƀhu.height)}setSize(t){return this.ƀhu.width=t.x,this.ƀhu.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀhu.getLocalBounds(),r=new helpersLib.Vector(this.ƀhu.scale.x,this.ƀhu.scale.y),o=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=o.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.ƀhu.x,this.ƀhu.y)}set position(t){this.ƀhu.position=t;}get x(){return this.ƀhu.x}set x(t){this.ƀhu.x=t;}get y(){return this.ƀhu.y}set y(t){this.ƀhu.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>e(),"handle");return this.ƀhu.on(t,i),()=>this.ƀhu.off(t,i)})}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀhu.rotation)}set rotation(t){this.ƀhu.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.ƀhu.zIndex}set zIndex(t){this.ƀhu.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀhu.skew.x)}set skewX(t){this.ƀhu.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀhu.skew.y)}set skewY(t){this.ƀhu.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀhu.sortableChildren}set sortableChildren(t){this.ƀhu.sortableChildren=t;}setAlpha(t){return this.ƀhu.alpha=t,this}get alpha(){return this.ƀhu.alpha}set alpha(t){this.ƀhu.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀhu.interactive}set interactive(t){t?this.ƀhu.eventMode="dynamic":this.ƀhu.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀhu.cursor}set cursor(t){this.ƀhu.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀhu.addChild(t.ƀhu),this.ƀhu.mask=t.getMask(),this.ƀgd=t):(this.ƀgd&&this.ƀhu.removeChild(this.ƀgd.ƀhu),this.ƀhu.mask=null),this}hitTest(t){if(this.ƀhu.parent)if(this.ƀhu.hitArea){let e=this.ƀhu.toLocal(t);return this.ƀhu.hitArea.contains(e.x,e.y)}else return this.ƀhu.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀhu.getLocalBounds();return new helpersLib.Rectangle(new helpersLib.Vector(t.x,t.y),new helpersLib.Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhe||(this.ƀhe=this.ƀhu.calculateBounds),this.ƀhu.calculateBounds=()=>this.ƀhu._bounds.clear()):this.ƀhe&&(this.ƀhu.calculateBounds=this.ƀhe),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀgl}set mirror(t){this.ƀgl=t,this.ƀkl();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdc}set flip(t){this.ƀdc=t,this.ƀkl();}setScale(t){return this.scale=t,this}get scale(){return this.ƀin}set scale(t){this.ƀin=t,this.ƀkl();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀkl();}ƀkl(){this.ƀhu.scale.set(this.ƀin,this.ƀin),this.ƀw<1?this.ƀhu.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀhu.scale.y/=this.ƀw),this.ƀgl&&(this.ƀhu.scale.x*=-1),this.ƀdc&&(this.ƀhu.scale.y*=-1);}};var A=2;exports.BlendMode=void 0;(function(s){s[s.Normal=0]="Normal",s[s.Add=1]="Add",s[s.Screen=3]="Screen",s[s.Luminosity=16]="Luminosity",s[s.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var pe=class{static{h(this,"GaussianValuesHelper");}static ƀdh(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),o=-(t*t)/(2*i);return r*Math.exp(o)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,o=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=o.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.ƀdh(r,t*.4)),i=e.reduce((r,o)=>r+o,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],o=i+t[i+1]/r;e.push({offset:o,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 Ri=class Xe extends L__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀei(){return `
2
2
  attribute vec2 aVertexPosition;
3
3
  attribute vec2 aTextureCoord;
4
4
 
@@ -29,7 +29,7 @@
29
29
  iterate(${o}, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);
30
30
  iterate(${o} * -1.0, ${helpersLib.NumberHelper.toFloatString(t[r].multiplier)}, gl_FragColor);`;}return i+=`
31
31
  }
32
- `,i}constructor(t,e){super(s.ƀeh(),s.ƀdq(pe.getValuesForLinearSamplingGauss(t),e)),this.ƀev=e,this.resolution=I;}apply(t,e,i,r){this.uniforms.pixelSize=this.ƀev?1/(e.width*I):1/(e.height*I),t.applyFilter(this,e,i,r);}},Ct=class extends V__namespace.Filter{constructor(t=new helpersLib.Vector(2,2)){if(super(),this.ƀjn=t,this.resolution=I,this.ƀjn=t.multiplyNumber(I).floor(),this.ƀjn.x<0||this.ƀjn.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀjn.x>100||this.ƀjn.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀex=new de(this.ƀjn.x,true),this.ƀkl=new de(this.ƀjn.y,false),this.padding=Math.max(this.ƀjn.x,this.ƀjn.y);}apply(t,e,i,r){let o=t.getFilterTexture();this.ƀkl.apply(t,e,o,V__namespace.CLEAR_MODES.CLEAR),this.ƀex.apply(t,o,i,r),t.returnFilterTexture(o);}get blendMode(){return this.ƀex.blendMode}set blendMode(t){this.ƀex.blendMode=t,this.ƀkl.blendMode=t;}};var ue=class{get red(){return this.ƀhz}set red(t){this.ƀhz=t,this.ƀia();}get green(){return this.ƀel}set green(t){this.ƀel=t,this.ƀia();}get blue(){return this.ƀag}set blue(t){this.ƀag=t,this.ƀia();}get brightness(){return this.ƀal}set brightness(t){this.ƀal=t,this.ƀia();}get contrast(){return this.ƀbl}set contrast(t){this.ƀbl=t,this.ƀia();}get blur(){return this.ƀah}set blur(t){let e=helpersLib.Comparator.isNumber(t)?new helpersLib.Vector(t,t):t;(this.ƀah&&e&&!this.ƀah.isEqual(e)||this.ƀah&&!e||!this.ƀah&&e)&&(this.ƀah=e,this.ƀai&&(this.ƀai.destroy(),this.ƀai=void 0),e&&(this.ƀai=new Ct(e),this.ƀgr()));}constructor(t){this.ƀbh=t,this.ƀhz=1,this.ƀel=1,this.ƀag=1,this.ƀal=1,this.ƀbl=1,this.ƀgr();}removeColorFilter(){this.ƀba?.destroy(),this.ƀba=void 0,this.ƀgr();}ƀia(){this.ƀhz===1&&this.ƀel===1&&this.ƀag===1&&this.ƀal===1&&this.ƀbl===1?this.ƀba&&(this.ƀba.destroy(),this.ƀba=void 0,this.ƀgr()):(this.ƀba||(this.ƀba=new V__namespace.ColorMatrixFilter,this.ƀba.resolution=I,this.ƀgr()),this.ƀba.matrix=[this.ƀhz*this.ƀbl,0,0,0,this.ƀal-1,0,this.ƀel*this.ƀbl,0,0,this.ƀal-1,0,0,this.ƀag*this.ƀbl,0,this.ƀal-1,0,0,0,1,0]);}ƀgr(){let t=[];this.ƀai&&t.push(this.ƀai),this.ƀba&&t.push(this.ƀba),this.ƀbh.filters=t;}};var f=class s extends ce{static{this.allContainers=new Map;}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},s.allContainers.set(this.id,this),this.filters=new ue(this.pixiContainer);}destroy(){this.destroyed||(super.destroy(),s.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=s.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}};var A=class{static{this.ƀig=new Map;}static{this.ƀp=0;}static getAsset(t){let e=this.ƀig.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.ƀp++}`),this.ƀig.set(e,t),e}static destroyAsset(t){let e=this.ƀig.get(t);e&&(e.destroy(true),this.ƀig.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(o=>{if(!helpersLib.Comparator.isString(o.url))throw new Error(`GameAssets: source url should be a string: ${o.url}`);let n=e.get(o.url);n?n.push(o.id):(e.set(o.url,[o.id]),i.push({url:o.url,callback:a=>{if(a instanceof V__namespace.Texture&&(a.id=o.id),n=e.get(o.url),n)n.forEach(h=>{this.ƀig.set(h,a);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${o}`)}}));});let r=performance.now();return Promise.all(i.map(o=>V__namespace.Assets.load(o.url))).then(o=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-r)/1e3," seconds"),o.forEach((a,h)=>{i[h].callback(a);});}).catch(o=>{throw new Error(`GameAssets: during asset loading, an error occured: ${o}`)})}};var $t=class{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(o=>o.map(n=>r.to(helpersLib.Vector.fromVec2(n))))}},ge=class{constructor(t,e,i){this.ƀja=t.map(r=>new V__namespace.Polygon(r.map(o=>new V__namespace.Point(o.x,o.y))));}contains(t,e){return this.ƀja.some(i=>i.contains(t,e))}};var Bi;(function(s){s.BackgroundScreen="backgroundScreen",s.Background="background",s.Main="main",s.Foreground="foreground",s.ForegroundScreen="foregroundScreen";})(Bi||(Bi={}));exports.FocusingAnimation=void 0;(function(s){s[s.Instant=1]="Instant",s[s.EaseInOut=2]="EaseInOut",s[s.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var Dr=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ut=new U;exports.CameraGateway=class Tt{createCamera(){return ut.trigger("createCamera")}update(t,e){return ut.trigger("update",t,e)}setPosition(t){return ut.trigger("setPosition",t)}setTransition(t){return ut.trigger("setTransition",t)}getCameraPosition(){return ut.trigger("getCameraPosition")}};exports.CameraGateway=Dr([p()],exports.CameraGateway);var Br=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},we=new U,zt=class{getLayers(){return we.trigger("getLayers")}appear(t,e){return we.trigger("appear",t,e)}};zt=Br([p()],zt);var k=class{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}},Qe=class{start(){}multiplierFunction(t){return k.lineer(t)}},qe=class{start(){}multiplierFunction(t){return k.easeIn(t)}},ti=class{start(){}multiplierFunction(t){return k.easeOut(t)}},ei=class{start(){}multiplierFunction(t){return k.easeInOut(t)}},ii=class{start(){}multiplierFunction(t){return k.easeInOutCubic(t)}},Gi=class{start(){this.ƀjy=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀjy[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀjy[e]}},S=class{static{this.lineer=new Qe;}static{this.easeIn=new qe;}static{this.easeOut=new ti;}static{this.easeInOut=new ei;}static{this.easeInOutCubic=new ii;}};exports.ReAnimateHandlingType=void 0;(function(s){s[s.ThrowError=1]="ThrowError",s[s.IgnoreNewAnimation=2]="IgnoreNewAnimation",s[s.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(s){s[s.ReturnToOriginal=1]="ReturnToOriginal",s[s.StayInCurrentState=2]="StayInCurrentState",s[s.JumpToEnd=3]="JumpToEnd",s[s.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var O=class s{static{this.ƀk=new WeakMap;}static ƀdj(t){let e=s.ƀk.get(t);return e||(e=new helpersLib.MapToWeakRefs,s.ƀk.set(t,e)),e}get animating(){return this.ƀgx!==void 0}get target(){return this.ƀjp}get value(){return this.ƀkh||(this.ƀkh=new actionsLib.Variable(this.ƀjp)),this.ƀkh.notifier}constructor(t,e,i){this.ƀfl=false,this.ƀjb=false,this.ƀjp=t,this.ƀha={duration:200,animation:S.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀl=helpersLib.Comparator.isArray(e)?e:[e],this.ƀfy(t,this.ƀl);}animate(t,e){let i={...this.ƀha,...e},r=this.ƀgx;if(this.ƀgx)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.ƀiv(i.completionHandling,this.ƀgx.ƀhv,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀfl&&(this.ƀjb=true);let a=this.ƀl.reduce((l,c)=>(l[c]={ƀjj:this.ƀjp[c],ƀjr:t[c]},l),{}),h={ƀcs:i.duration,ƀct:0,ƀhv:a,ƀbf:i.completionHandling,ƀm:i.animation,ƀbe:n};if(h.ƀbf!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfj(h)){this.ƀgx=void 0,n(),r?.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}else h.ƀm.start();return this.ƀgx=h,this.ƀcv(),r?.ƀbe(),()=>{this.ƀgx===h&&(this.ƀjp instanceof actionsLib.Attachable&&this.ƀjp.destroyed||this.ƀiv(h.ƀbf,h.ƀhv,true),this.ƀgx=void 0,this.ƀke?.destroy(),this.ƀke=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r]&&(e=true,this.ƀjp[r]=t[r]);}e&&this.ƀkh?.set(this.ƀjp),this.ƀgx?.ƀbe();}completeAnimation(t){if(this.ƀgx){t=t??this.ƀgx.ƀbf,this.ƀiv(t,this.ƀgx.ƀhv,true);let e=this.ƀgx.ƀbe;this.ƀgx=void 0,e();}}ƀcv(){this.ƀke||(this.ƀke=g.beforeSceneUpdateAction.subscribe(t=>{this.ƀfl=true;try{let e=this.ƀgx;if(!e)return;e.ƀct+=t.delta;let i=e.ƀct>=e.ƀcs;if(i)if(e.ƀbf===exports.AnimationsCompletionHandlingType.Loop)e.ƀct%=e.ƀcs,e.ƀm.start(),i=!1;else {this.ƀiv(e.ƀbf,e.ƀhv,!1),this.ƀgx=void 0,e.ƀbe(),this.ƀgx||(this.ƀke?.destroy(),this.ƀke=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀct/e.ƀcs),o=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],h=e.ƀhv[a],c=(h.ƀjr-h.ƀjj)*r+h.ƀjj;c!==this.ƀjp[a]&&(o=!0,this.ƀjp[a]=c);}o&&this.ƀkh?.set(this.ƀjp);}}finally{this.ƀfl=false,this.ƀjb&&(this.ƀjb=false,this.ƀke?.destroy(),this.ƀke=void 0,this.ƀcv());}}).attachToRoot());}ƀfj(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀjp[i]!==t.ƀhv[i].ƀjr)return false}return true}ƀiv(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:this.ƀih(e);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀfo(e);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀfo(e);break;case exports.AnimationsCompletionHandlingType.Loop:this.ƀih(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀih(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjj&&(e=true,this.ƀjp[r]=t[r].ƀjj);}e&&this.ƀkh?.set(this.ƀjp);}ƀfo(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀjp[r]!==t[r].ƀjr&&(e=true,this.ƀjp[r]=t[r].ƀjr);}e&&this.ƀkh?.set(this.ƀjp);}ƀfy(t,e){let i=s.ƀdj(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 R;(function(s){s[s.Idle=1]="Idle",s[s.Transitioning=2]="Transitioning",s[s.Reverting=3]="Reverting";})(R||(R={}));var xe=class extends actionsLib.Attachable{get currentState(){return {value:this.ƀj.value,state:this.ƀjk,nextState:this.ƀgl,queuedState:this.ƀhw,animationState:this.ƀn}}constructor(t){super(),this.ƀj={value:0},this.ƀn=R.Idle,this.ƀgt=new actionsLib.Action,this.ƀgv=new actionsLib.Action,this.ƀha={duration:500,animation:S.lineer,...t},this.ƀo=new O(this.ƀj,"value",{duration:this.ƀha.duration,animation:this.ƀha.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀo.value.subscribe(()=>{this.ƀj.value!==1&&this.ƀj.value!==0&&this.ƀgv.trigger(this.ƀj.value);}).attach(this);}setState(t,e){if(this.ƀjk===void 0)this.ƀjk=t,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl}),this.ƀgv.trigger(this.ƀj.value);else if(e?.instant)this.ƀo.completeAnimation(),this.ƀn=R.Idle,this.ƀjk=t,this.ƀgl=void 0,this.ƀj.value=0,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl}),this.ƀgv.trigger(this.ƀj.value);else switch(this.ƀn){case R.Idle:t!==this.ƀjk&&(this.ƀn=R.Transitioning,this.ƀgl=t,this.ƀj.value=0,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl}),this.ƀgv.trigger(this.ƀj.value),this.ƀo.animate({value:1}).tap(()=>this.ƀgp()).attach(this));break;case R.Transitioning:t!==this.ƀgl&&(t===this.ƀjk?(this.ƀn=R.Reverting,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀha.duration}).tap(()=>this.ƀgp()).attach(this)):this.ƀhw=t);break;case R.Reverting:t!==this.ƀjk&&(t===this.ƀgl?(this.ƀn=R.Transitioning,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀha.duration}).tap(()=>this.ƀgp()).attach(this)):this.ƀhw=t);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀgp(){switch(this.ƀn){case R.Transitioning:this.ƀj.value===1&&(this.ƀj.value=0,this.ƀhw!==void 0?(this.ƀn=R.Transitioning,this.ƀjk=this.ƀgl,this.ƀgl=this.ƀhw,this.ƀhw=void 0,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl}),this.ƀo.animate({value:1}).tap(()=>this.ƀgp()).attach(this)):(this.ƀn=R.Idle,this.ƀjk=this.ƀgl,this.ƀgl=void 0,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl})),this.ƀgv.trigger(this.ƀj.value));break;case R.Reverting:if(this.ƀjk===void 0)throw new Error("StateAnimation: state must be defined when reverting!");this.ƀj.value===0&&(this.ƀhw!==void 0?(this.ƀn=R.Transitioning,this.ƀgl=this.ƀhw,this.ƀhw=void 0,this.ƀj.value=0,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl}),this.ƀo.animate({value:1}).tap(()=>this.ƀgp()).attach(this)):(this.ƀn=R.Idle,this.ƀgl=void 0,this.ƀj.value=0,this.ƀgt.trigger({state:this.ƀjk,nextState:this.ƀgl})),this.ƀgv.trigger(this.ƀj.value));break;case R.Idle:break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}onStateChange(t){return this.ƀgt.subscribe(e=>t(e.state,e.nextState)).attach(this),this}onValueChange(t){return this.ƀgv.subscribe(e=>t(e)).attach(this),this}};var w;(function(s){s[s.Hidden=1]="Hidden",s[s.Visible=2]="Visible",s[s.Appearing=3]="Appearing",s[s.Disappearing=4]="Disappearing",s[s.DisappearToChange=5]="DisappearToChange";})(w||(w={}));var ve=class extends actionsLib.Attachable{get currentState(){return {value:this.ƀj.value,state:this.ƀjk,queuedState:this.ƀhw,animationState:this.ƀn}}constructor(t){super(),this.ƀj={value:0},this.ƀn=w.Hidden,this.ƀgt=new actionsLib.Action,this.ƀgv=new actionsLib.Action,this.ƀha={duration:500,animation:S.lineer,...t},this.ƀj.value=0,this.ƀo=new O(this.ƀj,"value",{duration:this.ƀha.duration,animation:this.ƀha.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀo.value.subscribe(()=>{this.ƀj.value!==1&&this.ƀj.value!==0&&this.ƀgv.trigger(this.ƀj.value);}).attach(this);}setState(t,e){if(e?.instant){this.ƀo.completeAnimation(),this.ƀn=t!==void 0?w.Visible:w.Hidden,this.ƀhw=void 0;let i=t!==void 0?1:0,r=this.ƀjk!==t;r&&(this.ƀjk=t,this.ƀgt.trigger(this.ƀjk)),(r||this.ƀj.value!==i)&&(this.ƀj.value=i,this.ƀgv.trigger(this.ƀj.value));}else switch(this.ƀn){case w.Hidden:t!==void 0&&(this.ƀn=w.Appearing,this.ƀhw=void 0,this.ƀjk=t,this.ƀgt.trigger(this.ƀjk),this.ƀo.animate({value:1}).tap(()=>this.ƀgp()).attach(this));break;case w.Visible:t===void 0?(this.ƀn=w.Disappearing,this.ƀhw=void 0,this.ƀo.animate({value:0}).tap(()=>this.ƀgp()).attach(this)):t!==this.ƀjk&&(this.ƀn=w.DisappearToChange,this.ƀhw=t,this.ƀo.animate({value:0}).tap(()=>this.ƀgp()).attach(this));break;case w.Appearing:t===void 0?(this.ƀn=w.Disappearing,this.ƀhw=void 0,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀha.duration}).tap(()=>this.ƀgp()).attach(this)):t!==this.ƀjk&&(this.ƀj.value>0?(this.ƀn=w.DisappearToChange,this.ƀhw=t,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀha.duration}).tap(()=>this.ƀgp()).attach(this)):(this.ƀhw=void 0,this.ƀjk=t,this.ƀgt.trigger(this.ƀjk)));break;case w.Disappearing:t===this.ƀjk?(this.ƀn=w.Appearing,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀha.duration}).tap(()=>this.ƀgp()).attach(this)):t!==void 0&&(this.ƀn=w.DisappearToChange,this.ƀhw=t);break;case w.DisappearToChange:t===void 0?(this.ƀn=w.Disappearing,this.ƀhw=void 0):t===this.ƀjk?(this.ƀn=w.Appearing,this.ƀhw=void 0,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀha.duration}).tap(()=>this.ƀgp()).attach(this)):t!==this.ƀhw&&(this.ƀhw=t);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀgp(){switch(this.ƀn){case w.Appearing:this.ƀj.value===1&&(this.ƀn=w.Visible,this.ƀgv.trigger(this.ƀj.value));break;case w.Disappearing:if(this.ƀhw!==void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearing should not have a queued value");this.ƀj.value===0&&(this.ƀn=w.Hidden,this.ƀjk=void 0,this.ƀgt.trigger(this.ƀjk),this.ƀgv.trigger(this.ƀj.value));break;case w.DisappearToChange:if(this.ƀhw===void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearToChange should always have a queued value");this.ƀj.value===0&&(this.ƀn=w.Appearing,this.ƀjk=this.ƀhw,this.ƀhw=void 0,this.ƀgt.trigger(this.ƀjk),this.ƀgv.trigger(this.ƀj.value),this.ƀo.animate({value:1}).tap(()=>this.ƀgp()).attach(this));break;case w.Hidden:case w.Visible:return;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}onStateChange(t){return this.ƀgt.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀgv.subscribe(e=>t(e)).attach(this),this}};var Li=class extends f{constructor(t,e){super(),this.ƀbv=t;let i={duration:200,animation:S.easeInOut,...e};this.alpha=0,this.ƀjl=new ve(i).onStateChange(r=>{this.ƀbi?.destroy(),this.ƀbi=void 0,r!==void 0&&(this.ƀbi=new f().displayParent(this).attach(this),this.ƀbv({state:r,container:this.ƀbi}));}).onValueChange(r=>{this.alpha=r;}).attach(this);}setState(t,e){return this.ƀjl.setState(t,e),this}};var Se=class s extends V__namespace.Filter{static ƀeh(){return `
32
+ `,i}constructor(t,e){super(Xe.ƀei(),Xe.ƀdq(pe.getValuesForLinearSamplingGauss(t),e)),this.ƀex=e,this.resolution=A;}apply(t,e,i,r){this.uniforms.pixelSize=this.ƀex?1/(e.width*A):1/(e.height*A),t.applyFilter(this,e,i,r);}},Tt=class extends L__namespace.Filter{static{h(this,"BlurFilter");}constructor(t=new helpersLib.Vector(2,2)){if(super(),this.ƀjs=t,this.resolution=A,this.ƀjs=t.multiplyNumber(A).floor(),this.ƀjs.x<0||this.ƀjs.y<0)throw new Error("BlurFilterLinearSampling: Strength * Resolution must be greater than 0");if(this.ƀjs.x>100||this.ƀjs.y>100)throw new Error("BlurFilterLinearSampling: Strength * Resolution cannot be higher than 100");this.ƀez=new Ri(this.ƀjs.x,true),this.ƀkq=new Ri(this.ƀjs.y,false),this.padding=Math.max(this.ƀjs.x,this.ƀjs.y);}apply(t,e,i,r){let o=t.getFilterTexture();this.ƀkq.apply(t,e,o,L__namespace.CLEAR_MODES.CLEAR),this.ƀez.apply(t,o,i,r),t.returnFilterTexture(o);}get blendMode(){return this.ƀez.blendMode}set blendMode(t){this.ƀez.blendMode=t,this.ƀkq.blendMode=t;}};var fe=class{static{h(this,"Filters");}get red(){return this.ƀid}set red(t){this.ƀid=t,this.ƀie();}get green(){return this.ƀem}set green(t){this.ƀem=t,this.ƀie();}get blue(){return this.ƀaf}set blue(t){this.ƀaf=t,this.ƀie();}get brightness(){return this.ƀak}set brightness(t){this.ƀak=t,this.ƀie();}get contrast(){return this.ƀbk}set contrast(t){this.ƀbk=t,this.ƀie();}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 Tt(e),this.ƀgv()));}constructor(t){this.ƀbg=t,this.ƀid=1,this.ƀem=1,this.ƀaf=1,this.ƀak=1,this.ƀbk=1,this.ƀgv();}removeColorFilter(){this.ƀaz?.destroy(),this.ƀaz=void 0,this.ƀgv();}ƀie(){this.ƀid===1&&this.ƀem===1&&this.ƀaf===1&&this.ƀak===1&&this.ƀbk===1?this.ƀaz&&(this.ƀaz.destroy(),this.ƀaz=void 0,this.ƀgv()):(this.ƀaz||(this.ƀaz=new L__namespace.ColorMatrixFilter,this.ƀaz.resolution=A,this.ƀgv()),this.ƀaz.matrix=[this.ƀid*this.ƀbk,0,0,0,this.ƀak-1,0,this.ƀem*this.ƀbk,0,0,this.ƀak-1,0,0,this.ƀaf*this.ƀbk,0,this.ƀak-1,0,0,0,1,0]);}ƀgv(){let t=[];this.ƀah&&t.push(this.ƀah),this.ƀaz&&t.push(this.ƀaz),this.ƀbg.filters=t;}};var f=class s extends ce{static{h(this,"Container");}static{this.allContainers=new Map;}constructor(){super(),this.addChildTo=this,this.defaultChildOptions={addUnder:false,cropOverflowingParts:false},s.allContainers.set(this.id,this),this.filters=new fe(this.ƀhu);}destroy(){this.destroyed||(super.destroy(),s.allContainers.delete(this.id),!this.ƀhu.destroyed&&this.ƀhu.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=s.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.ƀhu.addChildAt(this.ƀhu,0):i.addChildTo.ƀhu.addChild(this.ƀhu),r.cropOverflowingParts)if(i)this.ƀhu.mask=i.getBoundingMask().pixiSprite;else throw new Error("Container: cropOverflowingParts can only be used with Container parent!");return this}};var O=class{static{h(this,"GameAssets");}static{this.ƀil=new Map;}static{this.ƀp=0;}static getAsset(t){let e=this.ƀil.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.ƀp++}`),this.ƀil.set(e,t),e}static destroyAsset(t){let e=this.ƀil.get(t);e&&(e.destroy(true),this.ƀil.delete(t));}static async loadGameAssets(t){let e=new Map,i=[];t.forEach(o=>{if(!helpersLib.Comparator.isString(o.url))throw new Error(`GameAssets: source url should be a string: ${o.url}`);let n=e.get(o.url);n?n.push(o.id):(e.set(o.url,[o.id]),i.push({url:o.url,callback:h(a=>{if(a instanceof L__namespace.Texture&&(a.id=o.id),n=e.get(o.url),n)n.forEach(l=>{this.ƀil.set(l,a);});else throw new Error(`GameAssets: unexpected error, nameGroup is not found! "./"! ${o}`)},"callback")}));});let r=performance.now();return Promise.all(i.map(o=>L__namespace.Assets.load(o.url))).then(o=>{let n=performance.now();console.info("Asset load completed in: ",Math.round(n-r)/1e3," seconds"),o.forEach((a,l)=>{i[l].callback(a);});}).catch(o=>{throw new Error(`GameAssets: during asset loading, an error occured: ${o}`)})}};var Wt=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(o=>o.map(n=>r.to(helpersLib.Vector.fromVec2(n))))}},me=class{static{h(this,"CompositeHitArea");}constructor(t,e,i){this.ƀjf=t.map(r=>new L__namespace.Polygon(r.map(o=>new L__namespace.Point(o.x,o.y))));}contains(t,e){return this.ƀjf.some(i=>i.contains(t,e))}};var Ii;(function(s){s.BackgroundScreen="backgroundScreen",s.Background="background",s.Main="main",s.Foreground="foreground",s.ForegroundScreen="foregroundScreen";})(Ii||(Ii={}));exports.FocusingAnimation=void 0;(function(s){s[s.Instant=1]="Instant",s[s.EaseInOut=2]="EaseInOut",s[s.EaseOut=3]="EaseOut";})(exports.FocusingAnimation||(exports.FocusingAnimation={}));var Ar=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},gt=new $;exports.CameraGateway=class Et{static{h(this,"CameraGateway");}createCamera(){return gt.trigger("createCamera")}update(t,e){return gt.trigger("update",t,e)}setPosition(t){return gt.trigger("setPosition",t)}setTransition(t){return gt.trigger("setTransition",t)}getCameraPosition(){return gt.trigger("getCameraPosition")}};exports.CameraGateway=Ar([d()],exports.CameraGateway);var Or=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ye=new $,Ut=class{static{h(this,"CameraViewGateway");}getLayers(){return ye.trigger("getLayers")}appear(t,e){return ye.trigger("appear",t,e)}};Ut=Or([d()],Ut);var J=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}},Mr=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return J.lineer(t)}},Dr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return J.easeIn(t)}},Br=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return J.easeOut(t)}},Gr=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return J.easeInOut(t)}},_r=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return J.easeInOutCubic(t)}},Ai=class{static{h(this,"AnimationFlicker");}start(){this.ƀkd=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀkd[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀkd[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀkd[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀkd[e]}},P=class{static{h(this,"Animations");}static{this.lineer=new Mr;}static{this.easeIn=new Dr;}static{this.easeOut=new Br;}static{this.easeInOut=new Gr;}static{this.easeInOutCubic=new _r;}};exports.ReAnimateHandlingType=void 0;(function(s){s[s.ThrowError=1]="ThrowError",s[s.IgnoreNewAnimation=2]="IgnoreNewAnimation",s[s.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(s){s[s.ReturnToOriginal=1]="ReturnToOriginal",s[s.StayInCurrentState=2]="StayInCurrentState",s[s.JumpToEnd=3]="JumpToEnd",s[s.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var M=class s{static{h(this,"Animator");}static{this.ƀk=new WeakMap;}static ƀdj(t){let e=s.ƀk.get(t);return e||(e=new helpersLib.MapToWeakRefs,s.ƀk.set(t,e)),e}get animating(){return this.ƀhb!==void 0}get target(){return this.ƀju}get value(){return this.ƀkm||(this.ƀkm=new actionsLib.Variable(this.ƀju)),this.ƀkm.notifier}constructor(t,e,i){this.ƀfn=false,this.ƀjg=false,this.ƀju=t,this.ƀhd={duration:200,animation:P.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀl=helpersLib.Comparator.isArray(e)?e:[e],this.ƀga(t,this.ƀl);}animate(t,e){let i={...this.ƀhd,...e},r=this.ƀhb;if(this.ƀhb)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.ƀja(i.completionHandling,this.ƀhb.ƀhz,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀfn&&(this.ƀjg=true);let a=this.ƀl.reduce((c,p)=>(c[p]={ƀjo:this.ƀju[p],ƀjw:t[p]},c),{}),l={ƀcs:i.duration,ƀct:0,ƀhz:a,ƀbe:i.completionHandling,ƀm:i.animation,ƀbd:n};if(l.ƀbe!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfl(l)){this.ƀhb=void 0,n(),r?.ƀbd(),this.ƀhb||(this.ƀkj?.destroy(),this.ƀkj=void 0);return}else l.ƀm.start();return this.ƀhb=l,this.ƀcv(),r?.ƀbd(),()=>{this.ƀhb===l&&(this.ƀju instanceof actionsLib.Attachable&&this.ƀju.destroyed||this.ƀja(l.ƀbe,l.ƀhz,true),this.ƀhb=void 0,this.ƀkj?.destroy(),this.ƀkj=void 0);}})}set(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀju[r]!==t[r]&&(e=true,this.ƀju[r]=t[r]);}e&&this.ƀkm?.set(this.ƀju),this.ƀhb?.ƀbd();}completeAnimation(t){if(this.ƀhb){t=t??this.ƀhb.ƀbe,this.ƀja(t,this.ƀhb.ƀhz,true);let e=this.ƀhb.ƀbd;this.ƀhb=void 0,e();}}ƀcv(){this.ƀkj||(this.ƀkj=y.beforeSceneUpdateAction.subscribe(t=>{this.ƀfn=true;try{let e=this.ƀhb;if(!e)return;e.ƀct+=t.delta;let i=e.ƀct>=e.ƀcs;if(i)if(e.ƀbe===exports.AnimationsCompletionHandlingType.Loop)e.ƀct%=e.ƀcs,e.ƀm.start(),i=!1;else {this.ƀja(e.ƀbe,e.ƀhz,!1),this.ƀhb=void 0,e.ƀbd(),this.ƀhb||(this.ƀkj?.destroy(),this.ƀkj=void 0);return}if(!i){let r=e.ƀm.multiplierFunction(e.ƀct/e.ƀcs),o=!1;for(let n=0;n<this.ƀl.length;n++){let a=this.ƀl[n],l=e.ƀhz[a],p=(l.ƀjw-l.ƀjo)*r+l.ƀjo;p!==this.ƀju[a]&&(o=!0,this.ƀju[a]=p);}o&&this.ƀkm?.set(this.ƀju);}}finally{this.ƀfn=false,this.ƀjg&&(this.ƀjg=false,this.ƀkj?.destroy(),this.ƀkj=void 0,this.ƀcv());}}).attachToRoot());}ƀfl(t){for(let e=0;e<this.ƀl.length;e++){let i=this.ƀl[e];if(this.ƀju[i]!==t.ƀhz[i].ƀjw)return false}return true}ƀja(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:this.ƀim(e);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀfq(e);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀfq(e);break;case exports.AnimationsCompletionHandlingType.Loop:this.ƀim(e);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀim(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀju[r]!==t[r].ƀjo&&(e=true,this.ƀju[r]=t[r].ƀjo);}e&&this.ƀkm?.set(this.ƀju);}ƀfq(t){let e=false;for(let i=0;i<this.ƀl.length;i++){let r=this.ƀl[i];this.ƀju[r]!==t[r].ƀjw&&(e=true,this.ƀju[r]=t[r].ƀjw);}e&&this.ƀkm?.set(this.ƀju);}ƀga(t,e){let i=s.ƀdj(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 I;(function(s){s[s.Idle=1]="Idle",s[s.Transitioning=2]="Transitioning",s[s.Reverting=3]="Reverting";})(I||(I={}));var we=class extends actionsLib.Attachable{static{h(this,"StateAnimation");}get currentState(){return {value:this.ƀj.value,state:this.ƀjp,nextState:this.ƀgp,queuedState:this.ƀia,animationState:this.ƀn}}constructor(t){super(),this.ƀj={value:0},this.ƀn=I.Idle,this.ƀgy=new actionsLib.Action,this.ƀha=new actionsLib.Action,this.ƀhd={duration:500,animation:P.lineer,...t},this.ƀo=new M(this.ƀj,"value",{duration:this.ƀhd.duration,animation:this.ƀhd.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀo.value.subscribe(()=>{this.ƀj.value!==1&&this.ƀj.value!==0&&this.ƀha.trigger(this.ƀj.value);}).attach(this);}setState(t,e){if(this.ƀjp===void 0)this.ƀjp=t,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp}),this.ƀha.trigger(this.ƀj.value);else if(e?.instant)this.ƀo.completeAnimation(),this.ƀn=I.Idle,this.ƀjp=t,this.ƀgp=void 0,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp}),this.ƀha.trigger(this.ƀj.value);else switch(this.ƀn){case I.Idle:t!==this.ƀjp&&(this.ƀn=I.Transitioning,this.ƀgp=t,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp}),this.ƀha.trigger(this.ƀj.value),this.ƀo.animate({value:1}).tap(()=>this.ƀgt()).attach(this));break;case I.Transitioning:t!==this.ƀgp&&(t===this.ƀjp?(this.ƀn=I.Reverting,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀhd.duration}).tap(()=>this.ƀgt()).attach(this)):this.ƀia=t);break;case I.Reverting:t!==this.ƀjp&&(t===this.ƀgp?(this.ƀn=I.Transitioning,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀhd.duration}).tap(()=>this.ƀgt()).attach(this)):this.ƀia=t);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀgt(){switch(this.ƀn){case I.Transitioning:this.ƀj.value===1&&(this.ƀj.value=0,this.ƀia!==void 0?(this.ƀn=I.Transitioning,this.ƀjp=this.ƀgp,this.ƀgp=this.ƀia,this.ƀia=void 0,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp}),this.ƀo.animate({value:1}).tap(()=>this.ƀgt()).attach(this)):(this.ƀn=I.Idle,this.ƀjp=this.ƀgp,this.ƀgp=void 0,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp})),this.ƀha.trigger(this.ƀj.value));break;case I.Reverting:if(this.ƀjp===void 0)throw new Error("StateAnimation: state must be defined when reverting!");this.ƀj.value===0&&(this.ƀia!==void 0?(this.ƀn=I.Transitioning,this.ƀgp=this.ƀia,this.ƀia=void 0,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp}),this.ƀo.animate({value:1}).tap(()=>this.ƀgt()).attach(this)):(this.ƀn=I.Idle,this.ƀgp=void 0,this.ƀj.value=0,this.ƀgy.trigger({state:this.ƀjp,nextState:this.ƀgp})),this.ƀha.trigger(this.ƀj.value));break;case I.Idle:break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}onStateChange(t){return this.ƀgy.subscribe(e=>t(e.state,e.nextState)).attach(this),this}onValueChange(t){return this.ƀha.subscribe(e=>t(e)).attach(this),this}};var w;(function(s){s[s.Hidden=1]="Hidden",s[s.Visible=2]="Visible",s[s.Appearing=3]="Appearing",s[s.Disappearing=4]="Disappearing",s[s.DisappearToChange=5]="DisappearToChange";})(w||(w={}));var xe=class extends actionsLib.Attachable{static{h(this,"FadeInStateAnimation");}get currentState(){return {value:this.ƀj.value,state:this.ƀjp,queuedState:this.ƀia,animationState:this.ƀn}}constructor(t){super(),this.ƀj={value:0},this.ƀn=w.Hidden,this.ƀgy=new actionsLib.Action,this.ƀha=new actionsLib.Action,this.ƀhd={duration:500,animation:P.lineer,...t},this.ƀj.value=0,this.ƀo=new M(this.ƀj,"value",{duration:this.ƀhd.duration,animation:this.ƀhd.animation,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀo.value.subscribe(()=>{this.ƀj.value!==1&&this.ƀj.value!==0&&this.ƀha.trigger(this.ƀj.value);}).attach(this);}setState(t,e){if(e?.instant){this.ƀo.completeAnimation(),this.ƀn=t!==void 0?w.Visible:w.Hidden,this.ƀia=void 0;let i=t!==void 0?1:0,r=this.ƀjp!==t;r&&(this.ƀjp=t,this.ƀgy.trigger(this.ƀjp)),(r||this.ƀj.value!==i)&&(this.ƀj.value=i,this.ƀha.trigger(this.ƀj.value));}else switch(this.ƀn){case w.Hidden:t!==void 0&&(this.ƀn=w.Appearing,this.ƀia=void 0,this.ƀjp=t,this.ƀgy.trigger(this.ƀjp),this.ƀo.animate({value:1}).tap(()=>this.ƀgt()).attach(this));break;case w.Visible:t===void 0?(this.ƀn=w.Disappearing,this.ƀia=void 0,this.ƀo.animate({value:0}).tap(()=>this.ƀgt()).attach(this)):t!==this.ƀjp&&(this.ƀn=w.DisappearToChange,this.ƀia=t,this.ƀo.animate({value:0}).tap(()=>this.ƀgt()).attach(this));break;case w.Appearing:t===void 0?(this.ƀn=w.Disappearing,this.ƀia=void 0,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀhd.duration}).tap(()=>this.ƀgt()).attach(this)):t!==this.ƀjp&&(this.ƀj.value>0?(this.ƀn=w.DisappearToChange,this.ƀia=t,this.ƀo.animate({value:0},{duration:this.ƀj.value*this.ƀhd.duration}).tap(()=>this.ƀgt()).attach(this)):(this.ƀia=void 0,this.ƀjp=t,this.ƀgy.trigger(this.ƀjp)));break;case w.Disappearing:t===this.ƀjp?(this.ƀn=w.Appearing,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀhd.duration}).tap(()=>this.ƀgt()).attach(this)):t!==void 0&&(this.ƀn=w.DisappearToChange,this.ƀia=t);break;case w.DisappearToChange:t===void 0?(this.ƀn=w.Disappearing,this.ƀia=void 0):t===this.ƀjp?(this.ƀn=w.Appearing,this.ƀia=void 0,this.ƀo.animate({value:1},{duration:(1-this.ƀj.value)*this.ƀhd.duration}).tap(()=>this.ƀgt()).attach(this)):t!==this.ƀia&&(this.ƀia=t);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀgt(){switch(this.ƀn){case w.Appearing:this.ƀj.value===1&&(this.ƀn=w.Visible,this.ƀha.trigger(this.ƀj.value));break;case w.Disappearing:if(this.ƀia!==void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearing should not have a queued value");this.ƀj.value===0&&(this.ƀn=w.Hidden,this.ƀjp=void 0,this.ƀgy.trigger(this.ƀjp),this.ƀha.trigger(this.ƀj.value));break;case w.DisappearToChange:if(this.ƀia===void 0)throw new Error("FadeInStateAnimation: Unexpected state, disappearToChange should always have a queued value");this.ƀj.value===0&&(this.ƀn=w.Appearing,this.ƀjp=this.ƀia,this.ƀia=void 0,this.ƀgy.trigger(this.ƀjp),this.ƀha.trigger(this.ƀj.value),this.ƀo.animate({value:1}).tap(()=>this.ƀgt()).attach(this));break;case w.Hidden:case w.Visible:return;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}onStateChange(t){return this.ƀgy.subscribe(e=>t(e)).attach(this),this}onValueChange(t){return this.ƀha.subscribe(e=>t(e)).attach(this),this}};var Bi=class extends f{static{h(this,"FadeInContent");}constructor(t,e){super(),this.ƀbu=t;let i={duration:200,animation:P.easeInOut,...e};this.alpha=0,this.ƀjq=new xe(i).onStateChange(r=>{this.ƀbh?.destroy(),this.ƀbh=void 0,r!==void 0&&(this.ƀbh=new f().displayParent(this).attach(this),this.ƀbu({state:r,container:this.ƀbh}));}).onValueChange(r=>{this.alpha=r;}).attach(this);}setState(t,e){return this.ƀjq.setState(t,e),this}};var be=class s extends L__namespace.Filter{static{h(this,"ExpandWithColorFilter");}static ƀei(){return `
33
33
  attribute vec2 aVertexPosition;
34
34
  attribute vec2 aTextureCoord;
35
35
 
@@ -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(s.ƀeh(),s.ƀdq(t*I)),this.ƀcy=t,this.resolution=I,this.ƀcy=t*I,this.ƀcy<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcy>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀcy)||(this.ƀcy=Math.floor(this.ƀcy));let i=helpersLib.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcy*this.ƀcy,this.padding=this.ƀcy;}apply(t,e,i,r){this.uniforms.pixelSize=new Float32Array([1/(e.width*I),1/(e.height*I)]),t.applyFilter(this,e,i,r);}};var Pe=class extends V__namespace.Filter{constructor(t){super(),this.resolution=I;let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Screen,...t};this.ƀcz=new Se(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀai=new Ct(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀai.blendMode=V__namespace.BLEND_MODES.SCREEN;}apply(t,e,i,r){let o=t.getFilterTexture();this.ƀcz.apply(t,e,o,V__namespace.CLEAR_MODES.CLEAR),this.ƀai.apply(t,o,i,r),t.returnFilterTexture(o);}};var Jt=class s{static{this.ƀek=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbd(e),o=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀds(t.texture,o,r.expand,r.color,i),a=new V__namespace.Sprite(n);return this.ƀiw(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(o.x,o.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀds(t,e,i,r,o){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(o){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(s.ƀek.has(n))return s.ƀek.get(n);{let a=this.ƀdt(t,e,i,r);return s.ƀek.set(n,a),a}}else return this.ƀdt(t,e,i,r)}static ƀdt(t,e,i,r){let o=new V__namespace.Sprite(t);this.ƀdb(o,Math.max(e.x,e.y)+i),o.filters=[new Pe({blurRadius:e,expand:i,color:r})];let n=y.instance.renderer.generateTexture(o);return n.id=A.insertAsset(n),o.destroy(),n}static ƀiw(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,o=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,o);}static ƀdb(t,e){if(t.isSprite){let o=new V__namespace.Graphics;t.addChild(o);}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 ƀbd(t){let e={glowAlpha:1,blurRadius:5,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Add};return t&&(e={...e,...t}),e}};B.onHardReset.subscribe(()=>{Jt.ƀek.clear();}).attachToRoot();var J=class s extends f{static createByName(t){let e=y.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new s(e)}static createSnapshotSprite(t){let e=t.pixiContainer,i=e.parent;i&&i.removeChild(e);let r=y.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:A.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,boundingShapes:void 0,destroyAssetOnDestroy:true};return new s(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀjw=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjf=t,this.pixiSprite=new V__namespace.Sprite(A.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.ƀgc?.destroy(),this.ƀak?.destroy(),this.ƀjf.destroyAssetOnDestroy&&(A.destroyAsset(this.ƀjf.id),this.ƀhr&&A.destroyAsset(this.ƀhr.texture.id)),this.ƀhr&&!this.ƀhr.destroyed&&this.ƀhr.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀjw}set textureScale(t){this.ƀjw=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.ƀjf.boundingShapes&&!this.pixiContainer.hitArea&&(this.pixiContainer.hitArea=new ge(this.ƀjf.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀjf.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.ƀhr)return this.ƀhr.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀhr)this.ƀhr.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀjf.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀhr&&(this.ƀhr.destroy(),this.ƀhr=void 0),t&&(this.ƀhr=Jt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjf.destroyAssetOnDestroy),this.ƀhr.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀhr.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.pixiContainer.addChild(this.ƀhr)),this}showBoundingShape(t){return t?this.ƀak||(this.ƀak=this.ƀbt().setAlpha(.3).setTint({r:0,g:0,b:200}).displayParent(this)):this.ƀak&&(this.ƀak.destroy(),this.ƀak=void 0),this}getBoundingMask(){if(!this.ƀgc){if(!this.ƀjf.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀgc=this.ƀbt(),this.ƀgc.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀgc.pixiSprite.renderable=false,this.ƀgc.displayParent(this);}return this.ƀgc}ƀbt(){if(!this.ƀjf.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return C.createPolygon(this.ƀjf.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=y.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 oi=class{start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},mt=class s extends f{static{this.ƀcr=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 o=new f;r===exports.ScrollDirection.Horizontal?this.ƀbz(e,i,o):this.ƀcg(e,i,o),this.ƀgc=J.createSnapshotSprite(o).attach(this),o.destroy(),t.setMask(this.ƀgc);}ƀcg(t,e,i){e>0&&this.ƀbw(new helpersLib.Vector(t.x,e)).displayParent(i).attach(i),C.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.ƀbw(new helpersLib.Vector(t.x,e)).setPosition(new helpersLib.Vector(t.x,t.y),{round:false}).setRotation(helpersLib.Radian.get180).displayParent(i).attach(i);}ƀbz(t,e,i){e>0&&this.ƀbw(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(0,t.y),{round:false}).setRotation(helpersLib.Radian.get270).displayParent(i).attach(i),C.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.ƀbw(new helpersLib.Vector(t.y,e)).setPosition(new helpersLib.Vector(t.x,0),{round:false}).setRotation(helpersLib.Radian.get90).displayParent(i).attach(i);}ƀbw(t){let i={id:this.ƀbx(t.y),scale:1,size:t,anchor:{x:0,y:0},boundingShapes:void 0};return new J(i,{textureSize:t,ignoreAnchor:true})}ƀbx(t){let e=JSON.stringify({type:"gradient",length:t}),i=s.ƀcr.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let o=r.getContext("2d");if(o){let n=new oi;helpersLib.ArrayHelper.createIntegerArray(t).forEach(h=>{let l=`rgba(255, 255, 255, ${n.multiplierFunction(h/t)})`;o.fillStyle=l,o.fillRect(0,h,1,1);});let a=V__namespace.Texture.from(r);i=A.insertAsset(a),s.ƀcr.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(s){s[s.Appear=1]="Appear",s[s.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var P;(function(s){s[s.Idle=1]="Idle",s[s.TransitionForward=2]="TransitionForward",s[s.TransitionBackward=3]="TransitionBackward",s[s.Reverting=4]="Reverting";})(P||(P={}));var Ce=class extends actionsLib.Attachable{constructor(t){super(),this.ƀn=P.Idle,this.ƀgt=new actionsLib.Action,this.ƀgv=new actionsLib.Action,this.ƀha={duration:500,animation:S.easeInOutCubic,...t},this.ƀjl=new xe({duration:this.ƀha.duration,animation:this.ƀha.animation}).onStateChange((e,i)=>this.ƀep(e,i)).onValueChange(e=>this.ƀeq(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀff===void 0?(this.ƀff=t,this.ƀgt.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀjl.setState(t,e)):this.ƀff!==t?this.ƀgk!==t?this.ƀn===P.Idle?(this.ƀn=t>this.ƀff?P.TransitionForward:P.TransitionBackward,this.ƀgk=t,this.ƀgt.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀgk}),this.ƀjl.setState(t,e)):this.ƀjl.setState(t,e):this.ƀn===P.Reverting&&this.ƀgk===t&&(this.ƀn=t>this.ƀff?P.TransitionForward:P.TransitionBackward,this.ƀjl.setState(t,e)):(this.ƀn===P.TransitionForward||this.ƀn===P.TransitionBackward)&&(this.ƀn=P.Reverting,this.ƀjl.setState(t,e));}ƀep(t,e){switch(this.ƀff!==void 0&&this.ƀff!==t&&this.ƀff!==e&&this.ƀgt.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀff}),this.ƀgk!==void 0&&this.ƀgk!==t&&this.ƀgk!==e&&this.ƀgt.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgk}),e!==void 0&&e!==this.ƀff&&e!==this.ƀgk&&this.ƀgt.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀn){case P.Idle:break;case P.TransitionForward:case P.TransitionBackward:e===void 0?(this.ƀn=P.Idle,this.ƀff=this.ƀgk,this.ƀgk=void 0):this.ƀff!==t&&this.ƀen(t,e);break;case P.Reverting:e===void 0?(this.ƀn=P.Idle,this.ƀgk=void 0):this.ƀff!==e&&this.ƀen(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀeq(t){let e=1;(this.ƀn===P.TransitionBackward||this.ƀn===P.Reverting&&this.ƀff!==void 0&&this.ƀgk!==void 0&&this.ƀff>this.ƀgk)&&(e=-1),(this.ƀn===P.Idle||t!==0)&&this.ƀgv.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀff}),this.ƀgk!==void 0&&this.ƀgv.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgk});}ƀen(t,e){this.ƀff=t,this.ƀgk=e,this.ƀgv.trigger({value:0,index:this.ƀff}),this.ƀn=this.ƀff<this.ƀgk?P.TransitionForward:P.TransitionBackward;}onStateChange(t){return this.ƀgt.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀgv.subscribe(e=>t(e.value,e.index)).attach(this),this}};exports.ScrollDirection=void 0;(function(s){s[s.Horizontal=1]="Horizontal",s[s.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var si=class extends f{constructor(t,e){super(),this.ƀbv=t,this.ƀcm="x",this.ƀbk=new Map,this.ƀha={duration:300,animation:S.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀha.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀha.size.x+this.ƀha.margin*2,this.ƀha.size.y):new helpersLib.Vector(this.ƀha.size.x,this.ƀha.size.y+this.ƀha.margin*2),r=new f().setPosition(this.ƀha.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀha.margin,0):new helpersLib.Vector(0,-this.ƀha.margin),{round:false}).displayParent(this).attach(this);this.ƀca(i,this.ƀha.margin,this.ƀha.direction,r),this.ƀcm=this.ƀha.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀjl=new Ce({duration:this.ƀha.duration,animation:this.ƀha.animation}).onStateChange((o,n)=>{if(o===exports.SlideStateAnimationState.Appear){let a=new f().displayParent(this).attach(this);this.ƀbk.set(n,a),this.ƀbv({index:n,container:a});}else {let a=this.ƀbk.get(n);a&&(a.destroy(),this.ƀbk.delete(n));}}).onValueChange((o,n)=>{let a=this.ƀbk.get(n);if(a){let h={x:0,y:0};h[this.ƀcm]=i[this.ƀcm]*o+this.ƀha.margin,a.setPosition(helpersLib.Vector.fromVec2(h),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjl.setIndex(t,e),this}ƀca(t,e,i,r){new mt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},zi=class extends si{constructor(t,e,i){super(r=>{let o=this.indexToItem.get(r.index);if(o)e({index:r.index,item:o,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,o)=>{this.itemToIndex.set(r,o),this.indexToItem.set(o,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 yt=class{constructor(){this.ƀki=new Map;}add(t){let e=this.ƀki.get(t.x);e||(e=new Set,this.ƀki.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀki.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀki.get(t.x);return e?e.delete(t.y):false}};var ni=class{static adjustMultiplier(t,e){return Math.pow(t,e)}};var M=class{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 Xt=class{static findByConvertingGridSpace(t,e,i){let r=new helpersLib.Vector(Math.ceil(e.size.x/i)-1,Math.ceil(e.size.y/i)-1),o=M.areaToGridArea(e,i);if(this.ƀat(t,o))return helpersLib.Vector.zero;let n=t.movePositionInsideGrid(o.topLeft),a=helpersLib.Vector.fromTo(o.topLeft,n),h=this.find(t,n,r);if(h){let l=h.add(a),c=helpersLib.Vector.fromTo(o.topLeft.multiplyNumber(i),e.topLeft);return new helpersLib.Vector(l.x*i+((r.x+1)*i-e.size.x)/2-c.x,l.y*i+((r.y+1)*i-e.size.y)/2-c.y)}}static find(t,e,i){let r=new yt,o=new helpersLib.Queue(e);for(;o.notEmpty;){let n=o.pop();r.add(n);let a=new helpersLib.Rectangle(n,n.add(i));if(this.ƀat(t,a))return helpersLib.Vector.fromTo(e,n);t.getNeighborPositions(n,helpersLib.GridNeighborType.Ortogonal).forEach(h=>{r.has(h)||o.add(h);});}}static ƀat(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 Te=class{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)}},ai=class{constructor(t,e){this.ƀem=t,this.ƀji=e,this.ƀgy=new helpersLib.BinaryHeap("min"),this.ƀax=[],this.ƀgm=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new Te(this.ƀji,0,Number.MAX_SAFE_INTEGER);this.ƀgy.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀgy.size>0}getNeighbors(t,e){return this.ƀem.getNeighborPositions(t.position,e).filter(i=>this.ƀem.get(i)).map(i=>this.ƀgm.get(i)||this.ƀcb(i))}popLowestPathCostNode(){let t=this.ƀgy.pop();return this.ƀgy.delete(t),t.closed=true,this.ƀax.push(t),t}changeNodeCost(t,e,i,r){this.ƀgy.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀgy.add(t.pathLength,t);}getBestClosedNode(){return this.ƀax.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀcb(t){let e=new Te(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgm.set(t,e),this.ƀgy.add(e.pathLength,e),e}},Kt=class{static findPath(t,e,i,r){let o=new ai(t,e);for(;o.hasOpenNodes;){let n=o.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=o.getNeighbors(n,r);for(let h of a)if(!h.closed){let l=n.distanceFromStart+n.getDistance(h.position);l<h.distanceFromStart&&o.changeNodeCost(h,l,i,n);}}return o.getBestClosedNode().createSolutionPath(false)}};var Zt=class{constructor(t,e){this.ƀjq=t,this.ƀx=e,this.ƀet=this.ƀdv(this.ƀx.size),this.ƀkq=new helpersLib.Grid({size:this.ƀx.size,defaultValue:this.ƀet}),this.ƀcn=new helpersLib.Grid({size:this.ƀx.size,defaultValue:void 0});let i=new yt,r=new helpersLib.Queue;for(this.ƀdk(this.ƀx.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀkq.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀkq.getOrFail(n);this.ƀea(n,this.ƀx).forEach(h=>{if(!i.has(h.position)){let l=this.ƀkq.getOrFail(h.position),c=a+h.distance;this.ƀx.getOrFail(h.position)&&c<l&&(this.ƀkq.set(h.position,c),r.add(h.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjq)){if(t=this.ƀkq.movePositionInsideGrid(t),this.ƀcn.has(t))return this.ƀcn.get(t);{let e=this.ƀea(t,this.ƀx),i;return this.ƀkq.getOrFail(t)>=this.ƀet?e.some(o=>this.ƀx.get(o.position))&&(e.some(n=>!this.ƀx.get(n.position))?i=this.ƀdp(e):i=this.ƀdl(t,e)):i=this.ƀdl(t,e),this.ƀcn.set(t,i),i}}}ƀdp(t){let e=t.filter(i=>this.ƀx.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdl(t,e){let i=e.filter(r=>this.ƀkq.getOrFail(r.position)<this.ƀet).reduce((r,o)=>{let n=this.ƀkq.getOrFail(o.position)+o.distance;return n<r.bestWeight?(r.bestDirections=[o.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(o.direction),r},{bestDirections:[],bestWeight:this.ƀet}).bestDirections;return this.ƀef(i,t)}ƀef(t,e){if(t.length>0){let i=t.reduce((r,o)=>r.add(o),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfk(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfk(t,e){let i=t.add(this.ƀkj(e));return this.ƀx.isPointWithinBounds(i)&&this.ƀx.getOrFail(i)}ƀea(t,e){return this.ƀkq.getNeighborDirections(t,helpersLib.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdk(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}ƀkj(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀdv(t){return (t.x+t.y)*20}};var lo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},F=class extends ft{constructor(){super(...arguments),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.offset=new actionsLib.Variable(helpersLib.Vector.zero),this.targetPosition=new actionsLib.Variable(void 0),this.focusingNewTargetInfo=new actionsLib.Variable(void 0);}};F=lo([pt()],F);var co=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},po=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},It=class extends Ht{constructor(t){super(),this.ƀcw=t,this.ƀij=new f().setAlpha(0).displayParent(y.instance.stage).attach(this),this.ƀae=C.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(y.instance.stage).attach(this),this.ƀac=new f().displayParent(this.ƀij).attach(this),this.ƀaq=new f().displayParent(this.ƀij).attach(this),this.ƀdg=new f().setSortableChildren(true).displayParent(this.ƀij).attach(this),this.ƀap=new f().setSortableChildren(true).displayParent(this.ƀaq).attach(this),this.ƀdf=new f().setSortableChildren(true).setZIndex(20).displayParent(this.ƀap).attach(this),this.ƀga=new f().setSortableChildren(true).setZIndex(10).displayParent(this.ƀap).attach(this),this.ƀab=new f().setZIndex(0).displayParent(this.ƀap).attach(this),this.ƀh=new O(this.ƀij,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀaf=new O(this.ƀae,"alpha",{duration:500,animation:S.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),y.instance.screenSize.subscribe(e=>{this.ƀae.aspectRatio=e.x/e.y,this.ƀae.scale=Math.max(e.x,e.y),this.ƀae.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.zero});}).attach(this),y.instance.setScreenPositionToStagePositionFunction(e=>new helpersLib.Vector(e.x-this.ƀap.position.x-this.ƀaq.position.x,e.y-this.ƀap.position.y-this.ƀaq.position.y)),this.ƀcw.position.subscribe(e=>{this.ƀap.position=this.ƀbq(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀaq.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),y.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀac.id,background:this.ƀab.id,main:this.ƀga.id,foreground:this.ƀdf.id,foregroundScreen:this.ƀdg.id}}appear(t,e){switch(e){case "alpha":return this.ƀaf.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.ƀaf.set({alpha:t?1:0}),this.ƀaf.animate({alpha:t?0:1}).chain(this);case "instant":return this.ƀh.set({alpha:t?1:0}),this.ƀaf.set({alpha:t?0:1}),actionsLib.SingleEvent.instant();default:{throw new Error('Switch ended with value "never".')}}}ƀbq(t){return helpersLib.Vector.fromTo(t,y.instance.getScreenSizeCenter())}};It=co([Xe({entity:F}),po("design:paramtypes",[F])],It);var mo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},go=1500,Re=class{createCamera(){return new F().attachToRoot()}getCameraPosition(){let t=F.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=F.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=F.getInstanceOrFail();e.focusingNewTargetInfo.value={time:y.time,duration:t?.duration??go,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=F.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfm(i,r,t):i.position.value=r);}ƀfm(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbc(t,e);else {let o=(i-r.time)/r.duration;if(o>=1)this.ƀbc(t,e);else {let n;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=k.easeInOut(o):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=k.easeOut(o):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;}}}ƀbc(t,e){t.position.value=e,t.focusingNewTargetInfo.value=void 0;}};Re=mo([p()],Re);var yo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},wo=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},ci=class{constructor(t){this.ƀar=t;}createCamera(){return this.ƀar.createCamera().id}update(t,e){this.ƀar.update(t,e);}setPosition(t){this.ƀar.setPosition(t);}setTransition(t){this.ƀar.setTransition(t);}getCameraPosition(){return this.ƀar.getCameraPosition()}};ci=yo([Q({controllerLink:ut}),wo("design:paramtypes",[Re])],ci);var xo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},pi=class{getLayers(){let t=F.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e){let i=F.getInstanceOrFail().id;return It.getInstanceOrFail(i).appear(t,e)}};pi=xo([Q({controllerLink:we})],pi);var qt=class{get position(){return this.ƀao.getCameraPosition()}constructor(){this.ƀao=b.get(exports.CameraGateway),this.ƀas=b.get(zt),this.ƀao.createCamera(),this.layers=this.ƀas.getLayers();}setPosition(t){this.ƀao.setPosition(t);}setTransition(t){this.ƀao.setTransition(t);}appear(t,e="alpha"){return this.ƀas.appear(t,e)}};var y=class s{static get instance(){return this.ƀfi}static{this.pause=actionsLib.Reducer.createOr();}static get camera(){return this.ƀan}static get time(){return g.ƀjx}static get setupOptions(){return this.ƀiy}getScreenSize(){return this.ƀio.value}getScreenSizeCenter(){return this.ƀip.value}constructor(t){if(this.ƀio=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀio.notifier,this.ƀip=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀip.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),s.ƀfi)throw new Error("There can be only one Game instance!");this.ƀbg={screenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbg.devMode||false,this.ƀhq=new V__namespace.Application({backgroundColor:this.ƀbg.backgroundColor,autoStart:false,antialias:this.ƀbg.antialias,resolution:this.ƀbg.resolution,width:this.ƀbg.screenResolution?.width,height:this.ƀbg.screenResolution?.height,resizeTo:this.ƀbg.screenResolution===void 0?window:void 0});}async setup(t){s.ƀiy=t,document.body.appendChild(this.ƀhq.view),await Promise.all([A.loadGameAssets(t.assetDefinitions)]),s.ƀfi=this,this.stage=new f().attachToRoot(),this.stage.pixiContainer=this.ƀhq.stage,this.renderer=this.ƀhq.renderer,this.ƀix(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀhq,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀix());}),s.ƀan=new qt,this.ƀhq.start(),this.ƀhq.ticker.add(()=>{g.triggerUpdateTick(this.ƀhq.ticker.deltaMS);});}setResolution(t){this.ƀhq.renderer.resolution!==t&&(this.ƀhq.renderer.resolution=t,this.ƀhq.renderer.resize(this.ƀhq.screen.width,this.ƀhq.screen.height));}screenPositonToStagePosition(t){let e=$t.includeScaleInScreenPosition(t,s.instance.stage.scale,s.instance.getScreenSizeCenter());return this.ƀin(e)}setScreenPositionToStagePositionFunction(t){this.ƀin=t;}resetScreenPositionToStagePositionFunction(){this.ƀin=t=>t;}destroyAsset(t){A.destroyAsset(t);}ƀix(){let t=new helpersLib.Vector(this.ƀhq.screen.width,this.ƀhq.screen.height);this.ƀio.value=t,this.ƀip.value=t.multiplyNumber(.5).round();}};var Ie=class{static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),o=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let h=t.add(o.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:h,to:h.add(o.normalize(n))}),a;let l=n-i.dashGap,c=i.dashLength+i.dashGap,u=Math.floor(l/c),m=l-c*u;u>=1&&m<i.dashLength&&(m+=c,u--);let T=o.normalize(m/2),vt=o.normalize(i.dashGap);if(a.push({from:h,to:h.add(T)}),h=h.add(T),u>0){let se=o.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(u).forEach(()=>{h=h.add(vt),a.push({from:h,to:h.add(se)}),h=h.add(se);});}return h=h.add(vt),a.push({from:h,to:h.add(T)}),a}};var C=class s extends f{static{this.ƀcr=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(o=>{i.drawPolygon(o.map(n=>new V__namespace.Point(n.x,n.y)));}),i.endFill(),new s(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},o=new V__namespace.Graphics;return o.lineStyle(r.width,r.color),Ie.getLines(t,e,r).forEach(a=>{o.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new s(o,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 s(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 s(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 s(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 s(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 s(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(o=>{i.drawPolygon(o.map(n=>new V__namespace.Point(n.x,n.y)));}),i.endFill(),new s(i,r)}static createRegularPolygon(t,e,i){let r=new V__namespace.Graphics,o=new helpersLib.Radian(helpersLib.PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let h=o.multiply(n).vector.normalize(e),l=e+h.x,c=e+h.y;r.lineTo(l,c);}return r.endFill(),new s(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.pixiContainer.addChild(t),this.pixiGraphics=t,this.ƀam=e;}destroy(){this.destroyed||(super.destroy(),!this.pixiGraphics.destroyed&&this.pixiGraphics.destroy());}toSprite(t){let e={cacheName:this.ƀam,cache:false,...t},i=this.ƀee(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},boundingShapes:void 0,destroyAssetOnDestroy:!e.cache},o=new J(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),o}ƀee(t,e){if(e){let i=s.ƀcr.get(t);return i||(i=this.ƀcf(),s.ƀcr.set(t,i)),i}else return this.ƀcf()}ƀcf(){let t=y.instance.renderer.generateTexture(this.pixiGraphics);t.id=A.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var ui=class extends f{constructor(t){super(),this.ƀhs=new V__namespace.Graphics,this.ƀhs.beginFill(0,1e-9),this.ƀhs.drawRect(0,0,t.x,t.y),this.ƀhs.endFill(),this.pixiContainer.addChild(this.ƀhs);}destroy(){this.destroyed||(super.destroy(),this.ƀhs.destroy());}};var At=class{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 o={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};r={dropShadow:true,dropShadowBlur:o.blur,dropShadowAngle:o.angle.value,dropShadowDistance:o.distance,dropShadowColor:helpersLib.ColorHelper.rgbToHex(o.color),dropShadowAlpha:o.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 Oe=class{static process(t,e){let i=new Set(e.styles?Object.keys(e.styles):[]),r=scriptEngineLib.RichTextSeparator.process(t,i),o=this.ƀfe(r,e),n=this.ƀs(o);return this.ƀjd(n)}static ƀfe(t,e){let i=new Map,r=new Map,o=(a,h)=>{if(r.has(h))return r.get(h);let l=At.getPixiTextStyle(a);return r.set(h,l),l};return t.map(a=>{let{style:h,cacheKey:l}=this.ƀdo(a.tags,e,i),c=o(h,l),u=V__namespace.TextMetrics.measureText(" ",new V__namespace.TextStyle(c),false);return {text:a.text,cacheKey:l,style:h,pixiStyle:c,spaceWidth:u.width}})}static ƀdo(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let o=this.ƀbb(t,e);return i.set(r,o),{style:o,cacheKey:r}}static ƀbb(t,e){let i={...e.default};for(let h of t)e.styles&&e.styles[h]&&(i={...i,...e.styles[h]});let{wordWrapWidth:r,align:o,dropShadow:n,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,o)=>{r.text.split(/\r?\n/).forEach((a,h)=>{h>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 ƀjd(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(o=>this.ƀje(o.text).map(a=>{let h=new V__namespace.TextStyle(o.pixiStyle),l=V__namespace.TextMetrics.measureText(a,h,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:o.cacheKey,style:o.style,pixiStyle:h,height:l.height,ascent:l.fontProperties.ascent,descent:l.fontProperties.descent,width:l.width,spaceWidth:o.spaceWidth}}}));e.push(r);}),e}static ƀje(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let o=0;o<t.length;o++){let n=t[o],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Me=class{get lineIsEmpty(){return this.ƀci.length===0}get remainingWidth(){return this.ƀks-this.ƀck}constructor(t,e){if(this.ƀks=t,this.ƀfu=[],this.ƀci=[],this.ƀck=0,this.ƀft=new helpersLib.Vector(0,0),this.ƀcj=0,this.ƀew=e?.horizontalAlignment??"left",this.ƀkk=e?.verticalAlignment??"bottom",e?.rectangleCutOption){if(e.rectangleCutOption.position.x<0||e.rectangleCutOption.position.x>=this.ƀks||e.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀcl={direction:e.rectangleCutOption.direction,rectangle:this.ƀbp(e.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀcj,t.y),i=this.ƀdw(this.ƀft.y,this.ƀft.y+e);return this.ƀck+t.x<=i}insertWord(t){let e=Math.max(this.ƀcj,t.style.height);if(this.ƀci.length===0){let i=this.ƀdx(this.ƀft.y,this.ƀft.y+e);this.ƀft=new helpersLib.Vector(i,this.ƀft.y),this.ƀck=this.ƀft.x;}this.ƀci.push({chunk:t,position:new helpersLib.Vector(this.ƀck,this.ƀft.y)}),this.ƀcj=e,this.ƀck+=t.style.width;}newLine(){let t=this.ƀft.y+this.ƀcj,e=this.ƀdx(t,t);this.ƀdd(),this.ƀft=new helpersLib.Vector(e,t),this.ƀck=this.ƀft.x,this.ƀcj=0;}print(){return this.ƀdd(),this.ƀfu}ƀdd(){this.ƀci.length>0&&(this.ƀfu.push(this.ƀg(this.ƀci)),this.ƀci=[]);}ƀg(t){return t=this.ƀkm(t),t=this.ƀey(t),t}ƀey(t){if(this.ƀew==="left")return t;let e=this.ƀft.y+this.ƀcj,i=this.ƀdx(this.ƀft.y,e),o=this.ƀdw(this.ƀft.y,e)-i,n=Math.min(o,t.reduce((h,l)=>h+l.chunk.style.width,0)),a;return this.ƀew==="center"?a=(o-n)/2:a=o-n,t.map(h=>(h={chunk:h.chunk,position:new helpersLib.Vector(h.position.x+a,h.position.y)},h))}ƀkm(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 o;switch(this.ƀkk){case "top":o=i-r.chunk.style.descent;break;case "center":o=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":o=e-r.chunk.style.ascent;break;default:{this.ƀkk;throw new Error(`Unexpected case! "${this.ƀkk}"`)}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+o)},r})}ƀdx(t,e){return this.ƀcl&&(this.ƀcl.direction==="topLeft"||this.ƀcl.direction==="bottomLeft")&&(this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(0,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(0,e),{includeEdges:false}))?this.ƀcl.rectangle.bottomRight.x:0}ƀdw(t,e){return this.ƀcl&&(this.ƀcl.direction==="topRight"||this.ƀcl.direction==="bottomRight")&&(this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(this.ƀks,t),{includeEdges:false})||this.ƀcl.rectangle.isPointInside(new helpersLib.Vector(this.ƀks,e),{includeEdges:false}))?this.ƀcl.rectangle.topLeft.x:this.ƀks}ƀbp(t){let e,i;switch(t.direction){case "topRight":e=new helpersLib.Vector(t.position.x,-1/0),i=new helpersLib.Vector(1/0,t.position.y);break;case "topLeft":e=new helpersLib.Vector(-1/0,-1/0),i=t.position;break;case "bottomRight":e=t.position,i=new helpersLib.Vector(1/0,1/0);break;case "bottomLeft":e=new helpersLib.Vector(-1/0,t.position.y),i=new helpersLib.Vector(t.position.x,1/0);break;default:{t.direction;throw new Error(`Unexpected case! "${t.direction}"`)}}return new helpersLib.Rectangle(e,i)}};var De=class{static wrapText(t,e){return t.forEach(i=>{i.forEach((r,o)=>{if(e.isSpaceAvailable(new helpersLib.Vector(r.style.width,r.style.height)))if(r.whitespace&&o===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.ƀkt(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀkt(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀkt(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 o=t.text.length-r-1;if(o>0){let n={text:" ".repeat(o),whitespace:true,style:{...t.style,width:o*t.style.spaceWidth}};e.insertWord(n);}}};var Be=class{static process(t){return t=this.ƀgg(t),t=this.ƀkc(t),this.ƀav(t)}static ƀgg(t){return t.map(e=>{let i=[],r,o=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,o=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;o=n.chunk.whitespace&&o,r={chunk:{text:a,whitespace:o,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀkc(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,o=i.chunk.text.trimEnd();r!==o.length?e.push({chunk:{text:o,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-o.length)*i.chunk.style.spaceWidth}},position:i.position}):e.push(i);}return e})}static ƀav(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 te=class{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=Oe.process(t,e),r=new Me(e.default.wordWrapWidth??1/0,{rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),o=De.wrapText(i,r);return Be.process(o)}};var Do=1,Qi=1/Do,ee=class extends f{get ƀju(){if(!this.ƀjv){let t=new V__namespace.TextStyle(this.ƀhu);this.ƀjv=V__namespace.TextMetrics.measureText(this.ƀjt,t);}return this.ƀjv}get ascent(){return this.ƀju.fontProperties.ascent}constructor(t,e){super(),this.ƀhu=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀht.destroyed&&this.ƀht.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀht.anchor.x,this.ƀht.anchor.y)}set anchor(t){this.ƀi=t,this.ƀht.anchor.set(t.x,t.y);}setText(t){return this.ƀjt!==t&&(this.ƀjt=t,this.ƀib()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀhu.fill!==e&&(this.ƀhu.fill=e,this.ƀib()),this}ƀib(){this.ƀht?.destroy(),this.ƀjo?.destroy(),this.ƀjo=void 0,this.ƀjv=void 0;let t=new V__namespace.TextStyle(this.ƀhu);this.ƀht=new V__namespace.Text(this.ƀjt,t),this.ƀie(),this.ƀi&&this.ƀht.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀht.scale.set(Qi,Qi),this.pixiContainer.addChild(this.ƀht),this.ƀhu.lineThrough&&(this.ƀjo=this.ƀe(this.ƀht,this.ƀhu.fill),this.pixiContainer.addChild(this.ƀjo));}ƀie(){let t=V__namespace.TextMetrics.measureText(this.ƀjt,new V__namespace.TextStyle({...this.ƀhu,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀht.calculateBounds=function(){this.updateText(true),this._bounds.clear();let e=-this.anchor.x*t.width,i=-this.anchor.y*t.height;this._bounds.addFrame(this.transform,e,i,e+t.width,i+t.height);};}ƀe(t,e){let i=V__namespace.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),o=r%2*.5,n=new V__namespace.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((h,l)=>{let c=V__namespace.TextMetrics.measureText(h,t.style),u=Math.round(a+(c.fontProperties.ascent-c.fontProperties.descent)*.6+c.fontProperties.descent)+o,m=0;t.style.align==="center"?m=0+(t.width-c.width)*.5:t.style.align==="right"&&(m=0+t.width-c.width),m=Math.floor(m),n.moveTo(Math.floor(m),u),n.lineTo(Math.floor(m+c.width),u),a+=c.lineHeight;}),n.endFill(),n}};var mi=class extends f{constructor(t,e){super(),te.process(t,e).forEach(r=>new ee(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var gi=class extends f{},yi=class extends f{constructor(t,e){super(),this.ƀbv=t,this.ƀco=new Map,this.ƀha={trackBy:(i,r)=>r,positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀco.keys()),i=0;t.forEach((r,o)=>{let n=this.ƀha.trackBy(r,o),a;this.ƀco.has(n)?(a=this.ƀco.get(n),e.delete(n),a.update(r)):(a=this.ƀbv(r).displayParent(this).attach(this),this.ƀco.set(n,a)),this.ƀha.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀha.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀha.positioning.spacing);}),e.forEach(r=>{this.ƀco.get(r).destroy(),this.ƀco.delete(r);});}};var Mt=class s extends f{static{this.ƀka=false;}static closeAll(){return s.ƀgz?s.ƀgz.close():actionsLib.SingleEvent.instant()}constructor(t,e){super(),this.ƀgs=new actionsLib.SingleAction,this.onOpen=this.ƀgs.notifier,this.ƀgn=new actionsLib.SingleAction,this.onClose=this.ƀgn.notifier;let i={closeOnBackgroundClick:true,appearAnimationDuration:150,darkeningAlpha:.3,...e};this.setZIndex(100).setAlpha(0),this.ƀo=new O(this,"alpha",{animation:S.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀaa=C.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.darkeningAlpha).setInteractive(true).displayParent(this).attach(this),this.ƀgf=J.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),y.instance.screenSize.subscribe(r=>{this.ƀaa.aspectRatio=r.x/r.y,this.ƀaa.scale=Math.max(r.x,r.y),this.ƀaa.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(r.multiplyNumber(.5));}).attach(this),s.ƀgz=this,this.onDestroy().tap(()=>{s.ƀgz=void 0;}).attachToRoot(),i.closeOnBackgroundClick&&this.ƀaa.on(exports.ContainerEventType.Click).filter(()=>!s.ƀka).tap(()=>this.ƀq(false)).take(1).attach(this),this.ƀq(true);}getBoundingMask(){return this.ƀgf.getBoundingMask()}close(){return this.ƀq(false)}ƀq(t){if(s.ƀka)throw new Error("WindowUI: cannot iterate while in transition");return s.ƀka=true,this.ƀo.animate({alpha:t?1:0}).chain(this).tap(()=>{s.ƀka=false,t?this.ƀgs.resolve():(this.ƀgn.resolve(),this.destroy());}).chainToRoot()}};var xi=class extends ft{constructor(t,e){super(),this.ƀgq=new actionsLib.SingleAction,this.onCreate=this.ƀgq.notifier,this.ƀgs=new actionsLib.SingleAction,this.onOpen=this.ƀgs.notifier,this.ƀgn=new actionsLib.SingleAction,this.onClose=this.ƀgn.notifier,Mt.closeAll().tap(()=>{if(!St.getActiveScene())throw new Error("WindowEntity: constructor is called when there is no active scene!");y.pause.effect(true).attach(this),this.ƀgf=new Mt(t,e).displayParent(y.camera.layers.foregroundScreen).attach(this),this.ƀgq.resolve(this.ƀgf),this.ƀgf.onOpen.subscribe(()=>this.ƀgs.resolve()).attach(this),this.ƀgf.onClose.subscribe(()=>{this.destroy(),this.ƀgn.resolve();}).attach(this);}).attach(this);}getMenuEvents(){return {onOpen:this.onOpen.toSingleEvent().destroyIfNotAttached(),onClose:this.onClose.toSingleEvent().destroyIfNotAttached()}}close(){if(this.ƀgf){let t=this.onClose.toSingleEvent().destroyIfNotAttached();return this.ƀgf.close(),t}else return this.onCreate.asyncMap(()=>this.close()).chain(this)}};var _o=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Fo=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};exports.MouseService=class xt{get initialMouseMoveHappened(){return this.ƀfg.value}getStagePosition(){return this.ƀjg.value}getScreenPosition(){return this.ƀim.value}getMainButtonState(){return this.ƀfz.value}getSecondaryButtonState(){return this.ƀis.value}constructor(){this.ƀfg=new actionsLib.Variable(false),this.onInitialMouseMove=this.ƀfg.notifier,this.ƀjg=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀjg.notifier,this.ƀim=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀim.notifier,this.ƀfz=new actionsLib.Variable(false),this.mainButtonState=this.ƀfz.notifier,this.ƀis=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀis.notifier,this.ƀjh(),window.addEventListener("mousedown",t=>{t.button===0?this.ƀfz.value=true:t.button===2&&(this.ƀis.value=true);}),window.addEventListener("mouseup",t=>{t.button===0?this.ƀfz.value=false:t.button===2&&(this.ƀis.value=false);}),window.addEventListener("blur",()=>{this.ƀfz.value=false,this.ƀis.value=false;});}ƀjh(){let t=helpersLib.Vector.zero;window.addEventListener("mousemove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfg.value=true;}),g.beforeSceneUpdateAction.subscribe(()=>{this.ƀim.value=t;}).attachToRoot(),g.afterSceneUpdateAction.subscribe(()=>{let e=y.instance.screenPositonToStagePosition(this.ƀim.value);e.isEqual(this.ƀjg.value)?y.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀim.value.x,clientY:this.ƀim.value.y,pointerType:"mouse"})):this.ƀjg.value=e;}).attachToRoot();}};exports.MouseService=_o([p(),Fo("design:paramtypes",[])],exports.MouseService);var re=class extends f{constructor(t){super(),this.ƀgw=new actionsLib.Action,this.onWheel=this.ƀgw.notifier,this.ƀer=(e=>{let i=b.get(exports.MouseService).getScreenPosition(),r=this.ƀkr.getBounds();i.x>=r.x&&i.x<=r.x+r.width&&i.y>=r.y&&i.y<=r.y+r.height&&this.ƀgw.trigger(e.deltaY);}).bind(this),this.ƀkr=new V__namespace.Graphics,this.ƀkr.beginFill(0,1e-9),this.ƀkr.drawRect(0,0,t.x,t.y),this.ƀkr.endFill(),this.pixiContainer.addChild(this.ƀkr),window.addEventListener("wheel",this.ƀer);}destroy(){this.destroyed||(super.destroy(),this.ƀkr.destroy(),window.removeEventListener("wheel",this.ƀer));}};var No=.65,jo=.01,Fe=class{get scrollHeight(){return this.ƀiq}get contentSize(){return this.ƀbi.size.ceil()}constructor(t,e,i,r){this.ƀbi=t,this.ƀv=e,this.ƀhd=i,this.ƀjc=r,this.ƀfh=false,this.ƀiq=e-i*2,this.ƀbi.y=i,this.ƀjp=i;}onWheel(t){this.setTarget(this.ƀjp-t*No);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀjp=helpersLib.NumberHelper.clamp(t,this.ƀv-this.ƀhd-this.contentSize.y,this.ƀhd);}jumpToTarget(){this.ƀbi.y=this.ƀjp;}update(t){let e=this.contentSize;if(e.y<=this.ƀiq){switch(this.ƀjc){case "start":this.ƀjp=this.ƀhd;break;case "center":this.ƀjp=(this.ƀv-e.y)*.5;break;case "end":this.ƀjp=this.ƀv-e.y-this.ƀhd;break;default:{this.ƀjc;throw new Error(`Unexpected case! "${this.ƀjc}"`)}}this.ƀfh||(this.ƀbi.y=this.ƀjp);}this.ƀfh=true;let i=this.ƀjp-this.ƀbi.y;this.ƀbi.y=this.ƀbi.y+i*jo*t;}};var Wo=15,vi=class extends f{get contentAreaSize(){return this.ƀbj}get contentSize(){return this.ƀir.contentSize}constructor(t,e={}){super();let i={padding:Wo,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 f().displayParent(this).attach(this);new mt(r,t,i.padding).attach(this);let o=new f().displayParent(r).attach(this);this.ƀir=new Fe(o,t.y,i.padding,i.smallContentAlign),this.ƀbj=new helpersLib.Vector(t.x,this.ƀir.scrollHeight),new re(t).displayParent(r).attach(this).onWheel.subscribe(a=>this.ƀir.onWheel(a)).attach(this),g.afterSceneUpdateAction.subscribe(a=>this.ƀir.update(a.delta)).attach(this),this.addChildTo=o;}scrollToTop(t){this.ƀir.scrollToTop(),t?.instant&&this.ƀir.jumpToTarget();}scrollToBottom(t){this.ƀir.scrollToBottom(),t?.instant&&this.ƀir.jumpToTarget();}};var Uo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},$o=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};exports.KeyboardService=class bi{constructor(){this.ƀfp=new actionsLib.Action,this.keyPressed=this.ƀfp.notifier,this.ƀfq=new actionsLib.Action,this.keyReleased=this.ƀfq.notifier,this.ƀfw=new Set,this.ƀfv=new Set,window.addEventListener("keydown",t=>{this.ƀfw.add(t.key),this.ƀfv.add(t.key),!t.repeat&&this.ƀfp.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀfw.delete(t.key),this.ƀfq.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀfw.clear();}),g.afterSceneUpdateAction.subscribe(()=>{this.ƀfv.clear();}).attachToRoot();}isKeyDown(t){return this.ƀfw.has(t)}isKeyJustPressed(t){return this.ƀfv.has(t)}};exports.KeyboardService=Uo([p(),$o("design:paramtypes",[])],exports.KeyboardService);var zo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ko=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};exports.MouseTargetFocusService=class Si{get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfs}constructor(t){this.ƀgi=t,this.ƀgu=new actionsLib.Action,this.onTargetFocus=this.ƀgu.notifier,this.ƀjz=0,this.ƀkb=false,this.ƀde=false,this.ƀfs=void 0,g.beforeSceneUpdateAction.subscribe(e=>this.ƀkd(e.delta)).attachToRoot();}ƀkd(t){if(this.ƀgj){let e=this.ƀed(this.ƀgi.getStagePosition(),this.ƀgj);this.ƀhf===void 0?this.ƀhf=e:this.ƀau(e,t);}this.ƀgj=this.ƀgi.getStagePosition();}ƀau(t,e){this.ƀhf-t>10?(this.ƀjz=Math.max(250,this.ƀjz),this.ƀkb=true):this.ƀjz>1e3&&(this.ƀkb=true);let i=this.ƀjz>=300&&this.ƀkb;this.ƀfn(i,t,e);}ƀfn(t,e,i){(t||e>this.ƀhf)&&(this.ƀhf=e),t?(this.ƀkb=false,this.ƀjz=0,this.ƀde=true,this.ƀfs=this.ƀgi.getStagePosition(),this.ƀgu.trigger(this.ƀfs)):(this.ƀjz+=i,this.ƀde=false);}ƀed(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=zo([p(),ko("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var Pi=10.8,Ci=10.01;exports.PhysicsShapeType=void 0;(function(s){s[s.Point=1]="Point",s[s.Circle=2]="Circle",s[s.Polygon=3]="Polygon",s[s.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var d=class s{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=>s.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 ot="border";var Qo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Y=new U,Dt=class{createBody(t,e,i,r,o){return Y.trigger("createBody",t,e,i,r,o)}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,o){return Y.trigger("addBody",t,e,i,r,o)}removeBody(t,e){return Y.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return Y.trigger("subscribeToPhysicsStep",t,e)}};Dt=Qo([p()],Dt);var v=class s extends ${static{this.ƀhc=new Map;}static{this.ƀhj=new Map;}static getFromP2BodyID(t){return s.ƀhc.get(t)}static getFromP2BodyIDOrFail(t){let e=s.ƀhc.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=s.ƀhj.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(s.ƀhj.values())}get area(){return this.ƀu}get mass(){return this.ƀgd}get collisions(){return this.ƀay}constructor(t,e,i){super(),this.ƀgo=new actionsLib.Action,this.onCollision=this.ƀgo.notifier,this.type="dynamic",this.ƀu=0,this.ƀgd=0,this.ƀay=[],this.physicsWorldID=t,this.ƀhl=b.get(Dt);let r=this.ƀhl.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),o=this.ƀhl.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhk=this.ƀhl.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhm=this.ƀhl.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀhl.createBody(this.physicsWorldID,e,r,o,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgd=this.p2Body.mass,this.p2Body.position=d.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀhl.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!");s.ƀhc.set(this.p2Body.id,this),s.ƀhj.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀhl.removeBody(this.physicsWorldID,this.p2Body),s.ƀhc.delete(this.p2Body.id),s.ƀhj.delete(this.id));}canCollideWith(t){return d.arePhysicsGroupsCollidable(this.ƀhk,this.ƀhm,t.ƀhk,t.ƀhm)}ƀiu(t){this.ƀay=t,t.length>0&&this.ƀgo.trigger(t);}};var oe=class extends v{constructor(t,e){super(t,e,"static"),this.position=d.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 Ti=class extends ${constructor(){super(),this.position=new actionsLib.Variable(helpersLib.Vector.zero),this.rotation=new actionsLib.Variable(helpersLib.Radian.get0),this.velocity=new actionsLib.Variable(helpersLib.Vector.zero),this.rotationalSpeed=new actionsLib.Variable(0),g.beforeSceneUpdateAction.subscribe(({time:t,delta:e})=>{this.ƀjm(t,e);}).attach(this);}ƀjm(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 Ei=class extends v{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.ƀez=false,this.ƀfa=false,this.ƀfc=false,this.ƀfb=false,this.ƀhg(),this.ƀfx(),b.get(Dt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjm(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}}ƀjm(t,e){this.ƀez=true,this.ƀfa=true,this.ƀfc=true,this.ƀfb=true,this.ƀhg();}ƀhg(){this.position.value=d.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=d.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀfx(){this.position.subscribe(t=>{this.ƀez?this.ƀez=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfa?this.ƀfa=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.angularVelocity=t;}).attach(this);}};var is=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},rs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},x=class extends ${constructor(t,e,i,r,o,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=o,this.physicsBodyGroupToP2Group=n,this.physicsBodyGroupToP2Mask=a;}};x=is([pt(),rs("design:paramtypes",[helpersLib.Vector,Boolean,W__default.default.World,Map,Map,Map,Map])],x);var as=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},X=class{createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((o,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(o,1<<n),r.set(o,0);}),e.map(([o,n])=>{if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(o),h=r.get(n),l=i.get(o),c=i.get(n);r.set(o,a|c),r.set(n,h|l);}),{physicsBodyGroupToP2Group:i,physicsBodyGroupToP2Mask:r}}getGroupConstant(t,e){return x.getInstanceByIDOrFail(t).physicsBodyGroupToP2Group.get(e)}getMaskConstant(t,e){return x.getInstanceByIDOrFail(t).physicsBodyGroupToP2Mask.get(e)}canCollide(t,e,i){let r=t.physicsBodyGroupToP2Group.get(e),o=t.physicsBodyGroupToP2Mask.get(e),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (o&n)!==0&&(a&r)!==0}};X=as([p()],X);var hs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ls=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ne=class{constructor(t){this.ƀhi=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,o)=>{r.forEach((n,a)=>{this.ƀhi.canCollide(t,a,e)&&i.push({grid:n,cellSize:o});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let o=t.availabilityGridCache.get(e);o||(o=new Map,t.availabilityGridCache.set(e,o)),o.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ne=hs([p(),ls("design:paramtypes",[X])],Ne);var cs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ps=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},st=class{constructor(t,e){this.ƀhi=t,this.ƀy=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=d.aabbToBoundingBox(e.aabb);this.ƀy.getCollidableGrids(t,i).forEach(o=>{let n=M.areaToGridArea(r,o.cellSize);o.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Bt){return e.aabbNeedsUpdate=true,e.updateAABB(),Xt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),d.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀy.get(t,e,i);return r||(r=this.ƀby(t,e,i),this.ƀy.set(t,e,i,r)),r}ƀby(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(o=>{let n=v.getFromP2BodyIDOrFail(o.id);if(n.includeInPathfinding&&this.ƀhi.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdu(o,e);r.setArea(a,false);}}),r}ƀdu(t,e){let i=d.aabbToBoundingBox(t.aabb);return M.areaToGridArea(i,e)}};st=cs([p(),ps("design:paramtypes",[X,Ne])],st);var us=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ms=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Bt=50,Gt=class{constructor(t){this.ƀhh=t;}findPathAStar(t,e,i,r,o){o||(o={}),o.neighborType===void 0&&(o.neighborType=helpersLib.GridNeighborType.Ortogonal),o.gridCellSize===void 0&&(o.gridCellSize=Bt);let n=x.getInstanceByIDOrFail(t),a,h;helpersLib.Comparator.isNumber(i)?(h=v.getPhysicsInstanceOrFail(i).p2Body,a=d.arrayToVector(h.position)):a=i;let l=M.positionToGridPosition(e,o.gridCellSize),c=M.positionToGridPosition(a,o.gridCellSize),u=this.ƀhh.getAvilabilityGrid(n,o.gridCellSize,r);if(h){let T=d.aabbToBoundingBox(h.aabb),vt=M.areaToGridArea(T,o.gridCellSize);u.setArea(vt,true);}let m=Kt.findPath(u,l,c,o.neighborType);return m.path=m.path.map(T=>M.gridPositionToPosition(T,o.gridCellSize)),m}findPathDirection(t,e,i,r,o=Bt){let n=x.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let m=v.getPhysicsInstanceOrFail(i);a=d.aabbToBoundingBox(m.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let h=M.areaToGridArea(a,o),l=JSON.stringify({targetGridArea:h,collidableWithGroup:r}),c=n.vectorFieldCache.get(l);if(!c){let m=this.ƀhh.getAvilabilityGrid(n,o,r);c=new Zt(h,m),n.vectorFieldCache.set(l,c);}let u=M.positionToGridPosition(e,o);return c.getDirectionToTarget(u)}};Gt=us([p(),ms("design:paramtypes",[st])],Gt);var ws=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},j=new U;exports.PhysicsGateway=class Ri{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,o){return j.trigger("findPath",t,e,i,r,o)}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,o,n){return j.trigger("createExplosion",t,e,i,r,o,n)}createElipticExplosion(t,e,i,r,o,n,a){return j.trigger("createElipticExplosion",t,e,i,r,o,n,a)}printPathfindingTestGrid(t,e,i,r,o,n=Bt){return j.trigger("printPathfindingTestGrid",t,e,i,r,o,n)}};exports.PhysicsGateway=ws([p()],exports.PhysicsGateway);var xs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},vs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Z=class{constructor(t,e){this.ƀz=t,this.ƀhe=e;}printPathfindingTestGrid(t,e,i,r,o,n){let a=x.getInstanceByIDOrFail(t);this.ƀz.getAvilabilityGrid(a,n,r).map((l,c)=>({position:M.gridPositionToPosition(c,n),availability:l})).forEach(l=>{if(l.position.isInsideRectangle(o)){let c=this.ƀhe.findPathDirection(t,l.position,i,r),u;c===void 0?u=C.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(l.position,{round:false}).attach(a):u=C.createArrow(25,l.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(l.position,{round:false}).setRotation(c).attach(a),new O(u,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>u.destroy()).attach(u);}});}createExplosionDebugVisual(t,e,i,r,o,n=300){let a=new f().displayParent(e).setAlpha(.5).attach(t);C.createCircle(o,helpersLib.ColorHelper.blue).toSprite().displayParent(a).setPosition(r,{round:false}).setAlpha(.5).attach(t),i.forEach(l=>{let c=l.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;C.createVector(r,l.line.to,c).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,o,n,a=300){let h=new f().displayParent(e).setAlpha(.5).attach(t);C.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(h).setPosition(r,{round:false}).setRotation(o).setAlpha(.5).attach(t),i.forEach(c=>{let u=c.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;C.createVector(c.line.from,c.line.to,u).toSprite().displayParent(h).attach(t);}),new O(h,"alpha",{duration:a,animation:S.easeIn}).animate({alpha:0}).tap(()=>h.destroy()).attach(h);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??d.arrayToVector(t.position),o=i?.overrideRotation??new helpersLib.Radian(t.angle),n=i?.color??helpersLib.ColorHelper.blue,a=new f().displayParent(e).setPosition(r,{round:false}).setRotation(o).setAlpha(.5).attachToRoot();t.shapes.forEach(l=>{this.ƀcq(l,n).displayParent(a).attachToRoot();}),new O(a,"alpha",{duration:1e3,animation:S.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcq(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.ƀcp(t,e);default:throw new Error("Not implemented")}}ƀcp(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return C.createPolygon(i,e).toSprite()}};Z=xs([p(),vs("design:paramtypes",[st,Gt])],Z);var Ps=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Cs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},je=class{constructor(t){this.ƀjs=t;}hitTest(t,e){let i=t.world,r=v.getFromP2BodyIDOrFail(t.id),o=d.cloneP2Body(t);this.ƀt(o,e);let n=i.broadphase.aabbQuery(i,this.ƀdi(o)).map(h=>v.getFromP2BodyIDOrFail(h.id)).filter(h=>h.includeInPathfinding).filter(h=>r.canCollideWith(h)).map(h=>d.cloneP2Body(h.p2Body)),a=false;if(n.length!==0){let h=new W__default.default.World;h.addBody(o),n.forEach(l=>h.addBody(l)),h.step(1,1,1),a=h.narrowphase.contactEquations.some(l=>l.bodyA===o||l.bodyB===o),h.clear();}if(e?.testLayerID){let h=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀjs.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:h});}return a}ƀt(t,e){e?.overridePosition&&(t.position=d.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};je=Ps([p(),Cs("design:paramtypes",[Z])],je);var Es=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},He=class{registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀic(t,i);});});}step(t,e,i){v.getPhysicsEntities().forEach(r=>{r.ƀay=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀic(t,r);}),t.bodiesInContactWith.forEach((r,o)=>{this.ƀeo(r.p2Body),r.entity.ƀiu(t.collisionReports.get(o)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀeo(t){let e=d.arrayToVector(t.velocity);e.length>Pi&&(e=e.normalize(Pi),t.velocity=d.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-Ci),Ci);}ƀic(t,e){let i=v.getFromP2BodyID(e.bodyA.id),r=v.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 o=t.collisionReports.get(e.bodyA.id)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:h}=this.ƀdn(i,r,e);o.push({self:a,target:h}),n.push({self:h,target:a}),t.collisionReports.set(e.bodyA.id,o),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdn(t,e,i){let r=t.convertToDTO(),o=e.convertToDTO(),n=d.arrayToVector(i.contactPointA),a=d.arrayToVector(i.contactPointB),{normalA:h,normalB:l}=this.ƀeb(i);return {collisionDetailsA:this.ƀdm(r,i.bodyA.mass,n,h,t.area),collisionDetailsB:this.ƀdm(o,i.bodyB.mass,a,l,e.area)}}ƀdm(t,e,i,r,o){let n,a=i.add(t.position);return {body:t,getPositionReletiveToObject:()=>(n||(n=i.rotate(t.rotation.multiply(-1).vector)),n),getPositionOnWorld:()=>(a||(a=i.add(t.position)),a),position:i,mass:e,area:o,normal:r}}ƀeb(t){let e=d.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};He=Es([p()],He);var Rs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Is=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},We=class extends oe{constructor(t,e){super(t,e);}};We=Rs([pt(),Is("design:paramtypes",[Number,Object])],We);var As=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},H=1e4,Ue=class{createBorders(t,e,i){this.ƀbs(t,new helpersLib.Vector(e.x/2,-H/2),new helpersLib.Vector(e.x+H*2,H),i),this.ƀbs(t,new helpersLib.Vector(e.x/2,e.y+H/2),new helpersLib.Vector(e.x+H*2,H),i),this.ƀbs(t,new helpersLib.Vector(-H/2,e.y/2),new helpersLib.Vector(H,e.y+H*2),i),this.ƀbs(t,new helpersLib.Vector(e.x+H/2,e.y/2),new helpersLib.Vector(H,e.y+H*2),i);}ƀbs(t,e,i,r){return new We(t,{shapeDefinition:{materialName:ot,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};Ue=As([p()],Ue);var Ms=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},lr=new W__default.default.Material,Ds={id:ot,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},_t=class{createMaterials(t,e,i,r){let o=new Map,n=new Map;if(i.forEach(a=>{o.set(a.id,new W__default.default.Material),n.set(a.id,a);}),o.has(ot))throw new Error(`Material with name ${ot} cannot be defined, pick another name for the material.`);return o.set(ot,lr),n.set(ot,Ds),this.ƀc(t,e,i,r,o),{materials:o,materialDefinitions:n}}getMaterial(t,e){let i=x.getInstanceByIDOrFail(t);return this.ƀdz(e,i.materials)}getMaterialDefinition(t,e){let i=x.getInstanceByIDOrFail(t);return this.ƀdy(e,i.materialDefinitions)}ƀdz(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdy(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,o){this.ƀdr(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀdz(n.materialA,o),h=this.ƀdz(n.materialB,o);t.addContactMaterial(new W__default.default.ContactMaterial(a,h,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,o);}ƀdr(t,e){let i=new Map;e.forEach(o=>{let n=i.get(o.materialA);n||(n=new Map,i.set(o.materialA,n)),n.set(o.materialB,o);});let r=[];return t.forEach((o,n)=>{for(let a=n;a<t.length;a++){let h=t[a],l=i.get(o)?.get(h);l?r.push(l):r.push({materialA:o,materialB:h,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(o=>{let n=this.ƀdz(o.id,r);t.addContactMaterial(new W__default.default.ContactMaterial(n,lr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};_t=Ms([p()],_t);var Bs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Gs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ft=class{constructor(t,e,i,r,o){this.ƀge=t,this.ƀaj=e,this.ƀz=i,this.ƀaz=r,this.ƀhi=o;}createPhysicsWorld(t){let e=new W__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀge.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:o,physicsBodyGroupToP2Mask:n}=this.ƀhi.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new x(t.mapSize,t.modifyUpdateCycle,e,i,r,o,n).attachByID(t.attachTo);return a.onDestroy().tap(()=>{e.clear(),t.modifyUpdateCycle&&g.cleanUpdateModifier();}).attachToRoot(),this.ƀaj.createBorders(a.id,t.mapSize,t.borderProperties.borderBodyGroup),this.ƀaz.registerPhysicsWorld(a),t.modifyUpdateCycle?g.registerUpdateModifier((h,l)=>this.ƀjm(a,h,l)):g.beforeSceneUpdateAction.subscribe(({time:h,delta:l})=>{this.ƀjm(a,h,l);}).attach(a),a.id}addBody(t,e,i,r,o){let n=x.getInstanceByIDOrFail(t);if(i){let a=this.ƀz.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),o&&this.ƀz.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),o&&this.ƀz.onBodyAdded(n,e,r),true}removeBody(t,e){x.getInstanceByID(t)?.p2World.removeBody(e);}ƀjm(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.ƀaz.step(t,r,i),t.onPhysicsStep.trigger({time:r,delta:i}),t.lastP2Time.value=t.p2World.time;}return i}setPaused(t,e){x.getInstanceByIDOrFail(e).paused.set(t);}};Ft=Bs([p(),Gs("design:paramtypes",[_t,Ue,st,He,X])],Ft);var Fs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Lt=class{castClosest(t,e,i){let r=new W__default.default.RaycastResult,o=new W__default.default.Ray({mode:W__default.default.Ray.CLOSEST,from:d.vectorToArray(e.from),to:d.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,o),r.hasHit())return this.ƀbn(r,e)}castAllFirstContacts(t,e,i){let r=new Map,o=new W__default.default.Ray({mode:W__default.default.Ray.ALL,from:d.vectorToArray(e.from),to:d.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i),callback:n=>{let a=r.get(n.body);!r.has(n.body)||n.fraction<a.fraction?r.set(n.body,this.ƀbn(n,e)):n.fraction===a.fraction&&a.isExternal()&&r.set(n.body,this.ƀbn(n,e));}});return t.p2World.raycast(new W__default.default.RaycastResult,o),Array.from(r.values())}ƀbn(t,e){let i=t.fraction,r=d.arrayToVector(t.normal),o,n,a;return {body:t.body,hitPosition:()=>(o===void 0&&(o=e.from.lerp(e.to,i)),o),hitDistance:()=>(n===void 0&&(n=e.length*i),n),isExternal:()=>(a===void 0&&(a=e.fromTo.dotProduct(r)<0),a),normal:r,fraction:i,line:e}}};Lt=Fs([p()],Lt);var Vs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ht=class{applyImpulse(t,e,i,r){let o=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(d.vectorToArray(o),n);}};ht=Vs([p()],ht);var Ls=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Nt=class{toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(o=>{let n=i.get(o.body);if(n){let a=o.fraction<n.closestRaycastHit.fraction?o:n.closestRaycastHit;n.rayCastHits.push(o),i.set(o.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.isExternal&&o.isExternal(),explosionCenter:o.line.from});}else {let a=o.isExternal();i.set(o.body,{hitCount:1,closestRaycastHit:o,rayCastHits:[o],isExternal:a,explosionCenter:o.line.from});}});}),[...i.values()].map(r=>this.ƀbo(r,t.length))}ƀbo(t,e){let i=t.hitCount/e,r=t.rayCastHits;if(t.isExternal)return {body:v.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 o=d.arrayToVector(t.closestRaycastHit.body.position);return {body:v.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(o,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:()=>t.explosionCenter,getHitDistance:()=>0}}}};Nt=Ls([p()],Nt);var js=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Hs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},$s=15,ze=class{constructor(t,e,i,r){this.ƀhy=t,this.ƀjs=e,this.ƀhx=i,this.ƀfd=r;}createElipticExplosion(t,e,i,r,o,n,a){let h=x.getInstanceByIDOrFail(t),l=this.ƀcd(e,i,r,o,a?.hitOnlyClosest===true,h),c=this.ƀhx.toExplosionHits(l,false);return this.ƀr(c,n),a?.testLayerID&&this.ƀjs.createElipticExplosionDebugVisual(h,a.testLayerID,l,e,i,r,a.debugRayDuration),c.map(u=>{let{p2Body:m,...T}=u;return T})}ƀcd(t,e,i,r,o,n){let a=[],h=e.vector,l=e.add(helpersLib.Radian.get90).vector,c=l.normalize(i.x);a.push(new helpersLib.Line(t,t.add(c))),a.push(new helpersLib.Line(t,t.add(c.multiplyNumber(-1))));let u=h.normalize(i.y);a.push(new helpersLib.Line(t,t.add(u))),a.push(new helpersLib.Line(t,t.add(u.multiplyNumber(-1))));let m=Math.round(i.y/$s),T=i.y/(m*2+1)*2,vt=h.normalize(T),se=i.x,pr=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(m).forEach(ct=>{let bt=T*(ct+1),Oi=vt.multiplyNumber(ct+1),ne=l.normalize(this.ƀej(se,pr,bt)),ae=t.add(Oi);a.push(new helpersLib.Line(ae,ae.add(ne))),a.push(new helpersLib.Line(ae,ae.add(ne.multiplyNumber(-1))));let he=t.add(Oi.multiplyNumber(-1));a.push(new helpersLib.Line(he,he.add(ne))),a.push(new helpersLib.Line(he,he.add(ne.multiplyNumber(-1))));}),a.map(ct=>{if(o){let bt=this.ƀhy.castClosest(n,ct,r);return {line:ct,hits:bt?[bt]:[]}}else {let bt=this.ƀhy.castAllFirstContacts(n,ct,r);return {line:ct,hits:bt}}})}ƀej(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let o,n;r.isExternal()?(o=r.line.fromTo,n=e*2):(o=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀfd.applyImpulse(r.body,r.hitPosition(),o,n);});});}};ze=js([p(),Hs("design:paramtypes",[Lt,Z,Nt,ht])],ze);var zs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ks=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},ke=class{constructor(t,e,i,r){this.ƀhy=t,this.ƀjs=e,this.ƀhx=i,this.ƀfd=r;}createExplosion(t,e,i,r,o,n){let a=x.getInstanceByIDOrFail(t),h=this.ƀeg(i),l=this.ƀcd(e,i,r,h,n?.hitOnlyClosest===true,a),c=this.ƀhx.toExplosionHits(l);return this.ƀr(e,i,o,h,c),n?.testLayerID&&this.ƀjs.createExplosionDebugVisual(a,n.testLayerID,l,e,i,n.debugRayDuration),c}ƀcd(t,e,i,r,o,n){let a=new helpersLib.Radian(helpersLib.PI_360/r),h=new helpersLib.Vector(0,-e),l=a.vector;return helpersLib.ArrayHelper.createEmptyArray(r).map(()=>{let c=t.add(h);return h=h.rotate(l),new helpersLib.Line(t,c)}).map(c=>{if(o){let u=this.ƀhy.castClosest(n,c,i);return {line:c,hits:u?[u]:[]}}else {let u=this.ƀhy.castAllFirstContacts(n,c,i);return {line:c,hits:u}}})}ƀr(t,e,i,r,o){o.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let h=i*(1-a.fraction);this.ƀfd.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,h);});else {let a=helpersLib.Vector.fromTo(t,d.arrayToVector(n.p2Body.position)),h=a.length/e,l=i*r*h/2;this.ƀfd.applyImpulse(n.p2Body,n.getHitPosition(),a,l);}});}ƀeg(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};ke=zs([p(),ks("design:paramtypes",[Lt,Z,Nt,ht])],ke);var Zs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},jt=class{getMapSize(t){let e=x.getInstanceByIDOrFail(t);return {dimentions:e.mapSize,center:e.mapSizeCenter}}subscribeToPhysicsStep(t,e){return x.getInstanceByIDOrFail(t).onPhysicsStep.subscribe(e)}};jt=Zs([p()],jt);var Qs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},qs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ii=class{constructor(t,e,i,r,o,n,a,h){this.ƀhp=t,this.ƀhe=e,this.ƀjs=i,this.ƀda=r,this.ƀcu=o,this.ƀeu=n,this.ƀho=a,this.ƀfd=h;}createPhysicsWorld(t){return this.ƀhp.createPhysicsWorld(t)}getMapSize(t){return this.ƀho.getMapSize(t)}setPaused(t,e){this.ƀhp.setPaused(t,e);}hitTest(t,e){let i=v.getPhysicsInstanceOrFail(t);return this.ƀeu.hitTest(i.p2Body,e)}findPath(t,e,i,r,o){return this.ƀhe.findPathAStar(t,e,i,r,{neighborType:o})}findPathDirection(t,e,i,r){return this.ƀhe.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let o=v.getPhysicsInstanceOrFail(t);this.ƀfd.applyImpulse(o.p2Body,e,i,r);}createExplosion(t,e,i,r,o,n){return this.ƀda.createExplosion(t,e,i,r,o,n)}createElipticExplosion(t,e,i,r,o,n,a){return this.ƀcu.createElipticExplosion(t,e,i,r,o,n,a)}printPathfindingTestGrid(t,e,i,r,o,n){this.ƀjs.printPathfindingTestGrid(t,e,i,r,o,n);}};Ii=Qs([Q({controllerLink:j}),qs("design:paramtypes",[Ft,Gt,Z,ke,ze,je,jt,ht])],Ii);var tn=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Je=class{createBody(t,e,i,r,o){let n=x.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.ƀbu(n,void 0,i,r,e.shapeDefinition.group,o);case exports.PhysicsShapeType.Circle:return this.ƀbu(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,o);case exports.PhysicsShapeType.Polygon:return this.ƀcc(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,o);case exports.PhysicsShapeType.Rectangle:return this.ƀce(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,o);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbu(t,e,i,r,o,n){let a=new W__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(o),collisionMask:t.physicsBodyGroupToP2Mask.get(o),radius:e});a.material=i;let h=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 h.addShape(a),h}ƀcc(t,e,i,r,o,n){let a=t.physicsBodyGroupToP2Group.get(o),h=t.physicsBodyGroupToP2Mask.get(o),l=e.map(m=>new W__default.default.Convex({vertices:m.map(T=>[T.x,T.y]),collisionGroup:a,collisionMask:h})).map(m=>(m.material=i,m)),c=l.reduce((m,T)=>m+T.area,0),u=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:c,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.forEach(m=>u.addShape(m)),u.setDensity(r.density),u}ƀce(t,e,i,r,o,n){let a=new W__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(o),collisionMask:t.physicsBodyGroupToP2Mask.get(o)});a.material=i;let h=e.x*e.y,l=new W__default.default.Body({type:n==="dynamic"?W__default.default.Body.DYNAMIC:W__default.default.Body.STATIC,mass:h,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l.setDensity(r.density),l}};Je=tn([p()],Je);var en=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},rn=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ai=class{constructor(t,e,i,r,o){this.ƀhp=t,this.ƀhn=e,this.ƀiz=i,this.ƀho=r,this.ƀhi=o;}createBody(t,e,i,r,o){return this.ƀiz.createBody(t,e,i,r,o)}getMaterial(t,e){return this.ƀhn.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀhn.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhi.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhi.getMaskConstant(t,e)}addBody(t,e,i,r,o){return this.ƀhp.addBody(t,e,i,r,o)}removeBody(t,e){this.ƀhp.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀho.subscribeToPhysicsStep(t,e)}};Ai=en([Q({controllerLink:Y}),rn("design:paramtypes",[Ft,_t,Je,jt,X])],Ai);exports.AnimationFlicker=Gi;exports.AnimationInterpolationFunctions=k;exports.Animations=S;exports.Animator=O;exports.BORDER_MATERIAL_NAME=ot;exports.BardLegendsHardReset=B;exports.Camera=qt;exports.ClosestAvailableSpaceHelper=Xt;exports.Container=f;exports.ControllerDecorator=Q;exports.ControllerLink=U;exports.DEFAULT_SHADER_RESOLUTION=I;exports.DeltaTime=ni;exports.DisplayObjectArray=yi;exports.Entity=$;exports.EntityDecorator=pt;exports.FadeInContent=Li;exports.FadeInStateAnimation=ve;exports.Game=y;exports.Graphics=C;exports.ImmovablePhysicsEntity=oe;exports.Menu=Mt;exports.MenuEntity=xi;exports.MouseWheelListenerUI=re;exports.MovableEntity=Ti;exports.MovablePhysicsEntity=Ei;exports.PathFinder=Kt;exports.PhysicsEntity=v;exports.Placeholder=ui;exports.PositionConversionHelper=$t;exports.ROTATIONAL_SPEED_LIMIT=Ci;exports.RichText=mi;exports.SPEED_LIMIT=Pi;exports.Scene=St;exports.SceneDecorator=vr;exports.ScrollAreaUI=vi;exports.ScrollMaskUI=mt;exports.Service=b;exports.ServiceDecorator=p;exports.SingletonEntity=ft;exports.SlideInContent=zi;exports.SlideInContentByIndex=si;exports.SlideStateAnimation=Ce;exports.Sprite=J;exports.StateAnimation=xe;exports.Text=ee;exports.UpdatableContainer=gi;exports.UpdateCycle=g;exports.VectorFieldPathFinder=Zt;exports.VectorSet=yt;exports.View=Ht;exports.ViewDecorator=Xe;
67
+ }`,e}constructor(t,e){if(super(s.ƀei(),s.ƀdq(t*A)),this.ƀcy=t,this.resolution=A,this.ƀcy=t*A,this.ƀcy<0)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be smaller than 0");if(this.ƀcy>10)throw new Error("ExpandWithColorFilter: Expand * resolution cannot be higher than 10");helpersLib.Comparator.isInteger(this.ƀcy)||(this.ƀcy=Math.floor(this.ƀcy));let i=helpersLib.ColorHelper.normalize(e);this.uniforms.color=new Float32Array([i.red,i.green,i.blue]),this.uniforms.expandSquared=this.ƀcy*this.ƀcy,this.padding=this.ƀcy;}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 Pe=class extends L__namespace.Filter{static{h(this,"GlowFilter");}constructor(t){super(),this.resolution=A;let e={blurRadius:1,expand:0,color:helpersLib.ColorHelper.white,blendMode:exports.BlendMode.Screen,...t};this.ƀcz=new be(e.expand,e.color);let i=helpersLib.Comparator.isNumber(e.blurRadius)?new helpersLib.Vector(e.blurRadius,e.blurRadius):e.blurRadius;this.ƀah=new Tt(i),this.padding=Math.max(i.x,i.y)+e.expand,this.ƀah.blendMode=L__namespace.BLEND_MODES.SCREEN;}apply(t,e,i,r){let o=t.getFilterTexture();this.ƀcz.apply(t,e,o,L__namespace.CLEAR_MODES.CLEAR),this.ƀah.apply(t,o,i,r),t.returnFilterTexture(o);}};var kt=class s{static{h(this,"GlowSpriteGenerator");}static{this.ƀel=new Map;}static createGlowSpriteFromSprite(t,e,i){let r=this.ƀbc(e),o=helpersLib.Comparator.isNumber(r.blurRadius)?new helpersLib.Vector(r.blurRadius,r.blurRadius):r.blurRadius,n=this.ƀds(t.texture,o,r.expand,r.color,i),a=new L__namespace.Sprite(n);return this.ƀjb(a,helpersLib.Vector.fromVec2(t.anchor),Math.max(o.x,o.y)+r.expand),a.alpha=r.glowAlpha,a.blendMode=r.blendMode,a}static ƀds(t,e,i,r,o){if(!t.id)throw new Error("GlowSpriteGenerator: baseTexture should have an id");if(o){let n=`${t.id}-${i}-${e.x}-${e.y}-${r.r}-${r.g}-${r.b}`;if(s.ƀel.has(n))return s.ƀel.get(n);{let a=this.ƀdt(t,e,i,r);return s.ƀel.set(n,a),a}}else return this.ƀdt(t,e,i,r)}static ƀdt(t,e,i,r){let o=new L__namespace.Sprite(t);this.ƀdb(o,Math.max(e.x,e.y)+i),o.filters=[new Pe({blurRadius:e,expand:i,color:r})];let n=x.instance.renderer.generateTexture(o);return n.id=O.insertAsset(n),o.destroy(),n}static ƀjb(t,e,i){let r=(i+(t.width-i*2)*e.x)/t.width,o=(i+(t.height-i*2)*e.y)/t.height;t.anchor.set(r,o);}static ƀdb(t,e){if(t.isSprite){let o=new L__namespace.Graphics;t.addChild(o);}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(()=>{kt.ƀel.clear();}).attachToRoot();var Y=class s extends f{static{h(this,"Sprite");}static createByName(t){let e=x.setupOptions.spriteDefinitions[t];if(!e)throw new Error(`Sprite: Could not find sprite definition with name ${t}.`);return new s(e)}static createSnapshotSprite(t){let e=t.ƀhu,i=e.parent;i&&i.removeChild(e);let r=x.instance.renderer.generateTexture(e,{resolution:2,scaleMode:L__namespace.SCALE_MODES.LINEAR,multisample:L__namespace.MSAA_QUALITY.HIGH});i&&i.addChild(e);let n={id:O.insertAsset(r),scale:t.scale,size:t.size,anchor:helpersLib.Vector.zero,destroyAssetOnDestroy:true};return new s(n,{ignoreAnchor:true})}constructor(t,e={}){if(super(),this.ƀkb=1,!t)throw new Error("Sprite: spriteDefinition cannot be nullish!");this.ƀjk=t,this.pixiSprite=new L__namespace.Sprite(O.getAsset(t.id)),this.ƀhu.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.ƀge?.destroy(),this.ƀaj?.destroy(),this.ƀjk.destroyAssetOnDestroy&&(O.destroyAsset(this.ƀjk.id),this.ƀhv&&O.destroyAsset(this.ƀhv.texture.id)),this.ƀhv&&!this.ƀhv.destroyed&&this.ƀhv.destroy());}setTextureScale(t){return this.textureScale=t,this}get textureScale(){return this.ƀkb}set textureScale(t){this.ƀkb=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.ƀjk.boundingShapes&&!this.ƀhu.hitArea&&(this.ƀhu.hitArea=new me(this.ƀjk.boundingShapes,this.size,helpersLib.Vector.fromVec2(this.ƀjk.anchor)));}setMipmap(t){return this.mipmap=t,this}get mipmap(){return this.pixiSprite.texture.baseTexture.mipmap===L__namespace.MIPMAP_MODES.ON}set mipmap(t){t?this.pixiSprite.texture.baseTexture.mipmap=L__namespace.MIPMAP_MODES.ON:this.pixiSprite.texture.baseTexture.mipmap=L__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 L__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.ƀhv)return this.ƀhv.alpha;throw new Error("Sprite: getGlowFilterAlpha cannot be called before glow filter is added.")}set glowAlpha(t){if(this.ƀhv)this.ƀhv.alpha=t;else throw new Error("Sprite: setGlowFilterAlpha cannot be called before glow filter is added.")}getAlignmentVector(t){let e=helpersLib.Vector.fromVec2(this.ƀjk.anchor).to(t);return new helpersLib.Vector(this.size.x*e.x,this.size.y*e.y)}setGlowEffect(t){return this.ƀhv&&(this.ƀhv.destroy(),this.ƀhv=void 0),t&&(this.ƀhv=kt.createGlowSpriteFromSprite(this.pixiSprite,t,!this.ƀjk.destroyAssetOnDestroy),this.ƀhv.position.set(this.pixiSprite.x,this.pixiSprite.y),this.ƀhv.scale.set(this.pixiSprite.scale.x,this.pixiSprite.scale.y),this.ƀhu.addChild(this.ƀhv)),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.ƀge){if(!this.ƀjk.boundingShapes)throw new Error("Sprite: cropOverflowingParts cannot be used without polygonDefinition!");this.ƀge=this.ƀbs(),this.ƀge.pixiSprite._maskRefCount=Number.POSITIVE_INFINITY,this.ƀge.pixiSprite.renderable=false,this.ƀge.displayParent(this);}return this.ƀge}ƀbs(){if(!this.ƀjk.boundingShapes)throw new Error("Sprite: bounding shape cannot be created without polygonDefinition!");return E.createPolygon(this.ƀjk.boundingShapes,helpersLib.ColorHelper.white).toSprite().attach(this)}download(){let t=x.instance.renderer.extract.canvas(this.ƀhu);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 Qe=class{static{h(this,"AnimationEaseInOutFlatter");}start(){}multiplierFunction(t){return 3*(1-t)*Math.pow(t,2)+Math.pow(t,3)}},yt=class s extends f{static{h(this,"ScrollMaskUI");}static{this.ƀcr=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 o=new f;r===exports.ScrollDirection.Horizontal?this.ƀby(e,i,o):this.ƀcf(e,i,o),this.ƀge=Y.createSnapshotSprite(o).attach(this),o.destroy(),t.setMask(this.ƀge);}ƀ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}};return new Y(i,{textureSize:t,ignoreAnchor:true})}ƀbw(t){let e=JSON.stringify({type:"gradient",length:t}),i=s.ƀcr.get(e);if(!i){let r=document.createElement("canvas");r.width=1,r.height=t;let o=r.getContext("2d");if(o){let n=new Qe;helpersLib.ArrayHelper.createIntegerArray(t).forEach(l=>{let c=`rgba(255, 255, 255, ${n.multiplierFunction(l/t)})`;o.fillStyle=c,o.fillRect(0,l,1,1);});let a=L__namespace.Texture.from(r);i=O.insertAsset(a),s.ƀcr.set(e,i);}else throw new Error("Canvas context is null")}return i}};exports.SlideStateAnimationState=void 0;(function(s){s[s.Appear=1]="Appear",s[s.Disappear=2]="Disappear";})(exports.SlideStateAnimationState||(exports.SlideStateAnimationState={}));var S;(function(s){s[s.Idle=1]="Idle",s[s.TransitionForward=2]="TransitionForward",s[s.TransitionBackward=3]="TransitionBackward",s[s.Reverting=4]="Reverting";})(S||(S={}));var Se=class extends actionsLib.Attachable{static{h(this,"SlideStateAnimation");}constructor(t){super(),this.ƀn=S.Idle,this.ƀgy=new actionsLib.Action,this.ƀha=new actionsLib.Action,this.ƀhd={duration:500,animation:P.easeInOutCubic,...t},this.ƀjq=new we({duration:this.ƀhd.duration,animation:this.ƀhd.animation}).onStateChange((e,i)=>this.ƀes(e,i)).onValueChange(e=>this.ƀet(e)).attach(this);}setIndex(t,e){if(!helpersLib.Comparator.isInteger(t))throw new Error("SlideStateAnimation: index must be an integer!");this.ƀfh===void 0?(this.ƀfh=t,this.ƀgy.trigger({state:exports.SlideStateAnimationState.Appear,index:t}),this.ƀjq.setState(t,e)):this.ƀfh!==t?this.ƀgo!==t?this.ƀn===S.Idle?(this.ƀn=t>this.ƀfh?S.TransitionForward:S.TransitionBackward,this.ƀgo=t,this.ƀgy.trigger({state:exports.SlideStateAnimationState.Appear,index:this.ƀgo}),this.ƀjq.setState(t,e)):this.ƀjq.setState(t,e):this.ƀn===S.Reverting&&this.ƀgo===t&&(this.ƀn=t>this.ƀfh?S.TransitionForward:S.TransitionBackward,this.ƀjq.setState(t,e)):(this.ƀn===S.TransitionForward||this.ƀn===S.TransitionBackward)&&(this.ƀn=S.Reverting,this.ƀjq.setState(t,e));}ƀes(t,e){switch(this.ƀfh!==void 0&&this.ƀfh!==t&&this.ƀfh!==e&&this.ƀgy.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀfh}),this.ƀgo!==void 0&&this.ƀgo!==t&&this.ƀgo!==e&&this.ƀgy.trigger({state:exports.SlideStateAnimationState.Disappear,index:this.ƀgo}),e!==void 0&&e!==this.ƀfh&&e!==this.ƀgo&&this.ƀgy.trigger({state:exports.SlideStateAnimationState.Appear,index:e}),this.ƀn){case S.Idle:break;case S.TransitionForward:case S.TransitionBackward:e===void 0?(this.ƀn=S.Idle,this.ƀfh=this.ƀgo,this.ƀgo=void 0):this.ƀfh!==t&&this.ƀeq(t,e);break;case S.Reverting:e===void 0?(this.ƀn=S.Idle,this.ƀgo=void 0):this.ƀfh!==e&&this.ƀeq(t,e);break;default:{this.ƀn;throw new Error(`Unexpected case! "${this.ƀn}"`)}}}ƀet(t){let e=1;(this.ƀn===S.TransitionBackward||this.ƀn===S.Reverting&&this.ƀfh!==void 0&&this.ƀgo!==void 0&&this.ƀfh>this.ƀgo)&&(e=-1),(this.ƀn===S.Idle||t!==0)&&this.ƀha.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(-e*t),index:this.ƀfh}),this.ƀgo!==void 0&&this.ƀha.trigger({value:helpersLib.NumberHelper.ensurePositiveZero(e*(1-t)),index:this.ƀgo});}ƀeq(t,e){this.ƀfh=t,this.ƀgo=e,this.ƀha.trigger({value:0,index:this.ƀfh}),this.ƀn=this.ƀfh<this.ƀgo?S.TransitionForward:S.TransitionBackward;}onStateChange(t){return this.ƀgy.subscribe(e=>t(e.state,e.index)).attach(this),this}onValueChange(t){return this.ƀha.subscribe(e=>t(e.value,e.index)).attach(this),this}};exports.ScrollDirection=void 0;(function(s){s[s.Horizontal=1]="Horizontal",s[s.Vertical=2]="Vertical";})(exports.ScrollDirection||(exports.ScrollDirection={}));var qe=class extends f{static{h(this,"SlideInContentByIndex");}constructor(t,e){super(),this.ƀbu=t,this.ƀcl="x",this.ƀbj=new Map,this.ƀhd={duration:300,animation:P.easeInOutCubic,size:new helpersLib.Vector(500,500),margin:20,direction:exports.ScrollDirection.Horizontal,...e};let i=this.ƀhd.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(this.ƀhd.size.x+this.ƀhd.margin*2,this.ƀhd.size.y):new helpersLib.Vector(this.ƀhd.size.x,this.ƀhd.size.y+this.ƀhd.margin*2),r=new f().setPosition(this.ƀhd.direction===exports.ScrollDirection.Horizontal?new helpersLib.Vector(-this.ƀhd.margin,0):new helpersLib.Vector(0,-this.ƀhd.margin),{round:false}).displayParent(this).attach(this);this.ƀbz(i,this.ƀhd.margin,this.ƀhd.direction,r),this.ƀcl=this.ƀhd.direction===exports.ScrollDirection.Horizontal?"x":"y",this.ƀjq=new Se({duration:this.ƀhd.duration,animation:this.ƀhd.animation}).onStateChange((o,n)=>{if(o===exports.SlideStateAnimationState.Appear){let a=new f().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((o,n)=>{let a=this.ƀbj.get(n);if(a){let l={x:0,y:0};l[this.ƀcl]=i[this.ƀcl]*o+this.ƀhd.margin,a.setPosition(helpersLib.Vector.fromVec2(l),{round:false});}}).attach(this),this.addChildTo=r;}setIndex(t,e){return this.ƀjq.setIndex(t,e),this}ƀbz(t,e,i,r){new yt(r,new helpersLib.Vector(t.x,t.y),e,i).attach(this);}},ji=class extends qe{static{h(this,"SlideInContent");}constructor(t,e,i){super(r=>{let o=this.indexToItem.get(r.index);if(o)e({index:r.index,item:o,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,o)=>{this.itemToIndex.set(r,o),this.indexToItem.set(o,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 xt=class{static{h(this,"VectorSet");}constructor(){this.ƀkn=new Map;}add(t){let e=this.ƀkn.get(t.x);e||(e=new Set,this.ƀkn.set(t.x,e)),e.add(t.y);}has(t){let e=this.ƀkn.get(t.x);return e?e.has(t.y):false}delete(t){let e=this.ƀkn.get(t.x);return e?e.delete(t.y):false}};var ti=class{static{h(this,"DeltaTime");}static adjustMultiplier(t,e){return Math.pow(t,e)}};var D=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 Jt=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),o=D.areaToGridArea(e,i);if(this.ƀas(t,o))return helpersLib.Vector.zero;let n=t.movePositionInsideGrid(o.topLeft),a=helpersLib.Vector.fromTo(o.topLeft,n),l=this.find(t,n,r);if(l){let c=l.add(a),p=helpersLib.Vector.fromTo(o.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 xt,o=new helpersLib.Queue(e);for(;o.notEmpty;){let n=o.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)||o.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 Hi=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)}},ao=class{static{h(this,"PathfinderGrid");}constructor(t,e){this.ƀen=t,this.ƀjn=e,this.ƀhc=new helpersLib.BinaryHeap("min"),this.ƀaw=[],this.ƀgq=new helpersLib.Grid({size:t.size,defaultValue:void 0});let i=new Hi(this.ƀjn,0,Number.MAX_SAFE_INTEGER);this.ƀhc.add(i.pathLength,i);}get hasOpenNodes(){return this.ƀhc.size>0}getNeighbors(t,e){return this.ƀen.getNeighborPositions(t.position,e).filter(i=>this.ƀen.get(i)).map(i=>this.ƀgq.get(i)||this.ƀca(i))}popLowestPathCostNode(){let t=this.ƀhc.pop();return this.ƀhc.delete(t),t.closed=true,this.ƀaw.push(t),t}changeNodeCost(t,e,i,r){this.ƀhc.delete(t),t.distanceFromStart=e,t.distanceToEnd=t.getDistance(i),t.parent=r,this.ƀhc.add(t.pathLength,t);}getBestClosedNode(){return this.ƀaw.reduce((t,e)=>t.distanceToEnd<e.distanceToEnd?t:e)}ƀca(t){let e=new Hi(t,Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);return this.ƀgq.set(t,e),this.ƀhc.add(e.pathLength,e),e}},Yt=class{static{h(this,"PathFinder");}static findPath(t,e,i,r){let o=new ao(t,e);for(;o.hasOpenNodes;){let n=o.popLowestPathCostNode();if(n.isEqual(i))return n.createSolutionPath(true);let a=o.getNeighbors(n,r);for(let l of a)if(!l.closed){let c=n.distanceFromStart+n.getDistance(l.position);c<l.distanceFromStart&&o.changeNodeCost(l,c,i,n);}}return o.getBestClosedNode().createSolutionPath(false)}};var Xt=class{static{h(this,"VectorFieldPathFinder");}constructor(t,e){this.ƀjv=t,this.ƀx=e,this.ƀev=this.ƀdv(this.ƀx.size),this.ƀkv=new helpersLib.Grid({size:this.ƀx.size,defaultValue:this.ƀev}),this.ƀcm=new helpersLib.Grid({size:this.ƀx.size,defaultValue:void 0});let i=new xt,r=new helpersLib.Queue;for(this.ƀdk(this.ƀx.cropAreaOutsideOfTheGrid(t)).forEach(n=>{this.ƀkv.set(n,0),r.add(n);});r.notEmpty;){let n=r.pop();if(!i.has(n)){i.add(n);let a=this.ƀkv.getOrFail(n);this.ƀeb(n,this.ƀx).forEach(l=>{if(!i.has(l.position)){let c=this.ƀkv.getOrFail(l.position),p=a+l.distance;this.ƀx.getOrFail(l.position)&&p<c&&(this.ƀkv.set(l.position,p),r.add(l.position));}});}}}getDirectionToTarget(t){if(!t.isInsideRectangle(this.ƀjv)){if(t=this.ƀkv.movePositionInsideGrid(t),this.ƀcm.has(t))return this.ƀcm.get(t);{let e=this.ƀeb(t,this.ƀx),i;return this.ƀkv.getOrFail(t)>=this.ƀev?e.some(o=>this.ƀx.get(o.position))&&(e.some(n=>!this.ƀx.get(n.position))?i=this.ƀdp(e):i=this.ƀdl(t,e)):i=this.ƀdl(t,e),this.ƀcm.set(t,i),i}}}ƀdp(t){let e=t.filter(i=>this.ƀx.get(i.position)).map(i=>i.direction.radian);return helpersLib.Radian.getAverage(...e)}ƀdl(t,e){let i=e.filter(r=>this.ƀkv.getOrFail(r.position)<this.ƀev).reduce((r,o)=>{let n=this.ƀkv.getOrFail(o.position)+o.distance;return n<r.bestWeight?(r.bestDirections=[o.direction],r.bestWeight=n):n===r.bestWeight&&r.bestDirections.push(o.direction),r},{bestDirections:[],bestWeight:this.ƀev}).bestDirections;return this.ƀeg(i,t)}ƀeg(t,e){if(t.length>0){let i=t.reduce((r,o)=>r.add(o),helpersLib.Vector.zero);if(i.isZero()||!this.ƀfm(e,i))return helpersLib.Random.pickRandomElement(t).radian;if(t.length>=1)return i.radian}}ƀfm(t,e){let i=t.add(this.ƀko(e));return this.ƀx.isPointWithinBounds(i)&&this.ƀx.getOrFail(i)}ƀeb(t,e){return this.ƀkv.getNeighborDirections(t,helpersLib.GridNeighborType.All).map(i=>({position:t.add(i),direction:i,distance:i.x!==0&&i.y!==0?14:10}))}ƀdk(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}ƀko(t){let e=t.normalize().round();return new helpersLib.Vector(e.x,e.y)}ƀdv(t){return (t.x+t.y)*20}};var fo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},V=class extends ut{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);}};V=fo([ft()],V);var uo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},mo=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},It=class extends dt{static{h(this,"CameraView");}constructor(t){super(),this.ƀcw=t,this.ƀio=new f().setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀad=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(0).displayParent(x.instance.stage).attach(this),this.ƀab=new f().displayParent(this.ƀio).attach(this),this.ƀap=new f().displayParent(this.ƀio).attach(this),this.ƀdg=new f().setSortableChildren(true).displayParent(this.ƀio).attach(this),this.ƀao=new f().setSortableChildren(true).displayParent(this.ƀap).attach(this),this.ƀdf=new f().setSortableChildren(true).setZIndex(20).displayParent(this.ƀao).attach(this),this.ƀgc=new f().setSortableChildren(true).setZIndex(10).displayParent(this.ƀao).attach(this),this.ƀaa=new f().setZIndex(0).displayParent(this.ƀao).attach(this),this.ƀh=new M(this.ƀio,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),this.ƀae=new M(this.ƀad,"alpha",{duration:500,animation:P.easeInOutCubic,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState}),x.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),x.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.ƀcw.position.subscribe(e=>{this.ƀao.position=this.ƀbp(e);}).attach(this),this.ƀcw.offset.subscribe(e=>{this.ƀap.position=e;}).attach(this),this.appear(true,"alpha");}destroy(){this.destroyed||(super.destroy(),x.instance.resetScreenPositionToStagePositionFunction());}getLayers(){return {backgroundScreen:this.ƀab.id,background:this.ƀaa.id,main:this.ƀgc.id,foreground:this.ƀdf.id,foregroundScreen:this.ƀdg.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,x.instance.getScreenSizeCenter())}};It=uo([Je({entity:V}),mo("design:paramtypes",[V])],It);var wo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},xo=1500,Ee=class{static{h(this,"CameraService");}createCamera(){return new V().attachToRoot()}getCameraPosition(){let t=V.getInstanceOrFail();return helpersLib.Vector.fromTo(t.offset.value,t.position.value)}setPosition(t){let e=V.getInstanceOrFail();e.targetPosition.value=t;}setTransition(t){let e=V.getInstanceOrFail();e.focusingNewTargetInfo.value={time:x.time,duration:t?.duration??xo,position:e.position.value,roundPosition:t?.roundPosition??false,roundPositionThreshold:t?.roundPositionThreshold??0,focusingAnimation:t?.animation??exports.FocusingAnimation.Instant};}update(t,e){let i=V.getInstanceOrFail(),r=i.targetPosition.value;r&&(i.focusingNewTargetInfo.value?this.ƀfo(i,r,t):i.position.value=r);}ƀfo(t,e,i){let r=t.focusingNewTargetInfo.value;if(r.focusingAnimation===exports.FocusingAnimation.Instant)this.ƀbb(t,e);else {let o=(i-r.time)/r.duration;if(o>=1)this.ƀbb(t,e);else {let n;r.focusingAnimation===exports.FocusingAnimation.EaseInOut?n=J.easeInOut(o):r.focusingAnimation===exports.FocusingAnimation.EaseOut?n=J.easeOut(o):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;}};Ee=wo([d()],Ee);var vo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},bo=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},ri=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()}};ri=vo([q({controllerLink:gt}),bo("design:paramtypes",[Ee])],ri);var Po=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},oi=class{static{h(this,"CameraViewController");}getLayers(){let t=V.getInstanceOrFail().id;return It.getInstanceOrFail(t).getLayers()}appear(t,e){let i=V.getInstanceOrFail().id;return It.getInstanceOrFail(i).appear(t,e)}};oi=Po([q({controllerLink:ye})],oi);var Zt=class{static{h(this,"Camera");}get position(){return this.ƀan.getCameraPosition()}constructor(){this.ƀan=T.get(exports.CameraGateway),this.ƀar=T.get(Ut),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 x=class s{static{h(this,"Game");}static get instance(){return this.ƀfk}static{this.pause=actionsLib.Reducer.createOr();}static get camera(){return this.ƀam}static get time(){return y.ƀkc}static get setupOptions(){return this.ƀjd}getScreenSize(){return this.ƀit.value}getScreenSizeCenter(){return this.ƀiu.value}constructor(t){if(this.ƀit=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSize=this.ƀit.notifier,this.ƀiu=new actionsLib.Variable(helpersLib.Vector.zero),this.screenSizeCenter=this.ƀiu.notifier,this.devMode=false,this.resetScreenPositionToStagePositionFunction(),s.ƀfk)throw new Error("There can be only one Game instance!");{this.ƀbf={screenResolution:void 0,devMode:false,backgroundColor:helpersLib.ColorHelper.black,antialias:false,resolution:1,...t},this.devMode=this.ƀbf.devMode||false;let e=helpersLib.JsonHelper.removeUndefinedProperties({backgroundColor:this.ƀbf.backgroundColor,autoStart:false,antialias:this.ƀbf.antialias,resolution:this.ƀbf.resolution,width:this.ƀbf.screenResolution?.width,height:this.ƀbf.screenResolution?.height,resizeTo:this.ƀbf.screenResolution===void 0?window:void 0});this.ƀht=new L__namespace.Application(e);}}async setup(t){s.ƀjd=t,document.body.appendChild(this.ƀht.view),await Promise.all([O.loadGameAssets(t.assetDefinitions)]),s.ƀfk=this,this.stage=new f().attachToRoot(),this.stage.ƀhu=this.ƀht.stage,this.renderer=this.ƀht.renderer,this.ƀjc(),this.stage.sortableChildren=true,globalThis.ƀa=this.ƀht,window.addEventListener("resize",e=>{setTimeout(()=>this.ƀjc());}),s.ƀam=new Zt,this.ƀht.start(),this.ƀht.ticker.add(()=>{y.triggerUpdateTick(this.ƀht.ticker.deltaMS);});}setResolution(t){this.ƀht.renderer.resolution!==t&&(this.ƀht.renderer.resolution=t,this.ƀht.renderer.resize(this.ƀht.screen.width,this.ƀht.screen.height));}screenPositonToStagePosition(t){let e=Wt.includeScaleInScreenPosition(t,s.instance.stage.scale,s.instance.getScreenSizeCenter());return this.ƀis(e)}setScreenPositionToStagePositionFunction(t){this.ƀis=t;}resetScreenPositionToStagePositionFunction(){this.ƀis=t=>t;}destroyAsset(t){O.destroyAsset(t);}ƀjc(){let t=new helpersLib.Vector(this.ƀht.screen.width,this.ƀht.screen.height);this.ƀit.value=t,this.ƀiu.value=t.multiplyNumber(.5).round();}};var Re=class{static{h(this,"DashedLineHelper");}static getLines(t,e,i){let r=helpersLib.Vector.fromTo(t,e),o=r.normalize(),n=r.length-i.lineStartGap-i.lineEndGap,a=[];if(n<=0)return a;let l=t.add(o.normalize(i.lineStartGap));if(n<=i.dashGap+i.dashLength*.5)return a.push({from:l,to:l.add(o.normalize(n))}),a;let c=n-i.dashGap,p=i.dashLength+i.dashGap,m=Math.floor(c/p),g=c-p*m;m>=1&&g<i.dashLength&&(g+=p,m--);let R=o.normalize(g/2),bt=o.normalize(i.dashGap);if(a.push({from:l,to:l.add(R)}),l=l.add(R),m>0){let oe=o.normalize(i.dashLength);helpersLib.ArrayHelper.createEmptyArray(m).forEach(()=>{l=l.add(bt),a.push({from:l,to:l.add(oe)}),l=l.add(oe);});}return l=l.add(bt),a.push({from:l,to:l.add(R)}),a}};var E=class s extends f{static{h(this,"Graphics");}static{this.ƀcr=new Map;}static createArrow(t,e){let i=new L__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(o=>{i.drawPolygon(o.map(n=>new L__namespace.Point(n.x,n.y)));}),i.endFill(),new s(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},o=new L__namespace.Graphics;return o.lineStyle(r.width,r.color),Re.getLines(t,e,r).forEach(a=>{o.moveTo(a.from.x,a.from.y).lineTo(a.to.x,a.to.y);}),new s(o,JSON.stringify({type:"dashedLine",from:t,to:e,options:r}))}static createVector(t,e,i){let r=new L__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 s(r,JSON.stringify({type:"line",start:t,end:e,color:i}))}static createRectangleBorders(t,e,i){let r=new L__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 s(r,JSON.stringify({type:"rectangle-borders",size:t,borderSize:e,color:i}))}static createRectangle(t,e=helpersLib.ColorHelper.white){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawRect(0,0,t.x,t.y),i.endFill(),new s(i,JSON.stringify({type:"rectangle",size:t,color:e}))}static createCircle(t,e){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawCircle(0,0,t),i.endFill(),new s(i,JSON.stringify({type:"circle",radius:t,color:e}))}static createElipse(t,e){let i=new L__namespace.Graphics;return i.beginFill(e),i.drawEllipse(0,0,t.x,t.y),i.endFill(),new s(i,JSON.stringify({type:"elipse",size:t,color:e}))}static createPolygon(t,e){let i=new L__namespace.Graphics,r=JSON.stringify({type:"polygon",polygon:t,color:e});return i.beginFill(e),t.forEach(o=>{i.drawPolygon(o.map(n=>new L__namespace.Point(n.x,n.y)));}),i.endFill(),new s(i,r)}static createRegularPolygon(t,e,i){let r=new L__namespace.Graphics,o=new helpersLib.Radian(helpersLib.PI_360/t);r.beginFill(i),r.moveTo(e,0);for(let n=1;n<=t;n++){let l=o.multiply(n).vector.normalize(e),c=e+l.x,p=e+l.y;r.lineTo(c,p);}return r.endFill(),new s(r,JSON.stringify({type:"regular-polygon",sides:t,radius:e,color:i}))}constructor(t,e){super(),this.ƀhu.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.ƀef(e.cacheName,e.cache),r={id:i.assetID,scale:1,size:i.bounds,anchor:{x:0,y:0},destroyAssetOnDestroy:!e.cache},o=new Y(r,{texturePosition:i.bounds,ignoreAnchor:true});return this.attachToRoot(),this.destroy(),o}ƀef(t,e){if(e){let i=s.ƀcr.get(t);return i||(i=this.ƀce(),s.ƀcr.set(t,i)),i}else return this.ƀce()}ƀce(){let t=x.instance.renderer.generateTexture(this.pixiGraphics);t.id=O.insertAsset(t);let e=this.pixiGraphics.getBounds();return {assetID:t.id,bounds:new helpersLib.Vector(e.x,e.y)}}};var ai=class extends f{static{h(this,"Placeholder");}constructor(t){super(),this.ƀhw=new L__namespace.Graphics,this.ƀhw.beginFill(0,1e-9),this.ƀhw.drawRect(0,0,t.x,t.y),this.ƀhw.endFill(),this.ƀhu.addChild(this.ƀhw);}destroy(){this.destroyed||(super.destroy(),this.ƀhw.destroy());}};var At=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 o={blur:4,angle:helpersLib.Radian.get60,distance:10,color:helpersLib.ColorHelper.black,alpha:.5,...i};r={dropShadow:true,dropShadowBlur:o.blur,dropShadowAngle:o.angle.value,dropShadowDistance:o.distance,dropShadowColor:helpersLib.ColorHelper.rgbToHex(o.color),dropShadowAlpha:o.alpha};}return helpersLib.JsonHelper.removeUndefinedProperties({fontFamily:e.fontFamily,fill:helpersLib.ColorHelper.rgbToHex(e.color),align:e.align,fontSize:e.fontSize,fontStyle:e.fontStyle,lineHeight:e.lineHeight,wordWrapWidth:e.wordWrapWidth,wordWrap:e.wordWrapWidth!==void 0,lineThrough:e.lineThrough,...r})}};var Ie=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),o=this.ƀfg(r,e),n=this.ƀs(o);return this.ƀji(n)}static ƀfg(t,e){let i=new Map,r=new Map,o=h((a,l)=>{if(r.has(l))return r.get(l);let c=At.getPixiTextStyle(a);return r.set(l,c),c},"GetPixiStyle");return t.map(a=>{let{style:l,cacheKey:c}=this.ƀdo(a.tags,e,i),p=o(l,c),m=L__namespace.TextMetrics.measureText(" ",new L__namespace.TextStyle(p),false);return {text:a.text,cacheKey:c,style:l,pixiStyle:p,spaceWidth:m.width}})}static ƀdo(t,e,i){let r=t.join("+");if(i.has(r))return {style:i.get(r),cacheKey:r};let o=this.ƀba(t,e);return i.set(r,o),{style:o,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:o,dropShadow:n,...a}=i;return a}static ƀs(t){let e=[],i=[];return t.forEach((r,o)=>{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 ƀji(t){let e=[];return t.forEach(i=>{if(i.length===0)throw new Error("Internal Error: Line is unexpectedly empty");let r=i.flatMap(o=>this.ƀjj(o.text).map(a=>{let l=new L__namespace.TextStyle(o.pixiStyle),c=L__namespace.TextMetrics.measureText(a,l,false);return {text:a,whitespace:a.trim()==="",style:{cacheKey:o.cacheKey,style:o.style,pixiStyle:l,height:c.height,ascent:c.fontProperties.ascent,descent:c.fontProperties.descent,width:c.width,spaceWidth:o.spaceWidth}}}));e.push(r);}),e}static ƀjj(t){if(t==="")return [""];let e=[],i="",r=t[0]===" ";for(let o=0;o<t.length;o++){let n=t[o],a=n===" ";a===r?i+=n:(e.push(i),i=n,r=a);}return i&&e.push(i),e}};var Ae=class{static{h(this,"RichTextTypewriter");}get lineIsEmpty(){return this.ƀch.length===0}get remainingWidth(){return this.ƀkw-this.ƀcj}constructor(t,e){this.ƀkw=t,this.ƀfw=[],this.ƀch=[],this.ƀcj=0,this.ƀfv=new helpersLib.Vector(0,0),this.ƀci=0;let i={rectangleCutOption:void 0,horizontalAlignment:"left",verticalAlignment:"bottom",...e};if(this.ƀey=i.horizontalAlignment,this.ƀkp=i.verticalAlignment,i.rectangleCutOption){if(i.rectangleCutOption.position.x<0||i.rectangleCutOption.position.x>=this.ƀkw||i.rectangleCutOption.position.y<0)throw new Error("Rectangle cut position is out of bounds");this.ƀck={direction:i.rectangleCutOption.direction,rectangle:this.ƀbo(i.rectangleCutOption)};}}isSpaceAvailable(t){let e=Math.max(this.ƀci,t.y),i=this.ƀdx(this.ƀfv.y,this.ƀfv.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.ƀdy(this.ƀfv.y,this.ƀfv.y+e);this.ƀfv=new helpersLib.Vector(i,this.ƀfv.y),this.ƀcj=this.ƀfv.x;}this.ƀch.push({chunk:t,position:new helpersLib.Vector(this.ƀcj,this.ƀfv.y)}),this.ƀci=e,this.ƀcj+=t.style.width;}newLine(){let t=this.ƀfv.y+this.ƀci,e=this.ƀdy(t,t);this.ƀdd(),this.ƀfv=new helpersLib.Vector(e,t),this.ƀcj=this.ƀfv.x,this.ƀci=0;}print(){return this.ƀdd(),this.ƀfw}ƀdd(){this.ƀch.length>0&&(this.ƀfw.push(this.ƀg(this.ƀch)),this.ƀch=[]);}ƀg(t){return t=this.ƀkr(t),t=this.ƀfa(t),t}ƀfa(t){if(this.ƀey==="left")return t;let e=this.ƀfv.y+this.ƀci,i=this.ƀdy(this.ƀfv.y,e),o=this.ƀdx(this.ƀfv.y,e)-i,n=Math.min(o,t.reduce((l,c)=>l+c.chunk.style.width,0)),a;return this.ƀey==="center"?a=(o-n)/2:a=o-n,t.map(l=>(l={chunk:l.chunk,position:new helpersLib.Vector(l.position.x+a,l.position.y)},l))}ƀkr(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 o;switch(this.ƀkp){case "top":o=i-r.chunk.style.descent;break;case "center":o=(i-r.chunk.style.descent+e-r.chunk.style.ascent)*.5;break;case "bottom":o=e-r.chunk.style.ascent;break;default:{this.ƀkp;throw new Error(`Unexpected case! "${this.ƀkp}"`)}}return r={chunk:r.chunk,position:new helpersLib.Vector(r.position.x,r.position.y+o)},r})}ƀdy(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}ƀdx(t,e){return this.ƀck&&(this.ƀck.direction==="topRight"||this.ƀck.direction==="bottomRight")&&(this.ƀck.rectangle.isPointInside(new helpersLib.Vector(this.ƀkw,t),{includeEdges:false})||this.ƀck.rectangle.isPointInside(new helpersLib.Vector(this.ƀkw,e),{includeEdges:false}))?this.ƀck.rectangle.topLeft.x:this.ƀkw}ƀ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;default:{t.direction;throw new Error(`Unexpected case! "${t.direction}"`)}}return new helpersLib.Rectangle(e,i)}};var Oe=class{static{h(this,"ConsistentSpaceTextWrapper");}static wrapText(t,e){return t.forEach(i=>{i.forEach((r,o)=>{if(e.isSpaceAvailable(new helpersLib.Vector(r.style.width,r.style.height)))if(r.whitespace&&o===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.ƀkx(r,e);}else e.insertWord(r);else e.lineIsEmpty?e.insertWord(r):r.whitespace?this.ƀkx(r,e):(e.newLine(),e.insertWord(r));}),e.newLine();}),e.print()}static ƀkx(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 o=t.text.length-r-1;if(o>0){let n={text:" ".repeat(o),whitespace:true,style:{...t.style,width:o*t.style.spaceWidth}};e.insertWord(n);}}};var Me=class{static{h(this,"RichTextDataOutConverter");}static process(t){return t=this.ƀgk(t),t=this.ƀkh(t),this.ƀau(t)}static ƀgk(t){return t.map(e=>{let i=[],r,o=true;return e.forEach(n=>{if(!r||r.chunk.style.cacheKey!==n.chunk.style.cacheKey)r&&i.push(r),r=n,o=n.chunk.whitespace;else {let a=r.chunk.text+n.chunk.text;o=n.chunk.whitespace&&o,r={chunk:{text:a,whitespace:o,style:{...r.chunk.style,width:r.chunk.style.width+n.chunk.style.width}},position:r.position};}}),r&&i.push(r),i})}static ƀkh(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,o=i.chunk.text.trimEnd();r!==o.length?e.push({chunk:{text:o,whitespace:false,style:{...i.chunk.style,width:i.chunk.style.width-(r-o.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 Qt=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=Ie.process(t,e),r=helpersLib.JsonHelper.removeUndefinedProperties({rectangleCutOption:e.rectangleCut,verticalAlignment:e.verticalAlignment,horizontalAlignment:e.default.align}),o=new Ae(e.default.wordWrapWidth??1/0,r),n=Oe.wrapText(i,o);return Me.process(n)}};var Lo=1,Yi=1/Lo,qt=class extends f{static{h(this,"Text");}get ƀjz(){if(!this.ƀka){let t=new L__namespace.TextStyle(this.ƀhy);this.ƀka=L__namespace.TextMetrics.measureText(this.ƀjy,t);}return this.ƀka}get ascent(){return this.ƀjz.fontProperties.ascent}constructor(t,e){super(),this.ƀhy=At.getPixiTextStyle(e),this.setText(t);}destroy(){this.destroyed||(super.destroy(),!this.ƀhx.destroyed&&this.ƀhx.destroy());}setAnchor(t){return this.anchor=t,this}get anchor(){return new helpersLib.Vector(this.ƀhx.anchor.x,this.ƀhx.anchor.y)}set anchor(t){this.ƀi=t,this.ƀhx.anchor.set(t.x,t.y);}setText(t){return this.ƀjy!==t&&(this.ƀjy=t,this.ƀif()),this}setColor(t){let e=helpersLib.ColorHelper.rgbToHex(t);return this.ƀhy.fill!==e&&(this.ƀhy.fill=e,this.ƀif()),this}ƀif(){this.ƀhx?.destroy(),this.ƀjt?.destroy(),this.ƀjt=void 0,this.ƀka=void 0;let t=new L__namespace.TextStyle(this.ƀhy);this.ƀhx=new L__namespace.Text(this.ƀjy,t),this.ƀij(),this.ƀi&&this.ƀhx.anchor.set(this.ƀi.x,this.ƀi.y),this.ƀhx.scale.set(Yi,Yi),this.ƀhu.addChild(this.ƀhx),this.ƀhy.lineThrough&&(this.ƀjt=this.ƀe(this.ƀhx,this.ƀhy.fill),this.ƀhu.addChild(this.ƀjt));}ƀij(){let t=L__namespace.TextMetrics.measureText(this.ƀjy,new L__namespace.TextStyle({...this.ƀhy,dropShadow:false,dropShadowAlpha:0,dropShadowBlur:0,dropShadowDistance:0}));this.ƀhx.calculateBounds=function(){this.updateText(true),this._bounds.clear();let e=-this.anchor.x*t.width,i=-this.anchor.y*t.height;this._bounds.addFrame(this.transform,e,i,e+t.width,i+t.height);};}ƀe(t,e){let i=L__namespace.TextMetrics.measureText(t.text,t.style),r=Math.max(1,Math.round(i.lineHeight*.07)),o=r%2*.5,n=new L__namespace.Graphics;n.lineStyle(r,e);let a=0;return i.lines.forEach((l,c)=>{let p=L__namespace.TextMetrics.measureText(l,t.style),m=Math.round(a+(p.fontProperties.ascent-p.fontProperties.descent)*.6+p.fontProperties.descent)+o,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),m),n.lineTo(Math.floor(g+p.width),m),a+=p.lineHeight;}),n.endFill(),n}};var hi=class extends f{static{h(this,"RichText");}constructor(t,e){super(),Qt.process(t,e).forEach(r=>new qt(r.text,r.style).setPosition(r.position).displayParent(this).attach(this));}};var li=class extends f{static{h(this,"UpdatableContainer");}},ci=class extends f{static{h(this,"DisplayObjectArray");}constructor(t,e){super(),this.ƀbu=t,this.ƀco=new Map,this.ƀhd={trackBy:h((i,r)=>r,"trackBy"),positioning:{direction:"vertical",spacing:0},...e};}set(t){let e=new Set(this.ƀco.keys()),i=0;t.forEach((r,o)=>{let n=this.ƀhd.trackBy(r,o),a;this.ƀco.has(n)?(a=this.ƀco.get(n),e.delete(n),a.update(r)):(a=this.ƀbu(r).displayParent(this).attach(this),this.ƀco.set(n,a)),this.ƀhd.positioning.direction==="horizontal"?(a.x=i,i+=a.size.x+this.ƀhd.positioning.spacing):(a.y=i,i+=a.size.y+this.ƀhd.positioning.spacing);}),e.forEach(r=>{this.ƀco.get(r).destroy(),this.ƀco.delete(r);});}};var te=class s extends f{static{h(this,"MenuUI");}static{this.ƀgi=[];}static{this.ƀkf=false;}static ƀdw(){for(;this.ƀgi.length>0;){let e=this.ƀgi[this.ƀgi.length-1].deref();if(!e||e.destroyed)this.ƀgi.pop();else return e}}static ƀep(t){let e=this.ƀdw();return this.ƀgi.push(new WeakRef(t)),t.onDestroy().asyncMap(()=>{if(e=this.ƀdw(),e)return e.ƀeo("closed")}).attachToRoot(),e?e.ƀeo("opened"):actionsLib.SingleEvent.instant()}constructor(t,e){super(),this.ƀgu=new actionsLib.SingleAction,this.onCreate=this.ƀgu.notifier,this.ƀgx=new actionsLib.SingleAction,this.onOpen=this.ƀgx.notifier,this.ƀgr=new actionsLib.SingleAction,this.onClose=this.ƀgr.notifier;let i={onNewMenuOpen:"close",closeOnBackgroundClick:true,appearAnimationDuration:150,backgroundDarkeningRatio:.3,...e};this.ƀgw=i.onNewMenuOpen,this.setZIndex(100).setAlpha(0),this.ƀo=new M(this,"alpha",{animation:P.easeInOutCubic,duration:i.appearAnimationDuration,reAnimateHandling:exports.ReAnimateHandlingType.CompletePrevious,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState});let r=E.createRectangle(new helpersLib.Vector(1,1),helpersLib.ColorHelper.black).toSprite({cache:true}).setAlpha(i.backgroundDarkeningRatio).setInteractive(true).displayParent(this).attach(this);this.ƀgh=Y.createByName(t).setPosition(new helpersLib.Vector(0,0)).setInteractive(true).displayParent(this).attach(this),x.instance.screenSize.subscribe(o=>{r.aspectRatio=o.x/o.y,r.scale=Math.max(o.x,o.y),r.setPosition(helpersLib.Vector.zero,{holdFrom:helpersLib.Vector.half}),this.setPosition(o.multiplyNumber(.5));}).attach(this),s.ƀep(this).tap(()=>{i.closeOnBackgroundClick&&r.on(exports.ContainerEventType.Click).filter(()=>!s.ƀkf).tap(()=>this.ƀcn({type:"backgroundClick",value:void 0})).take(1).attach(this),this.ƀgu.resolve(),this.ƀq();}).attach(this);}getBoundingMask(){return this.ƀgh.getBoundingMask()}close(t){return this.ƀcn(t)}ƀeo(t){switch(this.ƀgw){case "close":{if(t==="opened")return this.ƀcn({type:"newMenuOpened",value:void 0}).mapToVoid();throw new Error('MenuUI: new menu handling "close" type should not receive handling call after new menu closed')}case "temporarilyDisappear":return t==="opened"?this.ƀo.animate({alpha:0}).chain(this):this.ƀo.animate({alpha:1}).chain(this);case "stayInBackground":return actionsLib.SingleEvent.instant();default:{this.ƀgw;throw new Error(`Unexpected case! "${this.ƀgw}"`)}}}ƀq(){if(s.ƀkf)throw new Error("WindowUI: cannot iterate while in transition");return s.ƀkf=true,this.ƀo.animate({alpha:1}).chain(this).tap(()=>{s.ƀkf=false,this.ƀgx.resolve();}).chainToRoot()}ƀcn(t){if(s.ƀkf)throw new Error("WindowUI: cannot iterate while in transition");return s.ƀkf=true,this.ƀo.animate({alpha:0}).chain(this).map(()=>(s.ƀkf=false,this.ƀgr.resolve(t),this.destroy(),t)).chainToRoot()}};var di=class extends ut{static{h(this,"MenuEntity");}constructor(t){super(),this.ƀhd=t,queueMicrotask(()=>{if(!this.ƀgj)throw new Error("MenuEntity: MenuEntity has to have a MenuView.")});}ƀih(t){this.ƀgj=t,this.ƀgj.onClose.subscribe(()=>this.destroy()).attach(this);}onCreate(){return this.ƀgj.onCreate.toSingleEvent().destroyIfNotAttached()}onOpen(){return this.ƀgj.onOpen.toSingleEvent().destroyIfNotAttached()}onClose(){return this.ƀgj.onClose.toSingleEvent().destroyIfNotAttached()}close(...t){let e=t[0];return this.ƀgj.close({type:"withValue",value:e})}};var fi=class extends dt{static{h(this,"MenuView");}constructor(t,e,i){super();let r=helpersLib.JsonHelper.removeUndefinedProperties({onNewMenuOpen:t.ƀhd.onNewMenuOpen,appearAnimationDuration:i.appearAnimationDuration,backgroundDarkeningRatio:i.backgroundDarkeningRatio,closeOnBackgroundClick:t.ƀhd.closeOnBackgroundClick}),o=new te(e,r).displayParent(x.camera.layers.foregroundScreen).attach(this);t.ƀih(o);let n=new actionsLib.SingleAction;o.onCreate.subscribe(()=>n.resolve(o)).attach(this),this.onCreate=n.notifier,this.onOpen=o.onOpen.notifier,this.onClose=o.onClose.notifier;}};var Uo=.65,$o=.01,Be=class{static{h(this,"SmoothScroller");}get scrollHeight(){return this.ƀiv}get contentSize(){return this.ƀbh.size.ceil()}constructor(t,e,i,r){this.ƀbh=t,this.ƀv=e,this.ƀhg=i,this.ƀjh=r,this.ƀfj=false,this.ƀiv=e-i*2,this.ƀbh.y=i,this.ƀju=i;}onWheel(t){this.setTarget(this.ƀju-t*Uo);}scrollToTop(){this.setTarget(1/0);}scrollToBottom(){this.setTarget(-1/0);}setTarget(t){this.ƀju=helpersLib.NumberHelper.clamp(t,this.ƀv-this.ƀhg-this.contentSize.y,this.ƀhg);}jumpToTarget(){this.ƀbh.y=this.ƀju;}update(t){let e=this.contentSize;if(e.y<=this.ƀiv){switch(this.ƀjh){case "start":this.ƀju=this.ƀhg;break;case "center":this.ƀju=(this.ƀv-e.y)*.5;break;case "end":this.ƀju=this.ƀv-e.y-this.ƀhg;break;default:{this.ƀjh;throw new Error(`Unexpected case! "${this.ƀjh}"`)}}this.ƀfj||(this.ƀbh.y=this.ƀju);}this.ƀfj=true;let i=this.ƀju-this.ƀbh.y;this.ƀbh.y=this.ƀbh.y+i*$o*t;}};var zo=15,ui=class extends f{static{h(this,"ScrollAreaUI");}get contentAreaSize(){return this.ƀbi}get contentSize(){return this.ƀiw.contentSize}constructor(t,e={}){super();let i={padding:zo,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 f().displayParent(this).attach(this);new yt(r,t,i.padding).attach(this);let o=new L__namespace.Graphics;o.beginFill(0,1e-9),o.drawRect(0,0,t.x,t.y),o.endFill(),r.ƀhu.addChild(o);let n=new f().displayParent(r).attach(this);this.ƀiw=new Be(n,t.y,i.padding,i.smallContentAlign),this.ƀbi=new helpersLib.Vector(t.x,this.ƀiw.scrollHeight),o.eventMode="dynamic",o.addEventListener("wheel",a=>{this.ƀiw.onWheel(a.deltaY);}),n.setInteractive(true),n.ƀhu.addEventListener("wheel",a=>{this.ƀiw.onWheel(a.deltaY);}),y.afterSceneUpdateAction.subscribe(a=>this.ƀiw.update(a.delta)).attach(this),this.addChildTo=n;}scrollToTop(t){this.ƀiw.scrollToTop(),t?.instant&&this.ƀiw.jumpToTarget();}scrollToBottom(t){this.ƀiw.scrollToBottom(),t?.instant&&this.ƀiw.jumpToTarget();}};var Jo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Yo=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};exports.KeyboardService=class mi{static{h(this,"KeyboardService");}constructor(){this.ƀfr=new actionsLib.Action,this.keyPressed=this.ƀfr.notifier,this.ƀfs=new actionsLib.Action,this.keyReleased=this.ƀfs.notifier,this.ƀfy=new Set,this.ƀfx=new Set,window.addEventListener("keydown",t=>{this.ƀfy.add(t.key),this.ƀfx.add(t.key),!t.repeat&&this.ƀfr.trigger(t.key);}),window.addEventListener("keyup",t=>{this.ƀfy.delete(t.key),this.ƀfs.trigger(t.key);}),window.addEventListener("blur",()=>{this.ƀfy.clear();}),y.afterSceneUpdateAction.subscribe(()=>{this.ƀfx.clear();}).attachToRoot();}isKeyDown(t){return this.ƀfy.has(t)}isKeyJustPressed(t){return this.ƀfx.has(t)}};exports.KeyboardService=Jo([d(),Yo("design:paramtypes",[])],exports.KeyboardService);var Xo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Ko=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};exports.MouseService=class ie{static{h(this,"MouseService");}get initialMouseMoveHappened(){return this.ƀfi.value}getStagePosition(){return this.ƀjl.value}getScreenPosition(){return this.ƀir.value}getMainButtonState(){return this.ƀgb.value}getSecondaryButtonState(){return this.ƀix.value}constructor(){this.ƀfi=new actionsLib.Variable(false),this.onInitialMouseMove=this.ƀfi.notifier,this.ƀjl=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.stagePosition=this.ƀjl.notifier,this.ƀir=new actionsLib.Variable(helpersLib.Vector.zero,{notifyOnChange:true}),this.screenPosition=this.ƀir.notifier,this.ƀgb=new actionsLib.Variable(false),this.mainButtonState=this.ƀgb.notifier,this.ƀix=new actionsLib.Variable(false),this.secondaryButtonState=this.ƀix.notifier,this.ƀjm(),window.addEventListener("mousedown",t=>{t.button===0?this.ƀgb.value=true:t.button===2&&(this.ƀix.value=true);}),window.addEventListener("mouseup",t=>{t.button===0?this.ƀgb.value=false:t.button===2&&(this.ƀix.value=false);}),window.addEventListener("blur",()=>{this.ƀgb.value=false,this.ƀix.value=false;});}ƀjm(){let t=helpersLib.Vector.zero;window.addEventListener("mousemove",e=>{t=new helpersLib.Vector(e.clientX,e.clientY),this.ƀfi.value=true;}),y.beforeSceneUpdateAction.subscribe(()=>{this.ƀir.value=t;}).attachToRoot(),y.afterSceneUpdateAction.subscribe(()=>{let e=x.instance.screenPositonToStagePosition(this.ƀir.value);e.isEqual(this.ƀjl.value)?x.instance.renderer.events.onPointerMove(new PointerEvent("pointermove",{clientX:this.ƀir.value.x,clientY:this.ƀir.value.y,pointerType:"mouse"})):this.ƀjl.value=e;}).attachToRoot();}};exports.MouseService=Xo([d(),Ko("design:paramtypes",[])],exports.MouseService);var Zo=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Qo=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)};exports.MouseTargetFocusService=class gi{static{h(this,"MouseTargetFocusService");}get focusedInLastFrame(){return this.ƀde}get lastFocusedPosition(){return this.ƀfu}constructor(t){this.ƀgm=t,this.ƀgz=new actionsLib.Action,this.onTargetFocus=this.ƀgz.notifier,this.ƀke=0,this.ƀkg=false,this.ƀde=false,this.ƀfu=void 0,y.beforeSceneUpdateAction.subscribe(e=>this.ƀki(e.delta)).attachToRoot();}ƀki(t){if(this.ƀgn){let e=this.ƀee(this.ƀgm.getStagePosition(),this.ƀgn);this.ƀhi===void 0?this.ƀhi=e:this.ƀat(e,t);}this.ƀgn=this.ƀgm.getStagePosition();}ƀat(t,e){this.ƀhi-t>10?(this.ƀke=Math.max(250,this.ƀke),this.ƀkg=true):this.ƀke>1e3&&(this.ƀkg=true);let i=this.ƀke>=300&&this.ƀkg;this.ƀfp(i,t,e);}ƀfp(t,e,i){(t||e>this.ƀhi)&&(this.ƀhi=e),t?(this.ƀkg=false,this.ƀke=0,this.ƀde=true,this.ƀfu=this.ƀgm.getStagePosition(),this.ƀgz.trigger(this.ƀfu)):(this.ƀke+=i,this.ƀde=false);}ƀee(t,e){let i=helpersLib.Vector.fromTo(t,e);return Math.abs(i.x)+Math.abs(i.y)}};exports.MouseTargetFocusService=Zo([d(),Qo("design:paramtypes",[exports.MouseService])],exports.MouseTargetFocusService);var yi=10.8,wi=10.01;exports.PhysicsShapeType=void 0;(function(s){s[s.Point=1]="Point",s[s.Circle=2]="Circle",s[s.Polygon=3]="Polygon",s[s.Rectangle=4]="Rectangle";})(exports.PhysicsShapeType||(exports.PhysicsShapeType={}));var u=class s{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=>s.arePhysicsGroupsCollidable(i.collisionGroup,i.collisionMask,r.collisionGroup,r.collisionMask)))}static cloneP2Body(t){let e=new U__default.default.Body({position:t.position,angle:t.angle,type:t.type});return e.shapes=t.shapes,e}};var st="border";var os=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},X=new $,Mt=class{static{h(this,"PhysicsInternalGateway");}createBody(t,e,i,r,o){return X.trigger("createBody",t,e,i,r,o)}getMaterial(t,e){return X.trigger("getMaterial",t,e)}getMaterialDefinition(t,e){return X.trigger("getMaterialDefinition",t,e)}getGroupConstant(t,e){return X.trigger("getGroupConstant",t,e)}getMaskConstant(t,e){return X.trigger("getMaskConstant",t,e)}addBody(t,e,i,r,o){return X.trigger("addBody",t,e,i,r,o)}removeBody(t,e){return X.trigger("removeBody",t,e)}subscribeToPhysicsStep(t,e){return X.trigger("subscribeToPhysicsStep",t,e)}};Mt=os([d()],Mt);var b=class s extends k{static{h(this,"PhysicsEntity");}static{this.ƀhf=new Map;}static{this.ƀhm=new Map;}static getFromP2BodyID(t){return s.ƀhf.get(t)}static getFromP2BodyIDOrFail(t){let e=s.ƀhf.get(t);if(!e)throw new Error(`PhysicsEntity with p2BodyID ${t} not found`);return e}static getPhysicsInstanceOrFail(t){let e=s.ƀhm.get(t);if(!e)throw new Error(`PhysicsEntity with id ${t} not found`);return e}static getPhysicsEntities(){return Array.from(s.ƀhm.values())}get area(){return this.ƀu}get mass(){return this.ƀgf}get collisions(){return this.ƀax}constructor(t,e,i){super(),this.ƀgs=new actionsLib.Action,this.onCollision=this.ƀgs.notifier,this.type="dynamic",this.ƀu=0,this.ƀgf=0,this.ƀax=[],this.physicsWorldID=t,this.ƀho=T.get(Mt);let r=this.ƀho.getMaterial(this.physicsWorldID,e.shapeDefinition.materialName),o=this.ƀho.getMaterialDefinition(this.physicsWorldID,e.shapeDefinition.materialName);if(this.type=i,this.physicsBodyGroup=e.shapeDefinition.group,this.includeInPathfinding=e.includeOnPathfinding,this.ƀhn=this.ƀho.getGroupConstant(this.physicsWorldID,this.physicsBodyGroup),this.ƀhp=this.ƀho.getMaskConstant(this.physicsWorldID,this.physicsBodyGroup),this.p2Body=this.ƀho.createBody(this.physicsWorldID,e,r,o,this.type),this.ƀu=this.p2Body.getArea(),this.ƀgf=this.p2Body.mass,this.p2Body.position=u.vectorToArray(e.position),this.p2Body.angle=e.rotation.value,!this.ƀho.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!");s.ƀhf.set(this.p2Body.id,this),s.ƀhm.set(this.id,this);}destroy(){this.destroyed||(super.destroy(),this.ƀho.removeBody(this.physicsWorldID,this.p2Body),s.ƀhf.delete(this.p2Body.id),s.ƀhm.delete(this.id));}canCollideWith(t){return u.arePhysicsGroupsCollidable(this.ƀhn,this.ƀhp,t.ƀhn,t.ƀhp)}ƀiz(t){this.ƀax=t,t.length>0&&this.ƀgs.trigger(t);}};var re=class extends b{static{h(this,"ImmovablePhysicsEntity");}constructor(t,e){super(t,e,"static"),this.position=u.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 xi=class extends k{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.ƀjr(t,e);}).attach(this);}ƀjr(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 vi=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.ƀfb=false,this.ƀfc=false,this.ƀfe=false,this.ƀfd=false,this.ƀhj(),this.ƀfz(),T.get(Mt).subscribeToPhysicsStep(t,({time:i,delta:r})=>this.ƀjr(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}}ƀjr(t,e){this.ƀfb=true,this.ƀfc=true,this.ƀfe=true,this.ƀfd=true,this.ƀhj();}ƀhj(){this.position.value=u.arrayToVector(this.p2Body.position),this.rotation.value=new helpersLib.Radian(this.p2Body.angle),this.velocity.value=u.arrayToVector(this.p2Body.velocity),this.rotationalSpeed.value=this.p2Body.angularVelocity;}ƀfz(){this.position.subscribe(t=>{this.ƀfb?this.ƀfb=false:this.p2Body.position=[t.x,t.y];}).attach(this),this.rotation.subscribe(t=>{this.ƀfc?this.ƀfc=false:this.p2Body.angle=t.value;}).attach(this),this.velocity.subscribe(t=>{this.ƀfe?this.ƀfe=false:this.p2Body.velocity=[t.x,t.y];}).attach(this),this.rotationalSpeed.subscribe(t=>{this.ƀfd?this.ƀfd=false:this.p2Body.angularVelocity=t;}).attach(this);}};var hs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ls=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},v=class extends k{static{h(this,"PhysicsWorldEntity");}constructor(t,e,i,r,o,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=o,this.physicsBodyGroupToP2Group=n,this.physicsBodyGroupToP2Mask=a;}};v=hs([ft(),ls("design:paramtypes",[helpersLib.Vector,Boolean,U__default.default.World,Map,Map,Map,Map])],v);var fs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},K=class{static{h(this,"PhysicsBodyGroupService");}createBodyGroupsAndMasks(t,e){let i=new Map,r=new Map;return t.map((o,n)=>{if(n>31)return console.error("Cannot have more than 32 physics body groups"),{};i.set(o,1<<n),r.set(o,0);}),e.map(([o,n])=>{if(!i.has(o))throw new Error(`Physics body group "${o}" not found`);if(!i.has(n))throw new Error(`Physics body group "${n}" not found`);let a=r.get(o),l=r.get(n),c=i.get(o),p=i.get(n);r.set(o,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),o=t.physicsBodyGroupToP2Mask.get(e),n=t.physicsBodyGroupToP2Group.get(i),a=t.physicsBodyGroupToP2Mask.get(i);return (o&n)!==0&&(a&r)!==0}};K=fs([d()],K);var us=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ms=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ve=class{static{h(this,"AvailabilityGridCacheService");}constructor(t){this.ƀhl=t;}getCollidableGrids(t,e){let i=[];return t.availabilityGridCache.forEach((r,o)=>{r.forEach((n,a)=>{this.ƀhl.canCollide(t,a,e)&&i.push({grid:n,cellSize:o});});}),i}get(t,e,i){return t.availabilityGridCache.get(e)?.get(i)}set(t,e,i,r){let o=t.availabilityGridCache.get(e);o||(o=new Map,t.availabilityGridCache.set(e,o)),o.set(i,r);}clear(t){t.availabilityGridCache.clear();}};Ve=us([d(),ms("design:paramtypes",[K])],Ve);var gs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ys=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},nt=class{static{h(this,"AvailabilityGridService");}constructor(t,e){this.ƀhl=t,this.ƀy=e;}onBodyAdded(t,e,i){e.aabbNeedsUpdate=true,e.updateAABB();let r=u.aabbToBoundingBox(e.aabb);this.ƀy.getCollidableGrids(t,i).forEach(o=>{let n=D.areaToGridArea(r,o.cellSize);o.grid.setArea(n,false);});}findClosestAvailableSpace(t,e,i,r=Dt){return e.aabbNeedsUpdate=true,e.updateAABB(),Jt.findByConvertingGridSpace(this.getAvilabilityGrid(t,r,i),u.aabbToBoundingBox(e.aabb),r)}getAvilabilityGrid(t,e,i){let r=this.ƀy.get(t,e,i);return r||(r=this.ƀbx(t,e,i),this.ƀy.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(o=>{let n=b.getFromP2BodyIDOrFail(o.id);if(n.includeInPathfinding&&this.ƀhl.canCollide(t,n.physicsBodyGroup,i)){let a=this.ƀdu(o,e);r.setArea(a,false);}}),r}ƀdu(t,e){let i=u.aabbToBoundingBox(t.aabb);return D.areaToGridArea(i,e)}};nt=gs([d(),ys("design:paramtypes",[K,Ve])],nt);var vs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},bs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Dt=50,Bt=class{static{h(this,"PathFinderService");}constructor(t){this.ƀhk=t;}findPathAStar(t,e,i,r,o){o||(o={}),o.neighborType===void 0&&(o.neighborType=helpersLib.GridNeighborType.Ortogonal),o.gridCellSize===void 0&&(o.gridCellSize=Dt);let n=v.getInstanceByIDOrFail(t),a,l;helpersLib.Comparator.isNumber(i)?(l=b.getPhysicsInstanceOrFail(i).p2Body,a=u.arrayToVector(l.position)):a=i;let c=D.positionToGridPosition(e,o.gridCellSize),p=D.positionToGridPosition(a,o.gridCellSize),m=this.ƀhk.getAvilabilityGrid(n,o.gridCellSize,r);if(l){let R=u.aabbToBoundingBox(l.aabb),bt=D.areaToGridArea(R,o.gridCellSize);m.setArea(bt,true);}let g=Yt.findPath(m,c,p,o.neighborType);return g.path=g.path.map(R=>D.gridPositionToPosition(R,o.gridCellSize)),g}findPathDirection(t,e,i,r,o=Dt){let n=v.getInstanceByIDOrFail(t),a;if(helpersLib.Comparator.isNumber(i)){let g=b.getPhysicsInstanceOrFail(i);a=u.aabbToBoundingBox(g.p2Body.aabb);}else a=new helpersLib.Rectangle(i,i);let l=D.areaToGridArea(a,o),c=JSON.stringify({targetGridArea:l,collidableWithGroup:r}),p=n.vectorFieldCache.get(c);if(!p){let g=this.ƀhk.getAvilabilityGrid(n,o,r);p=new Xt(l,g),n.vectorFieldCache.set(c,p);}let m=D.positionToGridPosition(e,o);return p.getDirectionToTarget(m)}};Bt=vs([d(),bs("design:paramtypes",[nt])],Bt);var Ts=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},H=new $;exports.PhysicsGateway=class bi{static{h(this,"PhysicsGateway");}createPhysicsWorld(t){return H.trigger("createPhysicsWorld",t)}getMapSize(t){return H.trigger("getMapSize",t)}setPaused(t,e){return H.trigger("setPaused",t,e)}hitTest(t,e){return H.trigger("hitTest",t,e)}findPath(t,e,i,r,o){return H.trigger("findPath",t,e,i,r,o)}findPathDirection(t,e,i,r){return H.trigger("findPathDirection",t,e,i,r)}applyImpulse(t,e,i,r){return H.trigger("applyImpulse",t,e,i,r)}createExplosion(t,e,i,r,o,n){return H.trigger("createExplosion",t,e,i,r,o,n)}createElipticExplosion(t,e,i,r,o,n,a){return H.trigger("createElipticExplosion",t,e,i,r,o,n,a)}printPathfindingTestGrid(t,e,i,r,o,n=Dt){return H.trigger("printPathfindingTestGrid",t,e,i,r,o,n)}};exports.PhysicsGateway=Ts([d()],exports.PhysicsGateway);var Es=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Rs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Q=class{static{h(this,"TestVisualsService");}constructor(t,e){this.ƀz=t,this.ƀhh=e;}printPathfindingTestGrid(t,e,i,r,o,n){let a=v.getInstanceByIDOrFail(t);this.ƀz.getAvilabilityGrid(a,n,r).map((c,p)=>({position:D.gridPositionToPosition(p,n),availability:c})).forEach(c=>{if(c.position.isInsideRectangle(o)){let p=this.ƀhh.findPathDirection(t,c.position,i,r),m;p===void 0?m=E.createRectangleBorders(new helpersLib.Vector(8,8),2,helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).attach(a):m=E.createArrow(25,c.availability?helpersLib.ColorHelper.green:helpersLib.ColorHelper.red).toSprite().displayParent(e).setPosition(c.position,{round:false}).setRotation(p).attach(a),new M(m,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>m.destroy()).attach(m);}});}createExplosionDebugVisual(t,e,i,r,o,n=300){let a=new f().displayParent(e).setAlpha(.5).attach(t);E.createCircle(o,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 M(a,"alpha",{duration:n,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}createElipticExplosionDebugVisual(t,e,i,r,o,n,a=300){let l=new f().displayParent(e).setAlpha(.5).attach(t);E.createElipse(n,helpersLib.ColorHelper.blue).toSprite().displayParent(l).setPosition(r,{round:false}).setRotation(o).setAlpha(.5).attach(t),i.forEach(p=>{let m=p.hits.length>0?helpersLib.ColorHelper.red:helpersLib.ColorHelper.white;E.createVector(p.line.from,p.line.to,m).toSprite().displayParent(l).attach(t);}),new M(l,"alpha",{duration:a,animation:P.easeIn}).animate({alpha:0}).tap(()=>l.destroy()).attach(l);}createPhysicsEntityShapeVisual(t,e,i){let r=i?.overridePosition??u.arrayToVector(t.position),o=i?.overrideRotation??new helpersLib.Radian(t.angle),n=i?.color??helpersLib.ColorHelper.blue,a=new f().displayParent(e).setPosition(r,{round:false}).setRotation(o).setAlpha(.5).attachToRoot();t.shapes.forEach(c=>{this.ƀcq(c,n).displayParent(a).attachToRoot();}),new M(a,"alpha",{duration:1e3,animation:P.easeIn}).animate({alpha:0}).tap(()=>a.destroy()).attach(a);}ƀcq(t,e){switch(t.type){case U__default.default.Shape.PARTICLE:throw new Error("Not implemented");case U__default.default.Shape.LINE:throw new Error("Not implemented");case U__default.default.Shape.PLANE:throw new Error("Not implemented");case U__default.default.Shape.CIRCLE:throw new Error("Not implemented");case U__default.default.Shape.CAPSULE:throw new Error("Not implemented");case U__default.default.Shape.BOX:throw new Error("Not implemented");case U__default.default.Shape.HEIGHTFIELD:throw new Error("Not implemented");case U__default.default.Shape.CONVEX:return this.ƀcp(t,e);default:throw new Error("Not implemented")}}ƀcp(t,e){let i=[t.vertices.map(r=>({x:r[0],y:r[1]}))];return E.createPolygon(i,e).toSprite()}};Q=Es([d(),Rs("design:paramtypes",[nt,Bt])],Q);var As=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Os=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Le=class{static{h(this,"HitTestService");}constructor(t){this.ƀjx=t;}hitTest(t,e){let i=t.world,r=b.getFromP2BodyIDOrFail(t.id),o=u.cloneP2Body(t);this.ƀt(o,e);let n=i.broadphase.aabbQuery(i,this.ƀdi(o)).map(l=>b.getFromP2BodyIDOrFail(l.id)).filter(l=>l.includeInPathfinding).filter(l=>r.canCollideWith(l)).map(l=>u.cloneP2Body(l.p2Body)),a=false;if(n.length!==0){let l=new U__default.default.World;l.addBody(o),n.forEach(c=>l.addBody(c)),l.step(1,1,1),a=l.narrowphase.contactEquations.some(c=>c.bodyA===o||c.bodyB===o),l.clear();}if(e?.testLayerID){let l=a?helpersLib.ColorHelper.red:helpersLib.ColorHelper.green;this.ƀjx.createPhysicsEntityShapeVisual(t,e.testLayerID,{overridePosition:e.overridePosition,overrideRotation:e.overrideRotation,color:l});}return a}ƀt(t,e){e?.overridePosition&&(t.position=u.vectorToArray(e.overridePosition)),e?.overrideRotation&&(t.angle=e.overrideRotation.value);}ƀdi(t){return t.aabbNeedsUpdate=true,t.updateAABB(),t.aabb}};Le=As([d(),Os("design:paramtypes",[Q])],Le);var Ds=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Ne=class{static{h(this,"CollisionsService");}registerPhysicsWorld(t){t.p2World.on("beginContact",e=>{e.contactEquations.forEach(i=>{this.ƀig(t,i);});});}step(t,e,i){b.getPhysicsEntities().forEach(r=>{r.ƀax=[];}),t.p2World.narrowphase.contactEquations.forEach(r=>{this.ƀig(t,r);}),t.bodiesInContactWith.forEach((r,o)=>{this.ƀer(r.p2Body),r.entity.ƀiz(t.collisionReports.get(o)||[]);}),t.bodiesInContactWith.clear(),t.collisionReports.clear();}ƀer(t){let e=u.arrayToVector(t.velocity);e.length>yi&&(e=e.normalize(yi),t.velocity=u.vectorToArray(e)),t.angularVelocity=Math.min(Math.max(t.angularVelocity,-wi),wi);}ƀig(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 o=t.collisionReports.get(e.bodyA.id)||[],n=t.collisionReports.get(e.bodyB.id)||[],{collisionDetailsA:a,collisionDetailsB:l}=this.ƀdn(i,r,e);o.push({self:a,target:l}),n.push({self:l,target:a}),t.collisionReports.set(e.bodyA.id,o),t.collisionReports.set(e.bodyB.id,n);}else console.warn("ContactEquationOrganiser: Entity not found for contact equation",e);}ƀdn(t,e,i){let r=t.convertToDTO(),o=e.convertToDTO(),n=u.arrayToVector(i.contactPointA),a=u.arrayToVector(i.contactPointB),{normalA:l,normalB:c}=this.ƀec(i);return {collisionDetailsA:this.ƀdm(r,i.bodyA.mass,n,l,t.area),collisionDetailsB:this.ƀdm(o,i.bodyB.mass,a,c,e.area)}}ƀdm(t,e,i,r,o){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:o,normal:r}}ƀec(t){let e=u.arrayToVector(t.normalA),i=e.multiplyNumber(-1);return {normalA:e,normalB:i}}};Ne=Ds([d()],Ne);var Bs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Gs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},je=class extends re{static{h(this,"BorderEntity");}constructor(t,e){super(t,e);}};je=Bs([ft(),Gs("design:paramtypes",[Number,Object])],je);var _s=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},W=1e4,He=class{static{h(this,"BorderService");}createBorders(t,e,i){this.ƀbr(t,new helpersLib.Vector(e.x/2,-W/2),new helpersLib.Vector(e.x+W*2,W),i),this.ƀbr(t,new helpersLib.Vector(e.x/2,e.y+W/2),new helpersLib.Vector(e.x+W*2,W),i),this.ƀbr(t,new helpersLib.Vector(-W/2,e.y/2),new helpersLib.Vector(W,e.y+W*2),i),this.ƀbr(t,new helpersLib.Vector(e.x+W/2,e.y/2),new helpersLib.Vector(W,e.y+W*2),i);}ƀbr(t,e,i,r){return new je(t,{shapeDefinition:{materialName:st,group:r,shapeType:exports.PhysicsShapeType.Rectangle,shapeData:i},position:e,rotation:helpersLib.Radian.get0,addInEmptySpace:false,includeOnPathfinding:true}).attachByID(t)}};He=_s([d()],He);var Vs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},sr=new U__default.default.Material,Ls={id:st,density:Number.MAX_SAFE_INTEGER,velocityDrag:1,rotationalDrag:1},Gt=class{static{h(this,"MaterialsService");}createMaterials(t,e,i,r){let o=new Map,n=new Map;if(i.forEach(a=>{o.set(a.id,new U__default.default.Material),n.set(a.id,a);}),o.has(st))throw new Error(`Material with name ${st} cannot be defined, pick another name for the material.`);return o.set(st,sr),n.set(st,Ls),this.ƀc(t,e,i,r,o),{materials:o,materialDefinitions:n}}getMaterial(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀea(e,i.materials)}getMaterialDefinition(t,e){let i=v.getInstanceByIDOrFail(t);return this.ƀdz(e,i.materialDefinitions)}ƀea(t,e){let i=e.get(t);if(!i)throw new Error(`Could not find material with name ${t}.`);return i}ƀdz(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,o){this.ƀdr(i.map(n=>n.id),r).forEach(n=>{let a=this.ƀea(n.materialA,o),l=this.ƀea(n.materialB,o);t.addContactMaterial(new U__default.default.ContactMaterial(a,l,{friction:n.friction,restitution:n.bounciness,stiffness:n.stiffness,relaxation:n.relaxation}));}),this.ƀd(t,e,i,o);}ƀdr(t,e){let i=new Map;e.forEach(o=>{let n=i.get(o.materialA);n||(n=new Map,i.set(o.materialA,n)),n.set(o.materialB,o);});let r=[];return t.forEach((o,n)=>{for(let a=n;a<t.length;a++){let l=t[a],c=i.get(o)?.get(l);c?r.push(c):r.push({materialA:o,materialB:l,friction:0,bounciness:0,relaxation:4,stiffness:1e6});}}),r}ƀd(t,e,i,r){i.forEach(o=>{let n=this.ƀea(o.id,r);t.addContactMaterial(new U__default.default.ContactMaterial(n,sr,{friction:e.friction,restitution:e.bounciness,stiffness:e.stiffness,relaxation:e.relaxation}));});}};Gt=Vs([d()],Gt);var Ns=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},js=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},_t=class{static{h(this,"PhysicsWorldService");}constructor(t,e,i,r,o){this.ƀgg=t,this.ƀai=e,this.ƀz=i,this.ƀay=r,this.ƀhl=o;}createPhysicsWorld(t){let e=new U__default.default.World({gravity:[0,0]}),{materials:i,materialDefinitions:r}=this.ƀgg.createMaterials(e,t.borderProperties,t.materialDefinitions,t.materialContactDefinitions),{physicsBodyGroupToP2Group:o,physicsBodyGroupToP2Mask:n}=this.ƀhl.createBodyGroupsAndMasks(t.physicsBodyGroups,t.interactingBodyGroups),a=new v(t.mapSize,t.modifyUpdateCycle,e,i,r,o,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.ƀjr(a,l,c)):y.beforeSceneUpdateAction.subscribe(({time:l,delta:c})=>{this.ƀjr(a,l,c);}).attach(a),a.id}addBody(t,e,i,r,o){let n=v.getInstanceByIDOrFail(t);if(i){let a=this.ƀz.findClosestAvailableSpace(n,e,r);return a?(e.position[0]+=a.x,e.position[1]+=a.y,n.p2World.addBody(e),o&&this.ƀz.onBodyAdded(n,e,r),true):false}else return n.p2World.addBody(e),o&&this.ƀz.onBodyAdded(n,e,r),true}removeBody(t,e){v.getInstanceByID(t)?.p2World.removeBody(e);}ƀjr(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);}};_t=Ns([d(),js("design:paramtypes",[Gt,He,nt,Ne,K])],_t);var Ws=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Vt=class{static{h(this,"RayCastingService");}castClosest(t,e,i){let r=new U__default.default.RaycastResult,o=new U__default.default.Ray({mode:U__default.default.Ray.CLOSEST,from:u.vectorToArray(e.from),to:u.vectorToArray(e.to),collisionGroup:t.physicsBodyGroupToP2Group.get(i),collisionMask:t.physicsBodyGroupToP2Mask.get(i)});if(t.p2World.raycast(r,o),r.hasHit())return this.ƀbm(r,e)}castAllFirstContacts(t,e,i){let r=new Map,o=new U__default.default.Ray({mode:U__default.default.Ray.ALL,from:u.vectorToArray(e.from),to:u.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 U__default.default.RaycastResult,o),Array.from(r.values())}ƀbm(t,e){let i=t.fraction,r=u.arrayToVector(t.normal),o,n,a;return {body:t.body,hitPosition:h(()=>(o===void 0&&(o=e.from.lerp(e.to,i)),o),"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}}};Vt=Ws([d()],Vt);var Us=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},lt=class{static{h(this,"ImpactService");}applyImpulse(t,e,i,r){let o=i.normalize(r),n=[e.x-t.position[0],e.y-t.position[1]];t.applyImpulse(u.vectorToArray(o),n);}};lt=Us([d()],lt);var $s=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Lt=class{static{h(this,"RayCastHitConverterService");}toExplosionHits(t,e=true){let i=new Map;return t.forEach(r=>{r.hits.forEach(o=>{let n=i.get(o.body);if(n){let a=o.fraction<n.closestRaycastHit.fraction?o:n.closestRaycastHit;n.rayCastHits.push(o),i.set(o.body,{hitCount:n.hitCount+1,closestRaycastHit:a,rayCastHits:n.rayCastHits,isExternal:e?n.isExternal:n.isExternal&&o.isExternal(),explosionCenter:o.line.from});}else {let a=o.isExternal();i.set(o.body,{hitCount:1,closestRaycastHit:o,rayCastHits:[o],isExternal:a,explosionCenter:o.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 o=u.arrayToVector(t.closestRaycastHit.body.position);return {body:b.getFromP2BodyIDOrFail(t.closestRaycastHit.body.id).convertToDTO(),p2Body:t.closestRaycastHit.body,isExternal:false,normal:helpersLib.Vector.fromTo(o,t.explosionCenter).normalize(),fraction:0,ratioOfHits:i,raycastResults:r,getHitPosition:h(()=>t.explosionCenter,"getHitPosition"),getHitDistance:h(()=>0,"getHitDistance")}}}};Lt=$s([d()],Lt);var zs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Js=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Ks=15,Ue=class{static{h(this,"ElipticExplosionService");}constructor(t,e,i,r){this.ƀic=t,this.ƀjx=e,this.ƀib=i,this.ƀff=r;}createElipticExplosion(t,e,i,r,o,n,a){let l=v.getInstanceByIDOrFail(t),c=this.ƀcc(e,i,r,o,a?.hitOnlyClosest===true,l),p=this.ƀib.toExplosionHits(c,false);return this.ƀr(p,n),a?.testLayerID&&this.ƀjx.createElipticExplosionDebugVisual(l,a.testLayerID,c,e,i,r,a.debugRayDuration),p.map(m=>{let{p2Body:g,...R}=m;return R})}ƀcc(t,e,i,r,o,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 m=l.normalize(i.y);a.push(new helpersLib.Line(t,t.add(m))),a.push(new helpersLib.Line(t,t.add(m.multiplyNumber(-1))));let g=Math.round(i.y/Ks),R=i.y/(g*2+1)*2,bt=l.normalize(R),oe=i.x,ar=Math.pow(i.y,2);return helpersLib.ArrayHelper.createIntegerArray(g).forEach(pt=>{let Pt=R*(pt+1),Ti=bt.multiplyNumber(pt+1),se=c.normalize(this.ƀek(oe,ar,Pt)),ne=t.add(Ti);a.push(new helpersLib.Line(ne,ne.add(se))),a.push(new helpersLib.Line(ne,ne.add(se.multiplyNumber(-1))));let ae=t.add(Ti.multiplyNumber(-1));a.push(new helpersLib.Line(ae,ae.add(se))),a.push(new helpersLib.Line(ae,ae.add(se.multiplyNumber(-1))));}),a.map(pt=>{if(o){let Pt=this.ƀic.castClosest(n,pt,r);return {line:pt,hits:Pt?[Pt]:[]}}else {let Pt=this.ƀic.castAllFirstContacts(n,pt,r);return {line:pt,hits:Pt}}})}ƀek(t,e,i){return Math.sqrt(1-Math.pow(i,2)/e)*t}ƀr(t,e){t.forEach(i=>{i.raycastResults.forEach(r=>{let o,n;r.isExternal()?(o=r.line.fromTo,n=e*2):(o=r.line.fromTo.multiplyNumber(-1),n=e*(1-r.fraction)*8),this.ƀff.applyImpulse(r.body,r.hitPosition(),o,n);});});}};Ue=zs([d(),Js("design:paramtypes",[Vt,Q,Lt,lt])],Ue);var Zs=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Qs=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},$e=class{static{h(this,"ExplosionService");}constructor(t,e,i,r){this.ƀic=t,this.ƀjx=e,this.ƀib=i,this.ƀff=r;}createExplosion(t,e,i,r,o,n){let a=v.getInstanceByIDOrFail(t),l=this.ƀeh(i),c=this.ƀcc(e,i,r,l,n?.hitOnlyClosest===true,a),p=this.ƀib.toExplosionHits(c);return this.ƀr(e,i,o,l,p),n?.testLayerID&&this.ƀjx.createExplosionDebugVisual(a,n.testLayerID,c,e,i,n.debugRayDuration),p}ƀcc(t,e,i,r,o,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(o){let m=this.ƀic.castClosest(n,p,i);return {line:p,hits:m?[m]:[]}}else {let m=this.ƀic.castAllFirstContacts(n,p,i);return {line:p,hits:m}}})}ƀr(t,e,i,r,o){o.forEach(n=>{if(n.isExternal)n.raycastResults.forEach(a=>{let l=i*(1-a.fraction);this.ƀff.applyImpulse(a.body,a.hitPosition(),a.line.fromTo,l);});else {let a=helpersLib.Vector.fromTo(t,u.arrayToVector(n.p2Body.position)),l=a.length/e,c=i*r*l/2;this.ƀff.applyImpulse(n.p2Body,n.getHitPosition(),a,c);}});}ƀeh(t){return t>100?Math.floor(t*.3):Math.floor(t*.26+4)}};$e=Zs([d(),Qs("design:paramtypes",[Vt,Q,Lt,lt])],$e);var on=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},Nt=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)}};Nt=on([d()],Nt);var sn=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},nn=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Pi=class{static{h(this,"PhysicsController");}constructor(t,e,i,r,o,n,a,l){this.ƀhs=t,this.ƀhh=e,this.ƀjx=i,this.ƀda=r,this.ƀcu=o,this.ƀew=n,this.ƀhr=a,this.ƀff=l;}createPhysicsWorld(t){return this.ƀhs.createPhysicsWorld(t)}getMapSize(t){return this.ƀhr.getMapSize(t)}setPaused(t,e){this.ƀhs.setPaused(t,e);}hitTest(t,e){let i=b.getPhysicsInstanceOrFail(t);return this.ƀew.hitTest(i.p2Body,e)}findPath(t,e,i,r,o){return this.ƀhh.findPathAStar(t,e,i,r,{neighborType:o})}findPathDirection(t,e,i,r){return this.ƀhh.findPathDirection(t,e,i,r)}applyImpulse(t,e,i,r){let o=b.getPhysicsInstanceOrFail(t);this.ƀff.applyImpulse(o.p2Body,e,i,r);}createExplosion(t,e,i,r,o,n){return this.ƀda.createExplosion(t,e,i,r,o,n)}createElipticExplosion(t,e,i,r,o,n,a){return this.ƀcu.createElipticExplosion(t,e,i,r,o,n,a)}printPathfindingTestGrid(t,e,i,r,o,n){this.ƀjx.printPathfindingTestGrid(t,e,i,r,o,n);}};Pi=sn([q({controllerLink:H}),nn("design:paramtypes",[_t,Bt,Q,$e,Ue,Le,Nt,lt])],Pi);var an=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ke=class{static{h(this,"ShapeCreationService");}createBody(t,e,i,r,o){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,o);case exports.PhysicsShapeType.Circle:return this.ƀbt(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,o);case exports.PhysicsShapeType.Polygon:return this.ƀcb(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,o);case exports.PhysicsShapeType.Rectangle:return this.ƀcd(n,e.shapeDefinition.shapeData,i,r,e.shapeDefinition.group,o);default:{e.shapeDefinition.shapeType;throw new Error(`Unexpected case! "${e.shapeDefinition.shapeType}"`)}}}ƀbt(t,e,i,r,o,n){let a=new U__default.default.Circle({collisionGroup:t.physicsBodyGroupToP2Group.get(o),collisionMask:t.physicsBodyGroupToP2Mask.get(o),radius:e});a.material=i;let l=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:r.density,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return l.addShape(a),l}ƀcb(t,e,i,r,o,n){let a=t.physicsBodyGroupToP2Group.get(o),l=t.physicsBodyGroupToP2Mask.get(o),c=e.map(g=>new U__default.default.Convex({vertices:g.map(R=>[R.x,R.y]),collisionGroup:a,collisionMask:l})).map(g=>(g.material=i,g)),p=c.reduce((g,R)=>g+R.area,0),m=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:p,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.forEach(g=>m.addShape(g)),m.setDensity(r.density),m}ƀcd(t,e,i,r,o,n){let a=new U__default.default.Box({width:e.x,height:e.y,collisionGroup:t.physicsBodyGroupToP2Group.get(o),collisionMask:t.physicsBodyGroupToP2Mask.get(o)});a.material=i;let l=e.x*e.y,c=new U__default.default.Body({type:n==="dynamic"?U__default.default.Body.DYNAMIC:U__default.default.Body.STATIC,mass:l,damping:r.velocityDrag,angularDamping:r.rotationalDrag});return c.addShape(a),c.setDensity(r.density),c}};ke=an([d()],ke);var hn=function(s,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,t,e,i);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(o=(r<3?n(o):r>3?n(t,e,o):n(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},ln=function(s,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,t)},Si=class{static{h(this,"PhysicsInternalController");}constructor(t,e,i,r,o){this.ƀhs=t,this.ƀhq=e,this.ƀje=i,this.ƀhr=r,this.ƀhl=o;}createBody(t,e,i,r,o){return this.ƀje.createBody(t,e,i,r,o)}getMaterial(t,e){return this.ƀhq.getMaterial(t,e)}getMaterialDefinition(t,e){return this.ƀhq.getMaterialDefinition(t,e)}getGroupConstant(t,e){return this.ƀhl.getGroupConstant(t,e)}getMaskConstant(t,e){return this.ƀhl.getMaskConstant(t,e)}addBody(t,e,i,r,o){return this.ƀhs.addBody(t,e,i,r,o)}removeBody(t,e){this.ƀhs.removeBody(t,e);}subscribeToPhysicsStep(t,e){return this.ƀhr.subscribeToPhysicsStep(t,e)}};Si=hn([q({controllerLink:X}),ln("design:paramtypes",[_t,Gt,ke,Nt,K])],Si);exports.AnimationFlicker=Ai;exports.AnimationInterpolationFunctions=J;exports.Animations=P;exports.Animator=M;exports.BORDER_MATERIAL_NAME=st;exports.BardLegendsHardReset=G;exports.Camera=Zt;exports.ClosestAvailableSpaceHelper=Jt;exports.Container=f;exports.ControllerDecorator=q;exports.ControllerLink=$;exports.DEFAULT_SHADER_RESOLUTION=A;exports.DeltaTime=ti;exports.DisplayObjectArray=ci;exports.Entity=k;exports.EntityDecorator=ft;exports.FadeInContent=Bi;exports.FadeInStateAnimation=xe;exports.Game=x;exports.Graphics=E;exports.ImmovablePhysicsEntity=re;exports.MenuEntity=di;exports.MenuUI=te;exports.MenuView=fi;exports.MovableEntity=xi;exports.MovablePhysicsEntity=vi;exports.PathFinder=Yt;exports.PhysicsEntity=b;exports.Placeholder=ai;exports.PositionConversionHelper=Wt;exports.ROTATIONAL_SPEED_LIMIT=wi;exports.RichText=hi;exports.SPEED_LIMIT=yi;exports.Scene=he;exports.SceneDecorator=yr;exports.ScrollAreaUI=ui;exports.ScrollMaskUI=yt;exports.Service=T;exports.ServiceDecorator=d;exports.SingletonEntity=ut;exports.SlideInContent=ji;exports.SlideInContentByIndex=qe;exports.SlideStateAnimation=Se;exports.Sprite=Y;exports.StateAnimation=we;exports.Text=qt;exports.UpdatableContainer=li;exports.UpdateCycle=y;exports.VectorFieldPathFinder=Xt;exports.VectorSet=xt;exports.View=dt;exports.ViewDecorator=Je;