Socket
Socket
Sign inDemoInstall

@eva/eva.js

Package Overview
Dependencies
Maintainers
4
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.2-alpha.2 to 1.2.2-alpha.3

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),s=function(e,t){return(s=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 i(e,t){function r(){this.constructor=e}s(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,s=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var i=e.length-1;i>=0;i--)(n=e[i])&&(s=(a<3?n(s):a>3?n(t,r,s):n(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s}function u(e,t,r,o){return new(r||(r=Promise))((function(n,a){function s(e){try{c(o.next(e))}catch(e){a(e)}}function i(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(s,i)}c((o=o.apply(e,t||[])).next())}))}function p(e,t){var r,o,n,a,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}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,i])}}}function l(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 f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)s.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 s}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(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 i(t,e),t}(a),d=m;exports.OBSERVER_TYPE=void 0,(y=exports.OBSERVER_TYPE||(exports.OBSERVER_TYPE={})).ADD="ADD",y.REMOVE="REMOVE",y.CHANGE="CHANGE";var v={},g={},b={},E={};function _(e,t){v[e.gameObject.id]||(v[e.gameObject.id]={});var r=v[e.gameObject.id],o=e.name+"_"+t.join(",");if(r[o])return r[o];for(var n=t.length-1,a=e,s=0;s<n;s++)a=a[t[s]];return r[o]={property:a,key:t[n]},r[o]}function O(e){var t=e.systemName,r=e.componentName,o=e.component,n=e.prop,a=e.type;g[t].componentObserver.add({component:o,prop:n,type:a,componentName:r})}function R(e){var r,o,n=e.obj,a=e.key,s=e.prop,i=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]}),s.deep&&t.isObject(n[a]))try{for(var u=l(Object.keys(n[a])),p=u.next();!p.done;p=u.next()){var f=p.value;R({obj:n[a],key:f,prop:s,component:i,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 b){var s=(b[a]||{})[n];s&&s.findIndex((function(e){return t.isEqual(e,r)}))>-1&&O({systemName:a,componentName:n,component:o,prop:r,type:exports.OBSERVER_TYPE.CHANGE})}}({prop:s,component:i,componentName:c}))},get:function(){return n["_"+a]}})}else console.error("prop "+a+" not in component: "+c+", Can not observer")}function x(e,t){for(var r in void 0===t&&(t=e.name),b){(b[r]||{})[t]&&g[r].componentObserver.add({component:e,type:exports.OBSERVER_TYPE.REMOVE,componentName:t})}!function(e){e.gameObject&&delete v[e.gameObject.id]}(e)}var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Transform",t._parent=null,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 i(t,e),t.prototype.init=function(e){var t,r;void 0===e&&(e={});try{for(var o=l(["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){if(e.parent===this){var t=this.children.findIndex((function(t){return t===e}));this.children.splice(t,1)}else e.parent&&e.parent.removeChild(e);e._parent=this,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.type("vector2"),r.step(1)],t.prototype,"position",void 0),c([r.type("size"),r.step(1)],t.prototype,"size",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"origin",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"anchor",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"scale",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"skew",void 0),c([r.type("number"),r.step(.1)],t.prototype,"rotation",void 0),t}(d),S=0;var w=function(){function e(e,t){this._componentCache={},this.components=[],this._name=e,this.id=++S,this.addComponent(T,t)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(T)},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=l(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.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){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 d))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){for(var r in void 0===t&&(t=e.name),b)(b[r]||{})[t]&&g[r].componentObserver.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&&E[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=l(E[t]),s=a.next();!s.done;s=a.next()){var i=s.value,c=_(e,i.prop);R({obj:c.property,key:c.key,prop:i,component:e,componentName:t})}}catch(e){r={error:e}}finally{try{s&&!s.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 d?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(),x(r,e),r.gameObject=void 0,r}},e.prototype.getComponent=function(e){var t;return"string"==typeof e?t=e:e instanceof d?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(){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},e}(),k=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;this.events=this.events.filter((function(e){return e.component!==r}))}var s=this.events.findIndex((function(e){return e.component===r&&t.isEqual(e.prop,o)&&e.type===n}));s>-1&&this.events.splice(s,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}(),P=function(){function e(e){this.started=!1,this.componentObserver=new k,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 j,L=Date.now?Date.now:function(){return(new Date).getTime()},C={originTime:0,playbackRate:1},M=function(){function e(t,r){t instanceof e&&(r=t,t={}),t=Object.assign({},C,t),r&&(this._parent=r),this._createTime=L(),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:L()-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,s=t.playbackRate,i=void 0===s?this.playbackRate:s,c={globalTime:this.globalTime,localTime:o,entropy:a,playbackRate:i,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}(),N={autoStart:!0,frameRate:60},A=function(){function e(e){var t=this;e=Object.assign({},N,e),this._frameCount=0,this._frameDuration=1e3/e.frameRate,this.autoStart=e.autoStart,this.frameRate=e.frameRate,this.timeline=new M({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 s={deltaTime:a,time:n,currentTime:n,frameCount:++this._frameCount,fps:Math.round(1e3/a)};try{for(var i=l(this._tickers),c=i.next();!c.done;c=i.next()){var u=c.value;"function"==typeof u&&u(s)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=i.return)&&t.call(i)}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}(),I=function(e){function t(t,r){var o=e.call(this,t,r)||this;return o.gameObjects=[],o.scene=o,o}return i(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}(w);exports.LOAD_SCENE_MODE=void 0,(j=exports.LOAD_SCENE_MODE||(exports.LOAD_SCENE_MODE={})).SINGLE="SINGLE",j.MULTI_CANVAS="MULTI_CANVAS";var D=function(e){if((e instanceof P||e instanceof d)&&!e.started){e.started=!0;try{e.start&&e.start()}catch(t){e instanceof d?console.error(e.constructor.componentName+" start error",t):console.error(e.constructor.systemName+" start error",t)}}},V=function(e){function r(t){var r,o,n=void 0===t?{}:t,a=n.systems,s=n.frameRate,i=void 0===s?60:s,c=n.autoStart,u=void 0===c||c,p=n.needScene,f=void 0===p||p,h=e.call(this)||this;if(h.playing=!1,h.started=!1,h.multiScenes=[],h.systems=[],window.__EVA_INSPECTOR_ENV__&&(window.__EVA_GAME_INSTANCE__=h),h.ticker=new A({autoStart:!1,frameRate:i}),h.initTicker(),a&&a.length)try{for(var y=l(a),m=y.next();!m.done;m=y.next()){var d=m.value;h.addSystem(d)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(r)throw r.error}}return f&&h.loadScene(new I("scene")),u&&h.start(),h}return i(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})),s=[];try{for(var i=l(a),c=i.next();!c.done;c=i.next())s=h(s,c.value)}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return h(n,s)}(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 P))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){b[t.systemName]=t.observerInfo,g[t.systemName]=e}(o,o.constructor),function(e){var r,o,n,a,s=[];e instanceof Array?s.push.apply(s,h(e)):s.push(e);try{for(var i=l(s),c=i.next();!c.done;c=i.next()){var u=c.value;for(var p in u.observerInfo){E[p]=E[p]||[];var f=E[p],y=function(e){-1===f.findIndex((function(r){return t.isEqual(r,e)}))&&E[p].push(e)};try{for(var m=(n=void 0,l(u.observerInfo[p])),d=m.next();!d.done;d=m.next())y(d.value)}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=m.return)&&a.call(m)}finally{if(n)throw n.error}}}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=i.return)&&o.call(i)}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 P&&(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&&function(e,t){var r,o,n,a,s,i,c,u;void 0===t&&(t=[]);try{for(var p=l(t),f=p.next();!f.done;f=p.next()){var h=f.value;try{for(var y=(n=void 0,l(h.components)),m=y.next();!m.done;m=y.next()){var d=m.value;try{D(d),d.update&&d.update(e)}catch(e){console.error("gameObject: "+h.name+" "+d.name+" update error",e)}}}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{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}try{for(var v=l(t),g=v.next();!g.done;g=v.next()){h=g.value;try{for(var b=(c=void 0,l(h.components)),E=b.next();!E.done;E=b.next()){d=E.value;try{d.lateUpdate&&d.lateUpdate(e)}catch(e){console.error("gameObject: "+h.name+" "+d.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){s={error:e}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(s)throw s.error}}}(t,e.gameObjects);try{for(var s=l(e.systems),i=s.next();!i.done;i=s.next()){var c=i.value;try{D(c),c.update&&c.update(t)}catch(t){console.error(c.constructor.systemName+" update error",t)}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}try{for(var u=l(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=l(e),s=a.next();!s.done;s=a.next()){var i=s.value;try{for(var c=(o=void 0,l(i.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onResume&&p.onResume()}catch(e){console.error("gameObject: "+i.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{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=l(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=l(e),s=a.next();!s.done;s=a.next()){var i=s.value;try{for(var c=(o=void 0,l(i.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onPause&&p.onPause()}catch(e){console.error("gameObject: "+i.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{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=l(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=l(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}(a);function X(e,t){e.constructor.IDEProps||(e.constructor.IDEProps=[]),e.constructor.IDEProps.push(t)}function G(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 F,U,Y=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 i(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),q={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,(F=exports.LOAD_EVENT||(exports.LOAD_EVENT={})).START="start",F.PROGRESS="progress",F.LOADED="loaded",F.COMPLETE="complete",F.ERROR="error",exports.RESOURCE_TYPE=void 0,(U=exports.RESOURCE_TYPE||(exports.RESOURCE_TYPE={})).IMAGE="IMAGE",U.SPRITE="SPRITE",U.SPRITE_ANIMATION="SPRITE_ANIMATION",U.AUDIO="AUDIO",U.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 B={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},H=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 i(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=l(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&&e.push(r.name)}this.progress=new Y({resource:this,resourceTotal:e.length}),this.loadResource({names:e,preload:!0})},t.prototype.getResource=function(e){return u(this,void 0,void 0,(function(){return p(this,(function(t){return this.loadResource({names:[e]}),[2,this.promiseMap[e]||Promise.resolve({})]}))}))},t.prototype.instance=function(e){return u(this,void 0,void 0,(function(){var t,r;return p(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 u(this,void 0,void 0,(function(){return p(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),u(this,void 0,void 0,(function(){var r,o;return p(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,s=o.filter((function(e){return!t.promiseMap[e]&&t.resourcesMap[e]}));if(s.length){var i={},c=this.getLoader(a);s.forEach((function(e){var r,o;t.promiseMap[e]=new Promise((function(t){return i[e]=t}));var n=t.resourcesMap[e];try{for(var s=l(t.preProcessResourceHandlers),u=s.next();!u.done;u=s.next()){(0,u.value)(n)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}for(var p in n.src){var f=n.src[p].type;"data"===f?(n.data[p]=n.src[p].data,t.doComplete(e,i[e],a)):c.add({url:n.src[p].url,name:n.name+"_"+p,strategy:B[f],metadata:{key:p,name:n.name,resolves:i}})}})),c.load()}},t.prototype.doComplete=function(e,t,r){return void 0===r&&(r=!1),u(this,void 0,void 0,(function(){var o,n,a,s;return p(this,(function(i){switch(i.label){case 0:if(o=this.resourcesMap[e],n={name:e,resource:this.resourcesMap[e],success:!0},!this.checkAllLoaded(e))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),a=o,[4,this.instance(e)];case 2:return a.instance=i.sent(),o.complete=!0,r&&this.progress.onProgress(n),t(o),[3,4];case 3:return s=i.sent(),console.error(s),o.complete=!1,r&&(n.errMsg=s.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 u(this,void 0,void 0,(function(){var e,t,n,a,s;return p(this,(function(i){return e=o.metadata,t=e.key,n=e.name,a=e.resolves,s=o.data,this.resourcesMap[n].data[t]=s,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 u(this,void 0,void 0,(function(){var e,r,a,s;return p(this,(function(i){return e=n.metadata,r=e.name,a=e.resolves,this._destroy(r,!0),a[r]({}),o&&(s={name:r,resource:this.resourcesMap[r],success:!1,errMsg:t},this.progress.onProgress(s)),[2]}))}))},t}(a)),z={IDEProp:X,componentObserver:G};console.log("Eva.js version: 1.2.2-alpha.2"),exports.Component=d,exports.Game=V,exports.GameObject=w,exports.IDEProp=X,exports.RESOURCE_TYPE_STRATEGY=B,exports.Scene=I,exports.System=P,exports.Transform=T,exports.componentObserver=G,exports.decorators=z,exports.resource=H,exports.resourceLoader=q,exports.version="1.2.2-alpha.2";
***************************************************************************** */function i(e,t){function r(){this.constructor=e}s(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,s=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var i=e.length-1;i>=0;i--)(n=e[i])&&(s=(a<3?n(s):a>3?n(t,r,s):n(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s}function u(e,t,r,o){return new(r||(r=Promise))((function(n,a){function s(e){try{c(o.next(e))}catch(e){a(e)}}function i(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(s,i)}c((o=o.apply(e,t||[])).next())}))}function p(e,t){var r,o,n,a,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:a[1],done:!1};case 5:s.label++,o=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}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,i])}}}function l(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 f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)s.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 s}function h(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(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 i(t,e),t}(a),d=m;exports.OBSERVER_TYPE=void 0,(y=exports.OBSERVER_TYPE||(exports.OBSERVER_TYPE={})).ADD="ADD",y.REMOVE="REMOVE",y.CHANGE="CHANGE";var v={},g={},b={},E={};function _(e,t){v[e.gameObject.id]||(v[e.gameObject.id]={});var r=v[e.gameObject.id],o=e.name+"_"+t.join(",");if(r[o])return r[o];for(var n=t.length-1,a=e,s=0;s<n;s++)a=a[t[s]];return r[o]={property:a,key:t[n]},r[o]}function O(e){var t=e.systemName,r=e.componentName,o=e.component,n=e.prop,a=e.type;g[t].componentObserver.add({component:o,prop:n,type:a,componentName:r})}function R(e){var r,o,n=e.obj,a=e.key,s=e.prop,i=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]}),s.deep&&t.isObject(n[a]))try{for(var u=l(Object.keys(n[a])),p=u.next();!p.done;p=u.next()){var f=p.value;R({obj:n[a],key:f,prop:s,component:i,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 b){var s=(b[a]||{})[n];s&&s.findIndex((function(e){return t.isEqual(e,r)}))>-1&&O({systemName:a,componentName:n,component:o,prop:r,type:exports.OBSERVER_TYPE.CHANGE})}}({prop:s,component:i,componentName:c}))},get:function(){return n["_"+a]}})}else console.error("prop "+a+" not in component: "+c+", Can not observer")}function x(e,t){for(var r in void 0===t&&(t=e.name),b){(b[r]||{})[t]&&g[r].componentObserver.add({component:e,type:exports.OBSERVER_TYPE.REMOVE,componentName:t})}!function(e){e.gameObject&&delete v[e.gameObject.id]}(e)}var T=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Transform",t._parent=null,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 i(t,e),t.prototype.init=function(e){var t,r;void 0===e&&(e={});try{for(var o=l(["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){if(e.parent===this){var t=this.children.findIndex((function(t){return t===e}));this.children.splice(t,1)}else e.parent&&e.parent.removeChild(e);e._parent=this,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.type("vector2"),r.step(1)],t.prototype,"position",void 0),c([r.type("size"),r.step(1)],t.prototype,"size",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"origin",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"anchor",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"scale",void 0),c([r.type("vector2"),r.step(.1)],t.prototype,"skew",void 0),c([r.type("number"),r.step(.1)],t.prototype,"rotation",void 0),t}(d),S=0;var w=function(){function e(e,t){this._componentCache={},this.components=[],this._name=e,this.id=++S,this.addComponent(T,t)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(T)},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=l(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.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){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 d))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){for(var r in void 0===t&&(t=e.name),b)(b[r]||{})[t]&&g[r].componentObserver.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&&E[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=l(E[t]),s=a.next();!s.done;s=a.next()){var i=s.value,c=_(e,i.prop);R({obj:c.property,key:c.key,prop:i,component:e,componentName:t})}}catch(e){r={error:e}}finally{try{s&&!s.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 d?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(),x(r,e),r.gameObject=void 0,r}},e.prototype.getComponent=function(e){var t;return"string"==typeof e?t=e:e instanceof d?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(){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},e}(),k=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;this.events=this.events.filter((function(e){return e.component!==r}))}var s=this.events.findIndex((function(e){return e.component===r&&t.isEqual(e.prop,o)&&e.type===n}));s>-1&&this.events.splice(s,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}(),P=function(){function e(e){this.started=!1,this.componentObserver=new k,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 j,L=Date.now?Date.now:function(){return(new Date).getTime()},C={originTime:0,playbackRate:1},M=function(){function e(t,r){t instanceof e&&(r=t,t={}),t=Object.assign({},C,t),r&&(this._parent=r),this._createTime=L(),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:L()-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,s=t.playbackRate,i=void 0===s?this.playbackRate:s,c={globalTime:this.globalTime,localTime:o,entropy:a,playbackRate:i,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}(),N={autoStart:!0,frameRate:60},A=function(){function e(e){var t=this;e=Object.assign({},N,e),this._frameCount=0,this._frameDuration=1e3/e.frameRate,this.autoStart=e.autoStart,this.frameRate=e.frameRate,this.timeline=new M({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 s={deltaTime:a,time:n,currentTime:n,frameCount:++this._frameCount,fps:Math.round(1e3/a)};try{for(var i=l(this._tickers),c=i.next();!c.done;c=i.next()){var u=c.value;"function"==typeof u&&u(s)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=i.return)&&t.call(i)}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}(),I=function(e){function t(t,r){var o=e.call(this,t,r)||this;return o.gameObjects=[],o.scene=o,o}return i(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}(w);exports.LOAD_SCENE_MODE=void 0,(j=exports.LOAD_SCENE_MODE||(exports.LOAD_SCENE_MODE={})).SINGLE="SINGLE",j.MULTI_CANVAS="MULTI_CANVAS";var D=function(e){if((e instanceof P||e instanceof d)&&!e.started){e.started=!0;try{e.start&&e.start()}catch(t){e instanceof d?console.error(e.constructor.componentName+" start error",t):console.error(e.constructor.systemName+" start error",t)}}},V=function(e){function r(t){var r,o,n=void 0===t?{}:t,a=n.systems,s=n.frameRate,i=void 0===s?60:s,c=n.autoStart,u=void 0===c||c,p=n.needScene,f=void 0===p||p,h=e.call(this)||this;if(h.playing=!1,h.started=!1,h.multiScenes=[],h.systems=[],window.__EVA_INSPECTOR_ENV__&&(window.__EVA_GAME_INSTANCE__=h),h.ticker=new A({autoStart:!1,frameRate:i}),h.initTicker(),a&&a.length)try{for(var y=l(a),m=y.next();!m.done;m=y.next()){var d=m.value;h.addSystem(d)}}catch(e){r={error:e}}finally{try{m&&!m.done&&(o=y.return)&&o.call(y)}finally{if(r)throw r.error}}return f&&h.loadScene(new I("scene")),u&&h.start(),h}return i(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})),s=[];try{for(var i=l(a),c=i.next();!c.done;c=i.next())s=h(s,c.value)}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return h(n,s)}(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 P))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){b[t.systemName]=t.observerInfo,g[t.systemName]=e}(o,o.constructor),function(e){var r,o,n,a,s=[];e instanceof Array?s.push.apply(s,h(e)):s.push(e);try{for(var i=l(s),c=i.next();!c.done;c=i.next()){var u=c.value;for(var p in u.observerInfo){E[p]=E[p]||[];var f=E[p],y=function(e){-1===f.findIndex((function(r){return t.isEqual(r,e)}))&&E[p].push(e)};try{for(var m=(n=void 0,l(u.observerInfo[p])),d=m.next();!d.done;d=m.next())y(d.value)}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=m.return)&&a.call(m)}finally{if(n)throw n.error}}}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=i.return)&&o.call(i)}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 P&&(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&&function(e,t){var r,o,n,a,s,i,c,u;void 0===t&&(t=[]);try{for(var p=l(t),f=p.next();!f.done;f=p.next()){var h=f.value;try{for(var y=(n=void 0,l(h.components)),m=y.next();!m.done;m=y.next()){var d=m.value;try{D(d),d.update&&d.update(e)}catch(e){console.error("gameObject: "+h.name+" "+d.name+" update error",e)}}}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{f&&!f.done&&(o=p.return)&&o.call(p)}finally{if(r)throw r.error}}try{for(var v=l(t),g=v.next();!g.done;g=v.next()){h=g.value;try{for(var b=(c=void 0,l(h.components)),E=b.next();!E.done;E=b.next()){d=E.value;try{d.lateUpdate&&d.lateUpdate(e)}catch(e){console.error("gameObject: "+h.name+" "+d.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){s={error:e}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(s)throw s.error}}}(t,e.gameObjects);try{for(var s=l(e.systems),i=s.next();!i.done;i=s.next()){var c=i.value;try{D(c),c.update&&c.update(t)}catch(t){console.error(c.constructor.systemName+" update error",t)}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}try{for(var u=l(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=l(e),s=a.next();!s.done;s=a.next()){var i=s.value;try{for(var c=(o=void 0,l(i.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onResume&&p.onResume()}catch(e){console.error("gameObject: "+i.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{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=l(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=l(e),s=a.next();!s.done;s=a.next()){var i=s.value;try{for(var c=(o=void 0,l(i.components)),u=c.next();!u.done;u=c.next()){var p=u.value;try{p.onPause&&p.onPause()}catch(e){console.error("gameObject: "+i.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{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}(this.gameObjects);try{for(var r=l(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=l(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}(a);function X(e,t){e.constructor.IDEProps||(e.constructor.IDEProps=[]),e.constructor.IDEProps.push(t)}function G(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 F,U,Y=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 i(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),q={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,(F=exports.LOAD_EVENT||(exports.LOAD_EVENT={})).START="start",F.PROGRESS="progress",F.LOADED="loaded",F.COMPLETE="complete",F.ERROR="error",exports.RESOURCE_TYPE=void 0,(U=exports.RESOURCE_TYPE||(exports.RESOURCE_TYPE={})).IMAGE="IMAGE",U.SPRITE="SPRITE",U.SPRITE_ANIMATION="SPRITE_ANIMATION",U.AUDIO="AUDIO",U.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 B={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},H=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 i(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=l(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&&e.push(r.name)}this.progress=new Y({resource:this,resourceTotal:e.length}),this.loadResource({names:e,preload:!0})},t.prototype.getResource=function(e){return u(this,void 0,void 0,(function(){return p(this,(function(t){return this.loadResource({names:[e]}),[2,this.promiseMap[e]||Promise.resolve({})]}))}))},t.prototype.instance=function(e){return u(this,void 0,void 0,(function(){var t,r;return p(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 u(this,void 0,void 0,(function(){return p(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),u(this,void 0,void 0,(function(){var r,o;return p(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,s=o.filter((function(e){return!t.promiseMap[e]&&t.resourcesMap[e]}));if(s.length){var i={},c=this.getLoader(a);s.forEach((function(e){var r,o;t.promiseMap[e]=new Promise((function(t){return i[e]=t}));var n=t.resourcesMap[e];try{for(var s=l(t.preProcessResourceHandlers),u=s.next();!u.done;u=s.next()){(0,u.value)(n)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}for(var p in n.src){var f=n.src[p].type;"data"===f?(n.data[p]=n.src[p].data,t.doComplete(e,i[e],a)):c.add({url:n.src[p].url,name:n.name+"_"+p,strategy:B[f],metadata:{key:p,name:n.name,resolves:i}})}})),c.load()}},t.prototype.doComplete=function(e,t,r){return void 0===r&&(r=!1),u(this,void 0,void 0,(function(){var o,n,a,s;return p(this,(function(i){switch(i.label){case 0:if(o=this.resourcesMap[e],n={name:e,resource:this.resourcesMap[e],success:!0},!this.checkAllLoaded(e))return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),a=o,[4,this.instance(e)];case 2:return a.instance=i.sent(),o.complete=!0,r&&this.progress.onProgress(n),t(o),[3,4];case 3:return s=i.sent(),console.error(s),o.complete=!1,r&&(n.errMsg=s.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 u(this,void 0,void 0,(function(){var e,t,n,a,s;return p(this,(function(i){return e=o.metadata,t=e.key,n=e.name,a=e.resolves,s=o.data,this.resourcesMap[n].data[t]=s,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 u(this,void 0,void 0,(function(){var e,r,a,s;return p(this,(function(i){return e=n.metadata,r=e.name,a=e.resolves,this._destroy(r,!0),a[r]({}),o&&(s={name:r,resource:this.resourcesMap[r],success:!1,errMsg:t},this.progress.onProgress(s)),[2]}))}))},t}(a)),z={IDEProp:X,componentObserver:G};console.log("Eva.js version: 1.2.2-alpha.3"),exports.Component=d,exports.Game=V,exports.GameObject=w,exports.IDEProp=X,exports.RESOURCE_TYPE_STRATEGY=B,exports.Scene=I,exports.System=P,exports.Transform=T,exports.componentObserver=G,exports.decorators=z,exports.resource=H,exports.resourceLoader=q,exports.version="1.2.2-alpha.3";

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

export declare const version = "1.2.2-alpha.2";
export declare const version = "1.2.2-alpha.3";
export { }
{
"name": "@eva/eva.js",
"version": "1.2.2-alpha.2",
"version": "1.2.2-alpha.3",
"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