bard-legends-framework 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -81,7 +81,7 @@ declare class BardLegendsHardReset {
81
81
  static hardReset(): void;
82
82
  }
83
83
 
84
- type SceneClassType = new (...services: unknown[]) => Scene<unknown, unknown>;
84
+ type SceneClassType = new (...services: any[]) => Scene<any, any>;
85
85
  type SceneInput<T> = T extends Scene<infer I, any> ? I : never;
86
86
  declare function SceneDecorator(): (SceneClass: SceneClassType) => any;
87
87
  declare abstract class Scene<InputType, OutputType> extends IDAttachable {
@@ -89,16 +89,16 @@ declare abstract class Scene<InputType, OutputType> extends IDAttachable {
89
89
  static readonly activeScene: actions_lib.PersistentNotifier<Scene<unknown, unknown> | undefined>;
90
90
  static getActiveSceneOrFail(this: typeof Scene): Scene<unknown, unknown>;
91
91
  static cancelActiveScene(): IdleSingleEvent;
92
- static isActive<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): boolean;
93
- static getInstance<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T | undefined;
94
- static getInstanceOrFail<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T;
95
- static open<T extends Scene<any, any>>(this: new (...args1: unknown[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): IdleSingleEvent<T>;
92
+ static isActive<T extends Scene<any, any>>(this: new (...args: any[]) => T): boolean;
93
+ static getInstance<T extends Scene<any, any>>(this: new (...args: any[]) => T): T | undefined;
94
+ static getInstanceOrFail<T extends Scene<any, any>>(this: new (...args: any[]) => T): T;
95
+ static open<T extends Scene<any, any>>(this: new (...args1: any[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): IdleSingleEvent<T>;
96
96
  readonly onClose: actions_lib.PersistentSingleNotifier<OutputType>;
97
97
  constructor();
98
98
  close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): IdleSingleEvent<OutputType>;
99
- protected abstract init(input: InputType): IdleSingleEvent;
100
- protected abstract update(time: number, delta: number): void;
101
- protected abstract prepareToClose(): IdleSingleEvent;
99
+ protected abstract init: (input: InputType) => IdleSingleEvent;
100
+ protected abstract update: (time: number, delta: number) => void;
101
+ protected abstract prepareToClose: (output: OutputType | 'cancel') => IdleSingleEvent;
102
102
  /**
103
103
  * @deprecated
104
104
  */
@@ -140,7 +140,7 @@ declare abstract class View extends IDAttachable {
140
140
  static getInstanceOrFail<T extends View>(this: new (...args: any[]) => T, entityID: number): T;
141
141
  constructor();
142
142
  destroy(): void;
143
- update(time: number, delta: number): void;
143
+ update: (time: number, delta: number) => void;
144
144
  }
145
145
 
146
146
  type AudioAppearTransitionType = 'ease' | 'instant';
package/dist/index.d.ts CHANGED
@@ -81,7 +81,7 @@ declare class BardLegendsHardReset {
81
81
  static hardReset(): void;
82
82
  }
83
83
 
84
- type SceneClassType = new (...services: unknown[]) => Scene<unknown, unknown>;
84
+ type SceneClassType = new (...services: any[]) => Scene<any, any>;
85
85
  type SceneInput<T> = T extends Scene<infer I, any> ? I : never;
86
86
  declare function SceneDecorator(): (SceneClass: SceneClassType) => any;
87
87
  declare abstract class Scene<InputType, OutputType> extends IDAttachable {
@@ -89,16 +89,16 @@ declare abstract class Scene<InputType, OutputType> extends IDAttachable {
89
89
  static readonly activeScene: actions_lib.PersistentNotifier<Scene<unknown, unknown> | undefined>;
90
90
  static getActiveSceneOrFail(this: typeof Scene): Scene<unknown, unknown>;
91
91
  static cancelActiveScene(): IdleSingleEvent;
92
- static isActive<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): boolean;
93
- static getInstance<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T | undefined;
94
- static getInstanceOrFail<T extends Scene<unknown, unknown>>(this: new (...args: unknown[]) => T): T;
95
- static open<T extends Scene<any, any>>(this: new (...args1: unknown[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): IdleSingleEvent<T>;
92
+ static isActive<T extends Scene<any, any>>(this: new (...args: any[]) => T): boolean;
93
+ static getInstance<T extends Scene<any, any>>(this: new (...args: any[]) => T): T | undefined;
94
+ static getInstanceOrFail<T extends Scene<any, any>>(this: new (...args: any[]) => T): T;
95
+ static open<T extends Scene<any, any>>(this: new (...args1: any[]) => T, ...args2: T extends Scene<void, any> ? [] : [SceneInput<T>]): IdleSingleEvent<T>;
96
96
  readonly onClose: actions_lib.PersistentSingleNotifier<OutputType>;
97
97
  constructor();
98
98
  close(...args: void extends OutputType ? (OutputType extends void ? [] : [OutputType]) : [OutputType]): IdleSingleEvent<OutputType>;
99
- protected abstract init(input: InputType): IdleSingleEvent;
100
- protected abstract update(time: number, delta: number): void;
101
- protected abstract prepareToClose(): IdleSingleEvent;
99
+ protected abstract init: (input: InputType) => IdleSingleEvent;
100
+ protected abstract update: (time: number, delta: number) => void;
101
+ protected abstract prepareToClose: (output: OutputType | 'cancel') => IdleSingleEvent;
102
102
  /**
103
103
  * @deprecated
104
104
  */
@@ -140,7 +140,7 @@ declare abstract class View extends IDAttachable {
140
140
  static getInstanceOrFail<T extends View>(this: new (...args: any[]) => T, entityID: number): T;
141
141
  constructor();
142
142
  destroy(): void;
143
- update(time: number, delta: number): void;
143
+ update: (time: number, delta: number) => void;
144
144
  }
145
145
 
146
146
  type AudioAppearTransitionType = 'ease' | 'instant';
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'),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 V__namespace=/*#__PURE__*/_interopNamespace(V);var U__default=/*#__PURE__*/_interopDefault(U);var gr=Object.defineProperty;var h=(o,t)=>gr(o,"name",{value:t,configurable:true});function q(){return class{static{h(this,"GatewayBase");}}}h(q,"Gateway");function Di(o,t){let e=o.prototype,i=Object.getPrototypeOf(t);for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let s=t[r];if(typeof s=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=s.bind(t);}}}h(Di,"bindControllerToGateway");var R=class{static{h(this,"BardLegendsHardReset");}static{this.ƀfg=new actionsLib.Action;}static{this.onHardReset=this.ƀfg.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀfg.trigger();}};function d(){return function(o){let t=S.ƀep(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var S=class{static{h(this,"Service");}static{this.ƀjv=new Map;}static get(t){let e=this.ƀjv.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀjk(t.$meta.paramtypes);e=new t(...i),this.ƀjv.set(t,e);}return e}static ƀep(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjk(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};R.onHardReset.subscribe(()=>{S.ƀjv=new Map;}).attachToRoot();function Q(o){return function(t){let e=S.ƀep(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=S.ƀjk(e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);Di(o,r);}t.$meta={type:"controller"};}}h(Q,"ControllerDecorator");var m=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀjo=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀjo.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀll=0;}static{this.ƀlt=void 0;}static wait(t){let e=this.ƀll+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀlt)this.ƀlt=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlt=void 0;}static triggerUpdateTick(t){this.ƀlt&&(t=this.ƀlt(this.ƀll,t)),this.ƀll+=t,this.ƀgi=t,t>0&&(o.ƀad.trigger({time:this.ƀll,delta:t}),o.ƀjo.trigger({time:this.ƀll,delta:t}),o.ƀf.trigger({time:this.ƀll,delta:t}));}static get lastDelta(){return this.ƀgi}static{this.ƀgi=0;}};R.onHardReset.subscribe(()=>{m.ƀad.clear(),m.ƀjo.clear(),m.ƀf.clear(),m.ƀlt=void 0,m.ƀll=0;}).attachToRoot();var O=class o{static{h(this,"EntityStoreHelper");}static{this.ƀax=new Map;}static registerEntityClass(t){this.ƀax.set(t.id,new Map);}static registerEntity(t){let e=this.ƀax.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀax.get(i)?.delete(e);}static getEntity(t,e){return this.ƀax.get(t.id)?.get(e)}static getSingleton(t){let e=o.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀax.get(t.id);return Array.from(e.values())}};R.onHardReset.subscribe(()=>{O.ƀax.clear();}).attachToRoot();function Qe(o){return function(t){t.$meta={paramtypes:S.ƀep(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Qe,"ViewDecorator");var mt=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.ƀde=rt.entityID,this.ƀew().set(this.ƀde,this);}destroy(){this.destroyed||(super.destroy(),this.ƀew().delete(this.ƀde));}update(t,e){}ƀew(){return this.constructor.$meta.viewInstances}};var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀmd=new Map;}static registerView(t,e){o.ƀmd.has(e)||o.ƀmd.set(e,[]);let i=o.ƀmd.get(e);i&&i.push(t),O.getEntities(e).forEach(s=>{this.ƀck(s,t);});}static ƀck(t,e){try{let i=S.ƀjk(e.$meta.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀmc.ƀme.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdd=t,this.ƀme=[];}createViews(){if(!this.ƀdd.destroyed){let t=o.ƀmd.get(this.ƀdd.constructor);t&&t.forEach(e=>{o.ƀck(this.ƀdd,e);});}}updateViews(t,e){for(let i=0;i<this.ƀme.length;i++){let r=this.ƀme[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀme.forEach(t=>{t.destroy();});}};R.onHardReset.subscribe(()=>{rt.ƀmd=new Map;}).attachToRoot();function yt(){return function(o){o.$meta={type:"entity"},O.registerEntityClass(o);}}h(yt,"EntityDecorator");var W=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return O.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=O.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return O.getEntities(this)}constructor(){super(),this.ƀmc=new rt(this),O.registerEntity(this),m.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀmc.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmc.destroyViews(),O.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmc.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmc.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmc.createViews(),this}update(t,e){}};var gt=class o extends W{static{h(this,"SingletonEntity");}static{this.ƀcl=new WeakMap;}static ƀeb(t){let e=o.ƀcl.get(t);return e||(e=new actionsLib.SingleAction,o.ƀcl.set(t,e)),e}static ƀlq(t){o.ƀcl.delete(t);}static getInstanceAsync(){let t=O.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):o.ƀeb(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(s=>{e({type:"open",value:s}),s.onDestroy().tap(()=>{e({type:"close",value:s}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return O.getSingleton(this)}static getInstanceOrFail(){return O.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>o.ƀlq(this.constructor)).attachToRoot(),o.ƀeb(this.constructor).resolve(this);}};function Cr(){return function(o){return o.$meta={paramtypes:S.ƀep(o),type:"scene"},o}}h(Cr,"SceneDecorator");var me=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀgb=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀgb.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static cancelActiveScene(){return o.ƀb.value?o.ƀb.value.ƀj():actionsLib.SingleEvent.instant()}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀgb.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀgb.value=true;let i=S.ƀjk(this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀgb.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhl=new actionsLib.SingleAction,this.onClose=this.ƀhl.notifier,m.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀgb.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀgb.value=true;let e=t[0];return this.ƀj().map(()=>(this.ƀhl.resolve(e),e)).chainToRoot()}ƀj(){return this.prepareToClose().tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀgb.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};R.onHardReset.subscribe(()=>{me.ƀb.set(void 0);}).attachToRoot();var N=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Or=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return N.lineer(t)}},Dr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return N.easeIn(t)}},Mr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return N.easeOut(t)}},Br=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return N.easeInOut(t)}},Gr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return N.easeInCubic(t)}},_r=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return N.easeOutCubic(t)}},Fr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return N.easeInOutCubic(t)}},Nr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return N.blink(t)}},Bi=class{static{h(this,"AnimationFlicker");}start(){this.ƀlm=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀlm[e]}},x=class{static{h(this,"Animations");}static{this.lineer=new Or;}static{this.easeIn=new Dr;}static{this.easeOut=new Mr;}static{this.easeInOut=new Br;}static{this.easeInCubic=new Gr;}static{this.easeOutCubic=new _r;}static{this.easeInOutCubic=new Fr;}static{this.blink=new Nr;}};exports.ReAnimateHandlingType=void 0;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var I=class o{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdu(t){let e=o.ƀl.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀl.set(t,e)),e}get animating(){return this.ƀhv!==void 0}get target(){return this.ƀld}get value(){return this.ƀlw||(this.ƀlw=new actionsLib.Variable(this.ƀld)),this.ƀlw.notifier}get paused(){return this.ƀie!==void 0}set paused(t){this.ƀie=t?true:void 0;}constructor(t,e,i){this.ƀgc=false,this.ƀki=false,this.ƀld=t,this.ƀhx={duration:200,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀm=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgp(t,this.ƀm);}animate(t,e){let i={...this.ƀhx,...e},r=this.ƀhv;if(this.ƀhv)switch(i.reAnimateHandling){case exports.ReAnimateHandlingType.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case exports.ReAnimateHandlingType.IgnoreNewAnimation:return actionsLib.SingleEvent.instant().notIdle();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀjx(i.completionHandling,this.ƀhv.ƀja,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀgc&&(this.ƀki=true);let a={};for(let c of this.ƀm)a[c]={ƀkx:this.ƀld[c],ƀlf:t[c]};let l={ƀcy:i.duration,ƀcz:0,ƀja:a,ƀbj:i.completionHandling,ƀn:i.animation,ƀbi:n};if(l.ƀbj!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfy(l)){this.ƀhv=void 0,n(),r?.ƀbi(),this.ƀay();return}return l.ƀn.start(),this.ƀhv=l,this.ƀdc(),r?.ƀbi(),()=>{this.ƀhv===l&&(this.ƀld instanceof actionsLib.Attachable&&this.ƀld.destroyed||this.ƀjx(l.ƀbj,l.ƀja,true),this.ƀhv=void 0,this.ƀay());}}).notIdle()}set(t){this.ƀmi(e=>t[e]),this.ƀhv?.ƀbi();}completeAnimation(t){if(this.ƀhv){t=t??this.ƀhv.ƀbj,this.ƀjx(t,this.ƀhv.ƀja,true);let e=this.ƀhv.ƀbi;this.ƀhv=void 0,e();}}ƀdc(){this.ƀls||(this.ƀls=m.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀie){this.ƀgc=true;try{let e=this.ƀhv;if(!e)return;if(e.ƀcz+=t.delta,e.ƀcz>=e.ƀcy)if(e.ƀbj===exports.AnimationsCompletionHandlingType.Loop)e.ƀcz%=e.ƀcy,e.ƀn.start();else {this.ƀjx(e.ƀbj,e.ƀja,!1),this.ƀhv=void 0,e.ƀbi(),this.ƀay();return}let i=e.ƀn.multiplierFunction(e.ƀcz/e.ƀcy);this.ƀmi(r=>{let s=e.ƀja[r];return (s.ƀlf-s.ƀkx)*i+s.ƀkx});}finally{this.ƀgc=false,this.ƀki&&(this.ƀki=false,this.ƀcr(),this.ƀdc());}}}).attachToRoot());}ƀfy(t){return this.ƀm.every(e=>this.ƀld[e]===t.ƀja[e].ƀlf)}ƀjx(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀmi(r=>e[r].ƀkx);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀmi(r=>e[r].ƀlf);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀmi(r=>e[r].ƀlf);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀmi(t){let e=false;for(let i of this.ƀm){let r=t(i);this.ƀld[i]!==r&&(e=true,this.ƀld[i]=r);}e&&this.ƀlw?.set(this.ƀld);}ƀay(){this.ƀhv||this.ƀcr();}ƀcr(){this.ƀls?.destroy(),this.ƀls=void 0;}ƀgp(t,e){let i=o.ƀdu(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};exports.ContainerEventType=void 0;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change",o.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ge=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀhc=false,this.ƀdm=false,this.ƀjm=1,this.ƀw=1,this.ƀis=new V__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀis.width,this.ƀis.height)}setSize(t){return this.ƀis.width=t.x,this.ƀis.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀis.getLocalBounds(),r=new helpersLib.Vector(this.ƀis.scale.x,this.ƀis.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀis.x,this.ƀis.y)}set position(t){this.ƀis.position=t;}get x(){return this.ƀis.x}set x(t){this.ƀis.x=t;}get y(){return this.ƀis.y}set y(t){this.ƀis.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>{if(t===exports.ContainerEventType.Wheel){let n=r.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀis.on(t,i),()=>this.ƀis.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀis.rotation)}set rotation(t){this.ƀis.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.ƀis.zIndex}set zIndex(t){this.ƀis.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀis.skew.x)}set skewX(t){this.ƀis.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀis.skew.y)}set skewY(t){this.ƀis.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀis.sortableChildren}set sortableChildren(t){this.ƀis.sortableChildren=t;}setAlpha(t){return this.ƀis.alpha=t,this}get alpha(){return this.ƀis.alpha}set alpha(t){this.ƀis.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀis.interactive}set interactive(t){t?this.ƀis.eventMode="dynamic":this.ƀis.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀis.cursor}set cursor(t){this.ƀis.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀis.addChild(t.ƀis),this.ƀis.mask=t.getMask(),this.ƀgs=t):(this.ƀgs&&this.ƀis.removeChild(this.ƀgs.ƀis),this.ƀis.mask=null),this}hitTest(t){if(this.ƀis.parent)if(this.ƀis.hitArea){let e=this.ƀis.toLocal(t);return this.ƀis.hitArea.contains(e.x,e.y)}else return this.ƀis.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀis.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.ƀhy||(this.ƀhy=this.ƀis.calculateBounds),this.ƀis.calculateBounds=()=>this.ƀis._bounds.clear()):this.ƀhy&&(this.ƀis.calculateBounds=this.ƀhy),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhc}set mirror(t){this.ƀhc=t,this.ƀlu();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdm}set flip(t){this.ƀdm=t,this.ƀlu();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjm}set scale(t){this.ƀjm=t,this.ƀlu();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀlu();}ƀlu(){this.ƀis.scale.set(this.ƀjm,this.ƀjm),this.ƀw<1?this.ƀis.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀis.scale.y/=this.ƀw),this.ƀhc&&(this.ƀis.scale.x*=-1),this.ƀdm&&(this.ƀis.scale.y*=-1);}};var D=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var we=class{static{h(this,"GaussianValuesHelper");}static ƀds(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbu(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.ƀds(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbu(e)}}static ƀbu(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Fi=class ei extends V__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀev(){return `
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'),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 V__namespace=/*#__PURE__*/_interopNamespace(V);var U__default=/*#__PURE__*/_interopDefault(U);var gr=Object.defineProperty;var h=(o,t)=>gr(o,"name",{value:t,configurable:true});function q(){return class{static{h(this,"GatewayBase");}}}h(q,"Gateway");function Di(o,t){let e=o.prototype,i=Object.getPrototypeOf(t);for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let s=t[r];if(typeof s=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=s.bind(t);}}}h(Di,"bindControllerToGateway");var R=class{static{h(this,"BardLegendsHardReset");}static{this.ƀfg=new actionsLib.Action;}static{this.onHardReset=this.ƀfg.notifier;}static hardReset(){actionsLib.ActionLib.hardReset(),this.ƀfg.trigger();}};function d(){return function(o){let t=S.ƀep(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var S=class{static{h(this,"Service");}static{this.ƀjv=new Map;}static get(t){let e=this.ƀjv.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀjk(t.$meta.paramtypes);e=new t(...i),this.ƀjv.set(t,e);}return e}static ƀep(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjk(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};R.onHardReset.subscribe(()=>{S.ƀjv=new Map;}).attachToRoot();function Q(o){return function(t){let e=S.ƀep(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=S.ƀjk(e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);Di(o,r);}t.$meta={type:"controller"};}}h(Q,"ControllerDecorator");var m=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new actionsLib.Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀjo=new actionsLib.Action;}static{this.sceneUpdateAction=this.ƀjo.notifier;}static{this.ƀf=new actionsLib.Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀll=0;}static{this.ƀlt=void 0;}static wait(t){let e=this.ƀll+t;return actionsLib.SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀlt)this.ƀlt=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlt=void 0;}static triggerUpdateTick(t){this.ƀlt&&(t=this.ƀlt(this.ƀll,t)),this.ƀll+=t,this.ƀgi=t,t>0&&(o.ƀad.trigger({time:this.ƀll,delta:t}),o.ƀjo.trigger({time:this.ƀll,delta:t}),o.ƀf.trigger({time:this.ƀll,delta:t}));}static get lastDelta(){return this.ƀgi}static{this.ƀgi=0;}};R.onHardReset.subscribe(()=>{m.ƀad.clear(),m.ƀjo.clear(),m.ƀf.clear(),m.ƀlt=void 0,m.ƀll=0;}).attachToRoot();var O=class o{static{h(this,"EntityStoreHelper");}static{this.ƀax=new Map;}static registerEntityClass(t){this.ƀax.set(t.id,new Map);}static registerEntity(t){let e=this.ƀax.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀax.get(i)?.delete(e);}static getEntity(t,e){return this.ƀax.get(t.id)?.get(e)}static getSingleton(t){let e=o.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀax.get(t.id);return Array.from(e.values())}};R.onHardReset.subscribe(()=>{O.ƀax.clear();}).attachToRoot();function Qe(o){return function(t){t.$meta={paramtypes:S.ƀep(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Qe,"ViewDecorator");var mt=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.update=()=>{},this.attachToRoot(),this.ƀde=rt.entityID,this.ƀew().set(this.ƀde,this);}destroy(){this.destroyed||(super.destroy(),this.ƀew().delete(this.ƀde));}ƀew(){return this.constructor.$meta.viewInstances}};var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀmd=new Map;}static registerView(t,e){o.ƀmd.has(e)||o.ƀmd.set(e,[]);let i=o.ƀmd.get(e);i&&i.push(t),O.getEntities(e).forEach(s=>{this.ƀck(s,t);});}static ƀck(t,e){try{let i=S.ƀjk(e.$meta.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀmc.ƀme.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdd=t,this.ƀme=[];}createViews(){if(!this.ƀdd.destroyed){let t=o.ƀmd.get(this.ƀdd.constructor);t&&t.forEach(e=>{o.ƀck(this.ƀdd,e);});}}updateViews(t,e){for(let i=0;i<this.ƀme.length;i++){let r=this.ƀme[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀme.forEach(t=>{t.destroy();});}};R.onHardReset.subscribe(()=>{rt.ƀmd=new Map;}).attachToRoot();function yt(){return function(o){o.$meta={type:"entity"},O.registerEntityClass(o);}}h(yt,"EntityDecorator");var W=class extends actionsLib.IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return O.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=O.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return O.getEntities(this)}constructor(){super(),this.ƀmc=new rt(this),O.registerEntity(this),m.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.ƀlr(t.time,t.delta),this.ƀmc.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmc.destroyViews(),O.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmc.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmc.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmc.createViews(),this}ƀlr(t,e){}};var gt=class o extends W{static{h(this,"SingletonEntity");}static{this.ƀcl=new WeakMap;}static ƀeb(t){let e=o.ƀcl.get(t);return e||(e=new actionsLib.SingleAction,o.ƀcl.set(t,e)),e}static ƀlq(t){o.ƀcl.delete(t);}static getInstanceAsync(){let t=O.getSingleton(this);return t&&!t.destroyed?actionsLib.SingleEvent.instant(t):o.ƀeb(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(s=>{e({type:"open",value:s}),s.onDestroy().tap(()=>{e({type:"close",value:s}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return actionsLib.Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return O.getSingleton(this)}static getInstanceOrFail(){return O.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>o.ƀlq(this.constructor)).attachToRoot(),o.ƀeb(this.constructor).resolve(this);}};function Cr(){return function(o){return o.$meta={paramtypes:S.ƀep(o),type:"scene"},o}}h(Cr,"SceneDecorator");var me=class o extends actionsLib.IDAttachable{static{h(this,"Scene");}static{this.ƀgb=new actionsLib.Variable(false);}static{this.isTransitioning=this.ƀgb.notifier;}static{this.ƀb=new actionsLib.Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static cancelActiveScene(){return o.ƀb.value?o.ƀb.value.ƀj("cancel"):actionsLib.SingleEvent.instant()}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀgb.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀgb.value=true;let i=S.ƀjk(this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀgb.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhl=new actionsLib.SingleAction,this.onClose=this.ƀhl.notifier,m.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀgb.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀgb.value=true;let e=t[0];return this.ƀj(e).map(()=>(this.ƀhl.resolve(e),e)).chainToRoot()}ƀj(t){return this.prepareToClose(t).tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀgb.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};R.onHardReset.subscribe(()=>{me.ƀb.set(void 0);}).attachToRoot();var N=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Or=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return N.lineer(t)}},Dr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return N.easeIn(t)}},Mr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return N.easeOut(t)}},Br=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return N.easeInOut(t)}},Gr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return N.easeInCubic(t)}},_r=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return N.easeOutCubic(t)}},Fr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return N.easeInOutCubic(t)}},Nr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return N.blink(t)}},Bi=class{static{h(this,"AnimationFlicker");}start(){this.ƀlm=new Array(10).fill(0),helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(helpersLib.Random.integerBetween(0,9),this.ƀlm[helpersLib.Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀlm[e]}},x=class{static{h(this,"Animations");}static{this.lineer=new Or;}static{this.easeIn=new Dr;}static{this.easeOut=new Mr;}static{this.easeInOut=new Br;}static{this.easeInCubic=new Gr;}static{this.easeOutCubic=new _r;}static{this.easeInOutCubic=new Fr;}static{this.blink=new Nr;}};exports.ReAnimateHandlingType=void 0;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(exports.ReAnimateHandlingType||(exports.ReAnimateHandlingType={}));exports.AnimationsCompletionHandlingType=void 0;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(exports.AnimationsCompletionHandlingType||(exports.AnimationsCompletionHandlingType={}));var I=class o{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdu(t){let e=o.ƀl.get(t);return e||(e=new helpersLib.MapToWeakRefs,o.ƀl.set(t,e)),e}get animating(){return this.ƀhv!==void 0}get target(){return this.ƀld}get value(){return this.ƀlw||(this.ƀlw=new actionsLib.Variable(this.ƀld)),this.ƀlw.notifier}get paused(){return this.ƀie!==void 0}set paused(t){this.ƀie=t?true:void 0;}constructor(t,e,i){this.ƀgc=false,this.ƀki=false,this.ƀld=t,this.ƀhx={duration:200,animation:x.lineer,reAnimateHandling:exports.ReAnimateHandlingType.ThrowError,completionHandling:exports.AnimationsCompletionHandlingType.StayInCurrentState,...i},this.ƀm=helpersLib.Comparator.isArray(e)?e:[e],this.ƀgp(t,this.ƀm);}animate(t,e){let i={...this.ƀhx,...e},r=this.ƀhv;if(this.ƀhv)switch(i.reAnimateHandling){case exports.ReAnimateHandlingType.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case exports.ReAnimateHandlingType.IgnoreNewAnimation:return actionsLib.SingleEvent.instant().notIdle();case exports.ReAnimateHandlingType.CompletePrevious:this.ƀjx(i.completionHandling,this.ƀhv.ƀja,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return actionsLib.SingleEvent.create(n=>{this.ƀgc&&(this.ƀki=true);let a={};for(let c of this.ƀm)a[c]={ƀkx:this.ƀld[c],ƀlf:t[c]};let l={ƀcy:i.duration,ƀcz:0,ƀja:a,ƀbj:i.completionHandling,ƀn:i.animation,ƀbi:n};if(l.ƀbj!==exports.AnimationsCompletionHandlingType.Loop&&this.ƀfy(l)){this.ƀhv=void 0,n(),r?.ƀbi(),this.ƀay();return}return l.ƀn.start(),this.ƀhv=l,this.ƀdc(),r?.ƀbi(),()=>{this.ƀhv===l&&(this.ƀld instanceof actionsLib.Attachable&&this.ƀld.destroyed||this.ƀjx(l.ƀbj,l.ƀja,true),this.ƀhv=void 0,this.ƀay());}}).notIdle()}set(t){this.ƀmi(e=>t[e]),this.ƀhv?.ƀbi();}completeAnimation(t){if(this.ƀhv){t=t??this.ƀhv.ƀbj,this.ƀjx(t,this.ƀhv.ƀja,true);let e=this.ƀhv.ƀbi;this.ƀhv=void 0,e();}}ƀdc(){this.ƀls||(this.ƀls=m.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀie){this.ƀgc=true;try{let e=this.ƀhv;if(!e)return;if(e.ƀcz+=t.delta,e.ƀcz>=e.ƀcy)if(e.ƀbj===exports.AnimationsCompletionHandlingType.Loop)e.ƀcz%=e.ƀcy,e.ƀn.start();else {this.ƀjx(e.ƀbj,e.ƀja,!1),this.ƀhv=void 0,e.ƀbi(),this.ƀay();return}let i=e.ƀn.multiplierFunction(e.ƀcz/e.ƀcy);this.ƀmi(r=>{let s=e.ƀja[r];return (s.ƀlf-s.ƀkx)*i+s.ƀkx});}finally{this.ƀgc=false,this.ƀki&&(this.ƀki=false,this.ƀcr(),this.ƀdc());}}}).attachToRoot());}ƀfy(t){return this.ƀm.every(e=>this.ƀld[e]===t.ƀja[e].ƀlf)}ƀjx(t,e,i){switch(t){case exports.AnimationsCompletionHandlingType.ReturnToOriginal:case exports.AnimationsCompletionHandlingType.Loop:this.ƀmi(r=>e[r].ƀkx);break;case exports.AnimationsCompletionHandlingType.JumpToEnd:this.ƀmi(r=>e[r].ƀlf);break;case exports.AnimationsCompletionHandlingType.StayInCurrentState:i||this.ƀmi(r=>e[r].ƀlf);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀmi(t){let e=false;for(let i of this.ƀm){let r=t(i);this.ƀld[i]!==r&&(e=true,this.ƀld[i]=r);}e&&this.ƀlw?.set(this.ƀld);}ƀay(){this.ƀhv||this.ƀcr();}ƀcr(){this.ƀls?.destroy(),this.ƀls=void 0;}ƀgp(t,e){let i=o.ƀdu(t);for(let r of e){if(i.has(r))throw new Error(`Animator: target property is already animated! Target: "${JSON.stringify(t,void 0,2)}", Property: "${r}"`);i.set(r,this);}}};exports.ContainerEventType=void 0;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change",o.Wheel="wheel";})(exports.ContainerEventType||(exports.ContainerEventType={}));exports.Cursor=void 0;(function(o){o.Default="default",o.Pointer="pointer";})(exports.Cursor||(exports.Cursor={}));var ge=class extends actionsLib.IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀhc=false,this.ƀdm=false,this.ƀjm=1,this.ƀw=1,this.ƀis=new V__namespace.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new helpersLib.Vector(this.ƀis.width,this.ƀis.height)}setSize(t){return this.ƀis.width=t.x,this.ƀis.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀis.getLocalBounds(),r=new helpersLib.Vector(this.ƀis.scale.x,this.ƀis.scale.y),s=new helpersLib.Vector(i.x,i.y).multiply(r),n=new helpersLib.Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new helpersLib.Vector(this.ƀis.x,this.ƀis.y)}set position(t){this.ƀis.position=t;}get x(){return this.ƀis.x}set x(t){this.ƀis.x=t;}get y(){return this.ƀis.y}set y(t){this.ƀis.y=t;}on(t){return actionsLib.Sequence.create(e=>{let i=h(r=>{if(t===exports.ContainerEventType.Wheel){let n=r.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀis.on(t,i),()=>this.ƀis.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new helpersLib.Radian(this.ƀis.rotation)}set rotation(t){this.ƀis.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.ƀis.zIndex}set zIndex(t){this.ƀis.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new helpersLib.Radian(this.ƀis.skew.x)}set skewX(t){this.ƀis.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new helpersLib.Radian(this.ƀis.skew.y)}set skewY(t){this.ƀis.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀis.sortableChildren}set sortableChildren(t){this.ƀis.sortableChildren=t;}setAlpha(t){return this.ƀis.alpha=t,this}get alpha(){return this.ƀis.alpha}set alpha(t){this.ƀis.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀis.interactive}set interactive(t){t?this.ƀis.eventMode="dynamic":this.ƀis.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀis.cursor}set cursor(t){this.ƀis.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀis.addChild(t.ƀis),this.ƀis.mask=t.getMask(),this.ƀgs=t):(this.ƀgs&&this.ƀis.removeChild(this.ƀgs.ƀis),this.ƀis.mask=null),this}hitTest(t){if(this.ƀis.parent)if(this.ƀis.hitArea){let e=this.ƀis.toLocal(t);return this.ƀis.hitArea.contains(e.x,e.y)}else return this.ƀis.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀis.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.ƀhy||(this.ƀhy=this.ƀis.calculateBounds),this.ƀis.calculateBounds=()=>this.ƀis._bounds.clear()):this.ƀhy&&(this.ƀis.calculateBounds=this.ƀhy),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhc}set mirror(t){this.ƀhc=t,this.ƀlu();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdm}set flip(t){this.ƀdm=t,this.ƀlu();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjm}set scale(t){this.ƀjm=t,this.ƀlu();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀlu();}ƀlu(){this.ƀis.scale.set(this.ƀjm,this.ƀjm),this.ƀw<1?this.ƀis.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀis.scale.y/=this.ƀw),this.ƀhc&&(this.ƀis.scale.x*=-1),this.ƀdm&&(this.ƀis.scale.y*=-1);}};var D=2;exports.BlendMode=void 0;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(exports.BlendMode||(exports.BlendMode={}));var we=class{static{h(this,"GaussianValuesHelper");}static ƀds(t,e){let i=e*e,r=1/(helpersLib.PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=helpersLib.NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbu(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.ƀds(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbu(e)}}static ƀbu(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Fi=class ei extends V__namespace.Filter{static{h(this,"BlurFilterPass");}static ƀev(){return `
2
2
  attribute vec2 aVertexPosition;
3
3
  attribute vec2 aTextureCoord;
4
4
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {Action,ActionLib,SingleEvent,IDAttachable,SingleAction,Sequence,Variable,Attachable,Reducer}from'actions-lib';import'reflect-metadata';import {Random,MapToWeakRefs,Comparator,Vector,Radian,Rectangle,NumberHelper,ArrayHelper,ColorHelper,PI_360,Queue,GridNeighborType,BinaryHeap,Grid,JsonHelper,Line}from'helpers-lib';import*as V from'pixi.js';import {RichTextSeparator}from'script-engine-lib';import U from'p2';var gr=Object.defineProperty;var h=(o,t)=>gr(o,"name",{value:t,configurable:true});function q(){return class{static{h(this,"GatewayBase");}}}h(q,"Gateway");function Di(o,t){let e=o.prototype,i=Object.getPrototypeOf(t);for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let s=t[r];if(typeof s=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=s.bind(t);}}}h(Di,"bindControllerToGateway");var R=class{static{h(this,"BardLegendsHardReset");}static{this.ƀfg=new Action;}static{this.onHardReset=this.ƀfg.notifier;}static hardReset(){ActionLib.hardReset(),this.ƀfg.trigger();}};function d(){return function(o){let t=S.ƀep(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var S=class{static{h(this,"Service");}static{this.ƀjv=new Map;}static get(t){let e=this.ƀjv.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀjk(t.$meta.paramtypes);e=new t(...i),this.ƀjv.set(t,e);}return e}static ƀep(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjk(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};R.onHardReset.subscribe(()=>{S.ƀjv=new Map;}).attachToRoot();function Q(o){return function(t){let e=S.ƀep(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=S.ƀjk(e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);Di(o,r);}t.$meta={type:"controller"};}}h(Q,"ControllerDecorator");var m=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀjo=new Action;}static{this.sceneUpdateAction=this.ƀjo.notifier;}static{this.ƀf=new Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀll=0;}static{this.ƀlt=void 0;}static wait(t){let e=this.ƀll+t;return SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀlt)this.ƀlt=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlt=void 0;}static triggerUpdateTick(t){this.ƀlt&&(t=this.ƀlt(this.ƀll,t)),this.ƀll+=t,this.ƀgi=t,t>0&&(o.ƀad.trigger({time:this.ƀll,delta:t}),o.ƀjo.trigger({time:this.ƀll,delta:t}),o.ƀf.trigger({time:this.ƀll,delta:t}));}static get lastDelta(){return this.ƀgi}static{this.ƀgi=0;}};R.onHardReset.subscribe(()=>{m.ƀad.clear(),m.ƀjo.clear(),m.ƀf.clear(),m.ƀlt=void 0,m.ƀll=0;}).attachToRoot();var O=class o{static{h(this,"EntityStoreHelper");}static{this.ƀax=new Map;}static registerEntityClass(t){this.ƀax.set(t.id,new Map);}static registerEntity(t){let e=this.ƀax.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀax.get(i)?.delete(e);}static getEntity(t,e){return this.ƀax.get(t.id)?.get(e)}static getSingleton(t){let e=o.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀax.get(t.id);return Array.from(e.values())}};R.onHardReset.subscribe(()=>{O.ƀax.clear();}).attachToRoot();function Qe(o){return function(t){t.$meta={paramtypes:S.ƀep(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Qe,"ViewDecorator");var mt=class extends 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.ƀde=rt.entityID,this.ƀew().set(this.ƀde,this);}destroy(){this.destroyed||(super.destroy(),this.ƀew().delete(this.ƀde));}update(t,e){}ƀew(){return this.constructor.$meta.viewInstances}};var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀmd=new Map;}static registerView(t,e){o.ƀmd.has(e)||o.ƀmd.set(e,[]);let i=o.ƀmd.get(e);i&&i.push(t),O.getEntities(e).forEach(s=>{this.ƀck(s,t);});}static ƀck(t,e){try{let i=S.ƀjk(e.$meta.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀmc.ƀme.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdd=t,this.ƀme=[];}createViews(){if(!this.ƀdd.destroyed){let t=o.ƀmd.get(this.ƀdd.constructor);t&&t.forEach(e=>{o.ƀck(this.ƀdd,e);});}}updateViews(t,e){for(let i=0;i<this.ƀme.length;i++){let r=this.ƀme[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀme.forEach(t=>{t.destroy();});}};R.onHardReset.subscribe(()=>{rt.ƀmd=new Map;}).attachToRoot();function yt(){return function(o){o.$meta={type:"entity"},O.registerEntityClass(o);}}h(yt,"EntityDecorator");var W=class extends IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return O.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=O.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return O.getEntities(this)}constructor(){super(),this.ƀmc=new rt(this),O.registerEntity(this),m.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.update(t.time,t.delta),this.ƀmc.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmc.destroyViews(),O.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmc.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmc.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmc.createViews(),this}update(t,e){}};var gt=class o extends W{static{h(this,"SingletonEntity");}static{this.ƀcl=new WeakMap;}static ƀeb(t){let e=o.ƀcl.get(t);return e||(e=new SingleAction,o.ƀcl.set(t,e)),e}static ƀlq(t){o.ƀcl.delete(t);}static getInstanceAsync(){let t=O.getSingleton(this);return t&&!t.destroyed?SingleEvent.instant(t):o.ƀeb(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(s=>{e({type:"open",value:s}),s.onDestroy().tap(()=>{e({type:"close",value:s}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return O.getSingleton(this)}static getInstanceOrFail(){return O.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>o.ƀlq(this.constructor)).attachToRoot(),o.ƀeb(this.constructor).resolve(this);}};function Cr(){return function(o){return o.$meta={paramtypes:S.ƀep(o),type:"scene"},o}}h(Cr,"SceneDecorator");var me=class o extends IDAttachable{static{h(this,"Scene");}static{this.ƀgb=new Variable(false);}static{this.isTransitioning=this.ƀgb.notifier;}static{this.ƀb=new Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static cancelActiveScene(){return o.ƀb.value?o.ƀb.value.ƀj():SingleEvent.instant()}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀgb.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀgb.value=true;let i=S.ƀjk(this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀgb.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhl=new SingleAction,this.onClose=this.ƀhl.notifier,m.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀgb.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀgb.value=true;let e=t[0];return this.ƀj().map(()=>(this.ƀhl.resolve(e),e)).chainToRoot()}ƀj(){return this.prepareToClose().tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀgb.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};R.onHardReset.subscribe(()=>{me.ƀb.set(void 0);}).attachToRoot();var N=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Or=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return N.lineer(t)}},Dr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return N.easeIn(t)}},Mr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return N.easeOut(t)}},Br=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return N.easeInOut(t)}},Gr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return N.easeInCubic(t)}},_r=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return N.easeOutCubic(t)}},Fr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return N.easeInOutCubic(t)}},Nr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return N.blink(t)}},Bi=class{static{h(this,"AnimationFlicker");}start(){this.ƀlm=new Array(10).fill(0),Random.integerBetween(0,9),this.ƀlm[Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(Random.integerBetween(0,9),this.ƀlm[Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(Random.integerBetween(0,9),this.ƀlm[Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀlm[e]}},x=class{static{h(this,"Animations");}static{this.lineer=new Or;}static{this.easeIn=new Dr;}static{this.easeOut=new Mr;}static{this.easeInOut=new Br;}static{this.easeInCubic=new Gr;}static{this.easeOutCubic=new _r;}static{this.easeInOutCubic=new Fr;}static{this.blink=new Nr;}};var C;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(C||(C={}));var E;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(E||(E={}));var I=class o{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdu(t){let e=o.ƀl.get(t);return e||(e=new MapToWeakRefs,o.ƀl.set(t,e)),e}get animating(){return this.ƀhv!==void 0}get target(){return this.ƀld}get value(){return this.ƀlw||(this.ƀlw=new Variable(this.ƀld)),this.ƀlw.notifier}get paused(){return this.ƀie!==void 0}set paused(t){this.ƀie=t?true:void 0;}constructor(t,e,i){this.ƀgc=false,this.ƀki=false,this.ƀld=t,this.ƀhx={duration:200,animation:x.lineer,reAnimateHandling:C.ThrowError,completionHandling:E.StayInCurrentState,...i},this.ƀm=Comparator.isArray(e)?e:[e],this.ƀgp(t,this.ƀm);}animate(t,e){let i={...this.ƀhx,...e},r=this.ƀhv;if(this.ƀhv)switch(i.reAnimateHandling){case C.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case C.IgnoreNewAnimation:return SingleEvent.instant().notIdle();case C.CompletePrevious:this.ƀjx(i.completionHandling,this.ƀhv.ƀja,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return SingleEvent.create(n=>{this.ƀgc&&(this.ƀki=true);let a={};for(let c of this.ƀm)a[c]={ƀkx:this.ƀld[c],ƀlf:t[c]};let l={ƀcy:i.duration,ƀcz:0,ƀja:a,ƀbj:i.completionHandling,ƀn:i.animation,ƀbi:n};if(l.ƀbj!==E.Loop&&this.ƀfy(l)){this.ƀhv=void 0,n(),r?.ƀbi(),this.ƀay();return}return l.ƀn.start(),this.ƀhv=l,this.ƀdc(),r?.ƀbi(),()=>{this.ƀhv===l&&(this.ƀld instanceof Attachable&&this.ƀld.destroyed||this.ƀjx(l.ƀbj,l.ƀja,true),this.ƀhv=void 0,this.ƀay());}}).notIdle()}set(t){this.ƀmi(e=>t[e]),this.ƀhv?.ƀbi();}completeAnimation(t){if(this.ƀhv){t=t??this.ƀhv.ƀbj,this.ƀjx(t,this.ƀhv.ƀja,true);let e=this.ƀhv.ƀbi;this.ƀhv=void 0,e();}}ƀdc(){this.ƀls||(this.ƀls=m.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀie){this.ƀgc=true;try{let e=this.ƀhv;if(!e)return;if(e.ƀcz+=t.delta,e.ƀcz>=e.ƀcy)if(e.ƀbj===E.Loop)e.ƀcz%=e.ƀcy,e.ƀn.start();else {this.ƀjx(e.ƀbj,e.ƀja,!1),this.ƀhv=void 0,e.ƀbi(),this.ƀay();return}let i=e.ƀn.multiplierFunction(e.ƀcz/e.ƀcy);this.ƀmi(r=>{let s=e.ƀja[r];return (s.ƀlf-s.ƀkx)*i+s.ƀkx});}finally{this.ƀgc=false,this.ƀki&&(this.ƀki=false,this.ƀcr(),this.ƀdc());}}}).attachToRoot());}ƀfy(t){return this.ƀm.every(e=>this.ƀld[e]===t.ƀja[e].ƀlf)}ƀjx(t,e,i){switch(t){case E.ReturnToOriginal:case E.Loop:this.ƀmi(r=>e[r].ƀkx);break;case E.JumpToEnd:this.ƀmi(r=>e[r].ƀlf);break;case E.StayInCurrentState:i||this.ƀmi(r=>e[r].ƀlf);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀmi(t){let e=false;for(let i of this.ƀm){let r=t(i);this.ƀld[i]!==r&&(e=true,this.ƀld[i]=r);}e&&this.ƀlw?.set(this.ƀld);}ƀay(){this.ƀhv||this.ƀcr();}ƀcr(){this.ƀls?.destroy(),this.ƀls=void 0;}ƀgp(t,e){let i=o.ƀdu(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 At;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change",o.Wheel="wheel";})(At||(At={}));var ti;(function(o){o.Default="default",o.Pointer="pointer";})(ti||(ti={}));var ge=class extends IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀhc=false,this.ƀdm=false,this.ƀjm=1,this.ƀw=1,this.ƀis=new V.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new Vector(this.ƀis.width,this.ƀis.height)}setSize(t){return this.ƀis.width=t.x,this.ƀis.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀis.getLocalBounds(),r=new Vector(this.ƀis.scale.x,this.ƀis.scale.y),s=new Vector(i.x,i.y).multiply(r),n=new Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new Vector(this.ƀis.x,this.ƀis.y)}set position(t){this.ƀis.position=t;}get x(){return this.ƀis.x}set x(t){this.ƀis.x=t;}get y(){return this.ƀis.y}set y(t){this.ƀis.y=t;}on(t){return Sequence.create(e=>{let i=h(r=>{if(t===At.Wheel){let n=r.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀis.on(t,i),()=>this.ƀis.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new Radian(this.ƀis.rotation)}set rotation(t){this.ƀis.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀis.zIndex}set zIndex(t){this.ƀis.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new Radian(this.ƀis.skew.x)}set skewX(t){this.ƀis.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new Radian(this.ƀis.skew.y)}set skewY(t){this.ƀis.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀis.sortableChildren}set sortableChildren(t){this.ƀis.sortableChildren=t;}setAlpha(t){return this.ƀis.alpha=t,this}get alpha(){return this.ƀis.alpha}set alpha(t){this.ƀis.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀis.interactive}set interactive(t){t?this.ƀis.eventMode="dynamic":this.ƀis.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀis.cursor}set cursor(t){this.ƀis.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀis.addChild(t.ƀis),this.ƀis.mask=t.getMask(),this.ƀgs=t):(this.ƀgs&&this.ƀis.removeChild(this.ƀgs.ƀis),this.ƀis.mask=null),this}hitTest(t){if(this.ƀis.parent)if(this.ƀis.hitArea){let e=this.ƀis.toLocal(t);return this.ƀis.hitArea.contains(e.x,e.y)}else return this.ƀis.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀis.getLocalBounds();return new Rectangle(new Vector(t.x,t.y),new Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhy||(this.ƀhy=this.ƀis.calculateBounds),this.ƀis.calculateBounds=()=>this.ƀis._bounds.clear()):this.ƀhy&&(this.ƀis.calculateBounds=this.ƀhy),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhc}set mirror(t){this.ƀhc=t,this.ƀlu();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdm}set flip(t){this.ƀdm=t,this.ƀlu();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjm}set scale(t){this.ƀjm=t,this.ƀlu();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀlu();}ƀlu(){this.ƀis.scale.set(this.ƀjm,this.ƀjm),this.ƀw<1?this.ƀis.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀis.scale.y/=this.ƀw),this.ƀhc&&(this.ƀis.scale.x*=-1),this.ƀdm&&(this.ƀis.scale.y*=-1);}};var D=2,Ct;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(Ct||(Ct={}));var we=class{static{h(this,"GaussianValuesHelper");}static ƀds(t,e){let i=e*e,r=1/(PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbu(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=ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀds(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbu(e)}}static ƀbu(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Fi=class ei extends V.Filter{static{h(this,"BlurFilterPass");}static ƀev(){return `
1
+ import {Action,ActionLib,SingleEvent,IDAttachable,SingleAction,Sequence,Variable,Attachable,Reducer}from'actions-lib';import'reflect-metadata';import {Random,MapToWeakRefs,Comparator,Vector,Radian,Rectangle,NumberHelper,ArrayHelper,ColorHelper,PI_360,Queue,GridNeighborType,BinaryHeap,Grid,JsonHelper,Line}from'helpers-lib';import*as V from'pixi.js';import {RichTextSeparator}from'script-engine-lib';import U from'p2';var gr=Object.defineProperty;var h=(o,t)=>gr(o,"name",{value:t,configurable:true});function q(){return class{static{h(this,"GatewayBase");}}}h(q,"Gateway");function Di(o,t){let e=o.prototype,i=Object.getPrototypeOf(t);for(let r of Reflect.ownKeys(i)){if(typeof r!="string"||r==="constructor")continue;let s=t[r];if(typeof s=="function"){if(Object.prototype.hasOwnProperty.call(e,r))throw new Error(`Gateway "${o.name}": method "${r}" is already registered by another controller.`);e[r]=s.bind(t);}}}h(Di,"bindControllerToGateway");var R=class{static{h(this,"BardLegendsHardReset");}static{this.ƀfg=new Action;}static{this.onHardReset=this.ƀfg.notifier;}static hardReset(){ActionLib.hardReset(),this.ƀfg.trigger();}};function d(){return function(o){let t=S.ƀep(o);o.$meta={paramtypes:t,type:"service"};}}h(d,"ServiceDecorator");var S=class{static{h(this,"Service");}static{this.ƀjv=new Map;}static get(t){let e=this.ƀjv.get(t);if(!e){if(!t.$meta)throw new Error(`Service: service class is not decorated by @ServiceDecorator(), class: "${t.name}"`);let i=this.ƀjk(t.$meta.paramtypes);e=new t(...i),this.ƀjv.set(t,e);}return e}static ƀep(t){let e=Reflect.getMetadata("design:paramtypes",t)||[];return e.some(i=>!i)&&console.error(`Circular dependency: ${t.name}`),e.some(i=>i.name==="Object")&&console.error(`Some injected parameters are failed to resolve. Check if it is imported as value, if not remove the "type" keyword. Class: "${t.name}"`),e}static ƀjk(t){return t.map(i=>{if(i&&i.$meta?.type==="service")return this.get(i);throw new Error(`Injected parameter has to be decorated with @ServiceDecorator(), class: "${i.name}"`)})}};R.onHardReset.subscribe(()=>{S.ƀjv=new Map;}).attachToRoot();function Q(o){return function(t){let e=S.ƀep(t);if(e.some(i=>!i))console.error(`Circular dependency: ${t.name}`);else {let i=S.ƀjk(e);i.some(s=>s===void 0)&&console.error(i,e,t.name);let r=new t(...i);Di(o,r);}t.$meta={type:"controller"};}}h(Q,"ControllerDecorator");var m=class o{static{h(this,"UpdateCycle");}static{this.ƀad=new Action;}static{this.beforeSceneUpdateAction=this.ƀad.notifier;}static{this.ƀjo=new Action;}static{this.sceneUpdateAction=this.ƀjo.notifier;}static{this.ƀf=new Action;}static{this.afterSceneUpdateAction=this.ƀf.notifier;}static{this.ƀll=0;}static{this.ƀlt=void 0;}static wait(t){let e=this.ƀll+t;return SingleEvent.create(i=>{let r=o.beforeSceneUpdateAction.subscribe(s=>{s.time>=e&&i();}).attachToRoot();return ()=>r.destroy()})}static registerUpdateModifier(t){if(!this.ƀlt)this.ƀlt=t;else throw new Error("UpdateCycle: There can only one update modifier!")}static cleanUpdateModifier(){this.ƀlt=void 0;}static triggerUpdateTick(t){this.ƀlt&&(t=this.ƀlt(this.ƀll,t)),this.ƀll+=t,this.ƀgi=t,t>0&&(o.ƀad.trigger({time:this.ƀll,delta:t}),o.ƀjo.trigger({time:this.ƀll,delta:t}),o.ƀf.trigger({time:this.ƀll,delta:t}));}static get lastDelta(){return this.ƀgi}static{this.ƀgi=0;}};R.onHardReset.subscribe(()=>{m.ƀad.clear(),m.ƀjo.clear(),m.ƀf.clear(),m.ƀlt=void 0,m.ƀll=0;}).attachToRoot();var O=class o{static{h(this,"EntityStoreHelper");}static{this.ƀax=new Map;}static registerEntityClass(t){this.ƀax.set(t.id,new Map);}static registerEntity(t){let e=this.ƀax.get(t.classID);if(!e)throw new Error(`EntityStoreHelper: No entity class is found. Be sure that entity is decorated with EntityDecorator! Name: "${t.constructor.name}"`);e.set(t.id,t);}static unregisterEntity(t,e){let i=t.id;this.ƀax.get(i)?.delete(e);}static getEntity(t,e){return this.ƀax.get(t.id)?.get(e)}static getSingleton(t){let e=o.getEntities(t);if(e.length>1)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has multiple instances! Name: "${this.name}"`);return e[0]}static getSingletonOrFail(t){let e=this.getSingleton(t);if(!e)throw new Error(`EntityStoreHelper: selectSingleton is called with an entity that has no instance! Name: "${this.name}"`);return e}static getEntities(t){let e=this.ƀax.get(t.id);return Array.from(e.values())}};R.onHardReset.subscribe(()=>{O.ƀax.clear();}).attachToRoot();function Qe(o){return function(t){t.$meta={paramtypes:S.ƀep(t),viewInstances:new Map,entity:o.entity,type:"view"},rt.registerView(t,o.entity);}}h(Qe,"ViewDecorator");var mt=class extends 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.update=()=>{},this.attachToRoot(),this.ƀde=rt.entityID,this.ƀew().set(this.ƀde,this);}destroy(){this.destroyed||(super.destroy(),this.ƀew().delete(this.ƀde));}ƀew(){return this.constructor.$meta.viewInstances}};var rt=class o{static{h(this,"EntityViewsHelper");}static{this.ƀmd=new Map;}static registerView(t,e){o.ƀmd.has(e)||o.ƀmd.set(e,[]);let i=o.ƀmd.get(e);i&&i.push(t),O.getEntities(e).forEach(s=>{this.ƀck(s,t);});}static ƀck(t,e){try{let i=S.ƀjk(e.$meta.paramtypes.slice(1));o.entityID=t.id;let r=new e(t,...i);t.destroyed?r.destroy():t.ƀmc.ƀme.push(r);}catch(i){console.error(i);}}constructor(t){this.ƀdd=t,this.ƀme=[];}createViews(){if(!this.ƀdd.destroyed){let t=o.ƀmd.get(this.ƀdd.constructor);t&&t.forEach(e=>{o.ƀck(this.ƀdd,e);});}}updateViews(t,e){for(let i=0;i<this.ƀme.length;i++){let r=this.ƀme[i];r.destroyed||r.update(t,e);}}destroyViews(){this.ƀme.forEach(t=>{t.destroy();});}};R.onHardReset.subscribe(()=>{rt.ƀmd=new Map;}).attachToRoot();function yt(){return function(o){o.$meta={type:"entity"},O.registerEntityClass(o);}}h(yt,"EntityDecorator");var W=class extends IDAttachable{static{h(this,"Entity");}static getInstanceByID(t){if(t)return O.getEntity(this,t)}static getInstanceByIDOrFail(t){let e=O.getEntity(this,t);if(!e)throw new Error(`Entity: entity is not found! Name: "${this.name}", id: "${t}"`);return e}static getEntities(){return O.getEntities(this)}constructor(){super(),this.ƀmc=new rt(this),O.registerEntity(this),m.sceneUpdateAction.subscribe(t=>{this.destroyed||(this.ƀlr(t.time,t.delta),this.ƀmc.updateViews(t.time,t.delta));}).attach(this);}destroy(){this.destroyed||(this.ƀmc.destroyViews(),O.unregisterEntity(this.constructor,this.id),super.destroy());}attach(t){return super.attach(t),this.ƀmc.createViews(),this}attachByID(t){return super.attachByID(t),this.ƀmc.createViews(),this}attachToRoot(){return super.attachToRoot(),this.ƀmc.createViews(),this}ƀlr(t,e){}};var gt=class o extends W{static{h(this,"SingletonEntity");}static{this.ƀcl=new WeakMap;}static ƀeb(t){let e=o.ƀcl.get(t);return e||(e=new SingleAction,o.ƀcl.set(t,e)),e}static ƀlq(t){o.ƀcl.delete(t);}static getInstanceAsync(){let t=O.getSingleton(this);return t&&!t.destroyed?SingleEvent.instant(t):o.ƀeb(this).toSingleEvent()}static continuesSubscription(){let t=h((e,i)=>{this.getInstanceAsync().tap(s=>{e({type:"open",value:s}),s.onDestroy().tap(()=>{e({type:"close",value:s}),t(e,i);}).attach(i);}).attach(i);},"subscribe");return Sequence.create((e,i)=>t(e,i.attachable))}static getInstance(){return O.getSingleton(this)}static getInstanceOrFail(){return O.getSingletonOrFail(this)}constructor(){if(super(),this.constructor.getEntities().length>1)throw this.attachToRoot(),new Error(`SingletonEntity: entity is decorated as singleton but multiple instances are created! "${this}"`);this.onDestroy().tap(()=>o.ƀlq(this.constructor)).attachToRoot(),o.ƀeb(this.constructor).resolve(this);}};function Cr(){return function(o){return o.$meta={paramtypes:S.ƀep(o),type:"scene"},o}}h(Cr,"SceneDecorator");var me=class o extends IDAttachable{static{h(this,"Scene");}static{this.ƀgb=new Variable(false);}static{this.isTransitioning=this.ƀgb.notifier;}static{this.ƀb=new Variable(void 0);}static{this.activeScene=this.ƀb.notifier;}static getActiveSceneOrFail(){if(!o.ƀb.value)throw new Error("Scene: getActiveSceneOrFail is called when there is no active scene!");return o.ƀb.value}static cancelActiveScene(){return o.ƀb.value?o.ƀb.value.ƀj("cancel"):SingleEvent.instant()}static isActive(){return o.ƀb.value instanceof this}static getInstance(){return o.ƀb.value instanceof this?o.ƀb.value:void 0}static getInstanceOrFail(){if(!o.ƀb.value)throw new Error("Scene: getInstance is called when there is no active scene!");if(!(o.ƀb.value instanceof this))throw new Error(`Scene: getInstance is called while "${this.name}" was not the active scene. Current scene is: "${o.ƀb.value}"!`);return o.ƀb.value}static open(...t){if(o.ƀgb.value)throw new Error("Scene: you cannot open a scene while a scene is transitioning!");if(o.ƀb.value)throw new Error("Scene: you cannot open a scene while there is already another active scene!");let e=t[0];o.ƀgb.value=true;let i=S.ƀjk(this.$meta.paramtypes),r=new this(...i).attachToRoot();return o.ƀb.set(r),r.init(e).map(()=>(o.ƀgb.value=false,r)).chainToRoot()}constructor(){super(),this.ƀhl=new SingleAction,this.onClose=this.ƀhl.notifier,m.sceneUpdateAction.subscribe(t=>this.update(t.time,t.delta)).attach(this);}close(...t){if(o.ƀb.value!==this)throw new Error("Internal Error: Scene instance is accessed while it is not the active scene!");if(o.ƀgb.value)throw new Error("Scene: you cannot close a scene while a scene is transitioning!");o.ƀgb.value=true;let e=t[0];return this.ƀj(e).map(()=>(this.ƀhl.resolve(e),e)).chainToRoot()}ƀj(t){return this.prepareToClose(t).tap(()=>{super.destroy(),o.ƀb.set(void 0),o.ƀgb.value=false;}).chainToRoot()}destroy(){throw new Error('To close a scene use the "close()" function')}};R.onHardReset.subscribe(()=>{me.ƀb.set(void 0);}).attachToRoot();var N=class{static{h(this,"AnimationInterpolationFunctions");}static boomerangTime(t){return 1-Math.abs(t-.5)*2}static lineer(t){return t}static easeIn(t){return Math.pow(t,2)}static easeOut(t){return 1-Math.pow(1-t,2)}static easeInCubic(t){return Math.pow(t,3)}static easeOutCubic(t){return 1-Math.pow(1-t,3)}static easeInOut(t){return t<.5?2*t*t:(t-=1,1-2*t*t)}static easeInOutCubic(t){let e=2*t-2;return t<.5?4*Math.pow(t,3):(t-1)*Math.pow(e,2)+1}static blink(t){return t>.5?1:0}},Or=class{static{h(this,"AnimationLineer");}start(){}multiplierFunction(t){return N.lineer(t)}},Dr=class{static{h(this,"AnimationEaseIn");}start(){}multiplierFunction(t){return N.easeIn(t)}},Mr=class{static{h(this,"AnimationEaseOut");}start(){}multiplierFunction(t){return N.easeOut(t)}},Br=class{static{h(this,"AnimationEaseInOut");}start(){}multiplierFunction(t){return N.easeInOut(t)}},Gr=class{static{h(this,"AnimationEaseInCubic");}start(){}multiplierFunction(t){return N.easeInCubic(t)}},_r=class{static{h(this,"AnimationEaseOutCubic");}start(){}multiplierFunction(t){return N.easeOutCubic(t)}},Fr=class{static{h(this,"AnimationEaseInOutCubic");}start(){}multiplierFunction(t){return N.easeInOutCubic(t)}},Nr=class{static{h(this,"AnimationBlink");}start(){}multiplierFunction(t){return N.blink(t)}},Bi=class{static{h(this,"AnimationFlicker");}start(){this.ƀlm=new Array(10).fill(0),Random.integerBetween(0,9),this.ƀlm[Random.integerBetween(0,9)]=Math.random(),Math.random()<.3&&(Random.integerBetween(0,9),this.ƀlm[Random.integerBetween(0,9)]=Math.random()),Math.random()<.2&&(Random.integerBetween(0,9),this.ƀlm[Random.integerBetween(0,9)]=Math.random());}multiplierFunction(t){let e=Math.floor(t*10);return this.ƀlm[e]}},x=class{static{h(this,"Animations");}static{this.lineer=new Or;}static{this.easeIn=new Dr;}static{this.easeOut=new Mr;}static{this.easeInOut=new Br;}static{this.easeInCubic=new Gr;}static{this.easeOutCubic=new _r;}static{this.easeInOutCubic=new Fr;}static{this.blink=new Nr;}};var C;(function(o){o[o.ThrowError=1]="ThrowError",o[o.IgnoreNewAnimation=2]="IgnoreNewAnimation",o[o.CompletePrevious=3]="CompletePrevious";})(C||(C={}));var E;(function(o){o[o.ReturnToOriginal=1]="ReturnToOriginal",o[o.StayInCurrentState=2]="StayInCurrentState",o[o.JumpToEnd=3]="JumpToEnd",o[o.Loop=4]="Loop";})(E||(E={}));var I=class o{static{h(this,"Animator");}static{this.ƀl=new WeakMap;}static ƀdu(t){let e=o.ƀl.get(t);return e||(e=new MapToWeakRefs,o.ƀl.set(t,e)),e}get animating(){return this.ƀhv!==void 0}get target(){return this.ƀld}get value(){return this.ƀlw||(this.ƀlw=new Variable(this.ƀld)),this.ƀlw.notifier}get paused(){return this.ƀie!==void 0}set paused(t){this.ƀie=t?true:void 0;}constructor(t,e,i){this.ƀgc=false,this.ƀki=false,this.ƀld=t,this.ƀhx={duration:200,animation:x.lineer,reAnimateHandling:C.ThrowError,completionHandling:E.StayInCurrentState,...i},this.ƀm=Comparator.isArray(e)?e:[e],this.ƀgp(t,this.ƀm);}animate(t,e){let i={...this.ƀhx,...e},r=this.ƀhv;if(this.ƀhv)switch(i.reAnimateHandling){case C.ThrowError:throw new Error("Animator: new animation triggered while another is not complete yet.");case C.IgnoreNewAnimation:return SingleEvent.instant().notIdle();case C.CompletePrevious:this.ƀjx(i.completionHandling,this.ƀhv.ƀja,true);break;default:{throw new Error(`Animator: unknown re-animate handling type: "${i.reAnimateHandling}"`)}}return SingleEvent.create(n=>{this.ƀgc&&(this.ƀki=true);let a={};for(let c of this.ƀm)a[c]={ƀkx:this.ƀld[c],ƀlf:t[c]};let l={ƀcy:i.duration,ƀcz:0,ƀja:a,ƀbj:i.completionHandling,ƀn:i.animation,ƀbi:n};if(l.ƀbj!==E.Loop&&this.ƀfy(l)){this.ƀhv=void 0,n(),r?.ƀbi(),this.ƀay();return}return l.ƀn.start(),this.ƀhv=l,this.ƀdc(),r?.ƀbi(),()=>{this.ƀhv===l&&(this.ƀld instanceof Attachable&&this.ƀld.destroyed||this.ƀjx(l.ƀbj,l.ƀja,true),this.ƀhv=void 0,this.ƀay());}}).notIdle()}set(t){this.ƀmi(e=>t[e]),this.ƀhv?.ƀbi();}completeAnimation(t){if(this.ƀhv){t=t??this.ƀhv.ƀbj,this.ƀjx(t,this.ƀhv.ƀja,true);let e=this.ƀhv.ƀbi;this.ƀhv=void 0,e();}}ƀdc(){this.ƀls||(this.ƀls=m.beforeSceneUpdateAction.subscribe(t=>{if(!this.ƀie){this.ƀgc=true;try{let e=this.ƀhv;if(!e)return;if(e.ƀcz+=t.delta,e.ƀcz>=e.ƀcy)if(e.ƀbj===E.Loop)e.ƀcz%=e.ƀcy,e.ƀn.start();else {this.ƀjx(e.ƀbj,e.ƀja,!1),this.ƀhv=void 0,e.ƀbi(),this.ƀay();return}let i=e.ƀn.multiplierFunction(e.ƀcz/e.ƀcy);this.ƀmi(r=>{let s=e.ƀja[r];return (s.ƀlf-s.ƀkx)*i+s.ƀkx});}finally{this.ƀgc=false,this.ƀki&&(this.ƀki=false,this.ƀcr(),this.ƀdc());}}}).attachToRoot());}ƀfy(t){return this.ƀm.every(e=>this.ƀld[e]===t.ƀja[e].ƀlf)}ƀjx(t,e,i){switch(t){case E.ReturnToOriginal:case E.Loop:this.ƀmi(r=>e[r].ƀkx);break;case E.JumpToEnd:this.ƀmi(r=>e[r].ƀlf);break;case E.StayInCurrentState:i||this.ƀmi(r=>e[r].ƀlf);break;default:{throw new Error(`Animator: unknown completion handling type: "${t}"`)}}}ƀmi(t){let e=false;for(let i of this.ƀm){let r=t(i);this.ƀld[i]!==r&&(e=true,this.ƀld[i]=r);}e&&this.ƀlw?.set(this.ƀld);}ƀay(){this.ƀhv||this.ƀcr();}ƀcr(){this.ƀls?.destroy(),this.ƀls=void 0;}ƀgp(t,e){let i=o.ƀdu(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 At;(function(o){o.Click="click",o.MouseOver="mouseover",o.MouseOut="mouseout",o.PointerDown="pointerdown",o.PointerUp="pointerup",o.PointerUpOutside="pointerupoutside",o.PointerMove="pointermove",o.PointerCancel="pointercancel",o.PointerOver="pointerover",o.PointerOut="pointerout",o.PointerEnter="pointerenter",o.PointerLeave="pointerleave",o.Added="added",o.Removed="removed",o.Update="update",o.Change="change",o.Wheel="wheel";})(At||(At={}));var ti;(function(o){o.Default="default",o.Pointer="pointer";})(ti||(ti={}));var ge=class extends IDAttachable{static{h(this,"ContainerAttributes");}constructor(){super(),this.ƀhc=false,this.ƀdm=false,this.ƀjm=1,this.ƀw=1,this.ƀis=new V.Container;}get size(){return this.getSize()}set size(t){this.setSize(t);}getSize(){return new Vector(this.ƀis.width,this.ƀis.height)}setSize(t){return this.ƀis.width=t.x,this.ƀis.height=t.y,this}setPosition(t,e){if(e?.holdFrom){let i=this.ƀis.getLocalBounds(),r=new Vector(this.ƀis.scale.x,this.ƀis.scale.y),s=new Vector(i.x,i.y).multiply(r),n=new Vector(i.width,i.height).multiply(r),a=s.add(n.multiply(e.holdFrom));t=t.subtract(a);}return e?.round!==false&&(t=t.round({rollHalfsDown:true})),this.position=t,this}get position(){return new Vector(this.ƀis.x,this.ƀis.y)}set position(t){this.ƀis.position=t;}get x(){return this.ƀis.x}set x(t){this.ƀis.x=t;}get y(){return this.ƀis.y}set y(t){this.ƀis.y=t;}on(t){return Sequence.create(e=>{let i=h(r=>{if(t===At.Wheel){let n=r.deltaY;e({deltaY:n});}else e(void 0);},"handle");return this.ƀis.on(t,i),()=>this.ƀis.off(t,i)}).notIdle()}setRotation(t){return this.rotation=t,this}get rotation(){return new Radian(this.ƀis.rotation)}set rotation(t){this.ƀis.rotation=t.value;}get rotationValue(){return this.rotation.value}set rotationValue(t){this.rotation=new Radian(t);}setZIndex(t){return this.zIndex=t,this}get zIndex(){return this.ƀis.zIndex}set zIndex(t){this.ƀis.zIndex=t;}setSkewX(t){return this.skewX=t,this}get skewX(){return new Radian(this.ƀis.skew.x)}set skewX(t){this.ƀis.skew.x=t.value;}setSkewY(t){return this.skewY=t,this}get skewY(){return new Radian(this.ƀis.skew.y)}set skewY(t){this.ƀis.skew.y=t.value;}setSortableChildren(t){return this.sortableChildren=t,this}get sortableChildren(){return this.ƀis.sortableChildren}set sortableChildren(t){this.ƀis.sortableChildren=t;}setAlpha(t){return this.ƀis.alpha=t,this}get alpha(){return this.ƀis.alpha}set alpha(t){this.ƀis.alpha=t;}setInteractive(t){return this.interactive=t,this}get interactive(){return this.ƀis.interactive}set interactive(t){t?this.ƀis.eventMode="dynamic":this.ƀis.eventMode="none";}setCursor(t){return this.cursor=t,this}get cursor(){return this.ƀis.cursor}set cursor(t){this.ƀis.cursor=t;}getMask(){throw new Error("ContainerAttributes: mask is not available!")}setMask(t){return t?(this.ƀis.addChild(t.ƀis),this.ƀis.mask=t.getMask(),this.ƀgs=t):(this.ƀgs&&this.ƀis.removeChild(this.ƀgs.ƀis),this.ƀis.mask=null),this}hitTest(t){if(this.ƀis.parent)if(this.ƀis.hitArea){let e=this.ƀis.toLocal(t);return this.ƀis.hitArea.contains(e.x,e.y)}else return this.ƀis.getBounds().contains(t.x,t.y);else return false}get boundingBox(){let t=this.ƀis.getLocalBounds();return new Rectangle(new Vector(t.x,t.y),new Vector(t.x+t.width,t.y+t.height))}ignoreBounds(t=true){return t?(this.ƀhy||(this.ƀhy=this.ƀis.calculateBounds),this.ƀis.calculateBounds=()=>this.ƀis._bounds.clear()):this.ƀhy&&(this.ƀis.calculateBounds=this.ƀhy),this}setMirror(t=false){return this.mirror=t,this}get mirror(){return this.ƀhc}set mirror(t){this.ƀhc=t,this.ƀlu();}setFlip(t=false){return this.flip=t,this}get flip(){return this.ƀdm}set flip(t){this.ƀdm=t,this.ƀlu();}setScale(t){return this.scale=t,this}get scale(){return this.ƀjm}set scale(t){this.ƀjm=t,this.ƀlu();}setAspectRatio(t){return this.aspectRatio=t,this}get aspectRatio(){return this.ƀw}set aspectRatio(t){this.ƀw=t,this.ƀlu();}ƀlu(){this.ƀis.scale.set(this.ƀjm,this.ƀjm),this.ƀw<1?this.ƀis.scale.x*=this.ƀw:this.ƀw>1&&(this.ƀis.scale.y/=this.ƀw),this.ƀhc&&(this.ƀis.scale.x*=-1),this.ƀdm&&(this.ƀis.scale.y*=-1);}};var D=2,Ct;(function(o){o[o.Normal=0]="Normal",o[o.Add=1]="Add",o[o.Screen=3]="Screen",o[o.Luminosity=16]="Luminosity",o[o.ColorDodge=7]="ColorDodge";})(Ct||(Ct={}));var we=class{static{h(this,"GaussianValuesHelper");}static ƀds(t,e){let i=e*e,r=1/(PI_360*i),s=-(t*t)/(2*i);return r*Math.exp(s)}static getValuesForLinearSamplingPascal(t){let e=t*2,i=Math.pow(2,e),r=.005*i,s=NumberHelper.pascalTriangleRow(e).slice(t).filter(l=>{if(l<r)i-=l*2;else return true}),n=1/i,a=s.map(l=>l*n);return this.ƀbu(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=ArrayHelper.createIntegerArray(Math.ceil(t*.75)).map(r=>this.ƀds(r,t*.4)),i=e.reduce((r,s)=>r+s,0);return i=i*2-e[0],e=e.map(r=>r/i),this.ƀbu(e)}}static ƀbu(t){let e=[{offset:0,multiplier:t[0]}];for(let i=1;i<t.length-1;i+=2){let r=t[i]+t[i+1],s=i+t[i+1]/r;e.push({offset:s,multiplier:r});}if(t.length%2===0){let i=t[t.length-1],r=t.length-1;e.push({offset:r,multiplier:i});}return e}};var Fi=class ei extends V.Filter{static{h(this,"BlurFilterPass");}static ƀev(){return `
2
2
  attribute vec2 aVertexPosition;
3
3
  attribute vec2 aTextureCoord;
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bard-legends-framework",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "Bard Legends Framework",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {