@eva/plugin-a11y 1.2.0-alpha.6 → 1.2.1

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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("pixi.js"),r=require("@eva/inspector-decorator"),n=require("lodash-es/isEqual"),o=require("eventemitter3");function i(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var _=i(n),a=i(o),s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function E(e,t){function r(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function S(e,t,r,n){var o,i=arguments.length,_=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)_=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(_=(i<3?o(_):i>3?o(t,r,_):o(t,r))||_);return i>3&&_&&Object.defineProperty(t,r,_),_}function R(e,t,r,n){return new(r||(r=Promise))((function(o,i){function _(e){try{s(n.next(e))}catch(e){i(e)}}function a(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){e.done?o(e.value):new r((function(t){t(e.value)})).then(_,a)}s((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,o,i,_={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(;_;)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 _.label++,{value:i[1],done:!1};case 5:_.label++,n=i[1],i=[0];continue;case 7:i=_.ops.pop(),_.trys.pop();continue;default:if(!(o=_.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){_=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){_.label=i[1];break}if(6===i[0]&&_.label<o[1]){_.label=o[1],o=i;break}if(o&&_.label<o[2]){_.label=o[2],_.ops.push(i);break}o[2]&&_.ops.pop(),_.trys.pop();continue}i=t.call(e,_)}catch(e){i=[6,e],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 l(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function C(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),_=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)_.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return _}function u(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(C(arguments[t]));return e}var h=function(e){function t(t){return t.autoStart=!1,e.call(this,t)||this}return E(t,e),t}(t.Application),A=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),t}(t.Container),d=function(){function t(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return t.prototype.register=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=l(r),i=o.next();!i.done;i=o.next()){var _=i.value;_.game=this.game,_.rendererManager=this.rendererSystem.rendererManager,_.containerManager=this.rendererSystem.containerManager,this.renderers.push(_)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}},t.prototype.componentChanged=function(t){var r,n,o=function(t){var r,n;try{for(var o=(r=void 0,l(i.renderers)),a=o.next();!a.done;a=o.next()){var s=a.value,E=s.observerInfo[t.componentName];if(E){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{s.componentChanged&&s.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(E.findIndex((function(e){return _(e,t.prop)}))>-1)try{s.componentChanged&&s.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},i=this;try{for(var a=l(t),s=a.next();!s.done;s=a.next()){o(s.value)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},t.prototype.update=function(e){var t,r,n,o;try{for(var i=l(e.components),_=i.next();!_.done;_=i.next()){var a=_.value;try{for(var s=(n=void 0,l(this.renderers)),E=s.next();!E.done;E=s.next()){var c=E.value,S=[];if(c.observerInfo[a.name]&&-1===S.indexOf(e)){S.push(e);try{c.rendererUpdate&&c.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+a.name+" is update error",t)}}}}catch(e){n={error:e}}finally{try{E&&!E.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},t}(),f=function(){function e(){this.containerMap={}}return e.prototype.addContainer=function(e){var t=e.name,r=e.container;this.containerMap[t]=r},e.prototype.getContainer=function(e){return this.containerMap[e]},e.prototype.removeContainer=function(e){var t;null===(t=this.containerMap[e])||void 0===t||t.destroy({children:!0}),delete this.containerMap[e]},e.prototype.updateTransform=function(e){var t=e.name,r=e.transform,n=this.containerMap[t];if(n){var o=r.anchor,i=r.origin,_=r.position,a=r.rotation,s=r.scale,E=r.size,c=r.skew;n.rotation=a,n.scale=s,n.pivot.x=E.width*i.x,n.pivot.y=E.height*i.y,n.skew=c;var S=_.x,R=_.y;if(r.parent){var p=r.parent;S+=p.size.width*o.x,R+=p.size.height*o.y}n.position={x:S,y:R}}},e}(),P=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 E(r,t),r.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,n=e.mode,o=e.application;t.waitChangeScenes.push({scene:r,mode:n,application:o})}))},r.prototype.update=function(){var e,t,r,n;try{for(var o=l(this.waitRemoveIds),i=o.next();!i.done;i=o.next()){var _=i.value;this.containerManager.removeContainer(_)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var a=l(this.waitChangeScenes),s=a.next();!s.done;s=a.next()){var E=s.value,c=this.containerManager.getContainer(E.scene.id);c&&(E.application.stage.removeChildren(),E.application.stage.addChild(c))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}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(e){var t=new A;t.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:t}),e.component.worldTransform=t.transform.worldTransform},r.prototype.change=function(e){var t=e.component;if(t.parent){this.containerManager.getContainer(t.parent.gameObject.id).addChild(this.containerManager.getContainer(e.gameObject.id));var r=e.gameObject.transform.parent&&e.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(e.gameObject.id);delete t.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=S([e.decorators.componentObserver({Transform:["_parent"]})],r)}(a),T=void 0;function v(e){if(T)return T;if(!e)return console.warn("WebGL not available for compressed textures. Silently failing."),{s3tc:!1,etc:!1,etc1:!1,pvrtc:!1,atc:!1,astc:!1};T={s3tc:!!e.getExtension("WEBGL_compressed_texture_s3tc"),etc:!!e.getExtension("WEBGL_compressed_texture_etc"),etc1:!!e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:!!e.getExtension("WEBGL_compressed_texture_pvrtc")||!!e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:!!e.getExtension("WEBGL_compressed_texture_atc"),astc:!!e.getExtension("WEBGL_compressed_texture_astc")};try{console.log("Eva.js Supported Compressed Texture Format List: "+Object.keys(T).filter((function(e){return T[e]})).join(", "))}catch(e){}return T}var m,B,O,G=e.resourceLoader.XhrLoadStrategy;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=3781]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"}(O||(O={}));var y=((m={})[O.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],m[O.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],m[O.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],m[O.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],m[O.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],m[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],m[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],m[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],m[O.COMPRESSED_R11_EAC]=[4,4],m[O.COMPRESSED_SIGNED_R11_EAC]=[4,4],m[O.COMPRESSED_RG11_EAC]=[4,4],m[O.COMPRESSED_SIGNED_RG11_EAC]=[4,4],m[O.COMPRESSED_RGB8_ETC2]=[4,4],m[O.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],m[O.COMPRESSED_SRGB8_ETC2]=[4,4],m[O.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],m[O.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],m[O.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],m[O.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],m[O.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],m[O.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],m[O.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],m[O.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],m[O.COMPRESSED_RGB_ATC_WEBGL]=[4,4],m[O.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],m[O.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],m[O.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],m[O.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],m[O.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],m[O.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],m[O.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],m[O.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],m[O.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],m[O.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],m[O.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],m[O.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],m[O.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],m[O.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],m[O.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],m[O.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],m),D=((B={})[O.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",B[O.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",B[O.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",B[O.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",B[O.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[O.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",B[O.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[O.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[O.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[O.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[O.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",B[O.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",B[O.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",B[O.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",B[O.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",B[O.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",B[O.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",B[O.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",B[O.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",B[O.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",B),M=function(){function e(){this.levelBuffers=[]}return e.prototype.upload=function(e){var t=this.levels,r=D[this.internalFormat];e[r]||(e[r]=!0,"WEBGL_compressed_texture_pvrtc"===r?e.getExtension(r)||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"):e.getExtension(r));for(var n=0;n<this.levels;++n){var o=this.levelBuffers[n],i=o.levelWidth,_=o.levelHeight,a=o.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,n,this.internalFormat,i,_,0,a)}t>1?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR))},e}(),x=12,g=28,H=36,L=40,b=44,w=48,I=52,X=56,K=60,N=[171,75,84,88,32,49,49,187,13,10,26,10],W=function(t){function r(r,n){var o,i=t.call(this)||this;i.complete=!0,i.src=n.url;var _=new DataView(r);if(!function(e){for(var t=0;t<N.length;t++)if(e.getUint8(t)!==N[t])return!1;return!0}(_))throw new Error("Not a valid KTX Texture");var a=67305985===_.getUint32(x,!0);i.internalFormat=_.getUint32(g,a);var s=i.formerWidth=_.getUint32(H,a),E=i.formerHeight=_.getUint32(L,a)||1,c=y[i.internalFormat];i.width=s%c[0]==0?s:s+c[0]-s%c[0],i.height=E%c[1]==0?E:E+c[1]-E%c[1];var S=e.resource.resourcesMap[n.metadata.name].src[n.metadata.key],R=null!==(o=null==S?void 0:S.size)&&void 0!==o?o:{},p=R.width,l=R.height;p&&l&&(i.naturalWidth=p,i.naturalHeight=l);var C=_.getUint32(b,a)||1,u=_.getUint32(w,a)||1,h=_.getUint32(I,a),A=i.levels=_.getUint32(X,a),d=_.getUint32(K,a);if(0===E||1!==C)throw new Error("Only 2D textures are supported!");if(1!==h)throw new Error("CubeTextures are not supported!");if(1!==u)throw new Error("It does not support array textures!");for(var f=s,P=E,T=64+d,v=0;v<A;v++){var m=_.getUint32(T,a);T+=4;var B=y[i.internalFormat],O={levelID:v,levelWidth:f%B[0]==0?f:f+B[0]-f%B[0],levelHeight:P%B[1]==0?P:P+B[1]-P%B[1],levelBuffer:new Uint8Array(r,T,m)};i.levelBuffers.push(O),T+=m,T+=3-(T+3)%4,f=f>>1||1,P=P>>1||1}return i}return E(r,t),r}(M);var U=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return E(t,e),t.prototype._complete=function(t,r){e.prototype._complete.call(this,t,new W(r,this.config))},t}(G),j=e.resourceLoader.XhrResponseType;var V,k,Y,z={isCompressed:!1,uploadNotCompressed:t.glCore.GLTexture.prototype.upload,upload:function(e){if(!(e instanceof M))return this.uploadNotCompressed(e);this.bind();var t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),this.isCompressed=!0,e.upload(t)},enableMipmap:function(){if(!this.isCompressed){var e=this.gl;this.bind(),this.mipmap=!0,e.generateMipmap(e.TEXTURE_2D)}}},F=Symbol(),q=((V={})[F]=t.Texture.from,V.from=function(e){return e instanceof M?new t.Texture(t.BaseTexture.from(e)):this[F](e)},V),J=Symbol(),Q=((k={})[J]=t.BaseTexture.from,k.from=function(e,r,n){if(!(e instanceof M))return this[J](e,r,n);var o=e.src,i=t.utils.BaseTextureCache[o];return i||((i=new t.BaseTexture(e,r)).imageUrl=o,n&&(i.sourceScale=n),t.BaseTexture.addToCache(i,o)),i},k);function Z(r){!function(e,t){e.addPreProcessResourceHandler((function(e){var r,n,o,i=null===(n=null===(r=e.src)||void 0===r?void 0:r.image)||void 0===n?void 0:n.texture;if(i){Array.isArray(i)||(i=[i]);var _=null!==(o=v(t))&&void 0!==o?o:{},a=i.find((function(e){return _[e.type]}));a&&Object.assign(e.src.image,a)}}))}(e.resource,r),Object.assign(e.RESOURCE_TYPE_STRATEGY,{astc:U,etc:U,pvrtc:U,s3tc:U,atc:U}),U.setExtensionXhrType("ktx",j.Buffer),Object.assign(t.glCore.GLTexture.prototype,z),Object.assign(t.Texture,q),Object.assign(t.BaseTexture,Q)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.WEBGL=1]="WEBGL",e[e.CANVAS=2]="CANVAS"}(Y||(Y={}));var $=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},ee=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},te=function(r){function n(){var e=null!==r&&r.apply(this,arguments)||this;return e.multiApps=[],e}return E(n,r),n.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new f,this.rendererManager=new d({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new P({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var n,o=t.scene,i=t.mode,_=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:_})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:i,application:n})}));var n=this.application.renderer.gl;n&&(this.suportedCompressedTextureFormats=v(n),Z(n))},n.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var n in e)r[n]||(r[n]=[]),(t=r[n]).push.apply(t,u(e[n]))},n.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},n.prototype.createApplication=function(e){e.view=e.canvas,e.renderType===Y.CANVAS&&(e.forceCanvas=!0),t.ticker.shared.autoStart=!1,t.ticker.shared.stop();var r=new h(c({sharedTicker:!0},e));return void 0!==e.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),e.preventScroll?ee(r.renderer):$(r.renderer)),void 0!==e.enableScroll&&(e.enableScroll?ee(r.renderer):$(r.renderer)),void 0===e.preventScroll&&void 0===e.enableScroll&&ee(r.renderer),r},n.prototype.update=function(){var e,t,r,n,o=this.componentObserver.clear();try{for(var i=l(o),_=i.next();!_.done;_=i.next()){var a=_.value;this.transform.componentChanged(a)}}catch(t){e={error:t}}finally{try{_&&!_.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}try{for(var s=l(this.game.gameObjects),E=s.next();!E.done;E=s.next()){var c=E.value;this.containerManager.updateTransform({name:c.id,transform:c.transform}),this.rendererManager.update(c)}}catch(e){r={error:e}}finally{try{E&&!E.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},n.prototype.lateUpdate=function(e){this.transform.update(),this.application.ticker.update(e.time)},n.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=l(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.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(e,t){this.params.width=e,this.params.height=t,this.application.renderer.resize(e,t)},n.systemName="Renderer",n=S([e.decorators.componentObserver({Transform:["_parent"]})],n)}(e.System);t.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete t.utils.TextureCache[this.imageUrl],this.imageUrl=null),this.source=null,this.dispose(),t.BaseTexture.removeFromCache(this),this.textureCacheIds=null,this._destroyed=!0};var re,ne,oe,ie,_e=function(e,t){var r=t.width,n=t.height,o=t.position,i=t.left,_=void 0===i?0:i,a=t.top,s=void 0===a?0:a,E=t.zIndex,c=t.pointerEvents,S=t.background;e.style.width=r+"px",e.style.height=n+"px",e.style.position=o,e.style.left=""+_,e.style.top=""+s,e.style.zIndex=""+E,e.style.pointerEvents=c,e.style.background=S,e.style.border="none",e.style.overflow="hidden"},ae=function(e){function t(t){var r=e.call(this)||this;Object.assign(r,t);var n=t.hint,o=void 0===n?"":n,i=t.event,_=t.delay,a=void 0===_?0:_,s=t.attr,E=void 0===s?{}:s,c=t.role,S=void 0===c?"":c,R=t.props,p=void 0===R?{}:R,l=t.state,C=void 0===l?{}:l;return r.hint=o,r.event=i,r.delay=a,r.attr=E,r.role=S,r.props=p,r.state=C,r.a11yId="_"+function(e){for(var t="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[],n=t.length,o=0;o<e;o++)r[o]=t[0|Math.random()*n];return r.join("")}(6),r}return E(t,e),t.componentName="A11y",S([r.type("boolean")],t.prototype,"interactive",void 0),S([r.type("string")],t.prototype,"hint",void 0),S([r.type("number"),r.step(1)],t.prototype,"delay",void 0),S([r.type("string")],t.prototype,"role",void 0),S([r.type("string")],t.prototype,"a11yId",void 0),t}(e.Component);exports.A11yActivate=void 0,(re=exports.A11yActivate||(exports.A11yActivate={}))[re.ENABLE=0]="ENABLE",re[re.DISABLE=1]="DISABLE",re[re.CHECK=2]="CHECK",function(e){e.NONE="none",e.AUTO="auto"}(ne||(ne={})),function(e){e.DEBUG="rgba(255,0,0,0.5)",e.NONE="transparent"}(oe||(oe={})),function(e){e.BUTTON="button",e.DIV="div"}(ie||(ie={}));var se=["hint","event","delay","attr","role","props","state","a11yId","name"],Ee=function(e,t,r){var n=this;["touchstart","touchend","tap"].forEach((function(o){e.emit(o,{stopPropagation:function(){return r.stopPropagation()},data:{position:n.eventPosition},gameObject:t})}))},ce=function(t){function r(e){var r=t.call(this,e)||this;return r.cache=new Map,r.eventCache=new Map,r.zIndex=3,r}return E(r,t),Object.defineProperty(r.prototype,"ratioX",{get:function(){return this._ratioX||this.setRatio()?this._ratioX:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"ratioY",{get:function(){return this._ratioY||this.setRatio()?this._ratioY:0},enumerable:!1,configurable:!0}),r.prototype.init=function(e){return void 0===e&&(e={}),R(this,void 0,void 0,(function(){var t,r,n,o,i,_,a,s,E;return p(this,(function(c){switch(c.label){case 0:switch(t=e.activate,r=void 0===t?exports.A11yActivate.CHECK:t,n=e.delay,o=void 0===n?100:n,i=e.checkA11yOpen,_=void 0===i?function(){return Promise.resolve(!1)}:i,a=e.zIndex,this.delay=o,this.zIndex=a||this.zIndex,r){case exports.A11yActivate.CHECK:return[3,1];case exports.A11yActivate.DISABLE:return[3,5];case exports.A11yActivate.ENABLE:return[3,6]}return[3,7];case 1:return c.trys.push([1,3,,4]),s=this,[4,_()];case 2:return s.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?(E=document.createElement("div"),this.div=E,this.game.canvas.parentNode&&this.game.canvas.parentNode.insertBefore(this.div,this.game.canvas),[2]):[2]}}))}))},r.prototype.setRatio=function(){var e=this.getCanvasBoundingClientRect(),t=e.width,r=e.height,n=this.getRenderRect(),o=n.renderWidth,i=n.renderHeight;return this._ratioX=t/o,this._ratioY=r/i,!(!t&&!r)&&(this.initDiv(),!0)},r.prototype.getRenderRect=function(){var e=this.game.getSystem(te).params,t=void 0===e?{width:300,height:300}:e,r=t.height;return{renderWidth:t.width,renderHeight:r}},r.prototype.getCanvasBoundingClientRect=function(){var e=this.game.canvas.getBoundingClientRect();return{width:e.width,height:e.height,left:e.left,top:e.top}},r.prototype.initDiv=function(){var e=this,t=window.pageXOffset,r=window.pageYOffset,n=this.getCanvasBoundingClientRect(),o={width:n.width,height:n.height,left:n.left+t+"px",top:n.top+r+"px",position:"absolute",zIndex:this.zIndex,pointerEvents:ne.NONE,background:oe.NONE};_e(this.div,o),this.div.addEventListener("click",(function(t){var r=t.currentTarget.getBoundingClientRect(),n=r.left,o=r.top,i=(t.pageX-n)/e.ratioX,_=(t.pageY-o)/e.ratioY;e.eventPosition={x:i,y:_}}),!0)},r.prototype.update=function(){return R(this,void 0,void 0,(function(){var t,r,n,o,i,_;return p(this,(function(a){if(t=this.componentObserver.clear(),!this.activate)return[2];try{for(r=l(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(e){i={error:e}}finally{try{n&&!n.done&&(_=r.return)&&_.call(r)}finally{if(i)throw i.error}}return[2]}))}))},r.prototype.change=function(e){var t=e.component;if("hint"===e.prop.prop[0]){var r=this.cache.get(t.a11yId);null==r||r.setAttribute("aria-label",t.hint),r&&this.setPosition(r,e.gameObject.transform)}},r.prototype.remove=function(e){var t=e.component;if(t){var r=t.a11yId,n=this.div.querySelector("#"+r);n&&this.div.removeChild(n),this.cache.delete(r)}},r.prototype.add=function(e){var t=this;if(this.activate){var r=e.component,n=e.gameObject,o=r.delay,i=r.a11yId,_=r.event;if(n){var a=n.transform;if(a){var s=document.createElement("div");this.cache.set(i,s),_||(_=n.getComponent("Event")),setTimeout((function(){t.setPosition(s,a),t.setA11yAttr(s,r),_&&t.addEvent(n),n.scene&&t.div.appendChild(s)}),o||this.delay)}}}},r.prototype.transformChange=function(e){var t=e.component,r=e.gameObject.getComponent(ae);if(r){var n=r.a11yId;if(t.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)}}},r.prototype.setEvent=function(e,t,r,n){if(t){var o=Ee.bind(this,t,r);this.eventCache.set(n,o),e.addEventListener("click",o)}},r.prototype.addEvent=function(e){var t=e.getComponent(ae);if(t){var r=e.getComponent("Event");if(r){var n=this.cache.get(t.a11yId);n&&this.setEvent(n,r,e,t.a11yId)}}},r.prototype.removeEvent=function(e){var t=e.gameObject.getComponent(ae);if(t&&e.component){var r=t.a11yId,n=this.eventCache.get(r),o=this.cache.get(r);o&&o.removeEventListener("click",n)}},r.prototype.setA11yAttr=function(e,t){var r,n,o,i,_,a,s=t.hint,E=t.props,c=void 0===E?{}:E,S=t.state,R=void 0===S?{}:S,p=t.role,C=t.a11yId,u=p||"text";e.setAttribute("role",u),e.setAttribute("aria-label",s),e.id=C;var h=Object.keys(c);try{for(var A=l(h),d=A.next();!d.done;d=A.next()){var f=d.value;e.setAttribute(f,c[f])}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=A.return)&&n.call(A)}finally{if(r)throw r.error}}var P=Object.keys(R);try{for(var T=l(P),v=T.next();!v.done;v=T.next()){f=v.value;e.setAttribute(f,R[f])}}catch(e){o={error:e}}finally{try{v&&!v.done&&(i=T.return)&&i.call(T)}finally{if(o)throw o.error}}try{for(var m=l(Object.keys(t)),B=m.next();!B.done;B=m.next()){"string"==typeof t[f=B.value]&&-1===se.indexOf(f)&&1!==f.indexOf("_")&&e.setAttribute(f,t[f])}}catch(e){_={error:e}}finally{try{B&&!B.done&&(a=m.return)&&a.call(m)}finally{if(_)throw _.error}}},r.prototype.setPosition=function(e,t){var r=t.size,n=r.width,o=r.height,i={width:0===n?1:n*this.ratioX,height:0===o?1:o*this.ratioY,position:"absolute",zIndex:this.zIndex,pointerEvents:ne.AUTO,background:this.debug?oe.DEBUG:oe.NONE},_=c({},t);_e(e,i),function(e,t,r,n){var o=t.worldTransform,i="matrix("+o.a+", "+o.b+", "+o.c+", "+o.d+", "+o.tx*r+", "+o.ty*n+")";e.style.transform=""+i,e.style.webkitTransform=""+i,e.style.transformOrigin="left top",e.style.webkitTransformOrigin="left top"}(e,_,this.ratioX,this.ratioY)},r.prototype.onDestroy=function(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null,this.div=null},r.systemName="A11ySystem",r=S([e.decorators.componentObserver({A11y:["hint"],Transform:["inScene"],Event:[]})],r)}(e.System);exports.A11y=ae,exports.A11ySystem=ce;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@eva/eva.js"),e=require("@eva/plugin-renderer"),n=require("@eva/inspector-decorator"),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){t.done?i(t.value):new n((function(e){e(t.value)})).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 h(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}var p,u,v,l,d=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,h=e.zIndex,p=e.pointerEvents,u=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=""+h,t.style.pointerEvents=p,t.style.background=u,t.style.border="none",t.style.overflow="hidden"},f=function(t){function e(e){var n=t.call(this)||this;Object.assign(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,h=void 0===c?{}:c,p=e.role,u=void 0===p?"":p,v=e.props,l=void 0===v?{}:v,d=e.state,f=void 0===d?{}:d;return n.hint=i,n.event=o,n.delay=s,n.attr=h,n.role=u,n.props=l,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([n.type("boolean")],e.prototype,"interactive",void 0),a([n.type("string")],e.prototype,"hint",void 0),a([n.type("number"),n.step(1)],e.prototype,"delay",void 0),a([n.type("string")],e.prototype,"role",void 0),a([n.type("string")],e.prototype,"a11yId",void 0),e}(t.Component);exports.A11yActivate=void 0,(p=exports.A11yActivate||(exports.A11yActivate={}))[p.ENABLE=0]="ENABLE",p[p.DISABLE=1]="DISABLE",p[p.CHECK=2]="CHECK",function(t){t.NONE="none",t.AUTO="auto"}(u||(u={})),function(t){t.DEBUG="rgba(255,0,0,0.5)",t.NONE="transparent"}(v||(v={})),function(t){t.BUTTON="button",t.DIV="div"}(l||(l={}));var y=["hint","event","delay","attr","role","props","state","a11yId","name"],g=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})}))},m=function(n){function r(t){var e=n.call(this,t)||this;return e.cache=new Map,e.eventCache=new Map,e.zIndex=3,e}return i(r,n),Object.defineProperty(r.prototype,"ratioX",{get:function(){return this._ratioX||this.setRatio()?this._ratioX:0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"ratioY",{get:function(){return this._ratioY||this.setRatio()?this._ratioY:0},enumerable:!1,configurable:!0}),r.prototype.init=function(t){return void 0===t&&(t={}),s(this,void 0,void 0,(function(){var e,n,r,i,o,a,s,h,p;return c(this,(function(c){switch(c.label){case 0:switch(e=t.activate,n=void 0===e?exports.A11yActivate.CHECK:e,r=t.delay,i=void 0===r?100:r,o=t.checkA11yOpen,a=void 0===o?function(){return Promise.resolve(!1)}:o,s=t.zIndex,this.delay=i,this.zIndex=s||this.zIndex,n){case exports.A11yActivate.CHECK:return[3,1];case exports.A11yActivate.DISABLE:return[3,5];case exports.A11yActivate.ENABLE:return[3,6]}return[3,7];case 1:return c.trys.push([1,3,,4]),h=this,[4,a()];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=t.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]}}))}))},r.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)},r.prototype.getRenderRect=function(){var t=this.game.getSystem(e.RendererSystem).params,n=void 0===t?{width:300,height:300}:t,r=n.height;return{renderWidth:n.width,renderHeight:r}},r.prototype.getCanvasBoundingClientRect=function(){var t=this.game.canvas.getBoundingClientRect();return{width:t.width,height:t.height,left:t.left,top:t.top}},r.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:"absolute",zIndex:this.zIndex,pointerEvents:u.NONE,background:v.NONE};d(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)},r.prototype.update=function(){return s(this,void 0,void 0,(function(){var e,n,r,i,o,a;return c(this,(function(s){if(e=this.componentObserver.clear(),!this.activate)return[2];try{for(n=h(e),r=n.next();!r.done;r=n.next())switch((i=r.value).type){case t.OBSERVER_TYPE.ADD:"Event"===i.componentName&&this.addEvent(i.gameObject),"A11y"===i.componentName&&this.add(i);break;case t.OBSERVER_TYPE.CHANGE:"Transform"===i.componentName&&this.transformChange(i),"A11y"===i.componentName&&this.change(i);break;case t.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]}))}))},r.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)}},r.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)}},r.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)}}}},r.prototype.transformChange=function(t){var e=t.component,n=t.gameObject.getComponent(f);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)}}},r.prototype.setEvent=function(t,e,n,r){if(e){var i=g.bind(this,e,n);this.eventCache.set(r,i),t.addEventListener("click",i)}},r.prototype.addEvent=function(t){var e=t.getComponent(f);if(e){var n=t.getComponent("Event");if(n){var r=this.cache.get(e.a11yId);r&&this.setEvent(r,n,t,e.a11yId)}}},r.prototype.removeEvent=function(t){var e=t.gameObject.getComponent(f);if(e&&t.component){var n=e.a11yId,r=this.eventCache.get(n),i=this.cache.get(n);i&&i.removeEventListener("click",r)}},r.prototype.setA11yAttr=function(t,e){var n,r,i,o,a,s,c=e.hint,p=e.props,u=void 0===p?{}:p,v=e.state,l=void 0===v?{}:v,d=e.role,f=e.a11yId,g=d||"text";t.setAttribute("role",g),t.setAttribute("aria-label",c),t.id=f;var m=Object.keys(u);try{for(var b=h(m),E=b.next();!E.done;E=b.next()){var x=E.value;t.setAttribute(x,u[x])}}catch(t){n={error:t}}finally{try{E&&!E.done&&(r=b.return)&&r.call(b)}finally{if(n)throw n.error}}var A=Object.keys(l);try{for(var O=h(A),w=O.next();!w.done;w=O.next()){x=w.value;t.setAttribute(x,l[x])}}catch(t){i={error:t}}finally{try{w&&!w.done&&(o=O.return)&&o.call(O)}finally{if(i)throw i.error}}try{for(var C=h(Object.keys(e)),I=C.next();!I.done;I=C.next()){"string"==typeof e[x=I.value]&&-1===y.indexOf(x)&&1!==x.indexOf("_")&&t.setAttribute(x,e[x])}}catch(t){a={error:t}}finally{try{I&&!I.done&&(s=C.return)&&s.call(C)}finally{if(a)throw a.error}}},r.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:"absolute",zIndex:this.zIndex,pointerEvents:u.AUTO,background:this.debug?v.DEBUG:v.NONE},s=o({},e);d(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)},r.prototype.onDestroy=function(){this.div.parentElement.removeChild(this.div),this.cache=null,this.eventCache=null,this.div=null},r.systemName="A11ySystem",r=a([t.decorators.componentObserver({A11y:["hint"],Transform:["inScene"],Event:[]})],r)}(t.System);exports.A11y=f,exports.A11ySystem=m;