@eva/eva.js
Version:
@eva/eva.js
1 lines • 66.8 kB
JavaScript
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},_extends.apply(this,arguments)}var _EVA_IIFE_EVA=function(t){"use strict";var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},e(t,r)};function r(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(t,e,r,n){var o,i=arguments.length,s=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,r,s):o(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function o(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function a(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}c((n=n.apply(t,e||[])).next())}))}function i(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t}var u=function(t){var e={exports:{}};return t(e,e.exports),e.exports}((function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new o(n,i||t,s),c=r?r+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],a]:t._events[c].push(a):(t._events[c]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},a.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o<i;o++)s[o]=n[o].fn;return s},a.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},a.prototype.emit=function(t,e,n,o,i,s){var a=r?r+t:t;if(!this._events[a])return!1;var c,u,l=this._events[a],p=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),p){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,o),!0;case 5:return l.fn.call(l.context,e,n,o,i),!0;case 6:return l.fn.call(l.context,e,n,o,i,s),!0}for(u=1,c=new Array(p-1);u<p;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var h,f=l.length;for(u=0;u<f;u++)switch(l[u].once&&this.removeListener(t,l[u].fn,void 0,!0),p){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,e);break;case 3:l[u].fn.call(l[u].context,e,n);break;case 4:l[u].fn.call(l[u].context,e,n,o);break;default:if(!c)for(h=1,c=new Array(p-1);h<p;h++)c[h-1]=arguments[h];l[u].fn.apply(l[u].context,c)}}return!0},a.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},a.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},a.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var a=this._events[i];if(a.fn)a.fn!==e||o&&!a.once||n&&a.context!==n||s(this,i);else{for(var c=0,u=[],l=a.length;c<l;c++)(a[c].fn!==e||o&&!a[c].once||n&&a[c].context!==n)&&u.push(a[c]);u.length?this._events[i]=1===u.length?u[0]:u:s(this,i)}return this},a.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,t.exports=a})),l=u;var p=function(t){function e(e){var r=t.call(this)||this;return r.started=!1,r.name=r.constructor.componentName,r.__componentDefaultParams=e,r}return r(e,t),e}(l),h=p,f="object"==typeof global&&global&&global.Object===Object&&global,d="object"==typeof self&&self&&self.Object===Object&&self,y=f||d||Function("return this")(),m=y.Symbol,v=Object.prototype,_=v.hasOwnProperty,b=v.toString,g=m?m.toStringTag:void 0;var E=Object.prototype.toString;var w=m?m.toStringTag:void 0;function O(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":w&&w in Object(t)?function(t){var e=_.call(t,g),r=t[g];try{t[g]=void 0;var n=!0}catch(t){}var o=b.call(t);return n&&(e?t[g]=r:delete t[g]),o}(t):function(t){return E.call(t)}(t)}function x(t){return null!=t&&"object"==typeof t}var T=Array.isArray;function j(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function k(t){if(!j(t))return!1;var e=O(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var A,R=y["__core-js_shared__"],P=(A=/[^.]+$/.exec(R&&R.keys&&R.keys.IE_PROTO||""))?"Symbol(src)_1."+A:"";var S=Function.prototype.toString;function C(t){if(null!=t){try{return S.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var L=/^\[object .+?Constructor\]$/,M=Function.prototype,D=Object.prototype,I=M.toString,N=D.hasOwnProperty,B=RegExp("^"+I.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function V(t){return!(!j(t)||(e=t,P&&P in e))&&(k(t)?B:L).test(C(t));var e}function U(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return V(r)?r:void 0}var q=U(y,"WeakMap"),F=/^(?:0|[1-9]\d*)$/;function z(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&F.test(t))&&t>-1&&t%1==0&&t<e}function G(t,e){return t===e||t!=t&&e!=e}function X(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var Y=Object.prototype;function H(t){return x(t)&&"[object Arguments]"==O(t)}var J=Object.prototype,$=J.hasOwnProperty,Q=J.propertyIsEnumerable,W=H(function(){return arguments}())?H:function(t){return x(t)&&$.call(t,"callee")&&!Q.call(t,"callee")},K=W;var Z="object"==typeof t&&t&&!t.nodeType&&t,tt=Z&&"object"==typeof module&&module&&!module.nodeType&&module,et=tt&&tt.exports===Z?y.Buffer:void 0,rt=(et?et.isBuffer:void 0)||function(){return!1},nt={};nt["[object Float32Array]"]=nt["[object Float64Array]"]=nt["[object Int8Array]"]=nt["[object Int16Array]"]=nt["[object Int32Array]"]=nt["[object Uint8Array]"]=nt["[object Uint8ClampedArray]"]=nt["[object Uint16Array]"]=nt["[object Uint32Array]"]=!0,nt["[object Arguments]"]=nt["[object Array]"]=nt["[object ArrayBuffer]"]=nt["[object Boolean]"]=nt["[object DataView]"]=nt["[object Date]"]=nt["[object Error]"]=nt["[object Function]"]=nt["[object Map]"]=nt["[object Number]"]=nt["[object Object]"]=nt["[object RegExp]"]=nt["[object Set]"]=nt["[object String]"]=nt["[object WeakMap]"]=!1;var ot,it="object"==typeof t&&t&&!t.nodeType&&t,st=it&&"object"==typeof module&&module&&!module.nodeType&&module,at=st&&st.exports===it&&f.process,ct=function(){try{var t=st&&st.require&&st.require("util").types;return t||at&&at.binding&&at.binding("util")}catch(t){}}(),ut=ct&&ct.isTypedArray,lt=ut?(ot=ut,function(t){return ot(t)}):function(t){return x(t)&&X(t.length)&&!!nt[O(t)]},pt=Object.prototype.hasOwnProperty;function ht(t,e){var r=T(t),n=!r&&K(t),o=!r&&!n&&rt(t),i=!r&&!n&&!o&<(t),s=r||n||o||i,a=s?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],c=a.length;for(var u in t)!e&&!pt.call(t,u)||s&&("length"==u||o&&("offset"==u||"parent"==u)||i&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||z(u,c))||a.push(u);return a}var ft=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),dt=ft,yt=Object.prototype.hasOwnProperty;function mt(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||Y))return dt(t);var e,r,n=[];for(var o in Object(t))yt.call(t,o)&&"constructor"!=o&&n.push(o);return n}function vt(t){return null!=(e=t)&&X(e.length)&&!k(e)?ht(t):mt(t);var e}var _t=U(Object,"create");var bt=Object.prototype.hasOwnProperty;var gt=Object.prototype.hasOwnProperty;function Et(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function wt(t,e){for(var r=t.length;r--;)if(G(t[r][0],e))return r;return-1}Et.prototype.clear=function(){this.__data__=_t?_t(null):{},this.size=0},Et.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Et.prototype.get=function(t){var e=this.__data__;if(_t){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return bt.call(e,t)?e[t]:void 0},Et.prototype.has=function(t){var e=this.__data__;return _t?void 0!==e[t]:gt.call(e,t)},Et.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=_t&&void 0===e?"__lodash_hash_undefined__":e,this};var Ot=Array.prototype.splice;function xt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}xt.prototype.clear=function(){this.__data__=[],this.size=0},xt.prototype.delete=function(t){var e=this.__data__,r=wt(e,t);return!(r<0)&&(r==e.length-1?e.pop():Ot.call(e,r,1),--this.size,!0)},xt.prototype.get=function(t){var e=this.__data__,r=wt(e,t);return r<0?void 0:e[r][1]},xt.prototype.has=function(t){return wt(this.__data__,t)>-1},xt.prototype.set=function(t,e){var r=this.__data__,n=wt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var Tt=U(y,"Map");function jt(t,e){var r=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?r["string"==typeof e?"string":"hash"]:r.map}function kt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}kt.prototype.clear=function(){this.size=0,this.__data__={hash:new Et,map:new(Tt||xt),string:new Et}},kt.prototype.delete=function(t){var e=jt(this,t).delete(t);return this.size-=e?1:0,e},kt.prototype.get=function(t){return jt(this,t).get(t)},kt.prototype.has=function(t){return jt(this,t).has(t)},kt.prototype.set=function(t,e){var r=jt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function At(t){var e=this.__data__=new xt(t);this.size=e.size}At.prototype.clear=function(){this.__data__=new xt,this.size=0},At.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},At.prototype.get=function(t){return this.__data__.get(t)},At.prototype.has=function(t){return this.__data__.has(t)},At.prototype.set=function(t,e){var r=this.__data__;if(r instanceof xt){var n=r.__data__;if(!Tt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new kt(n)}return r.set(t,e),this.size=r.size,this};var Rt=Object.prototype.propertyIsEnumerable,Pt=Object.getOwnPropertySymbols,St=Pt?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var s=t[r];e(s,r,t)&&(i[o++]=s)}return i}(Pt(t),(function(e){return Rt.call(t,e)})))}:function(){return[]};function Ct(t){return function(t,e,r){var n=e(t);return T(t)?n:function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}(n,r(t))}(t,vt,St)}var Lt=U(y,"DataView"),Mt=U(y,"Promise"),Dt=U(y,"Set"),It="[object Map]",Nt="[object Promise]",Bt="[object Set]",Vt="[object WeakMap]",Ut="[object DataView]",qt=C(Lt),Ft=C(Tt),zt=C(Mt),Gt=C(Dt),Xt=C(q),Yt=O;(Lt&&Yt(new Lt(new ArrayBuffer(1)))!=Ut||Tt&&Yt(new Tt)!=It||Mt&&Yt(Mt.resolve())!=Nt||Dt&&Yt(new Dt)!=Bt||q&&Yt(new q)!=Vt)&&(Yt=function(t){var e=O(t),r="[object Object]"==e?t.constructor:void 0,n=r?C(r):"";if(n)switch(n){case qt:return Ut;case Ft:return It;case zt:return Nt;case Gt:return Bt;case Xt:return Vt}return e});var Ht=Yt,Jt=y.Uint8Array;function $t(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new kt;++e<r;)this.add(t[e])}function Qt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}$t.prototype.add=$t.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},$t.prototype.has=function(t){return this.__data__.has(t)};function Wt(t,e,r,n,o,i){var s=1&r,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=i.get(t),l=i.get(e);if(u&&l)return u==e&&l==t;var p=-1,h=!0,f=2&r?new $t:void 0;for(i.set(t,e),i.set(e,t);++p<a;){var d=t[p],y=e[p];if(n)var m=s?n(y,d,p,e,t,i):n(d,y,p,t,e,i);if(void 0!==m){if(m)continue;h=!1;break}if(f){if(!Qt(e,(function(t,e){if(s=e,!f.has(s)&&(d===t||o(d,t,r,n,i)))return f.push(e);var s}))){h=!1;break}}else if(d!==y&&!o(d,y,r,n,i)){h=!1;break}}return i.delete(t),i.delete(e),h}function Kt(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function Zt(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var te=m?m.prototype:void 0,ee=te?te.valueOf:void 0;var re=Object.prototype.hasOwnProperty;var ne,oe="[object Arguments]",ie="[object Array]",se="[object Object]",ae=Object.prototype.hasOwnProperty;function ce(t,e,r,n,o,i){var s=T(t),a=T(e),c=s?ie:Ht(t),u=a?ie:Ht(e),l=(c=c==oe?se:c)==se,p=(u=u==oe?se:u)==se,h=c==u;if(h&&rt(t)){if(!rt(e))return!1;s=!0,l=!1}if(h&&!l)return i||(i=new At),s||lt(t)?Wt(t,e,r,n,o,i):function(t,e,r,n,o,i,s){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Jt(t),new Jt(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return G(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=Kt;case"[object Set]":var c=1&n;if(a||(a=Zt),t.size!=e.size&&!c)return!1;var u=s.get(t);if(u)return u==e;n|=2,s.set(t,e);var l=Wt(a(t),a(e),n,o,i,s);return s.delete(t),l;case"[object Symbol]":if(ee)return ee.call(t)==ee.call(e)}return!1}(t,e,c,r,n,o,i);if(!(1&r)){var f=l&&ae.call(t,"__wrapped__"),d=p&&ae.call(e,"__wrapped__");if(f||d){var y=f?t.value():t,m=d?e.value():e;return i||(i=new At),o(y,m,r,n,i)}}return!!h&&(i||(i=new At),function(t,e,r,n,o,i){var s=1&r,a=Ct(t),c=a.length;if(c!=Ct(e).length&&!s)return!1;for(var u=c;u--;){var l=a[u];if(!(s?l in e:re.call(e,l)))return!1}var p=i.get(t),h=i.get(e);if(p&&h)return p==e&&h==t;var f=!0;i.set(t,e),i.set(e,t);for(var d=s;++u<c;){var y=t[l=a[u]],m=e[l];if(n)var v=s?n(m,y,l,e,t,i):n(y,m,l,t,e,i);if(!(void 0===v?y===m||o(y,m,r,n,i):v)){f=!1;break}d||(d="constructor"==l)}if(f&&!d){var _=t.constructor,b=e.constructor;_==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof _&&_ instanceof _&&"function"==typeof b&&b instanceof b||(f=!1)}return i.delete(t),i.delete(e),f}(t,e,r,n,o,i))}function ue(t,e,r,n,o){return t===e||(null==t||null==e||!x(t)&&!x(e)?t!=t&&e!=e:ce(t,e,r,n,ue,o))}function le(t,e){return ue(t,e)}t.OBSERVER_TYPE=void 0,(ne=t.OBSERVER_TYPE||(t.OBSERVER_TYPE={})).ADD="ADD",ne.REMOVE="REMOVE",ne.CHANGE="CHANGE";var pe={},he={},fe={},de={};function ye(t,e){pe[t.gameObject.id]||(pe[t.gameObject.id]={});var r=pe[t.gameObject.id],n=t.name+"_"+e.join(",");if(r[n])return r[n];for(var o=e.length-1,i=t,s=0;s<o;s++)i=i[e[s]];return r[n]={property:i,key:e[o]},r[n]}function me(t){var e,r,n=t.systemName,o=t.componentName,i=t.component,s=t.prop,a=t.type;null===(r=null===(e=he[n])||void 0===e?void 0:e.componentObserver)||void 0===r||r.add({component:i,prop:s,type:a,componentName:o})}function ve(e){var r,n,o=e.obj,i=e.key,a=e.prop,c=e.component,u=e.componentName;if(void 0!==o)if(i in o){if(Object.defineProperty(o,"_"+i,{enumerable:!1,writable:!0,value:o[i]}),a.deep&&j(o[i]))try{for(var l=s(Object.keys(o[i])),p=l.next();!p.done;p=l.next()){var h=p.value;ve({obj:o[i],key:h,prop:a,component:c,componentName:u})}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}Object.defineProperty(o,i,{enumerable:!0,set:function(e){o["_"+i]!==e&&(o["_"+i]=e,function(e){var r=e.prop,n=e.component,o=e.componentName;for(var i in fe){var s=(fe[i]||{})[o];s&&s.findIndex((function(t){return le(t,r)}))>-1&&me({systemName:i,componentName:o,component:n,prop:r,type:t.OBSERVER_TYPE.CHANGE})}}({prop:a,component:c,componentName:u}))},get:function(){return o["_"+i]}})}else console.error("prop "+i+" not in component: "+u+", Can not observer")}function _e(e,r){var n,o;for(var i in void 0===r&&(r=e.name),fe){(fe[i]||{})[r]&&(null===(o=null===(n=he[i])||void 0===n?void 0:n.componentObserver)||void 0===o||o.add({component:e,type:t.OBSERVER_TYPE.REMOVE,componentName:r}))}!function(t){t.gameObject&&delete pe[t.gameObject.id]}(e)}function be(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}function ge(t){return function(e,r){var n=be(e,r);n.key=r,n.type=t}}function Ee(t){return function(e,r){be(e,r).step=t}}var we=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Transform",e._parent=null,e.inScene=!1,e.children=[],e.position={x:0,y:0},e.size={width:0,height:0},e.origin={x:0,y:0},e.anchor={x:0,y:0},e.scale={x:1,y:1},e.skew={x:0,y:0},e.rotation=0,e}return r(e,t),e.prototype.init=function(t){var e,r;void 0===t&&(t={});try{for(var n=s(["position","size","origin","anchor","scale","skew"]),o=n.next();!o.done;o=n.next()){var i=o.value;_extends(this[i],t[i])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}this.rotation=t.rotation||this.rotation},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},set:function(t){t?t.addChild(this):this.parent&&this.parent.removeChild(this)},enumerable:!1,configurable:!0}),e.prototype.addChild=function(t){if(t.parent===this){var e=this.children.findIndex((function(e){return e===t}));this.children.splice(e,1)}else t.parent&&t.parent.removeChild(t);t._parent=this,this.children.push(t)},e.prototype.removeChild=function(t){var e=this.children.findIndex((function(e){return e===t}));e>-1&&(this.children.splice(e,1),t._parent=null)},e.prototype.clearChildren=function(){this.children.length=0},e.componentName="Transform",n([ge("vector2"),Ee(1)],e.prototype,"position",void 0),n([ge("size"),Ee(1)],e.prototype,"size",void 0),n([ge("vector2"),Ee(.1)],e.prototype,"origin",void 0),n([ge("vector2"),Ee(.1)],e.prototype,"anchor",void 0),n([ge("vector2"),Ee(.1)],e.prototype,"scale",void 0),n([ge("vector2"),Ee(.1)],e.prototype,"skew",void 0),n([ge("number"),Ee(.1)],e.prototype,"rotation",void 0),e}(h),Oe=we,xe=0;var Te=function(){function e(t,e){this._componentCache={},this.components=[],this.destroyed=!1,this._name=t,this.id=++xe,this.addComponent(Oe,e)}return Object.defineProperty(e.prototype,"transform",{get:function(){return this.getComponent(Oe)},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(t){var e,r;if(this._scene!==t){var n=this._scene;if(this._scene=t,this.transform&&this.transform.children)try{for(var o=s(this.transform.children),i=o.next();!i.done;i=o.next()){i.value.gameObject.scene=t}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t?t.addGameObject(this):n&&n.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,r){if(!this.destroyed){var n=function(t){return t instanceof p?t.name:t instanceof Function?t.componentName:void 0}(e);if(!this._componentCache[n]){var o;if(e instanceof Function)o=new e(r);else{if(!(e instanceof h))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,r){var n,o;for(var i in void 0===r&&(r=e.name),fe)(fe[i]||{})[r]&&(null===(o=null===(n=he[i])||void 0===n?void 0:n.componentObserver)||void 0===o||o.add({component:e,type:t.OBSERVER_TYPE.ADD,componentName:r}))}(o,o.name),function(t,e){var r,n;if(void 0===e&&(e=t.name),e&&de[e]){if(!(t&&(o=t,o&&o.constructor&&"componentName"in o.constructor)))throw new Error("component param must be an instance of Component");var o;if(!t.gameObject||!t.gameObject.id)throw new Error("component should be add to a gameObject");try{for(var i=s(de[e]),a=i.next();!a.done;a=i.next()){var c=a.value,u=ye(t,c.prop);ve({obj:u.property,key:u.key,prop:c,component:t,componentName:e})}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}(o,o.name),this.components.push(o),this._componentCache[n]=o,o.awake&&o.awake(),o}}},e.prototype.removeComponent=function(t){var e;if("string"==typeof t?e=t:t instanceof h?e=t.name:t.componentName&&(e=t.componentName),"Transform"===e)throw new Error("Transform can't be removed");return this._removeComponent(e)},e.prototype._removeComponent=function(t){var e=this.components.findIndex((function(e){return e.name===t}));if(-1!==e){var r=this.components.splice(e,1)[0];return delete this._componentCache[t],delete r.__componentDefaultParams,r.onDestroy&&r.onDestroy(),_e(r,t),r.gameObject=void 0,r}},e.prototype.getComponent=function(t){var e;return"string"==typeof t?e=t:t instanceof h?e=t.name:t.componentName&&(e=t.componentName),void 0!==this._componentCache[e]?this._componentCache[e]:void 0},e.prototype.remove=function(){if(this.parent)return this.parent.removeChild(this)},e.prototype.destroy=function(){if(this.transform){for(var t in Array.from(this.transform.children).forEach((function(t){t.gameObject.destroy()})),this.remove(),this.transform.clearChildren(),this._componentCache)this._removeComponent(t);this.components.length=0,this.destroyed=!0}else console.error("Cannot destroy gameObject that have already been destroyed.")},e}(),je=function(){function e(){this.events=[]}return e.prototype.add=function(e){var r=e.component,n=e.prop,o=e.type,i=e.componentName;if(o===t.OBSERVER_TYPE.REMOVE){if(this.events.find((function(e){return e.component===r&&e.type===t.OBSERVER_TYPE.ADD})))return void(this.events=this.events.filter((function(t){return t.component!==r})));this.events=this.events.filter((function(t){return t.component!==r}))}var s=this.events.findIndex((function(t){return t.component===r&&le(t.prop,n)&&t.type===o}));s>-1&&this.events.splice(s,1),this.events.push({gameObject:r.gameObject,component:r,prop:n,type:o,componentName:i})},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 t=this.events;return this.events=[],t},e}(),ke=je,Ae=function(){function t(t){this.started=!1,this.componentObserver=new ke,this.__systemDefaultParams=t,this.name=this.constructor.systemName}return t.prototype.destroy=function(){var t;this.componentObserver=null,this.__systemDefaultParams=null,null===(t=this.onDestroy)||void 0===t||t.call(this)},t}();var Re,Pe=Date.now?Date.now:function(){return(new Date).getTime()},Se={originTime:0,playbackRate:1},Ce=function(){function t(e,r){e instanceof t&&(r=e,e={}),e=_extends({},Se,e),r&&(this._parent=r),this._createTime=Pe(),this._timeMark=[{globalTime:this.globalTime,localTime:-e.originTime,entropy:-e.originTime,playbackRate:e.playbackRate,globalEntropy:0}],this._parent&&(this._timeMark[0].globalEntropy=this._parent.entropy),this._playbackRate=e.playbackRate}return Object.defineProperty(t.prototype,"globalTime",{get:function(){return this.parent?this.parent.currentTime:Pe()-this._createTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastTimeMark",{get:function(){return this._timeMark[this._timeMark.length-1]},enumerable:!1,configurable:!0}),t.prototype.markTime=function(t){var e=void 0===t?{}:t,r=e.time,n=void 0===r?this.currentTime:r,o=e.entropy,i=void 0===o?this.entropy:o,s=e.playbackRate,a=void 0===s?this.playbackRate:s,c={globalTime:this.globalTime,localTime:n,entropy:i,playbackRate:a,globalEntropy:this.globalEntropy};this._timeMark.push(c)},Object.defineProperty(t.prototype,"currentTime",{get:function(){var t=this.lastTimeMark,e=t.localTime,r=t.globalTime;return e+(this.globalTime-r)*this.playbackRate},set:function(t){this.markTime({time:t})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"globalEntropy",{get:function(){return this._parent?this._parent.entropy:this.globalTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"entropy",{get:function(){var t=this.lastTimeMark,e=t.entropy,r=t.globalEntropy;return e+Math.abs((this.globalEntropy-r)*this.playbackRate)},set:function(t){if(this.entropy>t){var e=this.seekTimeMark(t);this._timeMark.length=e+1}this.markTime({entropy:t})},enumerable:!1,configurable:!0}),t.prototype.fork=function(e){return new t(e,this)},t.prototype.seekGlobalTime=function(t){var e=this.seekTimeMark(t),r=this._timeMark[e],n=r.entropy,o=r.playbackRate;return r.globalTime+(t-n)/Math.abs(o)},t.prototype.seekLocalTime=function(t){var e=this.seekTimeMark(t),r=this._timeMark[e],n=r.localTime,o=r.entropy;return r.playbackRate>0?n+(t-o):n-(t-o)},t.prototype.seekTimeMark=function(t){var e=this._timeMark,r=0,n=e.length-1;if(t<=e[r].entropy)return r;if(t>=e[n].entropy)return n;for(var o=Math.floor((r+n)/2);o>r&&o<n;){if(t===e[o].entropy)return o;t<e[o].entropy?n=o:t>e[o].entropy&&(r=o),o=Math.floor((r+n)/2)}return r},Object.defineProperty(t.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(t){t!==this.playbackRate&&(this.markTime({playbackRate:t}),this._playbackRate=t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paused",{get:function(){if(0===this.playbackRate)return!0;for(var t=this.parent;t;){if(0===t.playbackRate)return!0;t=t.parent}return!1},enumerable:!1,configurable:!0}),t}(),Le={autoStart:!0,frameRate:60},Me=function(){function t(t){var e=this;t=_extends({},Le,t),this._frameCount=0,this._frameDuration=1e3/t.frameRate,this.autoStart=t.autoStart,this.frameRate=t.frameRate,this.timeline=new Ce({originTime:0,playbackRate:1}),this._lastFrameTime=this.timeline.currentTime,this._tickers=new Set,this._requestId=null,this._ticker=function(){e._started&&(e._requestId=requestAnimationFrame(e._ticker),e.update())},this.autoStart&&this.start()}return t.prototype.update=function(){var t,e,r=this.timeline.currentTime,n=r-this._lastFrameTime;if(n>=this._frameDuration){var o=r-n%this._frameDuration,i=o-this._lastFrameTime;this._lastFrameTime=o;var a={deltaTime:i,time:o,currentTime:o,frameCount:++this._frameCount,fps:Math.round(1e3/i)};try{for(var c=s(this._tickers),u=c.next();!u.done;u=c.next()){var l=u.value;"function"==typeof l&&l(a)}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}}},t.prototype.add=function(t){this._tickers.add(t)},t.prototype.remove=function(t){this._tickers.delete(t)},t.prototype.start=function(){this._started||(this._started=!0,this.timeline.playbackRate=1,this._requestId=requestAnimationFrame(this._ticker))},t.prototype.pause=function(){this._started=!1,this.timeline.playbackRate=0},t.prototype.setPlaybackRate=function(t){this.timeline.playbackRate=t},t}(),De=Me,Ie=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.gameObjects=[],n.scene=n,n}return r(e,t),e.prototype.addGameObject=function(t){this.gameObjects.push(t),t.transform&&(t.transform.inScene=!0)},e.prototype.removeGameObject=function(t){var e=this.gameObjects.indexOf(t);-1!==e&&(t.transform&&(t.transform.inScene=!1),this.gameObjects.splice(e,1))},e.prototype.destroy=function(){this.scene=null,t.prototype.destroy.call(this),this.gameObjects=null,this.canvas=null},e}(Te);t.LOAD_SCENE_MODE=void 0,(Re=t.LOAD_SCENE_MODE||(t.LOAD_SCENE_MODE={})).SINGLE="SINGLE",Re.MULTI_CANVAS="MULTI_CANVAS";var Ne=function(t){if((t instanceof Ae||t instanceof h)&&!t.started){t.started=!0;try{t.start&&t.start()}catch(e){t instanceof h?console.error(t.constructor.componentName+" start error",e):console.error(t.constructor.systemName+" start error",e)}}},Be=function(e){function n(t){var r,n,o=void 0===t?{}:t,i=o.systems,a=o.frameRate,c=void 0===a?60:a,u=o.autoStart,l=void 0===u||u,p=o.needScene,h=void 0===p||p,f=e.call(this)||this;if(f.playing=!1,f.started=!1,f.multiScenes=[],f.systems=[],window.__EVA_INSPECTOR_ENV__&&(window.__EVA_GAME_INSTANCE__=f),f.ticker=new De({autoStart:!1,frameRate:c}),f.initTicker(),i&&i.length)try{for(var d=s(i),y=d.next();!y.done;y=d.next()){var m=y.value;f.addSystem(m)}}catch(t){r={error:t}}finally{try{y&&!y.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return h&&f.loadScene(new Ie("scene")),l&&f.start(),f}return r(n,e),Object.defineProperty(n.prototype,"scene",{get:function(){return this._scene},set:function(t){this._scene=t},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"gameObjects",{get:function(){return function(t){var e,r,n,o=(null===(n=null==t?void 0:t.scene)||void 0===n?void 0:n.gameObjects)||[],i=null==t?void 0:t.multiScenes.map((function(t){return t.gameObjects})),a=[];try{for(var u=s(i),l=u.next();!l.done;l=u.next())a=c(a,l.value)}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return c(o,a)}(this)},enumerable:!1,configurable:!0}),n.prototype.addSystem=function(t,e){var r;if(t instanceof Function)r=new t(e);else{if(!(t instanceof Ae))return void console.warn("can only add System");r=t}if(!this.systems.find((function(t){return t.constructor===r.constructor}))){r.game=this,r.init&&r.init(r.__systemDefaultParams),function(t,e){fe[e.systemName]=e.observerInfo,he[e.systemName]=t}(r,r.constructor),function(t){var e,r,n,o,i=[];t instanceof Array?i.push.apply(i,c(t)):i.push(t);try{for(var a=s(i),u=a.next();!u.done;u=a.next()){var l=u.value;for(var p in l.observerInfo){de[p]=de[p]||[];var h=de[p],f=function(t){-1===h.findIndex((function(e){return le(e,t)}))&&de[p].push(t)};try{for(var d=(n=void 0,s(l.observerInfo[p])),y=d.next();!y.done;y=d.next())f(y.value)}catch(t){n={error:t}}finally{try{y&&!y.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}(r.constructor);try{r.awake&&r.awake()}catch(t){console.error(r.constructor.systemName+" awake error",t)}return this.systems.push(r),r}console.warn(r.constructor.systemName+" System has been added")},n.prototype.removeSystem=function(t){if(t){var e=-1;"string"==typeof t?e=this.systems.findIndex((function(e){return e.name===t})):t instanceof Function?e=this.systems.findIndex((function(e){return e.constructor===t})):t instanceof Ae&&(e=this.systems.findIndex((function(e){return e===t}))),e>-1&&(this.systems[e].destroy&&this.systems[e].destroy(),this.systems.splice(e,1))}},n.prototype.getSystem=function(t){return this.systems.find((function(e){return"string"==typeof t?e.name===t:e instanceof t}))},n.prototype.pause=function(){this.playing&&(this.playing=!1,this.ticker.pause(),this.triggerPause())},n.prototype.start=function(){this.playing||(this.playing=!0,this.started=!0,this.ticker.start())},n.prototype.resume=function(){this.playing||(this.playing=!0,this.ticker.start(),this.triggerResume())},n.prototype.initTicker=function(){var t=this;this.ticker.add((function(e){var r,n,o,i;t.scene&&function(t,e){var r,n,o,i,a,c,u,l;void 0===e&&(e=[]);try{for(var p=s(e),h=p.next();!h.done;h=p.next()){var f=h.value;try{for(var d=(o=void 0,s(f.components)),y=d.next();!y.done;y=d.next()){var m=y.value;try{Ne(m),m.update&&m.update(t)}catch(t){console.error("gameObject: "+f.name+" "+m.name+" update error",t)}}}catch(t){o={error:t}}finally{try{y&&!y.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}try{for(var v=s(e),_=v.next();!_.done;_=v.next()){f=_.value;try{for(var b=(u=void 0,s(f.components)),g=b.next();!g.done;g=b.next()){m=g.value;try{m.lateUpdate&&m.lateUpdate(t)}catch(t){console.error("gameObject: "+f.name+" "+m.name+" lateUpdate error",t)}}}catch(t){u={error:t}}finally{try{g&&!g.done&&(l=b.return)&&l.call(b)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{_&&!_.done&&(c=v.return)&&c.call(v)}finally{if(a)throw a.error}}}(e,t.gameObjects);try{for(var a=s(t.systems),c=a.next();!c.done;c=a.next()){var u=c.value;try{Ne(u),u.update&&u.update(e)}catch(e){console.error(u.constructor.systemName+" update error",e)}}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}try{for(var l=s(t.systems),p=l.next();!p.done;p=l.next()){u=p.value;try{u.lateUpdate&&u.lateUpdate(e)}catch(e){console.error(u.constructor.systemName+" lateUpdate error",e)}}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}}))},n.prototype.triggerResume=function(){var t,e;!function(t){var e,r,n,o;try{for(var i=s(t),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var u=(n=void 0,s(c.components)),l=u.next();!l.done;l=u.next()){var p=l.value;try{p.onResume&&p.onResume()}catch(t){console.error("gameObject: "+c.name+", "+p.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}(this.gameObjects);try{for(var r=s(this.systems),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.onResume&&o.onResume()}catch(t){console.error(o.constructor.systemName+", onResume error",t)}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},n.prototype.triggerPause=function(){var t,e;!function(t){var e,r,n,o;try{for(var i=s(t),a=i.next();!a.done;a=i.next()){var c=a.value;try{for(var u=(n=void 0,s(c.components)),l=u.next();!l.done;l=u.next()){var p=l.value;try{p.onPause&&p.onPause()}catch(t){console.error("gameObject: "+c.name+", "+p.name+", onResume error",t)}}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}(this.gameObjects);try{for(var r=s(this.systems),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.onPause&&o.onPause()}catch(t){console.error(o.constructor.systemName+", onPause error",t)}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},n.prototype.destroySystems=function(){var t,e;try{for(var r=s(c(this.systems)),n=r.next();!n.done;n=r.next()){var o=n.value;this.removeSystem(o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.systems.length=0},n.prototype.destroy=function(){this.removeAllListeners(),this.pause(),this.scene.destroy(),this.destroySystems(),this.ticker=null,this.scene=null,this.canvas=null,this.multiScenes=null},n.prototype.loadScene=function(e){var r=e.scene,n=e.mode,o=void 0===n?t.LOAD_SCENE_MODE.SINGLE:n,i=e.params,s=void 0===i?{}:i;if(r){switch(o){case t.LOAD_SCENE_MODE.SINGLE:this.scene=r;break;case t.LOAD_SCENE_MODE.MULTI_CANVAS:this.multiScenes.push(r)}this.emit("sceneChanged",{scene:r,mode:o,params:s})}},n}(l);function Ve(t,e){t.constructor.IDEProps||(t.constructor.IDEProps=[]),t.constructor.IDEProps.push(e)}function Ue(t){return void 0===t&&(t={}),function(e){if(!e.observerInfo){for(var r in t)for(var n in t[r]){"string"==typeof t[r][n]&&(t[r][n]=[t[r][n]]);var o=void 0;Array.isArray(t[r][n])&&(o={prop:t[r][n],deep:!1},t[r][n]=o),"string"==typeof(o=t[r][n]).prop&&(o.prop=[o.prop])}e.observerInfo=t}}}var qe,Fe,ze=function(){function t(t,e,r){void 0===e&&(e=!1),this.next=null,this.prev=null,this.owner=null,this.fn=t,this.once=e,this.thisArg=r}return t.prototype.detach=function(){return null!==this.owner&&(this.owner.detach(this),!0)},t.prototype.dispose=function(){this.detach()},t}(),Ge=function(){function t(){this._head=null,this._tail=null,this._filter=null}return t.prototype.handlers=function(){for(var t=this._head,e=[];t;)e.push(t),t=t.next;return e},t.prototype.hasAny=function(){return!!this._head},t.prototype.has=function(t){return t.owner===this},t.prototype.dispatch=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=this._head;if(!r)return!1;if(this._filter&&!this._filter.apply(this,t))return!1;for(;r;)r.once&&this.detach(r),r.fn.apply(r.thisArg,t),r=r.next;return!0},t.prototype.add=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new ze(t,!1,e))},t.prototype.once=function(t,e){return void 0===e&&(e=null),this._addSignalBinding(new ze(t,!0,e))},t.prototype.detach=function(t){var e=t;return e.owner!==this||(e.prev&&(e.prev.next=e.next),e.next&&(e.next.prev=e.prev),e===this._head?(this._head=e.next,null===e.next&&(this._tail=null)):e===this._tail&&(this._tail=e.prev,this._tail&&(this._tail.next=null)),e.owner=null),this},t.prototype.detachAll=function(){var t=this._head;if(!t)return this;for(this._head=null,this._tail=null;t;)t.owner=null,t=t.next;return this},t.prototype.filter=function(t){this._filter=t},t.prototype.proxy=function(){for(var t=this,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var n=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.dispatch.apply(t,e)},o=0;o<e.length;++o)e[o].add(n);return this},t.prototype._addSignalBinding=function(t){var e=t;return this._head?(this._tail&&(this._tail.next=e),e.prev=this._tail,this._tail=e):(this._head=e,this._tail=e),e.owner=this,e},t}(),Xe=function(t,e){if(void 0===e&&(e={}),t){for(var r={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/}},n=r.parser[e.strictMode?"strict":"loose"].exec(t),o={},i=14;i--;)o[r.key[i]]=n[i]||"";return o[r.q.name]={},o[r.key[12]].replace(r.q.parser,(function(t,e,n){e&&(o[r.q.name][e]=n)})),o}},Ye=function(t){this.config=t,this.onError=new Ge,this.onComplete=new Ge,this.onProgress=new Ge},He=function(t,e){return He=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},He(t,e)};function Je(t,e){function r(){this.constructor=t}He(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function $e(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}function Qe(t){var e="";if(0===t.indexOf("data:")){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var n=t.indexOf("?"),o=t.indexOf("#"),i=Math.min(n>-1?n:t.length,o>-1?o:t.length);e=(t=t.substring(0,i)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()}function We(t){throw new Error("Unexpected value. Should have been never.")}!function(t){t[t.Unknown=0]="Unknown",t[t.Buffer=1]="Buffer",t[t.Blob=2]="Blob",t[t.Json=3]="Json",t[t.Xml=4]="Xml",t[t.Image=5]="Image",t[t.Audio=6]="Audio",t[t.Video=7]="Video",t[t.Text=8]="Text"}(qe||(qe={})),function(t){t[t.NotStarted=0]="NotStarted",t[t.Loading=1]="Loading",t[t.Complete=2]="Complete"}(Fe||(Fe={}));var Ke,Ze=function(t){function e(e,r){var n=t.call(this,e)||this;return n.elementType=r,n._boundOnLoad=n._onLoad.bind(n),n._boundOnError=n._onError.bind(n),n._boundOnTimeout=n._onTimeout.bind(n),n._element=n._createElement(),n._elementTimer=0,n}return Je(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin);var e=t.sourceSet||[t.url];if(navigator.isCocoonJS)this._element.src=e[0];else for(var r=0;r<e.length;++r){var n=e[r],o=t.mimeTypes?t.mimeTypes[r]:void 0;o||(o=this.elementType+"/"+Qe(n));var i=document.createElement("source");i.src=n,i.type=o,this._element.appendChild(i)}this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("canplaythrough",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),this._element.load(),t.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,t.timeout))},e.prototype.abort=function(){for(this._clearEvents();this._element.firstChild;)this._element.removeChild(this._element.firstChild);this._error(this.elementType+" load aborted by the user.")},e.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement(this.elementType)},e.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("canplaythrough",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(){this._clearEvents();var t=qe.Unknown;switch(this.elementType){case"audio":t=qe.Audio;break;case"video":t=qe.Video;break;default:We(this.elementType)}this.onComplete.dispatch(t,this._element)},e.prototype._onLoad=function(){this._complete()},e.prototype._onError=function(){this._error(this.elementType+" failed to load.")},e.prototype._onTimeout=function(){this._error(this.elementType+" load timed out.")},e}(Ye),tr=function(t){function e(e){return t.call(this,e,"audio")||this}return Je(e,t),e}(Ze),er=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundOnLoad=e._onLoad.bind(e),e._boundOnError=e._onError.bind(e),e._boundOnTimeout=e._onTimeout.bind(e),e._element=e._createElement(),e._elementTimer=0,e}return Je(e,t),e.prototype.load=function(){var t=this.config;t.crossOrigin&&(this._element.crossOrigin=t.crossOrigin),this._element.src=t.url,this._element.addEventListener("load",this._boundOnLoad,!1),this._element.addEventListener("error",this._boundOnError,!1),t.timeout&&(this._elementTimer=window.setTimeout(this._boundOnTimeout,t.timeout))},e.prototype.abort=function(){this._clearEvents(),this._element.src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",this._error("Image load aborted by the user.")},e.prototype._createElement=function(){return this.config.loadElement?this.config.loadElement:document.createElement("img")},e.prototype._clearEvents=function(){clearTimeout(this._elementTimer),this._element.removeEventListener("load",this._boundOnLoad,!1),this._element.removeEventListener("error",this._boundOnError,!1)},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(){this._clearEvents(),this.onComplete.dispatch(qe.Image,this._element)},e.prototype._onLoad=function(){this._complete()},e.prototype._onError=function(){this._error("Image failed to load.")},e.prototype._onTimeout=function(){this._error("Image load timed out.")},e}(Ye),rr=function(t){function e(e){return t.call(this,e,"video")||this}return Je(e,t),e}(Ze),nr=!(!window.XDomainRequest||"withCredentials"in new XMLHttpRequest);function or(t){return t.toString().replace("object ","")}!function(t){t.Default="text",t.Buffer="arraybuffer",t.Blob="blob",t.Document="document",t.Json="json",t.Text="text"}(Ke||(Ke={}));var ir=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._boundOnLoad=e._onLoad.bind(e),e._boundOnAbort=e._onAbort.bind(e),e._boundOnError=e._onError.bind(e),e._boundOnTimeout=e._onTimeout.bind(e),e._boundOnProgress=e._onProgress.bind(e),e._xhr=e._createRequest(),e._xhrType=Ke.Default,e}return Je(e,t),e.prototype.load=function(){var t=this.config,e=Qe(t.url);"string"!=typeof t.xhrType&&(t.xhrType=this._determineXhrType(e));var r=this._xhr;this._xhrType=t.xhrType||Ke.Default,nr?(r.timeout=t.timeout||5e3,r.onload=this._boundOnLoad,r.onerror=this._boundOnError,r.ontimeout=this._boundOnTimeout,r.onprogress=this._boundOnProgress,r.open("GET",t.url,!0),setTimeout((function(){r.send()}),0)):(r.open("GET",t.url,!0),t.timeout&&(r.timeout=t.timeout),t.xhrType===Ke.Json||t.xhrType===Ke.Document?r.responseType=Ke.Text:r.responseType=t.xhrType,r.addEventListener("load",this._boundOnLoad,!1),r.addEventListener("abort",this._boundOnAbort,!1),r.addEventListener("error",this._boundOnError,!1),r.addEventListener("timeout",this._boundOnTimeout,!1),r.addEventListener("progress",this._boundOnProgress,!1),r.send())},e.prototype.abort=function(){nr?(this._clearEvents(),this._xhr.abort(),this._onAbort()):this._xhr.abort()},e.prototype._createRequest=function(){return nr?new window.XDomainRequest:new XMLHttpRequest},e.prototype._determineXhrType=function(t){return e._xhrTypeMap[t]||Ke.Default},e.prototype._clearEvents=function(){nr?(this._xhr.onload=null,this._xhr.onerror=null,this._xhr.ontimeout=null,this._xhr.onprogress=null):(this._xhr.removeEventListener("load",this._boundOnLoad,!1),this._xhr.removeEventListener("abort",this._boundOnAbort,!1),this._xhr.removeEventListener("error",this._boundOnError,!1),this._xhr.removeEventListener("timeout",this._boundOnTimeout,!1),this._xhr.removeEventListener("progress",this._boundOnProgress,!1))},e.prototype._error=function(t){this._clearEvents(),this.onError.dispatch(t)},e.prototype._complete=function(t,e){this._clearEvents(),this.onComplete.dispatch(t,e)},e.prototype._onLoad=function(){var t=this._xhr,e="",r=void 0===t.status?200:t.status;if(void 0!==t.responseType&&""!==t.responseType&&"text"!==t.responseType||(e=t.responseText),0===r&&(e.length>0||t.responseType===Ke.Buffer)?r=200:1223===r&&(r=204),200===100*Math.floor(r/100))switch(this._xhrType){case Ke.Buffer:this._complete(qe.Buffer,t.response);break;case Ke.Blob:this._complete(qe.Blob,t.response);break;case Ke.Document:this._parseDocument(e);break;case Ke.Json:this._parseJson(e);break;case Ke.Default:case Ke.Text:this._complete(qe.Text,e);break;default:We(this._xhrType)}else this._error("["+t.status+"] "+t.statusText+": "+t.responseURL)},e.prototype._parseDocument=function(t){try{if(window.DOMParser){var e=(new DOMParser).parseFromString(t,"text/xml");this._complete(qe.Xml,e)}else{var r=document.createElement("div");r.innerHTML=t,this._complete(qe.Xml,r)}}catch(t){this._error("Error trying to parse loaded xml: "+t)}},e.prototype._parseJson=function(t){try{var e=JSON.parse(t);this._complete(qe.Json,e)}catch(t){this._error("Error trying to parse loaded json: "+t)}},e.prototype._onAbort=function(){var t=this._xhr;this._error(or(t)+" Request was aborted by the user.")},e.prototype._onError=function(){var t=this._xhr;this._error(or(t)+" Request failed. Status: "+t.status+', text: "'+t.statusText+'"')},e.prototype._onTimeout=function(){var t=this._xhr;this._error(or(t)+" Request timed out.")},e.prototype._onProgress=function(t){t&&t.lengthComputable&&this.onProgress.dispatch(t.loaded/t.total)},e.setExtensionXhrType=function(t,r){t&&0===t.indexOf(".")&&(t=t.substring(1)),t&&(e._xhrTypeMap[t]=r)},e.ResponseType=Ke,e._xhrTypeMap={xhtml:Ke.Document,html:Ke.Document,htm:Ke.Document,xml:Ke.Document,tmx:Ke.Document,svg:Ke.Document,tsx:Ke.Document,gif:Ke