@eva/plugin-a11y 1.2.0-alpha.4 → 1.2.0-alpha.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- function _extends(){return(_extends=Object.assign||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}).apply(this,arguments)}this.EVA=this.EVA||{},this.EVA.plugin=this.EVA.plugin||{},this.EVA.plugin.a11y=function(t,e,r){"use strict";var n=function(t,e){return(n=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])})(t,e)};function o(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var i=function(){return(i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function a(t,e,r,n){var o,i=arguments.length,a=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var _=t.length-1;_>=0;_--)(o=t[_])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function _(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{s(n.next(t))}catch(t){i(t)}}function _(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,_)}s((n=n.apply(t,e||[])).next())}))}function s(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:_(0),throw:_(1),return:_(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function _(i){return function(_){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}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,_])}}}function c(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 u(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.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 a}function p(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(u(arguments[e]));return t}var l=function(t,e){return(l=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])})(t,e)};function E(t,e){function r(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var f=function(t){function e(e){return e.autoStart=!1,t.call(this,e)||this}return E(e,t),e}(r.Application),S=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e}(r.Container);!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}E(e,t)}(r.Graphics),function(t){function e(e,n,o,i,a){var _;return _="string"===e?r.Texture.fromFrame(e):r.Texture.from(e),t.call(this,_,n,o,i,a)||this}E(e,t)}(r.mesh.NineSlicePlane),function(){function t(t){this._image=null,this._image=t,t?t instanceof HTMLImageElement?this.sprite=r.Sprite.from(t):t instanceof r.Texture&&(this.sprite=new r.Sprite(t)):this.sprite=new r.Sprite}Object.defineProperty(t.prototype,"image",{get:function(){return this._image},set:function(t){this._image!==t&&(t instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=r.Texture.from(t)):t instanceof r.Texture&&(this.sprite.texture=t),this._image=t)},enumerable:!1,configurable:!0})}(),function(){function t(t){var e=t.frames;this.animatedSprite=new r.extras.AnimatedSprite(e)}t.prototype.play=function(){this.animatedSprite.play()},t.prototype.stop=function(){this.animatedSprite.stop()},t.prototype.gotoAndPlay=function(t){this.animatedSprite.gotoAndPlay(t)},t.prototype.gotoAndStop=function(t){this.animatedSprite.gotoAndStop(t)},Object.defineProperty(t.prototype,"speed",{get:function(){return this.animatedSprite.animationSpeed},set:function(t){this.animatedSprite.animationSpeed=t},enumerable:!1,configurable:!0})}(),function(t){function e(e,r){return t.call(this,e,r)||this}E(e,t)}(r.Text);var h=r.extras.TilingSprite;function R(t,e){return t===e||t!=t&&e!=e}function d(t,e){for(var r=t.length;r--;)if(R(t[r][0],e))return r;return-1}!function(){function t(t){this._image=null,this._image=t,t?t instanceof HTMLImageElement?this.tilingSprite=new h(r.Texture.from(t)):t instanceof r.Texture&&(this.tilingSprite=new h(t)):this.tilingSprite=new h(r.Texture.EMPTY)}Object.defineProperty(t.prototype,"image",{get:function(){return this._image},set:function(t){this._image!==t&&(t instanceof HTMLImageElement?this.tilingSprite.texture=r.Texture.from(t):t instanceof r.Texture&&(this.tilingSprite.texture=t),this._image=t)},enumerable:!1,configurable:!0})}();var v=Array.prototype.splice;function C(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])}}C.prototype.clear=function(){this.__data__=[],this.size=0},C.prototype.delete=function(t){var e=this.__data__,r=d(e,t);return!(r<0)&&(r==e.length-1?e.pop():v.call(e,r,1),--this.size,!0)},C.prototype.get=function(t){var e=this.__data__,r=d(e,t);return r<0?void 0:e[r][1]},C.prototype.has=function(t){return d(this.__data__,t)>-1},C.prototype.set=function(t,e){var r=this.__data__,n=d(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};var A="object"==typeof global&&global&&global.Object===Object&&global,y="object"==typeof self&&self&&self.Object===Object&&self,m=A||y||Function("return this")(),P=m.Symbol,T=Object.prototype,g=T.hasOwnProperty,O=T.toString,B=P?P.toStringTag:void 0;var G=Object.prototype.toString;var x=P?P.toStringTag:void 0;function D(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":x&&x in Object(t)?function(t){var e=g.call(t,B),r=t[B];try{t[B]=void 0;var n=!0}catch(t){}var o=O.call(t);return n&&(e?t[B]=r:delete t[B]),o}(t):function(t){return G.call(t)}(t)}function b(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function M(t){if(!b(t))return!1;var e=D(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}var H,L=m["__core-js_shared__"],w=(H=/[^.]+$/.exec(L&&L.keys&&L.keys.IE_PROTO||""))?"Symbol(src)_1."+H:"";var j=Function.prototype.toString;function I(t){if(null!=t){try{return j.call(t)}catch(t){}try{return t+""}catch(t){}}return""}var X=/^\[object .+?Constructor\]$/,K=Function.prototype,N=Object.prototype,W=K.toString,U=N.hasOwnProperty,V=RegExp("^"+W.call(U).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function k(t){return!(!b(t)||(e=t,w&&w in e))&&(M(t)?V:X).test(I(t));var e}function z(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return k(r)?r:void 0}var F=z(m,"Map"),Y=z(Object,"create");var $=Object.prototype.hasOwnProperty;var q=Object.prototype.hasOwnProperty;function J(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 Q(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 Z(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])}}J.prototype.clear=function(){this.__data__=Y?Y(null):{},this.size=0},J.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},J.prototype.get=function(t){var e=this.__data__;if(Y){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return $.call(e,t)?e[t]:void 0},J.prototype.has=function(t){var e=this.__data__;return Y?void 0!==e[t]:q.call(e,t)},J.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Y&&void 0===e?"__lodash_hash_undefined__":e,this},Z.prototype.clear=function(){this.size=0,this.__data__={hash:new J,map:new(F||C),string:new J}},Z.prototype.delete=function(t){var e=Q(this,t).delete(t);return this.size-=e?1:0,e},Z.prototype.get=function(t){return Q(this,t).get(t)},Z.prototype.has=function(t){return Q(this,t).has(t)},Z.prototype.set=function(t,e){var r=Q(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function tt(t){var e=this.__data__=new C(t);this.size=e.size}tt.prototype.clear=function(){this.__data__=new C,this.size=0},tt.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},tt.prototype.get=function(t){return this.__data__.get(t)},tt.prototype.has=function(t){return this.__data__.has(t)},tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof C){var n=r.__data__;if(!F||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Z(n)}return r.set(t,e),this.size=r.size,this};function et(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Z;++e<r;)this.add(t[e])}function rt(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}et.prototype.add=et.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},et.prototype.has=function(t){return this.__data__.has(t)};function nt(t,e,r,n,o,i){var a=1&r,_=t.length,s=e.length;if(_!=s&&!(a&&s>_))return!1;var c=i.get(t),u=i.get(e);if(c&&u)return c==e&&u==t;var p=-1,l=!0,E=2&r?new et:void 0;for(i.set(t,e),i.set(e,t);++p<_;){var f=t[p],S=e[p];if(n)var h=a?n(S,f,p,e,t,i):n(f,S,p,t,e,i);if(void 0!==h){if(h)continue;l=!1;break}if(E){if(!rt(e,(function(t,e){if(a=e,!E.has(a)&&(f===t||o(f,t,r,n,i)))return E.push(e);var a}))){l=!1;break}}else if(f!==S&&!o(f,S,r,n,i)){l=!1;break}}return i.delete(t),i.delete(e),l}var ot=m.Uint8Array;function it(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function at(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var _t=P?P.prototype:void 0,st=_t?_t.valueOf:void 0;var ct=Array.isArray;var ut=Object.prototype.propertyIsEnumerable,pt=Object.getOwnPropertySymbols,lt=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 a=t[r];e(a,r,t)&&(i[o++]=a)}return i}(pt(t),(function(e){return ut.call(t,e)})))}:function(){return[]};function Et(t){return null!=t&&"object"==typeof t}function ft(t){return Et(t)&&"[object Arguments]"==D(t)}var St=Object.prototype,ht=St.hasOwnProperty,Rt=St.propertyIsEnumerable,dt=ft(function(){return arguments}())?ft:function(t){return Et(t)&&ht.call(t,"callee")&&!Rt.call(t,"callee")};var vt="object"==typeof t&&t&&!t.nodeType&&t,Ct=vt&&"object"==typeof module&&module&&!module.nodeType&&module,At=Ct&&Ct.exports===vt?m.Buffer:void 0,yt=(At?At.isBuffer:void 0)||function(){return!1},mt=/^(?:0|[1-9]\d*)$/;function Pt(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&mt.test(t))&&t>-1&&t%1==0&&t<e}function Tt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}var gt={};gt["[object Float32Array]"]=gt["[object Float64Array]"]=gt["[object Int8Array]"]=gt["[object Int16Array]"]=gt["[object Int32Array]"]=gt["[object Uint8Array]"]=gt["[object Uint8ClampedArray]"]=gt["[object Uint16Array]"]=gt["[object Uint32Array]"]=!0,gt["[object Arguments]"]=gt["[object Array]"]=gt["[object ArrayBuffer]"]=gt["[object Boolean]"]=gt["[object DataView]"]=gt["[object Date]"]=gt["[object Error]"]=gt["[object Function]"]=gt["[object Map]"]=gt["[object Number]"]=gt["[object Object]"]=gt["[object RegExp]"]=gt["[object Set]"]=gt["[object String]"]=gt["[object WeakMap]"]=!1;var Ot,Bt="object"==typeof t&&t&&!t.nodeType&&t,Gt=Bt&&"object"==typeof module&&module&&!module.nodeType&&module,xt=Gt&&Gt.exports===Bt&&A.process,Dt=function(){try{var t=Gt&&Gt.require&&Gt.require("util").types;return t||xt&&xt.binding&&xt.binding("util")}catch(t){}}(),bt=Dt&&Dt.isTypedArray,Mt=bt?(Ot=bt,function(t){return Ot(t)}):function(t){return Et(t)&&Tt(t.length)&&!!gt[D(t)]},Ht=Object.prototype.hasOwnProperty;function Lt(t,e){var r=ct(t),n=!r&&dt(t),o=!r&&!n&&yt(t),i=!r&&!n&&!o&&Mt(t),a=r||n||o||i,_=a?function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}(t.length,String):[],s=_.length;for(var c in t)!e&&!Ht.call(t,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||i&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Pt(c,s))||_.push(c);return _}var wt=Object.prototype;var jt=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),It=Object.prototype.hasOwnProperty;function Xt(t){if(r=(e=t)&&e.constructor,e!==("function"==typeof r&&r.prototype||wt))return jt(t);var e,r,n=[];for(var o in Object(t))It.call(t,o)&&"constructor"!=o&&n.push(o);return n}function Kt(t){return null!=(e=t)&&Tt(e.length)&&!M(e)?Lt(t):Xt(t);var e}function Nt(t){return function(t,e,r){var n=e(t);return ct(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,Kt,lt)}var Wt=Object.prototype.hasOwnProperty;var Ut=z(m,"DataView"),Vt=z(m,"Promise"),kt=z(m,"Set"),zt=z(m,"WeakMap"),Ft="[object Map]",Yt="[object Promise]",$t="[object Set]",qt="[object WeakMap]",Jt="[object DataView]",Qt=I(Ut),Zt=I(F),te=I(Vt),ee=I(kt),re=I(zt),ne=D;(Ut&&ne(new Ut(new ArrayBuffer(1)))!=Jt||F&&ne(new F)!=Ft||Vt&&ne(Vt.resolve())!=Yt||kt&&ne(new kt)!=$t||zt&&ne(new zt)!=qt)&&(ne=function(t){var e=D(t),r="[object Object]"==e?t.constructor:void 0,n=r?I(r):"";if(n)switch(n){case Qt:return Jt;case Zt:return Ft;case te:return Yt;case ee:return $t;case re:return qt}return e});var oe=ne,ie="[object Arguments]",ae="[object Array]",_e="[object Object]",se=Object.prototype.hasOwnProperty;function ce(t,e,r,n,o,i){var a=ct(t),_=ct(e),s=a?ae:oe(t),c=_?ae:oe(e),u=(s=s==ie?_e:s)==_e,p=(c=c==ie?_e:c)==_e,l=s==c;if(l&&yt(t)){if(!yt(e))return!1;a=!0,u=!1}if(l&&!u)return i||(i=new tt),a||Mt(t)?nt(t,e,r,n,o,i):function(t,e,r,n,o,i,a){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 ot(t),new ot(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return R(+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 _=it;case"[object Set]":var s=1&n;if(_||(_=at),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var u=nt(_(t),_(e),n,o,i,a);return a.delete(t),u;case"[object Symbol]":if(st)return st.call(t)==st.call(e)}return!1}(t,e,s,r,n,o,i);if(!(1&r)){var E=u&&se.call(t,"__wrapped__"),f=p&&se.call(e,"__wrapped__");if(E||f){var S=E?t.value():t,h=f?e.value():e;return i||(i=new tt),o(S,h,r,n,i)}}return!!l&&(i||(i=new tt),function(t,e,r,n,o,i){var a=1&r,_=Nt(t),s=_.length;if(s!=Nt(e).length&&!a)return!1;for(var c=s;c--;){var u=_[c];if(!(a?u in e:Wt.call(e,u)))return!1}var p=i.get(t),l=i.get(e);if(p&&l)return p==e&&l==t;var E=!0;i.set(t,e),i.set(e,t);for(var f=a;++c<s;){var S=t[u=_[c]],h=e[u];if(n)var R=a?n(h,S,u,e,t,i):n(S,h,u,t,e,i);if(!(void 0===R?S===h||o(S,h,r,n,i):R)){E=!1;break}f||(f="constructor"==u)}if(E&&!f){var d=t.constructor,v=e.constructor;d==v||!("constructor"in t)||!("constructor"in e)||"function"==typeof d&&d instanceof d&&"function"==typeof v&&v instanceof v||(E=!1)}return i.delete(t),i.delete(e),E}(t,e,r,n,o,i))}function ue(t,e,r,n,o){return t===e||(null==t||null==e||!Et(t)&&!Et(e)?t!=t&&e!=e:ce(t,e,r,n,ue,o))}var pe=function(){function t(t){var e=t.game,r=t.rendererSystem;this.renderers=[],this.game=e,this.rendererSystem=r}return t.prototype.register=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=c(r),i=o.next();!i.done;i=o.next()){var a=i.value;a.game=this.game,a.rendererManager=this.rendererSystem.rendererManager,a.containerManager=this.rendererSystem.containerManager,this.renderers.push(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},t.prototype.componentChanged=function(t){var r,n,o=function(t){var r,n;try{for(var o=(r=void 0,c(i.renderers)),a=o.next();!a.done;a=o.next()){var _=a.value,s=_.observerInfo[t.componentName];if(s){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{_.componentChanged&&_.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(s.findIndex((function(e){return r=e,n=t.prop,ue(r,n);var r,n}))>-1)try{_.componentChanged&&_.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},i=this;try{for(var a=c(t),_=a.next();!_.done;_=a.next()){o(_.value)}}catch(t){r={error:t}}finally{try{_&&!_.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},t.prototype.update=function(t){var e,r,n,o;try{for(var i=c(t.components),a=i.next();!a.done;a=i.next()){var _=a.value;try{for(var s=(n=void 0,c(this.renderers)),u=s.next();!u.done;u=s.next()){var p=u.value,l=[];if(p.observerInfo[_.name]&&-1===l.indexOf(t)){l.push(t);try{p.rendererUpdate&&p.rendererUpdate(t)}catch(e){console.info("gameObject: "+t.name+", "+_.name+" is update error",e)}}}}catch(t){n={error:t}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}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}}},t}(),le=function(){function t(){this.containerMap={}}return t.prototype.addContainer=function(t){var e=t.name,r=t.container;this.containerMap[e]=r},t.prototype.getContainer=function(t){return this.containerMap[t]},t.prototype.removeContainer=function(t){var e;null===(e=this.containerMap[t])||void 0===e||e.destroy({children:!0}),delete this.containerMap[t]},t.prototype.updateTransform=function(t){var e=t.name,r=t.transform,n=this.containerMap[e];if(n){var o=r.anchor,i=r.origin,a=r.position,_=r.rotation,s=r.scale,c=r.size,u=r.skew;n.rotation=_,n.scale=s,n.pivot.x=c.width*i.x,n.pivot.y=c.height*i.y,n.skew=u;var p=a.x,l=a.y;if(r.parent){var E=r.parent;p+=E.size.width*o.x,l+=E.size.height*o.y}n.position={x:p,y:l}}},t}();var Ee=function(t){function r(e){var r=e.system,n=e.containerManager,o=t.call(this)||this;return o.name="Transform",o.waitRemoveIds=[],o.waitChangeScenes=[],o.containerManager=n,o.init(r),o}return o(r,t),r.prototype.init=function(t){var e=this;this.system=t,this.on("changeScene",(function(t){var r=t.scene,n=t.mode,o=t.application;e.waitChangeScenes.push({scene:r,mode:n,application:o})}))},r.prototype.update=function(){var t,e,r,n;try{for(var o=c(this.waitRemoveIds),i=o.next();!i.done;i=o.next()){var a=i.value;this.containerManager.removeContainer(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}this.waitRemoveIds=[];try{for(var _=c(this.waitChangeScenes),s=_.next();!s.done;s=_.next()){var u=s.value,p=this.containerManager.getContainer(u.scene.id);p&&(u.application.stage.removeChildren(),u.application.stage.addChild(p))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=_.return)&&n.call(_)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},r.prototype.componentChanged=function(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)},r.prototype.addContainer=function(t){var e=new S;e.name=t.gameObject.name,this.containerManager.addContainer({name:t.gameObject.id,container:e}),t.component.worldTransform=e.transform.worldTransform},r.prototype.change=function(t){var e=t.component;if(e.parent){this.containerManager.getContainer(e.parent.gameObject.id).addChild(this.containerManager.getContainer(t.gameObject.id));var r=t.gameObject.transform.parent&&t.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(t.gameObject.id);delete e.worldTransform,n.parent&&n.parent.removeChild(n)}},r.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},r=a([e.decorators.componentObserver({Transform:["_parent"]})],r)}(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,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var _=new o(n,i||t,a),s=r?r+e:e;return t._events[s]?t._events[s].fn?t._events[s]=[t._events[s],_]:t._events[s].push(_):(t._events[s]=_,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function _(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),_.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},_.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,a=new Array(i);o<i;o++)a[o]=n[o].fn;return a},_.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},_.prototype.emit=function(t,e,n,o,i,a){var _=r?r+t:t;if(!this._events[_])return!1;var s,c,u=this._events[_],p=arguments.length;if(u.fn){switch(u.once&&this.removeListener(t,u.fn,void 0,!0),p){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,e),!0;case 3:return u.fn.call(u.context,e,n),!0;case 4:return u.fn.call(u.context,e,n,o),!0;case 5:return u.fn.call(u.context,e,n,o,i),!0;case 6:return u.fn.call(u.context,e,n,o,i,a),!0}for(c=1,s=new Array(p-1);c<p;c++)s[c-1]=arguments[c];u.fn.apply(u.context,s)}else{var l,E=u.length;for(c=0;c<E;c++)switch(u[c].once&&this.removeListener(t,u[c].fn,void 0,!0),p){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,e);break;case 3:u[c].fn.call(u[c].context,e,n);break;case 4:u[c].fn.call(u[c].context,e,n,o);break;default:if(!s)for(l=1,s=new Array(p-1);l<p;l++)s[l-1]=arguments[l];u[c].fn.apply(u[c].context,s)}}return!0},_.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},_.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},_.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return a(this,i),this;var _=this._events[i];if(_.fn)_.fn!==e||o&&!_.once||n&&_.context!==n||a(this,i);else{for(var s=0,c=[],u=_.length;s<u;s++)(_[s].fn!==e||o&&!_[s].once||n&&_[s].context!==n)&&c.push(_[s]);c.length?this._events[i]=1===c.length?c[0]:c:a(this,i)}return this},_.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,this._eventsCount=0),this},_.prototype.off=_.prototype.removeListener,_.prototype.addListener=_.prototype.on,_.prefixed=r,_.EventEmitter=_,t.exports=_}))),fe=void 0;function Se(t){if(fe)return fe;if(!t)return console.warn("WebGL not available for compressed textures. Silently failing."),{s3tc:!1,etc:!1,etc1:!1,pvrtc:!1,atc:!1,astc:!1};fe={s3tc:!!t.getExtension("WEBGL_compressed_texture_s3tc"),etc:!!t.getExtension("WEBGL_compressed_texture_etc"),etc1:!!t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:!!t.getExtension("WEBGL_compressed_texture_pvrtc")||!!t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:!!t.getExtension("WEBGL_compressed_texture_atc"),astc:!!t.getExtension("WEBGL_compressed_texture_astc")};try{console.log("Eva.js Supported Compressed Texture Format List: "+Object.keys(fe).filter((function(t){return fe[t]})).join(", "))}catch(t){}return fe}var he,Re,de,ve=e.resourceLoader.XhrLoadStrategy;!function(t){t[t.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",t[t.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",t[t.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",t[t.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",t[t.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",t[t.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",t[t.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",t[t.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",t[t.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",t[t.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",t[t.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",t[t.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",t[t.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",t[t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",t[t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",t[t.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",t[t.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",t[t.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",t[t.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",t[t.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",t[t.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",t[t.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",t[t.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",t[t.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",t[t.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",t[t.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",t[t.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",t[t.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",t[t.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=3781]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",t[t.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"}(de||(de={}));var Ce=((he={})[de.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],he[de.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],he[de.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],he[de.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],he[de.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],he[de.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],he[de.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],he[de.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],he[de.COMPRESSED_R11_EAC]=[4,4],he[de.COMPRESSED_SIGNED_R11_EAC]=[4,4],he[de.COMPRESSED_RG11_EAC]=[4,4],he[de.COMPRESSED_SIGNED_RG11_EAC]=[4,4],he[de.COMPRESSED_RGB8_ETC2]=[4,4],he[de.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],he[de.COMPRESSED_SRGB8_ETC2]=[4,4],he[de.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],he[de.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],he[de.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],he[de.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],he[de.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],he[de.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],he[de.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],he[de.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],he[de.COMPRESSED_RGB_ATC_WEBGL]=[4,4],he[de.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],he[de.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],he[de.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],he[de.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],he[de.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],he[de.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],he[de.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],he[de.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],he[de.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],he[de.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],he[de.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],he[de.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],he[de.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],he[de.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],he[de.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],he[de.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],he),Ae=((Re={})[de.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",Re[de.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",Re[de.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",Re[de.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",Re[de.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",Re[de.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",Re[de.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",Re[de.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",Re[de.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",Re[de.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",Re[de.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",Re[de.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",Re[de.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",Re[de.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",Re[de.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",Re[de.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",Re[de.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",Re[de.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",Re[de.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",Re[de.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",Re[de.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",Re[de.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",Re[de.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",Re),ye=function(){function t(){this.levelBuffers=[]}return t.prototype.upload=function(t){var e=this.levels,r=Ae[this.internalFormat];t[r]||(t[r]=!0,"WEBGL_compressed_texture_pvrtc"===r?t.getExtension(r)||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"):t.getExtension(r));for(var n=0;n<this.levels;++n){var o=this.levelBuffers[n],i=o.levelWidth,a=o.levelHeight,_=o.levelBuffer;t.compressedTexImage2D(t.TEXTURE_2D,n,this.internalFormat,i,a,0,_)}e>1?(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST)):(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR))},t}(),me=12,Pe=28,Te=36,ge=40,Oe=44,Be=48,Ge=52,xe=56,De=60,be=[171,75,84,88,32,49,49,187,13,10,26,10],Me=function(t){function r(r,n){var o,i=t.call(this)||this;i.complete=!0,i.src=n.url;var a=new DataView(r);if(!function(t){for(var e=0;e<be.length;e++)if(t.getUint8(e)!==be[e])return!1;return!0}(a))throw new Error("Not a valid KTX Texture");var _=67305985===a.getUint32(me,!0);i.internalFormat=a.getUint32(Pe,_);var s=i.formerWidth=a.getUint32(Te,_),c=i.formerHeight=a.getUint32(ge,_)||1,u=Ce[i.internalFormat];i.width=s%u[0]==0?s:s+u[0]-s%u[0],i.height=c%u[1]==0?c:c+u[1]-c%u[1];var p=e.resource.resourcesMap[n.metadata.name].src[n.metadata.key],l=null!==(o=null==p?void 0:p.size)&&void 0!==o?o:{},E=l.width,f=l.height;E&&f&&(i.naturalWidth=E,i.naturalHeight=f);var S=a.getUint32(Oe,_)||1,h=a.getUint32(Be,_)||1,R=a.getUint32(Ge,_),d=i.levels=a.getUint32(xe,_),v=a.getUint32(De,_);if(0===c||1!==S)throw new Error("Only 2D textures are supported!");if(1!==R)throw new Error("CubeTextures are not supported!");if(1!==h)throw new Error("It does not support array textures!");for(var C=s,A=c,y=64+v,m=0;m<d;m++){var P=a.getUint32(y,_);y+=4;var T=Ce[i.internalFormat],g={levelID:m,levelWidth:C%T[0]==0?C:C+T[0]-C%T[0],levelHeight:A%T[1]==0?A:A+T[1]-A%T[1],levelBuffer:new Uint8Array(r,y,P)};i.levelBuffers.push(g),y+=P,y+=3-(y+3)%4,C=C>>1||1,A=A>>1||1}return i}return o(r,t),r}(ye);var He=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype._complete=function(e,r){t.prototype._complete.call(this,e,new Me(r,this.config))},e}(ve),Le=e.resourceLoader.XhrResponseType;var we,je,Ie,Xe={isCompressed:!1,uploadNotCompressed:r.glCore.GLTexture.prototype.upload,upload:function(t){if(!(t instanceof ye))return this.uploadNotCompressed(t);this.bind();var e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST_MIPMAP_NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),this.isCompressed=!0,t.upload(e)},enableMipmap:function(){if(!this.isCompressed){var t=this.gl;this.bind(),this.mipmap=!0,t.generateMipmap(t.TEXTURE_2D)}}},Ke=Symbol(),Ne=((we={})[Ke]=r.Texture.from,we.from=function(t){return t instanceof ye?new r.Texture(r.BaseTexture.from(t)):this[Ke](t)},we),We=Symbol(),Ue=((je={})[We]=r.BaseTexture.from,je.from=function(t,e,n){if(!(t instanceof ye))return this[We](t,e,n);var o=t.src,i=r.utils.BaseTextureCache[o];return i||((i=new r.BaseTexture(t,e)).imageUrl=o,n&&(i.sourceScale=n),r.BaseTexture.addToCache(i,o)),i},je);function Ve(t){!function(t,e){t.addPreProcessResourceHandler((function(t){var r,n,o,i=null===(n=null===(r=t.src)||void 0===r?void 0:r.image)||void 0===n?void 0:n.texture;if(i){Array.isArray(i)||(i=[i]);var a=null!==(o=Se(e))&&void 0!==o?o:{},_=i.find((function(t){return a[t.type]}));_&&_extends(t.src.image,_)}}))}(e.resource,t),_extends(e.RESOURCE_TYPE_STRATEGY,{astc:He,etc:He,pvrtc:He,s3tc:He,atc:He}),He.setExtensionXhrType("ktx",Le.Buffer),_extends(r.glCore.GLTexture.prototype,Xe),_extends(r.Texture,Ne),_extends(r.BaseTexture,Ue)}!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(Ie||(Ie={}));var ke=function(t){t.plugins.interaction.autoPreventDefault=!0,t.view.style.touchAction="none"},ze=function(t){t.plugins.interaction.autoPreventDefault=!1,t.view.style.touchAction="auto"},Fe=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.multiApps=[],e}return o(n,t),n.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new le,this.rendererManager=new pe({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new Ee({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var n,o=t.scene,i=t.mode,a=t.params;switch(i){case e.LOAD_SCENE_MODE.SINGLE:n=r.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:n=r.createMultiApplication({params:a})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:i,application:n})}));var n=this.application.renderer.gl;n&&(this.suportedCompressedTextureFormats=Se(n),Ve(n))},n.prototype.registerObserver=function(t){var e,r=this.constructor.observerInfo;for(var n in t)r[n]||(r[n]=[]),(e=r[n]).push.apply(e,p(t[n]))},n.prototype.createMultiApplication=function(t){var e=t.params,r=this.createApplication(e);return this.multiApps.push(r),r},n.prototype.createApplication=function(t){t.view=t.canvas,t.renderType===Ie.CANVAS&&(t.forceCanvas=!0),r.ticker.shared.autoStart=!1,r.ticker.shared.stop();var e=new f(i({sharedTicker:!0},t));return void 0!==t.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),t.preventScroll?ze(e.renderer):ke(e.renderer)),void 0!==t.enableScroll&&(t.enableScroll?ze(e.renderer):ke(e.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&ze(e.renderer),e},n.prototype.update=function(){var t,e,r,n,o=this.componentObserver.clear();try{for(var i=c(o),a=i.next();!a.done;a=i.next()){var _=a.value;this.transform.componentChanged(_)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}try{for(var s=c(this.game.gameObjects),u=s.next();!u.done;u=s.next()){var p=u.value;this.containerManager.updateTransform({name:p.id,transform:p.transform}),this.rendererManager.update(p)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},n.prototype.lateUpdate=function(t){this.transform.update(),this.application.ticker.update(t.time)},n.prototype.onDestroy=function(){var t,e;this.application.destroy();try{for(var r=c(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null},n.prototype.resize=function(t,e){this.params.width=t,this.params.height=e,this.application.renderer.resize(t,e)},n.systemName="Renderer",n=a([e.decorators.componentObserver({Transform:["_parent"]})],n)}(e.System);function Ye(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}function $e(t){return function(e,r){var n=Ye(e,r);n.key=r,n.type=t}}function qe(t){return function(e,r){Ye(e,r).step=t}}r.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete r.utils.TextureCache[this.imageUrl],this.imageUrl=null),this.source=null,this.dispose(),r.BaseTexture.removeFromCache(this),this.textureCacheIds=null,this._destroyed=!0};var Je,Qe,Ze,tr,er=function(t,e){var r=e.width,n=e.height,o=e.position,i=e.left,a=void 0===i?0:i,_=e.top,s=void 0===_?0:_,c=e.zIndex,u=e.pointerEvents,p=e.background;t.style.width=r+"px",t.style.height=n+"px",t.style.position=o,t.style.left=""+a,t.style.top=""+s,t.style.zIndex=""+c,t.style.pointerEvents=u,t.style.background=p,t.style.border="none",t.style.overflow="hidden"},rr=function(t){function e(e){var r=t.call(this)||this;_extends(r,e);var n=e.hint,o=void 0===n?"":n,i=e.event,a=e.delay,_=void 0===a?0:a,s=e.attr,c=void 0===s?{}:s,u=e.role,p=void 0===u?"":u,l=e.props,E=void 0===l?{}:l,f=e.state,S=void 0===f?{}:f;return r.hint=o,r.event=i,r.delay=_,r.attr=c,r.role=p,r.props=E,r.state=S,r.a11yId="_"+function(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[],n=e.length,o=0;o<t;o++)r[o]=e[0|Math.random()*n];return r.join("")}(6),r}return o(e,t),e.componentName="A11y",a([$e("boolean")],e.prototype,"interactive",void 0),a([$e("string")],e.prototype,"hint",void 0),a([$e("number"),qe(1)],e.prototype,"delay",void 0),a([$e("string")],e.prototype,"role",void 0),a([$e("string")],e.prototype,"a11yId",void 0),e}(e.Component),nr="absolute";t.A11yActivate=void 0,(Je=t.A11yActivate||(t.A11yActivate={}))[Je.ENABLE=0]="ENABLE",Je[Je.DISABLE=1]="DISABLE",Je[Je.CHECK=2]="CHECK",function(t){t.NONE="none",t.AUTO="auto"}(Qe||(Qe={})),function(t){t.DEBUG="rgba(255,0,0,0.5)",t.NONE="transparent"}(Ze||(Ze={})),function(t){t.BUTTON="button",t.DIV="div"}(tr||(tr={}));var or=["hint","event","delay","attr","role","props","state","a11yId","name"],ir=function(t,e,r){var n=this;["touchstart","touchend","tap"].forEach((function(o){t.emit(o,{stopPropagation:function(){return r.stopPropagation()},data:{position:n.eventPosition},gameObject:e})}))},ar=function(r){function n(t){var e=r.call(this,t)||this;return e.cache=new Map,e.eventCache=new Map,e}return o(n,r),Object.defineProperty(n.prototype,"ratioX",{get:function(){return this._ratioX||this.setRatio()?this._ratioX:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"ratioY",{get:function(){return this._ratioY||this.setRatio()?this._ratioY:0},enumerable:!1,configurable:!0}),n.prototype.init=function(e){return void 0===e&&(e={}),_(this,void 0,void 0,(function(){var r,n,o,i,a,_,c,u;return s(this,(function(s){switch(s.label){case 0:switch(r=e.activate,n=void 0===r?t.A11yActivate.CHECK:r,o=e.delay,i=void 0===o?100:o,a=e.checkA11yOpen,_=void 0===a?function(){return Promise.resolve(!1)}:a,this.delay=i,n){case t.A11yActivate.CHECK:return[3,1];case t.A11yActivate.DISABLE:return[3,5];case t.A11yActivate.ENABLE:return[3,6]}return[3,7];case 1:return s.trys.push([1,3,,4]),c=this,[4,_()];case 2:return c.activate=s.sent(),[3,4];case 3:return s.sent(),this.activate=!1,[3,4];case 4:return[3,7];case 5:return this.activate=!1,[3,7];case 6:return this.activate=!0,[3,7];case 7:return this.debug=e.debug||!1,this.debug&&(this.activate=!0),this.activate?(u=document.createElement("div"),this.div=u,this.game.canvas.parentNode&&this.game.canvas.parentNode.appendChild(this.div),[2]):[2]}}))}))},n.prototype.setRatio=function(){var t=this.getCanvasBoundingClientRect(),e=t.width,r=t.height,n=this.getRenderRect(),o=n.renderWidth,i=n.renderHeight;return this._ratioX=e/o,this._ratioY=r/i,!(!e&&!r)&&(this.initDiv(),!0)},n.prototype.getRenderRect=function(){var t=this.game.getSystem(Fe).params,e=void 0===t?{width:300,height:300}:t,r=e.height;return{renderWidth:e.width,renderHeight:r}},n.prototype.getCanvasBoundingClientRect=function(){var t=this.game.canvas.getBoundingClientRect();return{width:t.width,height:t.height,left:t.left,top:t.top}},n.prototype.initDiv=function(){var t=this,e=window.pageXOffset,r=window.pageYOffset,n=this.getCanvasBoundingClientRect(),o={width:n.width,height:n.height,left:n.left+e+"px",top:n.top+r+"px",position:nr,zIndex:3,pointerEvents:Qe.NONE,background:Ze.NONE};er(this.div,o),this.div.addEventListener("click",(function(e){var r=e.currentTarget.getBoundingClientRect(),n=r.left,o=r.top,i=(e.pageX-n)/t.ratioX,a=(e.pageY-o)/t.ratioY;t.eventPosition={x:i,y:a}}),!0)},n.prototype.update=function(){return _(this,void 0,void 0,(function(){var t,r,n,o,i,a;return s(this,(function(_){if(t=this.componentObserver.clear(),!this.activate)return[2];try{for(r=c(t),n=r.next();!n.done;n=r.next())switch((o=n.value).type){case e.OBSERVER_TYPE.ADD:"Event"===o.componentName&&this.addEvent(o.gameObject),"A11y"===o.componentName&&this.add(o);break;case e.OBSERVER_TYPE.CHANGE:"Transform"===o.componentName&&this.transformChange(o),"A11y"===o.componentName&&this.change(o);break;case e.OBSERVER_TYPE.REMOVE:"Event"===o.componentName&&this.removeEvent(o),"A11y"===o.componentName&&this.remove(o)}}catch(t){i={error:t}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(i)throw i.error}}return[2]}))}))},n.prototype.change=function(t){var e=t.component;if("hint"===t.prop.prop[0]){var r=this.cache.get(e.a11yId);null==r||r.setAttribute("aria-label",e.hint),r&&this.setPosition(r,t.gameObject.transform)}},n.prototype.remove=function(t){var e=t.component;if(e){var r=e.a11yId,n=this.div.querySelector("#"+r);n&&this.div.removeChild(n),this.cache.delete(r)}},n.prototype.add=function(t){var e=this;if(this.activate){var r=t.component,n=t.gameObject,o=r.delay,i=r.a11yId,a=r.event;if(n){var _=n.transform;if(_){var s=document.createElement("div");this.cache.set(i,s),a||(a=n.getComponent("Event")),setTimeout((function(){e.setPosition(s,_),e.setA11yAttr(s,r),a&&e.addEvent(n),n.scene&&e.div.appendChild(s)}),o||this.delay)}}}},n.prototype.transformChange=function(t){var e=t.component,r=t.gameObject.getComponent(rr);if(r){var n=r.a11yId;if(e.inScene){if(this.cache.has(n)){var o=this.cache.get(n);o&&this.div.appendChild(o)}}else{var i=this.div.querySelector("#"+n);i&&this.div.removeChild(i)}}},n.prototype.setEvent=function(t,e,r,n){if(e){var o=ir.bind(this,e,r);this.eventCache.set(n,o),t.addEventListener("click",o)}},n.prototype.addEvent=function(t){var e=t.getComponent(rr);if(e){var r=t.getComponent("Event");if(r){var n=this.cache.get(e.a11yId);n&&this.setEvent(n,r,t,e.a11yId)}}},n.prototype.removeEvent=function(t){var e=t.gameObject.getComponent(rr);if(e&&t.component){var r=e.a11yId,n=this.eventCache.get(r),o=this.cache.get(r);o&&o.removeEventListener("click",n)}},n.prototype.setA11yAttr=function(t,e){var r,n,o,i,a,_,s=e.hint,u=e.props,p=void 0===u?{}:u,l=e.state,E=void 0===l?{}:l,f=e.role,S=e.a11yId,h=f||"text";t.setAttribute("role",h),t.setAttribute("aria-label",s),t.id=S;var R=Object.keys(p);try{for(var d=c(R),v=d.next();!v.done;v=d.next()){var C=v.value;t.setAttribute(C,p[C])}}catch(t){r={error:t}}finally{try{v&&!v.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}var A=Object.keys(E);try{for(var y=c(A),m=y.next();!m.done;m=y.next()){C=m.value;t.setAttribute(C,E[C])}}catch(t){o={error:t}}finally{try{m&&!m.done&&(i=y.return)&&i.call(y)}finally{if(o)throw o.error}}try{for(var P=c(Object.keys(e)),T=P.next();!T.done;T=P.next()){"string"==typeof e[C=T.value]&&-1===or.indexOf(C)&&1!==C.indexOf("_")&&t.setAttribute(C,e[C])}}catch(t){a={error:t}}finally{try{T&&!T.done&&(_=P.return)&&_.call(P)}finally{if(a)throw a.error}}},n.prototype.setPosition=function(t,e){var r=e.size,n=r.width,o=r.height,a={width:0===n?1:n*this.ratioX,height:0===o?1:o*this.ratioY,position:nr,zIndex:3,pointerEvents:Qe.AUTO,background:this.debug?Ze.DEBUG:Ze.NONE},_=i({},e);er(t,a),function(t,e,r,n){var o=e.worldTransform,i="matrix("+o.a+", "+o.b+", "+o.c+", "+o.d+", "+o.tx*r+", "+o.ty*n+")";t.style.transform=""+i,t.style.webkitTransform=""+i,t.style.transformOrigin="left top",t.style.webkitTransformOrigin="left top"}(t,_,this.ratioX,this.ratioY)},n.prototype.onDestroy=function(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null},n.systemName="A11ySystem",n=a([e.decorators.componentObserver({A11y:["hint"],Transform:["inScene"],Event:[]})],n)}(e.System);return t.A11y=rr,t.A11ySystem=ar,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,PIXI);
1
+ function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}this.EVA=this.EVA||{},this.EVA.plugin=this.EVA.plugin||{},this.EVA.plugin.a11y=function(t,e,n){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function i(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var o=function(){return(o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function a(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}function s(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))}function c(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function u(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}function p(t){return function(e,n){var r=h(e,n);r.key=n,r.type=t}}function l(t){return function(e,n){h(e,n).step=t}}var v,d,f,y,g=function(t,e){var n=e.width,r=e.height,i=e.position,o=e.left,a=void 0===o?0:o,s=e.top,c=void 0===s?0:s,u=e.zIndex,h=e.pointerEvents,p=e.background;t.style.width=n+"px",t.style.height=r+"px",t.style.position=i,t.style.left=""+a,t.style.top=""+c,t.style.zIndex=""+u,t.style.pointerEvents=h,t.style.background=p,t.style.border="none",t.style.overflow="hidden"},m=function(t){function e(e){var n=t.call(this)||this;_extends(n,e);var r=e.hint,i=void 0===r?"":r,o=e.event,a=e.delay,s=void 0===a?0:a,c=e.attr,u=void 0===c?{}:c,h=e.role,p=void 0===h?"":h,l=e.props,v=void 0===l?{}:l,d=e.state,f=void 0===d?{}:d;return n.hint=i,n.event=o,n.delay=s,n.attr=u,n.role=p,n.props=v,n.state=f,n.a11yId="_"+function(t){for(var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),n=[],r=e.length,i=0;i<t;i++)n[i]=e[0|Math.random()*r];return n.join("")}(6),n}return i(e,t),e.componentName="A11y",a([p("boolean")],e.prototype,"interactive",void 0),a([p("string")],e.prototype,"hint",void 0),a([p("number"),l(1)],e.prototype,"delay",void 0),a([p("string")],e.prototype,"role",void 0),a([p("string")],e.prototype,"a11yId",void 0),e}(e.Component),b="absolute";t.A11yActivate=void 0,(v=t.A11yActivate||(t.A11yActivate={}))[v.ENABLE=0]="ENABLE",v[v.DISABLE=1]="DISABLE",v[v.CHECK=2]="CHECK",function(t){t.NONE="none",t.AUTO="auto"}(d||(d={})),function(t){t.DEBUG="rgba(255,0,0,0.5)",t.NONE="transparent"}(f||(f={})),function(t){t.BUTTON="button",t.DIV="div"}(y||(y={}));var E=["hint","event","delay","attr","role","props","state","a11yId","name"],A=function(t,e,n){var r=this;["touchstart","touchend","tap"].forEach((function(i){t.emit(i,{stopPropagation:function(){return n.stopPropagation()},data:{position:r.eventPosition},gameObject:e})}))},O=function(r){function h(t){var e=r.call(this,t)||this;return e.cache=new Map,e.eventCache=new Map,e.zIndex=3,e}return i(h,r),Object.defineProperty(h.prototype,"ratioX",{get:function(){return this._ratioX||this.setRatio()?this._ratioX:0},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"ratioY",{get:function(){return this._ratioY||this.setRatio()?this._ratioY:0},enumerable:!1,configurable:!0}),h.prototype.init=function(e){return void 0===e&&(e={}),s(this,void 0,void 0,(function(){var n,r,i,o,a,s,u,h,p;return c(this,(function(c){switch(c.label){case 0:switch(n=e.activate,r=void 0===n?t.A11yActivate.CHECK:n,i=e.delay,o=void 0===i?100:i,a=e.checkA11yOpen,s=void 0===a?function(){return Promise.resolve(!1)}:a,u=e.zIndex,this.delay=o,this.zIndex=u||this.zIndex,r){case t.A11yActivate.CHECK:return[3,1];case t.A11yActivate.DISABLE:return[3,5];case t.A11yActivate.ENABLE:return[3,6]}return[3,7];case 1:return c.trys.push([1,3,,4]),h=this,[4,s()];case 2:return h.activate=c.sent(),[3,4];case 3:return c.sent(),this.activate=!1,[3,4];case 4:return[3,7];case 5:return this.activate=!1,[3,7];case 6:return this.activate=!0,[3,7];case 7:return this.debug=e.debug||!1,this.debug&&(this.activate=!0),this.activate?(p=document.createElement("div"),this.div=p,this.game.canvas.parentNode&&this.game.canvas.parentNode.insertBefore(this.div,this.game.canvas),[2]):[2]}}))}))},h.prototype.setRatio=function(){var t=this.getCanvasBoundingClientRect(),e=t.width,n=t.height,r=this.getRenderRect(),i=r.renderWidth,o=r.renderHeight;return this._ratioX=e/i,this._ratioY=n/o,!(!e&&!n)&&(this.initDiv(),!0)},h.prototype.getRenderRect=function(){var t=this.game.getSystem(n.RendererSystem).params,e=void 0===t?{width:300,height:300}:t,r=e.height;return{renderWidth:e.width,renderHeight:r}},h.prototype.getCanvasBoundingClientRect=function(){var t=this.game.canvas.getBoundingClientRect();return{width:t.width,height:t.height,left:t.left,top:t.top}},h.prototype.initDiv=function(){var t=this,e=window.pageXOffset,n=window.pageYOffset,r=this.getCanvasBoundingClientRect(),i={width:r.width,height:r.height,left:r.left+e+"px",top:r.top+n+"px",position:b,zIndex:this.zIndex,pointerEvents:d.NONE,background:f.NONE};g(this.div,i),this.div.addEventListener("click",(function(e){var n=e.currentTarget.getBoundingClientRect(),r=n.left,i=n.top,o=(e.pageX-r)/t.ratioX,a=(e.pageY-i)/t.ratioY;t.eventPosition={x:o,y:a}}),!0)},h.prototype.update=function(){return s(this,void 0,void 0,(function(){var t,n,r,i,o,a;return c(this,(function(s){if(t=this.componentObserver.clear(),!this.activate)return[2];try{for(n=u(t),r=n.next();!r.done;r=n.next())switch((i=r.value).type){case e.OBSERVER_TYPE.ADD:"Event"===i.componentName&&this.addEvent(i.gameObject),"A11y"===i.componentName&&this.add(i);break;case e.OBSERVER_TYPE.CHANGE:"Transform"===i.componentName&&this.transformChange(i),"A11y"===i.componentName&&this.change(i);break;case e.OBSERVER_TYPE.REMOVE:"Event"===i.componentName&&this.removeEvent(i),"A11y"===i.componentName&&this.remove(i)}}catch(t){o={error:t}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(o)throw o.error}}return[2]}))}))},h.prototype.change=function(t){var e=t.component;if("hint"===t.prop.prop[0]){var n=this.cache.get(e.a11yId);null==n||n.setAttribute("aria-label",e.hint),n&&this.setPosition(n,t.gameObject.transform)}},h.prototype.remove=function(t){var e=t.component;if(e){var n=e.a11yId,r=this.div.querySelector("#"+n);r&&this.div.removeChild(r),this.cache.delete(n)}},h.prototype.add=function(t){var e=this;if(this.activate){var n=t.component,r=t.gameObject,i=n.delay,o=n.a11yId,a=n.event;if(r){var s=r.transform;if(s){var c=document.createElement("div");this.cache.set(o,c),a||(a=r.getComponent("Event")),setTimeout((function(){e.setPosition(c,s),e.setA11yAttr(c,n),a&&e.addEvent(r),r.scene&&e.div.appendChild(c)}),i||this.delay)}}}},h.prototype.transformChange=function(t){var e=t.component,n=t.gameObject.getComponent(m);if(n){var r=n.a11yId;if(e.inScene){if(this.cache.has(r)){var i=this.cache.get(r);i&&this.div.appendChild(i)}}else{var o=this.div.querySelector("#"+r);o&&this.div.removeChild(o)}}},h.prototype.setEvent=function(t,e,n,r){if(e){var i=A.bind(this,e,n);this.eventCache.set(r,i),t.addEventListener("click",i)}},h.prototype.addEvent=function(t){var e=t.getComponent(m);if(e){var n=t.getComponent("Event");if(n){var r=this.cache.get(e.a11yId);r&&this.setEvent(r,n,t,e.a11yId)}}},h.prototype.removeEvent=function(t){var e=t.gameObject.getComponent(m);if(e&&t.component){var n=e.a11yId,r=this.eventCache.get(n),i=this.cache.get(n);i&&i.removeEventListener("click",r)}},h.prototype.setA11yAttr=function(t,e){var n,r,i,o,a,s,c=e.hint,h=e.props,p=void 0===h?{}:h,l=e.state,v=void 0===l?{}:l,d=e.role,f=e.a11yId,y=d||"text";t.setAttribute("role",y),t.setAttribute("aria-label",c),t.id=f;var g=Object.keys(p);try{for(var m=u(g),b=m.next();!b.done;b=m.next()){var A=b.value;t.setAttribute(A,p[A])}}catch(t){n={error:t}}finally{try{b&&!b.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}var O=Object.keys(v);try{for(var w=u(O),x=w.next();!x.done;x=w.next()){A=x.value;t.setAttribute(A,v[A])}}catch(t){i={error:t}}finally{try{x&&!x.done&&(o=w.return)&&o.call(w)}finally{if(i)throw i.error}}try{for(var C=u(Object.keys(e)),I=C.next();!I.done;I=C.next()){"string"==typeof e[A=I.value]&&-1===E.indexOf(A)&&1!==A.indexOf("_")&&t.setAttribute(A,e[A])}}catch(t){a={error:t}}finally{try{I&&!I.done&&(s=C.return)&&s.call(C)}finally{if(a)throw a.error}}},h.prototype.setPosition=function(t,e){var n=e.size,r=n.width,i=n.height,a={width:0===r?1:r*this.ratioX,height:0===i?1:i*this.ratioY,position:b,zIndex:this.zIndex,pointerEvents:d.AUTO,background:this.debug?f.DEBUG:f.NONE},s=o({},e);g(t,a),function(t,e,n,r){var i=e.worldTransform,o="matrix("+i.a+", "+i.b+", "+i.c+", "+i.d+", "+i.tx*n+", "+i.ty*r+")";t.style.transform=""+o,t.style.webkitTransform=""+o,t.style.transformOrigin="left top",t.style.webkitTransformOrigin="left top"}(t,s,this.ratioX,this.ratioY)},h.prototype.onDestroy=function(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null,this.div=null},h.systemName="A11ySystem",h=a([e.decorators.componentObserver({A11y:["hint"],Transform:["inScene"],Event:[]})],h)}(e.System);return t.A11y=m,t.A11ySystem=O,Object.defineProperty(t,"__esModule",{value:!0}),t}({},EVA,EVA.plugin.renderer);