Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eva/eva.js

Package Overview
Dependencies
Maintainers
5
Versions
168
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eva/eva.js - npm Package Compare versions

Comparing version 1.2.7-editor.0 to 1.2.7-editor.1

2

dist/eva.js.cjs.prod.js

@@ -15,2 +15,2 @@ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("eventemitter3"),t=require("lodash-es"),r=require("@eva/inspector-decorator"),o=require("resource-loader");function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var a=n(e),i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};

and limitations under the License.
***************************************************************************** */function s(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,o){var n,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,r,i):n(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,o){return new(r||(r=Promise))((function(n,a){function i(e){try{c(o.next(e))}catch(e){a(e)}}function s(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):new r((function(t){t(e.value)})).then(i,s)}c((o=o.apply(e,t||[])).next())}))}function l(e,t){var r,o,n,a,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(n=i.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(6===a[0]&&i.label<n[1]){i.label=n[1],n=a;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(a);break}n[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(d(arguments[t]));return e}var y,m=function(e){function t(t){var r=e.call(this)||this;return r.started=!1,r.name=r.constructor.componentName,r.__componentDefaultParams=t,r}return s(t,e),t}(a),v=m;exports.OBSERVER_TYPE=void 0,(y=exports.OBSERVER_TYPE||(exports.OBSERVER_TYPE={})).ADD="ADD",y.REMOVE="REMOVE",y.CHANGE="CHANGE";var g={},b={},E={},_={};function O(e,t){g[e.gameObject.id]||(g[e.gameObject.id]={});var r=g[e.gameObject.id],o=e.name+"_"+t.join(",");if(r[o])return r[o];for(var n=t.length-1,a=e,i=0;i<n;i++)a=a[t[i]];return r[o]={property:a,key:t[n]},r[o]}function x(e){var t,r,o=e.systemName,n=e.componentName,a=e.component,i=e.prop,s=e.type;null===(r=null===(t=b[o])||void 0===t?void 0:t.componentObserver)||void 0===r||r.add({component:a,prop:i,type:s,componentName:n})}function R(e){var r,o,n=e.obj,a=e.key,i=e.prop,s=e.component,c=e.componentName;if(void 0!==n)if(a in n){if(Object.defineProperty(n,"_"+a,{enumerable:!1,writable:!0,value:n[a]}),i.deep&&t.isObject(n[a]))try{for(var u=f(Object.keys(n[a])),p=u.next();!p.done;p=u.next()){var l=p.value;R({obj:n[a],key:l,prop:i,component:s,componentName:c})}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}Object.defineProperty(n,a,{enumerable:!0,set:function(e){n["_"+a]!==e&&(n["_"+a]=e,function(e){var r=e.prop,o=e.component,n=e.componentName;for(var a in E){var i=(E[a]||{})[n];i&&i.findIndex((function(e){return t.isEqual(e,r)}))>-1&&x({systemName:a,componentName:n,component:o,prop:r,type:exports.OBSERVER_TYPE.CHANGE})}}({prop:i,component:s,componentName:c}))},get:function(){return n["_"+a]}})}else console.error("prop "+a+" not in component: "+c+", Can not observer")}function T(e,t){var r,o;for(var n in void 0===t&&(t=e.name),E){(E[n]||{})[t]&&(null===(o=null===(r=b[n])||void 0===r?void 0:r.componentObserver)||void 0===o||o.add({component:e,type:exports.OBSERVER_TYPE.REMOVE,componentName:t}))}!function(e){e.gameObject&&delete g[e.gameObject.id]}(e)}var S=function(){function e(){}return c([r.Field({step:.1,default:0}),u("design:type",Number)],e.prototype,"x",void 0),c([r.Field({step:.1,default:0}),u("design:type",Number)],e.prototype,"y",void 0),e}(),w=function(){function e(){}return c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"x",void 0),c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"y",void 0),e}(),k=function(){function e(){}return c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"width",void 0),c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"height",void 0),e}(),j=function(){function e(){}return c([r.Field({step:.1,default:1}),u("design:type",Number)],e.prototype,"x",void 0),c([r.Field({step:.1,default:1}),u("design:type",Number)],e.prototype,"y",void 0),e}(),P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Transform",t._parent=null,t.childIndex=-1,t.inScene=!1,t.children=[],t.position={x:0,y:0},t.size={width:0,height:0},t.origin={x:0,y:0},t.anchor={x:0,y:0},t.scale={x:1,y:1},t.skew={x:0,y:0},t.rotation=0,t}return s(t,e),t.prototype.init=function(e){var t,r;void 0===e&&(e={});try{for(var o=f(["position","size","origin","anchor","scale","skew"]),n=o.next();!n.done;n=o.next()){var a=n.value;Object.assign(this[a],e[a])}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this.rotation=e.rotation||this.rotation},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){e?e.addChild(this):this.parent&&this.parent.removeChild(this)},enumerable:!1,configurable:!0}),t.prototype.addChild=function(e){e.parent&&e.parent.removeChild(e),e._parent=this,e.childIndex>-1?this.children.splice(e.childIndex,0,e):this.children.push(e)},t.prototype.removeChild=function(e){var t=this.children.findIndex((function(t){return t===e}));t>-1&&(this.children.splice(t,1),e._parent=null)},t.prototype.clearChildren=function(){this.children.length=0},t.componentName="Transform",c([r.Field((function(){return w})),u("design:type",w)],t.prototype,"position",void 0),c([r.Field((function(){return k})),u("design:type",k)],t.prototype,"size",void 0),c([r.Field((function(){return S})),u("design:type",S)],t.prototype,"origin",void 0),c([r.Field((function(){return S})),u("design:type",S)],t.prototype,"anchor",void 0),c([r.Field((function(){return j})),u("design:type",S)],t.prototype,"scale",void 0),c([r.Field((function(){return S})),u("design:type",S)],t.prototype,"skew",void 0),c([r.Field({step:.1}),u("design:type",Number)],t.prototype,"rotation",void 0),t}(v),L=0;var C=function(){function e(e,t){this._componentCache={},this.components=[],this.destroyed=!1,this._name=e,this.id=++L,this.addComponent(P,t)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(P)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform&&this.transform.parent&&this.transform.parent.gameObject},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(e){var t,r;if(this._scene!==e){var o=this._scene;if(this._scene=e,this.transform&&this.transform.children)try{for(var n=f(this.transform.children),a=n.next();!a.done;a=n.next()){a.value.gameObject.scene=e}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e?e.addGameObject(this):o&&o.removeGameObject(this)}},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t&&t.transform&&t!==this){if(!(t instanceof e))throw new Error("addChild only receive GameObject");if(!this.transform)throw new Error("gameObject '"+this.name+"' has been destroy");t.transform.parent=this.transform,t.scene=this.scene}},e.prototype.addChildAt=function(e,t){if(t>this.transform.children.length)throw new Error(e.name+"addChildAt: The index 18 supplied is out of bounds "+this.transform.children.length);this.addChild(e),e.transform.childIndex=t},e.prototype.removeChild=function(t){return t instanceof e&&t.parent&&t.parent===this?(t.transform.parent=null,t.scene=null,t):t},e.prototype.addComponent=function(e,t){if(!this.destroyed){var r=function(e){return e instanceof m?e.name:e instanceof Function?e.componentName:void 0}(e);if(!this._componentCache[r]){var o;if(e instanceof Function)o=new e(t);else{if(!(e instanceof v))throw new Error("addComponent recieve Component and Component Constructor");o=e}if(o.gameObject)throw new Error("component has been added on gameObject "+o.gameObject.name);return o.gameObject=this,o.init&&o.init(o.__componentDefaultParams),function(e,t){var r,o;for(var n in void 0===t&&(t=e.name),E)(E[n]||{})[t]&&(null===(o=null===(r=b[n])||void 0===r?void 0:r.componentObserver)||void 0===o||o.add({component:e,type:exports.OBSERVER_TYPE.ADD,componentName:t}))}(o,o.name),function(e,t){var r,o;if(void 0===t&&(t=e.name),t&&_[t]){if(!(e&&(n=e,n&&n.constructor&&"componentName"in n.constructor)))throw new Error("component param must be an instance of Component");var n;if(!e.gameObject||!e.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var a=f(_[t]),i=a.next();!i.done;i=a.next()){var s=i.value,c=O(e,s.prop);R({obj:c.property,key:c.key,prop:s,component:e,componentName:t})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}}(o,o.name),this.components.push(o),this._componentCache[r]=o,o.awake&&o.awake(),o}}},e.prototype.removeComponent=function(e){var t;if("string"==typeof e?t=e:e instanceof v?t=e.name:e.componentName&&(t=e.componentName),"Transform"===t)throw new Error("Transform can't be removed");return this._removeComponent(t)},e.prototype._removeComponent=function(e){var t=this.components.findIndex((function(t){return t.name===e}));if(-1!==t){var r=this.components.splice(t,1)[0];return delete this._componentCache[e],delete r.__componentDefaultParams,r.onDestroy&&r.onDestroy(),T(r,e),r.gameObject=void 0,r}},e.prototype.getComponent=function(e){var t;return"string"==typeof e?t=e:e instanceof v?t=e.name:e.componentName&&(t=e.componentName),void 0!==this._componentCache[t]?this._componentCache[t]:void 0},e.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},e.prototype.destroy=function(){if(this.transform){for(var e in Array.from(this.transform.children).forEach((function(e){e.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(e);this.components.length=0,this.destroyed=!0}else console.error("Cannot destroy gameObject that have already been destroyed.")},e}(),N=function(){function e(){this.events=[]}return e.prototype.add=function(e){var r=e.component,o=e.prop,n=e.type,a=e.componentName;if(n===exports.OBSERVER_TYPE.REMOVE){if(this.events.find((function(e){return e.component===r&&e.type===exports.OBSERVER_TYPE.ADD})))return void(this.events=this.events.filter((function(e){return e.component!==r})));this.events=this.events.filter((function(e){return e.component!==r}))}var i=this.events.findIndex((function(e){return e.component===r&&t.isEqual(e.prop,o)&&e.type===n}));i>-1&&this.events.splice(i,1),this.events.push({gameObject:r.gameObject,component:r,prop:o,type:n,componentName:a})},e.prototype.getChanged=function(){return this.events},Object.defineProperty(e.prototype,"changed",{get:function(){return this.events},enumerable:!1,configurable:!0}),e.prototype.clear=function(){var e=this.events;return this.events=[],e},e}(),M=function(){function e(e){this.started=!1,this.componentObserver=new N,this.__systemDefaultParams=e,this.name=this.constructor.systemName}return e.prototype.destroy=function(){var e;this.componentObserver=null,this.__systemDefaultParams=null,null===(e=this.onDestroy)||void 0===e||e.call(this)},e}();var A,I=Date.now?Date.now:function(){return(new Date).getTime()},D={originTime:0,playbackRate:1},F=function(){function e(t,r){t instanceof e&&(r=t,t={}),t=Object.assign({},D,t),r&&(this._parent=r),this._createTime=I(),this._timeMark=[{globalTime:this.globalTime,localTime:-t.originTime,entropy:-t.originTime,playbackRate:t.playbackRate,globalEntropy:0}],this._parent&&(this._timeMark[0].globalEntropy=this._parent.entropy),this._playbackRate=t.playbackRate}return Object.defineProperty(e.prototype,"globalTime",{get:function(){return this.parent?this.parent.currentTime:I()-this._createTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastTimeMark",{get:function(){return this._timeMark[this._timeMark.length-1]},enumerable:!1,configurable:!0}),e.prototype.markTime=function(e){var t=void 0===e?{}:e,r=t.time,o=void 0===r?this.currentTime:r,n=t.entropy,a=void 0===n?this.entropy:n,i=t.playbackRate,s=void 0===i?this.playbackRate:i,c={globalTime:this.globalTime,localTime:o,entropy:a,playbackRate:s,globalEntropy:this.globalEntropy};this._timeMark.push(c)},Object.defineProperty(e.prototype,"currentTime",{get:function(){var e=this.lastTimeMark,t=e.localTime,r=e.globalTime;return t+(this.globalTime-r)*this.playbackRate},set:function(e){this.markTime({time:e})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalEntropy",{get:function(){return this._parent?this._parent.entropy:this.globalTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entropy",{get:function(){var e=this.lastTimeMark,t=e.entropy,r=e.globalEntropy;return t+Math.abs((this.globalEntropy-r)*this.playbackRate)},set:function(e){if(this.entropy>e){var t=this.seekTimeMark(e);this._timeMark.length=t+1}this.markTime({entropy:e})},enumerable:!1,configurable:!0}),e.prototype.fork=function(t){return new e(t,this)},e.prototype.seekGlobalTime=function(e){var t=this.seekTimeMark(e),r=this._timeMark[t],o=r.entropy,n=r.playbackRate;return r.globalTime+(e-o)/Math.abs(n)},e.prototype.seekLocalTime=function(e){var t=this.seekTimeMark(e),r=this._timeMark[t],o=r.localTime,n=r.entropy;return r.playbackRate>0?o+(e-n):o-(e-n)},e.prototype.seekTimeMark=function(e){var t=this._timeMark,r=0,o=t.length-1;if(e<=t[r].entropy)return r;if(e>=t[o].entropy)return o;for(var n=Math.floor((r+o)/2);n>r&&n<o;){if(e===t[n].entropy)return n;e<t[n].entropy?o=n:e>t[n].entropy&&(r=n),n=Math.floor((r+o)/2)}return r},Object.defineProperty(e.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(e){e!==this.playbackRate&&(this.markTime({playbackRate:e}),this._playbackRate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){if(0===this.playbackRate)return!0;for(var e=this.parent;e;){if(0===e.playbackRate)return!0;e=e.parent}return!1},enumerable:!1,configurable:!0}),e}(),V={autoStart:!0,frameRate:60},X=function(){function e(e){var t=this;e=Object.assign({},V,e),this._frameCount=0,this._frameDuration=1e3/e.frameRate,this.autoStart=e.autoStart,this.frameRate=e.frameRate,this.timeline=new F({originTime:0,playbackRate:1}),this._lastFrameTime=this.timeline.currentTime,this._tickers=new Set,this._requestId=null,this._ticker=function(){t._started&&(t._requestId=requestAnimationFrame(t._ticker),t.update())},this.autoStart&&this.start()}return e.prototype.update=function(){var e,t,r=this.timeline.currentTime,o=r-this._lastFrameTime;if(o>=this._frameDuration){var n=r-o%this._frameDuration,a=n-this._lastFrameTime;this._lastFrameTime=n;var i={deltaTime:a,time:n,currentTime:n,frameCount:++this._frameCount,fps:Math.round(1e3/a)};try{for(var s=f(this._tickers),c=s.next();!c.done;c=s.next()){var u=c.value;"function"==typeof u&&u(i)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}}},e.prototype.add=function(e){this._tickers.add(e)},e.prototype.remove=function(e){this._tickers.delete(e)},e.prototype.start=function(){this._started||(this._started=!0,this.timeline.playbackRate=1,this._requestId=requestAnimationFrame(this._ticker))},e.prototype.pause=function(){this._started=!1,this.timeline.playbackRate=0},e.prototype.setPlaybackRate=function(e){this.timeline.playbackRate=e},e}(),G=function(e){function t(t,r){var o=e.call(this,t,r)||this;return o.gameObjects=[],o.scene=o,o}return s(t,e),t.prototype.addGameObject=function(e){this.gameObjects.push(e),e.transform&&(e.transform.inScene=!0)},t.prototype.removeGameObject=function(e){var t=this.gameObjects.indexOf(e);-1!==t&&(e.transform&&(e.transform.inScene=!1),this.gameObjects.splice(t,1))},t.prototype.destroy=function(){this.scene=null,e.prototype.destroy.call(this),this.gameObjects=null,this.canvas=null},t}(C);exports.LOAD_SCENE_MODE=void 0,(A=exports.LOAD_SCENE_MODE||(exports.LOAD_SCENE_MODE={})).SINGLE="SINGLE",A.MULTI_CANVAS="MULTI_CANVAS";var Y=function(e){if((e instanceof M||e instanceof v)&&!e.started){e.started=!0;try{e.start&&e.start()}catch(t){e instanceof v?console.error(e.constructor.componentName+" start error",t):console.error(e.constructor.systemName+" start error",t)}}},U=function(e){function r(t){var r,o,n=void 0===t?{}:t,a=n.systems,i=n.frameRate,s=void 0===i?60:i,c=n.autoStart,u=void 0===c||c,p=n.needScene,l=void 0===p||p,d=n.mode,h=void 0===d?"PLAY":d,y=e.call(this)||this;if(y.playing=!1,y.started=!1,y.multiScenes=[],y.systems=[],y.mode="PLAY",y.mode=h,window.__EVA_INSPECTOR_ENV__&&(window.__EVA_GAME_INSTANCE__=y),y.ticker=new X({autoStart:!1,frameRate:s}),y.initTicker(),a&&a.length)try{for(var m=f(a),v=m.next();!v.done;v=m.next()){var g=v.value;y.addSystem(g)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=m.return)&&o.call(m)}finally{if(r)throw r.error}}return l&&y.loadScene(new G("scene")),u&&y.start(),y}return s(r,e),Object.defineProperty(r.prototype,"scene",{get:function(){return this._scene},set:function(e){this._scene=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"gameObjects",{get:function(){return function(e){var t,r,o,n=(null===(o=null==e?void 0:e.scene)||void 0===o?void 0:o.gameObjects)||[],a=null==e?void 0:e.multiScenes.map((function(e){return e.gameObjects})),i=[];try{for(var s=f(a),c=s.next();!c.done;c=s.next())i=h(i,c.value)}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return h(n,i)}(this)},enumerable:!1,configurable:!0}),r.prototype.addSystem=function(e,r){var o;if(e instanceof Function)o=new e(r);else{if(!(e instanceof M))return void console.warn("can only add System");o=e}if(!this.systems.find((function(e){return e.constructor===o.constructor}))){o.game=this,o.init&&o.init(o.__systemDefaultParams),function(e,t){E[t.systemName]=t.observerInfo,b[t.systemName]=e}(o,o.constructor),function(e){var r,o,n,a,i=[];e instanceof Array?i.push.apply(i,h(e)):i.push(e);try{for(var s=f(i),c=s.next();!c.done;c=s.next()){var u=c.value;for(var p in u.observerInfo){_[p]=_[p]||[];var l=_[p],d=function(e){-1===l.findIndex((function(r){return t.isEqual(r,e)}))&&_[p].push(e)};try{for(var y=(n=void 0,f(u.observerInfo[p])),m=y.next();!m.done;m=y.next())d(m.value)}catch(e){n={error:e}}finally{try{m&&!m.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}(o.constructor);try{o.awake&&o.awake()}catch(e){console.error(o.constructor.systemName+" awake error",e)}return this.systems.push(o),o}console.warn(o.constructor.systemName+" System has been added")},r.prototype.removeSystem=function(e){if(e){var t=-1;"string"==typeof e?t=this.systems.findIndex((function(t){return t.name===e})):e instanceof Function?t=this.systems.findIndex((function(t){return t.constructor===e})):e instanceof M&&(t=this.systems.findIndex((function(t){return t===e}))),t>-1&&(this.systems[t].destroy&&this.systems[t].destroy(),this.systems.splice(t,1))}},r.prototype.getSystem=function(e){return this.systems.find((function(t){return"string"==typeof e?t.name===e:t instanceof e}))},r.prototype.pause=function(){this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},r.prototype.start=function(){this.playing||(this.playing=!0,this.started=!0,this.ticker.start())},r.prototype.resume=function(){this.playing||(this.playing=!0,this.ticker.start(),this.triggerResume())},r.prototype.initTicker=function(){var e=this;this.ticker.add((function(t){var r,o,n,a;e.scene&&e.gameObjectLoop(t,e.gameObjects);try{for(var i=f(e.systems),s=i.next();!s.done;s=i.next()){var c=s.value;try{Y(c),c.update&&c.update(t)}catch(t){console.error(c.constructor.systemName+" update error",t)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}try{for(var u=f(e.systems),p=u.next();!p.done;p=u.next()){c=p.value;try{c.lateUpdate&&c.lateUpdate(t)}catch(t){console.error(c.constructor.systemName+" lateUpdate error",t)}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}}))},r.prototype.triggerResume=function(){var e,t;!function(e){var t,r,o,n;try{for(var a=f(e),i=a.next();!i.done;i=a.next()){var s=i.value;try{for(var c=(o=void 0,f(s.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onResume&&p.onResume()}catch(e){console.error("gameObject: "+s.name+", "+p.name+", onResume error",e)}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=f(this.systems),o=r.next();!o.done;o=r.next()){var n=o.value;try{n.onResume&&n.onResume()}catch(e){console.error(n.constructor.systemName+", onResume error",e)}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},r.prototype.triggerPause=function(){var e,t;!function(e){var t,r,o,n;try{for(var a=f(e),i=a.next();!i.done;i=a.next()){var s=i.value;try{for(var c=(o=void 0,f(s.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onPause&&p.onPause()}catch(e){console.error("gameObject: "+s.name+", "+p.name+", onResume error",e)}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=f(this.systems),o=r.next();!o.done;o=r.next()){var n=o.value;try{n.onPause&&n.onPause()}catch(e){console.error(n.constructor.systemName+", onPause error",e)}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},r.prototype.destroySystems=function(){var e,t;try{for(var r=f(h(this.systems)),o=r.next();!o.done;o=r.next()){var n=o.value;this.removeSystem(n)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.systems.length=0},r.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},r.prototype.loadScene=function(e){var t=e.scene,r=e.mode,o=void 0===r?exports.LOAD_SCENE_MODE.SINGLE:r,n=e.params,a=void 0===n?{}:n;if(t){switch(o){case exports.LOAD_SCENE_MODE.SINGLE:this.scene=t;break;case exports.LOAD_SCENE_MODE.MULTI_CANVAS:this.multiScenes.push(t)}this.emit("sceneChanged",{scene:t,mode:o,params:a})}},r.prototype.gameObjectLoop=function(e,t){var r,o,n,a,i,s,c,u;void 0===t&&(t=[]);try{for(var p=f(t),l=p.next();!l.done;l=p.next()){var d=l.value;try{for(var h=(n=void 0,f(d.components)),y=h.next();!y.done;y=h.next()){var m=y.value;try{"PLAY"===this.mode&&(Y(m),m.update&&m.update(e))}catch(e){console.error("gameObject: "+d.name+" "+m.name+" update error",e)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(a=h.return)&&a.call(h)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}try{for(var v=f(t),g=v.next();!g.done;g=v.next()){d=g.value;try{for(var b=(c=void 0,f(d.components)),E=b.next();!E.done;E=b.next()){m=E.value;try{"PLAY"===this.mode&&m.lateUpdate&&m.lateUpdate(e)}catch(e){console.error("gameObject: "+d.name+" "+m.name+" lateUpdate error",e)}}}catch(e){c={error:e}}finally{try{E&&!E.done&&(u=b.return)&&u.call(b)}finally{if(c)throw c.error}}}}catch(e){i={error:e}}finally{try{g&&!g.done&&(s=v.return)&&s.call(v)}finally{if(i)throw i.error}}},r}(a);function q(e){return void 0===e&&(e={}),function(t){if(!t.observerInfo){for(var r in e)for(var o in e[r]){"string"==typeof e[r][o]&&(e[r][o]=[e[r][o]]);var n=void 0;Array.isArray(e[r][o])&&(n={prop:e[r][o],deep:!1},e[r][o]=n),"string"==typeof(n=e[r][o]).prop&&(n.prop=[n.prop])}t.observerInfo=e}}}var B,H,z=function(e){function t(t){var r=t.resource,o=t.resourceTotal,n=e.call(this)||this;return n.progress=0,n.resourceTotal=0,n.resourceLoadedCount=0,n.resource=r,n.resourceTotal=o,0===o&&n.resource.emit(exports.LOAD_EVENT.COMPLETE,n),n}return s(t,e),t.prototype.onStart=function(){this.resource.emit(exports.LOAD_EVENT.START,this)},t.prototype.onProgress=function(e){this.resourceLoadedCount++,this.progress=Math.floor(this.resourceLoadedCount/this.resourceTotal*100)/100,e.success?this.resource.emit(exports.LOAD_EVENT.LOADED,this,e):this.resource.emit(exports.LOAD_EVENT.ERROR,this,e),this.resource.emit(exports.LOAD_EVENT.PROGRESS,this,e),this.resourceLoadedCount===this.resourceTotal&&this.resource.emit(exports.LOAD_EVENT.COMPLETE,this)},t}(a),J={AbstractLoadStrategy:o.AbstractLoadStrategy,AudioLoadStrategy:o.AudioLoadStrategy,ImageLoadStrategy:o.ImageLoadStrategy,XhrResponseType:o.XhrResponseType,MediaElementLoadStrategy:o.MediaElementLoadStrategy,VideoLoadStrategy:o.VideoLoadStrategy,XhrLoadStrategy:o.XhrLoadStrategy,Loader:o.Loader,Resource:o.Resource,ResourceType:o.ResourceType,ResourceState:o.ResourceState};exports.LOAD_EVENT=void 0,(B=exports.LOAD_EVENT||(exports.LOAD_EVENT={})).START="start",B.PROGRESS="progress",B.LOADED="loaded",B.COMPLETE="complete",B.ERROR="error",exports.RESOURCE_TYPE=void 0,(H=exports.RESOURCE_TYPE||(exports.RESOURCE_TYPE={})).IMAGE="IMAGE",H.SPRITE="SPRITE",H.SPRITE_ANIMATION="SPRITE_ANIMATION",H.AUDIO="AUDIO",H.VIDEO="VIDEO",o.XhrLoadStrategy.setExtensionXhrType("json",o.XhrResponseType.Json),o.XhrLoadStrategy.setExtensionXhrType("tex",o.XhrResponseType.Json),o.XhrLoadStrategy.setExtensionXhrType("ske",o.XhrResponseType.Json),o.XhrLoadStrategy.setExtensionXhrType("mp3",o.XhrResponseType.Buffer),o.XhrLoadStrategy.setExtensionXhrType("wav",o.XhrResponseType.Buffer),o.XhrLoadStrategy.setExtensionXhrType("aac",o.XhrResponseType.Buffer),o.XhrLoadStrategy.setExtensionXhrType("ogg",o.XhrResponseType.Buffer);var K={png:o.ImageLoadStrategy,jpg:o.ImageLoadStrategy,jpeg:o.ImageLoadStrategy,webp:o.ImageLoadStrategy,json:o.XhrLoadStrategy,tex:o.XhrLoadStrategy,ske:o.XhrLoadStrategy,audio:o.XhrLoadStrategy,video:o.VideoLoadStrategy},Q=new(function(e){function t(t){var r=e.call(this)||this;return r.timeout=6e3,r.preProcessResourceHandlers=[],r.resourcesMap={},r.makeInstanceFunctions={},r.destroyInstanceFunctions={},r.promiseMap={},r.loaders=[],t&&"number"==typeof t.timeout&&(r.timeout=t.timeout),r}return s(t,e),t.prototype.loadConfig=function(e){this.addResource(e),this.preload()},t.prototype.loadSingle=function(e){return this.addResource([e]),this.getResource(e.name)},t.prototype.addResource=function(e){var t,r;if(!e||e.length<1)console.warn("no resources");else try{for(var o=f(e),n=o.next();!n.done;n=o.next()){var a=n.value;this.resourcesMap[a.name]?console.warn(a.name+" was already added"):(this.resourcesMap[a.name]=a,this.resourcesMap[a.name].data={})}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},t.prototype.addPreProcessResourceHandler=function(e){this.preProcessResourceHandlers.push(e)},t.prototype.removePreProcessResourceHandler=function(e){this.preProcessResourceHandlers.splice(this.preProcessResourceHandlers.indexOf(e),1)},t.prototype.preload=function(){var e=[];for(var t in this.resourcesMap){var r=this.resourcesMap[t];!r.preload||r.complete||this.promiseMap[t]||e.push(r.name)}this.progress=new z({resource:this,resourceTotal:e.length}),this.loadResource({names:e,preload:!0})},t.prototype.getResource=function(e){return p(this,void 0,void 0,(function(){return l(this,(function(t){return this.loadResource({names:[e]}),[2,this.promiseMap[e]||Promise.resolve({})]}))}))},t.prototype.instance=function(e){return p(this,void 0,void 0,(function(){var t,r;return l(this,(function(o){switch(o.label){case 0:return t=this.resourcesMap[e],(r=this.makeInstanceFunctions[t.type])?[4,this.makeInstanceFunctions[t.type](t)]:[3,2];case 1:r=o.sent(),o.label=2;case 2:return[2,r]}}))}))},t.prototype.destroy=function(e){return p(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this._destroy(e)];case 1:return t.sent(),[2]}}))}))},t.prototype._destroy=function(e,t){return void 0===t&&(t=!1),p(this,void 0,void 0,(function(){var r,o;return l(this,(function(n){switch(n.label){case 0:if(!(r=this.resourcesMap[e]))return[2];if(t)return[3,5];n.label=1;case 1:return n.trys.push([1,4,,5]),this.destroyInstanceFunctions[r.type]?[4,this.destroyInstanceFunctions[r.type](r)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[3,5];case 4:return o=n.sent(),console.warn("destroy resource "+r.name+" error with '"+o.message+"'"),[3,5];case 5:return delete this.promiseMap[e],r.data={},r.complete=!1,r.instance=void 0,[2]}}))}))},t.prototype.registerResourceType=function(e,t){if(void 0===t&&(t=e),exports.RESOURCE_TYPE[e])throw new Error("The type "+e+" already exists in RESOURCE_TYPE");exports.RESOURCE_TYPE[e]=t},t.prototype.registerInstance=function(e,t){this.makeInstanceFunctions[e]=t},t.prototype.registerDestroy=function(e,t){this.destroyInstanceFunctions[e]=t},t.prototype.loadResource=function(e){var t=this,r=e.names,o=void 0===r?[]:r,n=e.preload,a=void 0!==n&&n,i=o.filter((function(e){return!t.promiseMap[e]&&t.resourcesMap[e]}));if(i.length){var s={},c=this.getLoader(a);i.forEach((function(e){var r,o;t.promiseMap[e]=new Promise((function(t){return s[e]=t}));var n=t.resourcesMap[e];try{for(var i=f(t.preProcessResourceHandlers),u=i.next();!u.done;u=i.next()){(0,u.value)(n)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}for(var p in n.src){var l=n.src[p].type;"data"===l?(n.data[p]=n.src[p].data,t.doComplete(e,s[e],a)):c.add({url:n.src[p].url,name:n.name+"_"+p,strategy:K[l],metadata:{key:p,name:n.name,resolves:s}})}})),c.load()}},t.prototype.doComplete=function(e,t,r){return void 0===r&&(r=!1),p(this,void 0,void 0,(function(){var o,n,a,i;return l(this,(function(s){switch(s.label){case 0:if(o=this.resourcesMap[e],n={name:e,resource:this.resourcesMap[e],success:!0},!this.checkAllLoaded(e))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),a=o,[4,this.instance(e)];case 2:return a.instance=s.sent(),o.complete=!0,r&&this.progress.onProgress(n),t(o),[3,4];case 3:return i=s.sent(),console.error(i),o.complete=!1,r&&(n.errMsg=i.message,n.success=!1,this.progress.onProgress(n)),t({}),[3,4];case 4:return[2]}}))}))},t.prototype.checkAllLoaded=function(e){var t=this.resourcesMap[e];return Array.from(Object.keys(t.src)).every((function(e){return t.data[e]}))},t.prototype.getLoader=function(e){var t=this;void 0===e&&(e=!1);var r=this.loaders.find((function(e){return!e.loading}));return r||(r=new o.Loader,this.loaders.push(r)),e&&r.onStart.once((function(){t.progress.onStart()})),r.onLoad.add((function(r,o){t.onLoad({preload:e,resource:o})})),r.onError.add((function(r,o,n){t.onError({errMsg:r,resource:n,preload:e})})),r.onComplete.once((function(){r.onLoad.detachAll(),r.onError.detachAll(),r.reset()})),r},t.prototype.onLoad=function(e){var t=e.preload,r=void 0!==t&&t,o=e.resource;return p(this,void 0,void 0,(function(){var e,t,n,a,i;return l(this,(function(s){return e=o.metadata,t=e.key,n=e.name,a=e.resolves,i=o.data,this.resourcesMap[n].data[t]=i,this.doComplete(n,a[n],r),[2]}))}))},t.prototype.onError=function(e){var t=e.errMsg,r=e.preload,o=void 0!==r&&r,n=e.resource;return p(this,void 0,void 0,(function(){var e,r,a,i;return l(this,(function(s){return e=n.metadata,r=e.name,a=e.resolves,this._destroy(r,!0),a[r]({}),o&&(i={name:r,resource:this.resourcesMap[r],success:!1,errMsg:t},this.progress.onProgress(i)),[2]}))}))},t}(a)),W={componentObserver:q};console.log("Eva.js version: 1.2.7-editor.0"),exports.Component=v,exports.Game=U,exports.GameObject=C,exports.RESOURCE_TYPE_STRATEGY=K,exports.Scene=G,exports.System=M,exports.Transform=P,exports.componentObserver=q,exports.decorators=W,exports.resource=Q,exports.resourceLoader=J,exports.version="1.2.7-editor.0";
***************************************************************************** */function s(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function c(e,t,r,o){var n,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(i=(a<3?n(i):a>3?n(t,r,i):n(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,o){return new(r||(r=Promise))((function(n,a){function i(e){try{c(o.next(e))}catch(e){a(e)}}function s(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):new r((function(t){t(e.value)})).then(i,s)}c((o=o.apply(e,t||[])).next())}))}function l(e,t){var r,o,n,a,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,o=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(n=i.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){i.label=a[1];break}if(6===a[0]&&i.label<n[1]){i.label=n[1],n=a;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(a);break}n[2]&&i.ops.pop(),i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e],o=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(d(arguments[t]));return e}var y,m=function(e){function t(t){var r=e.call(this)||this;return r.started=!1,r.name=r.constructor.componentName,r.__componentDefaultParams=t,r}return s(t,e),t}(a),v=m;exports.OBSERVER_TYPE=void 0,(y=exports.OBSERVER_TYPE||(exports.OBSERVER_TYPE={})).ADD="ADD",y.REMOVE="REMOVE",y.CHANGE="CHANGE";var g={},b={},E={},_={};function O(e,t){g[e.gameObject.id]||(g[e.gameObject.id]={});var r=g[e.gameObject.id],o=e.name+"_"+t.join(",");if(r[o])return r[o];for(var n=t.length-1,a=e,i=0;i<n;i++)a=a[t[i]];return r[o]={property:a,key:t[n]},r[o]}function x(e){var t,r,o=e.systemName,n=e.componentName,a=e.component,i=e.prop,s=e.type;null===(r=null===(t=b[o])||void 0===t?void 0:t.componentObserver)||void 0===r||r.add({component:a,prop:i,type:s,componentName:n})}function R(e){var r,o,n=e.obj,a=e.key,i=e.prop,s=e.component,c=e.componentName;if(void 0!==n)if(a in n){if(Object.defineProperty(n,"_"+a,{enumerable:!1,writable:!0,value:n[a]}),i.deep&&t.isObject(n[a]))try{for(var u=f(Object.keys(n[a])),p=u.next();!p.done;p=u.next()){var l=p.value;R({obj:n[a],key:l,prop:i,component:s,componentName:c})}}catch(e){r={error:e}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}Object.defineProperty(n,a,{enumerable:!0,set:function(e){n["_"+a]!==e&&(n["_"+a]=e,function(e){var r=e.prop,o=e.component,n=e.componentName;for(var a in E){var i=(E[a]||{})[n];i&&i.findIndex((function(e){return t.isEqual(e,r)}))>-1&&x({systemName:a,componentName:n,component:o,prop:r,type:exports.OBSERVER_TYPE.CHANGE})}}({prop:i,component:s,componentName:c}))},get:function(){return n["_"+a]}})}else console.error("prop "+a+" not in component: "+c+", Can not observer")}function T(e,t){var r,o;for(var n in void 0===t&&(t=e.name),E){(E[n]||{})[t]&&(null===(o=null===(r=b[n])||void 0===r?void 0:r.componentObserver)||void 0===o||o.add({component:e,type:exports.OBSERVER_TYPE.REMOVE,componentName:t}))}!function(e){e.gameObject&&delete g[e.gameObject.id]}(e)}var S=function(){function e(){}return c([r.Field({step:.1,default:0}),u("design:type",Number)],e.prototype,"x",void 0),c([r.Field({step:.1,default:0}),u("design:type",Number)],e.prototype,"y",void 0),e}(),w=function(){function e(){}return c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"x",void 0),c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"y",void 0),e}(),k=function(){function e(){}return c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"width",void 0),c([r.Field({step:1,default:0}),u("design:type",Number)],e.prototype,"height",void 0),e}(),j=function(){function e(){}return c([r.Field({step:.1,default:1}),u("design:type",Number)],e.prototype,"x",void 0),c([r.Field({step:.1,default:1}),u("design:type",Number)],e.prototype,"y",void 0),e}(),P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Transform",t._parent=null,t.childIndex=-1,t.inScene=!1,t.children=[],t.position={x:0,y:0},t.size={width:0,height:0},t.origin={x:0,y:0},t.anchor={x:0,y:0},t.scale={x:1,y:1},t.skew={x:0,y:0},t.rotation=0,t}return s(t,e),t.prototype.init=function(e){var t,r;void 0===e&&(e={});try{for(var o=f(["position","size","origin","anchor","scale","skew"]),n=o.next();!n.done;n=o.next()){var a=n.value;Object.assign(this[a],e[a])}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}this.rotation=e.rotation||this.rotation},Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){e?e.addChild(this):this.parent&&this.parent.removeChild(this)},enumerable:!1,configurable:!0}),t.prototype.addChild=function(e){e.parent&&e.parent.removeChild(e),e._parent=this,e.childIndex>-1?this.children.splice(e.childIndex,0,e):this.children.push(e)},t.prototype.removeChild=function(e){var t=this.children.findIndex((function(t){return t===e}));t>-1&&(this.children.splice(t,1),e._parent=null)},t.prototype.clearChildren=function(){this.children.length=0},t.componentName="Transform",c([r.Field((function(){return w})),u("design:type",w)],t.prototype,"position",void 0),c([r.Field((function(){return k})),u("design:type",k)],t.prototype,"size",void 0),c([r.Field((function(){return S})),u("design:type",S)],t.prototype,"origin",void 0),c([r.Field((function(){return S})),u("design:type",S)],t.prototype,"anchor",void 0),c([r.Field((function(){return j})),u("design:type",S)],t.prototype,"scale",void 0),c([r.Field((function(){return S})),u("design:type",S)],t.prototype,"skew",void 0),c([r.Field({step:.1}),u("design:type",Number)],t.prototype,"rotation",void 0),t}(v),L=0;var C=function(){function e(e,t){this._componentCache={},this.components=[],this.destroyed=!1,this._name=e,this.id=++L,this.addComponent(P,t)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(P)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.transform&&this.transform.parent&&this.transform.parent.gameObject},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},set:function(e){var t,r;if(this._scene!==e){var o=this._scene;if(this._scene=e,this.transform&&this.transform.children)try{for(var n=f(this.transform.children),a=n.next();!a.done;a=n.next()){a.value.gameObject.scene=e}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}e?e.addGameObject(this):o&&o.removeGameObject(this)}},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t&&t.transform&&t!==this){if(!(t instanceof e))throw new Error("addChild only receive GameObject");if(!this.transform)throw new Error("gameObject '"+this.name+"' has been destroy");t.transform.parent=this.transform,t.scene=this.scene}},e.prototype.addChildAt=function(e,t){if(t>this.transform.children.length)throw new Error(e.name+"addChildAt: The index 18 supplied is out of bounds "+this.transform.children.length);this.addChild(e),e.transform.childIndex=t},e.prototype.removeChild=function(t){return t instanceof e&&t.parent&&t.parent===this?(t.transform.parent=null,t.scene=null,t):t},e.prototype.addComponent=function(e,t){if(!this.destroyed){var r=function(e){return e instanceof m?e.name:e instanceof Function?e.componentName:void 0}(e);if(!this._componentCache[r]){var o;if(e instanceof Function)o=new e(t);else{if(!(e instanceof v))throw new Error("addComponent recieve Component and Component Constructor");o=e}if(o.gameObject)throw new Error("component has been added on gameObject "+o.gameObject.name);return o.gameObject=this,o.init&&o.init(o.__componentDefaultParams),function(e,t){var r,o;for(var n in void 0===t&&(t=e.name),E)(E[n]||{})[t]&&(null===(o=null===(r=b[n])||void 0===r?void 0:r.componentObserver)||void 0===o||o.add({component:e,type:exports.OBSERVER_TYPE.ADD,componentName:t}))}(o,o.name),function(e,t){var r,o;if(void 0===t&&(t=e.name),t&&_[t]){if(!(e&&(n=e,n&&n.constructor&&"componentName"in n.constructor)))throw new Error("component param must be an instance of Component");var n;if(!e.gameObject||!e.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var a=f(_[t]),i=a.next();!i.done;i=a.next()){var s=i.value,c=O(e,s.prop);R({obj:c.property,key:c.key,prop:s,component:e,componentName:t})}}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}}(o,o.name),this.components.push(o),this._componentCache[r]=o,o.awake&&o.awake(),o}}},e.prototype.removeComponent=function(e){var t;if("string"==typeof e?t=e:e instanceof v?t=e.name:e.componentName&&(t=e.componentName),"Transform"===t)throw new Error("Transform can't be removed");return this._removeComponent(t)},e.prototype._removeComponent=function(e){var t=this.components.findIndex((function(t){return t.name===e}));if(-1!==t){var r=this.components.splice(t,1)[0];return delete this._componentCache[e],delete r.__componentDefaultParams,r.onDestroy&&r.onDestroy(),T(r,e),r.gameObject=void 0,r}},e.prototype.getComponent=function(e){var t;return"string"==typeof e?t=e:e instanceof v?t=e.name:e.componentName&&(t=e.componentName),void 0!==this._componentCache[t]?this._componentCache[t]:void 0},e.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},e.prototype.destroy=function(){if(this.transform){for(var e in Array.from(this.transform.children).forEach((function(e){e.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(e);this.components.length=0,this.destroyed=!0}else console.error("Cannot destroy gameObject that have already been destroyed.")},e}(),N=function(){function e(){this.events=[]}return e.prototype.add=function(e){var r=e.component,o=e.prop,n=e.type,a=e.componentName;if(n===exports.OBSERVER_TYPE.REMOVE){if(this.events.find((function(e){return e.component===r&&e.type===exports.OBSERVER_TYPE.ADD})))return void(this.events=this.events.filter((function(e){return e.component!==r})));this.events=this.events.filter((function(e){return e.component!==r}))}var i=this.events.findIndex((function(e){return e.component===r&&t.isEqual(e.prop,o)&&e.type===n}));i>-1&&this.events.splice(i,1),this.events.push({gameObject:r.gameObject,component:r,prop:o,type:n,componentName:a})},e.prototype.getChanged=function(){return this.events},Object.defineProperty(e.prototype,"changed",{get:function(){return this.events},enumerable:!1,configurable:!0}),e.prototype.clear=function(){var e=this.events;return this.events=[],e},e}(),M=function(){function e(e){this.started=!1,this.componentObserver=new N,this.__systemDefaultParams=e,this.name=this.constructor.systemName}return e.prototype.destroy=function(){var e;this.componentObserver=null,this.__systemDefaultParams=null,null===(e=this.onDestroy)||void 0===e||e.call(this)},e}();var A,I=Date.now?Date.now:function(){return(new Date).getTime()},D={originTime:0,playbackRate:1},F=function(){function e(t,r){t instanceof e&&(r=t,t={}),t=Object.assign({},D,t),r&&(this._parent=r),this._createTime=I(),this._timeMark=[{globalTime:this.globalTime,localTime:-t.originTime,entropy:-t.originTime,playbackRate:t.playbackRate,globalEntropy:0}],this._parent&&(this._timeMark[0].globalEntropy=this._parent.entropy),this._playbackRate=t.playbackRate}return Object.defineProperty(e.prototype,"globalTime",{get:function(){return this.parent?this.parent.currentTime:I()-this._createTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastTimeMark",{get:function(){return this._timeMark[this._timeMark.length-1]},enumerable:!1,configurable:!0}),e.prototype.markTime=function(e){var t=void 0===e?{}:e,r=t.time,o=void 0===r?this.currentTime:r,n=t.entropy,a=void 0===n?this.entropy:n,i=t.playbackRate,s=void 0===i?this.playbackRate:i,c={globalTime:this.globalTime,localTime:o,entropy:a,playbackRate:s,globalEntropy:this.globalEntropy};this._timeMark.push(c)},Object.defineProperty(e.prototype,"currentTime",{get:function(){var e=this.lastTimeMark,t=e.localTime,r=e.globalTime;return t+(this.globalTime-r)*this.playbackRate},set:function(e){this.markTime({time:e})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalEntropy",{get:function(){return this._parent?this._parent.entropy:this.globalTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entropy",{get:function(){var e=this.lastTimeMark,t=e.entropy,r=e.globalEntropy;return t+Math.abs((this.globalEntropy-r)*this.playbackRate)},set:function(e){if(this.entropy>e){var t=this.seekTimeMark(e);this._timeMark.length=t+1}this.markTime({entropy:e})},enumerable:!1,configurable:!0}),e.prototype.fork=function(t){return new e(t,this)},e.prototype.seekGlobalTime=function(e){var t=this.seekTimeMark(e),r=this._timeMark[t],o=r.entropy,n=r.playbackRate;return r.globalTime+(e-o)/Math.abs(n)},e.prototype.seekLocalTime=function(e){var t=this.seekTimeMark(e),r=this._timeMark[t],o=r.localTime,n=r.entropy;return r.playbackRate>0?o+(e-n):o-(e-n)},e.prototype.seekTimeMark=function(e){var t=this._timeMark,r=0,o=t.length-1;if(e<=t[r].entropy)return r;if(e>=t[o].entropy)return o;for(var n=Math.floor((r+o)/2);n>r&&n<o;){if(e===t[n].entropy)return n;e<t[n].entropy?o=n:e>t[n].entropy&&(r=n),n=Math.floor((r+o)/2)}return r},Object.defineProperty(e.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(e){e!==this.playbackRate&&(this.markTime({playbackRate:e}),this._playbackRate=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){if(0===this.playbackRate)return!0;for(var e=this.parent;e;){if(0===e.playbackRate)return!0;e=e.parent}return!1},enumerable:!1,configurable:!0}),e}(),V={autoStart:!0,frameRate:60},X=function(){function e(e){var t=this;e=Object.assign({},V,e),this._frameCount=0,this._frameDuration=1e3/e.frameRate,this.autoStart=e.autoStart,this.frameRate=e.frameRate,this.timeline=new F({originTime:0,playbackRate:1}),this._lastFrameTime=this.timeline.currentTime,this._tickers=new Set,this._requestId=null,this._ticker=function(){t._started&&(t._requestId=requestAnimationFrame(t._ticker),t.update())},this.autoStart&&this.start()}return e.prototype.update=function(){var e,t,r=this.timeline.currentTime,o=r-this._lastFrameTime;if(o>=this._frameDuration){var n=r-o%this._frameDuration,a=n-this._lastFrameTime;this._lastFrameTime=n;var i={deltaTime:a,time:n,currentTime:n,frameCount:++this._frameCount,fps:Math.round(1e3/a)};try{for(var s=f(this._tickers),c=s.next();!c.done;c=s.next()){var u=c.value;"function"==typeof u&&u(i)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}}},e.prototype.add=function(e){this._tickers.add(e)},e.prototype.remove=function(e){this._tickers.delete(e)},e.prototype.start=function(){this._started||(this._started=!0,this.timeline.playbackRate=1,this._requestId=requestAnimationFrame(this._ticker))},e.prototype.pause=function(){this._started=!1,this.timeline.playbackRate=0},e.prototype.setPlaybackRate=function(e){this.timeline.playbackRate=e},e}(),G=function(e){function t(t,r){var o=e.call(this,t,r)||this;return o.gameObjects=[],o.scene=o,o}return s(t,e),t.prototype.addGameObject=function(e){this.gameObjects.push(e),e.transform&&(e.transform.inScene=!0)},t.prototype.removeGameObject=function(e){var t=this.gameObjects.indexOf(e);-1!==t&&(e.transform&&(e.transform.inScene=!1),this.gameObjects.splice(t,1))},t.prototype.destroy=function(){this.scene=null,e.prototype.destroy.call(this),this.gameObjects=null,this.canvas=null},t}(C);exports.LOAD_SCENE_MODE=void 0,(A=exports.LOAD_SCENE_MODE||(exports.LOAD_SCENE_MODE={})).SINGLE="SINGLE",A.MULTI_CANVAS="MULTI_CANVAS";var Y=function(e){if((e instanceof M||e instanceof v)&&!e.started){e.started=!0;try{e.start&&e.start()}catch(t){e instanceof v?console.error(e.constructor.componentName+" start error",t):console.error(e.constructor.systemName+" start error",t)}}},U=function(e){function r(t){var r,o,n=void 0===t?{}:t,a=n.systems,i=n.frameRate,s=void 0===i?60:i,c=n.autoStart,u=void 0===c||c,p=n.needScene,l=void 0===p||p,d=n.mode,h=void 0===d?"PLAY":d,y=e.call(this)||this;if(y.playing=!1,y.started=!1,y.multiScenes=[],y.systems=[],y.mode="PLAY",y.mode=h,window.__EVA_INSPECTOR_ENV__&&(window.__EVA_GAME_INSTANCE__=y),y.ticker=new X({autoStart:!1,frameRate:s}),y.initTicker(),a&&a.length)try{for(var m=f(a),v=m.next();!v.done;v=m.next()){var g=v.value;y.addSystem(g)}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=m.return)&&o.call(m)}finally{if(r)throw r.error}}return l&&y.loadScene(new G("scene")),u&&y.start(),y}return s(r,e),Object.defineProperty(r.prototype,"scene",{get:function(){return this._scene},set:function(e){this._scene=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"gameObjects",{get:function(){return function(e){var t,r,o,n=(null===(o=null==e?void 0:e.scene)||void 0===o?void 0:o.gameObjects)||[],a=null==e?void 0:e.multiScenes.map((function(e){return e.gameObjects})),i=[];try{for(var s=f(a),c=s.next();!c.done;c=s.next())i=h(i,c.value)}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}return h(n,i)}(this)},enumerable:!1,configurable:!0}),r.prototype.addSystem=function(e,r){var o;if(e instanceof Function)o=new e(r);else{if(!(e instanceof M))return void console.warn("can only add System");o=e}if(!this.systems.find((function(e){return e.constructor===o.constructor}))){o.game=this,o.init&&o.init(o.__systemDefaultParams),function(e,t){E[t.systemName]=t.observerInfo,b[t.systemName]=e}(o,o.constructor),function(e){var r,o,n,a,i=[];e instanceof Array?i.push.apply(i,h(e)):i.push(e);try{for(var s=f(i),c=s.next();!c.done;c=s.next()){var u=c.value;for(var p in u.observerInfo){_[p]=_[p]||[];var l=_[p],d=function(e){-1===l.findIndex((function(r){return t.isEqual(r,e)}))&&_[p].push(e)};try{for(var y=(n=void 0,f(u.observerInfo[p])),m=y.next();!m.done;m=y.next())d(m.value)}catch(e){n={error:e}}finally{try{m&&!m.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}(o.constructor);try{o.awake&&o.awake()}catch(e){console.error(o.constructor.systemName+" awake error",e)}return this.systems.push(o),o}console.warn(o.constructor.systemName+" System has been added")},r.prototype.removeSystem=function(e){if(e){var t=-1;"string"==typeof e?t=this.systems.findIndex((function(t){return t.name===e})):e instanceof Function?t=this.systems.findIndex((function(t){return t.constructor===e})):e instanceof M&&(t=this.systems.findIndex((function(t){return t===e}))),t>-1&&(this.systems[t].destroy&&this.systems[t].destroy(),this.systems.splice(t,1))}},r.prototype.getSystem=function(e){return this.systems.find((function(t){return"string"==typeof e?t.name===e:t instanceof e}))},r.prototype.pause=function(){this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},r.prototype.start=function(){this.playing||(this.playing=!0,this.started=!0,this.ticker.start())},r.prototype.resume=function(){this.playing||(this.playing=!0,this.ticker.start(),this.triggerResume())},r.prototype.initTicker=function(){var e=this;this.ticker.add((function(t){var r,o,n,a;e.scene&&e.gameObjectLoop(t,e.gameObjects);try{for(var i=f(e.systems),s=i.next();!s.done;s=i.next()){var c=s.value;try{Y(c),c.update&&c.update(t)}catch(t){console.error(c.constructor.systemName+" update error",t)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}try{for(var u=f(e.systems),p=u.next();!p.done;p=u.next()){c=p.value;try{c.lateUpdate&&c.lateUpdate(t)}catch(t){console.error(c.constructor.systemName+" lateUpdate error",t)}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(a=u.return)&&a.call(u)}finally{if(n)throw n.error}}}))},r.prototype.triggerResume=function(){var e,t;!function(e){var t,r,o,n;try{for(var a=f(e),i=a.next();!i.done;i=a.next()){var s=i.value;try{for(var c=(o=void 0,f(s.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onResume&&p.onResume()}catch(e){console.error("gameObject: "+s.name+", "+p.name+", onResume error",e)}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=f(this.systems),o=r.next();!o.done;o=r.next()){var n=o.value;try{n.onResume&&n.onResume()}catch(e){console.error(n.constructor.systemName+", onResume error",e)}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},r.prototype.triggerPause=function(){var e,t;!function(e){var t,r,o,n;try{for(var a=f(e),i=a.next();!i.done;i=a.next()){var s=i.value;try{for(var c=(o=void 0,f(s.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onPause&&p.onPause()}catch(e){console.error("gameObject: "+s.name+", "+p.name+", onResume error",e)}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(o)throw o.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=f(this.systems),o=r.next();!o.done;o=r.next()){var n=o.value;try{n.onPause&&n.onPause()}catch(e){console.error(n.constructor.systemName+", onPause error",e)}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},r.prototype.destroySystems=function(){var e,t;try{for(var r=f(h(this.systems)),o=r.next();!o.done;o=r.next()){var n=o.value;this.removeSystem(n)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.systems.length=0},r.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},r.prototype.loadScene=function(e){var t=e.scene,r=e.mode,o=void 0===r?exports.LOAD_SCENE_MODE.SINGLE:r,n=e.params,a=void 0===n?{}:n;if(t){switch(o){case exports.LOAD_SCENE_MODE.SINGLE:this.scene=t;break;case exports.LOAD_SCENE_MODE.MULTI_CANVAS:this.multiScenes.push(t)}this.emit("sceneChanged",{scene:t,mode:o,params:a})}},r.prototype.gameObjectLoop=function(e,t){var r,o,n,a,i,s,c,u;void 0===t&&(t=[]);try{for(var p=f(t),l=p.next();!l.done;l=p.next()){var d=l.value;try{for(var h=(n=void 0,f(d.components)),y=h.next();!y.done;y=h.next()){var m=y.value;try{"PLAY"===this.mode&&(Y(m),m.update&&m.update(e))}catch(e){console.error("gameObject: "+d.name+" "+m.name+" update error",e)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(a=h.return)&&a.call(h)}finally{if(n)throw n.error}}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}try{for(var v=f(t),g=v.next();!g.done;g=v.next()){d=g.value;try{for(var b=(c=void 0,f(d.components)),E=b.next();!E.done;E=b.next()){m=E.value;try{"PLAY"===this.mode&&m.lateUpdate&&m.lateUpdate(e)}catch(e){console.error("gameObject: "+d.name+" "+m.name+" lateUpdate error",e)}}}catch(e){c={error:e}}finally{try{E&&!E.done&&(u=b.return)&&u.call(b)}finally{if(c)throw c.error}}}}catch(e){i={error:e}}finally{try{g&&!g.done&&(s=v.return)&&s.call(v)}finally{if(i)throw i.error}}},r}(a);function q(e){return void 0===e&&(e={}),function(t){if(!t.observerInfo){for(var r in e)for(var o in e[r]){"string"==typeof e[r][o]&&(e[r][o]=[e[r][o]]);var n=void 0;Array.isArray(e[r][o])&&(n={prop:e[r][o],deep:!1},e[r][o]=n),"string"==typeof(n=e[r][o]).prop&&(n.prop=[n.prop])}t.observerInfo=e}}}var B,H,z=function(e){function t(t){var r=t.resource,o=t.resourceTotal,n=e.call(this)||this;return n.progress=0,n.resourceTotal=0,n.resourceLoadedCount=0,n.resource=r,n.resourceTotal=o,0===o&&n.resource.emit(exports.LOAD_EVENT.COMPLETE,n),n}return s(t,e),t.prototype.onStart=function(){this.resource.emit(exports.LOAD_EVENT.START,this)},t.prototype.onProgress=function(e){this.resourceLoadedCount++,this.progress=Math.floor(this.resourceLoadedCount/this.resourceTotal*100)/100,e.success?this.resource.emit(exports.LOAD_EVENT.LOADED,this,e):this.resource.emit(exports.LOAD_EVENT.ERROR,this,e),this.resource.emit(exports.LOAD_EVENT.PROGRESS,this,e),this.resourceLoadedCount===this.resourceTotal&&this.resource.emit(exports.LOAD_EVENT.COMPLETE,this)},t}(a),J={AbstractLoadStrategy:o.AbstractLoadStrategy,AudioLoadStrategy:o.AudioLoadStrategy,ImageLoadStrategy:o.ImageLoadStrategy,XhrResponseType:o.XhrResponseType,MediaElementLoadStrategy:o.MediaElementLoadStrategy,VideoLoadStrategy:o.VideoLoadStrategy,XhrLoadStrategy:o.XhrLoadStrategy,Loader:o.Loader,Resource:o.Resource,ResourceType:o.ResourceType,ResourceState:o.ResourceState};exports.LOAD_EVENT=void 0,(B=exports.LOAD_EVENT||(exports.LOAD_EVENT={})).START="start",B.PROGRESS="progress",B.LOADED="loaded",B.COMPLETE="complete",B.ERROR="error",exports.RESOURCE_TYPE=void 0,(H=exports.RESOURCE_TYPE||(exports.RESOURCE_TYPE={})).IMAGE="IMAGE",H.SPRITE="SPRITE",H.SPRITE_ANIMATION="SPRITE_ANIMATION",H.AUDIO="AUDIO",H.VIDEO="VIDEO",o.XhrLoadStrategy.setExtensionXhrType("json",o.XhrResponseType.Json),o.XhrLoadStrategy.setExtensionXhrType("tex",o.XhrResponseType.Json),o.XhrLoadStrategy.setExtensionXhrType("ske",o.XhrResponseType.Json),o.XhrLoadStrategy.setExtensionXhrType("mp3",o.XhrResponseType.Buffer),o.XhrLoadStrategy.setExtensionXhrType("wav",o.XhrResponseType.Buffer),o.XhrLoadStrategy.setExtensionXhrType("aac",o.XhrResponseType.Buffer),o.XhrLoadStrategy.setExtensionXhrType("ogg",o.XhrResponseType.Buffer);var K={png:o.ImageLoadStrategy,jpg:o.ImageLoadStrategy,jpeg:o.ImageLoadStrategy,webp:o.ImageLoadStrategy,json:o.XhrLoadStrategy,tex:o.XhrLoadStrategy,ske:o.XhrLoadStrategy,audio:o.XhrLoadStrategy,video:o.VideoLoadStrategy},Q=new(function(e){function t(t){var r=e.call(this)||this;return r.timeout=6e3,r.preProcessResourceHandlers=[],r.resourcesMap={},r.makeInstanceFunctions={},r.destroyInstanceFunctions={},r.promiseMap={},r.loaders=[],t&&"number"==typeof t.timeout&&(r.timeout=t.timeout),r}return s(t,e),t.prototype.loadConfig=function(e){this.addResource(e),this.preload()},t.prototype.loadSingle=function(e){return this.addResource([e]),this.getResource(e.name)},t.prototype.addResource=function(e){var t,r;if(!e||e.length<1)console.warn("no resources");else try{for(var o=f(e),n=o.next();!n.done;n=o.next()){var a=n.value;this.resourcesMap[a.name]?console.warn(a.name+" was already added"):(this.resourcesMap[a.name]=a,this.resourcesMap[a.name].data={})}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},t.prototype.addPreProcessResourceHandler=function(e){this.preProcessResourceHandlers.push(e)},t.prototype.removePreProcessResourceHandler=function(e){this.preProcessResourceHandlers.splice(this.preProcessResourceHandlers.indexOf(e),1)},t.prototype.preload=function(){var e=[];for(var t in this.resourcesMap){var r=this.resourcesMap[t];!r.preload||r.complete||this.promiseMap[t]||e.push(r.name)}this.progress=new z({resource:this,resourceTotal:e.length}),this.loadResource({names:e,preload:!0})},t.prototype.getResource=function(e){return p(this,void 0,void 0,(function(){return l(this,(function(t){return this.loadResource({names:[e]}),[2,this.promiseMap[e]||Promise.resolve({})]}))}))},t.prototype.instance=function(e){return p(this,void 0,void 0,(function(){var t,r;return l(this,(function(o){switch(o.label){case 0:return t=this.resourcesMap[e],(r=this.makeInstanceFunctions[t.type])?[4,this.makeInstanceFunctions[t.type](t)]:[3,2];case 1:r=o.sent(),o.label=2;case 2:return[2,r]}}))}))},t.prototype.destroy=function(e){return p(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this._destroy(e)];case 1:return t.sent(),[2]}}))}))},t.prototype._destroy=function(e,t){return void 0===t&&(t=!1),p(this,void 0,void 0,(function(){var r,o;return l(this,(function(n){switch(n.label){case 0:if(!(r=this.resourcesMap[e]))return[2];if(t)return[3,5];n.label=1;case 1:return n.trys.push([1,4,,5]),this.destroyInstanceFunctions[r.type]?[4,this.destroyInstanceFunctions[r.type](r)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[3,5];case 4:return o=n.sent(),console.warn("destroy resource "+r.name+" error with '"+o.message+"'"),[3,5];case 5:return delete this.promiseMap[e],r.data={},r.complete=!1,r.instance=void 0,[2]}}))}))},t.prototype.registerResourceType=function(e,t){if(void 0===t&&(t=e),exports.RESOURCE_TYPE[e])throw new Error("The type "+e+" already exists in RESOURCE_TYPE");exports.RESOURCE_TYPE[e]=t},t.prototype.registerInstance=function(e,t){this.makeInstanceFunctions[e]=t},t.prototype.registerDestroy=function(e,t){this.destroyInstanceFunctions[e]=t},t.prototype.loadResource=function(e){var t=this,r=e.names,o=void 0===r?[]:r,n=e.preload,a=void 0!==n&&n,i=o.filter((function(e){return!t.promiseMap[e]&&t.resourcesMap[e]}));if(i.length){var s={},c=this.getLoader(a);i.forEach((function(e){var r,o;t.promiseMap[e]=new Promise((function(t){return s[e]=t}));var n=t.resourcesMap[e];try{for(var i=f(t.preProcessResourceHandlers),u=i.next();!u.done;u=i.next()){(0,u.value)(n)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}for(var p in n.src){var l=n.src[p].type;"data"===l?(n.data[p]=n.src[p].data,t.doComplete(e,s[e],a)):c.add({url:n.src[p].url,name:n.name+"_"+p,strategy:K[l],metadata:{key:p,name:n.name,resolves:s}})}})),c.load()}},t.prototype.doComplete=function(e,t,r){return void 0===r&&(r=!1),p(this,void 0,void 0,(function(){var o,n,a,i;return l(this,(function(s){switch(s.label){case 0:if(o=this.resourcesMap[e],n={name:e,resource:this.resourcesMap[e],success:!0},!this.checkAllLoaded(e))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),a=o,[4,this.instance(e)];case 2:return a.instance=s.sent(),o.complete=!0,r&&this.progress.onProgress(n),t(o),[3,4];case 3:return i=s.sent(),console.error(i),o.complete=!1,r&&(n.errMsg=i.message,n.success=!1,this.progress.onProgress(n)),t({}),[3,4];case 4:return[2]}}))}))},t.prototype.checkAllLoaded=function(e){var t=this.resourcesMap[e];return Array.from(Object.keys(t.src)).every((function(e){return t.data[e]}))},t.prototype.getLoader=function(e){var t=this;void 0===e&&(e=!1);var r=this.loaders.find((function(e){return!e.loading}));return r||(r=new o.Loader,this.loaders.push(r)),e&&r.onStart.once((function(){t.progress.onStart()})),r.onLoad.add((function(r,o){t.onLoad({preload:e,resource:o})})),r.onError.add((function(r,o,n){t.onError({errMsg:r,resource:n,preload:e})})),r.onComplete.once((function(){r.onLoad.detachAll(),r.onError.detachAll(),r.reset()})),r},t.prototype.onLoad=function(e){var t=e.preload,r=void 0!==t&&t,o=e.resource;return p(this,void 0,void 0,(function(){var e,t,n,a,i;return l(this,(function(s){return e=o.metadata,t=e.key,n=e.name,a=e.resolves,i=o.data,this.resourcesMap[n].data[t]=i,this.doComplete(n,a[n],r),[2]}))}))},t.prototype.onError=function(e){var t=e.errMsg,r=e.preload,o=void 0!==r&&r,n=e.resource;return p(this,void 0,void 0,(function(){var e,r,a,i;return l(this,(function(s){return e=n.metadata,r=e.name,a=e.resolves,this._destroy(r,!0),a[r]({}),o&&(i={name:r,resource:this.resourcesMap[r],success:!1,errMsg:t},this.progress.onProgress(i)),[2]}))}))},t}(a)),W={componentObserver:q};console.log("Eva.js version: 1.2.7-editor.1"),exports.Component=v,exports.Game=U,exports.GameObject=C,exports.RESOURCE_TYPE_STRATEGY=K,exports.Scene=G,exports.System=M,exports.Transform=P,exports.componentObserver=q,exports.decorators=W,exports.resource=Q,exports.resourceLoader=J,exports.version="1.2.7-editor.1";

@@ -463,4 +463,4 @@ import { AbstractLoadStrategy } from 'resource-loader';

export declare const version = "1.2.7-editor.0";
export declare const version = "1.2.7-editor.1";
export { }
{
"name": "@eva/eva.js",
"version": "1.2.7-editor.0",
"version": "1.2.7-editor.1",
"description": "@eva/eva.js",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc