1 |
- System.register([],(function(e,t){"use strict";return{execute:function(){function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function r(){return(r=e("dy",Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e})).apply(this,arguments)}function s(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,o(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function h(e,t,i){return(h=u()?Reflect.construct:function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&o(r,i.prototype),r}).apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||(i=e,-1===Function.toString.call(i).indexOf("[native code]")))return e;var i;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return h(e,arguments,a(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),o(n,e)})(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function d(e,t){var i;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return _(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(i=e[Symbol.iterator]()).next.bind(i)}function f(e,t,i,n,r){var s={};return Object.keys(n).forEach((function(e){s[e]=n[e]})),s.enumerable=!!s.enumerable,s.configurable=!!s.configurable,("value"in s||s.initializer)&&(s.writable=!0),s=i.slice().reverse().reduce((function(i,n){return n(e,t,i)||i}),s),r&&void 0!==s.initializer&&(s.value=s.initializer?s.initializer.call(r):void 0,s.initializer=void 0),void 0===s.initializer&&(Object.defineProperty(e,t,s),s=null),s}function p(e,t){const i="undefined"==typeof window?global:window;return void 0===i[e]?i[e]=t:i[e]}e({A:void 0,E:void 0,F:void 0,G:void 0,H:void 0,I:void 0,J:void 0,K:void 0,L:void 0,M:void 0,N:void 0,O:void 0,Q:void 0,S:void 0,T:void 0,U:void 0,V:void 0,W:void 0,X:void 0,Y:void 0,a:function(e,t){t>=0&&e.length,e.length},a$:x_,aT:void 0,aZ:P_,a_:L_,b0:F_,b1:B_,b2:U_,b3:G_,bA:void 0,bB:void 0,bC:void 0,bD:void 0,bE:void 0,bF:void 0,bG:void 0,bJ:void 0,bY:ib,bZ:void 0,bo:void 0,bp:void 0,bt:Ri,bv:s,bw:void 0,bz:void 0,c:void 0,c3:void 0,c4:void 0,c9:void 0,cB:function(e,t,i,n,r){void 0===i&&(i=Fc.R32F),void 0===n&&(n=0),void 0===r&&(r=0);var s=b_[i];r||(r=s.size);for(var a="set"+Hb(s),o=s.size/s.count,u=Math.floor(t.length/s.count),h=Ec.isLittleEndian,c=0;c<u;++c)for(var l=n+r*c,_=0;_<s.count;++_){var d=l+o*_;e[a](d,t[s.count*c+_],h)}},cC:CL,cD:zb,cE:Z,cK:Ne,cL:rt,cM:f,cP:ec,cQ:va,cR:ke,cU:te,cV:ee,cX:void 0,cY:Si,ca:ct,cb:n,ce:d,cf:function(e,t,i,n,r,s){void 0===t&&(t=Fc.R32F),void 0===i&&(i=0),void 0===n&&(n=e.byteLength-i),void 0===r&&(r=0),void 0===s&&(s=[]);var a=b_[t];r||(r=a.size);for(var o="get"+Hb(a),u=a.size/a.count,h=Math.floor(n/r),c=Ec.isLittleEndian,l=0;l<h;++l)for(var _=i+r*l,d=0;d<a.count;++d){var f=_+u*d;s[a.count*l+d]=e[o](f,c)}return s},cg:function(){},cj:G,ck:Di,cl:S,cm:function(){},ct:q,cx:Cs,cz:Rc,d:void 0,d$:void 0,d3:yt,d8:z,d9:void 0,dA:pe,dB:mt,dC:void 0,dE:bi,dG:void 0,dL:Gh,dM:void 0,dN:Je,dP:void 0,dS:void 0,dV:void 0,dW:Ft,dX:Ge,dY:void 0,dZ:K,db:void 0,dn:kv,dp:Hv,dq:zv,dr:void 0,ds:function(e,t,i,n,r){var s=e;if("vert"===n){var a=new Set;s=Qv(s=function(e,t,i,n){for(var r=new RegExp("layout\\(location = (\\d+)\\)\\s+in.*?\\s(\\w+)[;,\\)]","g"),s=r.exec(e),a=e,o=function(){var o=s[2],u=t.attributes.find((function(e){return e.name===o}));if(0===(null==u?void 0:u.defines.length)||(null==u?void 0:u.defines.every((function(e){return""===e})))){var h=parseInt(s[1]);if(h>15){for(var c=0;n.has(c);)c++;h=c;var l=s[0].replace(s[1],""+h);a=e.replace(s[0],l)}n.add(h),i.set(s[2],h)}s=r.exec(e)};s;)o();return a}(e,t,r,a),t,i,"in",r,a),s=Qv(s,t,i,"out",r)}else"frag"===n&&(s=function(e,t,i){for(var n=e,r=new RegExp("layout\\(location = ([^\\)]+)\\)\\s+in.*?\\s(\\w+)[;,\\)]","g"),s=r.exec(e);s;){var a=s[2];if(!i.has(a)){var o=0;o=i.get(a)||0;var u=s[0].replace(s[1],""+o);n=n.replace(s[0],u)}s=r.exec(e)}return n}(s,0,r));return s},dt:Jv,dw:l,dy:r,e:void 0,e$:uc,e1:void 0,e2:ht,e3:void 0,e4:ot,eA:Rs,eB:Ii,eD:void 0,eE:void 0,eF:void 0,eG:void 0,eI:wi,eJ:lt,eL:void 0,eM:void 0,eN:ut,eO:U,eP:k,eQ:H,eR:W,eT:$h,eU:tc,eV:ic,eW:nc,eX:rc,eY:sc,eZ:ac,e_:oc,ef:qs,eh:Vs,ep:void 0,eq:it,er:Ce,eu:function(e,t,i,n){i&&Object.defineProperty(e,t,{enumerable:i.enumerable,configurable:i.configurable,writable:i.writable,value:i.initializer?i.initializer.call(n):void 0})},ez:Lu,f:void 0,f$:xi,f0:function(e,t,i){var n=Wb(e),r="Camera"+n,s=Zb(r,e,t),a=Xb(e,e.window.width,e.window.height),o=a.width,u=a.height,h="dsForwardPassColor"+r,c="dsForwardPassDS"+r;t.containsResource(h)||(i?t.addRenderTarget(h,Fc.RGBA16F,o,u,Sb.MANAGED):t.addRenderTexture(h,Fc.BGRA8,o,u,e.window),t.addDepthStencil(c,Fc.DEPTH_STENCIL,o,u,Sb.MANAGED)),i?(t.updateRenderTarget(h,o,u),t.updateDepthStencil(c,o,u)):(t.updateRenderWindow(h,e.window),t.updateDepthStencil(c,o,u));var l=t.addRasterPass(o,u,"default");l.name="CameraForwardPass"+n,l.setViewport(new xl(a.x,a.y,o,u));for(var _,f=d(s.mainLightShadowNames);!(_=f()).done;){var p=_.value;if(t.containsResource(p)){var m=new Bb("cc_shadowMap");l.addComputeView(p,m)}}for(var g,v=d(s.spotLightShadowNames);!(g=v()).done;){var y=g.value;if(t.containsResource(y)){var E=new Bb("cc_spotShadowMap");l.addComputeView(y,E)}}var T=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,i?nl.CLEAR:jb(e.clearFlag,Cb.RENDER_TARGET),rl.STORE,e.clearFlag,new Dl(e.clearColor.x,e.clearColor.y,e.clearColor.z,e.clearColor.w)),A=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,i?nl.CLEAR:jb(e.clearFlag,Cb.DEPTH_STENCIL),rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));l.addRasterView(h,T),l.addRasterView(c,A),l.addQueue(Rb.RENDER_OPAQUE).addSceneOfCamera(e,new Ub,Ob.OPAQUE_OBJECT|Ob.PLANAR_SHADOW|Ob.CUTOUT_OBJECT|Ob.DEFAULT_LIGHTING|Ob.DRAW_INSTANCING);var S=Ob.TRANSPARENT_OBJECT|Ob.GEOMETRY;return i||(S|=Ob.UI,l.showStatistics=!0),l.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,S),{rtName:h,dsName:c}},f1:function(e,t){var i=Wb(e),n=Xb(e,e.window.width,e.window.height),r=n.width,s=n.height,a="gBufferPassColorCamera",o="gBufferPassNormal",u="gBufferPassEmissive",h="gBufferPassDSCamera";if(!t.containsResource(a)){var c=Fc.RGBA16F;t.addRenderTarget(a,c,r,s,Sb.MANAGED),t.addRenderTarget(o,c,r,s,Sb.MANAGED),t.addRenderTarget(u,c,r,s,Sb.MANAGED),t.addDepthStencil(h,Fc.DEPTH_STENCIL,r,s,Sb.MANAGED)}t.updateRenderTarget(a,r,s),t.updateRenderTarget(o,r,s),t.updateRenderTarget(u,r,s),t.updateDepthStencil(h,r,s);var l=t.addRasterPass(r,s,"default");l.name="CameraGBufferPass"+i,l.setViewport(new xl(n.x,n.y,n.width,n.height));var _=new Dl(0,0,0,0);e.clearFlag&vl.COLOR&&(t.pipelineSceneData.isHDR?VE(_,e.clearColor):(_.x=e.clearColor.x,_.y=e.clearColor.y,_.z=e.clearColor.z));var d=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,_),f=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,new Dl(0,0,0,0)),p=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,new Dl(0,0,0,0)),m=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,nl.CLEAR,rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));l.addRasterView(a,d),l.addRasterView(o,f),l.addRasterView(u,p),l.addRasterView(h,m),l.addQueue(Rb.RENDER_OPAQUE).addSceneOfCamera(e,new Ub,Ob.OPAQUE_OBJECT|Ob.CUTOUT_OBJECT);var g=new Jb;return g.color=a,g.normal=o,g.emissive=u,g.ds=h,g},f2:function(e,t,i){eO||(eO=new $b);var n=Wb(e),r=Zb("Camera"+n,e,t),s=Xb(e,e.window.width,e.window.height),a=s.width,o=s.height,u="deferredLightingPassRTName",h="deferredLightingPassDS";t.containsResource(u)||(t.addRenderTarget(u,Fc.RGBA8,a,o,Sb.MANAGED),t.addDepthStencil(h,Fc.DEPTH_STENCIL,a,o,Sb.MANAGED)),t.updateRenderTarget(u,a,o),t.updateDepthStencil(h,a,o);var c=t.addRasterPass(a,o,"deferred-lighting");c.name="CameraLightingPass"+n,c.setViewport(new xl(s.x,s.y,a,o));for(var l,_=d(r.mainLightShadowNames);!(l=_()).done;){var f=l.value;if(t.containsResource(f)){var p=new Bb("cc_shadowMap");c.addComputeView(f,p)}}for(var m,g=d(r.spotLightShadowNames);!(m=g()).done;){var v=m.value;if(t.containsResource(v)){var y=new Bb("cc_spotShadowMap");c.addComputeView(v,y)}}if(t.containsResource(i.color)){var E=new Bb;E.name="gbuffer_albedoMap",c.addComputeView(i.color,E);var T=new Bb;T.name="gbuffer_normalMap",c.addComputeView(i.normal,T);var A=new Bb;A.name="gbuffer_emissiveMap",c.addComputeView(i.emissive,A);var S=new Bb;S.name="depth_stencil",c.addComputeView(i.ds,S)}var R=new Dl(0,0,0,0);e.clearFlag&vl.COLOR&&(R.x=e.clearColor.x,R.y=e.clearColor.y,R.z=e.clearColor.z),R.w=0;var w=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,e.clearFlag,R);return c.addRasterView(u,w),c.addQueue(Rb.RENDER_TRANSPARENT).addCameraQuad(e,eO.deferredLightingMaterial,0,Ob.VOLUMETRIC_LIGHTING),c.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,Ob.TRANSPARENT_OBJECT|Ob.PLANAR_SHADOW|Ob.GEOMETRY),{rtName:u,dsName:h}},f3:function(e,t,i,n){void 0===n&&(n=Gb.NONE),(!Yb||Yb&&Yb.antiAliasing!==n)&&(Yb=new Kb(n));var r=Wb(e),s=Xb(e,e.window.width,e.window.height),a=s.width,o=s.height,u="postprocessPassRTName"+r,h="postprocessPassDS"+r;t.containsResource(u)||(t.addRenderTexture(u,Fc.BGRA8,a,o,e.window),t.addDepthStencil(h,Fc.DEPTH_STENCIL,a,o,Sb.MANAGED)),t.updateRenderWindow(u,e.window),t.updateDepthStencil(h,a,o);var c=t.addRasterPass(a,o,"post-process");if(c.name="CameraPostprocessPass"+r,c.setViewport(new xl(s.x,s.y,s.width,s.height)),t.containsResource(i)){var l=new Bb;l.name="outputResultMap",c.addComputeView(i,l)}var _=new Dl(0,0,0,e.clearColor.w);e.clearFlag&vl.COLOR&&(_.x=e.clearColor.x,_.y=e.clearColor.y,_.z=e.clearColor.z);var d=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,jb(e.clearFlag,Cb.RENDER_TARGET),rl.STORE,e.clearFlag,_),f=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,jb(e.clearFlag,Cb.DEPTH_STENCIL),rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));return c.addRasterView(u,d),c.addRasterView(h,f),c.addQueue(Rb.NONE).addFullscreenQuad(Yb.postMaterial,0,Ob.NONE),c.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,Ob.UI),eT()===e&&(c.showStatistics=!0),{rtName:u,dsName:h}},f4:function(e,t){var i=Wb(e),n="Camera"+i,r=Xb(e,e.window.width,e.window.height),s=r.width,a=r.height,o="dsUIAndProfilerPassColor"+n,u="dsUIAndProfilerPassDS"+n;t.containsResource(o)||(t.addRenderTexture(o,Fc.BGRA8,s,a,e.window),t.addDepthStencil(u,Fc.DEPTH_STENCIL,s,a,Sb.MANAGED)),t.updateRenderWindow(o,e.window),t.updateDepthStencil(u,s,a);var h=t.addRasterPass(s,a,"default");h.name="CameraUIAndProfilerPass"+i,h.setViewport(new xl(r.x,r.y,s,a));var c=new xb("_",Mb.WRITE,Cb.RENDER_TARGET,jb(e.clearFlag,Cb.RENDER_TARGET),rl.STORE,e.clearFlag,new Dl(e.clearColor.x,e.clearColor.y,e.clearColor.z,e.clearColor.w)),l=new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,jb(e.clearFlag,Cb.DEPTH_STENCIL),rl.STORE,e.clearFlag,new Dl(e.clearDepth,e.clearStencil,0,0));h.addRasterView(o,c),h.addRasterView(u,l);var _=Ob.UI;h.addQueue(Rb.RENDER_TRANSPARENT).addSceneOfCamera(e,new Ub,_),eT()===e&&(h.showStatistics=!0)},f5:Ga,f7:fi,fA:Pt,fB:void 0,fG:void 0,fP:On,fQ:Qi,fR:Vi,fS:vn,fT:Sn,fV:Mn,fW:Ln,fX:tn,f_:Li,fc:Oi,fd:di,fe:eh,fg:Fi,fi:Ci,fj:Mi,fk:A,fl:Pi,fm:Bi,fp:Ai,fs:ki,ft:void 0,fu:void 0,fv:Gi,g:void 0,g0:Ui,g1:Hi,g4:pt,g8:function(e){e>0&&(ce=e)},g9:function(e){for(var t,i=d(e);!(t=i()).done;)me(t.value)},gF:ka,gH:V,gI:function(e,t){return Rs(e,t,0)},gJ:function(e,t,i){for(var n=0,r=e.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=e[s];if(i(a,t)<0)r=s-1;else{if(!(i(a,t)>0))return s;n=s+1}}return~n},gK:Cc,gM:cL,ga:function(e){return de||(de="undefined"==typeof Proxy?{}:new Proxy(e,{get:function(e,t,i){return me(t),Reflect.get(e,t,i)}})),de},gb:cc,gc:lc,gj:function(e){return e[Ks]},gl:ie,gm:ne,gn:void 0,gp:void 0,gq:mu,h:void 0,h3:void 0,h9:void 0,hM:qx,hm:bp,i:void 0,j:void 0,k:void 0,l:void 0,m:void 0,n:void 0,o:void 0,p:void 0,q:void 0,r:void 0,s:void 0,t:void 0,u:void 0,v:void 0,w:void 0,x:void 0,y:void 0,z:void 0}),e("f8",!1),p("CC_WECHAT",!1),p("CC_BAIDU",!1),p("CC_XIAOMI",!1),p("CC_ALIPAY",!1),p("CC_BYTEDANCE",!1),p("CC_OPPO",!1),p("CC_VIVO",!1),p("CC_HUAWEI",!1),p("CC_COCOSPLAY",!1),p("CC_QTT",!1),p("CC_LINKSURE",!1);const m=e("f9",!1);p("CC_EDITOR",!1),p("CC_PREVIEW",!1),p("CC_BUILD",!0),p("CC_TEST",!1),p("CC_DEBUG",!1),p("CC_DEV",!1),e("fC",!1),p("CC_MINIGAME",!1),e("fE",!1),p("CC_RUNTIME_BASED",!1),p("CC_SUPPORT_JIT",!0),e("fD",!1),p("CC_JSB",!1);var g="undefined"==typeof window?global:window,v=e("by",{_global:g});v.internal={};var y=e("fx","3.7.1");g.CocosEngine=v.ENGINE_VERSION=y,g.cc=v;var E=e("cF",void 0!==globalThis.jsb&&void 0!==jsb.window?jsb.window:globalThis);g.ccwindow=E;var T=e("fn",2147483647);function A(e){return(e>0)-(e<0)}function S(e){var t,i;return t=(e>65535)<<4,t|=i=((e>>>=t)>255)<<3,t|=i=((e>>>=i)>15)<<2,(t|=i=((e>>>=i)>3)<<1)|(e>>>=i)>>1}function R(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24}function w(e){var t=32;return(e&=-e)&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}function I(e){return--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,1+(e|=e>>>16)}var b=new Array(256);!function(e){for(var t=0;t<256;++t){var i=t,n=t,r=7;for(i>>>=1;i;i>>>=1)n<<=1,n|=1&i,--r;e[t]=n<<r&255}}(b);var O=Object.freeze({__proto__:null,INT_BITS:32,INT_MAX:T,INT_MIN:-2147483648,sign:A,abs:function(e){var t=e>>31;return(e^t)-t},min:function(e,t){return t^(e^t)&-(e<t)},max:function(e,t){return e^(e^t)&-(e<t)},isPow2:function(e){return!(e&e-1||!e)},log2:S,log10:function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},popCount:R,countTrailingZeros:w,nextPow2:I,prevPow2:function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,(e|=e>>>16)-(e>>>1)},parity:function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,27030>>>(e&=15)&1},reverse:function(e){return b[255&e]<<24|b[e>>>8&255]<<16|b[e>>>16&255]<<8|b[e>>>24&255]},interleave2:function(e,t){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))<<1},deinterleave2:function(e,t){return(e=65535&((e=16711935&((e=252645135&((e=858993459&((e=e>>>t&1431655765)|e>>>1))|e>>>2))|e>>>4))|e>>>16))<<16>>16},interleave3:function(e,t,i){return e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2),(e|=(t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2))<<1)|(i=1227133513&((i=3272356035&((i=251719695&((i=4278190335&((i&=1023)|i<<16))|i<<8))|i<<4))|i<<2))<<2},deinterleave3:function(e,t){return(e=1023&((e=4278190335&((e=251719695&((e=3272356035&((e=e>>>t&1227133513)|e>>>2))|e>>>4))|e>>>8))|e>>>16))<<22>>22},nextCombination:function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>w(e)+1}});e("fO",O);var N=E.document,C="https://github.com/cocos-creator/engine/blob/develop/EngineErrorMap.md",M=null,P=console.log.bind(console),L=P,x=P,D=function(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];console.log("ASSERT: "+B.apply(void 0,[t].concat(n)))}},F=P;function B(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return v.js.formatStr.apply(null,[e].concat(i))}function U(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return P.apply(void 0,[e].concat(i))}function G(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return L.apply(void 0,[e].concat(i))}function k(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return x.apply(void 0,[e].concat(i))}function H(e,t){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return D.apply(void 0,[e,t].concat(n))}function z(){return F.apply(void 0,arguments)}function V(e){if(P=L=x=D=F=function(){},e!==J.NONE){if(e>J.ERROR){var t=function(e){if(v.game.canvas){if(!M){var t=N.createElement("Div");t.setAttribute("id","logInfoDiv"),t.setAttribute("width","200"),t.setAttribute("height",v.game.canvas.height);var i=t.style;i.zIndex="99999",i.position="absolute",i.top=i.left="0",(M=N.createElement("textarea")).setAttribute("rows","20"),M.setAttribute("cols","30"),M.setAttribute("disabled","true");var n=M.style;n.backgroundColor="transparent",n.borderBottom="1px solid #cccccc",n.borderTopWidth=n.borderLeftWidth=n.borderRightWidth="0px",n.borderTopStyle=n.borderLeftStyle=n.borderRightStyle="none",n.padding="0px",n.margin="0px",t.appendChild(M),v.game.canvas.parentNode.appendChild(t)}M.value=M.value+e+"\r\n",M.scrollTop=M.scrollHeight}};x=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t("ERROR : "+B.apply(void 0,[e].concat(n)))},D=function(e,i){if(!e){for(var n=arguments.length,r=new Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];t("ASSERT: "+B.apply(void 0,[i].concat(r)))}},e!==J.ERROR_FOR_WEB_PAGE&&(L=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t("WARN : "+B.apply(void 0,[e].concat(n)))}),e===J.INFO_FOR_WEB_PAGE&&(P=function(e){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];t(B.apply(void 0,[e].concat(n)))})}else console&&(console.error||(console.error=console.log),console.warn||(console.warn=console.log),x=console.error.bind?console.error.bind(console):function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return console.error.apply(console,[e].concat(i))},D=function(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];var s=B.apply(void 0,[t].concat(n));throw new Error(s)}});if(e!==J.ERROR&&(L=console.warn.bind?console.warn.bind(console):function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return console.warn.apply(console,[e].concat(i))}),e<=J.INFO&&(P=console.log.bind?console.log.bind(console):function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return console.log.apply(console,[e].concat(i))}),e<=J.VERBOSE&&"function"==typeof console.debug){var i=console.debug.bind(console);F=function(){return i.apply(void 0,arguments)}}}}function W(e){k(e.stack||e)}function j(e){return function(t){for(var i=e+" "+t+", please go to "+C+"#"+t+" to see details.",n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return 0===r.length?i:i+" Arguments: "+r.join(", ")}}var X=j("Log");function K(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];U(X.apply(void 0,[e].concat(i)))}var Y=j("Warning");function q(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];G(Y.apply(void 0,[e].concat(i)))}var Q=j("Error");function Z(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];k(Q.apply(void 0,[e].concat(i)))}var J,$=j("Assert");function ee(e,t){if(!e){for(var i=arguments.length,n=new Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];H(!1,$.apply(void 0,[t].concat(n)))}}function te(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return Q.apply(void 0,[e].concat(i))}function ie(){return!!v.profiler&&v.profiler.isShowingStats()}function ne(e){v.profiler&&(e?v.profiler.showStats():v.profiler.hideStats())}!function(e){e[e.NONE=0]="NONE",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.INFO_FOR_WEB_PAGE=5]="INFO_FOR_WEB_PAGE",e[e.WARN_FOR_WEB_PAGE=6]="WARN_FOR_WEB_PAGE",e[e.ERROR_FOR_WEB_PAGE=7]="ERROR_FOR_WEB_PAGE"}(J||(J=e("gn",{}))),e("eS",Object.freeze({__proto__:null,log:U,warn:G,error:k,assert:H,debug:z,_resetDebugSetting:V,_throw:W,logID:K,warnID:q,errorID:Z,assertID:ee,get DebugMode(){return J},getError:te,isDisplayStats:ie,setDisplayStats:ne}));var re,se,ae,oe,ue,he,ce=10,le=0,_e=new Map;oe=function(e,t,i,n,r,s,a){var o=_e.get(s);o&&o.logTimes>o.count&&(r("'%s' is deprecated, please use '%s' instead. "+a,e+"."+t,i+"."+n),o.count++)},re=e("db",(function(e,t,i){null!=e&&i.forEach((function(i){var n=le++;_e.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ce});var r=null!=i.target?i.target:e,s=null!=i.newName?i.newName:i.name,a=null!=i.targetName?i.targetName:t,o=r===e,u=i.suggest?"("+i.suggest+")":"";if(null!=i.customFunction)e[i.name]=function(){var e;return oe(t,i.name,a,s,G,n,u),(e=i.customFunction).call.apply(e,[this].concat(Array.prototype.slice.call(arguments)))};else if(null!=i.customSetter||null!=i.customGetter){var h=null!=i.customSetter,c=null!=i.customGetter;h&&c?Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,a,s,G,n,u),i.customGetter.call(this)},set:function(e){oe(t,i.name,a,s,G,n,u),i.customSetter.call(this,e)},enumerable:!1}):h?Object.defineProperty(e,i.name,{set:function(e){oe(t,i.name,a,s,G,n,u),i.customSetter.call(this,e)},enumerable:!1}):c&&Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,a,s,G,n,u),i.customGetter.call(this)},enumerable:!1})}else Object.defineProperty(e,i.name,{get:function(){return oe(t,i.name,a,s,G,n,u),o?this[s]:r[s]},set:function(e){oe(t,i.name,a,s,G,n,u),o?this[s]=e:r[s]=e},enumerable:!1})}))})),he=function(e,t,i,n,r){var s=_e.get(n);s&&s.logTimes>s.count&&(i("'%s' has been removed. "+r,e+"."+t),s.count++)},se=e("d9",(function(e,t,i){null!=e&&i.forEach((function(i){var n=le++;_e.set(n,{id:n,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ce});var r=i.suggest?"("+i.suggest+")":"";Object.defineProperty(e,i.name,{get:function(){return he(t,i.name,k,n,r)},set:function(){he(t,i.name,k,n,r)},enumerable:!1})}))})),ue=function(e,t,i,n,r){var s=_e.get(n);s&&s.logTimes>s.count&&(i("'%s' is deprecated. "+r,e+"."+t),s.count++)},ae=e("dM",(function(e,t,i){null!=e&&i.forEach((function(i){var n=i.name,r=Object.getOwnPropertyDescriptor(e,n);if(r&&r.configurable){var s=le++;_e.set(s,{id:s,count:0,logTimes:void 0!==i.logTimes?i.logTimes:ce});var a=i.suggest?"("+i.suggest+")":"";if(void 0!==r.value)if("function"==typeof r.value){var o=r.value;e[n]=function(){return ue(t,n,G,s,a),o.call.apply(o,[this].concat(Array.prototype.slice.call(arguments)))}}else{var u=r.value;Object.defineProperty(e,n,{configurable:!0,get:function(){return ue(t,n,G,s,a),u}}),r.writable&&Object.defineProperty(e,n,{set:function(e){ue(t,n,G,s,a),u=e}})}else!function(t,i,n,r,s,a){if(t.get){var o=t.get;t.get=function(){return ue(i,n,r,s,a),o.call(this)}}if(t.set){var u=t.set;t.set=function(e){ue(i,n,r,s,a),u.call(this,e)}}Object.defineProperty(e,n,t)}(r,t,n,G,s,a);Object.defineProperty(e,n,{enumerable:!1})}}))}));var de,fe={};function pe(e){for(var t in e){var i=e[t];fe[t]=i}}function me(e){var t=fe[e];if(t){var i=t.newName,n=t.since;t.removed?i?Z(16003,e,n,i):Z(16002,e,n):i?q(16001,e,n,i):q(16e3,e,n)}}var ge=function(){function e(e){this.id=void 0,this.prefix=void 0,this.id=0|998*Math.random(),this.prefix=e?e+".":""}return e.prototype.getNewId=function(){return this.prefix+(++this.id).toString()},e}();ge.global=new ge("global");var ve=new ge("TmpCId."),ye="undefined"==typeof Symbol?"__aliases__":Symbol("[[Aliases]]"),Ee="__cid__";function Te(e){return"number"==typeof e||e instanceof Number}function Ae(e){return"string"==typeof e||e instanceof String}function Se(e){for(var t in e)return!1;return!0}var Re,we=e("f6",(Re={value:void 0,enumerable:!1,writable:!1,configurable:!0},function(e,t,i,n,r){Re.value=i,Re.writable=n,Re.enumerable=r,Object.defineProperty(e,t,Re),Re.value=void 0})),Ie=function(){var e={get:void 0,set:void 0,enumerable:!1};return function(t,i,n,r,s,a){void 0===s&&(s=!1),void 0===a&&(a=!1),"boolean"==typeof r&&(console.log("Set `setter` to boolean is deprecated. Please don not use like this again."),s=r,r=void 0),e.get=n,e.set=r,e.enumerable=s,e.configurable=a,Object.defineProperty(t,i,e),e.get=void 0,e.set=void 0}}(),be=function(){var e={get:void 0,enumerable:!1,configurable:!1};return function(t,i,n,r,s){e.get=n,e.enumerable=r,e.configurable=s,Object.defineProperty(t,i,e),e.get=void 0}}(),Oe=function(){var e={set:void 0,enumerable:!1,configurable:!1};return function(t,i,n,r,s){e.set=n,e.enumerable=r,e.configurable=s,Object.defineProperty(t,i,e),e.set=void 0}}();function Ne(e){var t=Object.create(null);return e&&(t["."]=1,t["/"]=1,delete t["."],delete t["/"]),t}function Ce(e){if("function"==typeof e){var t=e.prototype;if(t&&t.hasOwnProperty("__classname__")&&t.__classname__)return t.__classname__;var i="";if(e.name&&(i=e.name),e.toString){var n,r=e.toString();(n="["===r.charAt(0)?/\[\w+\s*(\w+)\]/.exec(r):/function\s*(\w+)/.exec(r))&&2===n.length&&(i=n[1])}return"Object"!==i?i:""}return e&&e.constructor?Ce(e.constructor):""}function Me(e,t,i,n){var r=/([^.]+)$/,s=r.exec(t)[0],a=r.exec(i)[0];function o(){return this[a]}n?Ie(e,s,o,(function(e){this[a]=e})):be(e,s,o)}function Pe(e,t,i,n){for(var r in i)Me(e,t+"."+r,i[r],n)}var Le=/(%d)|(%s)/,xe=/%s/;function De(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];if(0===arguments.length)return"";if(0===i.length)return""+e;var r="string"==typeof e&&Le.test(e);if(r)for(var s,a=d(i);!(s=a()).done;){var o=s.value,u="number"==typeof o?Le:xe;if(u.test(e)){var h=""+o;e=e.replace(u,h)}else e+=" "+o}else for(var c,l=d(i);!(c=l()).done;){var _=c.value;e+=" "+_}return e}function Fe(){for(var e=arguments.length-1,t=new Array(e),i=0;i<e;++i)t[i]=arguments[i+1];return t}function Be(e,t){for(;e;){var i=Object.getOwnPropertyDescriptor(e,t);if(i)return i;e=Object.getPrototypeOf(e)}return null}function Ue(e,t,i){var n=Be(t,e);n&&Object.defineProperty(i,e,n)}function Ge(e){e=e||{};for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];if(a){if("object"!=typeof a){Z(5402,a);continue}for(var o in a)o in e||Ue(o,a,e)}}return e}function ke(e){e=e||{};for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];if(a){if("object"!=typeof a){Z(5403,a);continue}for(var o in a)Ue(o,a,e)}}return e}function He(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e.prototype=Object.create(t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),e}function ze(e){var t=e.prototype,i=t&&Object.getPrototypeOf(t);return i&&i.constructor}function Ve(e,t){if(e&&t){if("function"!=typeof e)return!1;if("function"!=typeof t)return!1;if(e===t)return!0;for(;;){if(!(e=ze(e)))return!1;if(e===t)return!0}}return!1}function We(e){for(var t=0,i=Object.keys(e);t<i.length;t++)delete e[i[t]]}function je(e){return"string"!=typeof e||e.startsWith(ve.prefix)}var Xe=Ne(!0),Ke=Ne(!0);function Ye(e,t,i){return function(n,r){if(r.prototype.hasOwnProperty(e)&&delete t[r.prototype[e]],we(r.prototype,e,n),n){var s=t[n];!i&&s&&s!==r?k("A Class already exists with the same "+e+' : "'+n+'".'):t[n]=r}}}var qe=Ye("__cid__",Xe,!1),Qe=Ye("__classname__",Ke,!0);function Ze(e,t){if(Qe(e,t),!t.prototype.hasOwnProperty(Ee)){var i=e||ve.getNewId();i&&qe(i,t)}}function Je(e,t){var i=Ke[t],n=Xe[t],r=!0;if(i&&i!==e&&(k('"'+t+'" has already been set as name or alias of another class.'),r=!1),n&&n!==e&&(k('"'+t+'" has already been set as id or alias of another class.'),r=!1),r){var s=e[ye];s||(s=[],e[ye]=s),s.push(t),Ke[t]=e,Xe[t]=e}}function $e(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(var n=0,r=t;n<r.length;n++){var s=r[n],a=s.prototype,o=a.__cid__;o&&delete Xe[o];var u=a.__classname__;u&&delete Ke[u];var h=a[ye];if(h)for(var c=0;c<h.length;++c){var l=h[c];delete Ke[l],delete Xe[l]}}}function et(e){return tt(e)}function tt(e){return Xe[e]}function it(e){return Ke[e]}function nt(e,t){return rt(e,t)}function rt(e,t){var i;if(t=void 0===t||t,"function"==typeof e&&e.prototype.hasOwnProperty(Ee))return i=e.prototype.__cid__,!t&&m&&je(i)?"":i;if(e&&e.constructor){var n=e.constructor.prototype;if(n&&n.hasOwnProperty(Ee))return i=e.__cid__,!t&&m&&je(i)?"":i}return""}var st=e("cS",function(){var e=t.prototype;function t(e,t){this.count=void 0,this._pool=void 0,this._cleanup=void 0;var i=void 0===t?e:t,n=void 0===t?null:e;this.count=0,this._pool=new Array(i),this._cleanup=n}return e.get=function(){return this._get()},e._get=function(){if(this.count>0){--this.count;var e=this._pool[this.count];return this._pool[this.count]=null,e}return null},e.put=function(e){var t=this._pool;if(this.count<t.length){if(this._cleanup&&!1===this._cleanup(e))return;t[this.count]=e,++this.count}},e.resize=function(e){e>=0&&(this._pool.length=e,this.count>e&&(this.count=e))},t}()),at=e("eH",function(){function e(e){this.i=0,this.array=e}var t=e.prototype;return t.remove=function(e){var t=this.array.indexOf(e);t>=0&&this.removeAt(t)},t.removeAt=function(e){this.array.splice(e,1),e<=this.i&&--this.i},t.fastRemove=function(e){var t=this.array.indexOf(e);t>=0&&this.fastRemoveAt(t)},t.fastRemoveAt=function(e){var t=this.array;t[e]=t[t.length-1],--t.length,e<=this.i&&--this.i},t.push=function(e){this.array.push(e)},n(e,[{key:"length",get:function(){return this.array.length},set:function(e){this.array.length=e,this.i>=e&&(this.i=e-1)}}]),e}());function ot(e,t){e.splice(t,1)}function ut(e,t){var i=e.length;t<0||t>=i||(e[t]=e[i-1],e.length=i-1)}function ht(e,t){var i=e.indexOf(t);return i>=0&&(ot(e,i),!0)}function ct(e,t){var i=e.indexOf(t);i>=0&&(e[i]=e[e.length-1],--e.length)}function lt(e,t){return e.indexOf(t)>=0}var _t=Object.freeze({__proto__:null,removeAt:ot,fastRemoveAt:ut,remove:ht,fastRemove:ct,removeIf:function(e,t){var i=e.findIndex(t);if(i>=0){var n=e[i];return ot(e,i),n}},verifyType:function(e,t){if(e&&e.length>0)for(var i,n=d(e);!(i=n()).done;)if(!(i.value instanceof t))return K(1300),!1;return!0},removeArray:function(e,t){for(var i=0,n=t.length;i<n;i++)ht(e,t[i])},appendObjectsAt:function(e,t,i){return e.splice.apply(e,[i,0].concat(t)),e},contains:lt,copy:function(e){for(var t=e.length,i=new Array(t),n=0;n<t;n+=1)i[n]=e[n];return i},MutableForwardIterator:at}),dt={IDGenerator:ge,Pool:st,array:_t,isNumber:Te,isString:Ae,isEmptyObject:Se,getPropertyDescriptor:Be,addon:Ge,mixin:ke,extend:He,getSuper:ze,isChildClassOf:Ve,clear:We,value:we,getset:Ie,get:be,set:Oe,unregisterClass:$e,getClassName:Ce,setClassName:Ze,setClassAlias:Je,getClassByName:it,getClassById:tt,get _registeredClassNames(){return r({},Ke)},set _registeredClassNames(e){We(Ke),Object.assign(Ke,e)},get _registeredClassIds(){return r({},Xe)},set _registeredClassIds(e){We(Xe),Object.assign(Xe,e)},_getClassId:nt,getClassId:rt,_setClassId:qe,_getClassById:et,obsolete:Me,obsoletes:Pe,formatStr:De,shiftArguments:Fe,createMap:Ne};v.js=dt;var ft=Object.freeze({__proto__:null,array:_t,js:dt,IDGenerator:ge,Pool:st,isNumber:Te,isString:Ae,isEmptyObject:Se,value:we,getset:Ie,get:be,set:Oe,createMap:Ne,getClassName:Ce,obsolete:Me,obsoletes:Pe,formatStr:De,shiftArguments:Fe,getPropertyDescriptor:Be,copyAllProperties:function(e,t,i){for(var n=Object.getOwnPropertyNames(e),r=0,s=n.length;r<s;++r){var a=n[r];-1===i.indexOf(a)&&Ue(a,e,t)}},addon:Ge,mixin:ke,extend:He,getSuper:ze,isChildClassOf:Ve,clear:We,_idToClass:Xe,_nameToClass:Ke,_setClassId:qe,setClassName:Ze,setClassAlias:Je,unregisterClass:$e,_getClassById:et,getClassById:tt,getClassByName:it,_getClassId:nt,getClassId:rt});function pt(e){if("__bitmask__"in e)return e;we(e,"__bitmask__",null,!0);for(var t=-1,i=Object.keys(e),n=0;n<i.length;n++){var r=i[n],s=e[r];if(-1===s)s=++t,e[r]=s;else if("number"==typeof s)t=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&we(e,a,r)}return e}function mt(e){return"__enums__"in e?e:(we(e,"__enums__",null,!0),mt.update(e))}function gt(e){e.hasOwnProperty("__enums__")}function vt(e){gt(e);var t=e.__enums__||[];for(var i in t.length=0,e){var n=e[i];Number.isInteger(n)&&t.push({name:i,value:n})}return t.sort((function(e,t){return e.value-t.value})),e.__enums__=t,t}function yt(e){"__enums__"in e||we(e,"__enums__",null,!0)}e("g5",ft),pt.isBitMask=function(e){return e&&e.hasOwnProperty("__bitmask__")},pt.getList=function(e){if(e.__bitmask__)return e.__bitmask__;var t=e.__bitmask__=[];for(var i in e){var n=e[i];Number.isInteger(n)&&t.push({name:i,value:n})}return t.sort((function(e,t){return e.value-t.value})),t},v.BitMask=pt,mt.update=function(e){for(var t=-1,i=Object.keys(e),n=0;n<i.length;n++){var r=i[n],s=e[r];if(-1===s)s=++t,e[r]=s;else if("number"==typeof s)t=s;else if("string"==typeof s&&Number.isInteger(parseFloat(r)))continue;var a=""+s;r!==a&&we(e,a,r)}return Array.isArray(e.__enums__)&&vt(e),e},mt||(mt=e("dB",{})),mt.isEnum=function(e){return e&&e.hasOwnProperty("__enums__")},mt.getList=function(e){return gt(e),e.__enums__?e.__enums__:vt(e)},mt.sortList=function(e,t){gt(e),Array.isArray(e.__enums__)&&e.__enums__.sort(t)},v.Enum=mt;var Et,Tt=e("eC",function(){function e(){}var t=e.prototype;return t.clone=function(){return Z(100,Ce(this)+".clone"),this},t.equals=function(){return!1},t.set=function(){Z(100,Ce(this)+".set")},t.toString=function(){return""},e}());Ze("cc.ValueType",Tt),v.ValueType=Tt,function(e){e.PATH="path",e.ENGINE="engine",e.ASSETS="assets",e.SCRIPTING="scripting",e.PHYSICS="physics",e.RENDERING="rendering",e.LAUNCH="launch",e.SCREEN="screen",e.SPLASH_SCREEN="splashScreen",e.ANIMATION="animation",e.PROFILING="profiling",e.PLUGINS="plugins",e.XR="xr"}(Et||(Et={}));var At=e("dI",function(){function e(){this._settings={},this._override={}}var t=e.prototype;return t.init=function(e,t){var i=this;for(var n in void 0===e&&(e=""),void 0===t&&(t={}),t){var r=t[n];if(r)for(var s in r)this.overrideSettings(n,s,r[s])}return e?new Promise((function(t,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="text",r.onload=function(){i._settings=JSON.parse(r.response),t()},r.onerror=function(){n(new Error("request settings failed!"))},r.send(null)})):Promise.resolve()},t.overrideSettings=function(e,t,i){e in this._override||(this._override[e]={}),this._override[e][t]=i},t.querySettings=function(e,t){if(e in this._override){var i=this._override[e];if(i&&t in i)return i[t]}if(e in this._settings){var n=this._settings[e];if(n&&t in n)return n[t]}return null},e}());At.Category=Et;var St=e("dH",new At);v.settings=St;var Rt=e("c8",{SUPPORT_TEXTURE_FORMATS:[".astc",".pkm",".pvr",".webp",".jpg",".jpeg",".bmp",".png"],KEY:{none:0,back:6,menu:18,backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,select:41,insert:45,Delete:46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,b:66,c:67,d:68,e:69,f:70,g:71,h:72,i:73,j:74,k:75,l:76,m:77,n:78,o:79,p:80,q:81,r:82,s:83,t:84,u:85,v:86,w:87,x:88,y:89,z:90,num0:96,num1:97,num2:98,num3:99,num4:100,num5:101,num6:102,num7:103,num8:104,num9:105,"*":106,"+":107,"-":109,numdel:110,"/":111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,";":186,semicolon:186,equal:187,"=":187,",":188,comma:188,dash:189,".":190,period:190,forwardslash:191,grave:192,"[":219,openbracket:219,backslash:220,"]":221,closebracket:221,quote:222,dpadLeft:1e3,dpadRight:1001,dpadUp:1003,dpadDown:1004,dpadCenter:1005},RAD:Math.PI/180,DEG:180/Math.PI,REPEAT_FOREVER:Number.MAX_VALUE-1,FLT_EPSILON:1.192092896e-7,ORIENTATION_PORTRAIT:1,ORIENTATION_LANDSCAPE:2,ORIENTATION_AUTO:3,ENABLE_TILEDMAP_CULLING:!0,TOUCH_TIMEOUT:5e3,ENABLE_TRANSPARENT_CANVAS:!1,ENABLE_WEBGL_ANTIALIAS:!0,ENABLE_ANTIALIAS_FXAA:!1,ENABLE_BLOOM:!1,CLEANUP_IMAGE_CACHE:!1,ENABLE_MULTI_TOUCH:!0,MAX_LABEL_CANVAS_POOL_SIZE:20,ENABLE_WEBGL_HIGHP_STRUCT_VALUES:!1,BATCHER2D_MEM_INCREMENT:144,CUSTOM_PIPELINE_NAME:"",init:function(){var e=St.querySettings(At.Category.ENGINE,"macros");if(e)for(var t in e)Rt[t]=e[t]}});v.macro=Rt;for(var wt=/^(?:cc|dragonBones|sp|ccsg)\..+/,It=new Array(123),bt=0;bt<123;++bt)It[bt]=64;for(var Ot=0;Ot<64;++Ot)It["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charCodeAt(Ot)]=Ot;var Nt=It;function Ct(e,t,i){function n(e,t,i,n){var r=Object.getOwnPropertyDescriptor(e,t);if(r)r.get&&(e[i]=r.get),r.set&&n&&(e[n]=r.set);else{var s=e[i];Ie(e,t,s,e[n])}}for(var r,s=e.prototype,a=0;a<t.length;a++){var o=(r=t[a])[0].toUpperCase()+r.slice(1);n(s,r,"get"+o,"set"+o)}for(r in i){var u=i[r];n(s,r,u[0],u[1])}}function Mt(e,t,i,n){var r=e[t];r?Array.isArray(r)?n?(r.push(r[0]),r[0]=i):r.push(i):e[t]=n?[i,r]:[r,i]:e[t]=i}function Pt(e,t){if("function"==typeof e.contains)return e.contains(t);if("function"==typeof e.compareDocumentPosition)return!!(16&e.compareDocumentPosition(t));var i=t.parentNode;if(i)do{if(i===e)return!0;i=i.parentNode}while(null!==i);return!1}function Lt(e){return"object"==typeof window&&"function"==typeof Node?e instanceof Node:!!e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName}function xt(e,t,i){e&&setTimeout((function(){e(t,i)}),0)}function Dt(e){return!(!e||e.constructor!==Object)&&Se(e)}function Ft(e,t,i){if(t>i){var n=t;t=i,i=n}return e<t?t:e<i?e:i}function Bt(e){return e*Rt.RAD}function Ut(e){return e*Rt.DEG}v.misc={BUILTIN_CLASSID_RE:wt,BASE64_VALUES:Nt,propertyDefine:Ct,pushToMap:Mt,contains:Pt,isDomNode:Lt,callInNextTick:xt,isPlainEmptyObj_DEV:Dt,clampf:Ft,degreesToRadians:Bt,radiansToDegrees:Ut},e("g6",Object.freeze({__proto__:null,BUILTIN_CLASSID_RE:wt,BASE64_VALUES:Nt,propertyDefine:Ct,pushToMap:Mt,contains:Pt,isDomNode:Lt,callInNextTick:xt,tryCatchFunctor_EDITOR:function(e){return Function("target","try {\n target."+e+"();\n}\ncatch (e) {\n cc._throw(e);\n}")},isPlainEmptyObj_DEV:Dt,clampf:Ft,degreesToRadians:Bt,radiansToDegrees:Ut}));var Gt="$_$";function kt(e,t){var i=t?Object.create(t):{};return we(e,"__attrs__",i),i}function Ht(e){if("function"!=typeof e)return kt(e,Vt(e.constructor));for(var t,i=v.Class.getInheritanceChain(e),n=i.length-1;n>=0;n--){var r=i[n];r.hasOwnProperty("__attrs__")&&r.__attrs__||kt(r,(t=i[n+1])&&t.__attrs__)}return kt(e,(t=i[0])&&t.__attrs__),e.__attrs__}function zt(e,t){var i=Vt(e),n=t+Gt,r={};for(var s in i)s.startsWith(n)&&(r[s.slice(n.length)]=i[s]);return r}function Vt(e){return e.hasOwnProperty("__attrs__")&&e.__attrs__||Ht(e)}function Wt(e,t,i,n){Vt(e)[t+Gt+i]=n}var jt=function(){function e(e,t){this.name=void 0,this.default=void 0,this.name=e,this.default=t}return e.prototype.toString=function(){return this.name},e}(),Xt=e("ea",new jt("Integer",0));v.Integer=Xt,v.CCInteger=Xt;var Kt=e("ec",new jt("Float",0));v.Float=Kt,v.CCFloat=Kt;var Yt=e("eb",new jt("Boolean",!1));v.Boolean=Yt,v.CCBoolean=Yt;var qt=e("eg",new jt("String",""));function Qt(e,t){return function(i,n){var r='"'+Ce(i)+"."+n+'"',s=zt(i,n),a=s.type;if(a===Xt||a===Kt?a="Number":a!==qt&&a!==Yt||(a=""+a),a===e){if(s.hasOwnProperty("default")){var o=s.default;if(void 0!==o&&!Array.isArray(o)&&!Dt(o)){var u=typeof o,h=e.toLowerCase();if(u===h)if("object"===h){if(!o||o instanceof s.ctor)return;q(3605,r,Ce(s.ctor))}else"Number"!==e&&q(3606,t,r,e);else{if("function"===u)return;e===qt.default&&null==o?q(3607,r):q(3611,t,r,u)}delete s.type}}}else q(3604,r)}}v.String=qt,v.CCString=qt;var Zt=Object.freeze({__proto__:null,DELIMETER:Gt,createAttrsSingle:kt,createAttrs:Ht,attr:zt,getClassAttrs:Vt,setClassAttr:Wt,PrimitiveType:jt,CCInteger:Xt,CCFloat:Kt,CCBoolean:Yt,CCString:qt,getTypeChecker_ET:Qt,getObjTypeChecker_ET:function(e){return function(t,i){Qt("Object","type")(t,i);var n=Vt(t)[i+Gt+"default"],r=v.Class.getDefault(n);if(!Array.isArray(r)&&Ve(e,v.ValueType)){var s=Ce(e),a=De('No need to specify the "type" of "%s.%s" because %s is a child class of ValueType.',Ce(t),i,s);n?U(a):q(3612,a,s,Ce(t),i,s)}}}}),Jt={default:{},serializable:{},editorOnly:{},formerlySerializedAs:{}};function $t(e,t,i,n){if(!e.get&&!e.set&&e.hasOwnProperty("default")){var r="_N$"+t;e.get=function(){return this[r]},e.set=function(e){var t=this[r];this[r]=e,i.call(this,t)};var s={};for(var a in n[r]=s,Jt){var o=Jt[a];e.hasOwnProperty(a)&&(s[a]=e[a],o.canUsedInGet||delete e[a])}}}function ei(e,t,i,n){if(Array.isArray(t)){if(!(t.length>0))return Z(5508,i,n);e.type=t=t[0]}"function"==typeof t&&(t===String?e.type=v.String:t===Boolean?e.type=v.Boolean:t===Number&&(e.type=v.Float))}function ti(e,t,i){var n=e?{_short:!0}:{_short:!0,default:t};return i&&(n.type=i),n}function ii(e,t){if(!e||e.constructor!==Object){if(Array.isArray(e)&&e.length>0)return ti(t,[],e);if("function"==typeof e){var i=e;return ti(t,Ve(i,v.ValueType)?new i:null,i)}return ti(t,e instanceof jt?e.default:e)}return null}var ni,ri=[];function si(){return ri[ri.length-1]}v._RF={push:function(e,t,i,n){void 0===i&&(i=t,t=""),ri.push({uuid:t,script:i,module:e,exports:e.exports,beh:null,importMeta:n})},pop:function(){var e=ri.pop(),t=e.module,i=t.exports;if(i===e.exports){for(var n in i)return;t.exports=i=e.cls}},peek:si},function(e){e[e.STANDALONE=1]="STANDALONE",e[e.IMPLICIT_VISIBLE=2]="IMPLICIT_VISIBLE",e[e.IMPLICIT_SERIALIZABLE=4]="IMPLICIT_SERIALIZABLE"}(ni||(ni={}));var ai=Gt,oi="__ctors__",ui=e("gD","Enum"),hi=e("gE","BitMask");function ci(e,t,i,n){!function(e,t){!function(e,t){e.indexOf(t)<0&&e.push(t)}(e.__props__,t)}(e,i),mi(e,n,t,i)}function li(e,t,i,n){var r=n.get;n.set,r&&(mi(e,n,t,i),Wt(e,i,"serializable",!1))}function _i(e){return"function"==typeof e?e():e}function di(e){var t=e.name,i=e.extends,n=function(e,t,i){var n=v.Component,r=si();if(r&&Ve(t,n)){if(Ve(r.cls,n))return Z(3615),null;e=e||r.script}var s=function(e,t,i){var n=i.ctor;return we(n,oi,!0,!0),n.prototype,t&&(n.$super=t),Ze(e,n),n}(e,t,i);if(r)if(Ve(t,n)){var a=r.uuid;a&&qe(a,s),r.cls=s}else Ve(r.cls,n)||(r.cls=s);return s}(t,i,e);t||(t=v.js.getClassName(n)),n._sealed=!0,i&&(i._sealed=!1),function(e,t,i,n){if(e.__props__=[],n&&n.__props__&&(e.__props__=n.__props__.slice()),i)for(var r in function(e,t){for(var i in e){var n=e[i],r=ii(n,!1);if(r&&(n=e[i]=r),n){var s=n.notify;s&&$t(n,i,s,e),"type"in n&&ei(n,n.type,t,i)}}}(i,t),i){var s=i[r];s.get||s.set?li(e,t,r,s):ci(e,t,r,s)}var a=Vt(e);e.__values__=e.__props__.filter((function(e){return!1!==a[e+ai+"serializable"]}))}(n,t,e.properties,i);var r=e.editor;return r&&Ve(i,v.Component)&&v.Component._registerEditorProps(n,r),n}function fi(e){var t;return null==e||null===(t=e.hasOwnProperty)||void 0===t?void 0:t.call(e,"__values__")}di._isCCClass=function(e){var t;return null==e||null===(t=e.hasOwnProperty)||void 0===t?void 0:t.call(e,oi)},di.fastDefine=function(e,t,i){Ze(e,t);for(var n=t.__props__=t.__values__=Object.keys(i),r=Vt(t),s=0;s<n.length;s++){var a=n[s];r[a+ai+"visible"]=!1,r[a+ai+"default"]=i[a]}},di.Attr=Zt,di.attr=zt,di.isCCClassOrFastDefined=fi,di.getInheritanceChain=function(e){for(var t=[];e=ze(e);)e!==Object&&t.push(e);return t};var pi={Integer:"Number",Float:"Number",Boolean:"Boolean",String:"String"};function mi(e,t,i,n){var r=null,s="";function a(){return s=n+ai,r=Vt(e)}"type"in t&&void 0===t.type&&q(3660,n,i);var o=t.type;o&&(pi[o]?(r||a())[s+"type"]=o:"Object"===o||("object"==typeof o?mt.isEnum(o)?((r||a())[s+"type"]=ui,r[s+"enumList"]=mt.getList(o)):pt.isBitMask(o)&&((r||a())[s+"type"]=hi,r[s+"bitmaskList"]=pt.getList(o)):"function"==typeof o&&((r||a())[s+"type"]="Object",r[s+"ctor"]=o))),"default"in t&&((r||a())[s+"default"]=t.default);var u,h=function(e,i){if(e in t){var n=t[e];typeof n===i&&((r||a())[s+e]=n)}};t.editorOnly&&((r||a())[s+"editorOnly"]=!0),t.__internalFlags&ni.STANDALONE?u=!0===t.serializable||0!=(t.__internalFlags&ni.IMPLICIT_SERIALIZABLE):!1===t.serializable&&(u=!1),void 0!==u&&((r||a())[s+"serializable"]=u),h("formerlySerializedAs","string");var c=t.range;c&&Array.isArray(c)&&c.length>=2&&((r||a())[s+"min"]=c[0],r[s+"max"]=c[1],c.length>2&&(r[s+"step"]=c[2])),h("min","number"),h("max","number"),h("step","number")}di.isArray=function(e){return e=_i(e),Array.isArray(e)},di.getDefault=_i,di.escapeForJS=function(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")},di.IDENTIFIER_RE=/^[A-Za-z_$][0-9A-Za-z_$]*$/,di.getNewValueTypeCode=function(e){for(var t=Ce(e),i=e.constructor,n="new "+t+"(",r=0;r<i.__props__.length;r++)n+=e[i.__props__[r]],r<i.__props__.length-1&&(n+=",");return n+")"},v.Class=di;var gi=Math.PI/180,vi=180/Math.PI,yi=e("fY",.5*Math.PI),Ei=e("fZ",2*Math.PI),Ti=e("cZ",1e-6);function Ai(e,t){return Math.abs(e-t)<=Ti*Math.max(1,Math.abs(e),Math.abs(t))}function Si(e,t,i){return i=i||Ti,Math.abs(e-t)<=i}function Ri(e,t,i){if(t>i){var n=t;t=i,i=n}return e<t?t:e>i?i:e}function wi(e){return e<0?0:e>1?1:e}function Ii(e,t,i){return e+(t-e)*i}function bi(e){return e*gi}function Oi(e){return e*vi}var Ni=e("fh",Math.random);function Ci(e,t){return Math.random()*(t-e)+e}function Mi(e,t){return Math.floor(Ci(e,t))}function Pi(e){return(e=(9301*e+49297)%233280)/233280}function Li(e,t,i){return Pi(e)*(i-t)+t}function xi(e,t,i){return Math.floor(Li(e,t,i))}function Di(e){return I(e)}function Fi(e,t){return e-Math.floor(e/t)*t}function Bi(e,t){return e=Fi(e,2*t),t-Math.abs(e-t)}function Ui(e,t,i){return(i-e)/(t-e)}function Gi(e){return Math.abs(e.x)>Math.abs(e.y)?Math.abs(e.x)>Math.abs(e.z)?e.x:e.z:Math.abs(e.y)>Math.abs(e.z)?e.y:e.z}function ki(e,t){return Math.abs(e)>Math.abs(t)?e:t}function Hi(e,t){t.forEach((function(t){Object.defineProperty(e,t,{enumerable:!0})}))}var zi=e("cJ",function(e){function t(t,i,n,r){var s;return s=e.call(this)||this,t&&"object"==typeof t?(s.x=t.x,s.y=t.y,s.z=t.z,s.w=t.w):(s.x=t||0,s.y=i||0,s.z=n||0,s.w=r||0),s}s(t,e),t.clone=function(e){return new t(e.x,e.y,e.z,e.w)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e},t.set=function(e,t,i,n,r){return e.x=t,e.y=i,e.z=n,e.w=r,e},t.add=function(e,t,i){return e.x=t.x+i.x,e.y=t.y+i.y,e.z=t.z+i.z,e.w=t.w+i.w,e},t.subtract=function(e,t,i){return e.x=t.x-i.x,e.y=t.y-i.y,e.z=t.z-i.z,e.w=t.w-i.w,e},t.multiply=function(e,t,i){return e.x=t.x*i.x,e.y=t.y*i.y,e.z=t.z*i.z,e.w=t.w*i.w,e},t.divide=function(e,t,i){return e.x=t.x/i.x,e.y=t.y/i.y,e.z=t.z/i.z,e.w=t.w/i.w,e},t.ceil=function(e,t){return e.x=Math.ceil(t.x),e.y=Math.ceil(t.y),e.z=Math.ceil(t.z),e.w=Math.ceil(t.w),e},t.floor=function(e,t){return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e.w=Math.floor(t.w),e},t.min=function(e,t,i){return e.x=Math.min(t.x,i.x),e.y=Math.min(t.y,i.y),e.z=Math.min(t.z,i.z),e.w=Math.min(t.w,i.w),e},t.max=function(e,t,i){return e.x=Math.max(t.x,i.x),e.y=Math.max(t.y,i.y),e.z=Math.max(t.z,i.z),e.w=Math.max(t.w,i.w),e},t.round=function(e,t){return e.x=Math.round(t.x),e.y=Math.round(t.y),e.z=Math.round(t.z),e.w=Math.round(t.w),e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e.w=t.w*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e.z=t.z+i.z*n,e.w=t.w+i.w*n,e},t.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z,s=t.w-e.w;return Math.sqrt(i*i+n*n+r*r+s*s)},t.squaredDistance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z,s=t.w-e.w;return i*i+n*n+r*r+s*s},t.len=function(e){var t=e.x,i=e.y,n=e.z,r=e.w;return Math.sqrt(t*t+i*i+n*n+r*r)},t.lengthSqr=function(e){var t=e.x,i=e.y,n=e.z,r=e.w;return t*t+i*i+n*n+r*r},t.negate=function(e,t){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=-t.w,e},t.inverse=function(e,t){return e.x=1/t.x,e.y=1/t.y,e.z=1/t.z,e.w=1/t.w,e},t.inverseSafe=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w;return Math.abs(i)<Ti?e.x=0:e.x=1/i,Math.abs(n)<Ti?e.y=0:e.y=1/n,Math.abs(r)<Ti?e.z=0:e.z=1/r,Math.abs(s)<Ti?e.w=0:e.w=1/s,e},t.normalize=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w,a=i*i+n*n+r*r+s*s;return a>0&&(a=1/Math.sqrt(a),e.x=i*a,e.y=n*a,e.z=r*a,e.w=s*a),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},t.lerp=function(e,t,i,n){return e.x=t.x+n*(i.x-t.x),e.y=t.y+n*(i.y-t.y),e.z=t.z+n*(i.z-t.z),e.w=t.w+n*(i.w-t.w),e},t.random=function(e,t){t=t||1;var i=2*Ni()*Math.PI,n=2*Ni()-1,r=Math.sqrt(1-n*n);return e.x=r*Math.cos(i)*t,e.y=r*Math.sin(i)*t,e.z=n*t,e.w=0,e},t.transformMat4=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w;return e.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,e.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,e.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,e.w=i.m03*n+i.m07*r+i.m11*s+i.m15*a,e},t.transformAffine=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w;return e.x=i.m00*n+i.m04*r+i.m08*s+i.m12*a,e.y=i.m01*n+i.m05*r+i.m09*s+i.m13*a,e.z=i.m02*n+i.m06*r+i.m10*s+i.m14*a,e.w=t.w,e},t.transformQuat=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.x,o=i.y,u=i.z,h=i.w,c=h*n+o*s-u*r,l=h*r+u*n-a*s,_=h*s+a*r-o*n,d=-a*n-o*r-u*s;return e.x=c*h+d*-a+l*-u-_*-o,e.y=l*h+d*-o+_*-a-c*-u,e.z=_*h+d*-u+c*-o-l*-a,e.w=t.w,e},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e[i+2]=t.z,e[i+3]=t.w,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e.z=t[i+2],e.w=t[i+3],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.x-t.x)<=i*Math.max(1,Math.abs(e.x),Math.abs(t.x))&&Math.abs(e.y-t.y)<=i*Math.max(1,Math.abs(e.y),Math.abs(t.y))&&Math.abs(e.z-t.z)<=i*Math.max(1,Math.abs(e.z),Math.abs(t.z))&&Math.abs(e.w-t.w)<=i*Math.max(1,Math.abs(e.w),Math.abs(t.w))};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.z,this.w)},i.set=function(e,t,i,n){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x=e||0,this.y=t||0,this.z=i||0,this.w=n||0),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t*Math.max(1,Math.abs(this.x),Math.abs(e.x))&&Math.abs(this.y-e.y)<=t*Math.max(1,Math.abs(this.y),Math.abs(e.y))&&Math.abs(this.z-e.z)<=t*Math.max(1,Math.abs(this.z),Math.abs(e.z))&&Math.abs(this.w-e.w)<=t*Math.max(1,Math.abs(this.w),Math.abs(e.w))},i.equals4f=function(e,t,i,n,r){return void 0===r&&(r=Ti),Math.abs(this.x-e)<=r*Math.max(1,Math.abs(this.x),Math.abs(e))&&Math.abs(this.y-t)<=r*Math.max(1,Math.abs(this.y),Math.abs(t))&&Math.abs(this.z-i)<=r*Math.max(1,Math.abs(this.z),Math.abs(i))&&Math.abs(this.w-n)<=r*Math.max(1,Math.abs(this.w),Math.abs(n))},i.strictEquals=function(e){return this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},i.strictEquals4f=function(e,t,i,n){return this.x===e&&this.y===t&&this.z===i&&this.w===n},i.lerp=function(e,t){var i=this.x,n=this.y,r=this.z,s=this.w;return this.x=i+t*(e.x-i),this.y=n+t*(e.y-n),this.z=r+t*(e.z-r),this.w=s+t*(e.w-s),this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+", "+this.w.toFixed(2)+")"},i.clampf=function(e,t){return this.x=Ri(this.x,e.x,t.x),this.y=Ri(this.y,e.y,t.y),this.z=Ri(this.z,e.z,t.z),this.w=Ri(this.w,e.w,t.w),this},i.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},i.add4f=function(e,t,i,n){return this.x+=e,this.y+=t,this.z+=i,this.w+=n,this},i.subtract=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},i.subtract4f=function(e,t,i,n){return this.x-=e,this.y-=t,this.z-=i,this.w-=n,this},i.multiplyScalar=function(e){return"object"==typeof e&&console.warn("should use Vec4.multiply for vector * vector operation"),this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},i.multiply=function(e){return"object"!=typeof e&&console.warn("should use Vec4.scale for vector * scalar operation"),this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},i.multiply4f=function(e,t,i,n){return this.x*=e,this.y*=t,this.z*=i,this.w*=n,this},i.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this},i.divide4f=function(e,t,i,n){return this.x/=e,this.y/=t,this.z/=i,this.w/=n,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},i.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},i.cross=function(e){var t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,a=e.z;return this.x=i*a-n*s,this.y=n*r-t*a,this.z=t*s-i*r,this},i.length=function(){var e=this.x,t=this.y,i=this.z,n=this.w;return Math.sqrt(e*e+t*t+i*i+n*n)},i.lengthSqr=function(){var e=this.x,t=this.y,i=this.z,n=this.w;return e*e+t*t+i*i+n*n},i.normalize=function(){var e=this.x,t=this.y,i=this.z,n=this.w,r=e*e+t*t+i*i+n*n;return r>0&&(r=1/Math.sqrt(r),this.x=e*r,this.y=t*r,this.z=i*r,this.w=n*r),this},i.transformMat4=function(e){var t=this.x,i=this.y,n=this.z,r=this.w;return this.x=e.m00*t+e.m04*i+e.m08*n+e.m12*r,this.y=e.m01*t+e.m05*i+e.m09*n+e.m13*r,this.z=e.m02*t+e.m06*i+e.m10*n+e.m14*r,this.w=e.m03*t+e.m07*i+e.m11*n+e.m15*r,this},t}(Tt));function Vi(e,t,i,n){return new zi(e,t,i,n)}zi.ZERO=Object.freeze(new zi(0,0,0,0)),zi.ONE=Object.freeze(new zi(1,1,1,1)),zi.NEG_ONE=Object.freeze(new zi(-1,-1,-1,-1)),di.fastDefine("cc.Vec4",zi,{x:0,y:0,z:0,w:0}),v.Vec4=zi,v.v4=Vi;var Wi,ji,Xi,Ki=e("cq",function(e){function t(t,i,n){var r;return r=e.call(this)||this,t&&"object"==typeof t?(r.x=t.x,r.y=t.y,r.z=t.z):(r.x=t||0,r.y=i||0,r.z=n||0),r}s(t,e),t.zero=function(e){return e.x=0,e.y=0,e.z=0,e},t.clone=function(e){return new t(e.x,e.y,e.z)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e},t.set=function(e,t,i,n){return e.x=t,e.y=i,e.z=n,e},t.add=function(e,t,i){return e.x=t.x+i.x,e.y=t.y+i.y,e.z=t.z+i.z,e},t.subtract=function(e,t,i){return e.x=t.x-i.x,e.y=t.y-i.y,e.z=t.z-i.z,e},t.multiply=function(e,t,i){return e.x=t.x*i.x,e.y=t.y*i.y,e.z=t.z*i.z,e},t.divide=function(e,t,i){return e.x=t.x/i.x,e.y=t.y/i.y,e.z=t.z/i.z,e},t.ceil=function(e,t){return e.x=Math.ceil(t.x),e.y=Math.ceil(t.y),e.z=Math.ceil(t.z),e},t.floor=function(e,t){return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e.z=Math.floor(t.z),e},t.min=function(e,t,i){return e.x=Math.min(t.x,i.x),e.y=Math.min(t.y,i.y),e.z=Math.min(t.z,i.z),e},t.max=function(e,t,i){return e.x=Math.max(t.x,i.x),e.y=Math.max(t.y,i.y),e.z=Math.max(t.z,i.z),e},t.round=function(e,t){return e.x=Math.round(t.x),e.y=Math.round(t.y),e.z=Math.round(t.z),e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e.z=t.z+i.z*n,e},t.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z;return Math.sqrt(i*i+n*n+r*r)},t.squaredDistance=function(e,t){var i=t.x-e.x,n=t.y-e.y,r=t.z-e.z;return i*i+n*n+r*r},t.len=function(e){var t=e.x,i=e.y,n=e.z;return Math.sqrt(t*t+i*i+n*n)},t.lengthSqr=function(e){var t=e.x,i=e.y,n=e.z;return t*t+i*i+n*n},t.negate=function(e,t){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e},t.invert=function(e,t){return e.x=1/t.x,e.y=1/t.y,e.z=1/t.z,e},t.invertSafe=function(e,t){var i=t.x,n=t.y,r=t.z;return Math.abs(i)<Ti?e.x=0:e.x=1/i,Math.abs(n)<Ti?e.y=0:e.y=1/n,Math.abs(r)<Ti?e.z=0:e.z=1/r,e},t.normalize=function(e,t){var i=t.x,n=t.y,r=t.z,s=i*i+n*n+r*r;return s>0&&(s=1/Math.sqrt(s),e.x=i*s,e.y=n*s,e.z=r*s),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},t.cross=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.x,o=i.y,u=i.z;return e.x=r*u-s*o,e.y=s*a-n*u,e.z=n*o-r*a,e},t.lerp=function(e,t,i,n){return e.x=t.x+n*(i.x-t.x),e.y=t.y+n*(i.y-t.y),e.z=t.z+n*(i.z-t.z),e},t.random=function(e,t){t=t||1;var i=2*Ni()*Math.PI,n=2*Ni()-1,r=Math.sqrt(1-n*n);return e.x=r*Math.cos(i)*t,e.y=r*Math.sin(i)*t,e.z=n*t,e},t.transformMat4=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.m03*n+i.m07*r+i.m11*s+i.m15;return a=a?Math.abs(1/a):1,e.x=(i.m00*n+i.m04*r+i.m08*s+i.m12)*a,e.y=(i.m01*n+i.m05*r+i.m09*s+i.m13)*a,e.z=(i.m02*n+i.m06*r+i.m10*s+i.m14)*a,e},t.transformMat4Normal=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=i.m03*n+i.m07*r+i.m11*s;return a=a?Math.abs(1/a):1,e.x=(i.m00*n+i.m04*r+i.m08*s)*a,e.y=(i.m01*n+i.m05*r+i.m09*s)*a,e.z=(i.m02*n+i.m06*r+i.m10*s)*a,e},t.transformMat3=function(e,t,i){var n=t.x,r=t.y,s=t.z;return e.x=n*i.m00+r*i.m03+s*i.m06,e.y=n*i.m01+r*i.m04+s*i.m07,e.z=n*i.m02+r*i.m05+s*i.m08,e},t.transformAffine=function(e,t,i){var n=t.x,r=t.y,s=t.z;return e.x=i.m00*n+i.m04*r+i.m08*s+i.m12,e.y=i.m01*n+i.m05*r+i.m09*s+i.m13,e.z=i.m02*n+i.m06*r+i.m10*s+i.m14,e},t.transformQuat=function(e,t,i){var n=i.w*t.x+i.y*t.z-i.z*t.y,r=i.w*t.y+i.z*t.x-i.x*t.z,s=i.w*t.z+i.x*t.y-i.y*t.x,a=-i.x*t.x-i.y*t.y-i.z*t.z;return e.x=n*i.w+a*-i.x+r*-i.z-s*-i.y,e.y=r*i.w+a*-i.y+s*-i.x-n*-i.z,e.z=s*i.w+a*-i.z+n*-i.y-r*-i.x,e},t.transformRTS=function(e,t,i,n,r){var s=t.x*r.x,a=t.y*r.y,o=t.z*r.z,u=i.w*s+i.y*o-i.z*a,h=i.w*a+i.z*s-i.x*o,c=i.w*o+i.x*a-i.y*s,l=-i.x*s-i.y*a-i.z*o;return e.x=u*i.w+l*-i.x+h*-i.z-c*-i.y+n.x,e.y=h*i.w+l*-i.y+c*-i.x-u*-i.z+n.y,e.z=c*i.w+l*-i.z+u*-i.y-h*-i.x+n.z,e},t.transformInverseRTS=function(e,t,i,n,r){var s=t.x-n.x,a=t.y-n.y,o=t.z-n.z,u=i.w*s-i.y*o+i.z*a,h=i.w*a-i.z*s+i.x*o,c=i.w*o-i.x*a+i.y*s,l=i.x*s+i.y*a+i.z*o;return e.x=(u*i.w+l*i.x+h*i.z-c*i.y)/r.x,e.y=(h*i.w+l*i.y+c*i.x-u*i.z)/r.y,e.z=(c*i.w+l*i.z+u*i.y-h*i.x)/r.z,e},t.rotateX=function(e,t,i,n){var r=t.x-i.x,s=t.y-i.y,a=t.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r,c=s*o-a*u,l=s*u+a*o;return e.x=h+i.x,e.y=c+i.y,e.z=l+i.z,e},t.rotateY=function(e,t,i,n){var r=t.x-i.x,s=t.y-i.y,a=t.z-i.z,o=Math.cos(n),u=Math.sin(n),h=a*u+r*o,c=s,l=a*o-r*u;return e.x=h+i.x,e.y=c+i.y,e.z=l+i.z,e},t.rotateZ=function(e,t,i,n){var r=t.x-i.x,s=t.y-i.y,a=t.z-i.z,o=Math.cos(n),u=Math.sin(n),h=r*o-s*u,c=r*u+s*o,l=a;return e.x=h+i.x,e.y=c+i.y,e.z=l+i.z,e},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e[i+2]=t.z,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e.z=t[i+2],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z},t.equals=function(e,t,i){void 0===i&&(i=Ti);var n=e.x,r=e.y,s=e.z,a=t.x,o=t.y,u=t.z;return Math.abs(n-a)<=i*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(r-o)<=i*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(s-u)<=i*Math.max(1,Math.abs(s),Math.abs(u))},t.angle=function(e,i){t.normalize(Yi,e),t.normalize(qi,i);var n=t.dot(Yi,qi);return n>1?0:n<-1?Math.PI:Math.acos(n)},t.projectOnPlane=function(e,i,n){return t.subtract(e,i,t.project(e,i,n))},t.project=function(e,i,n){var r=t.lengthSqr(n);return r<1e-6?t.set(e,0,0,0):t.multiplyScalar(e,n,t.dot(i,n)/r)};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.z)},i.set=function(e,t,i){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z):(this.x=e||0,this.y=t||0,this.z=i||0),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t&&Math.abs(this.y-e.y)<=t&&Math.abs(this.z-e.z)<=t},i.equals3f=function(e,t,i,n){return void 0===n&&(n=Ti),Math.abs(this.x-e)<=n&&Math.abs(this.y-t)<=n&&Math.abs(this.z-i)<=n},i.strictEquals=function(e){return this.x===e.x&&this.y===e.y&&this.z===e.z},i.strictEquals3f=function(e,t,i){return this.x===e&&this.y===t&&this.z===i},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.z.toFixed(2)+")"},i.lerp=function(e,t){return this.x+=t*(e.x-this.x),this.y+=t*(e.y-this.y),this.z+=t*(e.z-this.z),this},i.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},i.add3f=function(e,t,i){return this.x+=e,this.y+=t,this.z+=i,this},i.subtract=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},i.subtract3f=function(e,t,i){return this.x-=e,this.y-=t,this.z-=i,this},i.multiplyScalar=function(e){return"object"==typeof e&&console.warn("should use Vec3.multiply for vector * vector operation"),this.x*=e,this.y*=e,this.z*=e,this},i.multiply=function(e){return"object"!=typeof e&&console.warn("should use Vec3.scale for vector * scalar operation"),this.x*=e.x,this.y*=e.y,this.z*=e.z,this},i.multiply3f=function(e,t,i){return this.x*=e,this.y*=t,this.z*=i,this},i.divide=function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},i.divide3f=function(e,t,i){return this.x/=e,this.y/=t,this.z/=i,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},i.clampf=function(e,t){return this.x=Ri(this.x,e.x,t.x),this.y=Ri(this.y,e.y,t.y),this.z=Ri(this.z,e.z,t.z),this},i.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},i.cross=function(e){var t=this.x,i=this.y,n=this.z,r=e.x,s=e.y,a=e.z;return this.x=i*a-n*s,this.y=n*r-t*a,this.z=t*s-i*r,this},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z},i.normalize=function(){var e=this.x,t=this.y,i=this.z,n=e*e+t*t+i*i;return n>0&&(n=1/Math.sqrt(n),this.x=e*n,this.y=t*n,this.z=i*n),this},i.transformMat4=function(e){var t=this.x,i=this.y,n=this.z,r=e.m03*t+e.m07*i+e.m11*n+e.m15;return r=r?1/r:1,this.x=(e.m00*t+e.m04*i+e.m08*n+e.m12)*r,this.y=(e.m01*t+e.m05*i+e.m09*n+e.m13)*r,this.z=(e.m02*t+e.m06*i+e.m10*n+e.m14)*r,this},t}(Tt));Ki.UNIT_X=Object.freeze(new Ki(1,0,0)),Ki.UNIT_Y=Object.freeze(new Ki(0,1,0)),Ki.UNIT_Z=Object.freeze(new Ki(0,0,1)),Ki.RIGHT=Object.freeze(new Ki(1,0,0)),Ki.UP=Object.freeze(new Ki(0,1,0)),Ki.FORWARD=Object.freeze(new Ki(0,0,-1)),Ki.ZERO=Object.freeze(new Ki(0,0,0)),Ki.ONE=Object.freeze(new Ki(1,1,1)),Ki.NEG_ONE=Object.freeze(new Ki(-1,-1,-1)),Ki.slerp=(Wi=new Ki,ji=new Ki,Xi=new Ki,function(e,t,i,n){var r=1e-5,s=Ki.len(t),a=Ki.len(i);if(s<r||a<r)return Ki.lerp(e,t,i,n);var o=Ii(s,a,n),u=Ki.dot(t,i)/(s*a);if(u>.99999)return Ki.lerp(e,t,i,n);if(u<-.99999){var h=Ki.multiplyScalar(Wi,t,1/s),c=function(e,t){var i=t.x,n=t.y,r=t.z,s=Math.abs(i),a=Math.abs(n),o=Math.abs(r);return s<a&&s<o?Ki.set(e,0,r,-n):a<o?Ki.set(e,r,0,-i):Ki.set(e,n,-i,0),Ki.normalize(e,e)}(ji,h),l=Math.PI*n;return Ji(Xi,h,c,l),Ki.multiplyScalar(e,Xi,o),e}var _=u,d=Math.acos(_)*n,f=Ki.multiplyScalar(Wi,t,1/s),p=Ki.multiplyScalar(ji,i,1/a);return Ki.scaleAndAdd(Xi,p,f,-_),Ki.normalize(Xi,Xi),Ki.multiplyScalar(Xi,Xi,Math.sin(d)),Ki.scaleAndAdd(Xi,Xi,f,Math.cos(d)),Ki.multiplyScalar(e,Xi,o),e});var Yi=new Ki,qi=new Ki;function Qi(e,t,i){return new Ki(e,t,i)}di.fastDefine("cc.Vec3",Ki,{x:0,y:0,z:0}),v.Vec3=Ki;var Zi,Ji=(Zi={x:0,y:0,z:0,w:0},function(e,t,i,n){var r=.5*n,s=Math.sin(r);return Zi.x=s*i.x,Zi.y=s*i.y,Zi.z=s*i.z,Zi.w=Math.cos(r),Ki.transformQuat(e,t,Zi),e});v.v3=Qi;var $i=1/255,en=e("bu",function(e){function t(t,i,n,r){var s;return(s=e.call(this)||this)._val=0,"string"==typeof t?s.fromHEX(t):void 0!==i?s.set(t,i,n,r):s.set(t),s}s(t,e),t.clone=function(e){var i=new t;return e._val?i._val=e._val:i._val=(e.a<<24>>>0)+(e.b<<16)+(e.g<<8)+e.r,i},t.copy=function(e,t){return e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a,e},t.set=function(e,t,i,n,r){return e.r=t,e.g=i,e.b=n,e.a=r,e},t.toVec4=function(e,t){return(t=void 0!==t?t:new zi).x=nn(e.r),t.y=nn(e.g),t.z=nn(e.b),t.w=nn(e.a),t},t.fromVec4=function(e,i){return(i=void 0===i?new t:i).r=rn(e.x),i.g=rn(e.y),i.b=rn(e.z),i.a=rn(e.w),i},t.fromHEX=function(e,t){t=0===t.indexOf("#")?t.substring(1):t,e.r=parseInt(t.substr(0,2),16)||0,e.g=parseInt(t.substr(2,2),16)||0,e.b=parseInt(t.substr(4,2),16)||0;var i=parseInt(t.substr(6,2),16);return e.a=Number.isNaN(i)?255:i,e._val=(e.a<<24>>>0)+(e.b<<16)+(e.g<<8)+e.r,e},t.add=function(e,t,i){return e.r=t.r+i.r,e.g=t.g+i.g,e.b=t.b+i.b,e.a=t.a+i.a,e},t.subtract=function(e,t,i){return e.r=t.r-i.r,e.g=t.g-i.g,e.b=t.b-i.b,e.a=t.a-i.a,e},t.multiply=function(e,t,i){return e.r=t.r*i.r,e.g=t.g*i.g,e.b=t.b*i.b,e.a=t.a*i.a,e},t.divide=function(e,t,i){return e.r=t.r/i.r,e.g=t.g/i.g,e.b=t.b/i.b,e.a=t.a/i.a,e},t.scale=function(e,t,i){return e.r=t.r*i,e.g=t.g*i,e.b=t.b*i,e.a=t.a*i,e},t.lerp=function(e,t,i,n){var r=t.r,s=t.g,a=t.b,o=t.a;return r+=(i.r-r)*n,s+=(i.g-s)*n,a+=(i.b-a)*n,o+=(i.a-o)*n,e._val=Math.floor((o<<24>>>0)+(a<<16)+(s<<8)+r),e},t.toArray=function(e,i,n){void 0===n&&(n=0);var r=i instanceof t||i.a>1?1/255:1;return e[n+0]=i.r*r,e[n+1]=i.g*r,e[n+2]=i.b*r,e[n+3]=i.a*r,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),t.r=255*e[i+0],t.g=255*e[i+1],t.b=255*e[i+2],t.a=255*e[i+3],t},t.strictEquals=function(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.r-t.r)<=i*Math.max(1,Math.abs(e.r),Math.abs(t.r))&&Math.abs(e.g-t.g)<=i*Math.max(1,Math.abs(e.g),Math.abs(t.g))&&Math.abs(e.b-t.b)<=i*Math.max(1,Math.abs(e.b),Math.abs(t.b))&&Math.abs(e.a-t.a)<=i*Math.max(1,Math.abs(e.a),Math.abs(t.a))},t.hex=function(e){return(255*e.r<<24|255*e.g<<16|255*e.b<<8|255*e.a)>>>0};var i=t.prototype;return i.clone=function(){var e=new t;return e._val=this._val,e},i.equals=function(e){return e&&this._val===e._val},i.lerp=function(e,t){var i=this.r,n=this.g,r=this.b,s=this.a;return i+=(e.r-i)*t,n+=(e.g-n)*t,r+=(e.b-r)*t,s+=(e.a-s)*t,this._val=Math.floor((s<<24>>>0)+(r<<16)+(n<<8)+i),this},i.toString=function(){return"rgba("+this.r.toFixed()+", "+this.g.toFixed()+", "+this.b.toFixed()+", "+this.a.toFixed()+")"},i.toCSS=function(e){return void 0===e&&(e="rgba"),"rgba"===e?"rgba("+this.r+","+this.g+","+this.b+","+(this.a*$i).toFixed(2)+")":"rgb"===e?"rgb("+this.r+","+this.g+","+this.b+")":"#"+this.toHEX(e)},i.fromHEX=function(e){e=0===e.indexOf("#")?e.substring(1):e;var t=parseInt(e.substr(0,2),16)||0,i=parseInt(e.substr(2,2),16)||0,n=parseInt(e.substr(4,2),16)||0,r=parseInt(e.substr(6,2),16);return r=Number.isNaN(r)?255:r,this._val=(r<<24>>>0)+(n<<16)+(i<<8)+(0|t),this},i.toHEX=function(e){void 0===e&&(e="#rrggbb");var t="0",i=[(this.r<16?t:"")+this.r.toString(16),(this.g<16?t:"")+this.g.toString(16),(this.b<16?t:"")+this.b.toString(16)];return"#rgb"===e?(i[0]=i[0][0],i[1]=i[1][0],i[2]=i[2][0]):"#rrggbbaa"===e&&i.push((this.a<16?t:"")+this.a.toString(16)),i.join("")},i.toRGBValue=function(){return 16777215&this._val},i.fromHSV=function(e,t,i){var n=0,r=0,s=0;if(0===t)n=r=s=i;else if(0===i)n=r=s=0;else{1===e&&(e=0),e*=6;var a=Math.floor(e),o=e-a,u=i*(1-t),h=i*(1-t*o),c=i*(1-t*(1-o));switch(a){default:case 0:n=i,r=c,s=u;break;case 1:n=h,r=i,s=u;break;case 2:n=u,r=i,s=c;break;case 3:n=u,r=h,s=i;break;case 4:n=c,r=u,s=i;break;case 5:n=i,r=u,s=h}}return n*=255,r*=255,s*=255,this._val=(this.a<<24>>>0)+(s<<16)+(r<<8)+(0|n),this},i.toHSV=function(){var e=this.r*$i,t=this.g*$i,i=this.b*$i,n={h:0,s:0,v:0},r=Math.max(e,t,i),s=Math.min(e,t,i),a=0;return n.v=r,n.s=r?(r-s)/r:0,n.s?(a=r-s,n.h=e===r?(t-i)/a:t===r?2+(i-e)/a:4+(e-t)/a,n.h/=6,n.h<0&&(n.h+=1)):n.h=0,n},i.set=function(e,t,i,n){return"object"==typeof e?null!=e._val?this._val=e._val:(t=e.g||0,i=e.b||0,n="number"==typeof e.a?e.a:255,e=e.r||0,this._val=(n<<24>>>0)+(i<<16)+(t<<8)+(0|e)):(e=e||0,t=t||0,i=i||0,n="number"==typeof n?n:255,this._val=(n<<24>>>0)+(i<<16)+(t<<8)+(0|e)),this},i.multiply=function(e){var t=(255&this._val)*e.r>>8,i=(65280&this._val)*e.g>>8,n=(16711680&this._val)*e.b>>8,r=((4278190080&this._val)>>>8)*e.a;return this._val=4278190080&r|16711680&n|65280&i|255&t,this},i._set_r_unsafe=function(e){return this._val=(4294967040&this._val|e)>>>0,this},i._set_g_unsafe=function(e){return this._val=(4294902015&this._val|e<<8)>>>0,this},i._set_b_unsafe=function(e){return this._val=(4278255615&this._val|e<<16)>>>0,this},i._set_a_unsafe=function(e){return this._val=(16777215&this._val|e<<24)>>>0,this},n(t,[{key:"r",get:function(){return 255&this._val},set:function(e){e=~~Ri(e,0,255),this._val=(4294967040&this._val|e)>>>0}},{key:"g",get:function(){return(65280&this._val)>>8},set:function(e){e=~~Ri(e,0,255),this._val=(4294902015&this._val|e<<8)>>>0}},{key:"b",get:function(){return(16711680&this._val)>>16},set:function(e){e=~~Ri(e,0,255),this._val=(4278255615&this._val|e<<16)>>>0}},{key:"a",get:function(){return(4278190080&this._val)>>>24},set:function(e){e=~~Ri(e,0,255),this._val=(16777215&this._val|e<<24)>>>0}},{key:"x",get:function(){return this.r*$i},set:function(e){this.r=255*e}},{key:"y",get:function(){return this.g*$i},set:function(e){this.g=255*e}},{key:"z",get:function(){return this.b*$i},set:function(e){this.b=255*e}},{key:"w",get:function(){return this.a*$i},set:function(e){this.a=255*e}}]),t}(Tt));function tn(e,t,i,n){return new en(e,t,i,n)}function nn(e){if((0|e)!==e||e>>>8!=0)throw new RangeError("Value out of 8-bit range");return an[e]}function rn(e){if(e<=0)return 0;var t=an;if(e>=1)return t.length-1;for(var i=0,n=t.length>>>1;0!==n;n>>>=1)t[i|n]<=e&&(i|=n);return e-t[i]<=t[i+1]-e?i:i+1}en.WHITE=Object.freeze(new en(255,255,255,255)),en.GRAY=Object.freeze(new en(127,127,127,255)),en.BLACK=Object.freeze(new en(0,0,0,255)),en.TRANSPARENT=Object.freeze(new en(0,0,0,0)),en.RED=Object.freeze(new en(255,0,0,255)),en.GREEN=Object.freeze(new en(0,255,0,255)),en.BLUE=Object.freeze(new en(0,0,255,255)),en.CYAN=Object.freeze(new en(0,255,255,255)),en.MAGENTA=Object.freeze(new en(255,0,255,255)),en.YELLOW=Object.freeze(new en(255,255,0,255)),di.fastDefine("cc.Color",en,{r:0,g:0,b:0,a:255}),v.Color=en,v.color=tn;for(var sn,an=[],on=0;on<256;on++)an.push((sn=on/255)<=0?0:sn>=1?1:sn<.04045?sn/12.92:Math.pow((sn+.055)/1.055,2.4));function un(e){var t=e.clone();return t.x=Math.floor(e.x),t.y=Math.floor(e.y),t.z=Math.floor(e.z),t}var hn=e("fb",function(e){function t(t,i,n,r,s,a,o,u,h){var c;return void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=1),c=e.call(this)||this,"object"==typeof t?(c.m00=t.m00,c.m01=t.m01,c.m02=t.m02,c.m03=t.m03,c.m04=t.m04,c.m05=t.m05,c.m06=t.m06,c.m07=t.m07,c.m08=t.m08):(c.m00=t,c.m01=i,c.m02=n,c.m03=r,c.m04=s,c.m05=a,c.m06=o,c.m07=u,c.m08=h),c}s(t,e),t.clone=function(e){return new t(e.m00,e.m01,e.m02,e.m03,e.m04,e.m05,e.m06,e.m07,e.m08)},t.copy=function(e,t){return e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e},t.set=function(e,t,i,n,r,s,a,o,u,h){return e.m00=t,e.m01=i,e.m02=n,e.m03=r,e.m04=s,e.m05=a,e.m06=o,e.m07=u,e.m08=h,e},t.identity=function(e){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=1,e.m05=0,e.m06=0,e.m07=0,e.m08=1,e},t.transpose=function(e,t){if(e===t){var i=t.m01,n=t.m02,r=t.m05;e.m01=t.m03,e.m02=t.m06,e.m03=i,e.m05=t.m07,e.m06=n,e.m07=r}else e.m00=t.m00,e.m01=t.m03,e.m02=t.m06,e.m03=t.m01,e.m04=t.m04,e.m05=t.m07,e.m06=t.m02,e.m07=t.m05,e.m08=t.m08;return e},t.invert=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=c*a-o*h,_=-c*s+o*u,d=h*s-a*u,f=i*l+n*_+r*d;return 0===f?(e.m00=0,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=0,e.m06=0,e.m07=0,e.m08=0,e):(f=1/f,e.m00=l*f,e.m01=(-c*n+r*h)*f,e.m02=(o*n-r*a)*f,e.m03=_*f,e.m04=(c*i-r*u)*f,e.m05=(-o*i+r*s)*f,e.m06=d*f,e.m07=(-h*i+n*u)*f,e.m08=(a*i-n*s)*f,e)},t.determinant=function(e){var t=e.m00,i=e.m01,n=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,h=e.m08;return t*(h*s-a*u)+i*(-h*r+a*o)+n*(u*r-s*o)},t.multiply=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m03,m=i.m04,g=i.m05,v=i.m06,y=i.m07,E=i.m08;return e.m00=_*n+d*a+f*h,e.m01=_*r+d*o+f*c,e.m02=_*s+d*u+f*l,e.m03=p*n+m*a+g*h,e.m04=p*r+m*o+g*c,e.m05=p*s+m*u+g*l,e.m06=v*n+y*a+E*h,e.m07=v*r+y*o+E*c,e.m08=v*s+y*u+E*l,e},t.multiplyMat4=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=i.m00,d=i.m01,f=i.m02,p=i.m04,m=i.m05,g=i.m06,v=i.m08,y=i.m09,E=i.m10;return e.m00=_*n+d*a+f*h,e.m01=_*r+d*o+f*c,e.m02=_*s+d*u+f*l,e.m03=p*n+m*a+g*h,e.m04=p*r+m*o+g*c,e.m05=p*s+m*u+g*l,e.m06=v*n+y*a+E*h,e.m07=v*r+y*o+E*c,e.m08=v*s+y*u+E*l,e},t.transform=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=i.x,d=i.y;return e.m00=n,e.m01=r,e.m02=s,e.m03=a,e.m04=o,e.m05=u,e.m06=_*n+d*a+h,e.m07=_*r+d*o+c,e.m08=_*s+d*u+l,e},t.scale=function(e,t,i){var n=i.x,r=i.y;return e.m00=n*t.m00,e.m01=n*t.m01,e.m02=n*t.m02,e.m03=r*t.m03,e.m04=r*t.m04,e.m05=r*t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e},t.rotate=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=Math.sin(i),d=Math.cos(i);return e.m00=d*n+_*a,e.m01=d*r+_*o,e.m02=d*s+_*u,e.m03=d*a-_*n,e.m04=d*o-_*r,e.m05=d*u-_*s,e.m06=h,e.m07=c,e.m08=l,e},t.fromMat4=function(e,t){return e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m04,e.m04=t.m05,e.m05=t.m06,e.m06=t.m08,e.m07=t.m09,e.m08=t.m10,e},t.fromViewUp=function(e,i,n){return Ki.lengthSqr(i)<Ti*Ti?(t.identity(e),e):(n=n||Ki.UNIT_Y,Ki.normalize(cn,Ki.cross(cn,n,i)),Ki.lengthSqr(cn)<Ti*Ti?(t.identity(e),e):(Ki.cross(ln,i,cn),t.set(e,cn.x,cn.y,cn.z,ln.x,ln.y,ln.z,i.x,i.y,i.z),e))},t.fromTranslation=function(e,t){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=1,e.m05=0,e.m06=t.x,e.m07=t.y,e.m08=1,e},t.fromScaling=function(e,t){return e.m00=t.x,e.m01=0,e.m02=0,e.m03=0,e.m04=t.y,e.m05=0,e.m06=0,e.m07=0,e.m08=1,e},t.fromRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=n,e.m01=i,e.m02=0,e.m03=-i,e.m04=n,e.m05=0,e.m06=0,e.m07=0,e.m08=1,e},t.fromQuat=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w,a=i+i,o=n+n,u=r+r,h=i*a,c=n*a,l=n*o,_=r*a,d=r*o,f=r*u,p=s*a,m=s*o,g=s*u;return e.m00=1-l-f,e.m03=c-g,e.m06=_+m,e.m01=c+g,e.m04=1-h-f,e.m07=d-p,e.m02=_-m,e.m05=d+p,e.m08=1-h-l,e},t.inverseTransposeMat4=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=t.m09,_=t.m10,d=t.m11,f=t.m12,p=t.m13,m=t.m14,g=t.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,A=n*h-s*o,S=r*h-s*u,R=c*p-l*f,w=c*m-_*f,I=c*g-d*f,b=l*m-_*p,O=l*g-d*p,N=_*g-d*m,C=v*N-y*O+E*b+T*I-A*w+S*R;return C?(C=1/C,e.m00=(o*N-u*O+h*b)*C,e.m01=(u*I-a*N-h*w)*C,e.m02=(a*O-o*I+h*R)*C,e.m03=(r*O-n*N-s*b)*C,e.m04=(i*N-r*I+s*w)*C,e.m05=(n*I-i*O-s*R)*C,e.m06=(p*S-m*A+g*T)*C,e.m07=(m*E-f*S-g*y)*C,e.m08=(f*A-p*E+g*v)*C,e):null},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.m00,e[i+1]=t.m01,e[i+2]=t.m02,e[i+3]=t.m03,e[i+4]=t.m04,e[i+5]=t.m05,e[i+6]=t.m06,e[i+7]=t.m07,e[i+8]=t.m08,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.m00=t[i+0],e.m01=t[i+1],e.m02=t[i+2],e.m03=t[i+3],e.m04=t[i+4],e.m05=t[i+5],e.m06=t[i+6],e.m07=t[i+7],e.m08=t[i+8],e},t.add=function(e,t,i){return e.m00=t.m00+i.m00,e.m01=t.m01+i.m01,e.m02=t.m02+i.m02,e.m03=t.m03+i.m03,e.m04=t.m04+i.m04,e.m05=t.m05+i.m05,e.m06=t.m06+i.m06,e.m07=t.m07+i.m07,e.m08=t.m08+i.m08,e},t.subtract=function(e,t,i){return e.m00=t.m00-i.m00,e.m01=t.m01-i.m01,e.m02=t.m02-i.m02,e.m03=t.m03-i.m03,e.m04=t.m04-i.m04,e.m05=t.m05-i.m05,e.m06=t.m06-i.m06,e.m07=t.m07-i.m07,e.m08=t.m08-i.m08,e},t.multiplyScalar=function(e,t,i){return e.m00=t.m00*i,e.m01=t.m01*i,e.m02=t.m02*i,e.m03=t.m03*i,e.m04=t.m04*i,e.m05=t.m05*i,e.m06=t.m06*i,e.m07=t.m07*i,e.m08=t.m08*i,e},t.multiplyScalarAndAdd=function(e,t,i,n){return e.m00=i.m00*n+t.m00,e.m01=i.m01*n+t.m01,e.m02=i.m02*n+t.m02,e.m03=i.m03*n+t.m03,e.m04=i.m04*n+t.m04,e.m05=i.m05*n+t.m05,e.m06=i.m06*n+t.m06,e.m07=i.m07*n+t.m07,e.m08=i.m08*n+t.m08,e},t.strictEquals=function(e,t){return e.m00===t.m00&&e.m01===t.m01&&e.m02===t.m02&&e.m03===t.m03&&e.m04===t.m04&&e.m05===t.m05&&e.m06===t.m06&&e.m07===t.m07&&e.m08===t.m08},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.m00-t.m00)<=i*Math.max(1,Math.abs(e.m00),Math.abs(t.m00))&&Math.abs(e.m01-t.m01)<=i*Math.max(1,Math.abs(e.m01),Math.abs(t.m01))&&Math.abs(e.m02-t.m02)<=i*Math.max(1,Math.abs(e.m02),Math.abs(t.m02))&&Math.abs(e.m03-t.m03)<=i*Math.max(1,Math.abs(e.m03),Math.abs(t.m03))&&Math.abs(e.m04-t.m04)<=i*Math.max(1,Math.abs(e.m04),Math.abs(t.m04))&&Math.abs(e.m05-t.m05)<=i*Math.max(1,Math.abs(e.m05),Math.abs(t.m05))&&Math.abs(e.m06-t.m06)<=i*Math.max(1,Math.abs(e.m06),Math.abs(t.m06))&&Math.abs(e.m07-t.m07)<=i*Math.max(1,Math.abs(e.m07),Math.abs(t.m07))&&Math.abs(e.m08-t.m08)<=i*Math.max(1,Math.abs(e.m08),Math.abs(t.m08))},t.toEuler=function(e,t){var i=e.m00,n=e.m01,r=(e.m02,e.m03),s=e.m04,a=(e.m05,e.m06),o=e.m07,u=e.m08;return o<.999?o>-.999?(t.x=Math.asin(-o),t.y=Math.atan2(a,u),t.z=Math.atan2(n,s),!0):(t.x=yi,t.y=Math.atan2(r,i),t.z=0,!1):(t.x=-yi,t.y=Math.atan2(-r,i),t.z=0,!1)};var i=t.prototype;return i.clone=function(){var e=this;return new t(e.m00,e.m01,e.m02,e.m03,e.m04,e.m05,e.m06,e.m07,e.m08)},i.set=function(e,t,i,n,r,s,a,o,u){return void 0===e&&(e=1),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),"object"==typeof e?(this.m00=e.m00,this.m01=e.m01,this.m02=e.m02,this.m03=e.m03,this.m04=e.m04,this.m05=e.m05,this.m06=e.m06,this.m07=e.m07,this.m08=e.m08):(this.m00=e,this.m01=t,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=u),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.m00-e.m00)<=t*Math.max(1,Math.abs(this.m00),Math.abs(e.m00))&&Math.abs(this.m01-e.m01)<=t*Math.max(1,Math.abs(this.m01),Math.abs(e.m01))&&Math.abs(this.m02-e.m02)<=t*Math.max(1,Math.abs(this.m02),Math.abs(e.m02))&&Math.abs(this.m03-e.m03)<=t*Math.max(1,Math.abs(this.m03),Math.abs(e.m03))&&Math.abs(this.m04-e.m04)<=t*Math.max(1,Math.abs(this.m04),Math.abs(e.m04))&&Math.abs(this.m05-e.m05)<=t*Math.max(1,Math.abs(this.m05),Math.abs(e.m05))&&Math.abs(this.m06-e.m06)<=t*Math.max(1,Math.abs(this.m06),Math.abs(e.m06))&&Math.abs(this.m07-e.m07)<=t*Math.max(1,Math.abs(this.m07),Math.abs(e.m07))&&Math.abs(this.m08-e.m08)<=t*Math.max(1,Math.abs(this.m08),Math.abs(e.m08))},i.strictEquals=function(e){return this.m00===e.m00&&this.m01===e.m01&&this.m02===e.m02&&this.m03===e.m03&&this.m04===e.m04&&this.m05===e.m05&&this.m06===e.m06&&this.m07===e.m07&&this.m08===e.m08},i.toString=function(){var e=this;return"[\n"+e.m00+", "+e.m01+", "+e.m02+",\n"+e.m03+",\n"+e.m04+", "+e.m05+",\n"+e.m06+", "+e.m07+",\n"+e.m08+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=1,this.m05=0,this.m06=0,this.m07=0,this.m08=1,this},i.transpose=function(){var e=this.m01,t=this.m02,i=this.m05;return this.m01=this.m03,this.m02=this.m06,this.m03=e,this.m05=this.m07,this.m06=t,this.m07=i,this},i.invert=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=u*r-s*o,c=-u*n+s*a,l=o*n-r*a,_=e*h+t*c+i*l;return 0===_?(this.set(0,0,0,0,0,0,0,0,0),this):(_=1/_,this.m00=h*_,this.m01=(-u*t+i*o)*_,this.m02=(s*t-i*r)*_,this.m03=c*_,this.m04=(u*e-i*a)*_,this.m05=(-s*e+i*n)*_,this.m06=l*_,this.m07=(-o*e+t*a)*_,this.m08=(r*e-t*n)*_,this)},i.determinant=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08;return e*(u*r-s*o)+t*(-u*n+s*a)+i*(o*n-r*a)},i.add=function(e){return this.m00+=e.m00,this.m01+=e.m01,this.m02+=e.m02,this.m03+=e.m03,this.m04+=e.m04,this.m05+=e.m05,this.m06+=e.m06,this.m07+=e.m07,this.m08+=e.m08,this},i.subtract=function(e){return this.m00-=e.m00,this.m01-=e.m01,this.m02-=e.m02,this.m03-=e.m03,this.m04-=e.m04,this.m05-=e.m05,this.m06-=e.m06,this.m07-=e.m07,this.m08-=e.m08,this},i.multiply=function(e){var t=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,c=e.m00,l=e.m01,_=e.m02,d=e.m03,f=e.m04,p=e.m05,m=e.m06,g=e.m07,v=e.m08;return this.m00=c*t+l*r+_*o,this.m01=c*i+l*s+_*u,this.m02=c*n+l*a+_*h,this.m03=d*t+f*r+p*o,this.m04=d*i+f*s+p*u,this.m05=d*n+f*a+p*h,this.m06=m*t+g*r+v*o,this.m07=m*i+g*s+v*u,this.m08=m*n+g*a+v*h,this},i.multiplyScalar=function(e){return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=e,this.m05*=e,this.m06*=e,this.m07*=e,this.m08*=e,this},i.scale=function(e){var t=e.x,i=e.y;return this.m00=t*this.m00,this.m01=t*this.m01,this.m02=t*this.m02,this.m03=i*this.m03,this.m04=i*this.m04,this.m05=i*this.m05,this.m06=this.m06,this.m07=this.m07,this.m08=this.m08,this},i.rotate=function(e){var t=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,c=Math.sin(e),l=Math.cos(e);return this.m00=l*t+c*r,this.m01=l*i+c*s,this.m02=l*n+c*a,this.m03=l*r-c*t,this.m04=l*s-c*i,this.m05=l*a-c*n,this.m06=o,this.m07=u,this.m08=h,this},i.fromQuat=function(e){var t=e.x,i=e.y,n=e.z,r=e.w,s=t+t,a=i+i,o=n+n,u=t*s,h=i*s,c=i*a,l=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-c-d,this.m03=h-m,this.m06=l+p,this.m01=h+m,this.m04=1-u-d,this.m07=_-f,this.m02=l-p,this.m05=_+f,this.m08=1-u-c,this},t}(Tt));hn.IDENTITY=Object.freeze(new hn);var cn=new Ki,ln=new Ki;di.fastDefine("cc.Mat3",hn,{m00:1,m01:0,m02:0,m03:0,m04:1,m05:0,m06:0,m07:0,m08:1}),v.Mat3=hn;var _n=e("cv",function(e){function t(t,i,n,r){var s;return s=e.call(this)||this,t&&"object"==typeof t?(s.x=t.x,s.y=t.y,s.z=t.z,s.w=t.w):(s.x=t||0,s.y=i||0,s.z=n||0,s.w=null!=r?r:1),s}s(t,e),t.clone=function(e){return new t(e.x,e.y,e.z,e.w)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e},t.set=function(e,t,i,n,r){return e.x=t,e.y=i,e.z=n,e.w=r,e},t.identity=function(e){return e.x=0,e.y=0,e.z=0,e.w=1,e},t.rotationTo=function(e,i,n){var r=Ki.dot(i,n);return r<-.999999?(Ki.cross(pn,Ki.UNIT_X,i),pn.length()<1e-6&&Ki.cross(pn,Ki.UNIT_Y,i),Ki.normalize(pn,pn),t.fromAxisAngle(e,pn,Math.PI),e):r>.999999?(e.x=0,e.y=0,e.z=0,e.w=1,e):(Ki.cross(pn,i,n),e.x=pn.x,e.y=pn.y,e.z=pn.z,e.w=1+r,t.normalize(e,e))},t.getAxisAngle=function(e,t){var i=2*Math.acos(t.w),n=Math.sin(i/2);return 0!==n?(e.x=t.x/n,e.y=t.y/n,e.z=t.z/n):(e.x=1,e.y=0,e.z=0),i},t.multiply=function(e,t,i){var n=t.x*i.w+t.w*i.x+t.y*i.z-t.z*i.y,r=t.y*i.w+t.w*i.y+t.z*i.x-t.x*i.z,s=t.z*i.w+t.w*i.z+t.x*i.y-t.y*i.x,a=t.w*i.w-t.x*i.x-t.y*i.y-t.z*i.z;return e.x=n,e.y=r,e.z=s,e.w=a,e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e.w=t.w*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e.z=t.z+i.z*n,e.w=t.w+i.w*n,e},t.rotateX=function(e,t,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r+u*n,e.y=a*r+o*n,e.z=o*r-a*n,e.w=u*r-s*n,e},t.rotateY=function(e,t,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r-o*n,e.y=a*r+u*n,e.z=o*r+s*n,e.w=u*r-a*n,e},t.rotateZ=function(e,t,i){i*=.5;var n=Math.sin(i),r=Math.cos(i),s=t.x,a=t.y,o=t.z,u=t.w;return e.x=s*r+a*n,e.y=a*r-s*n,e.z=o*r+u*n,e.w=u*r-o*n,e},t.rotateAround=function(e,i,n,r){return t.invert(dn,i),Ki.transformQuat(pn,n,dn),t.fromAxisAngle(dn,pn,r),t.multiply(e,i,dn),e},t.rotateAroundLocal=function(e,i,n,r){return t.fromAxisAngle(dn,n,r),t.multiply(e,i,dn),e},t.calculateW=function(e,t){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=Math.sqrt(Math.abs(1-t.x*t.x-t.y*t.y-t.z*t.z)),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},t.lerp=function(e,t,i,n){return e.x=t.x+n*(i.x-t.x),e.y=t.y+n*(i.y-t.y),e.z=t.z+n*(i.z-t.z),e.w=t.w+n*(i.w-t.w),e},t.slerp=function(e,t,i,n){var r=0,s=0,a=i.x,o=i.y,u=i.z,h=i.w,c=t.x*i.x+t.y*i.y+t.z*i.z+t.w*i.w;if(c<0&&(c=-c,a=-a,o=-o,u=-u,h=-h),1-c>1e-6){var l=Math.acos(c),_=Math.sin(l);r=Math.sin((1-n)*l)/_,s=Math.sin(n*l)/_}else r=1-n,s=n;return e.x=r*t.x+s*a,e.y=r*t.y+s*o,e.z=r*t.z+s*u,e.w=r*t.w+s*h,e},t.sqlerp=function(e,i,n,r,s,a){return t.slerp(dn,i,s,a),t.slerp(fn,n,r,a),t.slerp(e,dn,fn,2*a*(1-a)),e},t.invert=function(e,t){var i=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w,n=i?1/i:0;return e.x=-t.x*n,e.y=-t.y*n,e.z=-t.z*n,e.w=t.w*n,e},t.conjugate=function(e,t){return e.x=-t.x,e.y=-t.y,e.z=-t.z,e.w=t.w,e},t.len=function(e){return Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w)},t.lengthSqr=function(e){return e.x*e.x+e.y*e.y+e.z*e.z+e.w*e.w},t.normalize=function(e,t){var i=t.x*t.x+t.y*t.y+t.z*t.z+t.w*t.w;return i>0&&(i=1/Math.sqrt(i),e.x=t.x*i,e.y=t.y*i,e.z=t.z*i,e.w=t.w*i),e},t.fromAxes=function(e,i,n,r){return hn.set(mn,i.x,i.y,i.z,n.x,n.y,n.z,r.x,r.y,r.z),t.normalize(e,t.fromMat3(e,mn))},t.fromViewUp=function(e,i,n){return hn.fromViewUp(mn,i,n),t.normalize(e,t.fromMat3(e,mn))},t.fromAxisAngle=function(e,t,i){i*=.5;var n=Math.sin(i);return e.x=n*t.x,e.y=n*t.y,e.z=n*t.z,e.w=Math.cos(i),e},t.fromMat3=function(e,t){var i=t.m00,n=t.m03,r=t.m06,s=t.m01,a=t.m04,o=t.m07,u=t.m02,h=t.m05,c=t.m08,l=i+a+c;if(l>0){var _=.5/Math.sqrt(l+1);e.w=.25/_,e.x=(h-o)*_,e.y=(r-u)*_,e.z=(s-n)*_}else if(i>a&&i>c){var d=2*Math.sqrt(1+i-a-c);e.w=(h-o)/d,e.x=.25*d,e.y=(n+s)/d,e.z=(r+u)/d}else if(a>c){var f=2*Math.sqrt(1+a-i-c);e.w=(r-u)/f,e.x=(n+s)/f,e.y=.25*f,e.z=(o+h)/f}else{var p=2*Math.sqrt(1+c-i-a);e.w=(s-n)/p,e.x=(r+u)/p,e.y=(o+h)/p,e.z=.25*p}return e},t.fromEuler=function(e,t,i,n){t*=gn,i*=gn,n*=gn;var r=Math.sin(t),s=Math.cos(t),a=Math.sin(i),o=Math.cos(i),u=Math.sin(n),h=Math.cos(n);return e.x=r*o*h+s*a*u,e.y=s*a*h+r*o*u,e.z=s*o*u-r*a*h,e.w=s*o*h-r*a*u,e},t.fromAngleZ=function(e,t){return t*=gn,e.x=e.y=0,e.z=Math.sin(t),e.w=Math.cos(t),e},t.toAxisX=function(e,t){var i=2*t.y,n=2*t.z;return e.x=1-i*t.y-n*t.z,e.y=i*t.x+n*t.w,e.z=n*t.x+i*t.w,e},t.toAxisY=function(e,t){var i=2*t.x,n=2*t.y,r=2*t.z;return e.x=n*t.x-r*t.w,e.y=1-i*t.x-r*t.z,e.z=r*t.y+i*t.w,e},t.toAxisZ=function(e,t){var i=2*t.x,n=2*t.y,r=2*t.z;return e.x=r*t.x-n*t.w,e.y=r*t.y-i*t.w,e.z=1-i*t.x-n*t.y,e},t.toEuler=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=0,u=0,h=0,c=n*r+s*a;if(c>.499999)o=0,u=Oi(2*Math.atan2(n,a)),h=90;else if(c<-.499999)o=0,u=-Oi(2*Math.atan2(n,a)),h=-90;else{var l=n*n,_=r*r,d=s*s;o=Oi(Math.atan2(2*n*a-2*r*s,1-2*l-2*d)),u=Oi(Math.atan2(2*r*a-2*n*s,1-2*_-2*d)),h=Oi(Math.asin(2*c)),i&&(o=-180*Math.sign(o+1e-6)+o,u=-180*Math.sign(u+1e-6)+u,h=180*Math.sign(h+1e-6)-h)}return e.x=o,e.y=u,e.z=h,e},t.toEulerInYXZOrder=function(e,t){hn.fromQuat(mn,t),hn.toEuler(mn,e),e.x=Oi(e.x),e.y=Oi(e.y),e.z=Oi(e.z)},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e[i+2]=t.z,e[i+3]=t.w,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e.z=t[i+2],e.w=t[i+3],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.x-t.x)<=i*Math.max(1,Math.abs(e.x),Math.abs(t.x))&&Math.abs(e.y-t.y)<=i*Math.max(1,Math.abs(e.y),Math.abs(t.y))&&Math.abs(e.z-t.z)<=i*Math.max(1,Math.abs(e.z),Math.abs(t.z))&&Math.abs(e.w-t.w)<=i*Math.max(1,Math.abs(e.w),Math.abs(t.w))};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.z,this.w)},i.set=function(e,t,i,n){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w):(this.x=e||0,this.y=t||0,this.z=i||0,this.w=null!=n?n:1),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t*Math.max(1,Math.abs(this.x),Math.abs(e.x))&&Math.abs(this.y-e.y)<=t*Math.max(1,Math.abs(this.y),Math.abs(e.y))&&Math.abs(this.z-e.z)<=t*Math.max(1,Math.abs(this.z),Math.abs(e.z))&&Math.abs(this.w-e.w)<=t*Math.max(1,Math.abs(this.w),Math.abs(e.w))},i.strictEquals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},i.getEulerAngles=function(e){return t.toEuler(e,this)},i.lerp=function(e,t){return this.x+=t*(e.x-this.x),this.y+=t*(e.y-this.y),this.z+=t*(e.z-this.z),this.w+=t*(e.w-this.w),this},i.slerp=function(e,i){return t.slerp(this,this,e,i)},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t}(Tt));_n.IDENTITY=Object.freeze(new _n);var dn=new _n,fn=new _n,pn=new Ki,mn=new hn,gn=.5*Math.PI/180;function vn(e,t,i,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),new _n(e,t,i,n)}di.fastDefine("cc.Quat",_n,{x:0,y:0,z:0,w:1}),v.Quat=_n,v.quat=vn;var yn=e("fw",Object.freeze([Object.freeze([1,0,0,1]),Object.freeze([0,1,-1,0]),Object.freeze([-1,0,0,-1]),Object.freeze([0,-1,1,0])])),En=e("bs",function(e){function t(t,i,n,r,s,a,o,u,h,c,l,_,d,f,p,m){var g;return void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=0),void 0===l&&(l=1),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===m&&(m=1),g=e.call(this)||this,"object"==typeof t?(g.m00=t.m00,g.m01=t.m01,g.m02=t.m02,g.m03=t.m03,g.m04=t.m04,g.m05=t.m05,g.m06=t.m06,g.m07=t.m07,g.m08=t.m08,g.m09=t.m09,g.m10=t.m10,g.m11=t.m11,g.m12=t.m12,g.m13=t.m13,g.m14=t.m14,g.m15=t.m15):(g.m00=t,g.m01=i,g.m02=n,g.m03=r,g.m04=s,g.m05=a,g.m06=o,g.m07=u,g.m08=h,g.m09=c,g.m10=l,g.m11=_,g.m12=d,g.m13=f,g.m14=p,g.m15=m),g}s(t,e),t.clone=function(e){return new t(e.m00,e.m01,e.m02,e.m03,e.m04,e.m05,e.m06,e.m07,e.m08,e.m09,e.m10,e.m11,e.m12,e.m13,e.m14,e.m15)},t.copy=function(e,t){return e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e.m09=t.m09,e.m10=t.m10,e.m11=t.m11,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15,e},t.set=function(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p,m){return e.m00=t,e.m01=i,e.m02=n,e.m03=r,e.m04=s,e.m05=a,e.m06=o,e.m07=u,e.m08=h,e.m09=c,e.m10=l,e.m11=_,e.m12=d,e.m13=f,e.m14=p,e.m15=m,e},t.identity=function(e){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=1,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=1,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.transpose=function(e,t){if(e===t){var i=t.m01,n=t.m02,r=t.m03,s=t.m06,a=t.m07,o=t.m11;e.m01=t.m04,e.m02=t.m08,e.m03=t.m12,e.m04=i,e.m06=t.m09,e.m07=t.m13,e.m08=n,e.m09=s,e.m11=t.m14,e.m12=r,e.m13=a,e.m14=o}else e.m00=t.m00,e.m01=t.m04,e.m02=t.m08,e.m03=t.m12,e.m04=t.m01,e.m05=t.m05,e.m06=t.m09,e.m07=t.m13,e.m08=t.m02,e.m09=t.m06,e.m10=t.m10,e.m11=t.m14,e.m12=t.m03,e.m13=t.m07,e.m14=t.m11,e.m15=t.m15;return e},t.invert=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=t.m09,_=t.m10,d=t.m11,f=t.m12,p=t.m13,m=t.m14,g=t.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,A=n*h-s*o,S=r*h-s*u,R=c*p-l*f,w=c*m-_*f,I=c*g-d*f,b=l*m-_*p,O=l*g-d*p,N=_*g-d*m,C=v*N-y*O+E*b+T*I-A*w+S*R;return 0===C?(e.m00=0,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=0,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=0,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=0,e):(C=1/C,e.m00=(o*N-u*O+h*b)*C,e.m01=(r*O-n*N-s*b)*C,e.m02=(p*S-m*A+g*T)*C,e.m03=(_*A-l*S-d*T)*C,e.m04=(u*I-a*N-h*w)*C,e.m05=(i*N-r*I+s*w)*C,e.m06=(m*E-f*S-g*y)*C,e.m07=(c*S-_*E+d*y)*C,e.m08=(a*O-o*I+h*R)*C,e.m09=(n*I-i*O-s*R)*C,e.m10=(f*A-p*E+g*v)*C,e.m11=(l*E-c*A-d*v)*C,e.m12=(o*w-a*b-u*R)*C,e.m13=(i*b-n*w+r*R)*C,e.m14=(p*y-f*T-m*v)*C,e.m15=(c*T-l*y+_*v)*C,e)},t.determinant=function(e){var t=e.m00,i=e.m01,n=e.m02,r=e.m03,s=e.m04,a=e.m05,o=e.m06,u=e.m07,h=e.m08,c=e.m09,l=e.m10,_=e.m11,d=e.m12,f=e.m13,p=e.m14,m=e.m15;return(t*a-i*s)*(l*m-_*p)-(t*o-n*s)*(c*m-_*f)+(t*u-r*s)*(c*p-l*f)+(i*o-n*a)*(h*m-_*d)-(i*u-r*a)*(h*p-l*d)+(n*u-r*o)*(h*f-c*d)},t.multiply=function(e,t,i){var n=t.m00,r=t.m01,s=t.m02,a=t.m03,o=t.m04,u=t.m05,h=t.m06,c=t.m07,l=t.m08,_=t.m09,d=t.m10,f=t.m11,p=t.m12,m=t.m13,g=t.m14,v=t.m15,y=i.m00,E=i.m01,T=i.m02,A=i.m03;return e.m00=y*n+E*o+T*l+A*p,e.m01=y*r+E*u+T*_+A*m,e.m02=y*s+E*h+T*d+A*g,e.m03=y*a+E*c+T*f+A*v,y=i.m04,E=i.m05,T=i.m06,A=i.m07,e.m04=y*n+E*o+T*l+A*p,e.m05=y*r+E*u+T*_+A*m,e.m06=y*s+E*h+T*d+A*g,e.m07=y*a+E*c+T*f+A*v,y=i.m08,E=i.m09,T=i.m10,A=i.m11,e.m08=y*n+E*o+T*l+A*p,e.m09=y*r+E*u+T*_+A*m,e.m10=y*s+E*h+T*d+A*g,e.m11=y*a+E*c+T*f+A*v,y=i.m12,E=i.m13,T=i.m14,A=i.m15,e.m12=y*n+E*o+T*l+A*p,e.m13=y*r+E*u+T*_+A*m,e.m14=y*s+E*h+T*d+A*g,e.m15=y*a+E*c+T*f+A*v,e},t.transform=function(e,t,i){var n=i.x,r=i.y,s=i.z;if(t===e)e.m12=t.m00*n+t.m04*r+t.m08*s+t.m12,e.m13=t.m01*n+t.m05*r+t.m09*s+t.m13,e.m14=t.m02*n+t.m06*r+t.m10*s+t.m14,e.m15=t.m03*n+t.m07*r+t.m11*s+t.m15;else{var a=t.m00,o=t.m01,u=t.m02,h=t.m03,c=t.m04,l=t.m05,_=t.m06,d=t.m07,f=t.m08,p=t.m09,m=t.m10,g=t.m11;t.m12,t.m13,t.m14,t.m15,e.m00=a,e.m01=o,e.m02=u,e.m03=h,e.m04=c,e.m05=l,e.m06=_,e.m07=d,e.m08=f,e.m09=p,e.m10=m,e.m11=g,e.m12=a*n+c*r+f*s+t.m12,e.m13=o*n+l*r+p*s+t.m13,e.m14=u*n+_*r+m*s+t.m14,e.m15=h*n+d*r+g*s+t.m15}return e},t.translate=function(e,t,i){return t===e?(e.m12+=i.x,e.m13+=i.y,e.m14+=i.z):(e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m08=t.m08,e.m09=t.m09,e.m10=t.m10,e.m11=t.m11,e.m12+=i.x,e.m13+=i.y,e.m14+=i.z,e.m15=t.m15),e},t.scale=function(e,t,i){var n=i.x,r=i.y,s=i.z;return e.m00=t.m00*n,e.m01=t.m01*n,e.m02=t.m02*n,e.m03=t.m03*n,e.m04=t.m04*r,e.m05=t.m05*r,e.m06=t.m06*r,e.m07=t.m07*r,e.m08=t.m08*s,e.m09=t.m09*s,e.m10=t.m10*s,e.m11=t.m11*s,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15,e},t.rotate=function(e,t,i,n){var r=n.x,s=n.y,a=n.z,o=Math.sqrt(r*r+s*s+a*a);if(Math.abs(o)<Ti)return null;r*=o=1/o,s*=o,a*=o;var u=Math.sin(i),h=Math.cos(i),c=1-h,l=t.m00,_=t.m01,d=t.m02,f=t.m03,p=t.m04,m=t.m05,g=t.m06,v=t.m07,y=t.m08,E=t.m09,T=t.m10,A=t.m11,S=r*r*c+h,R=s*r*c+a*u,w=a*r*c-s*u,I=r*s*c-a*u,b=s*s*c+h,O=a*s*c+r*u,N=r*a*c+s*u,C=s*a*c-r*u,M=a*a*c+h;return e.m00=l*S+p*R+y*w,e.m01=_*S+m*R+E*w,e.m02=d*S+g*R+T*w,e.m03=f*S+v*R+A*w,e.m04=l*I+p*b+y*O,e.m05=_*I+m*b+E*O,e.m06=d*I+g*b+T*O,e.m07=f*I+v*b+A*O,e.m08=l*N+p*C+y*M,e.m09=_*N+m*C+E*M,e.m10=d*N+g*C+T*M,e.m11=f*N+v*C+A*M,t!==e&&(e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e},t.rotateX=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t.m04,a=t.m05,o=t.m06,u=t.m07,h=t.m08,c=t.m09,l=t.m10,_=t.m11;return t!==e&&(e.m00=t.m00,e.m01=t.m01,e.m02=t.m02,e.m03=t.m03,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e.m04=s*r+h*n,e.m05=a*r+c*n,e.m06=o*r+l*n,e.m07=u*r+_*n,e.m08=h*r-s*n,e.m09=c*r-a*n,e.m10=l*r-o*n,e.m11=_*r-u*n,e},t.rotateY=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t.m00,a=t.m01,o=t.m02,u=t.m03,h=t.m08,c=t.m09,l=t.m10,_=t.m11;return t!==e&&(e.m04=t.m04,e.m05=t.m05,e.m06=t.m06,e.m07=t.m07,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e.m00=s*r-h*n,e.m01=a*r-c*n,e.m02=o*r-l*n,e.m03=u*r-_*n,e.m08=s*n+h*r,e.m09=a*n+c*r,e.m10=o*n+l*r,e.m11=u*n+_*r,e},t.rotateZ=function(e,t,i){var n=Math.sin(i),r=Math.cos(i),s=t.m00,a=t.m01,o=t.m02,u=t.m03,h=t.m04,c=t.m05,l=t.m06,_=t.m07;return t!==e&&(e.m08=t.m08,e.m09=t.m09,e.m10=t.m10,e.m11=t.m11,e.m12=t.m12,e.m13=t.m13,e.m14=t.m14,e.m15=t.m15),e.m00=s*r+h*n,e.m01=a*r+c*n,e.m02=o*r+l*n,e.m03=u*r+_*n,e.m04=h*r-s*n,e.m05=c*r-a*n,e.m06=l*r-o*n,e.m07=_*r-u*n,e},t.fromTranslation=function(e,t){return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=1,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=1,e.m11=0,e.m12=t.x,e.m13=t.y,e.m14=t.z,e.m15=1,e},t.fromScaling=function(e,t){return e.m00=t.x,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=t.y,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=t.z,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromRotation=function(e,t,i){var n=i.x,r=i.y,s=i.z,a=Math.sqrt(n*n+r*r+s*s);if(Math.abs(a)<Ti)return null;n*=a=1/a,r*=a,s*=a;var o=Math.sin(t),u=Math.cos(t),h=1-u;return e.m00=n*n*h+u,e.m01=r*n*h+s*o,e.m02=s*n*h-r*o,e.m03=0,e.m04=n*r*h-s*o,e.m05=r*r*h+u,e.m06=s*r*h+n*o,e.m07=0,e.m08=n*s*h+r*o,e.m09=r*s*h-n*o,e.m10=s*s*h+u,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromXRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=1,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=n,e.m06=i,e.m07=0,e.m08=0,e.m09=-i,e.m10=n,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromYRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=n,e.m01=0,e.m02=-i,e.m03=0,e.m04=0,e.m05=1,e.m06=0,e.m07=0,e.m08=i,e.m09=0,e.m10=n,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromZRotation=function(e,t){var i=Math.sin(t),n=Math.cos(t);return e.m00=n,e.m01=i,e.m02=0,e.m03=0,e.m04=-i,e.m05=n,e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=1,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.fromRT=function(e,t,i){var n=t.x,r=t.y,s=t.z,a=t.w,o=n+n,u=r+r,h=s+s,c=n*o,l=n*u,_=n*h,d=r*u,f=r*h,p=s*h,m=a*o,g=a*u,v=a*h;return e.m00=1-(d+p),e.m01=l+v,e.m02=_-g,e.m03=0,e.m04=l-v,e.m05=1-(c+p),e.m06=f+m,e.m07=0,e.m08=_+g,e.m09=f-m,e.m10=1-(c+d),e.m11=0,e.m12=i.x,e.m13=i.y,e.m14=i.z,e.m15=1,e},t.getTranslation=function(e,t){return e.x=t.m12,e.y=t.m13,e.z=t.m14,e},t.getScaling=function(e,t){var i=An.m00=t.m00,n=An.m01=t.m01,r=An.m02=t.m02,s=An.m03=t.m04,a=An.m04=t.m05,o=An.m05=t.m06,u=An.m06=t.m08,h=An.m07=t.m09,c=An.m08=t.m10;return e.x=Math.sqrt(i*i+n*n+r*r),e.y=Math.sqrt(s*s+a*a+o*o),e.z=Math.sqrt(u*u+h*h+c*c),hn.determinant(An)<0&&(e.x*=-1),e},t.getRotation=function(e,t){var i=t.m00+t.m05+t.m10,n=0;return i>0?(n=2*Math.sqrt(i+1),e.w=.25*n,e.x=(t.m06-t.m09)/n,e.y=(t.m08-t.m02)/n,e.z=(t.m01-t.m04)/n):t.m00>t.m05&&t.m00>t.m10?(n=2*Math.sqrt(1+t.m00-t.m05-t.m10),e.w=(t.m06-t.m09)/n,e.x=.25*n,e.y=(t.m01+t.m04)/n,e.z=(t.m08+t.m02)/n):t.m05>t.m10?(n=2*Math.sqrt(1+t.m05-t.m00-t.m10),e.w=(t.m08-t.m02)/n,e.x=(t.m01+t.m04)/n,e.y=.25*n,e.z=(t.m06+t.m09)/n):(n=2*Math.sqrt(1+t.m10-t.m00-t.m05),e.w=(t.m01-t.m04)/n,e.x=(t.m08+t.m02)/n,e.y=(t.m06+t.m09)/n,e.z=.25*n),e},t.toRTS=function(e,t,i,n){var r=Ki.set(Tn,e.m00,e.m01,e.m02).length(),s=Ki.set(Tn,e.m04,e.m05,e.m06).length(),a=Ki.set(Tn,e.m08,e.m09,e.m10).length();n&&(n.x=r,n.y=s,n.z=a),i&&Ki.set(i,e.m12,e.m13,e.m14),t&&(An.m00=e.m00/r,An.m01=e.m01/r,An.m02=e.m02/r,An.m03=e.m04/s,An.m04=e.m05/s,An.m05=e.m06/s,An.m06=e.m08/a,An.m07=e.m09/a,An.m08=e.m10/a,hn.determinant(An)<0&&(n&&(n.x*=-1),An.m00*=-1,An.m01*=-1,An.m02*=-1),_n.fromMat3(t,An))},t.fromRTS=function(e,t,i,n){var r=t.x,s=t.y,a=t.z,o=t.w,u=r+r,h=s+s,c=a+a,l=r*u,_=r*h,d=r*c,f=s*h,p=s*c,m=a*c,g=o*u,v=o*h,y=o*c,E=n.x,T=n.y,A=n.z;return e.m00=(1-(f+m))*E,e.m01=(_+y)*E,e.m02=(d-v)*E,e.m03=0,e.m04=(_-y)*T,e.m05=(1-(l+m))*T,e.m06=(p+g)*T,e.m07=0,e.m08=(d+v)*A,e.m09=(p-g)*A,e.m10=(1-(l+f))*A,e.m11=0,e.m12=i.x,e.m13=i.y,e.m14=i.z,e.m15=1,e},t.fromRTSOrigin=function(e,t,i,n,r){var s=t.x,a=t.y,o=t.z,u=t.w,h=s+s,c=a+a,l=o+o,_=s*h,d=s*c,f=s*l,p=a*c,m=a*l,g=o*l,v=u*h,y=u*c,E=u*l,T=n.x,A=n.y,S=n.z,R=r.x,w=r.y,I=r.z;return e.m00=(1-(p+g))*T,e.m01=(d+E)*T,e.m02=(f-y)*T,e.m03=0,e.m04=(d-E)*A,e.m05=(1-(_+g))*A,e.m06=(m+v)*A,e.m07=0,e.m08=(f+y)*S,e.m09=(m-v)*S,e.m10=(1-(_+p))*S,e.m11=0,e.m12=i.x+R-(e.m00*R+e.m04*w+e.m08*I),e.m13=i.y+w-(e.m01*R+e.m05*w+e.m09*I),e.m14=i.z+I-(e.m02*R+e.m06*w+e.m10*I),e.m15=1,e},t.fromQuat=function(e,t){var i=t.x,n=t.y,r=t.z,s=t.w,a=i+i,o=n+n,u=r+r,h=i*a,c=n*a,l=n*o,_=r*a,d=r*o,f=r*u,p=s*a,m=s*o,g=s*u;return e.m00=1-l-f,e.m01=c+g,e.m02=_-m,e.m03=0,e.m04=c-g,e.m05=1-h-f,e.m06=d+p,e.m07=0,e.m08=_+m,e.m09=d-p,e.m10=1-h-l,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e},t.frustum=function(e,t,i,n,r,s,a){var o=1/(i-t),u=1/(r-n),h=1/(s-a);return e.m00=2*s*o,e.m01=0,e.m02=0,e.m03=0,e.m04=0,e.m05=2*s*u,e.m06=0,e.m07=0,e.m08=(i+t)*o,e.m09=(r+n)*u,e.m10=(a+s)*h,e.m11=-1,e.m12=0,e.m13=0,e.m14=a*s*2*h,e.m15=0,e},t.perspective=function(e,t,i,n,r,s,a,o,u){void 0===s&&(s=!0),void 0===a&&(a=-1),void 0===o&&(o=1),void 0===u&&(u=0);var h=1/Math.tan(t/2),c=1/(n-r),l=s?h/i:h,_=(s?h:h*i)*o,d=yn[u];return e.m00=l*d[0],e.m01=l*d[1],e.m02=0,e.m03=0,e.m04=_*d[2],e.m05=_*d[3],e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=(r-a*n)*c,e.m11=-1,e.m12=0,e.m13=0,e.m14=r*n*c*(1-a),e.m15=0,e},t.ortho=function(e,t,i,n,r,s,a,o,u,h){void 0===o&&(o=-1),void 0===u&&(u=1),void 0===h&&(h=0);var c=1/(t-i),l=1/(n-r)*u,_=1/(s-a),d=-2*c,f=-2*l,p=(t+i)*c,m=(r+n)*l,g=yn[h];return e.m00=d*g[0],e.m01=d*g[1],e.m02=0,e.m03=0,e.m04=f*g[2],e.m05=f*g[3],e.m06=0,e.m07=0,e.m08=0,e.m09=0,e.m10=_*(1-o),e.m11=0,e.m12=p*g[0]+m*g[2],e.m13=p*g[1]+m*g[3],e.m14=(s-o*a)*_,e.m15=1,e},t.lookAt=function(e,t,i,n){var r=t.x,s=t.y,a=t.z,o=n.x,u=n.y,h=n.z,c=r-i.x,l=s-i.y,_=a-i.z,d=1/Math.sqrt(c*c+l*l+_*_),f=u*(_*=d)-h*(l*=d),p=h*(c*=d)-o*_,m=o*l-u*c,g=l*(m*=d=1/Math.sqrt(f*f+p*p+m*m))-_*(p*=d),v=_*(f*=d)-c*m,y=c*p-l*f;return e.m00=f,e.m01=g,e.m02=c,e.m03=0,e.m04=p,e.m05=v,e.m06=l,e.m07=0,e.m08=m,e.m09=y,e.m10=_,e.m11=0,e.m12=-(f*r+p*s+m*a),e.m13=-(g*r+v*s+y*a),e.m14=-(c*r+l*s+_*a),e.m15=1,e},t.inverseTranspose=function(e,t){var i=t.m00,n=t.m01,r=t.m02,s=t.m03,a=t.m04,o=t.m05,u=t.m06,h=t.m07,c=t.m08,l=t.m09,_=t.m10,d=t.m11,f=t.m12,p=t.m13,m=t.m14,g=t.m15,v=i*o-n*a,y=i*u-r*a,E=i*h-s*a,T=n*u-r*o,A=n*h-s*o,S=r*h-s*u,R=c*p-l*f,w=c*m-_*f,I=c*g-d*f,b=l*m-_*p,O=l*g-d*p,N=_*g-d*m,C=v*N-y*O+E*b+T*I-A*w+S*R;return C?(C=1/C,e.m00=(o*N-u*O+h*b)*C,e.m01=(u*I-a*N-h*w)*C,e.m02=(a*O-o*I+h*R)*C,e.m03=0,e.m04=(r*O-n*N-s*b)*C,e.m05=(i*N-r*I+s*w)*C,e.m06=(n*I-i*O-s*R)*C,e.m07=0,e.m08=(p*S-m*A+g*T)*C,e.m09=(m*E-f*S-g*y)*C,e.m10=(f*A-p*E+g*v)*C,e.m11=0,e.m12=0,e.m13=0,e.m14=0,e.m15=1,e):null},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.m00,e[i+1]=t.m01,e[i+2]=t.m02,e[i+3]=t.m03,e[i+4]=t.m04,e[i+5]=t.m05,e[i+6]=t.m06,e[i+7]=t.m07,e[i+8]=t.m08,e[i+9]=t.m09,e[i+10]=t.m10,e[i+11]=t.m11,e[i+12]=t.m12,e[i+13]=t.m13,e[i+14]=t.m14,e[i+15]=t.m15,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.m00=t[i+0],e.m01=t[i+1],e.m02=t[i+2],e.m03=t[i+3],e.m04=t[i+4],e.m05=t[i+5],e.m06=t[i+6],e.m07=t[i+7],e.m08=t[i+8],e.m09=t[i+9],e.m10=t[i+10],e.m11=t[i+11],e.m12=t[i+12],e.m13=t[i+13],e.m14=t[i+14],e.m15=t[i+15],e},t.add=function(e,t,i){return e.m00=t.m00+i.m00,e.m01=t.m01+i.m01,e.m02=t.m02+i.m02,e.m03=t.m03+i.m03,e.m04=t.m04+i.m04,e.m05=t.m05+i.m05,e.m06=t.m06+i.m06,e.m07=t.m07+i.m07,e.m08=t.m08+i.m08,e.m09=t.m09+i.m09,e.m10=t.m10+i.m10,e.m11=t.m11+i.m11,e.m12=t.m12+i.m12,e.m13=t.m13+i.m13,e.m14=t.m14+i.m14,e.m15=t.m15+i.m15,e},t.subtract=function(e,t,i){return e.m00=t.m00-i.m00,e.m01=t.m01-i.m01,e.m02=t.m02-i.m02,e.m03=t.m03-i.m03,e.m04=t.m04-i.m04,e.m05=t.m05-i.m05,e.m06=t.m06-i.m06,e.m07=t.m07-i.m07,e.m08=t.m08-i.m08,e.m09=t.m09-i.m09,e.m10=t.m10-i.m10,e.m11=t.m11-i.m11,e.m12=t.m12-i.m12,e.m13=t.m13-i.m13,e.m14=t.m14-i.m14,e.m15=t.m15-i.m15,e},t.multiplyScalar=function(e,t,i){return e.m00=t.m00*i,e.m01=t.m01*i,e.m02=t.m02*i,e.m03=t.m03*i,e.m04=t.m04*i,e.m05=t.m05*i,e.m06=t.m06*i,e.m07=t.m07*i,e.m08=t.m08*i,e.m09=t.m09*i,e.m10=t.m10*i,e.m11=t.m11*i,e.m12=t.m12*i,e.m13=t.m13*i,e.m14=t.m14*i,e.m15=t.m15*i,e},t.multiplyScalarAndAdd=function(e,t,i,n){return e.m00=t.m00+i.m00*n,e.m01=t.m01+i.m01*n,e.m02=t.m02+i.m02*n,e.m03=t.m03+i.m03*n,e.m04=t.m04+i.m04*n,e.m05=t.m05+i.m05*n,e.m06=t.m06+i.m06*n,e.m07=t.m07+i.m07*n,e.m08=t.m08+i.m08*n,e.m09=t.m09+i.m09*n,e.m10=t.m10+i.m10*n,e.m11=t.m11+i.m11*n,e.m12=t.m12+i.m12*n,e.m13=t.m13+i.m13*n,e.m14=t.m14+i.m14*n,e.m15=t.m15+i.m15*n,e},t.strictEquals=function(e,t){return e.m00===t.m00&&e.m01===t.m01&&e.m02===t.m02&&e.m03===t.m03&&e.m04===t.m04&&e.m05===t.m05&&e.m06===t.m06&&e.m07===t.m07&&e.m08===t.m08&&e.m09===t.m09&&e.m10===t.m10&&e.m11===t.m11&&e.m12===t.m12&&e.m13===t.m13&&e.m14===t.m14&&e.m15===t.m15},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.m00-t.m00)<=i*Math.max(1,Math.abs(e.m00),Math.abs(t.m00))&&Math.abs(e.m01-t.m01)<=i*Math.max(1,Math.abs(e.m01),Math.abs(t.m01))&&Math.abs(e.m02-t.m02)<=i*Math.max(1,Math.abs(e.m02),Math.abs(t.m02))&&Math.abs(e.m03-t.m03)<=i*Math.max(1,Math.abs(e.m03),Math.abs(t.m03))&&Math.abs(e.m04-t.m04)<=i*Math.max(1,Math.abs(e.m04),Math.abs(t.m04))&&Math.abs(e.m05-t.m05)<=i*Math.max(1,Math.abs(e.m05),Math.abs(t.m05))&&Math.abs(e.m06-t.m06)<=i*Math.max(1,Math.abs(e.m06),Math.abs(t.m06))&&Math.abs(e.m07-t.m07)<=i*Math.max(1,Math.abs(e.m07),Math.abs(t.m07))&&Math.abs(e.m08-t.m08)<=i*Math.max(1,Math.abs(e.m08),Math.abs(t.m08))&&Math.abs(e.m09-t.m09)<=i*Math.max(1,Math.abs(e.m09),Math.abs(t.m09))&&Math.abs(e.m10-t.m10)<=i*Math.max(1,Math.abs(e.m10),Math.abs(t.m10))&&Math.abs(e.m11-t.m11)<=i*Math.max(1,Math.abs(e.m11),Math.abs(t.m11))&&Math.abs(e.m12-t.m12)<=i*Math.max(1,Math.abs(e.m12),Math.abs(t.m12))&&Math.abs(e.m13-t.m13)<=i*Math.max(1,Math.abs(e.m13),Math.abs(t.m13))&&Math.abs(e.m14-t.m14)<=i*Math.max(1,Math.abs(e.m14),Math.abs(t.m14))&&Math.abs(e.m15-t.m15)<=i*Math.max(1,Math.abs(e.m15),Math.abs(t.m15))};var i=t.prototype;return i.clone=function(){return new t(this.m00,this.m01,this.m02,this.m03,this.m04,this.m05,this.m06,this.m07,this.m08,this.m09,this.m10,this.m11,this.m12,this.m13,this.m14,this.m15)},i.set=function(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p){return void 0===e&&(e=1),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),"object"==typeof e?(this.m01=e.m01,this.m02=e.m02,this.m03=e.m03,this.m04=e.m04,this.m05=e.m05,this.m06=e.m06,this.m07=e.m07,this.m08=e.m08,this.m09=e.m09,this.m10=e.m10,this.m11=e.m11,this.m12=e.m12,this.m13=e.m13,this.m14=e.m14,this.m15=e.m15,this.m00=e.m00):(this.m01=t,this.m02=i,this.m03=n,this.m04=r,this.m05=s,this.m06=a,this.m07=o,this.m08=u,this.m09=h,this.m10=c,this.m11=l,this.m12=_,this.m13=d,this.m14=f,this.m15=p,this.m00=e),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.m00-e.m00)<=t*Math.max(1,Math.abs(this.m00),Math.abs(e.m00))&&Math.abs(this.m01-e.m01)<=t*Math.max(1,Math.abs(this.m01),Math.abs(e.m01))&&Math.abs(this.m02-e.m02)<=t*Math.max(1,Math.abs(this.m02),Math.abs(e.m02))&&Math.abs(this.m03-e.m03)<=t*Math.max(1,Math.abs(this.m03),Math.abs(e.m03))&&Math.abs(this.m04-e.m04)<=t*Math.max(1,Math.abs(this.m04),Math.abs(e.m04))&&Math.abs(this.m05-e.m05)<=t*Math.max(1,Math.abs(this.m05),Math.abs(e.m05))&&Math.abs(this.m06-e.m06)<=t*Math.max(1,Math.abs(this.m06),Math.abs(e.m06))&&Math.abs(this.m07-e.m07)<=t*Math.max(1,Math.abs(this.m07),Math.abs(e.m07))&&Math.abs(this.m08-e.m08)<=t*Math.max(1,Math.abs(this.m08),Math.abs(e.m08))&&Math.abs(this.m09-e.m09)<=t*Math.max(1,Math.abs(this.m09),Math.abs(e.m09))&&Math.abs(this.m10-e.m10)<=t*Math.max(1,Math.abs(this.m10),Math.abs(e.m10))&&Math.abs(this.m11-e.m11)<=t*Math.max(1,Math.abs(this.m11),Math.abs(e.m11))&&Math.abs(this.m12-e.m12)<=t*Math.max(1,Math.abs(this.m12),Math.abs(e.m12))&&Math.abs(this.m13-e.m13)<=t*Math.max(1,Math.abs(this.m13),Math.abs(e.m13))&&Math.abs(this.m14-e.m14)<=t*Math.max(1,Math.abs(this.m14),Math.abs(e.m14))&&Math.abs(this.m15-e.m15)<=t*Math.max(1,Math.abs(this.m15),Math.abs(e.m15))},i.strictEquals=function(e){return this.m00===e.m00&&this.m01===e.m01&&this.m02===e.m02&&this.m03===e.m03&&this.m04===e.m04&&this.m05===e.m05&&this.m06===e.m06&&this.m07===e.m07&&this.m08===e.m08&&this.m09===e.m09&&this.m10===e.m10&&this.m11===e.m11&&this.m12===e.m12&&this.m13===e.m13&&this.m14===e.m14&&this.m15===e.m15},i.toString=function(){return"[\n"+this.m00+", "+this.m01+", "+this.m02+", "+this.m03+",\n"+this.m04+", "+this.m05+", "+this.m06+", "+this.m07+",\n"+this.m08+", "+this.m09+", "+this.m10+", "+this.m11+",\n"+this.m12+", "+this.m13+", "+this.m14+", "+this.m15+"\n]"},i.identity=function(){return this.m00=1,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=1,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=1,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},i.zero=function(){return this.m00=0,this.m01=0,this.m02=0,this.m03=0,this.m04=0,this.m05=0,this.m06=0,this.m07=0,this.m08=0,this.m09=0,this.m10=0,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=0,this},i.transpose=function(){var e=this.m01,t=this.m02,i=this.m03,n=this.m06,r=this.m07,s=this.m11;return this.m01=this.m04,this.m02=this.m08,this.m03=this.m12,this.m04=e,this.m06=this.m09,this.m07=this.m13,this.m08=t,this.m09=n,this.m11=this.m14,this.m12=i,this.m13=r,this.m14=s,this},i.invert=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15,m=e*s-t*r,g=e*a-i*r,v=e*o-n*r,y=t*a-i*s,E=t*o-n*s,T=i*o-n*a,A=u*d-h*_,S=u*f-c*_,R=u*p-l*_,w=h*f-c*d,I=h*p-l*d,b=c*p-l*f,O=m*b-g*I+v*w+y*R-E*S+T*A;return 0===O?(this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this):(O=1/O,this.m00=(s*b-a*I+o*w)*O,this.m01=(i*I-t*b-n*w)*O,this.m02=(d*T-f*E+p*y)*O,this.m03=(c*E-h*T-l*y)*O,this.m04=(a*R-r*b-o*S)*O,this.m05=(e*b-i*R+n*S)*O,this.m06=(f*v-_*T-p*g)*O,this.m07=(u*T-c*v+l*g)*O,this.m08=(r*I-s*R+o*A)*O,this.m09=(t*R-e*I-n*A)*O,this.m10=(_*E-d*v+p*m)*O,this.m11=(h*v-u*E-l*m)*O,this.m12=(s*S-r*w-a*A)*O,this.m13=(e*w-t*S+i*A)*O,this.m14=(d*g-_*y-f*m)*O,this.m15=(u*y-h*g+c*m)*O,this)},i.determinant=function(){var e=this.m00,t=this.m01,i=this.m02,n=this.m03,r=this.m04,s=this.m05,a=this.m06,o=this.m07,u=this.m08,h=this.m09,c=this.m10,l=this.m11,_=this.m12,d=this.m13,f=this.m14,p=this.m15;return(e*s-t*r)*(c*p-l*f)-(e*a-i*r)*(h*p-l*d)+(e*o-n*r)*(h*f-c*d)+(t*a-i*s)*(u*p-l*_)-(t*o-n*s)*(u*f-c*_)+(i*o-n*a)*(u*d-h*_)},i.add=function(e){return this.m00+=e.m00,this.m01+=e.m01,this.m02+=e.m02,this.m03+=e.m03,this.m04+=e.m04,this.m05+=e.m05,this.m06+=e.m06,this.m07+=e.m07,this.m08+=e.m08,this.m09+=e.m09,this.m10+=e.m10,this.m11+=e.m11,this.m12+=e.m12,this.m13+=e.m13,this.m14+=e.m14,this.m15+=e.m15,this},i.subtract=function(e){return this.m00-=e.m00,this.m01-=e.m01,this.m02-=e.m02,this.m03-=e.m03,this.m04-=e.m04,this.m05-=e.m05,this.m06-=e.m06,this.m07-=e.m07,this.m08-=e.m08,this.m09-=e.m09,this.m10-=e.m10,this.m11-=e.m11,this.m12-=e.m12,this.m13-=e.m13,this.m14-=e.m14,this.m15-=e.m15,this},i.multiply=function(e){var t=this.m00,i=this.m01,n=this.m02,r=this.m03,s=this.m04,a=this.m05,o=this.m06,u=this.m07,h=this.m08,c=this.m09,l=this.m10,_=this.m11,d=this.m12,f=this.m13,p=this.m14,m=this.m15,g=e.m00,v=e.m01,y=e.m02,E=e.m03;return this.m00=g*t+v*s+y*h+E*d,this.m01=g*i+v*a+y*c+E*f,this.m02=g*n+v*o+y*l+E*p,this.m03=g*r+v*u+y*_+E*m,g=e.m04,v=e.m05,y=e.m06,E=e.m07,this.m04=g*t+v*s+y*h+E*d,this.m05=g*i+v*a+y*c+E*f,this.m06=g*n+v*o+y*l+E*p,this.m07=g*r+v*u+y*_+E*m,g=e.m08,v=e.m09,y=e.m10,E=e.m11,this.m08=g*t+v*s+y*h+E*d,this.m09=g*i+v*a+y*c+E*f,this.m10=g*n+v*o+y*l+E*p,this.m11=g*r+v*u+y*_+E*m,g=e.m12,v=e.m13,y=e.m14,E=e.m15,this.m12=g*t+v*s+y*h+E*d,this.m13=g*i+v*a+y*c+E*f,this.m14=g*n+v*o+y*l+E*p,this.m15=g*r+v*u+y*_+E*m,this},i.multiplyScalar=function(e){return this.m00*=e,this.m01*=e,this.m02*=e,this.m03*=e,this.m04*=e,this.m05*=e,this.m06*=e,this.m07*=e,this.m08*=e,this.m09*=e,this.m10*=e,this.m11*=e,this.m12*=e,this.m13*=e,this.m14*=e,this.m15*=e,this},i.translate=function(e){return this.m12+=e.x,this.m13+=e.y,this.m14+=e.z,this},i.scale=function(e){var t=e.x,i=e.y,n=e.z;return this.m00*=t,this.m01*=t,this.m02*=t,this.m03*=t,this.m04*=i,this.m05*=i,this.m06*=i,this.m07*=i,this.m08*=n,this.m09*=n,this.m10*=n,this.m11*=n,this},i.rotate=function(e,t){var i=t.x,n=t.y,r=t.z,s=Math.sqrt(i*i+n*n+r*r);if(Math.abs(s)<Ti)return null;i*=s=1/s,n*=s,r*=s;var a=Math.sin(e),o=Math.cos(e),u=1-o,h=this.m00,c=this.m01,l=this.m02,_=this.m03,d=this.m04,f=this.m05,p=this.m06,m=this.m07,g=this.m08,v=this.m09,y=this.m10,E=this.m11,T=i*i*u+o,A=n*i*u+r*a,S=r*i*u-n*a,R=i*n*u-r*a,w=n*n*u+o,I=r*n*u+i*a,b=i*r*u+n*a,O=n*r*u-i*a,N=r*r*u+o;return this.m00=h*T+d*A+g*S,this.m01=c*T+f*A+v*S,this.m02=l*T+p*A+y*S,this.m03=_*T+m*A+E*S,this.m04=h*R+d*w+g*I,this.m05=c*R+f*w+v*I,this.m06=l*R+p*w+y*I,this.m07=_*R+m*w+E*I,this.m08=h*b+d*O+g*N,this.m09=c*b+f*O+v*N,this.m10=l*b+p*O+y*N,this.m11=_*b+m*O+E*N,this},i.getTranslation=function(e){return e.x=this.m12,e.y=this.m13,e.z=this.m14,e},i.getScale=function(e){var t=An.m00=this.m00,i=An.m01=this.m01,n=An.m02=this.m02,r=An.m03=this.m04,s=An.m04=this.m05,a=An.m05=this.m06,o=An.m06=this.m08,u=An.m07=this.m09,h=An.m08=this.m10;return e.x=Math.sqrt(t*t+i*i+n*n),e.y=Math.sqrt(r*r+s*s+a*a),e.z=Math.sqrt(o*o+u*u+h*h),hn.determinant(An)<0&&(e.x*=-1),e},i.getRotation=function(e){var t=this.m00+this.m05+this.m10,i=0;return t>0?(i=2*Math.sqrt(t+1),e.w=.25*i,e.x=(this.m06-this.m09)/i,e.y=(this.m08-this.m02)/i,e.z=(this.m01-this.m04)/i):this.m00>this.m05&&this.m00>this.m10?(i=2*Math.sqrt(1+this.m00-this.m05-this.m10),e.w=(this.m06-this.m09)/i,e.x=.25*i,e.y=(this.m01+this.m04)/i,e.z=(this.m08+this.m02)/i):this.m05>this.m10?(i=2*Math.sqrt(1+this.m05-this.m00-this.m10),e.w=(this.m08-this.m02)/i,e.x=(this.m01+this.m04)/i,e.y=.25*i,e.z=(this.m06+this.m09)/i):(i=2*Math.sqrt(1+this.m10-this.m00-this.m05),e.w=(this.m01-this.m04)/i,e.x=(this.m08+this.m02)/i,e.y=(this.m06+this.m09)/i,e.z=.25*i),e},i.fromRTS=function(e,t,i){var n=e.x,r=e.y,s=e.z,a=e.w,o=n+n,u=r+r,h=s+s,c=n*o,l=n*u,_=n*h,d=r*u,f=r*h,p=s*h,m=a*o,g=a*u,v=a*h,y=i.x,E=i.y,T=i.z;return this.m00=(1-(d+p))*y,this.m01=(l+v)*y,this.m02=(_-g)*y,this.m03=0,this.m04=(l-v)*E,this.m05=(1-(c+p))*E,this.m06=(f+m)*E,this.m07=0,this.m08=(_+g)*T,this.m09=(f-m)*T,this.m10=(1-(c+d))*T,this.m11=0,this.m12=t.x,this.m13=t.y,this.m14=t.z,this.m15=1,this},i.fromQuat=function(e){var t=e.x,i=e.y,n=e.z,r=e.w,s=t+t,a=i+i,o=n+n,u=t*s,h=i*s,c=i*a,l=n*s,_=n*a,d=n*o,f=r*s,p=r*a,m=r*o;return this.m00=1-c-d,this.m01=h+m,this.m02=l-p,this.m03=0,this.m04=h-m,this.m05=1-u-d,this.m06=_+f,this.m07=0,this.m08=l+p,this.m09=_-f,this.m10=1-u-c,this.m11=0,this.m12=0,this.m13=0,this.m14=0,this.m15=1,this},t}(Tt));En.IDENTITY=Object.freeze(new En);var Tn=new Ki,An=new hn;function Sn(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p){return new En(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p)}di.fastDefine("cc.Mat4",En,{m00:1,m01:0,m02:0,m03:0,m04:0,m05:1,m06:0,m07:0,m08:0,m09:0,m10:1,m11:0,m12:0,m13:0,m14:0,m15:1}),v.Mat4=En,v.mat4=Sn;var Rn=e("cH",function(e){function t(t,i){var n;return n=e.call(this)||this,t&&"object"==typeof t?(n.x=t.x,n.y=t.y):(n.x=t||0,n.y=i||0),n}s(t,e),t.clone=function(e){return new t(e.x,e.y)},t.copy=function(e,t){return e.x=t.x,e.y=t.y,e},t.set=function(e,t,i){return e.x=t,e.y=i,e},t.add=function(e,t,i){return e.x=t.x+i.x,e.y=t.y+i.y,e},t.subtract=function(e,t,i){return e.x=t.x-i.x,e.y=t.y-i.y,e},t.multiply=function(e,t,i){return e.x=t.x*i.x,e.y=t.y*i.y,e},t.divide=function(e,t,i){return e.x=t.x/i.x,e.y=t.y/i.y,e},t.ceil=function(e,t){return e.x=Math.ceil(t.x),e.y=Math.ceil(t.y),e},t.floor=function(e,t){return e.x=Math.floor(t.x),e.y=Math.floor(t.y),e},t.min=function(e,t,i){return e.x=Math.min(t.x,i.x),e.y=Math.min(t.y,i.y),e},t.max=function(e,t,i){return e.x=Math.max(t.x,i.x),e.y=Math.max(t.y,i.y),e},t.round=function(e,t){return e.x=Math.round(t.x),e.y=Math.round(t.y),e},t.multiplyScalar=function(e,t,i){return e.x=t.x*i,e.y=t.y*i,e},t.scaleAndAdd=function(e,t,i,n){return e.x=t.x+i.x*n,e.y=t.y+i.y*n,e},t.distance=function(e,t){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},t.squaredDistance=function(e,t){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},t.len=function(e){var t=e.x,i=e.y;return Math.sqrt(t*t+i*i)},t.lengthSqr=function(e){var t=e.x,i=e.y;return t*t+i*i},t.negate=function(e,t){return e.x=-t.x,e.y=-t.y,e},t.inverse=function(e,t){return e.x=1/t.x,e.y=1/t.y,e},t.inverseSafe=function(e,t){var i=t.x,n=t.y;return Math.abs(i)<Ti?e.x=0:e.x=1/i,Math.abs(n)<Ti?e.y=0:e.y=1/n,e},t.normalize=function(e,t){var i=t.x,n=t.y,r=i*i+n*n;return r>0&&(r=1/Math.sqrt(r),e.x=i*r,e.y=n*r),e},t.dot=function(e,t){return e.x*t.x+e.y*t.y},t.cross=function(e,t,i){return e instanceof Ki?(e.x=e.y=0,e.z=t.x*i.y-t.y*i.x,e):e.x*t.y-e.y*t.x},t.lerp=function(e,t,i,n){var r=t.x,s=t.y;return e.x=r+n*(i.x-r),e.y=s+n*(i.y-s),e},t.random=function(e,t){t=t||1;var i=2*Ni()*Math.PI;return e.x=Math.cos(i)*t,e.y=Math.sin(i)*t,e},t.transformMat3=function(e,t,i){var n=t.x,r=t.y;return e.x=i.m00*n+i.m03*r+i.m06,e.y=i.m01*n+i.m04*r+i.m07,e},t.transformMat4=function(e,t,i){var n=t.x,r=t.y;return e.x=i.m00*n+i.m04*r+i.m12,e.y=i.m01*n+i.m05*r+i.m13,e},t.str=function(e){return"Vec2("+e.x+", "+e.y+")"},t.toArray=function(e,t,i){return void 0===i&&(i=0),e[i+0]=t.x,e[i+1]=t.y,e},t.fromArray=function(e,t,i){return void 0===i&&(i=0),e.x=t[i+0],e.y=t[i+1],e},t.strictEquals=function(e,t){return e.x===t.x&&e.y===t.y},t.equals=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(e.x-t.x)<=i*Math.max(1,Math.abs(e.x),Math.abs(t.x))&&Math.abs(e.y-t.y)<=i*Math.max(1,Math.abs(e.y),Math.abs(t.y))},t.angle=function(e,i){t.normalize(In,e),t.normalize(bn,i);var n=t.dot(In,bn);return n>1?0:n<-1?Math.PI:Math.acos(n)};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y)},i.set=function(e,t){return e&&"object"==typeof e?(this.x=e.x,this.y=e.y):(this.x=e||0,this.y=t||0),this},i.equals=function(e,t){return void 0===t&&(t=Ti),Math.abs(this.x-e.x)<=t*Math.max(1,Math.abs(this.x),Math.abs(e.x))&&Math.abs(this.y-e.y)<=t*Math.max(1,Math.abs(this.y),Math.abs(e.y))},i.equals2f=function(e,t,i){return void 0===i&&(i=Ti),Math.abs(this.x-e)<=i*Math.max(1,Math.abs(this.x),Math.abs(e))&&Math.abs(this.y-t)<=i*Math.max(1,Math.abs(this.y),Math.abs(t))},i.strictEquals=function(e){return e&&this.x===e.x&&this.y===e.y},i.strictEquals2f=function(e,t){return this.x===e&&this.y===t},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+")"},i.lerp=function(e,t){var i=this.x,n=this.y;return this.x=i+t*(e.x-i),this.y=n+t*(e.y-n),this},i.clampf=function(e,t){return this.x=Ri(this.x,e.x,t.x),this.y=Ri(this.y,e.y,t.y),this},i.add=function(e){return this.x+=e.x,this.y+=e.y,this},i.add2f=function(e,t){return this.x+=e,this.y+=t,this},i.subtract=function(e){return this.x-=e.x,this.y-=e.y,this},i.subtract2f=function(e,t){return this.x-=e,this.y-=t,this},i.multiplyScalar=function(e){return"object"==typeof e&&console.warn("should use Vec2.multiply for vector * vector operation"),this.x*=e,this.y*=e,this},i.multiply=function(e){return"object"!=typeof e&&console.warn("should use Vec2.scale for vector * scalar operation"),this.x*=e.x,this.y*=e.y,this},i.multiply2f=function(e,t){return this.x*=e,this.y*=t,this},i.divide=function(e){return this.x/=e.x,this.y/=e.y,this},i.divide2f=function(e,t){return this.x/=e,this.y/=t,this},i.negative=function(){return this.x=-this.x,this.y=-this.y,this},i.dot=function(e){return this.x*e.x+this.y*e.y},i.cross=function(e){return this.x*e.y-this.y*e.x},i.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},i.lengthSqr=function(){return this.x*this.x+this.y*this.y},i.normalize=function(){var e=this.x,t=this.y,i=e*e+t*t;return i>0&&(i=1/Math.sqrt(i),this.x*=i,this.y*=i),this},i.angle=function(e){var t=this.lengthSqr(),i=e.lengthSqr();if(0===t||0===i)return console.warn("Can't get angle between zero vector"),0;var n=this.dot(e)/Math.sqrt(t*i);return n=Ri(n,-1,1),Math.acos(n)},i.signAngle=function(e){var t=this.angle(e);return this.cross(e)<0?-t:t},i.rotate=function(e){var t=this.x,i=this.y,n=Math.sin(e),r=Math.cos(e);return this.x=r*t-n*i,this.y=n*t+r*i,this},i.project=function(e){var t=this.dot(e)/e.dot(e);return this.x=e.x*t,this.y=e.y*t,this},i.transformMat4=function(e){var t=this.x,i=this.y;return this.x=e.m00*t+e.m04*i+e.m12,this.y=e.m01*t+e.m05*i+e.m13,this},t}(Tt));Rn.ZERO=Object.freeze(new Rn(0,0)),Rn.ONE=Object.freeze(new Rn(1,1)),Rn.NEG_ONE=Object.freeze(new Rn(-1,-1)),Rn.UNIT_X=Object.freeze(new Rn(1,0)),Rn.UNIT_Y=Object.freeze(new Rn(0,1));var wn,In=new Rn,bn=new Rn;function On(e,t){return new Rn(e,t)}di.fastDefine("cc.Vec2",Rn,{x:0,y:0}),v.Vec2=Rn,v.v2=On,re(Rn,"Vec2",[{name:"sub",newName:"subtract",target:Rn,targetName:"Vec2"},{name:"mul",newName:"multiply",target:Rn,targetName:"Vec2"},{name:"div",newName:"divide",target:Rn,targetName:"Vec2"},{name:"dist",newName:"distance",target:Rn,targetName:"Vec2"},{name:"sqrDist",newName:"squaredDistance",target:Rn,targetName:"Vec2"},{name:"mag",newName:"len",target:Rn,targetName:"Vec2"},{name:"sqrMag",newName:"lengthSqr",target:Rn,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Rn,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Rn,targetName:"Vec2"}]),re(Rn.prototype,"Vec2",[{name:"mag",newName:"length",target:Rn.prototype,targetName:"Vec2"},{name:"magSqr",newName:"lengthSqr",target:Rn.prototype,targetName:"Vec2"},{name:"scale",newName:"multiplyScalar",target:Rn.prototype,targetName:"Vec2"},{name:"exactEquals",newName:"strictEquals",target:Rn.prototype,targetName:"Vec2"}]),re(Ki,"Vec3",[{name:"sub",newName:"subtract",target:Ki,targetName:"Vec3"},{name:"mul",newName:"multiply",target:Ki,targetName:"Vec3"},{name:"div",newName:"divide",target:Ki,targetName:"Vec3"},{name:"dist",newName:"distance",target:Ki,targetName:"Vec3"},{name:"sqrDist",newName:"squaredDistance",target:Ki,targetName:"Vec3"},{name:"mag",newName:"len",target:Ki,targetName:"Vec3"},{name:"sqrMag",newName:"lengthSqr",target:Ki,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Ki,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Ki,targetName:"Vec3"}]),re(Ki.prototype,"Vec3",[{name:"mag",newName:"length",target:Ki.prototype,targetName:"Vec3"},{name:"magSqr",newName:"lengthSqr",target:Ki.prototype,targetName:"Vec3"},{name:"scale",newName:"multiplyScalar",target:Ki.prototype,targetName:"Vec3"},{name:"exactEquals",newName:"strictEquals",target:Ki.prototype,targetName:"Vec3"}]),re(zi,"Vec4",[{name:"sub",newName:"subtract",target:zi,targetName:"Vec4"},{name:"mul",newName:"multiply",target:zi,targetName:"Vec4"},{name:"div",newName:"divide",target:zi,targetName:"Vec4"},{name:"dist",newName:"distance",target:zi,targetName:"Vec4"},{name:"sqrDist",newName:"squaredDistance",target:zi,targetName:"Vec4"},{name:"mag",newName:"len",target:zi,targetName:"Vec4"},{name:"sqrMag",newName:"lengthSqr",target:zi,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:zi,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:zi,targetName:"Vec4"}]),re(zi.prototype,"Vec4",[{name:"mag",newName:"length",target:zi.prototype,targetName:"Vec4"},{name:"magSqr",newName:"lengthSqr",target:zi.prototype,targetName:"Vec4"},{name:"scale",newName:"multiplyScalar",target:zi.prototype,targetName:"Vec4"},{name:"exactEquals",newName:"strictEquals",target:zi.prototype,targetName:"Vec4"}]),re(_n,"Quat",[{name:"mag",newName:"len",target:_n,targetName:"Quat"},{name:"mul",newName:"multiply",target:_n,targetName:"Quat"},{name:"sqrMag",newName:"lengthSqr",target:_n,targetName:"Quat"},{name:"scale",newName:"multiplyScalar",target:_n,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:_n,targetName:"Quat"}]),re(_n.prototype,"Quat",[{name:"scale",newName:"multiplyScalar",target:_n.prototype,targetName:"Quat"},{name:"exactEquals",newName:"strictEquals",target:_n.prototype,targetName:"Quat"}]),re(en,"Color",[{name:"sub",newName:"subtract",target:en,targetName:"Color"},{name:"mul",newName:"multiply",target:en,targetName:"Color"},{name:"div",newName:"divide",target:en,targetName:"Color"},{name:"exactEquals",newName:"strictEquals",target:en,targetName:"Color"},{name:"fromHex",newName:"fromHEX",customFunction:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=t[1].toString(16);return v.Color.fromHEX(t[0],n)}}]),re(hn,"Mat3",[{name:"sub",newName:"subtract",target:hn,targetName:"Mat3"},{name:"mul",newName:"multiply",target:hn,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:hn,targetName:"Mat3"},{name:"transfrom",newName:"transform",target:hn,targetName:"Mat3"}]),re(hn.prototype,"Mat3",[{name:"sub",newName:"subtract",target:hn.prototype,targetName:"Mat3"},{name:"mul",newName:"multiply",target:hn.prototype,targetName:"Mat3"},{name:"mulScalar",newName:"multiplyScalar",target:hn.prototype,targetName:"Mat3"},{name:"exactEquals",newName:"strictEquals",target:hn.prototype,targetName:"Mat3"}]),re(En,"Mat4",[{name:"sub",newName:"subtract",target:En,targetName:"Mat4"},{name:"mul",newName:"multiply",target:En,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:En,targetName:"Mat4"}]),re(En.prototype,"Mat4",[{name:"sub",newName:"subtract",target:En.prototype,targetName:"Mat4"},{name:"mul",newName:"multiply",target:En.prototype,targetName:"Mat4"},{name:"mulScalar",newName:"multiplyScalar",target:En.prototype,targetName:"Mat4"},{name:"exactEquals",newName:"strictEquals",target:En.prototype,targetName:"Mat4"}]),function(e){e[e.VEC2=0]="VEC2",e[e.VEC3=1]="VEC3",e[e.VEC4=2]="VEC4",e[e.QUATERNION=3]="QUATERNION",e[e.MAT3=4]="MAT3",e[e.MAT4=5]="MAT4",e[e.SIZE=6]="SIZE",e[e.RECT=7]="RECT",e[e.COLOR=8]="COLOR"}(wn||(wn={}));var Nn=e("fU",function(){function e(e,t,i,n,r,s){void 0===e&&(e=1),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),this.a=e,this.b=t,this.c=i,this.d=n,this.tx=r,this.ty=s}return e.identity=function(){return new e},e.clone=function(t){return new e(t.a,t.b,t.c,t.d,t.tx,t.ty)},e.concat=function(e,t,i){var n=t.a,r=t.b,s=t.c,a=t.d,o=t.tx,u=t.ty;e.a=n*i.a+r*i.c,e.b=n*i.b+r*i.d,e.c=s*i.a+a*i.c,e.d=s*i.b+a*i.d,e.tx=o*i.a+u*i.c+i.tx,e.ty=o*i.b+u*i.d+i.ty},e.invert=function(e,t){var i=1/(t.a*t.d-t.b*t.c);e.a=i*t.d,e.b=-i*t.b,e.c=-i*t.c,e.d=i*t.a,e.tx=i*(t.c*t.ty-t.d*t.tx),e.ty=i*(t.b*t.tx-t.a*t.ty)},e.fromMat4=function(e,t){e.a=t.m00,e.b=t.m01,e.c=t.m04,e.d=t.m05,e.tx=t.m12,e.ty=t.m13},e.transformVec2=function(e,t,i,n){var r,s;n?(r=t,s=i):(n=i,r=t.x,s=t.y),e.x=n.a*r+n.c*s+n.tx,e.y=n.b*r+n.d*s+n.ty},e.transformSize=function(e,t,i){e.width=i.a*t.width+i.c*t.height,e.height=i.b*t.width+i.d*t.height},e.transformRect=function(e,t,i){var n=t.x+t.width,r=t.y+t.height,s=i.a*t.x+i.c*t.y+i.tx,a=i.b*t.x+i.d*t.y+i.ty,o=i.a*n+i.c*t.y+i.tx,u=i.b*n+i.d*t.y+i.ty,h=i.a*t.x+i.c*r+i.tx,c=i.b*t.x+i.d*r+i.ty,l=i.a*n+i.c*r+i.tx,_=i.b*n+i.d*r+i.ty,d=Math.min(s,o,h,l),f=Math.max(s,o,h,l),p=Math.min(a,u,c,_),m=Math.max(a,u,c,_);e.x=d,e.y=p,e.width=f-d,e.height=m-p},e.transformObb=function(e,t,i,n,r,s){var a=s.a*r.x+s.c*r.y+s.tx,o=s.b*r.x+s.d*r.y+s.ty,u=s.a*r.width,h=s.b*r.width,c=s.c*r.height,l=s.d*r.height;t.x=a,t.y=o,i.x=u+a,i.y=h+o,e.x=c+a,e.y=l+o,n.x=u+c+a,n.y=h+l+o},e}());v.AffineTransform=Nn;var Cn=e("cI",function(e){function t(t,i){var n;return n=e.call(this)||this,t&&"object"==typeof t?(n.width=t.width,n.height=t.height):(n.width=t||0,n.height=i||0),n}s(t,e),t.lerp=function(e,t,i,n){return e.width=t.width+(i.width-t.width)*n,e.height=t.height+(i.height-t.height)*n,e};var i=t.prototype;return i.clone=function(){return new t(this.width,this.height)},i.set=function(e,t){return e&&"object"==typeof e?(this.height=e.height,this.width=e.width):(this.width=e||0,this.height=t||0),this},i.equals=function(e){return this.width===e.width&&this.height===e.height},i.lerp=function(e,t){return this.width+=(e.width-this.width)*t,this.height+=(e.height-this.height)*t,this},i.toString=function(){return"("+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},n(t,[{key:"x",get:function(){return this.width},set:function(e){this.width=e}},{key:"y",get:function(){return this.height},set:function(e){this.height=e}}]),t}(Tt));function Mn(e,t){return void 0===e&&(e=0),void 0===t&&(t=0),new Cn(e,t)}Cn.ZERO=Object.freeze(new Cn(0,0)),Cn.ONE=Object.freeze(new Cn(1,1)),di.fastDefine("cc.Size",Cn,{width:0,height:0}),v.size=Mn,v.Size=Cn;var Pn=e("cG",function(e){function t(t,i,n,r){var s;return s=e.call(this)||this,t&&"object"==typeof t?(s.y=t.y,s.width=t.width,s.height=t.height,s.x=t.x):(s.x=t||0,s.y=i||0,s.width=n||0,s.height=r||0),s}s(t,e),t.fromMinMax=function(e,t,i){var n=Math.min(t.x,i.x),r=Math.min(t.y,i.y),s=Math.max(t.x,i.x),a=Math.max(t.y,i.y);return e.x=n,e.y=r,e.width=s-n,e.height=a-r,e},t.lerp=function(e,t,i,n){var r=t.x,s=t.y,a=t.width,o=t.height;return e.x=r+(i.x-r)*n,e.y=s+(i.y-s)*n,e.width=a+(i.width-a)*n,e.height=o+(i.height-o)*n,e},t.intersection=function(e,t,i){var n=t.x,r=t.y,s=t.x+t.width,a=t.y+t.height,o=i.x,u=i.y,h=i.x+i.width,c=i.y+i.height;return e.x=Math.max(n,o),e.y=Math.max(r,u),e.width=Math.min(s,h)-e.x,e.height=Math.min(a,c)-e.y,e},t.union=function(e,t,i){var n=t.x,r=t.y,s=t.width,a=t.height,o=i.x,u=i.y,h=i.width,c=i.height;return e.x=Math.min(n,o),e.y=Math.min(r,u),e.width=Math.max(n+s,o+h)-e.x,e.height=Math.max(r+a,u+c)-e.y,e};var i=t.prototype;return i.clone=function(){return new t(this.x,this.y,this.width,this.height)},i.set=function(e,t,i,n){return e&&"object"==typeof e?(this.y=e.y,this.width=e.width,this.height=e.height,this.x=e.x):(this.x=e||0,this.y=t||0,this.width=i||0,this.height=n||0),this},i.equals=function(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height},i.lerp=function(e,t){var i=this.x,n=this.y,r=this.width,s=this.height;return this.x=i+(e.x-i)*t,this.y=n+(e.y-n)*t,this.width=r+(e.width-r)*t,this.height=s+(e.height-s)*t,this},i.toString=function(){return"("+this.x.toFixed(2)+", "+this.y.toFixed(2)+", "+this.width.toFixed(2)+", "+this.height.toFixed(2)+")"},i.intersects=function(e){var t=this.x+this.width,i=this.y+this.height,n=e.x+e.width,r=e.y+e.height;return!(t<e.x||n<this.x||i<e.y||r<this.y)},i.contains=function(e){return this.x<=e.x&&this.x+this.width>=e.x&&this.y<=e.y&&this.y+this.height>=e.y},i.containsRect=function(e){return this.x<=e.x&&this.x+this.width>=e.x+e.width&&this.y<=e.y&&this.y+this.height>=e.y+e.height},i.transformMat4=function(e){var t=this.x,i=this.y,n=t+this.width,r=i+this.height,s=e.m00*t+e.m04*i+e.m12,a=e.m01*t+e.m05*i+e.m13,o=e.m00*n+e.m04*i+e.m12,u=e.m01*n+e.m05*i+e.m13,h=e.m00*t+e.m04*r+e.m12,c=e.m01*t+e.m05*r+e.m13,l=e.m00*n+e.m04*r+e.m12,_=e.m01*n+e.m05*r+e.m13,d=Math.min(s,o,h,l),f=Math.max(s,o,h,l),p=Math.min(a,u,c,_),m=Math.max(a,u,c,_);return this.x=d,this.y=p,this.width=f-d,this.height=m-p,this},i.transformMat4ToPoints=function(e,t,i,n,r){var s=this.x,a=this.y,o=s+this.width,u=a+this.height;t.x=e.m00*s+e.m04*a+e.m12,t.y=e.m01*s+e.m05*a+e.m13,r.x=e.m00*o+e.m04*a+e.m12,r.y=e.m01*o+e.m05*a+e.m13,i.x=e.m00*s+e.m04*u+e.m12,i.y=e.m01*s+e.m05*u+e.m13,n.x=e.m00*o+e.m04*u+e.m12,n.y=e.m01*o+e.m05*u+e.m13},n(t,[{key:"xMin",get:function(){return this.x},set:function(e){this.width+=this.x-e,this.x=e}},{key:"yMin",get:function(){return this.y},set:function(e){this.height+=this.y-e,this.y=e}},{key:"xMax",get:function(){return this.x+this.width},set:function(e){this.width=e-this.x}},{key:"yMax",get:function(){return this.y+this.height},set:function(e){this.height=e-this.y}},{key:"center",get:function(){return new Rn(this.x+.5*this.width,this.y+.5*this.height)},set:function(e){this.x=e.x-.5*this.width,this.y=e.y-.5*this.height}},{key:"origin",get:function(){return new Rn(this.x,this.y)},set:function(e){this.x=e.x,this.y=e.y}},{key:"size",get:function(){return new Cn(this.width,this.height)},set:function(e){this.width=e.width,this.height=e.height}},{key:"z",get:function(){return this.width},set:function(e){this.width=e}},{key:"w",get:function(){return this.height},set:function(e){this.height=e}}]),t}(Tt));function Ln(e,t,i,n){return void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),new Pn(e,t,i,n)}di.fastDefine("cc.Rect",Pn,{x:0,y:0,width:0,height:0}),v.Rect=Pn,v.rect=Ln;var xn=e("g2",Float64Array),Dn=e("g3",function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.createFloatArray=function(e){return new xn(e)},n(t,[{key:"array",get:function(){return this._array}}]),t}(Tt)),Fn=Object.freeze({__proto__:null,bits:O,Vec2:Rn,v2:On,Vec3:Ki,v3:Qi,Vec4:zi,v4:Vi,Quat:_n,quat:vn,Mat3:hn,Mat4:En,mat4:Sn,AffineTransform:Nn,Size:Cn,size:Mn,Rect:Pn,rect:Ln,Color:en,color:tn,preTransforms:yn,HALF_PI:yi,TWO_PI:Ei,EPSILON:Ti,equals:Ai,approx:Si,clamp:Ri,clamp01:wi,lerp:Ii,toRadian:bi,toDegree:Oi,random:Ni,randomRange:Ci,randomRangeInt:Mi,pseudoRandom:Pi,pseudoRandomRange:Li,pseudoRandomRangeInt:xi,nextPow2:Di,repeat:Fi,pingPong:Bi,inverseLerp:Ui,absMaxComponent:Gi,absMax:ki,enumerableProps:Hi,MATH_FLOAT_ARRAY:xn,MathBase:Dn});e("fM",Fn);var Bn=new Ki,Un=new Ki,Gn=new Ki,kn=new Ki,Hn=new Ki,zn=new Ki,Vn=new Array(3),Wn=new Array(3);function jn(e,t){return Ki.dot(t.n,e)-t.d}function Xn(e,t,i){return Ki.copy(e,t),Ki.subtract(Hn,i.center,i.halfExtents),Ki.add(zn,i.center,i.halfExtents),e.x=e.x<Hn.x?Hn.x:e.x,e.y=e.y<Hn.y?Hn.y:e.y,e.z=e.z<Hn.z?Hn.z:e.z,e.x=e.x>zn.x?zn.x:e.x,e.y=e.y>zn.y?zn.y:e.y,e.z=e.z>zn.z?zn.z:e.z,e}function Kn(e,t,i){Ki.set(Bn,i.orientation.m00,i.orientation.m01,i.orientation.m02),Ki.set(Un,i.orientation.m03,i.orientation.m04,i.orientation.m05),Ki.set(Gn,i.orientation.m06,i.orientation.m07,i.orientation.m08),Vn[0]=Bn,Vn[1]=Un,Vn[2]=Gn,Wn[0]=i.halfExtents.x,Wn[1]=i.halfExtents.y,Wn[2]=i.halfExtents.z,Ki.subtract(kn,t,i.center),Ki.set(e,i.center.x,i.center.y,i.center.z);for(var n=0;n<3;n++){var r=Ki.dot(kn,Vn[n]);r>Wn[n]&&(r=Wn[n]),r<-Wn[n]&&(r=-Wn[n]),e.x+=r*Vn[n].x,e.y+=r*Vn[n].y,e.z+=r*Vn[n].z}return e}var Yn=Object.freeze({__proto__:null,point_plane:jn,pt_point_plane:function(e,t,i){var n=jn(t,i);return Ki.subtract(e,t,Ki.multiplyScalar(e,i.n,n))},pt_point_aabb:Xn,pt_point_obb:Kn,pt_point_line:function(e,t,i,n){Ki.subtract(Bn,i,n);var r=Bn,s=Ki.lengthSqr(r);if(0===s)Ki.copy(e,i);else{Ki.subtract(Bn,t,i);var a=Ki.dot(Bn,r)/s;a<0?Ki.copy(e,i):a>1?Ki.copy(e,n):Ki.scaleAndAdd(e,i,r,a)}}}),qn={SHAPE_RAY:1,SHAPE_LINE:2,SHAPE_SPHERE:4,SHAPE_AABB:8,SHAPE_OBB:16,SHAPE_PLANE:32,SHAPE_TRIANGLE:64,SHAPE_FRUSTUM:128,SHAPE_FRUSTUM_ACCURATE:256,SHAPE_CAPSULE:512,SHAPE_SPLINE:1024},Qn=function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.s=void 0,this.e=void 0,this._type=void 0,this._type=qn.SHAPE_LINE,this.s=new Ki(e,t,i),this.e=new Ki(n,r,s)}return e.create=function(t,i,n,r,s,a){return new e(t,i,n,r,s,a)},e.clone=function(t){return new e(t.s.x,t.s.y,t.s.z,t.e.x,t.e.y,t.e.z)},e.copy=function(e,t){return Ki.copy(e.s,t.s),Ki.copy(e.e,t.e),e},e.fromPoints=function(e,t,i){return Ki.copy(e.s,t),Ki.copy(e.e,i),e},e.set=function(e,t,i,n,r,s,a){return e.s.x=t,e.s.y=i,e.s.z=n,e.e.x=r,e.e.y=s,e.e.z=a,e},e.len=function(e){return Ki.distance(e.s,e.e)},e.prototype.length=function(){return Ki.distance(this.s,this.e)},n(e,[{key:"type",get:function(){return this._type}}]),e}(),Zn=e("dD",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=-1),this.o=void 0,this.d=void 0,this._type=void 0,this._type=qn.SHAPE_RAY,this.o=new Ki(e,t,i),this.d=new Ki(n,r,s)}return e.create=function(t,i,n,r,s,a){return void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=1),new e(t,i,n,r,s,a)},e.clone=function(t){return new e(t.o.x,t.o.y,t.o.z,t.d.x,t.d.y,t.d.z)},e.copy=function(e,t){return Ki.copy(e.o,t.o),Ki.copy(e.d,t.d),e},e.fromPoints=function(e,t,i){return Ki.copy(e.o,t),Ki.normalize(e.d,Ki.subtract(e.d,i,t)),e},e.set=function(e,t,i,n,r,s,a){return e.o.x=t,e.o.y=i,e.o.z=n,e.d.x=r,e.d.y=s,e.d.z=a,e},e.prototype.computeHit=function(e,t){Ki.normalize(e,this.d),Ki.scaleAndAdd(e,this.o,e,t)},n(e,[{key:"type",get:function(){return this._type}}]),e}()),Jn=new Ki,$n=new Ki,er=new Ki,tr=new Ki;function ir(e){return Math.max(Math.max(e.x,e.y),e.z)}var nr,rr,sr,ar,or,ur,hr,cr,lr=e("fr",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),this._center=new Ki(0,0,0),this._radius=0,this._type=void 0,this._type=qn.SHAPE_SPHERE,this._center=new Ki(e,t,i),this._radius=n}e.create=function(t,i,n,r){return new e(t,i,n,r)},e.clone=function(t){return new e(t.center.x,t.center.y,t.center.z,t.radius)},e.copy=function(e,t){return Ki.copy(e.center,t.center),e.radius=t.radius,e},e.fromPoints=function(e,t,i){return Ki.multiplyScalar(e.center,Ki.add(Jn,t,i),.5),e.radius=.5*Ki.subtract(Jn,i,t).length(),e},e.set=function(e,t,i,n,r){return e.center.x=t,e.center.y=i,e.center.z=n,e.radius=r,e};var t=e.prototype;return t.destroy=function(){},t.clone=function(){return e.clone(this)},t.copy=function(t){return e.copy(this,t)},t.getBoundary=function(e,t){Ki.set(e,this.center.x-this.radius,this.center.y-this.radius,this.center.z-this.radius),Ki.set(t,this.center.x+this.radius,this.center.y+this.radius,this.center.z+this.radius)},t.transform=function(e,t,i,n,r){Ki.transformMat4(r.center,this.center,e),r.radius=this.radius*ir(n)},t.translateAndRotate=function(e,t,i){Ki.transformMat4(i.center,this.center,e)},t.setScale=function(e,t){t.radius=this.radius*ir(e)},t.mergePoint=function(e){this.radius<0&&(this.center.set(e),this.radius=0),Ki.subtract($n,e,this.center);var t=$n.length();if(t>this.radius){var i=.5*(t-this.radius);this.radius+=i,Ki.multiplyScalar($n,$n,i/t),Ki.add(this.center,this.center,$n)}},t.mergePoints=function(e){var t=e.length;if(!(t<1)){this.radius=-1;for(var i=0;i<t;i++)this.mergePoint(e[i])}},t.mergeAABB=function(e){e.getBoundary(er,tr),this.mergePoint(er),this.mergePoint(tr)},n(e,[{key:"center",get:function(){return this._center},set:function(e){this._center=e}},{key:"radius",get:function(){return this._radius},set:function(e){this._radius=e}},{key:"type",get:function(){return this._type}}]),e}()),_r=(nr=new Ki(0,0,0),function(e,t){var i=Ki.dot(e.d,t.n);if(Math.abs(i)<Number.EPSILON)return 0;Ki.multiplyScalar(nr,t.n,t.d);var n=Ki.dot(Ki.subtract(nr,nr,e.o),t.n)/i;return n<0?0:n}),dr=(rr=new Ki(0,0,0),sr=new Ki(0,0,0),ar=new Ki(0,0,0),or=new Ki(0,0,0),ur=new Ki(0,0,0),function(e,t,i){Ki.subtract(rr,t.b,t.a),Ki.subtract(sr,t.c,t.a),Ki.cross(ar,e.d,sr);var n=Ki.dot(rr,ar);if(n<Number.EPSILON&&(!i||n>-Number.EPSILON))return 0;var r=1/n;Ki.subtract(or,e.o,t.a);var s=Ki.dot(or,ar)*r;if(s<0||s>1)return 0;Ki.cross(ur,or,rr);var a=Ki.dot(e.d,ur)*r;if(a<0||s+a>1)return 0;var o=Ki.dot(sr,ur)*r;return o<0?0:o}),fr=function(){var e=new Ki(0,0,0);return function(t,i){var n=i.radius,r=i.center,s=t.o,a=t.d,o=n*n;Ki.subtract(e,r,s);var u=e.lengthSqr(),h=Ki.dot(e,a),c=o-(u-h*h);if(c<0)return 0;var l=Math.sqrt(c),_=u<o?h+l:h-l;return _<0?0:_}}(),pr=(hr=new Ki,cr=new Ki,function(e,t){return Ki.subtract(hr,t.center,t.halfExtents),Ki.add(cr,t.center,t.halfExtents),function(e,t,i){var n=e.o,r=e.d,s=1/r.x,a=1/r.y,o=1/r.z,u=(t.x-n.x)*s,h=(i.x-n.x)*s,c=(t.y-n.y)*a,l=(i.y-n.y)*a,_=(t.z-n.z)*o,d=(i.z-n.z)*o,f=Math.max(Math.max(Math.min(u,h),Math.min(c,l)),Math.min(_,d)),p=Math.min(Math.min(Math.max(u,h),Math.max(c,l)),Math.max(_,d));return p<0||f>p?0:f>0?f:p}(e,hr,cr)}),mr=function(){var e=new Ki,t=new Ki,i=new Ki,n=new Ki,r=new Ki,s=new Ki,a=new Ki,o=new Array(3),u=new Array(3),h=new Array(3),c=new Array(6);return function(l,_){o[0]=_.halfExtents.x,o[1]=_.halfExtents.y,o[2]=_.halfExtents.z,e=_.center,t=l.o,i=l.d,Ki.set(n,_.orientation.m00,_.orientation.m01,_.orientation.m02),Ki.set(r,_.orientation.m03,_.orientation.m04,_.orientation.m05),Ki.set(s,_.orientation.m06,_.orientation.m07,_.orientation.m08),Ki.subtract(a,e,t),u[0]=Ki.dot(n,i),u[1]=Ki.dot(r,i),u[2]=Ki.dot(s,i),h[0]=Ki.dot(n,a),h[1]=Ki.dot(r,a),h[2]=Ki.dot(s,a);for(var d=0;d<3;++d){if(0===u[d]){if(-h[d]-o[d]>0||-h[d]+o[d]<0)return 0;u[d]=1e-7}c[2*d+0]=(h[d]+o[d])/u[d],c[2*d+1]=(h[d]-o[d])/u[d]}var f=Math.max(Math.max(Math.min(c[0],c[1]),Math.min(c[2],c[3])),Math.min(c[4],c[5])),p=Math.min(Math.min(Math.max(c[0],c[1]),Math.max(c[2],c[3])),Math.max(c[4],c[5]));return p<0||f>p?0:f>0?f:p}}(),gr=function(){var e=new Ki,t=new Ki,i=new Ki,n=new Ki,r=new Ki,s=new Ki,a=new Ki,o=new lr;return function(u,h){var c=h.radius*h.radius,l=Ki.normalize(e,u.d),_=h.ellipseCenter0,d=h.ellipseCenter1,f=Ki.subtract(t,d,_);if(f.equals(Ki.ZERO))return o.radius=h.radius,o.center.set(h.ellipseCenter0),$r.raySphere(u,o);var p=u.o,m=Ki.subtract(i,p,_),g=Ki.cross(n,l,f),v=g.lengthSqr();if(0===v){o.radius=h.radius;var y=Ki.subtract(r,d,p);return m.lengthSqr()<y.lengthSqr()?o.center.set(h.ellipseCenter0):o.center.set(h.ellipseCenter1),$r.raySphere(u,o)}var E=Ki.cross(r,m,f),T=f.lengthSqr(),A=2*Ki.dot(g,E),S=A*A-4*v*(E.lengthSqr()-c*T);if(S<0)return 0;var R=(-A-Math.sqrt(S))/(2*v);if(R<0){o.radius=h.radius;var w=Ki.subtract(s,d,p);return m.lengthSqr()<w.lengthSqr()?o.center.set(h.ellipseCenter0):o.center.set(h.ellipseCenter1),$r.raySphere(u,o)}var I=Ki.scaleAndAdd(s,u.o,l,R),b=Ki.subtract(a,I,_),O=Ki.dot(b,f)/T;return O>=0&&O<=1?R:O<0?(o.radius=h.radius,o.center.set(h.ellipseCenter0),$r.raySphere(u,o)):O>1?(o.radius=h.radius,o.center.set(h.ellipseCenter1),$r.raySphere(u,o)):0}}(),vr=function(){var e=new Ki(0,0,0);return function(t,i){Ki.subtract(e,t.e,t.s);var n=(i.d-Ki.dot(t.s,i.n))/Ki.dot(e,i.n);return n<0||n>1?0:n}}(),yr=function(){var e=new Ki(0,0,0),t=new Ki(0,0,0),i=new Ki(0,0,0),n=new Ki(0,0,0),r=new Ki(0,0,0),s=new Ki(0,0,0);return function(a,o,u){Ki.subtract(e,o.b,o.a),Ki.subtract(t,o.c,o.a),Ki.subtract(i,a.s,a.e),Ki.cross(r,e,t);var h=Ki.dot(i,r);if(h<=0)return 0;Ki.subtract(n,a.s,o.a);var c=Ki.dot(n,r);if(c<0||c>h)return 0;Ki.cross(s,i,n);var l=Ki.dot(t,s);if(l<0||l>h)return 0;var _=-Ki.dot(e,s);if(_<0||l+_>h)return 0;if(u){var d=1/h,f=1-(l*=d)-(_*=d);Ki.set(u,o.a.x*f+o.b.x*l+o.c.x*_,o.a.y*f+o.b.y*l+o.c.y*_,o.a.z*f+o.b.z*l+o.c.z*_)}return 1}}(),Er=new Zn;function Tr(e,t){Er.o.set(e.s),Ki.subtract(Er.d,e.e,e.s),Er.d.normalize();var i=pr(Er,t);return i<=e.length()?i:0}function Ar(e,t){Er.o.set(e.s),Ki.subtract(Er.d,e.e,e.s),Er.d.normalize();var i=mr(Er,t);return i<=e.length()?i:0}function Sr(e,t){Er.o.set(e.s),Ki.subtract(Er.d,e.e,e.s),Er.d.normalize();var i=fr(Er,t);return i<=e.length()?i:0}var Rr,wr,Ir,br,Or=(Rr=new Ki,wr=new Ki,Ir=new Ki,br=new Ki,function(e,t){return Ki.subtract(Rr,e.center,e.halfExtents),Ki.add(wr,e.center,e.halfExtents),Ki.subtract(Ir,t.center,t.halfExtents),Ki.add(br,t.center,t.halfExtents),Rr.x<=br.x&&wr.x>=Ir.x&&Rr.y<=br.y&&wr.y>=Ir.y&&Rr.z<=br.z&&wr.z>=Ir.z});function Nr(e,t,i,n,r,s){Ki.set(s[0],e.x+i.x*t.x+n.x*t.y+r.x*t.z,e.y+i.y*t.x+n.y*t.y+r.y*t.z,e.z+i.z*t.x+n.z*t.y+r.z*t.z),Ki.set(s[1],e.x-i.x*t.x+n.x*t.y+r.x*t.z,e.y-i.y*t.x+n.y*t.y+r.y*t.z,e.z-i.z*t.x+n.z*t.y+r.z*t.z),Ki.set(s[2],e.x+i.x*t.x-n.x*t.y+r.x*t.z,e.y+i.y*t.x-n.y*t.y+r.y*t.z,e.z+i.z*t.x-n.z*t.y+r.z*t.z),Ki.set(s[3],e.x+i.x*t.x+n.x*t.y-r.x*t.z,e.y+i.y*t.x+n.y*t.y-r.y*t.z,e.z+i.z*t.x+n.z*t.y-r.z*t.z),Ki.set(s[4],e.x-i.x*t.x-n.x*t.y-r.x*t.z,e.y-i.y*t.x-n.y*t.y-r.y*t.z,e.z-i.z*t.x-n.z*t.y-r.z*t.z),Ki.set(s[5],e.x+i.x*t.x-n.x*t.y-r.x*t.z,e.y+i.y*t.x-n.y*t.y-r.y*t.z,e.z+i.z*t.x-n.z*t.y-r.z*t.z),Ki.set(s[6],e.x-i.x*t.x+n.x*t.y-r.x*t.z,e.y-i.y*t.x+n.y*t.y-r.y*t.z,e.z-i.z*t.x+n.z*t.y-r.z*t.z),Ki.set(s[7],e.x-i.x*t.x-n.x*t.y+r.x*t.z,e.y-i.y*t.x-n.y*t.y+r.y*t.z,e.z-i.z*t.x-n.z*t.y+r.z*t.z)}function Cr(e,t){for(var i=Ki.dot(t,e[0]),n=i,r=1;r<8;++r){var s=Ki.dot(t,e[r]);i=s<i?s:i,n=s>n?s:n}return[i,n]}var Mr,Pr,Lr,Dr=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=new Ki(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Ki(0,0,0),n[r]=new Ki(0,0,0);var s=new Ki,a=new Ki;return function(t,r){Ki.set(e[0],1,0,0),Ki.set(e[1],0,1,0),Ki.set(e[2],0,0,1),Ki.set(e[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Ki.set(e[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Ki.set(e[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var o=0;o<3;++o)Ki.cross(e[6+3*o],e[o],e[3]),Ki.cross(e[7+3*o],e[o],e[4]),Ki.cross(e[7+3*o],e[o],e[5]);Ki.subtract(s,t.center,t.halfExtents),Ki.add(a,t.center,t.halfExtents),function(e,t,i){Ki.set(i[0],e.x,t.y,t.z),Ki.set(i[1],e.x,t.y,e.z),Ki.set(i[2],e.x,e.y,t.z),Ki.set(i[3],e.x,e.y,e.z),Ki.set(i[4],t.x,t.y,t.z),Ki.set(i[5],t.x,t.y,e.z),Ki.set(i[6],t.x,e.y,t.z),Ki.set(i[7],t.x,e.y,e.z)}(s,a,i),Nr(r.center,r.halfExtents,e[3],e[4],e[5],n);for(var u=0;u<15;++u){var h=Cr(i,e[u]),c=Cr(n,e[u]);if(c[0]>h[1]||h[0]>c[1])return 0}return 1}}(),Fr=function(e,t){var i=e.halfExtents.x*Math.abs(t.n.x)+e.halfExtents.y*Math.abs(t.n.y)+e.halfExtents.z*Math.abs(t.n.z),n=Ki.dot(t.n,e.center);return n+i<t.d?-1:n-i>t.d?0:1},Br=function(e,t){for(var i=0;i<t.planes.length;i++)if(-1===Fr(e,t.planes[i]))return 0;return 1},Ur=function(){for(var e=new Array(8),t=0,i=0,n=0;n<e.length;n++)e[n]=new Ki(0,0,0);return function(n,r){for(var s=0,a=!1,o=0;o<r.planes.length;o++){if(-1===(s=Fr(n,r.planes[o])))return 0;1===s&&(a=!0)}if(!a)return 1;for(var u=0;u<r.vertices.length;u++)Ki.subtract(e[u],r.vertices[u],n.center);t=0,i=0;for(var h=0;h<r.vertices.length;h++)e[h].x>n.halfExtents.x?t++:e[h].x<-n.halfExtents.x&&i++;if(t===r.vertices.length||i===r.vertices.length)return 0;t=0,i=0;for(var c=0;c<r.vertices.length;c++)e[c].y>n.halfExtents.y?t++:e[c].y<-n.halfExtents.y&&i++;if(t===r.vertices.length||i===r.vertices.length)return 0;t=0,i=0;for(var l=0;l<r.vertices.length;l++)e[l].z>n.halfExtents.z?t++:e[l].z<-n.halfExtents.z&&i++;return t===r.vertices.length||i===r.vertices.length?0:1}}(),Gr=(Mr=new Ki(0,0,0),Pr=new hn,function(e,t){return Ki.subtract(Mr,t,e.center),Ki.transformMat3(Mr,Mr,hn.transpose(Pr,e.orientation)),i=Mr,n=e.halfExtents,Math.abs(i.x)<n.x&&Math.abs(i.y)<n.y&&Math.abs(i.z)<n.z;var i,n}),kr=(Lr=function(e,t,i,n){return Math.abs(e.x*t+e.y*i+e.z*n)},function(e,t){var i=e.halfExtents.x*Lr(t.n,e.orientation.m00,e.orientation.m01,e.orientation.m02)+e.halfExtents.y*Lr(t.n,e.orientation.m03,e.orientation.m04,e.orientation.m05)+e.halfExtents.z*Lr(t.n,e.orientation.m06,e.orientation.m07,e.orientation.m08),n=Ki.dot(t.n,e.center);return n+i<t.d?-1:n-i>t.d?0:1}),Hr=function(e,t){for(var i=0;i<t.planes.length;i++)if(-1===kr(e,t.planes[i]))return 0;return 1},zr=function(){for(var e=new Array(8),t=0,i=0,n=0,r=0;r<e.length;r++)e[r]=new Ki(0,0,0);var s=function(e,t,i,n){return e.x*t+e.y*i+e.z*n};return function(r,a){for(var o=0,u=!1,h=0;h<a.planes.length;h++){if(-1===(o=kr(r,a.planes[h])))return 0;1===o&&(u=!0)}if(!u)return 1;for(var c=0;c<a.vertices.length;c++)Ki.subtract(e[c],a.vertices[c],r.center);i=0,n=0;for(var l=0;l<a.vertices.length;l++)(t=s(e[l],r.orientation.m00,r.orientation.m01,r.orientation.m02))>r.halfExtents.x?i++:t<-r.halfExtents.x&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var _=0;_<a.vertices.length;_++)(t=s(e[_],r.orientation.m03,r.orientation.m04,r.orientation.m05))>r.halfExtents.y?i++:t<-r.halfExtents.y&&n++;if(i===a.vertices.length||n===a.vertices.length)return 0;i=0,n=0;for(var d=0;d<a.vertices.length;d++)(t=s(e[d],r.orientation.m06,r.orientation.m07,r.orientation.m08))>r.halfExtents.z?i++:t<-r.halfExtents.z&&n++;return i===a.vertices.length||n===a.vertices.length?0:1}}(),Vr=function(){for(var e=new Array(15),t=0;t<15;t++)e[t]=new Ki(0,0,0);for(var i=new Array(8),n=new Array(8),r=0;r<8;r++)i[r]=new Ki(0,0,0),n[r]=new Ki(0,0,0);return function(t,r){Ki.set(e[0],t.orientation.m00,t.orientation.m01,t.orientation.m02),Ki.set(e[1],t.orientation.m03,t.orientation.m04,t.orientation.m05),Ki.set(e[2],t.orientation.m06,t.orientation.m07,t.orientation.m08),Ki.set(e[3],r.orientation.m00,r.orientation.m01,r.orientation.m02),Ki.set(e[4],r.orientation.m03,r.orientation.m04,r.orientation.m05),Ki.set(e[5],r.orientation.m06,r.orientation.m07,r.orientation.m08);for(var s=0;s<3;++s)Ki.cross(e[6+3*s],e[s],e[3]),Ki.cross(e[7+3*s],e[s],e[4]),Ki.cross(e[8+3*s],e[s],e[5]);Nr(t.center,t.halfExtents,e[0],e[1],e[2],i),Nr(r.center,r.halfExtents,e[3],e[4],e[5],n);for(var a=0;a<15;++a){var o=Cr(i,e[a]),u=Cr(n,e[a]);if(u[0]>o[1]||o[0]>u[1])return 0}return 1}}(),Wr=function(){for(var e=new lr,t=new Ki,i=new Ki,n=new Ki,r=new Array(8),s=0;s<8;s++)r[s]=new Ki;for(var a=new Array(8),o=0;o<8;o++)a[o]=new Ki;return function(s,o){if(0===Ki.squaredDistance(o.ellipseCenter0,o.ellipseCenter1))return e.radius=o.radius,e.center.set(o.ellipseCenter0),$r.sphereOBB(e,s);t.x=s.orientation.m00,t.y=s.orientation.m01,t.z=s.orientation.m02,i.x=s.orientation.m03,i.y=s.orientation.m04,i.z=s.orientation.m05,n.x=s.orientation.m06,n.y=s.orientation.m07,n.z=s.orientation.m08,Nr(s.center,s.halfExtents,t,i,n,r);var u=a,h=Ki.copy(u[0],t),c=Ki.copy(u[1],i),l=Ki.copy(u[2],n);Ki.subtract(u[3],o.center,s.center).normalize();var _=Ki.subtract(u[4],o.ellipseCenter0,o.ellipseCenter1);_.normalize(),Ki.cross(u[5],h,_),Ki.cross(u[6],c,_),Ki.cross(u[7],l,_);for(var d=0;d<8;++d){var f=Cr(r,u[d]),p=Ki.dot(u[d],o.ellipseCenter0),m=Ki.dot(u[d],o.ellipseCenter1),g=Math.max(p,m),v=Math.min(p,m)-o.radius,y=g+o.radius;if(v>f[1]||f[0]>y)return 0}return 1}}(),jr=function(e,t){var i=Ki.dot(t.n,e.center),n=e.radius*t.n.length();return i+n<t.d?-1:i-n>t.d?0:1},Xr=function(e,t){for(var i=0;i<t.planes.length;i++)if(-1===jr(e,t.planes[i]))return 0;return 1},Kr=function(){var e=new Ki(0,0,0),t=[1,-1,1,-1,1,-1];return function(i,n){for(var r=0;r<6;r++){var s=n.planes[r],a=i.radius,o=i.center,u=s.n,h=s.d,c=Ki.dot(u,o);if(c+a<h)return 0;if(!(c-a>h)){Ki.add(e,o,Ki.multiplyScalar(e,u,a));for(var l=0;l<6;l++)if(l!==r&&l!==r+t[r]){var _=n.planes[l];if(Ki.dot(_.n,e)<_.d)return 0}}}return 1}}(),Yr=function(e,t){var i=e.radius+t.radius;return Ki.squaredDistance(e.center,t.center)<i*i},qr=function(){var e=new Ki;return function(t,i){return Xn(e,t.center,i),Ki.squaredDistance(t.center,e)<t.radius*t.radius}}(),Qr=function(){var e=new Ki;return function(t,i){return Kn(e,t.center,i),Ki.squaredDistance(t.center,e)<t.radius*t.radius}}(),Zr=function(){var e=new Ki,t=new Ki;return function(i,n){var r=i.radius+n.radius,s=r*r,a=Ki.squaredDistance(n.ellipseCenter0,n.ellipseCenter1);if(0===a)return Ki.squaredDistance(i.center,n.center)<s;Ki.subtract(e,i.center,n.ellipseCenter0),Ki.subtract(t,n.ellipseCenter1,n.ellipseCenter0);var o=Ki.dot(e,t)/a;return o<0?Ki.squaredDistance(i.center,n.ellipseCenter0)<s:o>1?Ki.squaredDistance(i.center,n.ellipseCenter1)<s:(Ki.scaleAndAdd(e,n.ellipseCenter0,t,o),Ki.squaredDistance(i.center,e)<s)}}(),Jr=function(){var e=new Ki,t=new Ki,i=new Ki,n=new Ki,r=new Ki,s=new Ki;return function(a,o){var u,h,c=Ki.subtract(e,a.ellipseCenter1,a.ellipseCenter0),l=Ki.subtract(t,o.ellipseCenter1,o.ellipseCenter0),_=Ki.subtract(i,a.ellipseCenter0,o.ellipseCenter0),d=Ki.dot(c,c),f=Ki.dot(c,l),p=Ki.dot(l,l),m=Ki.dot(c,_),g=Ki.dot(l,_),v=d*p-f*f,y=v,E=v;v<Ti?(u=0,y=1,h=g,E=p):(h=d*g-f*m,(u=f*g-p*m)<0?(u=0,h=g,E=p):u>y&&(u=y,h=g+f,E=p)),h<0?(h=0,-m<0?u=0:-m>d?u=y:(u=-m,y=d)):h>E&&(h=E,-m+f<0?u=0:-m+f>d?u=y:(u=-m+f,y=d));var T=Math.abs(u)<Ti?0:u/y,A=Math.abs(h)<Ti?0:h/E,S=n;S.set(_),S.add(Ki.multiplyScalar(r,c,T)),S.subtract(Ki.multiplyScalar(s,l,A));var R=a.radius+o.radius;return S.lengthSqr()<R*R}}(),$r=e("dQ",{raySphere:fr,rayAABB:pr,rayOBB:mr,rayPlane:_r,rayTriangle:dr,rayCapsule:gr,raySubMesh:null,rayMesh:null,rayModel:null,lineSphere:Sr,lineAABB:Tr,lineOBB:Ar,linePlane:vr,lineTriangle:yr,sphereWithSphere:Yr,sphereAABB:qr,sphereOBB:Qr,spherePlane:jr,sphereFrustum:Xr,sphereFrustumAccurate:Kr,sphereCapsule:Zr,aabbWithAABB:Or,aabbWithOBB:Dr,aabbPlane:Fr,aabbFrustum:Br,aabbFrustumAccurate:Ur,obbWithOBB:Vr,obbPlane:kr,obbFrustum:Hr,obbFrustumAccurate:zr,obbPoint:Gr,obbCapsule:Wr,aabbFrustumCompletelyInside:function(e,t){for(var i=0;i<t.planes.length;i++)if(0!==Fr(e,t.planes[i]))return 0;return 1},capsuleWithCapsule:Jr,resolve:function(e,t,i){void 0===i&&(i=null);var n=e._type,r=t._type,s=this[n|r];return n<r?s(e,t,i):s(t,e,i)}});$r[qn.SHAPE_RAY|qn.SHAPE_SPHERE]=fr,$r[qn.SHAPE_RAY|qn.SHAPE_AABB]=pr,$r[qn.SHAPE_RAY|qn.SHAPE_OBB]=mr,$r[qn.SHAPE_RAY|qn.SHAPE_PLANE]=_r,$r[qn.SHAPE_RAY|qn.SHAPE_TRIANGLE]=dr,$r[qn.SHAPE_RAY|qn.SHAPE_CAPSULE]=gr,$r[qn.SHAPE_LINE|qn.SHAPE_SPHERE]=Sr,$r[qn.SHAPE_LINE|qn.SHAPE_AABB]=Tr,$r[qn.SHAPE_LINE|qn.SHAPE_OBB]=Ar,$r[qn.SHAPE_LINE|qn.SHAPE_PLANE]=vr,$r[qn.SHAPE_LINE|qn.SHAPE_TRIANGLE]=yr,$r[qn.SHAPE_SPHERE]=Yr,$r[qn.SHAPE_SPHERE|qn.SHAPE_AABB]=qr,$r[qn.SHAPE_SPHERE|qn.SHAPE_OBB]=Qr,$r[qn.SHAPE_SPHERE|qn.SHAPE_PLANE]=jr,$r[qn.SHAPE_SPHERE|qn.SHAPE_FRUSTUM]=Xr,$r[qn.SHAPE_SPHERE|qn.SHAPE_FRUSTUM_ACCURATE]=Kr,$r[qn.SHAPE_SPHERE|qn.SHAPE_CAPSULE]=Zr,$r[qn.SHAPE_AABB]=Or,$r[qn.SHAPE_AABB|qn.SHAPE_OBB]=Dr,$r[qn.SHAPE_AABB|qn.SHAPE_PLANE]=Fr,$r[qn.SHAPE_AABB|qn.SHAPE_FRUSTUM]=Br,$r[qn.SHAPE_AABB|qn.SHAPE_FRUSTUM_ACCURATE]=Ur,$r[qn.SHAPE_OBB]=Vr,$r[qn.SHAPE_OBB|qn.SHAPE_PLANE]=kr,$r[qn.SHAPE_OBB|qn.SHAPE_FRUSTUM]=Hr,$r[qn.SHAPE_OBB|qn.SHAPE_FRUSTUM_ACCURATE]=zr,$r[qn.SHAPE_OBB|qn.SHAPE_CAPSULE]=Wr,$r[qn.SHAPE_CAPSULE]=Jr,re(Qn.prototype,"line",[{name:"mag",newName:"len"},{name:"magnitude",newName:"len"}]),se($r,"intersect",[{name:"line_quad"}]);var es=new Ki(0,0,0),ts=new Ki(0,0,0),is=v.mat4(),ns=v.v4(),rs=function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=0),this.n=void 0,this._type=qn.SHAPE_PLANE,this.n=new Ki(e,t,i),this.d=n}return e.create=function(t,i,n,r){return new e(t,i,n,r)},e.clone=function(t){return new e(t.n.x,t.n.y,t.n.z,t.d)},e.copy=function(e,t){return Ki.copy(e.n,t.n),e.d=t.d,e},e.fromPoints=function(e,t,i,n){return Ki.subtract(es,i,t),Ki.subtract(ts,n,t),Ki.normalize(e.n,Ki.cross(e.n,es,ts)),e.d=Ki.dot(e.n,t),e},e.set=function(e,t,i,n,r){return e.n.x=t,e.n.y=i,e.n.z=n,e.d=r,e},e.fromNormalAndPoint=function(e,t,i){return Ki.copy(e.n,t),e.d=Ki.dot(t,i),e},e.normalize=function(e,t){var i=t.n.length();return Ki.normalize(e.n,t.n),i>0&&(e.d=t.d/i),e},e.prototype.transform=function(e){En.invert(is,e),En.transpose(is,is),zi.set(ns,this.n.x,this.n.y,this.n.z,this.d),zi.transformMat4(ns,ns,is),Ki.set(this.n,ns.x,ns.y,ns.z),this.d=ns.w},n(e,[{key:"type",get:function(){return this._type}},{key:"x",get:function(){return this.n.x},set:function(e){this.n.x=e}},{key:"y",get:function(){return this.n.y},set:function(e){this.n.y=e}},{key:"z",get:function(){return this.n.z},set:function(e){this.n.z=e}},{key:"w",get:function(){return this.d},set:function(e){this.d=e}}]),e}(),ss=e("dO",function(){function e(e,t,i,n,r,s,a,o,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=1),void 0===u&&(u=0),this.a=void 0,this.b=void 0,this.c=void 0,this._type=void 0,this._type=qn.SHAPE_TRIANGLE,this.a=new Ki(e,t,i),this.b=new Ki(n,r,s),this.c=new Ki(a,o,u)}return e.create=function(t,i,n,r,s,a,o,u,h){return void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=1),new e(t,i,n,r,s,a,o,u,h)},e.clone=function(t){return new e(t.a.x,t.a.y,t.a.z,t.b.x,t.b.y,t.b.z,t.c.x,t.c.y,t.c.z)},e.copy=function(e,t){return Ki.copy(e.a,t.a),Ki.copy(e.b,t.b),Ki.copy(e.c,t.c),e},e.fromPoints=function(e,t,i,n){return Ki.copy(e.a,t),Ki.copy(e.b,i),Ki.copy(e.c,n),e},e.set=function(e,t,i,n,r,s,a,o,u,h){return e.a.x=t,e.a.y=i,e.a.z=n,e.b.x=r,e.b.y=s,e.b.z=a,e.c.x=o,e.c.y=u,e.c.z=h,e},n(e,[{key:"type",get:function(){return this._type}}]),e}()),as=new Ki,os=new Ki,us=new Ki,hs=new Ki,cs=new hn,ls=function(e,t,i){cs.m00=Math.abs(i.m00),cs.m01=Math.abs(i.m01),cs.m02=Math.abs(i.m02),cs.m03=Math.abs(i.m04),cs.m04=Math.abs(i.m05),cs.m05=Math.abs(i.m06),cs.m06=Math.abs(i.m08),cs.m07=Math.abs(i.m09),cs.m08=Math.abs(i.m10),Ki.transformMat3(e,t,cs)},_s=e("cu",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),this.center=void 0,this.halfExtents=void 0,this._type=void 0,this._type=qn.SHAPE_AABB,this.center=new Ki(e,t,i),this.halfExtents=new Ki(n,r,s)}e.create=function(t,i,n,r,s,a){return new e(t,i,n,r,s,a)},e.clone=function(t){return new e(t.center.x,t.center.y,t.center.z,t.halfExtents.x,t.halfExtents.y,t.halfExtents.z)},e.copy=function(e,t){return Ki.copy(e.center,t.center),Ki.copy(e.halfExtents,t.halfExtents),e},e.fromPoints=function(e,t,i){return Ki.add(as,i,t),Ki.subtract(os,i,t),Ki.multiplyScalar(e.center,as,.5),Ki.multiplyScalar(e.halfExtents,os,.5),e},e.set=function(e,t,i,n,r,s,a){return e.center.set(t,i,n),e.halfExtents.set(r,s,a),e},e.merge=function(t,i,n){return Ki.subtract(as,i.center,i.halfExtents),Ki.subtract(os,n.center,n.halfExtents),Ki.add(us,i.center,i.halfExtents),Ki.add(hs,n.center,n.halfExtents),Ki.max(hs,us,hs),Ki.min(us,as,os),e.fromPoints(t,us,hs)},e.toBoundingSphere=function(e,t){return e.center.set(t.center),e.radius=t.halfExtents.length(),e},e.transform=function(e,t,i){return Ki.transformMat4(e.center,t.center,i),ls(e.halfExtents,t.halfExtents,i),e};var t=e.prototype;return t.getBoundary=function(e,t){Ki.subtract(e,this.center,this.halfExtents),Ki.add(t,this.center,this.halfExtents)},t.transform=function(e,t,i,n,r){Ki.transformMat4(r.center,this.center,e),ls(r.halfExtents,this.halfExtents,e)},t.clone=function(){return e.clone(this)},t.copy=function(t){return e.copy(this,t)},t.mergePoint=function(e){this.getBoundary(as,os),e.x<as.x&&(as.x=e.x),e.y<as.y&&(as.y=e.y),e.z<as.z&&(as.z=e.z),e.x>os.x&&(os.x=e.x),e.y>os.y&&(os.y=e.y),e.z>os.z&&(os.z=e.z),Ki.add(us,as,os),this.center.set(Ki.multiplyScalar(us,us,.5)),this.halfExtents.set(os.x-us.x,os.y-us.y,os.z-us.z)},t.mergePoints=function(e){if(!(e.length<1))for(var t=0;t<e.length;t++)this.mergePoint(e[t])},t.mergeFrustum=function(e){this.mergePoints(e.vertices)},n(e,[{key:"type",get:function(){return this._type}}]),e}()),ds=function(){function e(e,t,i){void 0===e&&(e=.5),void 0===t&&(t=.5),void 0===i&&(i=1),this._type=void 0,this.radius=void 0,this.halfHeight=void 0,this.axis=void 0,this.center=void 0,this.rotation=void 0,this.ellipseCenter0=void 0,this.ellipseCenter1=void 0,this._type=qn.SHAPE_CAPSULE,this.radius=e,this.halfHeight=t,this.axis=i,this.center=new Ki,this.rotation=new _n,this.ellipseCenter0=new Ki(0,t,0),this.ellipseCenter1=new Ki(0,-t,0),this.updateCache()}var t=e.prototype;return t.transform=function(e,t,i,n,r){var s=n,a=Gi(s);r.radius=this.radius*Math.abs(a);var o=(this.halfHeight+this.radius)*Math.abs(s.y)-r.radius;o<0&&(o=0),r.halfHeight=o,Ki.transformMat4(r.center,this.center,e),_n.multiply(r.rotation,this.rotation,i),r.updateCache()},t.updateCache=function(){this.updateLocalCenter(),Ki.transformQuat(this.ellipseCenter0,this.ellipseCenter0,this.rotation),Ki.transformQuat(this.ellipseCenter1,this.ellipseCenter1,this.rotation),this.ellipseCenter0.add(this.center),this.ellipseCenter1.add(this.center)},t.updateLocalCenter=function(){var e=this.halfHeight;switch(this.axis){case 0:this.ellipseCenter0.set(e,0,0),this.ellipseCenter1.set(-e,0,0);break;case 1:this.ellipseCenter0.set(0,e,0),this.ellipseCenter1.set(0,-e,0);break;case 2:this.ellipseCenter0.set(0,0,e),this.ellipseCenter1.set(0,0,-e)}},n(e,[{key:"type",get:function(){return this._type}}]),e}(),fs=new Array(8);fs[0]=new Ki(1,1,1),fs[1]=new Ki(-1,1,1),fs[2]=new Ki(-1,-1,1),fs[3]=new Ki(1,-1,1),fs[4]=new Ki(1,1,-1),fs[5]=new Ki(-1,1,-1),fs[6]=new Ki(-1,-1,-1),fs[7]=new Ki(1,-1,-1);var ps,ms=new Ki,gs=new Ki,vs=new Ki,ys=function(){t.createOrtho=function(e,t,i,n,r,s){var a=t/2,o=i/2;Ki.set(vs,a,o,-n),Ki.transformMat4(e.vertices[0],vs,s),Ki.set(vs,-a,o,-n),Ki.transformMat4(e.vertices[1],vs,s),Ki.set(vs,-a,-o,-n),Ki.transformMat4(e.vertices[2],vs,s),Ki.set(vs,a,-o,-n),Ki.transformMat4(e.vertices[3],vs,s),Ki.set(vs,a,o,-r),Ki.transformMat4(e.vertices[4],vs,s),Ki.set(vs,-a,o,-r),Ki.transformMat4(e.vertices[5],vs,s),Ki.set(vs,-a,-o,-r),Ki.transformMat4(e.vertices[6],vs,s),Ki.set(vs,a,-o,-r),Ki.transformMat4(e.vertices[7],vs,s),rs.fromPoints(e.planes[0],e.vertices[1],e.vertices[6],e.vertices[5]),rs.fromPoints(e.planes[1],e.vertices[3],e.vertices[4],e.vertices[7]),rs.fromPoints(e.planes[2],e.vertices[6],e.vertices[3],e.vertices[7]),rs.fromPoints(e.planes[3],e.vertices[0],e.vertices[5],e.vertices[4]),rs.fromPoints(e.planes[4],e.vertices[2],e.vertices[0],e.vertices[3]),rs.fromPoints(e.planes[5],e.vertices[7],e.vertices[5],e.vertices[6])},t.createFromAABB=function(e,t){var i=new Ki,n=new Ki;return Ki.subtract(i,t.center,t.halfExtents),Ki.add(n,t.center,t.halfExtents),e.vertices[0].set(i.x,n.y,i.z),e.vertices[1].set(n.x,n.y,i.z),e.vertices[2].set(n.x,i.y,i.z),e.vertices[3].set(i.x,i.y,i.z),e.vertices[4].set(i.x,n.y,n.z),e.vertices[5].set(n.x,n.y,n.z),e.vertices[6].set(n.x,i.y,n.z),e.vertices[7].set(i.x,i.y,n.z),e._type!==qn.SHAPE_FRUSTUM_ACCURATE||e.updatePlanes(),e};var e=t.prototype;function t(){this.planes=void 0,this.vertices=void 0,this._type=void 0,this._type=qn.SHAPE_FRUSTUM,this.planes=new Array(6);for(var e=0;e<6;++e)this.planes[e]=rs.create(0,0,0,0);this.vertices=new Array(8);for(var t=0;t<8;++t)this.vertices[t]=new Ki}return e.split=function(e,t,i,n,r){var s=Math.tan(.5*n),a=s*i;ms.set(e*a,e*s,e),gs.set(t*a,t*s,t);var o=this.vertices;vs.set(ms.x,ms.y,ms.z),Ki.transformMat4(o[0],vs,r),vs.set(-ms.x,ms.y,ms.z),Ki.transformMat4(o[1],vs,r),vs.set(-ms.x,-ms.y,ms.z),Ki.transformMat4(o[2],vs,r),vs.set(ms.x,-ms.y,ms.z),Ki.transformMat4(o[3],vs,r),vs.set(gs.x,gs.y,gs.z),Ki.transformMat4(o[4],vs,r),vs.set(-gs.x,gs.y,gs.z),Ki.transformMat4(o[5],vs,r),vs.set(-gs.x,-gs.y,gs.z),Ki.transformMat4(o[6],vs,r),vs.set(gs.x,-gs.y,gs.z),Ki.transformMat4(o[7],vs,r),this.updatePlanes()},t.create=function(){return new t},t.clone=function(e){return t.copy(new t,e)},t.copy=function(e,t){e._type=t.type;for(var i=0;i<6;++i)rs.copy(e.planes[i],t.planes[i]);for(var n=0;n<8;++n)Ki.copy(e.vertices[n],t.vertices[n]);return e},e.update=function(e,t){if(Ki.set(this.planes[0].n,e.m03+e.m00,e.m07+e.m04,e.m11+e.m08),this.planes[0].d=-(e.m15+e.m12),Ki.set(this.planes[1].n,e.m03-e.m00,e.m07-e.m04,e.m11-e.m08),this.planes[1].d=-(e.m15-e.m12),Ki.set(this.planes[2].n,e.m03+e.m01,e.m07+e.m05,e.m11+e.m09),this.planes[2].d=-(e.m15+e.m13),Ki.set(this.planes[3].n,e.m03-e.m01,e.m07-e.m05,e.m11-e.m09),this.planes[3].d=-(e.m15-e.m13),Ki.set(this.planes[4].n,e.m03+e.m02,e.m07+e.m06,e.m11+e.m10),this.planes[4].d=-(e.m15+e.m14),Ki.set(this.planes[5].n,e.m03-e.m02,e.m07-e.m06,e.m11-e.m10),this.planes[5].d=-(e.m15-e.m14),this._type===qn.SHAPE_FRUSTUM_ACCURATE){for(var i=0;i<6;i++){var n=this.planes[i],r=1/n.n.length();Ki.multiplyScalar(n.n,n.n,r),n.d*=r}for(var s=0;s<8;s++)Ki.transformMat4(this.vertices[s],fs[s],t)}},e.transform=function(e){if(this._type===qn.SHAPE_FRUSTUM_ACCURATE){for(var t=0;t<8;t++)Ki.transformMat4(this.vertices[t],this.vertices[t],e);this.updatePlanes()}},e.zero=function(){for(var e=0;e<8;e++)this.vertices[e].set(0,0,0);this.updatePlanes()},e.updatePlanes=function(){rs.fromPoints(this.planes[0],this.vertices[1],this.vertices[6],this.vertices[5]),rs.fromPoints(this.planes[1],this.vertices[3],this.vertices[4],this.vertices[7]),rs.fromPoints(this.planes[2],this.vertices[6],this.vertices[3],this.vertices[7]),rs.fromPoints(this.planes[3],this.vertices[0],this.vertices[5],this.vertices[4]),rs.fromPoints(this.planes[4],this.vertices[2],this.vertices[0],this.vertices[3]),rs.fromPoints(this.planes[5],this.vertices[7],this.vertices[5],this.vertices[6])},n(t,[{key:"accurate",set:function(e){this._type=e?qn.SHAPE_FRUSTUM_ACCURATE:qn.SHAPE_FRUSTUM}},{key:"type",get:function(){return this._type}}]),t}(),Es=new Ki,Ts=new Ki,As=new hn,Ss=function(){function e(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===s&&(s=1),void 0===a&&(a=1),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=1),this.center=void 0,this.halfExtents=void 0,this.orientation=void 0,this._type=void 0,this._type=qn.SHAPE_OBB,this.center=new Ki(e,t,i),this.halfExtents=new Ki(n,r,s),this.orientation=new hn(a,o,u,h,c,l,_,d,f)}e.create=function(t,i,n,r,s,a,o,u,h,c,l,_,d,f,p){return new e(t,i,n,r,s,a,o,u,h,c,l,_,d,f,p)},e.clone=function(t){return new e(t.center.x,t.center.y,t.center.z,t.halfExtents.x,t.halfExtents.y,t.halfExtents.z,t.orientation.m00,t.orientation.m01,t.orientation.m02,t.orientation.m03,t.orientation.m04,t.orientation.m05,t.orientation.m06,t.orientation.m07,t.orientation.m08)},e.copy=function(e,t){return Ki.copy(e.center,t.center),Ki.copy(e.halfExtents,t.halfExtents),hn.copy(e.orientation,t.orientation),e},e.fromPoints=function(e,t,i){return Ki.multiplyScalar(e.center,Ki.add(Es,t,i),.5),Ki.multiplyScalar(e.halfExtents,Ki.subtract(Ts,i,t),.5),hn.identity(e.orientation),e},e.set=function(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p){return Ki.set(e.center,t,i,n),Ki.set(e.halfExtents,r,s,a),hn.set(e.orientation,o,u,h,c,l,_,d,f,p),e};var t=e.prototype;return t.getBoundary=function(e,t){!function(e,t,i){As.m00=Math.abs(i.m00),As.m01=Math.abs(i.m01),As.m02=Math.abs(i.m02),As.m03=Math.abs(i.m03),As.m04=Math.abs(i.m04),As.m05=Math.abs(i.m05),As.m06=Math.abs(i.m06),As.m07=Math.abs(i.m07),As.m08=Math.abs(i.m08),Ki.transformMat3(e,t,As)}(Es,this.halfExtents,this.orientation),Ki.subtract(e,this.center,Es),Ki.add(t,this.center,Es)},t.transform=function(e,t,i,n,r){Ki.transformMat4(r.center,this.center,e),hn.fromQuat(r.orientation,i),Ki.multiply(r.halfExtents,this.halfExtents,n)},t.translateAndRotate=function(e,t,i){Ki.transformMat4(i.center,this.center,e),hn.fromQuat(i.orientation,t)},t.setScale=function(e,t){Ki.multiply(t.halfExtents,this.halfExtents,e)},n(e,[{key:"type",get:function(){return this._type}}]),e}();function Rs(e,t,i){void 0===i&&(i=1e-6);for(var n=0,r=e.length-1,s=r>>>1;n<=r;s=n+r>>>1){var a=e[s];if(a>t+i)r=s-1;else{if(!(a<t-i))return s;n=s+1}}return~n}ps=Symbol.iterator;var ws,Is,bs,Os=function(){function e(){this._times=[],this._values=[]}var t=e.prototype;return t[ps]=function(){var e=this,t=0;return{next:function(){if(t>=e._times.length)return{done:!0,value:void 0};var i=[e._times[t],e._values[t]];return++t,{done:!1,value:i}}}},t.keyframes=function(){return this},t.times=function(){return this._times},t.values=function(){return this._values},t.getKeyframeTime=function(e){return this._times[e]},t.getKeyframeValue=function(e){return this._values[e]},t.addKeyFrame=function(e,t){return this._insertNewKeyframe(e,t)},t.removeKeyframe=function(e){this._times.splice(e,1),this._values.splice(e,1)},t.indexOfKeyframe=function(e){return Rs(this._times,e)},t.updateTime=function(e,t){var i=this._values[e];this.removeKeyframe(e),this._insertNewKeyframe(t,i)},t.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.slice());else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return e[1]})))}},t.clear=function(){this._times.length=0,this._values.length=0},t.searchKeyframe=function(e){return Rs(this._times,e)},t.setKeyframes=function(e,t){e.length,t.length,function(e){e.every((function(e,t,i){return 0===t||e>i[t-1]||Si(e,i[t-1],1e-6)}))}(e),this._times=e,this._values=t},t._insertNewKeyframe=function(e,t){var i=this._times,n=this._values,r=i.length,s=Rs(i,e);if(s>=0)return s;var a=~s;return 0===a?(i.unshift(e),n.unshift(t)):a===r?(i.push(e),n.push(t)):(i.splice(a-1,0,e),n.splice(a-1,0,t)),a},n(e,[{key:"keyFramesCount",get:function(){return this._times.length}},{key:"rangeMin",get:function(){return this._times[0]}},{key:"rangeMax",get:function(){return this._times[this._values.length-1]}}]),e}();function Ns(e){return e>-1e-9&&e<1e-9}function Cs(e,t,i,n){return i.slice().reverse().reduce((function(i,n){return n(e,t,i)||i}),n)}di.fastDefine("cc.KeyframeCurve",Os,{_times:[],_values:[]}),function(e){e[e.LINEAR=0]="LINEAR",e[e.CONSTANT=1]="CONSTANT",e[e.CUBIC=2]="CUBIC"}(ws||(ws=e("eE",{}))),function(e){e[e.LINEAR=0]="LINEAR",e[e.CLAMP=1]="CLAMP",e[e.LOOP=2]="LOOP",e[e.PING_PONG=3]="PING_PONG"}(Is||(Is=e("gp",{}))),function(e){e[e.NONE=0]="NONE",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.BOTH=3]="BOTH"}(bs||(bs=e("eF",{})));var Ms=function(){},Ps=function(){return Ms},Ls=xs((function(){}));function xs(e){return function(t){return"function"==typeof t?e(t):function(i){return e(i,t)}}}function Ds(e){return function(t){return function(i){!function(e,t,i){var n=Bs(e);if(n){var r=Us(n,"proto");Us(r,"editor")[t]=i}}(i,e,t)}}}var Fs="__ccclassCache__";function Bs(e){return Us(e,Fs)}function Us(e,t){return e[t]||(e[t]={})}var Gs=e("cr",xs((function(e,t){var i=ze(e);i===Object&&(i=null);var n={name:t,extends:i,ctor:e},r=e[Fs];if(r){var s=r.proto;s&&ke(n,s),e[Fs]=void 0}return di(n)}))),ks=e("d6",Ds("requireComponent")),Hs=e("c_",Ds("executionOrder")),zs=e("cW",Ls);function Vs(e,t,i){var n=null;function r(e,t,i){!function(e,t,i,n,r,s){var a,o=s&&"function"!=typeof s&&(s.get||s.set);r&&(a=ii(r,o));var u=ke(t,a||r||{});o?(s.get&&(u.get=s.get),s.set&&(u.set=s.set)):Xs(e,u,i,n,s)}(function(e){return Bs(e.constructor)}(e),function(e,t){var i,n,r=Us(Bs(e.constructor),"proto"),s=Us(r,"properties");return null!==(n=s[i=t])&&void 0!==n?n:s[i]={}}(e,t),e.constructor,t,n,i)}return void 0===e?Vs({type:void 0}):void 0===t?(n=e,r):void r(e,t,i)}function Ws(e){var t;try{t=e()}catch(t){return e}return"object"!=typeof t||null===t?t:e}function js(e,t,i){var n,r,s=Bs(e.constructor),a=Us(s,"proto"),o=Us(a,"properties"),u=null!==(r=o[n=t])&&void 0!==r?r:o[n]={};return u.__internalFlags|=ni.STANDALONE,i&&"function"!=typeof i&&(i.get||i.set)?(i.get&&(u.get=i.get),i.set&&(u.set=i.set)):Xs(s,u,e.constructor,t,i),u}function Xs(e,t,i,n,r){if(void 0!==r)"function"==typeof r?t.default=Ws(r):null===r||r.initializer&&(t.default=Ws(r.initializer));else{var s=e.default||(e.default=function(e){var t;try{t=new e}catch(e){return{}}return t}(i));s.hasOwnProperty(n)&&(t.default=s[n])}}var Ks=Symbol("cc:SerializationMetadata"),Ys=e("cy",(function(e,t,i){Zs(js(e,t,i))}));function qs(e){return function(t,i,n){var r=js(t,i,n);r.formerlySerializedAs=e,Zs(r)}}var Qs=e("fJ",(function(e,t,i){var n=js(e,t,i);n.editorOnly=!0,Zs(n)}));function Zs(e){e.__internalFlags|=ni.IMPLICIT_SERIALIZABLE}var Js=e("es",Ms),$s=Ls,ea=Ps,ta=Ls,ia=Ps,na=Ps,ra=Ps,sa=e("gs",Ms),aa=e("gu",Ps),oa=e("gv",Ps),ua=e("gt",Ps),ha=e("gx",Ps),ca=e("gy",Ps),la=e("gz",Ms),_a=e("gw",Ps),da=e("gA",Ms),fa=va(Xt),pa=e("ev",va(Kt)),ma=va(Yt),ga=e("cO",va(qt));function va(e){return Vs({type:e})}var ya,Ea=e("cN",(function(e,t,i){js(e,t,i).override=!0})),Ta=e("gg","__editorExtras__"),Aa=e("eo",(function(){})),Sa=Object.freeze({__proto__:null,uniquelyReferenced:Js,ccclass:Gs,property:Vs,requireComponent:ks,executionOrder:Hs,disallowMultiple:zs,allowReplicated:function(e){di.Attr.setClassAttr(e,"replicated","visible",!0)},executeInEditMode:$s,menu:ea,playOnFocus:ta,inspector:ia,icon:na,help:ra,type:va,integer:fa,float:pa,boolean:ma,string:ga,editable:sa,tooltip:ua,visible:aa,displayName:oa,displayOrder:_a,range:ha,rangeStep:ca,slide:la,disallowAnimation:da,override:Ea,formerlySerializedAs:qs,serializable:Ys});e("ge",Sa);var Ra,wa,Ia,ba,Oa,Na,Ca,Ma,Pa,La,xa,Da=1<<22,Fa=[],Ba=e("dU",function(){function e(e){void 0===e&&(e=""),this._objFlags=void 0,this._name=void 0,this._name=e,this._objFlags=0}e._deferredDestroy=function(){for(var e=Fa.length,t=0;t<e;++t){var i=Fa[t];1&i._objFlags||i._destroyImmediate()}e===Fa.length?Fa.length=0:Fa.splice(0,e)};var t=e.prototype;return t.destroy=function(){return 1&this._objFlags?(q(5e3),!1):!(4&this._objFlags||(this._objFlags|=4,Fa.push(this),0))},t._destruct=function(){var e=this.constructor,t=e.__destruct__;t||(t=function(e,t){var i,n=e instanceof v.Node||e instanceof v.Component,r=n?"_id":null,s={};for(i in e)if(e.hasOwnProperty(i)){if(i===r)continue;switch(typeof e[i]){case"string":s[i]="";break;case"object":case"function":s[i]=null}}if(di._isCCClass(t))for(var a=v.Class.Attr.getClassAttrs(t),o=t.__props__,u=0;u<o.length;u++){var h=""+(i=o[u]);if(h in a){if(n&&"_id"===i)continue;switch(typeof a[h]){case"string":s[i]="";break;case"object":case"function":s[i]=null;break;case"undefined":s[i]=void 0}}}var c="";for(i in s){var l;l=di.IDENTIFIER_RE.test(i)?"o."+i+"=":"o["+di.escapeForJS(i)+"]=";var _=s[i];""===_&&(_='""'),c+=l+_+";\n"}return Function("o",c)}(this,e),we(e,"__destruct__",t,!0)),t(this)},t._destroyImmediate=function(){1&this._objFlags?Z(5e3):(this._onPreDestroy&&this._onPreDestroy(),this._destruct(),this._objFlags|=1)},n(e,[{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"hideFlags",get:function(){return this._objFlags&e.Flags.AllHideMasks},set:function(t){var i=t&e.Flags.AllHideMasks;this._objFlags=this._objFlags&~e.Flags.AllHideMasks|i}},{key:"replicated",get:function(){return!!(this._objFlags&Da)},set:function(e){e?this._objFlags|=Da:this._objFlags&=-4194305}},{key:"isValid",get:function(){return!(1&this._objFlags)}}]),e}()),Ua=Ba.prototype;function Ga(e){return e instanceof Ba}function ka(e,t){return"object"==typeof e?!(!e||e._objFlags&(t?5:1)):void 0!==e}function Ha(e,t){return(t<<3)+e}function za(e){return Wa[e]}function Va(e){switch(e){case La.Uint8:return Uint8Array;case La.Uint16:return Uint16Array;case La.Uint32:return Uint32Array;case La.Int8:return Int8Array;case La.Int16:return Int16Array;case La.Int32:return Int32Array;case La.Float32:return Float32Array;case La.Float64:return Float64Array}}Ua._deserialize=null,Ua._onPreDestroy=null,di.fastDefine("cc.Object",Ba,((ya={_name:"",_objFlags:0})[Ta]={},ya)),di.Attr.setClassAttr(Ba,Ta,"editorOnly",!0),di.Attr.setClassAttr(Ba,"replicated","visible",!1),we(Ba,"Flags",{Destroyed:1,DontSave:8,EditorOnly:16,Dirty:32,DontDestroy:64,PersistentMask:-4192741,Destroying:128,Deactivating:256,LockedInEditor:512,HideInHierarchy:1024,AllHideMasks:1560,IsPreloadStarted:8192,IsOnLoadStarted:32768,IsOnLoadCalled:16384,IsOnEnableCalled:2048,IsStartCalled:65536,IsEditorOnEnableCalled:4096,IsPositionLocked:1<<21,IsRotationLocked:1<<17,IsScaleLocked:1<<18,IsAnchorLocked:1<<19,IsSizeLocked:1<<20}),v.isValid=ka,v.Object=Ba,function(e){e[e.Uint8=0]="Uint8",e[e.Uint16=1]="Uint16",e[e.Uint32=2]="Uint32",e[e.Int8=3]="Int8",e[e.Int16=4]="Int16",e[e.Int32=5]="Int32",e[e.Float32=6]="Float32",e[e.Float64=7]="Float64"}(La||(La={})),function(e){e[e.Scalar=0]="Scalar",e[e.Vec2=1]="Vec2",e[e.Vec3=2]="Vec3",e[e.Vec4=3]="Vec4",e[e.Quat=4]="Quat",e[e.Mat4=5]="Mat4"}(xa||(xa={})),e("gf",Gs("cc.CompactValueTypeArray")((Ma=Ca=function(){function e(){this._byteOffset=Ia&&Ia(),this._unitCount=ba&&ba(),this._unitElement=Oa&&Oa(),this._length=Na&&Na()}return e.lengthFor=function(e,t,i){return za(t).requiredUnits*e.length*Va(i).BYTES_PER_ELEMENT},e.compress=function(t,i,n,r,s,a){for(var o=za(i),u=Va(n),h=o.requiredUnits*t.length,c=new u(r,s,h),l=0;l<t.length;++l)o.compress(c,l,t[l]);var _=new e;return _._unitElement=Ha(n,i),_._byteOffset=a,_._unitCount=h,_._length=t.length,_},e.prototype.decompress=function(e){for(var t,i={storageUnit:7&(t=this._unitElement),elementType:t>>3},n=i.storageUnit,r=za(i.elementType),s=new(Va(n))(e,this._byteOffset,this._unitCount),a=new Array(this._length),o=0;o<this._length;++o)a[o]=r.decompress(s,o);return a},e}(),Ca.StorageUnit=La,Ca.ElementType=xa,Ia=Cs((wa=Ma).prototype,"_byteOffset",[Ys],(function(){return 0})),ba=Cs(wa.prototype,"_unitCount",[Ys],(function(){return 0})),Oa=Cs(wa.prototype,"_unitElement",[Ys],(function(){return Ha(La.Uint8,xa.Scalar)})),Na=Cs(wa.prototype,"_length",[Ys],(function(){return 0})),Ra=wa))||Ra);var Wa=((Pa={})[xa.Scalar]={requiredUnits:1,compress:function(e,t,i){e[t]=i},decompress:function(e,t){return e[t]}},Pa[xa.Vec2]={requiredUnits:2,compress:function(e,t,i){e[2*t]=i.x,e[2*t+1]=i.y},decompress:function(e,t){return new Ki(e[2*t],e[2*t+1])}},Pa[xa.Vec3]={requiredUnits:3,compress:function(e,t,i){e[3*t]=i.x,e[3*t+1]=i.y,e[3*t+2]=i.z},decompress:function(e,t){return new Ki(e[3*t],e[3*t+1],e[3*t+2])}},Pa[xa.Vec4]={requiredUnits:4,compress:function(e,t,i){e[4*t]=i.x,e[4*t+1]=i.y,e[4*t+2]=i.z,e[4*t+3]=i.w},decompress:function(e,t){return new zi(e[4*t],e[4*t+1],e[4*t+2],e[4*t+3])}},Pa[xa.Quat]={requiredUnits:4,compress:function(e,t,i){e[4*t]=i.x,e[4*t+1]=i.y,e[4*t+2]=i.z,e[4*t+3]=i.w},decompress:function(e,t){return new _n(e[4*t],e[4*t+1],e[4*t+2],e[4*t+3])}},Pa[xa.Mat4]={requiredUnits:16,compress:function(e,t,i){En.toArray(e,i,16*t)},decompress:function(e,t){return En.fromArray(new En,e,16*t)}},Pa),ja=e("gi",Symbol("[[Serialize]]")),Xa=e("gh",Symbol("[[Deserialize]]"));function Ka(){return 0}function Ya(e){return e}function qa(e){return e*e}function Qa(e){return e*(2-e)}function Za(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}function Ja(e){return e*e*e}function $a(e){return--e*e*e+1}function eo(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}function to(e){return e*e*e*e}function io(e){return 1- --e*e*e*e}function no(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}function ro(e){return e*e*e*e*e}function so(e){return--e*e*e*e*e+1}function ao(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}function oo(e){return 1===e?1:1-Math.cos(e*Math.PI/2)}function uo(e){return Math.sin(e*Math.PI/2)}function ho(e){return.5*(1-Math.cos(Math.PI*e))}function co(e){return 0===e?0:Math.pow(1024,e-1)}function lo(e){return 1===e?1:1-Math.pow(2,-10*e)}function _o(e){return 0===e?0:1===e?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(2-Math.pow(2,-10*(e-1)))}function fo(e){return 1-Math.sqrt(1-e*e)}function po(e){return Math.sqrt(1- --e*e)}function mo(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}function go(e){var t,i=.1;return 0===e?0:1===e?1:(!i||i<1?(i=1,t=.1):t=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/.4))}function vo(e){var t,i=.1;return 0===e?0:1===e?1:(!i||i<1?(i=1,t=.1):t=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*e)*Math.sin(2*(e-t)*Math.PI/.4)+1)}function yo(e){var t,i=.1;return 0===e?0:1===e?1:(!i||i<1?(i=1,t=.1):t=.4*Math.asin(1/i)/(2*Math.PI),(e*=2)<1?i*Math.pow(2,10*(e-=1))*Math.sin(2*(e-t)*Math.PI/.4)*-.5:i*Math.pow(2,-10*(e-=1))*Math.sin(2*(e-t)*Math.PI/.4)*.5+1)}function Eo(e){if(1===e)return 1;var t=1.70158;return e*e*((t+1)*e-t)}function To(e){if(0===e)return 0;var t=1.70158;return--e*e*((t+1)*e+t)+1}function Ao(e){var t=2.5949095;return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}function So(e){return 1-Ro(1-e)}function Ro(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375}function wo(e){return e<.5?.5*So(2*e):.5*Ro(2*e-1)+.5}function Io(e){return e<=0?0:e>=1?1:e*e*(3-2*e)}function bo(e){return e<=0?0:e>=1?1:e*e*e*(e*(6*e-15)+10)}v._decorator=Sa;var Oo=Uo(qa,Qa),No=Uo(Ja,$a),Co=Uo(to,io),Mo=Uo(ro,so),Po=Uo(oo,uo),Lo=Uo(co,lo),xo=Uo(fo,po),Do=Uo(go,vo),Fo=Uo(Eo,To),Bo=Uo(So,Ro);function Uo(e,t){return function(i){return i<.5?t(2*i)/2:e(2*i-1)/2+.5}}var Go,ko,Ho=Object.freeze({__proto__:null,constant:Ka,linear:Ya,quadIn:qa,quadOut:Qa,quadInOut:Za,cubicIn:Ja,cubicOut:$a,cubicInOut:eo,quartIn:to,quartOut:io,quartInOut:no,quintIn:ro,quintOut:so,quintInOut:ao,sineIn:oo,sineOut:uo,sineInOut:ho,expoIn:co,expoOut:lo,expoInOut:_o,circIn:fo,circOut:po,circInOut:mo,elasticIn:go,elasticOut:vo,elasticInOut:yo,backIn:Eo,backOut:To,backInOut:Ao,bounceIn:So,bounceOut:Ro,bounceInOut:wo,smooth:Io,fade:bo,quadOutIn:Oo,cubicOutIn:No,quartOutIn:Co,quintOutIn:Mo,sineOutIn:Po,expoOutIn:Lo,circOutIn:xo,elasticOutIn:Do,backOutIn:Fo,bounceOutIn:Bo});e("ey",Ho),function(e){e[e.LINEAR=0]="LINEAR",e[e.CONSTANT=1]="CONSTANT",e[e.QUAD_IN=2]="QUAD_IN",e[e.QUAD_OUT=3]="QUAD_OUT",e[e.QUAD_IN_OUT=4]="QUAD_IN_OUT",e[e.QUAD_OUT_IN=5]="QUAD_OUT_IN",e[e.CUBIC_IN=6]="CUBIC_IN",e[e.CUBIC_OUT=7]="CUBIC_OUT",e[e.CUBIC_IN_OUT=8]="CUBIC_IN_OUT",e[e.CUBIC_OUT_IN=9]="CUBIC_OUT_IN",e[e.QUART_IN=10]="QUART_IN",e[e.QUART_OUT=11]="QUART_OUT",e[e.QUART_IN_OUT=12]="QUART_IN_OUT",e[e.QUART_OUT_IN=13]="QUART_OUT_IN",e[e.QUINT_IN=14]="QUINT_IN",e[e.QUINT_OUT=15]="QUINT_OUT",e[e.QUINT_IN_OUT=16]="QUINT_IN_OUT",e[e.QUINT_OUT_IN=17]="QUINT_OUT_IN",e[e.SINE_IN=18]="SINE_IN",e[e.SINE_OUT=19]="SINE_OUT",e[e.SINE_IN_OUT=20]="SINE_IN_OUT",e[e.SINE_OUT_IN=21]="SINE_OUT_IN",e[e.EXPO_IN=22]="EXPO_IN",e[e.EXPO_OUT=23]="EXPO_OUT",e[e.EXPO_IN_OUT=24]="EXPO_IN_OUT",e[e.EXPO_OUT_IN=25]="EXPO_OUT_IN",e[e.CIRC_IN=26]="CIRC_IN",e[e.CIRC_OUT=27]="CIRC_OUT",e[e.CIRC_IN_OUT=28]="CIRC_IN_OUT",e[e.CIRC_OUT_IN=29]="CIRC_OUT_IN",e[e.ELASTIC_IN=30]="ELASTIC_IN",e[e.ELASTIC_OUT=31]="ELASTIC_OUT",e[e.ELASTIC_IN_OUT=32]="ELASTIC_IN_OUT",e[e.ELASTIC_OUT_IN=33]="ELASTIC_OUT_IN",e[e.BACK_IN=34]="BACK_IN",e[e.BACK_OUT=35]="BACK_OUT",e[e.BACK_IN_OUT=36]="BACK_IN_OUT",e[e.BACK_OUT_IN=37]="BACK_OUT_IN",e[e.BOUNCE_IN=38]="BOUNCE_IN",e[e.BOUNCE_OUT=39]="BOUNCE_OUT",e[e.BOUNCE_IN_OUT=40]="BOUNCE_IN_OUT",e[e.BOUNCE_OUT_IN=41]="BOUNCE_OUT_IN",e[e.SMOOTH=42]="SMOOTH",e[e.FADE=43]="FADE"}(ko||(ko=e("eD",{})));var zo,Vo=((Go={})[ko.CONSTANT]=Ka,Go[ko.LINEAR]=Ya,Go[ko.QUAD_IN]=qa,Go[ko.QUAD_OUT]=Qa,Go[ko.QUAD_IN_OUT]=Za,Go[ko.QUAD_OUT_IN]=Oo,Go[ko.CUBIC_IN]=Ja,Go[ko.CUBIC_OUT]=$a,Go[ko.CUBIC_IN_OUT]=eo,Go[ko.CUBIC_OUT_IN]=No,Go[ko.QUART_IN]=to,Go[ko.QUART_OUT]=io,Go[ko.QUART_IN_OUT]=no,Go[ko.QUART_OUT_IN]=Co,Go[ko.QUINT_IN]=ro,Go[ko.QUINT_OUT]=so,Go[ko.QUINT_IN_OUT]=ao,Go[ko.QUINT_OUT_IN]=Mo,Go[ko.SINE_IN]=oo,Go[ko.SINE_OUT]=uo,Go[ko.SINE_IN_OUT]=ho,Go[ko.SINE_OUT_IN]=Po,Go[ko.EXPO_IN]=co,Go[ko.EXPO_OUT]=lo,Go[ko.EXPO_IN_OUT]=_o,Go[ko.EXPO_OUT_IN]=Lo,Go[ko.CIRC_IN]=fo,Go[ko.CIRC_OUT]=po,Go[ko.CIRC_IN_OUT]=mo,Go[ko.CIRC_OUT_IN]=xo,Go[ko.ELASTIC_IN]=go,Go[ko.ELASTIC_OUT]=vo,Go[ko.ELASTIC_IN_OUT]=yo,Go[ko.ELASTIC_OUT_IN]=Do,Go[ko.BACK_IN]=Eo,Go[ko.BACK_OUT]=To,Go[ko.BACK_IN_OUT]=Ao,Go[ko.BACK_OUT_IN]=Fo,Go[ko.BOUNCE_IN]=So,Go[ko.BOUNCE_OUT]=Ro,Go[ko.BOUNCE_IN_OUT]=wo,Go[ko.BOUNCE_OUT_IN]=Bo,Go[ko.SMOOTH]=Io,Go[ko.FADE]=bo,Go);function Wo(e){return Vo[e]}R(255),R(65280);var jo,Xo,Ko,Yo=ws.LINEAR<<0|bs.NONE<<8|ko.LINEAR<<16,qo=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).value=0,t.rightTangent=0,t.rightTangentWeight=0,t.leftTangent=0,t.leftTangentWeight=0,t._flags=Yo,t}return s(t,e),n(t,[{key:"interpolationMode",get:function(){return(255&this._flags)>>0},set:function(e){this._flags&=-256,this._flags|=e<<0}},{key:"tangentWeightMode",get:function(){return(65280&this._flags)>>8},set:function(e){this._flags&=-65281,this._flags|=e<<8}},{key:"easingMethod",get:function(){return(16711680&this._flags)>>16},set:function(e){this._flags&=-16711681,this._flags|=e<<16}}]),t}(Aa);function Qo(e){var t=new qo;if("number"==typeof e)t.value=e;else{var i=e.interpolationMode,n=e.tangentWeightMode,r=e.value,s=e.rightTangent,a=e.rightTangentWeight,o=e.leftTangent,u=e.leftTangentWeight,h=e.easingMethod,c=e[Ta];t.value=null!=r?r:t.value,t.rightTangent=null!=s?s:t.rightTangent,t.rightTangentWeight=null!=a?a:t.rightTangentWeight,t.leftTangent=null!=o?o:t.leftTangent,t.leftTangentWeight=null!=u?u:t.leftTangentWeight,t.interpolationMode=null!=i?i:t.interpolationMode,t.tangentWeightMode=null!=n?n:t.tangentWeightMode,t.easingMethod=null!=h?h:t.easingMethod,c&&(t[Ta]=c)}return t}di.fastDefine("cc.RealKeyframeValue",qo,((zo={interpolationMode:ws.LINEAR,tangentWeightMode:bs.NONE,value:0,rightTangent:0,rightTangentWeight:0,leftTangent:0,leftTangentWeight:0,easingMethod:ko.LINEAR})[Ta]=void 0,zo)),di.Attr.setClassAttr(qo,Ta,"editorOnly",!0),(jo=qo,null!==(Ko=(Xo=jo)[Ks])&&void 0!==Ko?Ko:Xo[Ks]={}).uniquelyReferenced=!0;var Zo,Jo=e("et",function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).preExtrapolation=Is.CLAMP,t.postExtrapolation=Is.CLAMP,t}s(t,e);var i=t.prototype;return i.evaluate=function(e){var t=this._times,i=this._values,n=t.length;if(0===n)return 0;var r=t[0],s=t[n-1];if(e<r){var a=this.preExtrapolation,o=i[0];if(a===Is.CLAMP||n<2)return o.value;switch(a){case Is.LINEAR:return fu(r,i[0].value,t[1],i[1].value,e);case Is.LOOP:e=_u(e,r,s);break;case Is.PING_PONG:e=du(e,r,s);break;default:return o.value}}else if(e>s){var u=this.postExtrapolation,h=i[n-1];if(u===Is.CLAMP||n<2)return h.value;switch(u){case Is.LINEAR:return fu(s,h.value,t[n-2],i[n-2].value,e);case Is.LOOP:e=_u(e,r,s);break;case Is.PING_PONG:e=du(e,r,s);break;default:return h.value}}var c=Rs(t,e);if(c>=0)return i[c].value;var l=~c,_=l-1,d=t[_],f=i[_],p=t[l];return function(e,t,i,n,r){var s=i-e;switch(t.interpolationMode){default:case ws.CONSTANT:return t.value;case ws.LINEAR:var a=t.easingMethod===ko.LINEAR?r:Wo(t.easingMethod)(r);return Ii(t.value,n.value,a);case ws.CUBIC:var o=1/3,u=t.rightTangent,h=t.rightTangentWeight,c=0!=(t.tangentWeightMode&bs.RIGHT),l=n.leftTangent,_=n.leftTangentWeight,d=0!=(n.tangentWeightMode&bs.LEFT);if(c||d){var f=0;if(c)f=h;else{var p=s,m=s*u;f=Math.sqrt(p*p+m*m)*o}var g=Math.atan(u),v=Math.cos(g)*f+e,y=Math.sin(g)*f+t.value,E=0;if(d)E=_;else{var T=s,A=s*l;E=Math.sqrt(T*T+A*A)*o}var S=Math.atan(l),R=(v-e)/s,w=(-Math.cos(S)*E+i-e)/s,I=y,b=-Math.sin(S)*E+n.value,O=[0,0,0],N=function(e,t,i,n,r){var s=i/n,a=t/n,o=s*s,u=1/3*(-1/3*o+a),h=.5*(2/27*s*o-1/3*s*a+e/n),c=u*u*u,l=h*h+c,_=0;if(Ns(l)){if(Ns(h))return r[0]=0,1;var d=Math.cbrt(-h);return r[0]=2*d,r[1]=-d,2}if(l<0){var f=1/3*Math.acos(-h/Math.sqrt(-c)),p=2*Math.sqrt(-u);r[0]=p*Math.cos(f),r[1]=-p*Math.cos(f+Math.PI/3),r[2]=-p*Math.cos(f-Math.PI/3),_=3}else{var m=Math.sqrt(l),g=Math.cbrt(m-h),v=-Math.cbrt(m+h);r[0]=g+v,_=1}for(var y=1/3*s,E=0;E<_;++E)r[E]-=y;return _}(0-r,3*R,3*w-6*R,3*(R-w)+1,O),C=function(e,t,i){var n=i;if(1===t)n=e[0];else{n=-1/0;for(var r=0;r<t;++r){var s=e[r];s>=0&&s<=1&&s>n&&(n=s)}n===-1/0&&(n=0)}return n}(O,N,r);return pu(t.value,I,b,n.value,C)}var M=t.value+o*u*s,P=n.value-o*l*s;return pu(t.value,M,P,n.value,r)}}(d,f,p,i[l],(e-d)/(p-d))},i.addKeyFrame=function(t,i){return e.prototype.addKeyFrame.call(this,t,Qo(i))},i.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return Qo(e)})));else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return Qo(e[1])})))}},i.isConstant=function(e){if(this._values.length<=1)return!0;var t=this._values[0].value;return this._values.every((function(i){return Si(i.value,t,e)}))},i[ja]=function(e,t){if(t.toCCON){var i=this._times,n=this._values,r=i.length,s=new DataView(new ArrayBuffer(0+$o+$o+eu+tu*r+hu*r)),a=0;s.setUint8(a,this.preExtrapolation),a+=$o,s.setUint8(a,this.postExtrapolation),a+=$o,s.setUint32(a,r,!0),a+=eu,i.forEach((function(e,t){return s.setFloat32(a+tu*t,e,!0)})),a+=tu*r;for(var o,u=d(n);!(o=u()).done;){var h=o.value;a=cu(s,h,a)}var c=new Uint8Array(s.buffer,0,a);e.writeProperty("bytes",c);var l=n.map((function(e){return e[Ta]}));l.some((function(e){return void 0!==e}))&&e.writeProperty("keyframeValueEditorExtras",l)}else e.writeThis()},i[Xa]=function(e,t){if(t.fromCCON){var i=e.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0;this.preExtrapolation=n.getUint8(r),r+=$o,this.postExtrapolation=n.getUint8(r),r+=$o;var s=n.getUint32(r,!0);r+=eu;var a=Array.from({length:s},(function(e,t){return n.getFloat32(r+tu*t,!0)}));r+=tu*s;for(var o=new Array(s),u=0;u<s;++u){var h=Qo({});r=lu(n,h,r),o[u]=h}i.byteLength;var c=e.readProperty("keyframeValueEditorExtras");c&&(c.length,c.forEach((function(e,t){return o[t][Ta]=e}))),this._times=a,this._values=o}else e.readThis()},t}(Os));di.fastDefine("cc.RealCurve",Jo,{_times:[],_values:[],preExtrapolation:Is.CLAMP,postExtrapolation:Is.CLAMP}),function(e){e[e.VALUE=1]="VALUE",e[e.INTERPOLATION_MODE=2]="INTERPOLATION_MODE",e[e.TANGENT_WEIGHT_MODE=4]="TANGENT_WEIGHT_MODE",e[e.LEFT_TANGENT=8]="LEFT_TANGENT",e[e.LEFT_TANGENT_WEIGHT=16]="LEFT_TANGENT_WEIGHT",e[e.RIGHT_TANGENT=32]="RIGHT_TANGENT",e[e.RIGHT_TANGENT_WEIGHT=64]="RIGHT_TANGENT_WEIGHT"}(Zo||(Zo={}));var $o=1,eu=4,tu=4,iu=Qo({}),nu=iu.interpolationMode,ru=iu.tangentWeightMode,su=iu.leftTangent,au=iu.leftTangentWeight,ou=iu.rightTangent,uu=iu.rightTangentWeight,hu=26;function cu(e,t,i){var n=0,r=i,s=r;r+=4;var a=t.value,o=t.interpolationMode,u=t.tangentWeightMode,h=t.rightTangent,c=t.rightTangentWeight,l=t.leftTangent,_=t.leftTangentWeight,d=t.easingMethod;return e.setFloat32(r,a,!0),r+=4,o!==nu&&(n|=Zo.INTERPOLATION_MODE,e.setUint8(r,o),r+=1),u!==ru&&(n|=Zo.TANGENT_WEIGHT_MODE,e.setUint8(r,u),r+=1),l!==su&&(n|=Zo.LEFT_TANGENT,e.setFloat32(r,l,!0),r+=4),_!==au&&(n|=Zo.LEFT_TANGENT_WEIGHT,e.setFloat32(r,_,!0),r+=4),h!==ou&&(n|=Zo.RIGHT_TANGENT,e.setFloat32(r,h,!0),r+=4),c!==uu&&(n|=Zo.RIGHT_TANGENT_WEIGHT,e.setFloat32(r,c,!0),r+=4),n|=d<<8,e.setUint32(s,n,!0),r}function lu(e,t,i){var n=i,r=e.getUint32(n,!0);n+=4,t.value=e.getFloat32(n,!0),n+=4,r&Zo.INTERPOLATION_MODE&&(t.interpolationMode=e.getUint8(n),n+=1),r&Zo.TANGENT_WEIGHT_MODE&&(t.tangentWeightMode=e.getUint8(n),n+=1),r&Zo.LEFT_TANGENT&&(t.leftTangent=e.getFloat32(n,!0),n+=4),r&Zo.LEFT_TANGENT_WEIGHT&&(t.leftTangentWeight=e.getFloat32(n,!0),n+=4),r&Zo.RIGHT_TANGENT&&(t.rightTangent=e.getFloat32(n,!0),n+=4),r&Zo.RIGHT_TANGENT_WEIGHT&&(t.rightTangentWeight=e.getFloat32(n,!0),n+=4);var s=(65280&r)>>8;return t.easingMethod=s,n}function _u(e,t,i){return t+Fi(e-t,i-t)}function du(e,t,i){return t+Bi(e-t,i-t)}function fu(e,t,i,n,r){return t+(n-t)/(i-e)*(r-e)}function pu(e,t,i,n,r){var s=1-r;return s*s*s*e+3*s*s*r*t+3*s*r*r*i+r*r*r*n}function mu(e,t,i,n,r){var s=1-r;return s*(s*(e+(3*t-e)*r)+3*i*r*r)+n*r*r*r}v.bezier=mu;var gu,vu,yu,Eu,Tu,Au,Su,Ru,wu,Iu,bu=Math.cos,Ou=Math.acos,Nu=Math.max,Cu=2*Math.PI,Mu=Math.sqrt;function Pu(e){return e<0?-Math.pow(-e,1/3):Math.pow(e,1/3)}function Lu(e,t){var i=function(e,t){var i,n,r,s,a=t-0,o=t-e[0],u=3*a,h=3*o,c=3*(t-e[2]),l=1/(-a+h-c+(t-1)),_=1/3,d=(u-6*o+c)*l,f=d*_,p=(-u+h)*l,m=(3*p-d*d)*_,g=m*_,v=(2*d*d*d-9*d*p+a*l*27)/27,y=v/2,E=y*y+g*g*g;if(E<0){var T=-m*_,A=Mu(T*T*T),S=-v/(2*A),R=Ou(S<-1?-1:S>1?1:S),w=2*Pu(A);return n=w*bu(R*_)-f,r=w*bu((R+Cu)*_)-f,s=w*bu((R+2*Cu)*_)-f,n>=0&&n<=1?r>=0&&r<=1?s>=0&&s<=1?Nu(n,r,s):Nu(n,r):s>=0&&s<=1?Nu(n,s):n:r>=0&&r<=1?s>=0&&s<=1?Nu(r,s):r:s}if(0===E)return r=-(i=y<0?Pu(-y):-Pu(y))-f,(n=2*i-f)>=0&&n<=1?r>=0&&r<=1?Nu(n,r):n:r;var I=Mu(E);return(i=Pu(-y+I))-Pu(y+I)-f}(e,t),n=e[1];return((1-i)*(n+(e[3]-n)*i)*3+i*i)*i}v.bezierByTime=Lu,function(e){e[e.SLERP=0]="SLERP",e[e.CONSTANT=1]="CONSTANT"}(Iu||(Iu=e("eG",{})));var xu,Du=Gs("cc.QuatKeyframeValue")(gu=Js((vu=function(e){var t=void 0===e?{}:e,i=t.value,n=t.interpolationMode,r=t.easingMethod;this.interpolationMode=yu&&yu(),this.value=Eu&&Eu(),this.easingMethod=Tu&&Tu(),this.value=i?_n.clone(i):this.value,this.interpolationMode=null!=n?n:this.interpolationMode,this.easingMethod=null!=r?r:this.easingMethod},yu=Cs(vu.prototype,"interpolationMode",[Ys],(function(){return Iu.SLERP})),Eu=Cs(vu.prototype,"value",[Ys],(function(){return _n.clone(_n.IDENTITY)})),Tu=Cs(vu.prototype,"easingMethod",[Ys],(function(){return ko.LINEAR})),gu=vu))||gu)||gu;function Fu(e){return new Du(e)}e("ew",Gs("cc.QuatCurve")((Su=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).preExtrapolation=Ru&&Ru(),t.postExtrapolation=wu&&wu(),t}s(t,e);var i=t.prototype;return i.evaluate=function(e,t){var i;null!==(i=t)&&void 0!==i||(t=new _n);var n=this._times,r=this._values,s=this.postExtrapolation,a=this.preExtrapolation,o=n.length;if(0===o)return t;var u=n[0],h=n[o-1];if(e<u){var c=r[0];switch(a){case Is.LOOP:e=u+Fi(e-u,h-u);break;case Is.PING_PONG:e=u+Bi(e-u,h-u);break;case Is.CLAMP:default:return _n.copy(t,c.value)}}else if(e>h){var l=r[o-1];switch(s){case Is.LOOP:e=u+Fi(e-u,h-u);break;case Is.PING_PONG:e=u+Bi(e-u,h-u);break;case Is.CLAMP:default:return _n.copy(t,l.value)}}var _=Rs(n,e);if(_>=0)return _n.copy(t,r[_].value);var d=~_,f=d-1,p=n[f],m=r[f],g=n[d],v=r[d],y=(e-p)/(g-p);switch(m.interpolationMode){default:case Iu.CONSTANT:return _n.copy(t,m.value);case Iu.SLERP:var E=m.easingMethod,T=E===ko.LINEAR?y:Array.isArray(E)?Lu(E,y):Wo(E)(y);return _n.slerp(t,m.value,v.value,T)}},i.addKeyFrame=function(t,i){var n=new Du(i);return e.prototype.addKeyFrame.call(this,t,n)},i.assignSorted=function(e,t){if(void 0!==t)this.setKeyframes(e.slice(),t.map((function(e){return Fu(e)})));else{var i=Array.from(e);this.setKeyframes(i.map((function(e){return e[0]})),i.map((function(e){return Fu(e[1])})))}},i[ja]=function(e,t){if(t.toCCON){var i=this._times,n=this._values,r=!0;n.forEach((function(e,t,i){var n=i[0];r&&e.interpolationMode!==n.interpolationMode&&(r=!1)}));var s=i.length,a=zu*(r?1:s),o=n.reduce((function(e,t){var i=t.easingMethod;return e+(Array.isArray(i)?Vu+4*ju:Vu)}),0),u=0,h=new DataView(new ArrayBuffer(u+=Uu+Gu+ku*s+4*Hu*s+o+a+0)),c=0,l=0;r&&(l|=xu.INTERPOLATION_MODE),h.setUint32(c,l,!0),c+=Uu,h.setUint32(c,s,!0),c+=Gu,i.forEach((function(e,t){return h.setFloat32(c+ku*t,e,!0)})),c+=ku*s,n.forEach((function(e,t){var i=e.value,n=i.x,r=i.y,s=i.z,a=i.w,o=c+4*Hu*t;h.setFloat32(o+0*Hu,n,!0),h.setFloat32(o+1*Hu,r,!0),h.setFloat32(o+2*Hu,s,!0),h.setFloat32(o+3*Hu,a,!0)})),c+=4*Hu*s,n.forEach((function(e){var t=e.easingMethod;Array.isArray(t)?(h.setUint8(c,Wu),++c,h.setFloat32(c+0*ju,t[0],!0),h.setFloat32(c+1*ju,t[1],!0),h.setFloat32(c+2*ju,t[2],!0),h.setFloat32(c+3*ju,t[3],!0),c+=4*ju):(h.setUint8(c,t),++c)}));var _=c;c+=a;var d=_;n.forEach((function(e){var t=e.interpolationMode;h.setUint8(d,t),r||(d+=zu)}));var f=new Uint8Array(h.buffer);e.writeProperty("bytes",f)}else e.writeThis()},i[Xa]=function(e,t){if(t.fromCCON){var i=e.readProperty("bytes"),n=new DataView(i.buffer,i.byteOffset,i.byteLength),r=0,s=n.getUint32(r,!0);r+=Uu;var a=s&xu.INTERPOLATION_MODE,o=n.getUint32(r,!0);r+=Gu;var u=Array.from({length:o},(function(e,t){return n.getFloat32(r+ku*t,!0)})),h=r+=ku*o;r+=4*Hu*o;var c=Array.from({length:o},(function(e,t){var i=h+4*Hu*t,s=n.getFloat32(i+0*Hu,!0),a=n.getFloat32(i+1*Hu,!0),o=n.getFloat32(i+2*Hu,!0),u=n.getFloat32(i+3*Hu,!0),c=n.getUint8(r);++r;var l=Fu({value:{x:s,y:a,z:o,w:u}});return c!==Wu?l.easingMethod=c:(l.easingMethod=[n.getFloat32(r+0*ju,!0),n.getFloat32(r+1*ju,!0),n.getFloat32(r+2*ju,!0),n.getFloat32(r+3*ju,!0)],r+=4*ju),l}));if(a){var l=n.getUint8(r);++r;for(var _=0;_<o;++_)c[_].interpolationMode=l}else{for(var d=0;d<o;++d){var f=n.getUint8(r+d);c[d].interpolationMode=f}r+=o}this._times=u,this._values=c}else e.readThis()},t}(Os),Ru=Cs(Su.prototype,"preExtrapolation",[Ys],(function(){return Is.CLAMP})),wu=Cs(Su.prototype,"postExtrapolation",[Ys],(function(){return Is.CLAMP})),Au=Su))||Au),function(e){e[e.INTERPOLATION_MODE=1]="INTERPOLATION_MODE"}(xu||(xu={}));var Bu,Uu=1,Gu=4,ku=4,Hu=4,zu=1,Vu=1,Wu=255,ju=4,Xu=(e("ex",Gs("cc.ObjectCurve")(Bu=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.evaluate=function(e){var t=this.searchKeyframe(e);if(t>=0)return this._values[t];var i=Ri(~t-1,0,this._values.length-1);return this._values[i]},t}(Os))||Bu),function(){this.time=0,this.value=0,this.inTangent=0,this.outTangent=0});di.fastDefine("cc.Keyframe",Xu,{time:0,value:0,inTangent:0,outTangent:0});var Ku=function(){function e(){this.index=void 0,this.time=void 0,this.endTime=void 0,this.coefficient=void 0,this.index=-1,this.time=0,this.endTime=0,this.coefficient=new Float32Array(4)}return e.prototype.evaluate=function(e){return Yu(e-this.time,this.coefficient)},e}();function Yu(e,t){return e*(e*(e*t[0]+t[1])+t[2])+t[3]}var qu,Qu,Zu=e("ff",function(){function e(e){if(void 0===e&&(e=null),this.cachedKey=void 0,e instanceof Jo)this._curve=e;else{var t=new Jo;this._curve=t,t.preExtrapolation=Is.LOOP,t.postExtrapolation=Is.CLAMP,e?t.assignSorted(e.map((function(e){return[e.time,{interpolationMode:ws.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]}))):t.assignSorted([[0,{interpolationMode:ws.CUBIC,value:1}],[1,{interpolationMode:ws.CUBIC,value:1}]])}this.cachedKey=new Ku}var t=e.prototype;return t.addKey=function(e){e?this._curve.addKeyFrame(e.time,{interpolationMode:ws.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}):this._curve.clear()},t.evaluate_slow=function(e){return this._curve.evaluate(e)},t.evaluate=function(e){var t=this.cachedKey,i=this._curve,n=i.keyFramesCount-1,r=e,s=e<0?i.preExtrapolation:i.postExtrapolation,a=i.getKeyframeTime(0),o=i.getKeyframeTime(n);switch(s){case Is.LOOP:r=Fi(e-a,o-a)+a;break;case Is.PING_PONG:r=Bi(e-a,o-a)+a;break;case Is.CLAMP:default:r=Ri(e,a,o)}if(r>=t.time&&r<t.endTime)return t.evaluate(r);var u=this.findIndex(t,r),h=Math.min(u+1,n);return this.calcOptimizedKey(t,u,h),t.evaluate(r)},t.calcOptimizedKey=function(e,t,i){var n=this._curve.getKeyframeTime(t),r=this._curve.getKeyframeTime(i),s=this._curve.getKeyframeValue(t),a=s.value,o=s.leftTangent,u=this._curve.getKeyframeValue(i),h=u.value,c=u.rightTangent;e.index=t,e.time=n,e.endTime=r;var l=r-n,_=h-a,d=1/(l*l),f=o*l,p=c*l;e.coefficient[0]=(f+p-_-_)*d/l,e.coefficient[1]=(_+_+_-f-f-p)*d,e.coefficient[2]=o,e.coefficient[3]=a},t.findIndex=function(e,t){var i=this._curve,n=i.keyFramesCount,r=e.index;if(-1!==r)if(t>i.getKeyframeTime(r))for(var s=0;s<3;s++){var a=r+s;if(a+1<n&&i.getKeyframeTime(a+1)>t)return a}else for(var o=0;o<3;o++){var u=r-o;if(u>=0&&i.getKeyframeTime(u-1)<=t)return u-1}for(var h,c=0,l=n;l-c>1;)h=Math.floor((c+l)/2),i.getKeyframeTime(h)>=t?l=h:c=h;return c},n(e,[{key:"_internalCurve",get:function(){return this._curve}},{key:"keyFrames",get:function(){return Array.from(this._curve.keyframes()).map((function(e){var t=e[0],i=e[1],n=new Xu;return n.time=t,n.value=i.value,n.inTangent=i.leftTangent,n.outTangent=i.rightTangent,n}))},set:function(e){this._curve.assignSorted(e.map((function(e){return[e.time,{interpolationMode:ws.CUBIC,value:e.value,leftTangent:e.inTangent,rightTangent:e.outTangent}]})))}},{key:"preWrapMode",get:function(){return $u(this._curve.preExtrapolation)},set:function(e){this._curve.preExtrapolation=Ju(e)}},{key:"postWrapMode",get:function(){return $u(this._curve.postExtrapolation)},set:function(e){this._curve.postExtrapolation=Ju(e)}}]),e}());function Ju(e){switch(e){default:case qu.Default:case qu.Normal:case qu.Clamp:return Is.CLAMP;case qu.PingPong:return Is.PING_PONG;case qu.Loop:return Is.LOOP}}function $u(e){switch(e){default:case Is.LINEAR:case Is.CLAMP:return qu.Clamp;case Is.PING_PONG:return qu.PingPong;case Is.LOOP:return qu.Loop}}function eh(){var e=new Jo;return e.assignSorted([[0,{interpolationMode:ws.CUBIC,value:1}],[1,{interpolationMode:ws.CUBIC,value:1}]]),e}Zu.defaultKF=[{time:0,value:1,inTangent:0,outTangent:0},{time:1,value:1,inTangent:0,outTangent:0}],di.fastDefine("cc.AnimationCurve",Zu,{_curve:null}),function(e){e[e.Default=0]="Default",e[e.Normal=1]="Normal",e[e.Loop=2]="Loop",e[e.ShouldWrap=4]="ShouldWrap",e[e.Clamp=8]="Clamp",e[e.PingPong=22]="PingPong",e[e.Reverse=36]="Reverse"}(qu||(qu=e("ep",{}))),function(e){e[e.LINEAR=0]="LINEAR",e[e.BEZIER=1]="BEZIER",e[e.CATMULL_ROM=2]="CATMULL_ROM"}(Qu||(Qu={}));var th,ih=4294967295,nh=new Ki,rh=new Ki,sh=new Ki,ah=new Ki,oh=function(){function e(e,t){void 0===e&&(e=Qu.CATMULL_ROM),void 0===t&&(t=[]),this._type=void 0,this._mode=Qu.CATMULL_ROM,this._knots=[],this._type=qn.SHAPE_SPLINE,this._mode=e;for(var i=0;i<t.length;i++)this._knots[i]=new Ki(t[i])}e.create=function(t,i){return void 0===i&&(i=[]),new e(t,i)},e.clone=function(t){return new e(t.mode,t.knots)},e.copy=function(e,t){e._mode=t.mode,e._knots.length=0;for(var i=t.knots,n=i.length,r=0;r<n;r++)e._knots[r]=new Ki(i[r]);return e};var t=e.prototype;return t.setModeAndKnots=function(e,t){this._mode=e,this._knots.length=0;for(var i=0;i<t.length;i++)this._knots[i]=new Ki(t[i])},t.clearKnots=function(){this._knots.length=0},t.getKnotCount=function(){return this._knots.length},t.addKnot=function(e){this._knots.push(new Ki(e))},t.insertKnot=function(e,t){var i=new Ki(t);e>=this._knots.length?this._knots.push(i):this._knots.splice(e,0,i)},t.removeKnot=function(e){e>=0&&this._knots.length,this._knots.splice(e,1)},t.setKnot=function(e,t){e>=0&&this._knots.length,this._knots[e].set(t)},t.getKnot=function(e){return e>=0&&this._knots.length,this._knots[e]},t.getPoint=function(t,i){void 0===i&&(i=ih),t=Ri(t,0,1);var n=this.getSegments();if(0===n)return new Ki(0,0,0);if(i===ih){var r=1/n;i=Math.floor(t/r),t=t%r/r}if(i>=n)return new Ki(this._knots[this._knots.length-1]);switch(this._mode){case Qu.LINEAR:return e.calcLinear(this._knots[i],this._knots[i+1],t);case Qu.BEZIER:return e.calcBezier(this._knots[4*i],this._knots[4*i+1],this._knots[4*i+2],this._knots[4*i+3],t);case Qu.CATMULL_ROM:var s=i>0?this._knots[i-1]:this._knots[i],a=i+2<this._knots.length?this._knots[i+2]:this._knots[i+1];return e.calcCatmullRom(s,this._knots[i],this._knots[i+1],a,t);default:return new Ki(0,0,0)}},t.getPoints=function(e,t){if(void 0===t&&(t=ih),0===e)return[];if(1===e)return[this.getPoint(0,t)];for(var i=[],n=1/(e-1),r=0;r<e;r++){var s=r*n,a=this.getPoint(s,t);i.push(a)}return i},t.getSegments=function(){var e=this._knots.length;switch(this._mode){case Qu.LINEAR:case Qu.CATMULL_ROM:return e<2?(q(14300),0):e-1;case Qu.BEZIER:return e<4||e%4!=0?(q(14301),0):e/4}},e.calcLinear=function(e,t,i){var n=new Ki;return Ki.multiplyScalar(nh,e,1-i),Ki.multiplyScalar(rh,t,i),Ki.add(n,nh,rh),n},e.calcBezier=function(e,t,i,n,r){var s=new Ki,a=1-r;return Ki.multiplyScalar(nh,e,a*a*a),Ki.multiplyScalar(rh,t,3*r*a*a),Ki.multiplyScalar(sh,i,3*r*r*a),Ki.multiplyScalar(ah,n,r*r*r),Ki.add(nh,nh,rh),Ki.add(sh,sh,ah),Ki.add(s,nh,sh),s},e.calcCatmullRom=function(e,t,i,n,r){var s=new Ki,a=r*r,o=a*r;return Ki.multiplyScalar(nh,e,-.5*o+a-.5*r),Ki.multiplyScalar(rh,t,1.5*o-2.5*a+1),Ki.multiplyScalar(sh,i,-1.5*o+2*a+.5*r),Ki.multiplyScalar(ah,n,.5*o-.5*a),Ki.add(nh,nh,rh),Ki.add(sh,sh,ah),Ki.add(s,nh,sh),s},n(e,[{key:"type",get:function(){return this._type}},{key:"mode",get:function(){return this._mode}},{key:"knots",get:function(){return this._knots}}]),e}();function uh(e,t){console.warn(e+" is deprecated, please use "+t+" instead.")}!function(e){e[e.ALL=0]="ALL",e[e.CLOSEST=1]="CLOSEST",e[e.ANY=2]="ANY"}(th||(th=e("dP",{}))),re($r,"intersect",[{name:"ray_aabb",newName:"rayAABB"},{name:"ray_plane",newName:"rayPlane"},{name:"ray_triangle",newName:"rayTriangle"},{name:"ray_sphere",newName:"raySphere"},{name:"ray_obb",newName:"rayOBB"},{name:"ray_capsule",newName:"rayCapsule"},{name:"ray_subMesh",newName:"raySubMesh"},{name:"ray_mesh",newName:"rayMesh"},{name:"ray_model",newName:"rayModel"},{name:"line_plane",newName:"linePlane"},{name:"line_triangle",newName:"lineTriangle"},{name:"line_aabb",newName:"lineAABB"},{name:"line_obb",newName:"lineOBB"},{name:"line_sphere",newName:"lineSphere"},{name:"aabb_aabb",newName:"aabbWithAABB"},{name:"aabb_obb",newName:"aabbWithOBB"},{name:"aabb_plane",newName:"aabbPlane"},{name:"aabb_frustum",newName:"aabbFrustum"},{name:"aabbFrustum_accurate",newName:"aabbFrustumAccurate"},{name:"obb_point",newName:"obbPoint"},{name:"obb_plane",newName:"obbPlane"},{name:"obb_frustum",newName:"obbFrustum"},{name:"obbFrustum_accurate",newName:"obbFrustumAccurate"},{name:"obb_obb",newName:"obbWithOBB"},{name:"obb_capsule",newName:"obbCapsule"},{name:"sphere_plane",newName:"spherePlane"},{name:"sphere_frustum",newName:"sphereFrustum"},{name:"sphereFrustum_accurate",newName:"sphereFrustumAccurate"},{name:"sphere_sphere",newName:"sphereWithSphere"},{name:"sphere_aabb",newName:"sphereAABB"},{name:"sphere_obb",newName:"sphereOBB"},{name:"sphere_capsule",newName:"sphereCapsule"},{name:"capsule_capsule",newName:"capsuleWithCapsule"}]);var hh=function(e){function t(){var t;return t=e.call(this)||this,uh("line","Line"),t}return s(t,e),t}(Qn),ch=function(e){function t(){var t;return t=e.call(this)||this,uh("plane","Plane"),t}return s(t,e),t}(rs),lh=function(e){function t(){var t;return t=e.call(this)||this,uh("ray","Ray"),t}return s(t,e),t}(Zn),_h=function(e){function t(){var t;return t=e.call(this)||this,uh("triangle","Triangle"),t}return s(t,e),t}(ss),dh=function(e){function t(){var t;return t=e.call(this)||this,uh("sphere","Sphere"),t}return s(t,e),t}(lr),fh=function(e){function t(){var t;return t=e.call(this)||this,uh("aabb","AABB"),t}return s(t,e),t}(_s),ph=function(e){function t(){var t;return t=e.call(this)||this,uh("obb","OBB"),t}return s(t,e),t}(Ss),mh=function(e){function t(){var t;return t=e.call(this)||this,uh("capsule","Capsule"),t}return s(t,e),t}(ds),gh=function(e){function t(){var t;return t=e.call(this)||this,uh("frustum","Frustum"),t}return s(t,e),t}(ys),vh=Object.freeze({__proto__:null,distance:Yn,enums:qn,intersect:$r,Line:Qn,Plane:rs,Ray:Zn,Triangle:ss,Sphere:lr,AABB:_s,OBB:Ss,Capsule:ds,Frustum:ys,Keyframe:Xu,AnimationCurve:Zu,get WrapModeMask(){return qu},get SplineMode(){return Qu},Spline:oh,constructLegacyCurveAndConvert:eh,OptimizedKey:Ku,evalOptCurve:Yu,get ERaycastMode(){return th},line:hh,plane:ch,ray:lh,triangle:_h,sphere:dh,aabb:fh,obb:ph,capsule:mh,frustum:gh});e("fN",vh);var yh=new(function(){function e(){this._pools=[],this._lastShrinkPassed=0,this.shrinkTimeSpan=5}var t=e.prototype;return t.addContainer=function(e){-1===e._poolHandle&&(e._poolHandle=this._pools.length,this._pools.push(e))},t.removeContainer=function(e){-1!==e._poolHandle&&(this._pools[this._pools.length-1]._poolHandle=e._poolHandle,ut(this._pools,e._poolHandle),e._poolHandle=-1)},t.tryShrink=function(){for(var e=0;e<this._pools.length;e++)this._pools[e].tryShrink()},t.update=function(e){this._lastShrinkPassed+=e,this._lastShrinkPassed>this.shrinkTimeSpan&&(this.tryShrink(),this._lastShrinkPassed-=this.shrinkTimeSpan)},e}()),Eh=function(){function e(){this._poolHandle=-1,yh.addContainer(this)}return e.prototype.destroy=function(){yh.removeContainer(this)},e}(),Th=e("P",function(e){function t(t,i,n){var r;(r=e.call(this)||this)._ctor=void 0,r._elementsPerBatch=void 0,r._nextAvail=void 0,r._freePool=[],r._dtor=void 0,r._ctor=t,r._dtor=n||null,r._elementsPerBatch=Math.max(i,1),r._nextAvail=r._elementsPerBatch-1;for(var s=0;s<r._elementsPerBatch;++s)r._freePool.push(t());return r}s(t,e);var i=t.prototype;return i.alloc=function(){if(this._nextAvail<0){this._freePool.length=this._elementsPerBatch;for(var e=0;e<this._elementsPerBatch;e++)this._freePool[e]=this._ctor();this._nextAvail=this._elementsPerBatch-1}return this._freePool[this._nextAvail--]},i.free=function(e){this._freePool[++this._nextAvail]=e},i.freeArray=function(e){this._freePool.length=this._nextAvail+1,Array.prototype.push.apply(this._freePool,e),this._nextAvail+=e.length},i.tryShrink=function(){if(this._nextAvail>>1>this._elementsPerBatch){if(this._dtor)for(var e=this._nextAvail>>1;e<=this._nextAvail;e++)this._dtor(this._freePool[e]);this._freePool.length=this._nextAvail>>1,this._nextAvail=this._freePool.length-1}},i.destroy=function(){var t=arguments.length>0?arguments[0]:null;t&&q(14100);var i=t||this._dtor;if(i)for(var n=0;n<=this._nextAvail;n++)i(this._freePool[n]);this._freePool.length=0,this._nextAvail=-1,e.prototype.destroy.call(this)},t}(Eh)),Ah=e("R",function(e){function t(t,i,n){var r;(r=e.call(this)||this)._fn=void 0,r._dtor=null,r._count=0,r._data=void 0,r._initSize=0,r._fn=t,r._dtor=n||null,r._data=new Array(i),r._initSize=i;for(var s=0;s<i;++s)r._data[s]=t();return r}s(t,e);var i=t.prototype;return i.reset=function(){this._count=0},i.resize=function(e){if(e>this._data.length)for(var t=this._data.length;t<e;++t)this._data[t]=this._fn()},i.add=function(){return this._count>=this._data.length&&this.resize(this._data.length<<1),this._data[this._count++]},i.destroy=function(){if(this._dtor)for(var t=0;t<this._data.length;t++)this._dtor(this._data[t]);this._data.length=0,this._count=0,e.prototype.destroy.call(this)},i.tryShrink=function(){if(this._data.length>>2>this._count){var e=Math.max(this._initSize,this._data.length>>1);if(this._dtor)for(var t=e;t<this._data.length;t++)this._dtor(this._data[t]);this._data.length=e}},i.removeAt=function(e){if(!(e>=this._count)){var t=this._count-1,i=this._data[e];this._data[e]=this._data[t],this._data[t]=i,this._count-=1}},n(t,[{key:"length",get:function(){return this._count}},{key:"data",get:function(){return this._data}}]),t}(Eh)),Sh=e("C",function(e){function t(t,i){var n;return(n=e.call(this)||this).array=void 0,n.length=0,n._compareFn=void 0,n._initSize=0,n.array=new Array(t),n._initSize=t,n.length=0,n._compareFn=i,n}s(t,e);var i=t.prototype;return i.push=function(e){this.array[this.length++]=e},i.pop=function(){return this.array[--this.length]},i.get=function(e){return this.array[e]},i.clear=function(){this.length=0},i.destroy=function(){this.length=0,this.array.length=0,e.prototype.destroy.call(this)},i.tryShrink=function(){this.array.length>>2>this.length&&(this.array.length=Math.max(this._initSize,this.array.length>>1))},i.sort=function(){this.array.length=this.length,this.array.sort(this._compareFn)},i.concat=function(e){for(var t=0;t<e.length;++t)this.array[this.length++]=e[t]},i.fastRemove=function(e){if(!(e>=this.length||e<0)){var t=--this.length;this.array[e]=this.array[t]}},i.indexOf=function(e){for(var t=0,i=this.length;t<i;++t)if(this.array[t]===e)return t;return-1},t}(Eh)),Rh=e("cd",function(){function e(){this._id="",this._priority=0,this._executeInEditMode=!1}e.sortByPriority=function(e,t){return e._priority<t._priority?1:e._priority>t.priority?-1:0};var t=e.prototype;return t.init=function(){},t.update=function(){},t.postUpdate=function(){},t.destroy=function(){},n(e,[{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"id",get:function(){return this._id},set:function(e){this._id=e}}]),e}());Rh.Priority=mt({LOW:0,MEDIUM:100,HIGH:200,SCHEDULER:1<<31>>>0});var wh=new ge("Scheduler"),Ih=function(e,t,i,n){this.target=void 0,this.priority=void 0,this.paused=void 0,this.markedForDeletion=void 0,this.target=e,this.priority=t,this.paused=i,this.markedForDeletion=n};Ih.get=function(e,t,i,n){var r=Ih._listEntries.pop();return r?(r.target=e,r.priority=t,r.paused=i,r.markedForDeletion=n):r=new Ih(e,t,i,n),r},Ih.put=function(e){Ih._listEntries.length<20&&(e.target=null,Ih._listEntries.push(e))},Ih._listEntries=[];var bh=function(e,t,i,n){this.list=void 0,this.entry=void 0,this.target=void 0,this.callback=void 0,this.list=e,this.entry=t,this.target=i,this.callback=n};bh.get=function(e,t,i,n){var r=bh._hashUpdateEntries.pop();return r?(r.list=e,r.entry=t,r.target=i,r.callback=n):r=new bh(e,t,i,n),r},bh.put=function(e){bh._hashUpdateEntries.length<20&&(e.list=e.entry=e.target=e.callback=null,bh._hashUpdateEntries.push(e))},bh._hashUpdateEntries=[];var Oh=function(e,t,i,n,r,s){this.timers=void 0,this.target=void 0,this.timerIndex=void 0,this.currentTimer=void 0,this.currentTimerSalvaged=void 0,this.paused=void 0,this.timers=e,this.target=t,this.timerIndex=i,this.currentTimer=n,this.currentTimerSalvaged=r,this.paused=s};Oh.get=function(e,t,i,n,r,s){var a=Oh._hashTimerEntries.pop();return a?(a.timers=e,a.target=t,a.timerIndex=i,a.currentTimer=n,a.currentTimerSalvaged=r,a.paused=s):a=new Oh(e,t,i,n,r,s),a},Oh.put=function(e){Oh._hashTimerEntries.length<20&&(e.timers=e.target=e.currentTimer=null,Oh._hashTimerEntries.push(e))},Oh._hashTimerEntries=[];var Nh=function(){function e(){this._lock=void 0,this._scheduler=void 0,this._elapsed=void 0,this._runForever=void 0,this._useDelay=void 0,this._timesExecuted=void 0,this._repeat=void 0,this._delay=void 0,this._interval=void 0,this._target=void 0,this._callback=void 0,this._lock=!1,this._scheduler=null,this._elapsed=-1,this._runForever=!1,this._useDelay=!1,this._timesExecuted=0,this._repeat=0,this._delay=0,this._interval=0,this._target=null,this._callback=null}var t=e.prototype;return t.initWithCallback=function(e,t,i,n,r,s){return this._lock=!1,this._scheduler=e,this._target=i,this._callback=t,this._elapsed=-1,this._interval=n,this._delay=s,this._useDelay=this._delay>0,this._repeat=r,this._runForever=this._repeat===v.macro.REPEAT_FOREVER,!0},t.getInterval=function(){return this._interval},t.setInterval=function(e){this._interval=e},t.update=function(e){-1===this._elapsed?(this._elapsed=0,this._timesExecuted=0):(this._elapsed+=e,this._runForever&&!this._useDelay?this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0):(this._useDelay?this._elapsed>=this._delay&&(this.trigger(),this._elapsed-=this._delay,this._timesExecuted+=1,this._useDelay=!1):this._elapsed>=this._interval&&(this.trigger(),this._elapsed=0,this._timesExecuted+=1),this._callback&&!this._runForever&&this._timesExecuted>this._repeat&&this.cancel()))},t.getCallback=function(){return this._callback},t.trigger=function(){this._target&&this._callback&&(this._lock=!0,this._callback.call(this._target,this._elapsed),this._lock=!1)},t.cancel=function(){this._scheduler.unschedule(this._callback,this._target)},e}();Nh._timers=[],Nh.get=function(){return Nh._timers.pop()||new Nh},Nh.put=function(e){Nh._timers.length<20&&!e._lock&&(e._scheduler=e._target=e._callback=null,Nh._timers.push(e))};var Ch=e("go",function(e){function t(){var t;return(t=e.call(this)||this)._timeScale=void 0,t._updatesNegList=void 0,t._updates0List=void 0,t._updatesPosList=void 0,t._hashForUpdates=void 0,t._hashForTimers=void 0,t._currentTarget=void 0,t._currentTargetSalvaged=void 0,t._updateHashLocked=void 0,t._arrayForTimers=void 0,t._timeScale=1,t._updatesNegList=[],t._updates0List=[],t._updatesPosList=[],t._hashForUpdates=Ne(!0),t._hashForTimers=Ne(!0),t._currentTarget=null,t._currentTargetSalvaged=!1,t._updateHashLocked=!1,t._arrayForTimers=[],t}s(t,e),t.enableForTarget=function(e){var t=!1;(e.uuid||e.id)&&(t=!0),t||(e.__instanceId?q(1513):e.id=wh.getNewId())};var i=t.prototype;return i.setTimeScale=function(e){this._timeScale=e},i.getTimeScale=function(){return this._timeScale},i.update=function(e){var t,i,n,r,s;for(this._updateHashLocked=!0,1!==this._timeScale&&(e*=this._timeScale),t=0,n=(i=this._updatesNegList).length;t<n;t++)(r=i[t]).paused||r.markedForDeletion||r.target.update(e);for(t=0,n=(i=this._updates0List).length;t<n;t++)(r=i[t]).paused||r.markedForDeletion||r.target.update(e);for(t=0,n=(i=this._updatesPosList).length;t<n;t++)(r=i[t]).paused||r.markedForDeletion||r.target.update(e);var a=this._arrayForTimers;for(t=0;t<a.length;t++){if(s=a[t],this._currentTarget=s,this._currentTargetSalvaged=!1,!s.paused)for(s.timerIndex=0;s.timerIndex<s.timers.length;++s.timerIndex)s.currentTimer=s.timers[s.timerIndex],s.currentTimerSalvaged=!1,s.currentTimer.update(e),s.currentTimer=null;this._currentTargetSalvaged&&0===this._currentTarget.timers.length&&(this._removeHashElement(this._currentTarget),--t)}for(t=0,i=this._updatesNegList;t<i.length;)(r=i[t]).markedForDeletion?this._removeUpdateFromHash(r):t++;for(t=0,i=this._updates0List;t<i.length;)(r=i[t]).markedForDeletion?this._removeUpdateFromHash(r):t++;for(t=0,i=this._updatesPosList;t<i.length;)(r=i[t]).markedForDeletion?this._removeUpdateFromHash(r):t++;this._updateHashLocked=!1,this._currentTarget=null},i.schedule=function(e,t,i,n,r,s){if("function"!=typeof e){var a=e;e=t,t=a}3!==arguments.length&&4!==arguments.length&&5!==arguments.length||(s=!!n,n=v.macro.REPEAT_FOREVER,r=0),ee(t,1502);var o=t.uuid||t.id;if(o){var u,h,c=this._hashForTimers[o];if(c?c.paused!==s&&q(1511):(c=Oh.get(null,t,0,null,null,s),this._arrayForTimers.push(c),this._hashForTimers[o]=c),null==c.timers)c.timers=[];else for(h=0;h<c.timers.length;++h)if((u=c.timers[h])&&e===u._callback)return K(1507,u.getInterval(),i),void(u._interval=i);(u=Nh.get()).initWithCallback(this,e,t,i,n,r),c.timers.push(u),this._currentTarget===c&&this._currentTargetSalvaged&&(this._currentTargetSalvaged=!1)}else Z(1510)},i.scheduleUpdate=function(e,t,i){var n=e.uuid||e.id;if(n){var r=this._hashForUpdates[n];if(r&&r.entry){if(r.entry.priority===t)return r.entry.markedForDeletion=!1,void(r.entry.paused=i);if(this._updateHashLocked)return K(1506),r.entry.markedForDeletion=!1,void(r.entry.paused=i);this.unscheduleUpdate(e)}var s,a=Ih.get(e,t,i,!1);0===t?(s=this._updates0List,this._appendIn(s,a)):(s=t<0?this._updatesNegList:this._updatesPosList,this._priorityIn(s,a,t)),this._hashForUpdates[n]=bh.get(s,a,e,null)}else Z(1510)},i.unschedule=function(e,t){if(t&&e){var i=t.uuid||t.id;if(i){var n=this._hashForTimers[i];if(n)for(var r=n.timers,s=0,a=r.length;s<a;s++){var o=r[s];if(e===o._callback)return o!==n.currentTimer||n.currentTimerSalvaged||(n.currentTimerSalvaged=!0),r.splice(s,1),Nh.put(o),n.timerIndex>=s&&n.timerIndex--,void(0===r.length&&(this._currentTarget===n?this._currentTargetSalvaged=!0:this._removeHashElement(n)))}}else Z(1510)}},i.unscheduleUpdate=function(e){if(e){var t=e.uuid||e.id;if(t){var i=this._hashForUpdates[t];i&&(this._updateHashLocked?i.entry.markedForDeletion=!0:this._removeUpdateFromHash(i.entry))}else Z(1510)}},i.unscheduleAllForTarget=function(e){if(e){var t=e.uuid||e.id;if(t){var i=this._hashForTimers[t];if(i){var n=i.timers;n.indexOf(i.currentTimer)>-1&&!i.currentTimerSalvaged&&(i.currentTimerSalvaged=!0);for(var r=0,s=n.length;r<s;r++)Nh.put(n[r]);n.length=0,this._currentTarget===i?this._currentTargetSalvaged=!0:this._removeHashElement(i)}this.unscheduleUpdate(e)}else Z(1510)}},i.unscheduleAll=function(){this.unscheduleAllWithMinPriority(Rh.Priority.SCHEDULER)},i.unscheduleAllWithMinPriority=function(e){var t,i,n,r=this._arrayForTimers;for(t=r.length-1;t>=0;t--)i=r[t],this.unscheduleAllForTarget(i.target);var s=0;if(e<0)for(t=0;t<this._updatesNegList.length;)s=this._updatesNegList.length,(n=this._updatesNegList[t])&&n.priority>=e&&this.unscheduleUpdate(n.target),s===this._updatesNegList.length&&t++;if(e<=0)for(t=0;t<this._updates0List.length;)s=this._updates0List.length,(n=this._updates0List[t])&&this.unscheduleUpdate(n.target),s===this._updates0List.length&&t++;for(t=0;t<this._updatesPosList.length;)s=this._updatesPosList.length,(n=this._updatesPosList[t])&&n.priority>=e&&this.unscheduleUpdate(n.target),s===this._updatesPosList.length&&t++},i.isScheduled=function(e,t){ee(e,1508),ee(t,1509);var i=t.uuid||t.id;if(!i)return Z(1510),!1;var n=this._hashForTimers[i];if(!n)return!1;if(null==n.timers)return!1;for(var r=n.timers,s=0;s<r.length;++s)if(e===r[s]._callback)return!0;return!1},i.pauseAllTargets=function(){return this.pauseAllTargetsWithMinPriority(Rh.Priority.SCHEDULER)},i.pauseAllTargetsWithMinPriority=function(e){var t,i,n,r,s=[],a=this._arrayForTimers;for(i=0,n=a.length;i<n;i++)(t=a[i])&&(t.paused=!0,s.push(t.target));if(e<0)for(i=0;i<this._updatesNegList.length;i++)(r=this._updatesNegList[i])&&r.priority>=e&&(r.paused=!0,s.push(r.target));if(e<=0)for(i=0;i<this._updates0List.length;i++)(r=this._updates0List[i])&&(r.paused=!0,s.push(r.target));for(i=0;i<this._updatesPosList.length;i++)(r=this._updatesPosList[i])&&r.priority>=e&&(r.paused=!0,s.push(r.target));return s},i.resumeTargets=function(e){if(e)for(var t=0;t<e.length;t++)this.resumeTarget(e[t])},i.pauseTarget=function(e){ee(e,1503);var t=e.uuid||e.id;if(t){var i=this._hashForTimers[t];i&&(i.paused=!0);var n=this._hashForUpdates[t];n&&(n.entry.paused=!0)}else Z(1510)},i.resumeTarget=function(e){ee(e,1504);var t=e.uuid||e.id;if(t){var i=this._hashForTimers[t];i&&(i.paused=!1);var n=this._hashForUpdates[t];n&&(n.entry.paused=!1)}else Z(1510)},i.isTargetPaused=function(e){ee(e,1505);var t=e.uuid||e.id;if(!t)return Z(1510),!1;var i=this._hashForTimers[t];if(i)return i.paused;var n=this._hashForUpdates[t];return!!n&&n.entry.paused},i._removeHashElement=function(e){var t=e.target.uuid||e.target.id;delete this._hashForTimers[t];for(var i=this._arrayForTimers,n=0,r=i.length;n<r;n++)if(i[n]===e){i.splice(n,1);break}Oh.put(e)},i._removeUpdateFromHash=function(e){var t=e.target.uuid||e.target.id,i=this._hashForUpdates[t];if(i){for(var n=i.list,r=i.entry,s=0,a=n.length;s<a;s++)if(n[s]===r){n.splice(s,1);break}delete this._hashForUpdates[t],Ih.put(r),bh.put(i)}},i._priorityIn=function(e,t,i){for(var n=0;n<e.length;n++)if(i<e[n].priority)return void e.splice(n,0,t);e.push(t)},i._appendIn=function(e,t){e.push(t)},t}(Rh));Ch.ID="scheduler",v.Scheduler=Ch;var Mh={};re(Mh,"vmath",[{name:"vec2",newName:"Vec2",target:Fn,targetName:"math"},{name:"vec3",newName:"Vec3",target:Fn,targetName:"math"},{name:"vec4",newName:"Vec4",target:Fn,targetName:"math"},{name:"quat",newName:"Quat",target:Fn,targetName:"math"},{name:"mat3",newName:"Mat3",target:Fn,targetName:"math"},{name:"mat4",newName:"Mat4",target:Fn,targetName:"math"},{name:"color4",newName:"Color",target:Fn,targetName:"math"},{name:"rect",newName:"Rect",target:Fn,targetName:"math"},{name:"approx",newName:"approx",target:Fn,targetName:"math"},{name:"EPSILON",newName:"EPSILON",target:Fn,targetName:"math"},{name:"equals",newName:"equals",target:Fn,targetName:"math"},{name:"clamp",newName:"clamp",target:Fn,targetName:"math"},{name:"clamp01",newName:"clamp01",target:Fn,targetName:"math"},{name:"lerp",newName:"lerp",target:Fn,targetName:"math"},{name:"toRadian",newName:"toRadian",target:Fn,targetName:"math"},{name:"toDegree",newName:"toDegree",target:Fn,targetName:"math"},{name:"random",newName:"random",target:Fn,targetName:"math"},{name:"randomRange",newName:"randomRange",target:Fn,targetName:"math"},{name:"randomRangeInt",newName:"randomRangeInt",target:Fn,targetName:"math"},{name:"pseudoRandom",newName:"pseudoRandom",target:Fn,targetName:"math"},{name:"pseudoRandomRangeInt",newName:"pseudoRandomRangeInt",target:Fn,targetName:"math"},{name:"nextPow2",newName:"nextPow2",target:Fn,targetName:"math"},{name:"repeat",newName:"repeat",target:Fn,targetName:"math"},{name:"pingPong",newName:"pingPong",target:Fn,targetName:"math"},{name:"inverseLerp",newName:"inverseLerp",target:Fn,targetName:"math"}]),v.vmath=Mh,re(Ch.prototype,"Scheduler.prototype",[{name:"enableForTarget",newName:"enableForTarget",target:Ch,targetName:"Scheduler"}]),re(Ch,"Scheduler",[{name:"PRIORITY_SYSTEM",newName:"System.Priority.SCHEDULER",customGetter:function(){return Rh.Priority.SCHEDULER}}]),se(Ch,"Scheduler",[{name:"PRIORITY_NON_SYSTEM",suggest:"Use enum` System.Priority` instead"}]),pe({replaceProperty:{since:"3.6.0",removed:!1},removeProperty:{since:"3.6.0",removed:!1},markAsWarning:{since:"3.6.0",removed:!1},setDefaultLogTimes:{since:"3.6.0",removed:!1}});var Ph=ut;function Lh(){}var xh=function(){function e(){this.callback=Lh,this.target=void 0,this.once=!1}var t=e.prototype;return t.set=function(e,t,i){this.callback=e||Lh,this.target=t,this.once=!!i},t.reset=function(){this.target=void 0,this.callback=Lh,this.once=!1},t.check=function(){return!(Ga(this.target)&&!ka(this.target,!0))},e}(),Dh=new Th((function(){return new xh}),32),Fh=function(){function e(){this.callbackInfos=[],this.isInvoking=!1,this.containCanceled=!1}var t=e.prototype;return t.removeByCallback=function(e){for(var t=0;t<this.callbackInfos.length;++t){var i=this.callbackInfos[t];i&&i.callback===e&&(i.reset(),Dh.free(i),Ph(this.callbackInfos,t),--t)}},t.removeByTarget=function(e){for(var t=0;t<this.callbackInfos.length;++t){var i=this.callbackInfos[t];i&&i.target===e&&(i.reset(),Dh.free(i),Ph(this.callbackInfos,t),--t)}},t.cancel=function(e){var t=this.callbackInfos[e];t&&(t.reset(),this.isInvoking?this.callbackInfos[e]=null:Ph(this.callbackInfos,e),Dh.free(t)),this.containCanceled=!0},t.cancelAll=function(){for(var e=0;e<this.callbackInfos.length;e++){var t=this.callbackInfos[e];t&&(t.reset(),Dh.free(t),this.callbackInfos[e]=null)}this.containCanceled=!0},t.purgeCanceled=function(){for(var e=this.callbackInfos.length-1;e>=0;--e)this.callbackInfos[e]||Ph(this.callbackInfos,e);this.containCanceled=!1},t.clear=function(){this.cancelAll(),this.callbackInfos.length=0,this.isInvoking=!1,this.containCanceled=!1},e}(),Bh=new Th((function(){return new Fh}),16),Uh=e("gG",function(){function e(){this._callbackTable=Ne(!0),this._offCallback=void 0}var t=e.prototype;return t.on=function(e,t,i,n){if(!this.hasEventListener(e,t,i)){var r=this._callbackTable[e];r||(r=this._callbackTable[e]=Bh.alloc());var s=Dh.alloc();s.set(t,i,n),r.callbackInfos.push(s)}return t},t.hasEventListener=function(e,t,i){var n=this._callbackTable&&this._callbackTable[e];if(!n)return!1;var r=n.callbackInfos;if(!t){if(n.isInvoking){for(var s=0;s<r.length;++s)if(r[s])return!0;return!1}return r.length>0}for(var a=0;a<r.length;++a){var o=r[a];if(o&&o.check()&&o.callback===t&&o.target===i)return!0}return!1},t.removeAll=function(e){var t=typeof e;if("string"===t||"number"===t){var i=this._callbackTable&&this._callbackTable[e];i&&(i.isInvoking?i.cancelAll():(i.clear(),Bh.free(i),delete this._callbackTable[e]))}else if(e)for(var n in this._callbackTable){var r=this._callbackTable[n];if(r.isInvoking)for(var s=r.callbackInfos,a=0;a<s.length;++a){var o=s[a];o&&o.target===e&&r.cancel(a)}else r.removeByTarget(e)}},t.off=function(e,t,i){var n,r=this._callbackTable&&this._callbackTable[e];if(r){var s=r.callbackInfos;if(t)for(var a=0;a<s.length;++a){var o=s[a];if(o&&o.callback===t&&o.target===i){r.cancel(a);break}}else this.removeAll(e)}null===(n=this._offCallback)||void 0===n||n.call(this)},t.emit=function(e,t,i,n,r,s){var a=this._callbackTable&&this._callbackTable[e];if(a){var o=!a.isInvoking;a.isInvoking=!0;for(var u=a.callbackInfos,h=0,c=u.length;h<c;++h){var l=u[h];if(l){var _=l.callback,d=l.target;l.once&&this.off(e,_,d),l.check()?d?_.call(d,t,i,n,r,s):_(t,i,n,r,s):this.off(e,_,d)}}o&&(a.isInvoking=!1,a.containCanceled&&a.purgeCanceled())}},t.clear=function(){for(var e in this._callbackTable){var t=this._callbackTable[e];t&&(t.clear(),Bh.free(t),delete this._callbackTable[e])}},t._registerOffCallback=function(e){this._offCallback=e},e}());function Gh(e){for(var t=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._callbackTable=Ne(!0),t}s(t,e);var i=t.prototype;return i.once=function(e,t,i){return this.on(e,t,i,!0)},i.targetOff=function(e){this.removeAll(e)},t}(e),i=Uh.prototype,n=Object.getOwnPropertyNames(i).concat(Object.getOwnPropertySymbols(i)),r=0;r<n.length;++r){var a=n[r];if(!(a in t.prototype)){var o=Object.getOwnPropertyDescriptor(i,a);o&&Object.defineProperty(t.prototype,a,o)}}return t}var kh=e("ee",Gh((function(){})));v.EventTarget=kh;var Hh,zh,Vh,Wh,jh,Xh,Kh=e("gk",function(){function e(){this._delegates=[]}var t=e.prototype;return t.add=function(e){this._delegates.includes(e)||this._delegates.push(e)},t.hasListener=function(e){return this._delegates.includes(e)},t.remove=function(e){ct(this._delegates,e)},t.dispatch=function(){for(var e=arguments,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return Promise.all(this._delegates.map((function(t){return t.apply(void 0,e)})).filter(Boolean))},e}());!function(e){e.UNKNOWN="unknown",e.WECHAT="wechat",e.ANDROID="androidbrowser",e.IE="ie",e.EDGE="edge",e.QQ="qqbrowser",e.MOBILE_QQ="mqqbrowser",e.UC="ucbrowser",e.UCBS="ucbs",e.BROWSER_360="360browser",e.BAIDU_APP="baiduboxapp",e.BAIDU="baidubrowser",e.MAXTHON="maxthon",e.OPERA="opera",e.OUPENG="oupeng",e.MIUI="miuibrowser",e.FIREFOX="firefox",e.SAFARI="safari",e.CHROME="chrome",e.LIEBAO="liebao",e.QZONE="qzone",e.SOUGOU="sogou",e.HUAWEI="huawei"}(Hh||(Hh=e("eM",{}))),function(e){e.UNKNOWN="unknown",e.ENGLISH="en",e.CHINESE="zh",e.FRENCH="fr",e.ITALIAN="it",e.GERMAN="de",e.SPANISH="es",e.DUTCH="du",e.RUSSIAN="ru",e.KOREAN="ko",e.JAPANESE="ja",e.HUNGARIAN="hu",e.PORTUGUESE="pt",e.ARABIC="ar",e.NORWEGIAN="no",e.POLISH="pl",e.TURKISH="tr",e.UKRAINIAN="uk",e.ROMANIAN="ro",e.BULGARIAN="bg",e.HINDI="hi"}(zh||(zh={})),function(e){e[e.NONE=0]="NONE",e[e.LAN=1]="LAN",e[e.WWAN=2]="WWAN"}(Vh||(Vh={})),function(e){e.UNKNOWN="Unknown",e.IOS="iOS",e.ANDROID="Android",e.WINDOWS="Windows",e.LINUX="Linux",e.OSX="OS X",e.OHOS="OHOS"}(Wh||(Wh=e("eL",{}))),function(e){e.UNKNOWN="UNKNOWN",e.EDITOR_PAGE="EDITOR_PAGE",e.EDITOR_CORE="EDITOR_CORE",e.MOBILE_BROWSER="MOBILE_BROWSER",e.DESKTOP_BROWSER="DESKTOP_BROWSER",e.WIN32="WIN32",e.ANDROID="ANDROID",e.IOS="IOS",e.MACOS="MACOS",e.OHOS="OHOS",e.WECHAT_GAME="WECHAT_GAME",e.BAIDU_MINI_GAME="BAIDU_MINI_GAME",e.XIAOMI_QUICK_GAME="XIAOMI_QUICK_GAME",e.ALIPAY_MINI_GAME="ALIPAY_MINI_GAME",e.TAOBAO_CREATIVE_APP="TAOBAO_CREATIVE_APP",e.BYTEDANCE_MINI_GAME="BYTEDANCE_MINI_GAME",e.OPPO_MINI_GAME="OPPO_MINI_GAME",e.VIVO_MINI_GAME="VIVO_MINI_GAME",e.HUAWEI_QUICK_GAME="HUAWEI_QUICK_GAME",e.COCOSPLAY="COCOSPLAY",e.LINKSURE_MINI_GAME="LINKSURE_MINI_GAME",e.QTT_MINI_GAME="QTT_MINI_GAME"}(jh||(jh={})),function(e){e.WEBP="WEBP",e.IMAGE_BITMAP="IMAGE_BITMAP",e.WEB_VIEW="WEB_VIEW",e.VIDEO_PLAYER="VIDEO_PLAYER",e.SAFE_AREA="SAFE_AREA",e.INPUT_TOUCH="INPUT_TOUCH",e.EVENT_KEYBOARD="EVENT_KEYBOARD",e.EVENT_MOUSE="EVENT_MOUSE",e.EVENT_TOUCH="EVENT_TOUCH",e.EVENT_ACCELEROMETER="EVENT_ACCELEROMETER",e.EVENT_GAMEPAD="EVENT_GAMEPAD",e.EVENT_HANDLE="EVENT_HANDLE",e.EVENT_HMD="EVENT_HMD",e.EVENT_HANDHELD="EVENT_HANDHELD"}(Xh||(Xh={}));var Yh=function(e){function t(){var t,i,n;(n=e.call(this)||this).networkType=void 0,n.isNative=void 0,n.isBrowser=void 0,n.isMobile=void 0,n.isLittleEndian=void 0,n.platform=void 0,n.language=void 0,n.nativeLanguage=void 0,n.os=void 0,n.osVersion=void 0,n.osMainVersion=void 0,n.browserType=void 0,n.browserVersion=void 0,n.isXR=void 0,n._battery=void 0,n._featureMap=void 0,n._initPromise=void 0;var r,s=window.navigator,a=s.userAgent.toLowerCase();null===(t=s.getBattery)||void 0===t||t.call(s).then((function(e){n._battery=e})),n.networkType=Vh.LAN,n.isNative=!1,n.isBrowser=!0,n.isMobile=/mobile|android|iphone|ipad/.test(a),n.platform=n.isMobile?jh.MOBILE_BROWSER:jh.DESKTOP_BROWSER,n.isLittleEndian=(r=new ArrayBuffer(2),new DataView(r).setInt16(0,256,!0),256===new Int16Array(r)[0]);var o=s.language;n.nativeLanguage=o.toLowerCase(),o=(o=o||s.browserLanguage)?o.split("-")[0]:zh.ENGLISH,n.language=o;var u=!1,h=!1,c="",l=0,_=/android\s*(\d+(?:\.\d+)*)/i.exec(a)||/android\s*(\d+(?:\.\d+)*)/i.exec(s.platform);_&&(u=!0,c=_[1]||"",l=parseInt(c)||0),(_=/(iPad|iPhone|iPod).*OS ((\d+_?){2,3})/i.exec(a))?(h=!0,c=_[2]||"",l=parseInt(c)||0):(/(iPhone|iPad|iPod)/.exec(s.platform)||"MacIntel"===s.platform&&s.maxTouchPoints&&s.maxTouchPoints>1)&&(h=!0,c="",l=0);var d=Wh.UNKNOWN;-1!==s.appVersion.indexOf("Win")?d=Wh.WINDOWS:h?d=Wh.IOS:-1!==s.appVersion.indexOf("Mac")?d=Wh.OSX:-1!==s.appVersion.indexOf("X11")&&-1===s.appVersion.indexOf("Linux")?d=Wh.LINUX:u?d=Wh.ANDROID:-1===s.appVersion.indexOf("Linux")&&-1===a.indexOf("ubuntu")||(d=Wh.LINUX),n.os=d,n.osVersion=c,n.osMainVersion=l,n.browserType=Hh.UNKNOWN;var f=/wechat|weixin|micromessenger/i.exec(a)||/mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|ucbs|360 aphone|360browser|baiduboxapp|baidubrowser|maxthon|mxbrowser|miuibrowser/i.exec(a)||/qq|qqbrowser|ucbrowser|ubrowser|edge|HuaweiBrowser/i.exec(a)||/chrome|safari|firefox|trident|opera|opr\/|oupeng/i.exec(a),p=f?f[0].toLowerCase():Wh.UNKNOWN;("safari"===p&&u||"qq"===p&&/android.*applewebkit/i.test(a))&&(p=Hh.ANDROID);var g={micromessenger:Hh.WECHAT,wechat:Hh.WECHAT,weixin:Hh.WECHAT,trident:Hh.IE,edge:Hh.EDGE,"360 aphone":Hh.BROWSER_360,mxbrowser:Hh.MAXTHON,"opr/":Hh.OPERA,ubrowser:Hh.UC,huaweibrowser:Hh.HUAWEI};n.browserType=g[p]||p,n.browserVersion="";var v=/(mqqbrowser|micromessenger|qqbrowser|sogou|qzone|liebao|maxthon|uc|ucbs|360 aphone|360|baiduboxapp|baidu|maxthon|mxbrowser|miui(?:.hybrid)?)(mobile)?(browser)?\/?([\d.]+)/i.exec(a);v||(v=/(qq|chrome|safari|firefox|trident|opera|opr\/|oupeng)(mobile)?(browser)?\/?([\d.]+)/i.exec(a)),n.browserVersion=v?v[4]:"",n.isXR=!1;var y,E=document.createElement("canvas");E.getContext("2d");try{y=E.toDataURL("image/webp").startsWith("data:image/webp")}catch(e){y=!1}if(n.browserType===Hh.SAFARI){var T,A=null===(T=/ version\/(\d+)/.exec(a))||void 0===T?void 0:T[1];"string"==typeof A&&Number.parseInt(A)>=14&&(y=!0)}var S=void 0!==document.documentElement.ontouchstart||void 0!==document.ontouchstart||m,R=void 0!==document.documentElement.onmouseup||m;return n._featureMap=((i={})[Xh.WEBP]=y,i[Xh.IMAGE_BITMAP]=!1,i[Xh.WEB_VIEW]=!0,i[Xh.VIDEO_PLAYER]=!0,i[Xh.SAFE_AREA]=!1,i[Xh.INPUT_TOUCH]=S,i[Xh.EVENT_KEYBOARD]=void 0!==document.documentElement.onkeyup||m,i[Xh.EVENT_MOUSE]=R,i[Xh.EVENT_TOUCH]=S||R,i[Xh.EVENT_ACCELEROMETER]=void 0!==window.DeviceMotionEvent||void 0!==window.DeviceOrientationEvent,i[Xh.EVENT_GAMEPAD]=void 0!==navigator.getGamepads||void 0!==navigator.webkitGetGamepads,i[Xh.EVENT_HANDLE]=!1,i[Xh.EVENT_HMD]=n.isXR,i[Xh.EVENT_HANDHELD]=void 0!==navigator.xr,i),n._initPromise=[],n._initPromise.push(n._supportsImageBitmapPromise()),n._registerEvent(),n}s(t,e);var i=t.prototype;return i._supportsImageBitmapPromise=function(){var e=this;if("undefined"!=typeof createImageBitmap&&"undefined"!=typeof Blob){var t=document.createElement("canvas");t.width=t.height=2;var i=createImageBitmap(t,{});if(i instanceof Promise)return i.then((function(t){e._setFeature(Xh.IMAGE_BITMAP,!0),null==t||t.close()}))}return Promise.resolve()},i._registerEvent=function(){var e,t=this;e=void 0!==document.hidden?"hidden":void 0!==document.mozHidden?"mozHidden":void 0!==document.msHidden?"msHidden":void 0!==document.webkitHidden?"webkitHidden":"hidden";var i=!1,n=function(){i||(i=!0,t.emit("hide"))},r=function(e,n,r,s,a){i&&(i=!1,t.emit("show",e,n,r,s,a))};if(e)for(var s=["visibilitychange","mozvisibilitychange","msvisibilitychange","webkitvisibilitychange","qbrowserVisibilityChange"],a=0;a<s.length;a++)document.addEventListener(s[a],(function(t){var i=document[e];(i=i||t.hidden)?n():r()}));else window.addEventListener("blur",n),window.addEventListener("focus",r);window.navigator.userAgent.indexOf("MicroMessenger")>-1&&(window.onfocus=r),"onpageshow"in window&&"onpagehide"in window&&(window.addEventListener("pagehide",n),window.addEventListener("pageshow",r),document.addEventListener("pagehide",n),document.addEventListener("pageshow",r))},i._setFeature=function(e,t){return this._featureMap[e]=t},i.init=function(){return Promise.all(this._initPromise)},i.hasFeature=function(e){return this._featureMap[e]},i.getBatteryLevel=function(){return this._battery?this._battery.level:1},i.triggerGC=function(){},i.openURL=function(e){window.open(e)},i.now=function(){return Date.now?Date.now():+new Date},i.restartJSVM=function(){},i.close=function(){this.emit("close"),window.close()},t}(kh),qh=e("eK",new Yh),Qh=/(\.[^\.\/\?\\]*)(\?.*)?$/,Zh=/((.*)(\/|\\|\\\\))?(.*?\..*$)?/,Jh=/[^\.\/]+\/\.\.\//;function $h(){for(var e="",t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];for(var r=0,s=i;r<s.length;r++){var a=s[r];e=(e+(""===e?"":"/")+a).replace(/(\/|\\\\)$/,"")}return e}function ec(e){var t=Qh.exec(e);return t?t[1]:""}function tc(e){if(e){var t=e.lastIndexOf(".");if(-1!==t)return e.substring(0,t)}return e}function ic(e,t){var i=e.indexOf("?");i>0&&(e=e.substring(0,i));var n=/(\/|\\)([^\/\\]+)$/g.exec(e.replace(/(\/|\\)$/,""));if(!n)return e;var r=n[2];return t&&e.substring(e.length-t.length).toLowerCase()===t.toLowerCase()?r.substring(0,r.length-t.length):r}function nc(e){var t=Zh.exec(e);return t?t[2]:""}function rc(e,t){t=t||"";var i=e.indexOf("?"),n="";return i>0&&(n=e.substring(i),e=e.substring(0,i)),(i=e.lastIndexOf("."))<0?e+t+n:e.substring(0,i)+t+n}function sc(e,t,i){if(0===t.indexOf("."))return rc(e,t);var n=e.indexOf("?"),r="",s=i?ec(e):"";return n>0&&(r=e.substring(n),e=e.substring(0,n)),n=(n=e.lastIndexOf("/"))<=0?0:n+1,e.substring(0,n)+t+s+r}function ac(e){var t=e=String(e);do{t=e,e=e.replace(Jh,"")}while(t.length!==e.length);return e}function oc(e){return e.replace(/[\/\\]$/,"")}function uc(){return qh.os===Wh.WINDOWS?"\\":"/"}e("g7",Object.freeze({__proto__:null,join:$h,extname:ec,mainFileName:tc,basename:ic,dirname:nc,changeExtname:rc,changeBasename:sc,_normalize:ac,stripSep:oc,getSeperator:uc}));var hc=new Ki;function cc(e,t,i,n){n||(n=new Ki),e.convertToUINode(t,i,n);var r=i.position;return n.add(r),n}function lc(e,t,i){return i||(i=new Ki),e.worldToScreen(t,i),i.x/=v.view.getScaleX(),i.y/=v.view.getScaleY(),i}var _c,dc=e("gd",{WorldNode3DToLocalNodeUI:cc,WorldNode3DToWorldNodeUI:lc});v.pipelineUtils=dc,re(v.pipelineUtils,"cc.pipelineUtils",[{name:"WorldNode3DToLocalNodeUI",newName:"convertToUINode",targetName:"cc.Camera.prototype",customFunction:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=t[0],r=t[3]||hc;return n.convertToUINode(t[1],t[2],r),r.add(t[2].position),t[3]||r.clone()}}]),ae(ft,"js",[{name:"js",suggest:"'js.js' is deprecated since v3.7.0, please access 'js' directly instead."}]),function(e){e[e.PORTRAIT=1]="PORTRAIT",e[e.PORTRAIT_UPSIDE_DOWN=2]="PORTRAIT_UPSIDE_DOWN",e[e.LANDSCAPE_LEFT=4]="LANDSCAPE_LEFT",e[e.LANDSCAPE_RIGHT=8]="LANDSCAPE_RIGHT",e[e.LANDSCAPE=12]="LANDSCAPE",e[e.AUTO=13]="AUTO"}(_c||(_c=e("dG",{})));var fc,pc={auto:_c.AUTO,landscape:_c.LANDSCAPE,portrait:_c.PORTRAIT};!function(e){e[e.Unknown=0]="Unknown",e[e.SubFrame=1]="SubFrame",e[e.BrowserWindow=2]="BrowserWindow",e[e.Fullscreen=3]="Fullscreen"}(fc||(fc={}));var mc=function(e){function t(){var t,i,n,r,s,a;(t=e.call(this)||this).isFrameRotated=!1,t.handleResizeEvent=!0,t._gameFrame=void 0,t._gameContainer=void 0,t._gameCanvas=void 0,t._isProportionalToFrame=!1,t._cachedFrameStyle={width:"0px",height:"0px"},t._cachedContainerStyle={width:"0px",height:"0px"},t._cbToUpdateFrameBuffer=void 0,t._supportFullScreen=!1,t._touchEventName=void 0,t._onFullscreenChange=void 0,t._onFullscreenError=void 0,t._orientationChangeTimeoutId=-1,t._cachedFrameSize=new Cn(0,0),t._exactFitScreen=!1,t._isHeadlessMode=!1,t._fn={},t._fnGroup=[["requestFullscreen","exitFullscreen","fullscreenchange","fullscreenEnabled","fullscreenElement","fullscreenerror"],["requestFullScreen","exitFullScreen","fullScreenchange","fullScreenEnabled","fullScreenElement","fullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitfullscreenchange","webkitIsFullScreen","webkitCurrentFullScreenElement","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozFullScreen","mozFullScreenElement","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","MSFullscreenChange","msFullscreenEnabled","msFullscreenElement","msfullscreenerror"]],t._resolutionScale=1,t._orientation=_c.AUTO,t._gameFrame=document.getElementById("GameDiv"),t._gameContainer=document.getElementById("Cocos3dGameContainer"),t._gameCanvas=document.getElementById("GameCanvas"),t._gameFrame||(t._gameFrame=document.createElement("div"),t._gameFrame.setAttribute("id","GameDiv"),null===(i=t._gameCanvas)||void 0===i||null===(n=i.parentNode)||void 0===n||n.insertBefore(t._gameFrame,t._gameCanvas),t._gameFrame.appendChild(t._gameCanvas)),t._gameContainer||(t._gameContainer=document.createElement("div"),t._gameContainer.setAttribute("id","Cocos3dGameContainer"),null===(r=t._gameCanvas)||void 0===r||null===(s=r.parentNode)||void 0===s||s.insertBefore(t._gameContainer,t._gameCanvas),t._gameContainer.appendChild(t._gameCanvas));for(var o=t._fnGroup,u=0;u<o.length;u++)if(a=o[u],void 0!==document[a[1]]){for(var h=0;h<a.length;h++)t._fn[o[0][h]]=a[h];break}return t._supportFullScreen=void 0!==t._fn.requestFullscreen,t._touchEventName="ontouchstart"in window?"touchend":"mousedown",t._registerEvent(),t}s(t,e);var i=t.prototype;return i.init=function(e,t){this._cbToUpdateFrameBuffer=t,this.orientation=pc[e.configOrientation],this._exactFitScreen=e.exactFitScreen,this._isHeadlessMode=e.isHeadlessMode,this._resizeFrame()},i.requestFullScreen=function(){var e=this;return new Promise((function(t,i){e.isFullScreen?t():(e._cachedFrameSize=e.windowSize,e._doRequestFullScreen().then((function(){t()})).catch((function(){var n=e._getFullscreenTarget();n?n.addEventListener(e._touchEventName,(function(){e._doRequestFullScreen().then((function(){t()})).catch(i)}),{once:!0,capture:!0}):i(new Error("Cannot access fullscreen target"))})))}))},i.exitFullScreen=function(){var e=this;return new Promise((function(t,i){var n=document[e._fn.exitFullscreen]();window.Promise&&n instanceof Promise?n.then((function(){e.windowSize=e._cachedFrameSize,t()})).catch(i):(e.windowSize=e._cachedFrameSize,t())}))},i._registerEvent=function(){var e=this;document.addEventListener(this._fn.fullscreenerror,(function(){var t;null===(t=e._onFullscreenError)||void 0===t||t.call(e)})),window.addEventListener("resize",(function(){e.handleResizeEvent&&e._resizeFrame()})),"function"==typeof window.matchMedia&&function t(){var i,n,r=window.devicePixelRatio;null===(i=window.matchMedia("(resolution: "+r+"dppx)"))||void 0===i||null===(n=i.addEventListener)||void 0===n||n.call(i,"change",(function(){e.emit("window-resize",e.windowSize.width,e.windowSize.height),t()}),{once:!0})}(),window.addEventListener("orientationchange",(function(){-1!==e._orientationChangeTimeoutId&&clearTimeout(e._orientationChangeTimeoutId),e._orientationChangeTimeoutId=setTimeout((function(){e.handleResizeEvent&&(e._updateFrameState(),e._resizeFrame(),e.emit("orientation-change",e.windowSize.width,e.windowSize.height),e._orientationChangeTimeoutId=-1)}),200)})),document.addEventListener(this._fn.fullscreenchange,(function(){var t;null===(t=e._onFullscreenChange)||void 0===t||t.call(e),e.emit("fullscreen-change",e.windowSize.width,e.windowSize.height)}))},i._convertToSizeInCssPixels=function(e){var t=e.clone(),i=this.devicePixelRatio;return t.width/=i,t.height/=i,t},i._resizeFrame=function(e){if(this._gameFrame){if(this._gameFrame.style.display="flex",this._gameFrame.style["justify-content"]="center",this._gameFrame.style["align-items"]="center",this._windowType===fc.SubFrame){if(!e)return void this._updateContainer();this._gameFrame.style.width=e.width+"px",this._gameFrame.style.height=e.height+"px"}else{var t=window.innerWidth,i=window.innerHeight;this.isFrameRotated?(this._gameFrame.style["-webkit-transform"]="rotate(90deg)",this._gameFrame.style.transform="rotate(90deg)",this._gameFrame.style["-webkit-transform-origin"]="0px 0px 0px",this._gameFrame.style.transformOrigin="0px 0px 0px",this._gameFrame.style.margin="0 0 0 "+t+"px",this._gameFrame.style.width=i+"px",this._gameFrame.style.height=t+"px"):(this._gameFrame.style["-webkit-transform"]="rotate(0deg)",this._gameFrame.style.transform="rotate(0deg)",this._gameFrame.style.margin="0px auto",this._gameFrame.style.width=t+"px",this._gameFrame.style.height=i+"px")}this._updateContainer()}},i._getFullscreenTarget=function(){var e=this._windowType;return e===fc.Fullscreen?document[this._fn.fullscreenElement]:e===fc.SubFrame?this._gameFrame:document.body},i._doRequestFullScreen=function(){var e=this;return new Promise((function(t,i){if(e._supportFullScreen){var n=e._getFullscreenTarget();if(n){e._onFullscreenChange=void 0,e._onFullscreenError=void 0;var r=n[e._fn.requestFullscreen]();window.Promise&&r instanceof Promise?r.then(t).catch(i):(e._onFullscreenChange=t,e._onFullscreenError=i)}else i(new Error("Cannot access fullscreen target"))}else i(new Error("fullscreen is not supported"))}))},i._updateFrameState=function(){var e=this.orientation,t=window.innerWidth>window.innerHeight;this.isFrameRotated=qh.isMobile&&(t&&e===_c.PORTRAIT||!t&&e===_c.LANDSCAPE)},i._updateContainer=function(){if(this._gameContainer){if(this.isProportionalToFrame){if(!this._gameFrame)return void q(9201);var e,t,i=v.view.getDesignResolutionSize(),n=this._gameFrame,r=n.clientWidth,s=n.clientHeight,a=i.width,o=i.height,u=r/a,h=s/o,c=this._gameContainer.style;u<h?(e=r,t=o*u):(e=a*h,t=s),c.width=e+"px",c.height=t+"px"}else{var l=this._gameContainer.style;l.width="100%",l.height="100%"}!this._gameFrame||this._cachedFrameStyle.width===this._gameFrame.style.width&&this._cachedFrameStyle.height===this._gameFrame.style.height&&this._cachedContainerStyle.width===this._gameContainer.style.width&&this._cachedContainerStyle.height===this._gameContainer.style.height||(this.emit("window-resize",this.windowSize.width,this.windowSize.height),this._cachedFrameStyle.width=this._gameFrame.style.width,this._cachedFrameStyle.height=this._gameFrame.style.height,this._cachedContainerStyle.width=this._gameContainer.style.width,this._cachedContainerStyle.height=this._gameContainer.style.height)}else q(9201)},n(t,[{key:"supportFullScreen",get:function(){return this._supportFullScreen}},{key:"isFullScreen",get:function(){return!!this._supportFullScreen&&!!document[this._fn.fullscreenElement]}},{key:"devicePixelRatio",get:function(){var e;return Math.min(null!==(e=window.devicePixelRatio)&&void 0!==e?e:1,2)}},{key:"windowSize",get:function(){var e=this._windowSizeInCssPixels,t=this.devicePixelRatio;return e.width*=t,e.height*=t,e},set:function(e){this._windowType===fc.SubFrame?this._resizeFrame(this._convertToSizeInCssPixels(e)):q(9202)}},{key:"resolution",get:function(){var e=this.windowSize,t=this.resolutionScale;return new Cn(e.width*t,e.height*t)}},{key:"resolutionScale",get:function(){return this._resolutionScale},set:function(e){var t;e!==this._resolutionScale&&(this._resolutionScale=e,null===(t=this._cbToUpdateFrameBuffer)||void 0===t||t.call(this))}},{key:"orientation",get:function(){return this._orientation},set:function(e){this._orientation!==e&&(this._orientation=e,this._updateFrameState())}},{key:"safeAreaEdge",get:function(){return{top:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-top")||"0"),bottom:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-bottom")||"0"),left:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-left")||"0"),right:parseInt(getComputedStyle(document.documentElement).getPropertyValue("--safe-right")||"0")}}},{key:"isProportionalToFrame",get:function(){return this._isProportionalToFrame},set:function(e){this._isProportionalToFrame!==e&&(this._isProportionalToFrame=e,this._updateContainer())}},{key:"_windowSizeInCssPixels",get:function(){if(this.isProportionalToFrame)return this._gameContainer?new Cn(this._gameContainer.clientWidth,this._gameContainer.clientHeight):(q(9201),new Cn(0,0));var e,t,i;switch(this._windowType){case fc.SubFrame:return this._gameFrame?new Cn(this._gameFrame.clientWidth,this._gameFrame.clientHeight):(q(9201),new Cn(0,0));case fc.Fullscreen:return e=this._getFullscreenTarget(),t=this.isFrameRotated?e.clientHeight:e.clientWidth,i=this.isFrameRotated?e.clientWidth:e.clientHeight,new Cn(t,i);case fc.BrowserWindow:return t=this.isFrameRotated?window.innerHeight:window.innerWidth,i=this.isFrameRotated?window.innerWidth:window.innerHeight,new Cn(t,i);case fc.Unknown:default:return new Cn(0,0)}}},{key:"_windowType",get:function(){return this._isHeadlessMode?fc.Unknown:this.isFullScreen?fc.Fullscreen:this._gameFrame?this._exactFitScreen?fc.BrowserWindow:fc.SubFrame:(q(9201),fc.Unknown)}}]),t}(kh),gc=e("dJ",new mc),vc=function(){function e(){}var t=e.prototype;return t.init=function(){var e,t,i=null===(e=St.querySettings(At.Category.SCREEN,"exactFitScreen"))||void 0===e||e,n=null!==(t=St.querySettings(At.Category.SCREEN,"orientation"))&&void 0!==t?t:"auto",r=3===St.querySettings(At.Category.RENDERING,"renderMode");gc.init({exactFitScreen:i,configOrientation:n,isHeadlessMode:r},(function(){var e,t=v.director;null!==(e=t.root)&&void 0!==e&&e.pipeline?t.root.pipeline.shadingScale=gc.resolutionScale:q(1220)}))},t.fullScreen=function(){return gc.isFullScreen},t.requestFullScreen=function(e,t,i){return arguments.length>0&&q(1400,"screen.requestFullScreen(element, onFullScreenChange?, onFullScreenError?)","screen.requestFullScreen(): Promise"),gc.requestFullScreen().then((function(){null==t||t()})).catch((function(e){console.error(e),null==i||i()}))},t.exitFullScreen=function(){return gc.exitFullScreen()},t.autoFullScreen=function(e,t){var i;null===(i=this.requestFullScreen(e,t))||void 0===i||i.catch((function(){}))},t.disableAutoFullScreen=function(){},n(e,[{key:"devicePixelRatio",get:function(){return gc.devicePixelRatio}},{key:"windowSize",get:function(){return gc.windowSize},set:function(e){gc.windowSize=e}},{key:"resolution",get:function(){return gc.resolution}},{key:"supportsFullScreen",get:function(){return gc.supportFullScreen}}]),e}(),yc=e("dK",new vc);v.screen=yc;var Ec=e("cA",{Feature:Xh,hasFeature:function(e){return qh.hasFeature(e)},NetworkType:Vh,Language:zh,OS:Wh,Platform:jh,BrowserType:Hh,isNative:qh.isNative,isBrowser:qh.isBrowser,isMobile:qh.isMobile,isLittleEndian:qh.isLittleEndian,platform:qh.platform,language:qh.language,languageCode:qh.nativeLanguage,os:qh.os,osVersion:qh.osVersion,osMainVersion:qh.osMainVersion,browserType:qh.browserType,browserVersion:qh.browserVersion,isXR:qh.isXR,windowPixelResolution:yc.windowSize,capabilities:{canvas:!0,opengl:!0,webp:qh.hasFeature(Xh.WEBP),imageBitmap:qh.hasFeature(Xh.IMAGE_BITMAP),touches:qh.hasFeature(Xh.INPUT_TOUCH),mouse:qh.hasFeature(Xh.EVENT_MOUSE),keyboard:qh.hasFeature(Xh.EVENT_KEYBOARD),accelerometer:qh.hasFeature(Xh.EVENT_ACCELEROMETER)},localStorage:{},getNetworkType:function(){return qh.networkType},getBatteryLevel:function(){return qh.getBatteryLevel()},garbageCollect:function(){qh.triggerGC()},isObjectValid:function(e){return null!=e},dump:function(){var e="";e+="isMobile : "+this.isMobile+"\r\n",e+="language : "+this.language+"\r\n",e+="browserType : "+this.browserType+"\r\n",e+="browserVersion : "+this.browserVersion+"\r\n",e+="supports webp: "+Ec.hasFeature(Xh.WEBP)+"\r\n",e+="supports bitmap: "+Ec.hasFeature(Xh.IMAGE_BITMAP)+"\r\n",e+="supports touches: "+Ec.hasFeature(Xh.INPUT_TOUCH)+"\r\n",e+="supports mouse: "+Ec.hasFeature(Xh.EVENT_MOUSE)+"\r\n",e+="supports keyboard: "+Ec.hasFeature(Xh.EVENT_KEYBOARD)+"\r\n",e+="supports accelerometer: "+Ec.hasFeature(Xh.EVENT_ACCELEROMETER)+"\r\n",e+="os : "+this.os+"\r\n",e+="osVersion : "+this.osVersion+"\r\n",e+="platform : "+this.platform+"\r\n",U(e+="Using "+(v.game.renderType===v.game.RENDER_TYPE_WEBGL?"WEBGL":"CANVAS")+" renderer.\r\n")},openURL:function(e){qh.openURL(e)},init:function(){var e=this;return Promise.resolve().then((function(){return qh.init()})).then((function(){try{var t=Ec.localStorage=window.localStorage;t.setItem("storage",""),t.removeItem("storage"),t=null}catch(t){var i=function(){q(5200)};e.localStorage={getItem:i,setItem:i,clear:i,removeItem:i}}e.__isWebIOS14OrIPadOS14Env=(Ec.os===Wh.IOS||Ec.os===Wh.OSX)&&qh.isBrowser&&/(OS 14)|(Version\/14)/.test(window.navigator.userAgent)}))},now:function(){return qh.now()},restartVM:function(){qh.restartJSVM()},getSafeAreaRect:function(){var e=v.view,t=gc.safeAreaEdge,i=gc.windowSize,n=new Rn(t.left,t.bottom),r=new Rn(i.width-t.right,i.height-t.top);e._convertToUISpace(n),e._convertToUISpace(r);var s=n.x,a=n.y,o=r.x-n.x,u=r.y-n.y;return new Pn(s,a,o,u)}});v.sys=Ec,ae(v,"cc",[{name:"winSize",suggest:"please use view.getVisibleSize() instead."}]),ae(Ec,"sys",[{name:"capabilities",suggest:"please use sys.hasFeature() method instead."}]),re(Ec,"sys",["UNKNOWN","ENGLISH","CHINESE","FRENCH","ITALIAN","GERMAN","SPANISH","DUTCH","RUSSIAN","KOREAN","JAPANESE","HUNGARIAN","PORTUGUESE","ARABIC","NORWEGIAN","POLISH","TURKISH","UKRAINIAN","ROMANIAN","BULGARIAN"].map((function(e){return{name:"LANGUAGE_"+e,newName:e,target:Ec.Language,targetName:"sys.Language"}}))),re(Ec,"sys",["UNKNOWN","IOS","ANDROID","WINDOWS","LINUX","OSX"].map((function(e){return{name:"OS_"+e,newName:e,target:Ec.OS,targetName:"sys.OS"}}))),re(Ec,"sys",["UNKNOWN","WECHAT","ANDROID","IE","EDGE","QQ","MOBILE_QQ","UC","UCBS","BAIDU_APP","BAIDU","MAXTHON","OPERA","OUPENG","MIUI","FIREFOX","SAFARI","CHROME","LIEBAO","QZONE","SOUGOU","HUAWEI"].map((function(e){return{name:"BROWSER_TYPE_"+e,newName:e,target:Ec.BrowserType,targetName:"sys.BrowserType"}}))),re(Ec,"sys",[{name:"BROWSER_TYPE_360",newName:"BROWSER_360",target:Ec.BrowserType,targetName:"sys.BrowserType"}]),re(Ec,"sys",["UNKNOWN","EDITOR_PAGE","EDITOR_CORE","MOBILE_BROWSER","DESKTOP_BROWSER","WIN32","MACOS","IOS","ANDROID","OHOS","WECHAT_GAME","BAIDU_MINI_GAME","XIAOMI_QUICK_GAME","ALIPAY_MINI_GAME","BYTEDANCE_MINI_GAME","OPPO_MINI_GAME","VIVO_MINI_GAME","HUAWEI_QUICK_GAME","COCOSPLAY","LINKSURE_MINI_GAME","QTT_MINI_GAME"].map((function(e){return{name:e,target:Ec.Platform,targetName:"sys.Platform"}}))),re(Ec,"sys",[{name:"IPHONE",newName:"IOS",target:Ec.Platform,targetName:"sys.Platform"},{name:"IPAD",newName:"IOS",target:Ec.Platform,targetName:"sys.Platform"}]),se(Ec,"sys",["LINUX","BLACKBERRY","NACL","EMSCRIPTEN","TIZEN","WINRT","WP8","QQ_PLAY","FB_PLAYABLE_ADS"].map((function(e){return{name:e}}))),re(Ec,"sys",[{name:"windowPixelResolution",target:yc,targetName:"screen",newName:"windowSize"}]),ae(yc,"screen",[{name:"autoFullScreen",suggest:"please use screen.requestFullScreen() instead."},{name:"disableAutoFullScreen"}]);var Tc=e("c$",{topLeft:v.v2(0,0),topRight:v.v2(0,0),top:v.v2(0,0),bottomLeft:v.v2(0,0),bottomRight:v.v2(0,0),bottom:v.v2(0,0),center:v.v2(0,0),left:v.v2(0,0),right:v.v2(0,0),width:0,height:0,init:function(e){var t=this.width=e.width,i=this.height=e.height,n=e.x,r=e.y,s=r+i,a=n+t;this.topLeft.x=n,this.topLeft.y=s,this.topRight.x=a,this.topRight.y=s,this.top.x=n+t/2,this.top.y=s,this.bottomLeft.x=n,this.bottomLeft.y=r,this.bottomRight.x=a,this.bottomRight.y=r,this.bottom.x=n+t/2,this.bottom.y=r,this.center.x=n+t/2,this.center.y=r+i/2,this.left.x=n,this.left.y=r+i/2,this.right.x=a,this.right.y=r+i/2}});v.visibleRect=Tc;var Ac=String.prototype.charCodeAt;function Sc(e){return this[e]}function Rc(e,t){for(var i=e.length,n=t^i,r=0,s="string"==typeof e?Ac:Sc;i>=4;){var a=255&s.call(e,r)|(255&s.call(e,++r))<<8|(255&s.call(e,++r))<<16|(255&s.call(e,++r))<<24;a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16),n=1540483477*(65535&n)+((1540483477*(n>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),i-=4,++r}switch(i){case 3:n^=(255&s.call(e,r+2))<<16;case 2:n^=(255&s.call(e,r+1))<<8;case 1:n=1540483477*(65535&(n^=255&s.call(e,r)))+((1540483477*(n>>>16)&65535)<<16)}return n=1540483477*(65535&(n^=n>>>13))+((1540483477*(n>>>16)&65535)<<16),(n^=n>>>15)>>>0}function wc(){}v.easing=Ho,wc.prototype.once=function(e,t,i){return this.on(e,t,i,!0)},wc.prototype.targetOff=function(e){this.removeAll(e)},e("gr",Object.freeze({__proto__:null,syncNodeValues:function(e){var t=e._lpos;e.setPositionForJS(t.x,t.y,t.z);var i=e._lscale;e.setScaleForJS(i.x,i.y,i.z);var n=e._lrot;e.setRotationForJS(n.x,n.y,n.z,n.w);var r=e._euler;e.setRotationFromEulerForJS(r.x,r.y,r.z)},updateChildrenForDeserialize:function e(t){if(t){var i=t._children;if(i){var n=i.length;if(n){t._setChildren(i);for(var r=0;r<n;++r)e(i[r])}}}},ExtraEventMethods:wc}));var Ic=function(){function e(){this._finalizationRegistry=null,this._gcObjects=new WeakMap}var t=e.prototype;return t.registerGCObject=function(e){return e},t.init=function(){},t.finalizationRegistryCallback=function(e){var t=this._gcObjects.get(e);t&&(this._gcObjects.delete(e),t.destroy()),this._finalizationRegistry.unregister(e)},t.destroy=function(){},e}(),bc=e("gB",new Ic),Oc=e("gC",function(){function e(){return bc.registerGCObject(this)}return e.prototype.destroy=function(){},e}());function Nc(e,t){for(var i,n=d(t);!(i=n()).done;){var r=i.value;Array.isArray(r)?Nc(e,r):e.push(r)}}function Cc(e){var t=[];return Nc(t,e),t.join("")}v.math=Fn,v.geometry=vh;var Mc,Pc,Lc,xc,Dc,Fc,Bc,Uc,Gc,kc,Hc,zc,Vc,Wc,jc,Xc,Kc,Yc,qc,Qc,Zc,Jc,$c,el,tl,il,nl,rl,sl,al,ol,ul,hl,cl,ll,_l,dl,fl,pl,ml,gl,vl,yl,El,Tl=function(e,t,i){for(var n=0;n<t.length;++n)e.length<=n&&e.push(new i),e[n].copy(t[n]);e.length=t.length};!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.SWAPCHAIN=1]="SWAPCHAIN",e[e.BUFFER=2]="BUFFER",e[e.TEXTURE=3]="TEXTURE",e[e.RENDER_PASS=4]="RENDER_PASS",e[e.FRAMEBUFFER=5]="FRAMEBUFFER",e[e.SAMPLER=6]="SAMPLER",e[e.SHADER=7]="SHADER",e[e.DESCRIPTOR_SET_LAYOUT=8]="DESCRIPTOR_SET_LAYOUT",e[e.PIPELINE_LAYOUT=9]="PIPELINE_LAYOUT",e[e.PIPELINE_STATE=10]="PIPELINE_STATE",e[e.DESCRIPTOR_SET=11]="DESCRIPTOR_SET",e[e.INPUT_ASSEMBLER=12]="INPUT_ASSEMBLER",e[e.COMMAND_BUFFER=13]="COMMAND_BUFFER",e[e.QUEUE=14]="QUEUE",e[e.QUERY_POOL=15]="QUERY_POOL",e[e.GLOBAL_BARRIER=16]="GLOBAL_BARRIER",e[e.TEXTURE_BARRIER=17]="TEXTURE_BARRIER",e[e.BUFFER_BARRIER=18]="BUFFER_BARRIER",e[e.COUNT=19]="COUNT"}(Mc||(Mc=e("O",{}))),function(e){e[e.UNREADY=0]="UNREADY",e[e.FAILED=1]="FAILED",e[e.SUCCESS=2]="SUCCESS"}(Pc||(Pc=e("S",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.GLES2=1]="GLES2",e[e.GLES3=2]="GLES3",e[e.METAL=3]="METAL",e[e.VULKAN=4]="VULKAN",e[e.NVN=5]="NVN",e[e.WEBGL=6]="WEBGL",e[e.WEBGL2=7]="WEBGL2",e[e.WEBGPU=8]="WEBGPU"}(Lc||(Lc=e("A",{}))),function(e){e[e.IDENTITY=0]="IDENTITY",e[e.ROTATE_90=1]="ROTATE_90",e[e.ROTATE_180=2]="ROTATE_180",e[e.ROTATE_270=3]="ROTATE_270"}(xc||(xc=e("c",{}))),function(e){e[e.ELEMENT_INDEX_UINT=0]="ELEMENT_INDEX_UINT",e[e.INSTANCED_ARRAYS=1]="INSTANCED_ARRAYS",e[e.MULTIPLE_RENDER_TARGETS=2]="MULTIPLE_RENDER_TARGETS",e[e.BLEND_MINMAX=3]="BLEND_MINMAX",e[e.COMPUTE_SHADER=4]="COMPUTE_SHADER",e[e.INPUT_ATTACHMENT_BENEFIT=5]="INPUT_ATTACHMENT_BENEFIT",e[e.COUNT=6]="COUNT"}(Dc||(Dc=e("F",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A8=1]="A8",e[e.L8=2]="L8",e[e.LA8=3]="LA8",e[e.R8=4]="R8",e[e.R8SN=5]="R8SN",e[e.R8UI=6]="R8UI",e[e.R8I=7]="R8I",e[e.R16F=8]="R16F",e[e.R16UI=9]="R16UI",e[e.R16I=10]="R16I",e[e.R32F=11]="R32F",e[e.R32UI=12]="R32UI",e[e.R32I=13]="R32I",e[e.RG8=14]="RG8",e[e.RG8SN=15]="RG8SN",e[e.RG8UI=16]="RG8UI",e[e.RG8I=17]="RG8I",e[e.RG16F=18]="RG16F",e[e.RG16UI=19]="RG16UI",e[e.RG16I=20]="RG16I",e[e.RG32F=21]="RG32F",e[e.RG32UI=22]="RG32UI",e[e.RG32I=23]="RG32I",e[e.RGB8=24]="RGB8",e[e.SRGB8=25]="SRGB8",e[e.RGB8SN=26]="RGB8SN",e[e.RGB8UI=27]="RGB8UI",e[e.RGB8I=28]="RGB8I",e[e.RGB16F=29]="RGB16F",e[e.RGB16UI=30]="RGB16UI",e[e.RGB16I=31]="RGB16I",e[e.RGB32F=32]="RGB32F",e[e.RGB32UI=33]="RGB32UI",e[e.RGB32I=34]="RGB32I",e[e.RGBA8=35]="RGBA8",e[e.BGRA8=36]="BGRA8",e[e.SRGB8_A8=37]="SRGB8_A8",e[e.RGBA8SN=38]="RGBA8SN",e[e.RGBA8UI=39]="RGBA8UI",e[e.RGBA8I=40]="RGBA8I",e[e.RGBA16F=41]="RGBA16F",e[e.RGBA16UI=42]="RGBA16UI",e[e.RGBA16I=43]="RGBA16I",e[e.RGBA32F=44]="RGBA32F",e[e.RGBA32UI=45]="RGBA32UI",e[e.RGBA32I=46]="RGBA32I",e[e.R5G6B5=47]="R5G6B5",e[e.R11G11B10F=48]="R11G11B10F",e[e.RGB5A1=49]="RGB5A1",e[e.RGBA4=50]="RGBA4",e[e.RGB10A2=51]="RGB10A2",e[e.RGB10A2UI=52]="RGB10A2UI",e[e.RGB9E5=53]="RGB9E5",e[e.DEPTH=54]="DEPTH",e[e.DEPTH_STENCIL=55]="DEPTH_STENCIL",e[e.BC1=56]="BC1",e[e.BC1_ALPHA=57]="BC1_ALPHA",e[e.BC1_SRGB=58]="BC1_SRGB",e[e.BC1_SRGB_ALPHA=59]="BC1_SRGB_ALPHA",e[e.BC2=60]="BC2",e[e.BC2_SRGB=61]="BC2_SRGB",e[e.BC3=62]="BC3",e[e.BC3_SRGB=63]="BC3_SRGB",e[e.BC4=64]="BC4",e[e.BC4_SNORM=65]="BC4_SNORM",e[e.BC5=66]="BC5",e[e.BC5_SNORM=67]="BC5_SNORM",e[e.BC6H_UF16=68]="BC6H_UF16",e[e.BC6H_SF16=69]="BC6H_SF16",e[e.BC7=70]="BC7",e[e.BC7_SRGB=71]="BC7_SRGB",e[e.ETC_RGB8=72]="ETC_RGB8",e[e.ETC2_RGB8=73]="ETC2_RGB8",e[e.ETC2_SRGB8=74]="ETC2_SRGB8",e[e.ETC2_RGB8_A1=75]="ETC2_RGB8_A1",e[e.ETC2_SRGB8_A1=76]="ETC2_SRGB8_A1",e[e.ETC2_RGBA8=77]="ETC2_RGBA8",e[e.ETC2_SRGB8_A8=78]="ETC2_SRGB8_A8",e[e.EAC_R11=79]="EAC_R11",e[e.EAC_R11SN=80]="EAC_R11SN",e[e.EAC_RG11=81]="EAC_RG11",e[e.EAC_RG11SN=82]="EAC_RG11SN",e[e.PVRTC_RGB2=83]="PVRTC_RGB2",e[e.PVRTC_RGBA2=84]="PVRTC_RGBA2",e[e.PVRTC_RGB4=85]="PVRTC_RGB4",e[e.PVRTC_RGBA4=86]="PVRTC_RGBA4",e[e.PVRTC2_2BPP=87]="PVRTC2_2BPP",e[e.PVRTC2_4BPP=88]="PVRTC2_4BPP",e[e.ASTC_RGBA_4X4=89]="ASTC_RGBA_4X4",e[e.ASTC_RGBA_5X4=90]="ASTC_RGBA_5X4",e[e.ASTC_RGBA_5X5=91]="ASTC_RGBA_5X5",e[e.ASTC_RGBA_6X5=92]="ASTC_RGBA_6X5",e[e.ASTC_RGBA_6X6=93]="ASTC_RGBA_6X6",e[e.ASTC_RGBA_8X5=94]="ASTC_RGBA_8X5",e[e.ASTC_RGBA_8X6=95]="ASTC_RGBA_8X6",e[e.ASTC_RGBA_8X8=96]="ASTC_RGBA_8X8",e[e.ASTC_RGBA_10X5=97]="ASTC_RGBA_10X5",e[e.ASTC_RGBA_10X6=98]="ASTC_RGBA_10X6",e[e.ASTC_RGBA_10X8=99]="ASTC_RGBA_10X8",e[e.ASTC_RGBA_10X10=100]="ASTC_RGBA_10X10",e[e.ASTC_RGBA_12X10=101]="ASTC_RGBA_12X10",e[e.ASTC_RGBA_12X12=102]="ASTC_RGBA_12X12",e[e.ASTC_SRGBA_4X4=103]="ASTC_SRGBA_4X4",e[e.ASTC_SRGBA_5X4=104]="ASTC_SRGBA_5X4",e[e.ASTC_SRGBA_5X5=105]="ASTC_SRGBA_5X5",e[e.ASTC_SRGBA_6X5=106]="ASTC_SRGBA_6X5",e[e.ASTC_SRGBA_6X6=107]="ASTC_SRGBA_6X6",e[e.ASTC_SRGBA_8X5=108]="ASTC_SRGBA_8X5",e[e.ASTC_SRGBA_8X6=109]="ASTC_SRGBA_8X6",e[e.ASTC_SRGBA_8X8=110]="ASTC_SRGBA_8X8",e[e.ASTC_SRGBA_10X5=111]="ASTC_SRGBA_10X5",e[e.ASTC_SRGBA_10X6=112]="ASTC_SRGBA_10X6",e[e.ASTC_SRGBA_10X8=113]="ASTC_SRGBA_10X8",e[e.ASTC_SRGBA_10X10=114]="ASTC_SRGBA_10X10",e[e.ASTC_SRGBA_12X10=115]="ASTC_SRGBA_12X10",e[e.ASTC_SRGBA_12X12=116]="ASTC_SRGBA_12X12",e[e.COUNT=117]="COUNT"}(Fc||(Fc=e("d",{}))),function(e){e[e.NONE=0]="NONE",e[e.UNORM=1]="UNORM",e[e.SNORM=2]="SNORM",e[e.UINT=3]="UINT",e[e.INT=4]="INT",e[e.UFLOAT=5]="UFLOAT",e[e.FLOAT=6]="FLOAT"}(Bc||(Bc=e("e",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.BOOL=1]="BOOL",e[e.BOOL2=2]="BOOL2",e[e.BOOL3=3]="BOOL3",e[e.BOOL4=4]="BOOL4",e[e.INT=5]="INT",e[e.INT2=6]="INT2",e[e.INT3=7]="INT3",e[e.INT4=8]="INT4",e[e.UINT=9]="UINT",e[e.UINT2=10]="UINT2",e[e.UINT3=11]="UINT3",e[e.UINT4=12]="UINT4",e[e.FLOAT=13]="FLOAT",e[e.FLOAT2=14]="FLOAT2",e[e.FLOAT3=15]="FLOAT3",e[e.FLOAT4=16]="FLOAT4",e[e.MAT2=17]="MAT2",e[e.MAT2X3=18]="MAT2X3",e[e.MAT2X4=19]="MAT2X4",e[e.MAT3X2=20]="MAT3X2",e[e.MAT3=21]="MAT3",e[e.MAT3X4=22]="MAT3X4",e[e.MAT4X2=23]="MAT4X2",e[e.MAT4X3=24]="MAT4X3",e[e.MAT4=25]="MAT4",e[e.SAMPLER1D=26]="SAMPLER1D",e[e.SAMPLER1D_ARRAY=27]="SAMPLER1D_ARRAY",e[e.SAMPLER2D=28]="SAMPLER2D",e[e.SAMPLER2D_ARRAY=29]="SAMPLER2D_ARRAY",e[e.SAMPLER3D=30]="SAMPLER3D",e[e.SAMPLER_CUBE=31]="SAMPLER_CUBE",e[e.SAMPLER=32]="SAMPLER",e[e.TEXTURE1D=33]="TEXTURE1D",e[e.TEXTURE1D_ARRAY=34]="TEXTURE1D_ARRAY",e[e.TEXTURE2D=35]="TEXTURE2D",e[e.TEXTURE2D_ARRAY=36]="TEXTURE2D_ARRAY",e[e.TEXTURE3D=37]="TEXTURE3D",e[e.TEXTURE_CUBE=38]="TEXTURE_CUBE",e[e.IMAGE1D=39]="IMAGE1D",e[e.IMAGE1D_ARRAY=40]="IMAGE1D_ARRAY",e[e.IMAGE2D=41]="IMAGE2D",e[e.IMAGE2D_ARRAY=42]="IMAGE2D_ARRAY",e[e.IMAGE3D=43]="IMAGE3D",e[e.IMAGE_CUBE=44]="IMAGE_CUBE",e[e.SUBPASS_INPUT=45]="SUBPASS_INPUT",e[e.COUNT=46]="COUNT"}(Uc||(Uc=e("T",{}))),function(e){e[e.NONE=0]="NONE",e[e.TRANSFER_SRC=1]="TRANSFER_SRC",e[e.TRANSFER_DST=2]="TRANSFER_DST",e[e.INDEX=4]="INDEX",e[e.VERTEX=8]="VERTEX",e[e.UNIFORM=16]="UNIFORM",e[e.STORAGE=32]="STORAGE",e[e.INDIRECT=64]="INDIRECT"}(Gc||(Gc=e("f",{}))),function(e){e[e.NONE=0]="NONE"}(kc||(kc=e("g",{}))),function(e){e[e.NONE=0]="NONE",e[e.READ_ONLY=1]="READ_ONLY",e[e.WRITE_ONLY=2]="WRITE_ONLY",e[e.READ_WRITE=3]="READ_WRITE"}(Hc||(Hc=e("M",{}))),function(e){e[e.NONE=0]="NONE",e[e.DEVICE=1]="DEVICE",e[e.HOST=2]="HOST"}(zc||(zc=e("h",{}))),function(e){e[e.TEX1D=0]="TEX1D",e[e.TEX2D=1]="TEX2D",e[e.TEX3D=2]="TEX3D",e[e.CUBE=3]="CUBE",e[e.TEX1D_ARRAY=4]="TEX1D_ARRAY",e[e.TEX2D_ARRAY=5]="TEX2D_ARRAY"}(Vc||(Vc=e("i",{}))),function(e){e[e.NONE=0]="NONE",e[e.TRANSFER_SRC=1]="TRANSFER_SRC",e[e.TRANSFER_DST=2]="TRANSFER_DST",e[e.SAMPLED=4]="SAMPLED",e[e.STORAGE=8]="STORAGE",e[e.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",e[e.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT"}(Wc||(Wc=e("j",{}))),function(e){e[e.NONE=0]="NONE",e[e.GEN_MIPMAP=1]="GEN_MIPMAP",e[e.GENERAL_LAYOUT=2]="GENERAL_LAYOUT"}(jc||(jc=e("k",{}))),function(e){e[e.NONE=0]="NONE",e[e.RENDER_TARGET=1]="RENDER_TARGET",e[e.SAMPLED_TEXTURE=2]="SAMPLED_TEXTURE",e[e.LINEAR_FILTER=4]="LINEAR_FILTER",e[e.STORAGE_TEXTURE=8]="STORAGE_TEXTURE",e[e.VERTEX_ATTRIBUTE=16]="VERTEX_ATTRIBUTE"}(Xc||(Xc=e("l",{}))),function(e){e[e.ONE=0]="ONE",e[e.MULTIPLE_PERFORMANCE=1]="MULTIPLE_PERFORMANCE",e[e.MULTIPLE_BALANCE=2]="MULTIPLE_BALANCE",e[e.MULTIPLE_QUALITY=3]="MULTIPLE_QUALITY"}(Kc||(Kc=e("m",{}))),function(e){e[e.OFF=0]="OFF",e[e.ON=1]="ON",e[e.RELAXED=2]="RELAXED",e[e.MAILBOX=3]="MAILBOX",e[e.HALF=4]="HALF"}(Yc||(Yc=e("V",{}))),function(e){e[e.NONE=0]="NONE",e[e.POINT=1]="POINT",e[e.LINEAR=2]="LINEAR",e[e.ANISOTROPIC=3]="ANISOTROPIC"}(qc||(qc=e("n",{}))),function(e){e[e.WRAP=0]="WRAP",e[e.MIRROR=1]="MIRROR",e[e.CLAMP=2]="CLAMP",e[e.BORDER=3]="BORDER"}(Qc||(Qc=e("o",{}))),function(e){e[e.NEVER=0]="NEVER",e[e.LESS=1]="LESS",e[e.EQUAL=2]="EQUAL",e[e.LESS_EQUAL=3]="LESS_EQUAL",e[e.GREATER=4]="GREATER",e[e.NOT_EQUAL=5]="NOT_EQUAL",e[e.GREATER_EQUAL=6]="GREATER_EQUAL",e[e.ALWAYS=7]="ALWAYS"}(Zc||(Zc=e("p",{}))),function(e){e[e.ZERO=0]="ZERO",e[e.KEEP=1]="KEEP",e[e.REPLACE=2]="REPLACE",e[e.INCR=3]="INCR",e[e.DECR=4]="DECR",e[e.INVERT=5]="INVERT",e[e.INCR_WRAP=6]="INCR_WRAP",e[e.DECR_WRAP=7]="DECR_WRAP"}(Jc||(Jc=e("q",{}))),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_ALPHA=2]="SRC_ALPHA",e[e.DST_ALPHA=3]="DST_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=4]="ONE_MINUS_SRC_ALPHA",e[e.ONE_MINUS_DST_ALPHA=5]="ONE_MINUS_DST_ALPHA",e[e.SRC_COLOR=6]="SRC_COLOR",e[e.DST_COLOR=7]="DST_COLOR",e[e.ONE_MINUS_SRC_COLOR=8]="ONE_MINUS_SRC_COLOR",e[e.ONE_MINUS_DST_COLOR=9]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=10]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=11]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=12]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=13]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=14]="ONE_MINUS_CONSTANT_ALPHA"}($c||($c=e("r",{}))),function(e){e[e.ADD=0]="ADD",e[e.SUB=1]="SUB",e[e.REV_SUB=2]="REV_SUB",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX"}(el||(el=e("s",{}))),function(e){e[e.NONE=0]="NONE",e[e.R=1]="R",e[e.G=2]="G",e[e.B=4]="B",e[e.A=8]="A",e[e.ALL=15]="ALL"}(tl||(tl=e("t",{}))),function(e){e[e.NONE=0]="NONE",e[e.VERTEX=1]="VERTEX",e[e.CONTROL=2]="CONTROL",e[e.EVALUATION=4]="EVALUATION",e[e.GEOMETRY=8]="GEOMETRY",e[e.FRAGMENT=16]="FRAGMENT",e[e.COMPUTE=32]="COMPUTE",e[e.ALL=63]="ALL"}(il||(il=e("u",{}))),function(e){e[e.LOAD=0]="LOAD",e[e.CLEAR=1]="CLEAR",e[e.DISCARD=2]="DISCARD"}(nl||(nl=e("L",{}))),function(e){e[e.STORE=0]="STORE",e[e.DISCARD=1]="DISCARD"}(rl||(rl=e("v",{}))),function(e){e[e.NONE=0]="NONE",e[e.INDIRECT_BUFFER=1]="INDIRECT_BUFFER",e[e.INDEX_BUFFER=2]="INDEX_BUFFER",e[e.VERTEX_BUFFER=4]="VERTEX_BUFFER",e[e.VERTEX_SHADER_READ_UNIFORM_BUFFER=8]="VERTEX_SHADER_READ_UNIFORM_BUFFER",e[e.VERTEX_SHADER_READ_TEXTURE=16]="VERTEX_SHADER_READ_TEXTURE",e[e.VERTEX_SHADER_READ_OTHER=32]="VERTEX_SHADER_READ_OTHER",e[e.FRAGMENT_SHADER_READ_UNIFORM_BUFFER=64]="FRAGMENT_SHADER_READ_UNIFORM_BUFFER",e[e.FRAGMENT_SHADER_READ_TEXTURE=128]="FRAGMENT_SHADER_READ_TEXTURE",e[e.FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT=256]="FRAGMENT_SHADER_READ_COLOR_INPUT_ATTACHMENT",e[e.FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT=512]="FRAGMENT_SHADER_READ_DEPTH_STENCIL_INPUT_ATTACHMENT",e[e.FRAGMENT_SHADER_READ_OTHER=1024]="FRAGMENT_SHADER_READ_OTHER",e[e.COLOR_ATTACHMENT_READ=2048]="COLOR_ATTACHMENT_READ",e[e.DEPTH_STENCIL_ATTACHMENT_READ=4096]="DEPTH_STENCIL_ATTACHMENT_READ",e[e.COMPUTE_SHADER_READ_UNIFORM_BUFFER=8192]="COMPUTE_SHADER_READ_UNIFORM_BUFFER",e[e.COMPUTE_SHADER_READ_TEXTURE=16384]="COMPUTE_SHADER_READ_TEXTURE",e[e.COMPUTE_SHADER_READ_OTHER=32768]="COMPUTE_SHADER_READ_OTHER",e[e.TRANSFER_READ=65536]="TRANSFER_READ",e[e.HOST_READ=131072]="HOST_READ",e[e.PRESENT=262144]="PRESENT",e[e.VERTEX_SHADER_WRITE=524288]="VERTEX_SHADER_WRITE",e[e.FRAGMENT_SHADER_WRITE=1048576]="FRAGMENT_SHADER_WRITE",e[e.COLOR_ATTACHMENT_WRITE=2097152]="COLOR_ATTACHMENT_WRITE",e[e.DEPTH_STENCIL_ATTACHMENT_WRITE=4194304]="DEPTH_STENCIL_ATTACHMENT_WRITE",e[e.COMPUTE_SHADER_WRITE=8388608]="COMPUTE_SHADER_WRITE",e[e.TRANSFER_WRITE=16777216]="TRANSFER_WRITE",e[e.HOST_PREINITIALIZED=33554432]="HOST_PREINITIALIZED",e[e.HOST_WRITE=67108864]="HOST_WRITE"}(sl||(sl=e("w",{}))),function(e){e[e.NONE=0]="NONE",e[e.SAMPLE_ZERO=1]="SAMPLE_ZERO",e[e.AVERAGE=2]="AVERAGE",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX"}(al||(al=e("x",{}))),function(e){e[e.GRAPHICS=0]="GRAPHICS",e[e.COMPUTE=1]="COMPUTE",e[e.RAY_TRACING=2]="RAY_TRACING"}(ol||(ol=e("y",{}))),function(e){e[e.POINT_LIST=0]="POINT_LIST",e[e.LINE_LIST=1]="LINE_LIST",e[e.LINE_STRIP=2]="LINE_STRIP",e[e.LINE_LOOP=3]="LINE_LOOP",e[e.LINE_LIST_ADJACENCY=4]="LINE_LIST_ADJACENCY",e[e.LINE_STRIP_ADJACENCY=5]="LINE_STRIP_ADJACENCY",e[e.ISO_LINE_LIST=6]="ISO_LINE_LIST",e[e.TRIANGLE_LIST=7]="TRIANGLE_LIST",e[e.TRIANGLE_STRIP=8]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=9]="TRIANGLE_FAN",e[e.TRIANGLE_LIST_ADJACENCY=10]="TRIANGLE_LIST_ADJACENCY",e[e.TRIANGLE_STRIP_ADJACENCY=11]="TRIANGLE_STRIP_ADJACENCY",e[e.TRIANGLE_PATCH_ADJACENCY=12]="TRIANGLE_PATCH_ADJACENCY",e[e.QUAD_PATCH_LIST=13]="QUAD_PATCH_LIST"}(ul||(ul=e("z",{}))),function(e){e[e.FILL=0]="FILL",e[e.POINT=1]="POINT",e[e.LINE=2]="LINE"}(hl||(hl=e("E",{}))),function(e){e[e.GOURAND=0]="GOURAND",e[e.FLAT=1]="FLAT"}(cl||(cl=e("G",{}))),function(e){e[e.NONE=0]="NONE",e[e.FRONT=1]="FRONT",e[e.BACK=2]="BACK"}(ll||(ll=e("H",{}))),function(e){e[e.NONE=0]="NONE",e[e.LINE_WIDTH=1]="LINE_WIDTH",e[e.DEPTH_BIAS=2]="DEPTH_BIAS",e[e.BLEND_CONSTANTS=4]="BLEND_CONSTANTS",e[e.DEPTH_BOUNDS=8]="DEPTH_BOUNDS",e[e.STENCIL_WRITE_MASK=16]="STENCIL_WRITE_MASK",e[e.STENCIL_COMPARE_MASK=32]="STENCIL_COMPARE_MASK"}(_l||(_l=e("I",{}))),function(e){e[e.FRONT=1]="FRONT",e[e.BACK=2]="BACK",e[e.ALL=3]="ALL"}(dl||(dl=e("J",{}))),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.UNIFORM_BUFFER=1]="UNIFORM_BUFFER",e[e.DYNAMIC_UNIFORM_BUFFER=2]="DYNAMIC_UNIFORM_BUFFER",e[e.STORAGE_BUFFER=4]="STORAGE_BUFFER",e[e.DYNAMIC_STORAGE_BUFFER=8]="DYNAMIC_STORAGE_BUFFER",e[e.SAMPLER_TEXTURE=16]="SAMPLER_TEXTURE",e[e.SAMPLER=32]="SAMPLER",e[e.TEXTURE=64]="TEXTURE",e[e.STORAGE_IMAGE=128]="STORAGE_IMAGE",e[e.INPUT_ATTACHMENT=256]="INPUT_ATTACHMENT"}(fl||(fl=e("K",{}))),function(e){e[e.GRAPHICS=0]="GRAPHICS",e[e.COMPUTE=1]="COMPUTE",e[e.TRANSFER=2]="TRANSFER"}(pl||(pl=e("Q",{}))),function(e){e[e.OCCLUSION=0]="OCCLUSION",e[e.PIPELINE_STATISTICS=1]="PIPELINE_STATISTICS",e[e.TIMESTAMP=2]="TIMESTAMP"}(ml||(ml=e("N",{}))),function(e){e[e.PRIMARY=0]="PRIMARY",e[e.SECONDARY=1]="SECONDARY"}(gl||(gl=e("U",{}))),function(e){e[e.NONE=0]="NONE",e[e.COLOR=1]="COLOR",e[e.DEPTH=2]="DEPTH",e[e.STENCIL=4]="STENCIL",e[e.DEPTH_STENCIL=6]="DEPTH_STENCIL",e[e.ALL=7]="ALL"}(vl||(vl=e("W",{}))),function(e){e[e.FULL=0]="FULL",e[e.SPLIT_BEGIN=1]="SPLIT_BEGIN",e[e.SPLIT_END=2]="SPLIT_END"}(yl||(yl=e("X",{}))),function(e){e[e.RASTER=0]="RASTER",e[e.COMPUTE=1]="COMPUTE",e[e.COPY=2]="COPY",e[e.MOVE=3]="MOVE",e[e.RAYTRACE=4]="RAYTRACE",e[e.PRESENT=5]="PRESENT"}(El||(El=e("Y",{})));var Al,Sl=e("Z",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e}()),Rl=e("_",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p,m,g,v,y,E,T,A,S){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=0),void 0===l&&(l=0),void 0===_&&(_=0),void 0===d&&(d=0),void 0===f&&(f=0),void 0===p&&(p=1),void 0===m&&(m=0),void 0===g&&(g=0),void 0===v&&(v=new Sl),void 0===y&&(y=new Sl),void 0===E&&(E=!1),void 0===T&&(T=-1),void 0===A&&(A=1),void 0===S&&(S=1),this.maxVertexAttributes=e,this.maxVertexUniformVectors=t,this.maxFragmentUniformVectors=i,this.maxTextureUnits=n,this.maxImageUnits=r,this.maxVertexTextureUnits=s,this.maxColorRenderTargets=a,this.maxShaderStorageBufferBindings=o,this.maxShaderStorageBlockSize=u,this.maxUniformBufferBindings=h,this.maxUniformBlockSize=c,this.maxTextureSize=l,this.maxCubeMapTextureSize=_,this.maxArrayTextureLayers=d,this.max3DTextureSize=f,this.uboOffsetAlignment=p,this.maxComputeSharedMemorySize=m,this.maxComputeWorkGroupInvocations=g,this.maxComputeWorkGroupSize=v,this.maxComputeWorkGroupCount=y,this.supportQuery=E,this.clipSpaceMinZ=T,this.screenSpaceSignY=A,this.clipSpaceSignY=S}return e.prototype.copy=function(e){return this.maxVertexAttributes=e.maxVertexAttributes,this.maxVertexUniformVectors=e.maxVertexUniformVectors,this.maxFragmentUniformVectors=e.maxFragmentUniformVectors,this.maxTextureUnits=e.maxTextureUnits,this.maxImageUnits=e.maxImageUnits,this.maxVertexTextureUnits=e.maxVertexTextureUnits,this.maxColorRenderTargets=e.maxColorRenderTargets,this.maxShaderStorageBufferBindings=e.maxShaderStorageBufferBindings,this.maxShaderStorageBlockSize=e.maxShaderStorageBlockSize,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSize=e.maxUniformBlockSize,this.maxTextureSize=e.maxTextureSize,this.maxCubeMapTextureSize=e.maxCubeMapTextureSize,this.maxArrayTextureLayers=e.maxArrayTextureLayers,this.max3DTextureSize=e.max3DTextureSize,this.uboOffsetAlignment=e.uboOffsetAlignment,this.maxComputeSharedMemorySize=e.maxComputeSharedMemorySize,this.maxComputeWorkGroupInvocations=e.maxComputeWorkGroupInvocations,this.maxComputeWorkGroupSize.copy(e.maxComputeWorkGroupSize),this.maxComputeWorkGroupCount.copy(e.maxComputeWorkGroupCount),this.supportQuery=e.supportQuery,this.clipSpaceMinZ=e.clipSpaceMinZ,this.screenSpaceSignY=e.screenSpaceSignY,this.clipSpaceSignY=e.clipSpaceSignY,this},e}()),wl=e("$",function(){function e(e){void 0===e&&(e=!0),this.enableBarrierDeduce=e}return e.prototype.copy=function(e){return this.enableBarrierDeduce=e.enableBarrierDeduce,this},e}()),Il=e("a0",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.x=e,this.y=t,this.z=i}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},e}()),bl=e("a1",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=e,this.y=t,this.width=i,this.height=n}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this},e}()),Ol=e("a2",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),this.width=e,this.height=t,this.depth=i}return e.prototype.copy=function(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this},e}()),Nl=e("a3",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),this.mipLevel=e,this.baseArrayLayer=t,this.layerCount=i}return e.prototype.copy=function(e){return this.mipLevel=e.mipLevel,this.baseArrayLayer=e.baseArrayLayer,this.layerCount=e.layerCount,this},e}()),Cl=e("a4",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=1),void 0===i&&(i=0),void 0===n&&(n=1),this.baseMipLevel=e,this.levelCount=t,this.baseArrayLayer=i,this.layerCount=n}return e.prototype.copy=function(e){return this.baseMipLevel=e.baseMipLevel,this.levelCount=e.levelCount,this.baseArrayLayer=e.baseArrayLayer,this.layerCount=e.layerCount,this},e}()),Ml=e("a5",function(){function e(e,t,i,n,r){void 0===e&&(e=new Nl),void 0===t&&(t=new Il),void 0===i&&(i=new Nl),void 0===n&&(n=new Il),void 0===r&&(r=new Ol),this.srcSubres=e,this.srcOffset=t,this.dstSubres=i,this.dstOffset=n,this.extent=r}return e.prototype.copy=function(e){return this.srcSubres.copy(e.srcSubres),this.srcOffset.copy(e.srcOffset),this.dstSubres.copy(e.dstSubres),this.dstOffset.copy(e.dstOffset),this.extent.copy(e.extent),this},e}()),Pl=e("a6",function(){function e(e,t,i,n,r,s){void 0===e&&(e=new Nl),void 0===t&&(t=new Il),void 0===i&&(i=new Ol),void 0===n&&(n=new Nl),void 0===r&&(r=new Il),void 0===s&&(s=new Ol),this.srcSubres=e,this.srcOffset=t,this.srcExtent=i,this.dstSubres=n,this.dstOffset=r,this.dstExtent=s}return e.prototype.copy=function(e){return this.srcSubres.copy(e.srcSubres),this.srcOffset.copy(e.srcOffset),this.srcExtent.copy(e.srcExtent),this.dstSubres.copy(e.dstSubres),this.dstOffset.copy(e.dstOffset),this.dstExtent.copy(e.dstExtent),this},e}()),Ll=e("a7",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=new Il),void 0===r&&(r=new Ol),void 0===s&&(s=new Nl),this.buffOffset=e,this.buffStride=t,this.buffTexHeight=i,this.texOffset=n,this.texExtent=r,this.texSubres=s}return e.prototype.copy=function(e){return this.buffOffset=e.buffOffset,this.buffStride=e.buffStride,this.buffTexHeight=e.buffTexHeight,this.texOffset.copy(e.texOffset),this.texExtent.copy(e.texExtent),this.texSubres.copy(e.texSubres),this},e}()),xl=e("a8",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=1),this.left=e,this.top=t,this.width=i,this.height=n,this.minDepth=r,this.maxDepth=s}return e.prototype.copy=function(e){return this.left=e.left,this.top=e.top,this.width=e.width,this.height=e.height,this.minDepth=e.minDepth,this.maxDepth=e.maxDepth,this},e}()),Dl=e("a9",function(){function e(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=e,this.y=t,this.z=i,this.w=n}return e.prototype.copy=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},e}()),Fl=e("aa",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=[0]),void 0===t&&(t=[0]),void 0===i&&(i=[0]),void 0===n&&(n=[0]),void 0===r&&(r=[0]),void 0===s&&(s=[0]),void 0===a&&(a=[0]),void 0===o&&(o=[0]),this.maxBlockCounts=e,this.maxSamplerTextureCounts=t,this.maxSamplerCounts=i,this.maxTextureCounts=n,this.maxBufferCounts=r,this.maxImageCounts=s,this.maxSubpassInputCounts=a,this.setIndices=o}return e.prototype.copy=function(e){return this.maxBlockCounts=e.maxBlockCounts.slice(),this.maxSamplerTextureCounts=e.maxSamplerTextureCounts.slice(),this.maxSamplerCounts=e.maxSamplerCounts.slice(),this.maxTextureCounts=e.maxTextureCounts.slice(),this.maxBufferCounts=e.maxBufferCounts.slice(),this.maxImageCounts=e.maxImageCounts.slice(),this.maxSubpassInputCounts=e.maxSubpassInputCounts.slice(),this.setIndices=e.setIndices.slice(),this},e}()),Bl=e("ab",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=null),void 0===i&&(i=Yc.ON),void 0===n&&(n=0),void 0===r&&(r=0),this.windowId=e,this.windowHandle=t,this.vsyncMode=i,this.width=n,this.height=r}return e.prototype.copy=function(e){return this.windowId=e.windowId,this.windowHandle=e.windowHandle,this.vsyncMode=e.vsyncMode,this.width=e.width,this.height=e.height,this},e}()),Ul=e("ac",function(){function e(e){void 0===e&&(e=new Fl),this.bindingMappingInfo=e}return e.prototype.copy=function(e){return this.bindingMappingInfo.copy(e.bindingMappingInfo),this},e}()),Gl=e("ad",function(){function e(e,t,i,n,r){void 0===e&&(e=Gc.NONE),void 0===t&&(t=zc.NONE),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=kc.NONE),this.usage=e,this.memUsage=t,this.size=i,this.stride=n,this.flags=r}return e.prototype.copy=function(e){return this.usage=e.usage,this.memUsage=e.memUsage,this.size=e.size,this.stride=e.stride,this.flags=e.flags,this},e}()),kl=e("ae",function(){function e(e,t,i){void 0===e&&(e=null),void 0===t&&(t=0),void 0===i&&(i=0),this.buffer=e,this.offset=t,this.range=i}return e.prototype.copy=function(e){return this.buffer=e.buffer,this.offset=e.offset,this.range=e.range,this},e}()),Hl=e("af",function(){function e(e,t,i,n,r,s,a){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),this.vertexCount=e,this.firstVertex=t,this.indexCount=i,this.firstIndex=n,this.vertexOffset=r,this.instanceCount=s,this.firstInstance=a}return e.prototype.copy=function(e){return this.vertexCount=e.vertexCount,this.firstVertex=e.firstVertex,this.indexCount=e.indexCount,this.firstIndex=e.firstIndex,this.vertexOffset=e.vertexOffset,this.instanceCount=e.instanceCount,this.firstInstance=e.firstInstance,this},e}()),zl=e("ag",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=null),void 0===r&&(r=0),this.groupCountX=e,this.groupCountY=t,this.groupCountZ=i,this.indirectBuffer=n,this.indirectOffset=r}return e.prototype.copy=function(e){return this.groupCountX=e.groupCountX,this.groupCountY=e.groupCountY,this.groupCountZ=e.groupCountZ,this.indirectBuffer=e.indirectBuffer,this.indirectOffset=e.indirectOffset,this},e}()),Vl=e("ah",function(){function e(e){void 0===e&&(e=[]),this.drawInfos=e}return e.prototype.copy=function(e){return Tl(this.drawInfos,e.drawInfos,Hl),this},e}()),Wl=e("ai",function(){function e(e,t,i,n,r,s,a,o,u,h,c){void 0===e&&(e=Vc.TEX2D),void 0===t&&(t=Wc.NONE),void 0===i&&(i=Fc.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=jc.NONE),void 0===a&&(a=1),void 0===o&&(o=1),void 0===u&&(u=Kc.ONE),void 0===h&&(h=1),void 0===c&&(c=0),this.type=e,this.usage=t,this.format=i,this.width=n,this.height=r,this.flags=s,this.layerCount=a,this.levelCount=o,this.samples=u,this.depth=h,this.externalRes=c}return e.prototype.copy=function(e){return this.type=e.type,this.usage=e.usage,this.format=e.format,this.width=e.width,this.height=e.height,this.flags=e.flags,this.layerCount=e.layerCount,this.levelCount=e.levelCount,this.samples=e.samples,this.depth=e.depth,this.externalRes=e.externalRes,this},e}()),jl=e("aj",function(){function e(e,t,i,n,r,s,a){void 0===e&&(e=null),void 0===t&&(t=Vc.TEX2D),void 0===i&&(i=Fc.UNKNOWN),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),this.texture=e,this.type=t,this.format=i,this.baseLevel=n,this.levelCount=r,this.baseLayer=s,this.layerCount=a}return e.prototype.copy=function(e){return this.texture=e.texture,this.type=e.type,this.format=e.format,this.baseLevel=e.baseLevel,this.levelCount=e.levelCount,this.baseLayer=e.baseLayer,this.layerCount=e.layerCount,this},e}()),Xl=e("ak",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=qc.LINEAR),void 0===t&&(t=qc.LINEAR),void 0===i&&(i=qc.NONE),void 0===n&&(n=Qc.WRAP),void 0===r&&(r=Qc.WRAP),void 0===s&&(s=Qc.WRAP),void 0===a&&(a=0),void 0===o&&(o=Zc.ALWAYS),this.minFilter=e,this.magFilter=t,this.mipFilter=i,this.addressU=n,this.addressV=r,this.addressW=s,this.maxAnisotropy=a,this.cmpFunc=o}return e.prototype.copy=function(e){return this.minFilter=e.minFilter,this.magFilter=e.magFilter,this.mipFilter=e.mipFilter,this.addressU=e.addressU,this.addressV=e.addressV,this.addressW=e.addressW,this.maxAnisotropy=e.maxAnisotropy,this.cmpFunc=e.cmpFunc,this},e}()),Kl=e("al",function(){function e(e,t,i){void 0===e&&(e=""),void 0===t&&(t=Uc.UNKNOWN),void 0===i&&(i=0),this.name=e,this.type=t,this.count=i}return e.prototype.copy=function(e){return this.name=e.name,this.type=e.type,this.count=e.count,this},e}()),Yl=e("am",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=[]),void 0===r&&(r=0),void 0===s&&(s=0),this.set=e,this.binding=t,this.name=i,this.members=n,this.count=r,this.flattened=s}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,Tl(this.members,e.members,Kl),this.count=e.count,this.flattened=e.flattened,this},e}()),ql=e("an",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=Uc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=0),this.set=e,this.binding=t,this.name=i,this.type=n,this.count=r,this.flattened=s}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.type=e.type,this.count=e.count,this.flattened=e.flattened,this},e}()),Ql=e("ao",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),this.set=e,this.binding=t,this.name=i,this.count=n,this.flattened=r}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.count=e.count,this.flattened=e.flattened,this},e}()),Zl=e("ap",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=Uc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=0),this.set=e,this.binding=t,this.name=i,this.type=n,this.count=r,this.flattened=s}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.type=e.type,this.count=e.count,this.flattened=e.flattened,this},e}()),Jl=e("aq",function(){function e(e,t,i,n,r,s,a){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=Uc.UNKNOWN),void 0===r&&(r=0),void 0===s&&(s=Hc.READ_WRITE),void 0===a&&(a=0),this.set=e,this.binding=t,this.name=i,this.type=n,this.count=r,this.memoryAccess=s,this.flattened=a}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.type=e.type,this.count=e.count,this.memoryAccess=e.memoryAccess,this.flattened=e.flattened,this},e}()),$l=e("ar",function(){function e(e,t,i,n,r,s){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=Hc.READ_WRITE),void 0===s&&(s=0),this.set=e,this.binding=t,this.name=i,this.count=n,this.memoryAccess=r,this.flattened=s}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.count=e.count,this.memoryAccess=e.memoryAccess,this.flattened=e.flattened,this},e}()),e_=e("as",function(){function e(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=""),void 0===n&&(n=0),void 0===r&&(r=0),this.set=e,this.binding=t,this.name=i,this.count=n,this.flattened=r}return e.prototype.copy=function(e){return this.set=e.set,this.binding=e.binding,this.name=e.name,this.count=e.count,this.flattened=e.flattened,this},e}()),t_=e("at",function(){function e(e,t){void 0===e&&(e=il.NONE),void 0===t&&(t=""),this.stage=e,this.source=t}return e.prototype.copy=function(e){return this.stage=e.stage,this.source=e.source,this},e}()),i_=e("au",function(){function e(e,t,i,n,r,s){void 0===e&&(e=""),void 0===t&&(t=Fc.UNKNOWN),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=!1),void 0===s&&(s=0),this.name=e,this.format=t,this.isNormalized=i,this.stream=n,this.isInstanced=r,this.location=s}return e.prototype.copy=function(e){return this.name=e.name,this.format=e.format,this.isNormalized=e.isNormalized,this.stream=e.stream,this.isInstanced=e.isInstanced,this.location=e.location,this},e}()),n_=e("av",function(){function e(e,t,i,n,r,s,a,o,u,h){void 0===e&&(e=""),void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===s&&(s=[]),void 0===a&&(a=[]),void 0===o&&(o=[]),void 0===u&&(u=[]),void 0===h&&(h=[]),this.name=e,this.stages=t,this.attributes=i,this.blocks=n,this.buffers=r,this.samplerTextures=s,this.samplers=a,this.textures=o,this.images=u,this.subpassInputs=h}return e.prototype.copy=function(e){return this.name=e.name,Tl(this.stages,e.stages,t_),Tl(this.attributes,e.attributes,i_),Tl(this.blocks,e.blocks,Yl),Tl(this.buffers,e.buffers,$l),Tl(this.samplerTextures,e.samplerTextures,ql),Tl(this.samplers,e.samplers,Ql),Tl(this.textures,e.textures,Zl),Tl(this.images,e.images,Jl),Tl(this.subpassInputs,e.subpassInputs,e_),this},e}()),r_=e("aw",function(){function e(e,t,i,n){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=null),void 0===n&&(n=null),this.attributes=e,this.vertexBuffers=t,this.indexBuffer=i,this.indirectBuffer=n}return e.prototype.copy=function(e){return Tl(this.attributes,e.attributes,i_),this.vertexBuffers=e.vertexBuffers.slice(),this.indexBuffer=e.indexBuffer,this.indirectBuffer=e.indirectBuffer,this},e}()),s_=e("ax",function(){function e(e,t,i,n,r,s){void 0===e&&(e=Fc.UNKNOWN),void 0===t&&(t=Kc.ONE),void 0===i&&(i=nl.CLEAR),void 0===n&&(n=rl.STORE),void 0===r&&(r=null),void 0===s&&(s=!1),this.format=e,this.sampleCount=t,this.loadOp=i,this.storeOp=n,this.barrier=r,this.isGeneralLayout=s}return e.prototype.copy=function(e){return this.format=e.format,this.sampleCount=e.sampleCount,this.loadOp=e.loadOp,this.storeOp=e.storeOp,this.barrier=e.barrier,this.isGeneralLayout=e.isGeneralLayout,this},e}()),a_=e("ay",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=Fc.UNKNOWN),void 0===t&&(t=Kc.ONE),void 0===i&&(i=nl.CLEAR),void 0===n&&(n=rl.STORE),void 0===r&&(r=nl.CLEAR),void 0===s&&(s=rl.STORE),void 0===a&&(a=null),void 0===o&&(o=!1),this.format=e,this.sampleCount=t,this.depthLoadOp=i,this.depthStoreOp=n,this.stencilLoadOp=r,this.stencilStoreOp=s,this.barrier=a,this.isGeneralLayout=o}return e.prototype.copy=function(e){return this.format=e.format,this.sampleCount=e.sampleCount,this.depthLoadOp=e.depthLoadOp,this.depthStoreOp=e.depthStoreOp,this.stencilLoadOp=e.stencilLoadOp,this.stencilStoreOp=e.stencilStoreOp,this.barrier=e.barrier,this.isGeneralLayout=e.isGeneralLayout,this},e}()),o_=e("az",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===n&&(n=[]),void 0===r&&(r=-1),void 0===s&&(s=-1),void 0===a&&(a=al.NONE),void 0===o&&(o=al.NONE),this.inputs=e,this.colors=t,this.resolves=i,this.preserves=n,this.depthStencil=r,this.depthStencilResolve=s,this.depthResolveMode=a,this.stencilResolveMode=o}return e.prototype.copy=function(e){return this.inputs=e.inputs.slice(),this.colors=e.colors.slice(),this.resolves=e.resolves.slice(),this.preserves=e.preserves.slice(),this.depthStencil=e.depthStencil,this.depthStencilResolve=e.depthStencilResolve,this.depthResolveMode=e.depthResolveMode,this.stencilResolveMode=e.stencilResolveMode,this},e}()),u_=e("aA",function(){function e(e,t,i,n,r,s,a,o,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=0),void 0===a&&(a=null),void 0===o&&(o=null),void 0===u&&(u=0),this.srcSubpass=e,this.dstSubpass=t,this.generalBarrier=i,this.bufferBarriers=n,this.buffers=r,this.bufferBarrierCount=s,this.textureBarriers=a,this.textures=o,this.textureBarrierCount=u}return e.prototype.copy=function(e){return this.srcSubpass=e.srcSubpass,this.dstSubpass=e.dstSubpass,this.generalBarrier=e.generalBarrier,this.bufferBarriers=e.bufferBarriers,this.buffers=e.buffers,this.bufferBarrierCount=e.bufferBarrierCount,this.textureBarriers=e.textureBarriers,this.textures=e.textures,this.textureBarrierCount=e.textureBarrierCount,this},e}()),h_=e("aB",function(){function e(e,t,i,n){void 0===e&&(e=[]),void 0===t&&(t=new a_),void 0===i&&(i=[]),void 0===n&&(n=[]),this.colorAttachments=e,this.depthStencilAttachment=t,this.subpasses=i,this.dependencies=n}return e.prototype.copy=function(e){return Tl(this.colorAttachments,e.colorAttachments,s_),this.depthStencilAttachment.copy(e.depthStencilAttachment),Tl(this.subpasses,e.subpasses,o_),Tl(this.dependencies,e.dependencies,u_),this},e}()),c_=e("aC",function(){function e(e,t,i){void 0===e&&(e=sl.NONE),void 0===t&&(t=sl.NONE),void 0===i&&(i=yl.FULL),this.prevAccesses=e,this.nextAccesses=t,this.type=i}return e.prototype.copy=function(e){return this.prevAccesses=e.prevAccesses,this.nextAccesses=e.nextAccesses,this.type=e.type,this},e}()),l_=e("aD",function(){function e(e,t,i,n,r,s,a,o,u,h){void 0===e&&(e=sl.NONE),void 0===t&&(t=sl.NONE),void 0===i&&(i=yl.FULL),void 0===n&&(n=0),void 0===r&&(r=1),void 0===s&&(s=0),void 0===a&&(a=1),void 0===o&&(o=!1),void 0===u&&(u=null),void 0===h&&(h=null),this.prevAccesses=e,this.nextAccesses=t,this.type=i,this.baseMipLevel=n,this.levelCount=r,this.baseSlice=s,this.sliceCount=a,this.discardContents=o,this.srcQueue=u,this.dstQueue=h}return e.prototype.copy=function(e){return this.prevAccesses=e.prevAccesses,this.nextAccesses=e.nextAccesses,this.type=e.type,this.baseMipLevel=e.baseMipLevel,this.levelCount=e.levelCount,this.baseSlice=e.baseSlice,this.sliceCount=e.sliceCount,this.discardContents=e.discardContents,this.srcQueue=e.srcQueue,this.dstQueue=e.dstQueue,this},e}()),__=e("aE",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=sl.NONE),void 0===t&&(t=sl.NONE),void 0===i&&(i=yl.FULL),void 0===n&&(n=0),void 0===r&&(r=0),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===o&&(o=null),this.prevAccesses=e,this.nextAccesses=t,this.type=i,this.offset=n,this.size=r,this.discardContents=s,this.srcQueue=a,this.dstQueue=o}return e.prototype.copy=function(e){return this.prevAccesses=e.prevAccesses,this.nextAccesses=e.nextAccesses,this.type=e.type,this.offset=e.offset,this.size=e.size,this.discardContents=e.discardContents,this.srcQueue=e.srcQueue,this.dstQueue=e.dstQueue,this},e}()),d_=e("aF",function(){function e(e,t,i){void 0===e&&(e=null),void 0===t&&(t=[]),void 0===i&&(i=null),this.renderPass=e,this.colorTextures=t,this.depthStencilTexture=i}return e.prototype.copy=function(e){return this.renderPass=e.renderPass,this.colorTextures=e.colorTextures.slice(),this.depthStencilTexture=e.depthStencilTexture,this},e}()),f_=e("aG",function(){function e(e,t,i,n,r){void 0===e&&(e=-1),void 0===t&&(t=fl.UNKNOWN),void 0===i&&(i=0),void 0===n&&(n=il.NONE),void 0===r&&(r=[]),this.binding=e,this.descriptorType=t,this.count=i,this.stageFlags=n,this.immutableSamplers=r}return e.prototype.copy=function(e){return this.binding=e.binding,this.descriptorType=e.descriptorType,this.count=e.count,this.stageFlags=e.stageFlags,this.immutableSamplers=e.immutableSamplers.slice(),this},e}()),p_=e("aH",function(){function e(e){void 0===e&&(e=[]),this.bindings=e}return e.prototype.copy=function(e){return Tl(this.bindings,e.bindings,f_),this},e}()),m_=e("aI",function(){function e(e){void 0===e&&(e=null),this.layout=e}return e.prototype.copy=function(e){return this.layout=e.layout,this},e}()),g_=e("aJ",function(){function e(e){void 0===e&&(e=[]),this.setLayouts=e}return e.prototype.copy=function(e){return this.setLayouts=e.setLayouts.slice(),this},e}()),v_=e("aK",function(){function e(e){void 0===e&&(e=[]),this.attributes=e}return e.prototype.copy=function(e){return Tl(this.attributes,e.attributes,i_),this},e}()),y_=e("aL",function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=gl.PRIMARY),this.queue=e,this.type=t}return e.prototype.copy=function(e){return this.queue=e.queue,this.type=e.type,this},e}()),E_=e("aM",function(){function e(e){void 0===e&&(e=pl.GRAPHICS),this.type=e}return e.prototype.copy=function(e){return this.type=e.type,this},e}()),T_=e("aN",function(){function e(e,t,i){void 0===e&&(e=ml.OCCLUSION),void 0===t&&(t=32767),void 0===i&&(i=!0),this.type=e,this.maxQueryObjects=t,this.forceWait=i}return e.prototype.copy=function(e){return this.type=e.type,this.maxQueryObjects=e.maxQueryObjects,this.forceWait=e.forceWait,this},e}()),A_=e("aO",(function(e,t,i,n,r,s,a,o){void 0===e&&(e=""),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=Bc.NONE),void 0===r&&(r=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),void 0===o&&(o=!1),this.name=e,this.size=t,this.count=i,this.type=n,this.hasAlpha=r,this.hasDepth=s,this.hasStencil=a,this.isCompressed=o})),S_=e("aP",function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.bufferSize=e,this.textureSize=t}return e.prototype.copy=function(e){return this.bufferSize=e.bufferSize,this.textureSize=e.textureSize,this},e}()),R_=e("aQ",function(){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.writeMask=e,this.compareMask=t,this.reference=i}return e.prototype.copy=function(e){return this.writeMask=e.writeMask,this.compareMask=e.compareMask,this.reference=e.reference,this},e}()),w_=e("aR",function(){function e(e,t,i,n,r,s,a,o,u,h,c){void 0===e&&(e=new xl),void 0===t&&(t=new bl),void 0===i&&(i=new Dl),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=new R_),void 0===c&&(c=new R_),this.viewport=e,this.scissor=t,this.blendConstant=i,this.lineWidth=n,this.depthBiasConstant=r,this.depthBiasClamp=s,this.depthBiasSlope=a,this.depthMinBounds=o,this.depthMaxBounds=u,this.stencilStatesFront=h,this.stencilStatesBack=c}return e.prototype.copy=function(e){return this.viewport.copy(e.viewport),this.scissor.copy(e.scissor),this.blendConstant.copy(e.blendConstant),this.lineWidth=e.lineWidth,this.depthBiasConstant=e.depthBiasConstant,this.depthBiasClamp=e.depthBiasClamp,this.depthBiasSlope=e.depthBiasSlope,this.depthMinBounds=e.depthMinBounds,this.depthMaxBounds=e.depthMaxBounds,this.stencilStatesFront.copy(e.stencilStatesFront),this.stencilStatesBack.copy(e.stencilStatesBack),this},e}()),I_=e("aS",function(e){function t(i){var n;return(n=e.call(this)||this)._objectType=Mc.UNKNOWN,n._objectID=0,n._typedID=0,n._objectType=i,n._objectID=t._idTable[Mc.UNKNOWN]++,n._typedID=t._idTable[i]++,n}return s(t,e),n(t,[{key:"objectType",get:function(){return this._objectType}},{key:"objectID",get:function(){return this._objectID}},{key:"typedID",get:function(){return this._typedID}}]),t}(Oc));I_._idTable=Array(Mc.COUNT).fill(65536),function(e){e.ATTR_POSITION="a_position",e.ATTR_NORMAL="a_normal",e.ATTR_TANGENT="a_tangent",e.ATTR_BITANGENT="a_bitangent",e.ATTR_WEIGHTS="a_weights",e.ATTR_JOINTS="a_joints",e.ATTR_COLOR="a_color",e.ATTR_COLOR1="a_color1",e.ATTR_COLOR2="a_color2",e.ATTR_TEX_COORD="a_texCoord",e.ATTR_TEX_COORD1="a_texCoord1",e.ATTR_TEX_COORD2="a_texCoord2",e.ATTR_TEX_COORD3="a_texCoord3",e.ATTR_TEX_COORD4="a_texCoord4",e.ATTR_TEX_COORD5="a_texCoord5",e.ATTR_TEX_COORD6="a_texCoord6",e.ATTR_TEX_COORD7="a_texCoord7",e.ATTR_TEX_COORD8="a_texCoord8",e.ATTR_BATCH_ID="a_batch_id",e.ATTR_BATCH_UV="a_batch_uv"}(Al||(Al=e("aT",{})));var b_=e("aU",Object.freeze([new A_("UNKNOWN",0,0,Bc.NONE,!1,!1,!1,!1),new A_("A8",1,1,Bc.UNORM,!0,!1,!1,!1),new A_("L8",1,1,Bc.UNORM,!1,!1,!1,!1),new A_("LA8",1,2,Bc.UNORM,!0,!1,!1,!1),new A_("R8",1,1,Bc.UNORM,!1,!1,!1,!1),new A_("R8SN",1,1,Bc.SNORM,!1,!1,!1,!1),new A_("R8UI",1,1,Bc.UINT,!1,!1,!1,!1),new A_("R8I",1,1,Bc.INT,!1,!1,!1,!1),new A_("R16F",2,1,Bc.FLOAT,!1,!1,!1,!1),new A_("R16UI",2,1,Bc.UINT,!1,!1,!1,!1),new A_("R16I",2,1,Bc.INT,!1,!1,!1,!1),new A_("R32F",4,1,Bc.FLOAT,!1,!1,!1,!1),new A_("R32UI",4,1,Bc.UINT,!1,!1,!1,!1),new A_("R32I",4,1,Bc.INT,!1,!1,!1,!1),new A_("RG8",2,2,Bc.UNORM,!1,!1,!1,!1),new A_("RG8SN",2,2,Bc.SNORM,!1,!1,!1,!1),new A_("RG8UI",2,2,Bc.UINT,!1,!1,!1,!1),new A_("RG8I",2,2,Bc.INT,!1,!1,!1,!1),new A_("RG16F",4,2,Bc.FLOAT,!1,!1,!1,!1),new A_("RG16UI",4,2,Bc.UINT,!1,!1,!1,!1),new A_("RG16I",4,2,Bc.INT,!1,!1,!1,!1),new A_("RG32F",8,2,Bc.FLOAT,!1,!1,!1,!1),new A_("RG32UI",8,2,Bc.UINT,!1,!1,!1,!1),new A_("RG32I",8,2,Bc.INT,!1,!1,!1,!1),new A_("RGB8",3,3,Bc.UNORM,!1,!1,!1,!1),new A_("SRGB8",3,3,Bc.UNORM,!1,!1,!1,!1),new A_("RGB8SN",3,3,Bc.SNORM,!1,!1,!1,!1),new A_("RGB8UI",3,3,Bc.UINT,!1,!1,!1,!1),new A_("RGB8I",3,3,Bc.INT,!1,!1,!1,!1),new A_("RGB16F",6,3,Bc.FLOAT,!1,!1,!1,!1),new A_("RGB16UI",6,3,Bc.UINT,!1,!1,!1,!1),new A_("RGB16I",6,3,Bc.INT,!1,!1,!1,!1),new A_("RGB32F",12,3,Bc.FLOAT,!1,!1,!1,!1),new A_("RGB32UI",12,3,Bc.UINT,!1,!1,!1,!1),new A_("RGB32I",12,3,Bc.INT,!1,!1,!1,!1),new A_("RGBA8",4,4,Bc.UNORM,!0,!1,!1,!1),new A_("BGRA8",4,4,Bc.UNORM,!0,!1,!1,!1),new A_("SRGB8_A8",4,4,Bc.UNORM,!0,!1,!1,!1),new A_("RGBA8SN",4,4,Bc.SNORM,!0,!1,!1,!1),new A_("RGBA8UI",4,4,Bc.UINT,!0,!1,!1,!1),new A_("RGBA8I",4,4,Bc.INT,!0,!1,!1,!1),new A_("RGBA16F",8,4,Bc.FLOAT,!0,!1,!1,!1),new A_("RGBA16UI",8,4,Bc.UINT,!0,!1,!1,!1),new A_("RGBA16I",8,4,Bc.INT,!0,!1,!1,!1),new A_("RGBA32F",16,4,Bc.FLOAT,!0,!1,!1,!1),new A_("RGBA32UI",16,4,Bc.UINT,!0,!1,!1,!1),new A_("RGBA32I",16,4,Bc.INT,!0,!1,!1,!1),new A_("R5G6B5",2,3,Bc.UNORM,!1,!1,!1,!1),new A_("R11G11B10F",4,3,Bc.FLOAT,!1,!1,!1,!1),new A_("RGB5A1",2,4,Bc.UNORM,!0,!1,!1,!1),new A_("RGBA4",2,4,Bc.UNORM,!0,!1,!1,!1),new A_("RGB10A2",2,4,Bc.UNORM,!0,!1,!1,!1),new A_("RGB10A2UI",2,4,Bc.UINT,!0,!1,!1,!1),new A_("RGB9E5",2,4,Bc.FLOAT,!0,!1,!1,!1),new A_("DEPTH",4,1,Bc.FLOAT,!1,!0,!1,!1),new A_("DEPTH_STENCIL",5,2,Bc.FLOAT,!1,!0,!0,!1),new A_("BC1",1,3,Bc.UNORM,!1,!1,!1,!0),new A_("BC1_ALPHA",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC1_SRGB",1,3,Bc.UNORM,!1,!1,!1,!0),new A_("BC1_SRGB_ALPHA",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC2",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC2_SRGB",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC3",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC3_SRGB",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC4",1,1,Bc.UNORM,!1,!1,!1,!0),new A_("BC4_SNORM",1,1,Bc.SNORM,!1,!1,!1,!0),new A_("BC5",1,2,Bc.UNORM,!1,!1,!1,!0),new A_("BC5_SNORM",1,2,Bc.SNORM,!1,!1,!1,!0),new A_("BC6H_UF16",1,3,Bc.UFLOAT,!1,!1,!1,!0),new A_("BC6H_SF16",1,3,Bc.FLOAT,!1,!1,!1,!0),new A_("BC7",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("BC7_SRGB",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ETC_RGB8",1,3,Bc.UNORM,!1,!1,!1,!0),new A_("ETC2_RGB8",1,3,Bc.UNORM,!1,!1,!1,!0),new A_("ETC2_SRGB8",1,3,Bc.UNORM,!1,!1,!1,!0),new A_("ETC2_RGB8_A1",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ETC2_SRGB8_A1",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ETC2_RGBA8",2,4,Bc.UNORM,!0,!1,!1,!0),new A_("ETC2_SRGB8_A8",2,4,Bc.UNORM,!0,!1,!1,!0),new A_("EAC_R11",1,1,Bc.UNORM,!1,!1,!1,!0),new A_("EAC_R11SN",1,1,Bc.SNORM,!1,!1,!1,!0),new A_("EAC_RG11",2,2,Bc.UNORM,!1,!1,!1,!0),new A_("EAC_RG11SN",2,2,Bc.SNORM,!1,!1,!1,!0),new A_("PVRTC_RGB2",2,3,Bc.UNORM,!1,!1,!1,!0),new A_("PVRTC_RGBA2",2,4,Bc.UNORM,!0,!1,!1,!0),new A_("PVRTC_RGB4",2,3,Bc.UNORM,!1,!1,!1,!0),new A_("PVRTC_RGBA4",2,4,Bc.UNORM,!0,!1,!1,!0),new A_("PVRTC2_2BPP",2,4,Bc.UNORM,!0,!1,!1,!0),new A_("PVRTC2_4BPP",2,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_4x4",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_5x4",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_5x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_6x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_6x6",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_8x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_8x6",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_8x8",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_10x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_10x6",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_10x8",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_10x10",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_12x10",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_RGBA_12x12",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_4x4",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_5x4",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_5x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_6x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_6x6",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_8x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_8x6",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_8x8",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_10x5",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_10x6",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_10x8",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_10x10",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_12x10",1,4,Bc.UNORM,!0,!1,!1,!0),new A_("ASTC_SRGBA_12x12",1,4,Bc.UNORM,!0,!1,!1,!0)])),O_=e("aV",fl.UNIFORM_BUFFER|fl.DYNAMIC_UNIFORM_BUFFER|fl.STORAGE_BUFFER|fl.DYNAMIC_STORAGE_BUFFER),N_=e("aW",fl.SAMPLER_TEXTURE|fl.SAMPLER|fl.TEXTURE|fl.STORAGE_IMAGE|fl.INPUT_ATTACHMENT),C_=e("aX",fl.DYNAMIC_STORAGE_BUFFER|fl.DYNAMIC_UNIFORM_BUFFER),M_=e("aY",28);function P_(e){return e>0&&0==(e&e-1)}function L_(e,t,i,n){if(!b_[e].isCompressed)return t*i*n*b_[e].size;switch(e){case Fc.BC1:case Fc.BC1_ALPHA:case Fc.BC1_SRGB:case Fc.BC1_SRGB_ALPHA:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case Fc.BC2:case Fc.BC2_SRGB:case Fc.BC3:case Fc.BC3_SRGB:case Fc.BC4:case Fc.BC4_SNORM:case Fc.BC6H_SF16:case Fc.BC6H_UF16:case Fc.BC7:case Fc.BC7_SRGB:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case Fc.BC5:case Fc.BC5_SNORM:return Math.ceil(t/4)*Math.ceil(i/4)*32*n;case Fc.ETC_RGB8:case Fc.ETC2_RGB8:case Fc.ETC2_SRGB8:case Fc.ETC2_RGB8_A1:case Fc.EAC_R11:case Fc.EAC_R11SN:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case Fc.ETC2_RGBA8:case Fc.ETC2_SRGB8_A1:case Fc.EAC_RG11:case Fc.EAC_RG11SN:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case Fc.PVRTC_RGB2:case Fc.PVRTC_RGBA2:case Fc.PVRTC2_2BPP:return Math.ceil(t/8)*Math.ceil(i/4)*8*n;case Fc.PVRTC_RGB4:case Fc.PVRTC_RGBA4:case Fc.PVRTC2_4BPP:return Math.ceil(t/4)*Math.ceil(i/4)*8*n;case Fc.ASTC_RGBA_4X4:case Fc.ASTC_SRGBA_4X4:return Math.ceil(t/4)*Math.ceil(i/4)*16*n;case Fc.ASTC_RGBA_5X4:case Fc.ASTC_SRGBA_5X4:return Math.ceil(t/5)*Math.ceil(i/4)*16*n;case Fc.ASTC_RGBA_5X5:case Fc.ASTC_SRGBA_5X5:return Math.ceil(t/5)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_6X5:case Fc.ASTC_SRGBA_6X5:return Math.ceil(t/6)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_6X6:case Fc.ASTC_SRGBA_6X6:return Math.ceil(t/6)*Math.ceil(i/6)*16*n;case Fc.ASTC_RGBA_8X5:case Fc.ASTC_SRGBA_8X5:return Math.ceil(t/8)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_8X6:case Fc.ASTC_SRGBA_8X6:return Math.ceil(t/8)*Math.ceil(i/6)*16*n;case Fc.ASTC_RGBA_8X8:case Fc.ASTC_SRGBA_8X8:return Math.ceil(t/8)*Math.ceil(i/8)*16*n;case Fc.ASTC_RGBA_10X5:case Fc.ASTC_SRGBA_10X5:return Math.ceil(t/10)*Math.ceil(i/5)*16*n;case Fc.ASTC_RGBA_10X6:case Fc.ASTC_SRGBA_10X6:return Math.ceil(t/10)*Math.ceil(i/6)*16*n;case Fc.ASTC_RGBA_10X8:case Fc.ASTC_SRGBA_10X8:return Math.ceil(t/10)*Math.ceil(i/8)*16*n;case Fc.ASTC_RGBA_10X10:case Fc.ASTC_SRGBA_10X10:return Math.ceil(t/10)*Math.ceil(i/10)*16*n;case Fc.ASTC_RGBA_12X10:case Fc.ASTC_SRGBA_12X10:return Math.ceil(t/12)*Math.ceil(i/10)*16*n;case Fc.ASTC_RGBA_12X12:case Fc.ASTC_SRGBA_12X12:return Math.ceil(t/12)*Math.ceil(i/12)*16*n;default:return 0}}function x_(e,t,i,n,r){for(var s=0,a=0;a<r;++a)s+=L_(e,t,i,n),t=Math.max(t>>1,1),i=Math.max(i>>1,1);return s}var D_=[0,4,8,12,16,4,8,12,16,4,8,12,16,4,8,12,16,16,24,32,24,36,48,32,48,64,4,4,4,4,4,4];function F_(e){return D_[e]||0}function B_(e){if(e.isCompressed)return Uint8Array;var t=e.size/e.count;switch(e.type){case Bc.UNORM:case Bc.UINT:switch(t){case 1:return Uint8Array;case 2:return Uint16Array;case 4:return Uint32Array;default:return Uint8Array}case Bc.SNORM:case Bc.INT:switch(t){case 1:return Int8Array;case 2:return Int16Array;case 4:return Int32Array;default:return Int8Array}case Bc.FLOAT:return Float32Array}return Float32Array}function U_(e){switch(e){case Fc.BC1:case Fc.BC1_ALPHA:case Fc.BC1_SRGB:case Fc.BC1_SRGB_ALPHA:case Fc.BC2:case Fc.BC2_SRGB:case Fc.BC3:case Fc.BC3_SRGB:case Fc.BC4:case Fc.BC4_SNORM:case Fc.BC6H_SF16:case Fc.BC6H_UF16:case Fc.BC7:case Fc.BC7_SRGB:case Fc.BC5:case Fc.BC5_SNORM:case Fc.ETC_RGB8:case Fc.ETC2_RGB8:case Fc.ETC2_SRGB8:case Fc.ETC2_RGB8_A1:case Fc.EAC_R11:case Fc.EAC_R11SN:case Fc.ETC2_RGBA8:case Fc.ETC2_SRGB8_A1:case Fc.EAC_RG11:case Fc.EAC_RG11SN:return{width:4,height:4};case Fc.PVRTC_RGB2:case Fc.PVRTC_RGBA2:case Fc.PVRTC2_2BPP:return{width:8,height:4};case Fc.PVRTC_RGB4:case Fc.PVRTC_RGBA4:case Fc.PVRTC2_4BPP:return{width:4,height:4};case Fc.ASTC_RGBA_4X4:case Fc.ASTC_SRGBA_4X4:return{width:4,height:4};case Fc.ASTC_RGBA_5X4:case Fc.ASTC_SRGBA_5X4:return{width:5,height:4};case Fc.ASTC_RGBA_5X5:case Fc.ASTC_SRGBA_5X5:return{width:5,height:5};case Fc.ASTC_RGBA_6X5:case Fc.ASTC_SRGBA_6X5:return{width:6,height:5};case Fc.ASTC_RGBA_6X6:case Fc.ASTC_SRGBA_6X6:return{width:6,height:6};case Fc.ASTC_RGBA_8X5:case Fc.ASTC_SRGBA_8X5:return{width:8,height:5};case Fc.ASTC_RGBA_8X6:case Fc.ASTC_SRGBA_8X6:return{width:8,height:6};case Fc.ASTC_RGBA_8X8:case Fc.ASTC_SRGBA_8X8:return{width:8,height:8};case Fc.ASTC_RGBA_10X5:case Fc.ASTC_SRGBA_10X5:return{width:10,height:5};case Fc.ASTC_RGBA_10X6:case Fc.ASTC_SRGBA_10X6:return{width:10,height:6};case Fc.ASTC_RGBA_10X8:case Fc.ASTC_SRGBA_10X8:return{width:10,height:8};case Fc.ASTC_RGBA_10X10:case Fc.ASTC_SRGBA_10X10:return{width:10,height:10};case Fc.ASTC_RGBA_12X10:case Fc.ASTC_SRGBA_12X10:return{width:12,height:10};case Fc.ASTC_RGBA_12X12:case Fc.ASTC_SRGBA_12X12:return{width:12,height:12};default:return{width:1,height:1}}}function G_(e,t){return Math.ceil(e/t)*t}var k_=Object.freeze({__proto__:null,get ObjectType(){return Mc},get Status(){return Pc},get API(){return Lc},get SurfaceTransform(){return xc},get Feature(){return Dc},get Format(){return Fc},get FormatType(){return Bc},get Type(){return Uc},get BufferUsageBit(){return Gc},get BufferFlagBit(){return kc},get MemoryAccessBit(){return Hc},get MemoryUsageBit(){return zc},get TextureType(){return Vc},get TextureUsageBit(){return Wc},get TextureFlagBit(){return jc},get FormatFeatureBit(){return Xc},get SampleCount(){return Kc},get VsyncMode(){return Yc},get Filter(){return qc},get Address(){return Qc},get ComparisonFunc(){return Zc},get StencilOp(){return Jc},get BlendFactor(){return $c},get BlendOp(){return el},get ColorMask(){return tl},get ShaderStageFlagBit(){return il},get LoadOp(){return nl},get StoreOp(){return rl},get AccessFlagBit(){return sl},get ResolveMode(){return al},get PipelineBindPoint(){return ol},get PrimitiveMode(){return ul},get PolygonMode(){return hl},get ShadeModel(){return cl},get CullMode(){return ll},get DynamicStateFlagBit(){return _l},get StencilFace(){return dl},get DescriptorType(){return fl},get QueueType(){return pl},get QueryType(){return ml},get CommandBufferType(){return gl},get ClearFlagBit(){return vl},get BarrierType(){return yl},get PassType(){return El},Size:Sl,DeviceCaps:Rl,DeviceOptions:wl,Offset:Il,Rect:bl,Extent:Ol,TextureSubresLayers:Nl,TextureSubresRange:Cl,TextureCopy:Ml,TextureBlit:Pl,BufferTextureCopy:Ll,Viewport:xl,Color:Dl,BindingMappingInfo:Fl,SwapchainInfo:Bl,DeviceInfo:Ul,BufferInfo:Gl,BufferViewInfo:kl,DrawInfo:Hl,DispatchInfo:zl,IndirectBuffer:Vl,TextureInfo:Wl,TextureViewInfo:jl,SamplerInfo:Xl,Uniform:Kl,UniformBlock:Yl,UniformSamplerTexture:ql,UniformSampler:Ql,UniformTexture:Zl,UniformStorageImage:Jl,UniformStorageBuffer:$l,UniformInputAttachment:e_,ShaderStage:t_,Attribute:i_,ShaderInfo:n_,InputAssemblerInfo:r_,ColorAttachment:s_,DepthStencilAttachment:a_,SubpassInfo:o_,SubpassDependency:u_,RenderPassInfo:h_,GeneralBarrierInfo:c_,TextureBarrierInfo:l_,BufferBarrierInfo:__,FramebufferInfo:d_,DescriptorSetLayoutBinding:f_,DescriptorSetLayoutInfo:p_,DescriptorSetInfo:m_,PipelineLayoutInfo:g_,InputState:v_,CommandBufferInfo:y_,QueueInfo:E_,QueryPoolInfo:T_,FormatInfo:A_,MemoryStatus:S_,DynamicStencilStates:R_,DynamicStates:w_,GFXObject:I_,get AttributeName(){return Al},FormatInfos:b_,DESCRIPTOR_BUFFER_TYPE:O_,DESCRIPTOR_SAMPLER_TYPE:N_,DESCRIPTOR_DYNAMIC_TYPE:C_,DRAW_INFO_SIZE:M_,IsPowerOf2:P_,FormatSize:L_,FormatSurfaceSize:x_,GetTypeSize:F_,getTypedArrayConstructor:B_,formatAlignment:U_,alignTo:G_}),H_=e("B",function(e){function t(){var t;return(t=e.call(this,Mc.BUFFER)||this)._usage=Gc.NONE,t._memUsage=zc.NONE,t._size=0,t._stride=1,t._count=0,t._flags=kc.NONE,t._isBufferView=!1,t}return s(t,e),n(t,[{key:"usage",get:function(){return this._usage}},{key:"memUsage",get:function(){return this._memUsage}},{key:"size",get:function(){return this._size}},{key:"stride",get:function(){return this._stride}},{key:"count",get:function(){return this._count}},{key:"flags",get:function(){return this._flags}}]),t}(I_)),z_=e("b",function(e){function t(){var t;return(t=e.call(this,Mc.COMMAND_BUFFER)||this)._queue=null,t._type=gl.PRIMARY,t._numDrawCalls=0,t._numInstances=0,t._numTris=0,t}return s(t,e),n(t,[{key:"type",get:function(){return this._type}},{key:"queue",get:function(){return this._queue}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}}]),t}(I_)),V_=e("b4",function(){function e(){this._gfxAPI=Lc.UNKNOWN,this._renderer="",this._vendor="",this._features=new Array(Dc.COUNT),this._formatFeatures=new Array(Fc.COUNT),this._queue=null,this._cmdBuff=null,this._numDrawCalls=0,this._numInstances=0,this._numTris=0,this._memoryStatus=new S_,this._caps=new Rl,this._bindingMappingInfo=new Fl,this._samplers=new Map,this._generalBarrierss=new Map,this._textureBarriers=new Map,this._bufferBarriers=new Map}var t=e.prototype;return t.hasFeature=function(e){return this._features[e]},t.getFormatFeatures=function(e){return this._formatFeatures[e]},n(e,[{key:"gfxAPI",get:function(){return this._gfxAPI}},{key:"queue",get:function(){return this._queue}},{key:"commandBuffer",get:function(){return this._cmdBuff}},{key:"renderer",get:function(){return this._renderer}},{key:"vendor",get:function(){return this._vendor}},{key:"numDrawCalls",get:function(){return this._numDrawCalls}},{key:"numInstances",get:function(){return this._numInstances}},{key:"numTris",get:function(){return this._numTris}},{key:"memoryStatus",get:function(){return this._memoryStatus}},{key:"capabilities",get:function(){return this._caps}},{key:"bindingMappingInfo",get:function(){return this._bindingMappingInfo}}]),e}());V_.canvas=void 0,e("b5",function(){function e(e){this._texture2D=null,this._texture3D=null,this._textureCube=null,this._texture2DArray=null;var t=new Uint8Array(64);if(t.fill(255),e.capabilities.maxTextureSize>=2){this._texture2D=e.createTexture(new Wl(Vc.TEX2D,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE));var i=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,1));e.copyBuffersToTexture([t],this._texture2D,[i])}if(e.capabilities.maxTextureSize>=2){this._textureCube=e.createTexture(new Wl(Vc.CUBE,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE,6));var n=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,1));e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=1,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=2,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=3,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=4,e.copyBuffersToTexture([t],this._textureCube,[n]),n.texSubres.baseArrayLayer=5,e.copyBuffersToTexture([t],this._textureCube,[n])}if(e.capabilities.max3DTextureSize>=2){this._texture3D=e.createTexture(new Wl(Vc.TEX3D,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE,1,1,Kc.ONE,2));var r=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,2),new Nl(0,0,1));e.copyBuffersToTexture([t],this._texture3D,[r])}if(e.capabilities.maxArrayTextureLayers>=2){this._texture2DArray=e.createTexture(new Wl(Vc.TEX2D_ARRAY,Wc.STORAGE|Wc.SAMPLED,Fc.RGBA8,2,2,jc.NONE,2));var s=new Ll(0,0,0,new Il(0,0,0),new Ol(2,2,1),new Nl(0,0,1));e.copyBuffersToTexture([t],this._texture2DArray,[s]),s.texSubres.baseArrayLayer=1,e.copyBuffersToTexture([t],this._texture2DArray,[s])}}return e.prototype.getTexture=function(e){switch(e){case Vc.TEX2D:return this._texture2D;case Vc.TEX3D:return this._texture3D;case Vc.CUBE:return this._textureCube;case Vc.TEX2D_ARRAY:return this._texture2DArray;default:return null}},e}());var W_=e("b6",function(e){function t(){var t;return(t=e.call(this,Mc.SWAPCHAIN)||this)._transform=xc.IDENTITY,t._colorTexture=null,t._depthStencilTexture=null,t}return s(t,e),n(t,[{key:"colorTexture",get:function(){return this._colorTexture}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}},{key:"surfaceTransform",get:function(){return this._transform}},{key:"width",get:function(){return this._colorTexture.width}},{key:"height",get:function(){return this._colorTexture.height}}]),t}(I_)),j_=e("b7",function(e){function t(){var t;return(t=e.call(this,Mc.FRAMEBUFFER)||this)._renderPass=null,t._colorTextures=[],t._depthStencilTexture=null,t}return s(t,e),n(t,[{key:"renderPass",get:function(){return this._renderPass}},{key:"colorTextures",get:function(){return this._colorTextures}},{key:"depthStencilTexture",get:function(){return this._depthStencilTexture}}]),t}(I_)),X_=e("b8",function(e){function t(){var t;return(t=e.call(this,Mc.INPUT_ASSEMBLER)||this)._attributes=[],t._attributesHash=0,t._vertexBuffers=[],t._indexBuffer=null,t._indirectBuffer=null,t._drawInfo=new Hl,t}s(t,e);var i=t.prototype;return i.getVertexBuffer=function(e){return void 0===e&&(e=0),e<this._vertexBuffers.length?this._vertexBuffers[e]:null},i.computeAttributesHash=function(){for(var e="attrs",t=0;t<this.attributes.length;++t){var i=this.attributes[t];e+=","+i.name+","+i.format+","+i.isNormalized+","+i.stream+","+i.isInstanced+","+i.location}return Rc(e,666)},n(t,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"attributesHash",get:function(){return this._attributesHash}},{key:"vertexCount",get:function(){return this._drawInfo.vertexCount},set:function(e){this._drawInfo.vertexCount=e}},{key:"firstVertex",get:function(){return this._drawInfo.firstVertex},set:function(e){this._drawInfo.firstVertex=e}},{key:"indexCount",get:function(){return this._drawInfo.indexCount},set:function(e){this._drawInfo.indexCount=e}},{key:"firstIndex",get:function(){return this._drawInfo.firstIndex},set:function(e){this._drawInfo.firstIndex=e}},{key:"vertexOffset",get:function(){return this._drawInfo.vertexOffset},set:function(e){this._drawInfo.vertexOffset=e}},{key:"instanceCount",get:function(){return this._drawInfo.instanceCount},set:function(e){this._drawInfo.instanceCount=e}},{key:"firstInstance",get:function(){return this._drawInfo.firstInstance},set:function(e){this._drawInfo.firstInstance=e}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(e){this._drawInfo=e}}]),t}(I_)),K_=e("D",function(e){function t(){var t;return(t=e.call(this,Mc.DESCRIPTOR_SET)||this)._layout=null,t._buffers=[],t._textures=[],t._samplers=[],t._isDirty=!1,t}s(t,e);var i=t.prototype;return i.bindBuffer=function(e,t,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[e],r=this._layout.bindings[n];if(r&&r.descriptorType&O_){var s=this._layout.descriptorIndices[e];this._buffers[s+i]!==t&&(this._buffers[s+i]=t,this._isDirty=!0)}},i.bindSampler=function(e,t,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[e],r=this._layout.bindings[n];if(r&&r.descriptorType&N_){var s=this._layout.descriptorIndices[e];this._samplers[s+i]!==t&&(this._samplers[s+i]=t,this._isDirty=!0)}},i.bindTexture=function(e,t,i){void 0===i&&(i=0);var n=this._layout.bindingIndices[e],r=this._layout.bindings[n];if(r&&r.descriptorType&N_){var s=this._layout.descriptorIndices[e];this._textures[s+i]!==t&&(this._textures[s+i]=t,this._isDirty=!0)}},i.getBuffer=function(e,t){void 0===t&&(t=0);var i=this._layout.descriptorIndices[e];return this._buffers[i+t]},i.getSampler=function(e,t){void 0===t&&(t=0);var i=this._layout.descriptorIndices[e];return this._samplers[i+t]},i.getTexture=function(e,t){void 0===t&&(t=0);var i=this._layout.descriptorIndices[e];return this._textures[i+t]},n(t,[{key:"layout",get:function(){return this._layout}}]),t}(I_)),Y_=e("b9",function(e){function t(){var t;return(t=e.call(this,Mc.DESCRIPTOR_SET_LAYOUT)||this)._bindings=[],t._bindingIndices=[],t._descriptorIndices=[],t}return s(t,e),n(t,[{key:"bindings",get:function(){return this._bindings}},{key:"bindingIndices",get:function(){return this._bindingIndices}},{key:"descriptorIndices",get:function(){return this._descriptorIndices}}]),t}(I_)),q_=e("ba",function(e){function t(){var t;return(t=e.call(this,Mc.PIPELINE_LAYOUT)||this)._setLayouts=[],t}return s(t,e),n(t,[{key:"setLayouts",get:function(){return this._setLayouts}}]),t}(I_)),Q_=e("bb",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l){void 0===e&&(e=!1),void 0===t&&(t=hl.FILL),void 0===i&&(i=cl.GOURAND),void 0===n&&(n=ll.BACK),void 0===r&&(r=!0),void 0===s&&(s=!1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=!0),void 0===c&&(c=!1),void 0===l&&(l=1),this.isDiscard=e,this.polygonMode=t,this.shadeModel=i,this.cullMode=n,this.isFrontFaceCCW=r,this.depthBiasEnabled=s,this.depthBias=a,this.depthBiasClamp=o,this.depthBiasSlop=u,this.isDepthClip=h,this.isMultisample=c,this.lineWidth=l}var t=e.prototype;return t.reset=function(){this.isDiscard=!1,this.polygonMode=hl.FILL,this.shadeModel=cl.GOURAND,this.cullMode=ll.BACK,this.isFrontFaceCCW=!0,this.depthBiasEnabled=!1,this.depthBias=0,this.depthBiasClamp=0,this.depthBiasSlop=0,this.isDepthClip=!0,this.isMultisample=!1,this.lineWidth=1},t.assign=function(e){Object.assign(this,e)},t.destroy=function(){},n(e,[{key:"native",get:function(){return this}}]),e}()),Z_=e("bc",function(){function e(e,t,i,n,r,s,a,o,u,h,c,l,_,d,f,p,m,g,v){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=Zc.LESS),void 0===n&&(n=!1),void 0===r&&(r=Zc.ALWAYS),void 0===s&&(s=65535),void 0===a&&(a=65535),void 0===o&&(o=Jc.KEEP),void 0===u&&(u=Jc.KEEP),void 0===h&&(h=Jc.KEEP),void 0===c&&(c=1),void 0===l&&(l=!1),void 0===_&&(_=Zc.ALWAYS),void 0===d&&(d=65535),void 0===f&&(f=65535),void 0===p&&(p=Jc.KEEP),void 0===m&&(m=Jc.KEEP),void 0===g&&(g=Jc.KEEP),void 0===v&&(v=1),this.depthTest=e,this.depthWrite=t,this.depthFunc=i,this.stencilTestFront=n,this.stencilFuncFront=r,this.stencilReadMaskFront=s,this.stencilWriteMaskFront=a,this.stencilFailOpFront=o,this.stencilZFailOpFront=u,this.stencilPassOpFront=h,this.stencilRefFront=c,this.stencilTestBack=l,this.stencilFuncBack=_,this.stencilReadMaskBack=d,this.stencilWriteMaskBack=f,this.stencilFailOpBack=p,this.stencilZFailOpBack=m,this.stencilPassOpBack=g,this.stencilRefBack=v}var t=e.prototype;return t.reset=function(){this.depthTest=!0,this.depthWrite=!0,this.depthFunc=Zc.LESS,this.stencilTestFront=!1,this.stencilFuncFront=Zc.ALWAYS,this.stencilReadMaskFront=65535,this.stencilWriteMaskFront=65535,this.stencilFailOpFront=Jc.KEEP,this.stencilZFailOpFront=Jc.KEEP,this.stencilPassOpFront=Jc.KEEP,this.stencilRefFront=1,this.stencilTestBack=!1,this.stencilFuncBack=Zc.ALWAYS,this.stencilReadMaskBack=65535,this.stencilWriteMaskBack=65535,this.stencilFailOpBack=Jc.KEEP,this.stencilZFailOpBack=Jc.KEEP,this.stencilPassOpBack=Jc.KEEP,this.stencilRefBack=1},t.assign=function(e){Object.assign(this,e)},t.destroy=function(){},n(e,[{key:"native",get:function(){return this}}]),e}()),J_=e("bd",function(){function e(e,t,i,n,r,s,a,o){void 0===e&&(e=!1),void 0===t&&(t=$c.ONE),void 0===i&&(i=$c.ZERO),void 0===n&&(n=el.ADD),void 0===r&&(r=$c.ONE),void 0===s&&(s=$c.ZERO),void 0===a&&(a=el.ADD),void 0===o&&(o=tl.ALL),this.blend=e,this.blendSrc=t,this.blendDst=i,this.blendEq=n,this.blendSrcAlpha=r,this.blendDstAlpha=s,this.blendAlphaEq=a,this.blendColorMask=o}var t=e.prototype;return t.reset=function(){this.blend=!1,this.blendSrc=$c.ONE,this.blendDst=$c.ZERO,this.blendEq=el.ADD,this.blendSrcAlpha=$c.ONE,this.blendDstAlpha=$c.ZERO,this.blendAlphaEq=el.ADD,this.blendColorMask=tl.ALL},t.assign=function(e){Object.assign(this,e)},t.destroy=function(){},e}()),$_=e("be",function(){function e(e,t,i,n){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=new Dl),void 0===n&&(n=[new J_]),this.isA2C=e,this.isIndepend=t,this.blendColor=i,this.targets=n}var t=e.prototype;return t.setTarget=function(e,t){var i=this.targets[e];i||(i=this.targets[e]=new J_),Object.assign(i,t)},t.reset=function(){this.isA2C=!1,this.isIndepend=!1,this.blendColor.x=0,this.blendColor.y=0,this.blendColor.z=0,this.blendColor.w=0,this.targets.length=1,this.targets[0].reset()},t.destroy=function(){},n(e,[{key:"native",get:function(){return this}}]),e}()),ed=e("bf",(function(e,t,i,n,r,s,a,o,u,h){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=new v_),void 0===r&&(r=new Q_),void 0===s&&(s=new Z_),void 0===a&&(a=new $_),void 0===o&&(o=ul.TRIANGLE_LIST),void 0===u&&(u=_l.NONE),void 0===h&&(h=ol.GRAPHICS),this.shader=e,this.pipelineLayout=t,this.renderPass=i,this.inputState=n,this.rasterizerState=r,this.depthStencilState=s,this.blendState=a,this.primitive=o,this.dynamicStates=u,this.bindPoint=h})),td=e("bg",function(e){function t(){var t;return(t=e.call(this,Mc.PIPELINE_STATE)||this)._shader=null,t._pipelineLayout=null,t._primitive=ul.TRIANGLE_LIST,t._is=null,t._rs=new Q_,t._dss=new Z_,t._bs=new $_,t._dynamicStates=_l.NONE,t._renderPass=null,t}return s(t,e),n(t,[{key:"shader",get:function(){return this._shader}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}},{key:"primitive",get:function(){return this._primitive}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"inputState",get:function(){return this._is}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"renderPass",get:function(){return this._renderPass}}]),t}(I_)),id=e("bh",function(e){function t(){var t;return(t=e.call(this,Mc.QUEUE)||this)._type=pl.GRAPHICS,t}return s(t,e),n(t,[{key:"type",get:function(){return this._type}}]),t}(I_)),nd=e("bi",function(e){function t(){var t;return(t=e.call(this,Mc.RENDER_PASS)||this)._colorInfos=[],t._depthStencilInfo=null,t._subpasses=[],t._hash=0,t}return s(t,e),t.prototype.computeHash=function(){var e="";if(this._subpasses.length)for(var t=0;t<this._subpasses.length;++t){var i=this._subpasses[t];if(i.inputs.length){e+="ia";for(var n=0;n<i.inputs.length;++n){var r=this._colorInfos[i.inputs[n]];e+=","+r.format+","+r.sampleCount}}if(i.colors.length){e+="ca";for(var s=0;s<i.inputs.length;++s){var a=this._colorInfos[i.inputs[s]];e+=","+a.format+","+a.sampleCount}}if(i.depthStencil>=0){var o=this._colorInfos[i.depthStencil];e+="ds,"+o.format+","+o.sampleCount}}else{e+="ca";for(var u=0;u<this._colorInfos.length;++u){var h=this._colorInfos[u];e+=","+h.format+","+h.sampleCount}var c=this._depthStencilInfo;c&&(e+="ds,"+c.format+","+c.sampleCount)}return Rc(e,666)},n(t,[{key:"colorAttachments",get:function(){return this._colorInfos}},{key:"depthStencilAttachment",get:function(){return this._depthStencilInfo}},{key:"subPasses",get:function(){return this._subpasses}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),rd=e("bj",function(e){function t(t,i){var n;return(n=e.call(this,Mc.SAMPLER)||this)._info=new Xl,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){var t=e.minFilter;return t|=e.magFilter<<2,t|=e.mipFilter<<4,t|=e.addressU<<6,t|=e.addressV<<8,t|=e.addressW<<10,(t|=e.maxAnisotropy<<12)|e.cmpFunc<<16},t.unpackFromHash=function(e){var t=new Xl;return t.minFilter=(3&e)>>0,t.magFilter=(3&e)>>2,t.mipFilter=(3&e)>>4,t.addressU=(3&e)>>6,t.addressV=(3&e)>>8,t.addressW=(3&e)>>10,t.maxAnisotropy=(15&e)>>12,t.cmpFunc=(7&e)>>16,t},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),sd=e("bk",function(e){function t(){var t;return(t=e.call(this,Mc.SHADER)||this)._name="",t._stages=[],t._attributes=[],t._blocks=[],t._samplers=[],t}return s(t,e),n(t,[{key:"name",get:function(){return this._name}},{key:"attributes",get:function(){return this._attributes}},{key:"blocks",get:function(){return this._blocks}},{key:"samplers",get:function(){return this._samplers}}]),t}(I_)),ad=e("bl",function(e){function t(){var t;return(t=e.call(this,Mc.TEXTURE)||this)._info=new Wl,t._viewInfo=new jl,t._isPowerOf2=!1,t._isTextureView=!1,t._size=0,t}return s(t,e),t.getLevelCount=function(e,t){return Math.floor(Math.log2(Math.max(e,t)))},n(t,[{key:"type",get:function(){return this._info.type}},{key:"usage",get:function(){return this._info.usage}},{key:"format",get:function(){return this._info.format}},{key:"width",get:function(){return this._info.width}},{key:"height",get:function(){return this._info.height}},{key:"depth",get:function(){return this._info.depth}},{key:"layerCount",get:function(){return this._info.layerCount}},{key:"levelCount",get:function(){return this._info.levelCount}},{key:"samples",get:function(){return this._info.samples}},{key:"flags",get:function(){return this._info.flags}},{key:"size",get:function(){return this._size}},{key:"info",get:function(){return this._info}},{key:"viewInfo",get:function(){return this._viewInfo}},{key:"isTextureView",get:function(){return this._isTextureView}}]),t}(I_)),od=e("bm",function(e){function t(t,i){var n;return(n=e.call(this,Mc.GLOBAL_BARRIER)||this)._info=new c_,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){return Rc(e.prevAccesses+" "+e.nextAccesses+" "+e.type,666)},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),ud=e("bn",function(e){function t(t,i){var n;return(n=e.call(this,Mc.TEXTURE_BARRIER)||this)._info=new l_,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){var t=e.prevAccesses+" "+e.nextAccesses;return t+=e.type,t+=e.baseMipLevel,t+=e.levelCount,t+=e.baseSlice,t+=e.sliceCount,t+=e.discardContents,t+=e.srcQueue?e.srcQueue.type:0,Rc(t+=e.dstQueue?e.dstQueue.type:0,666)},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),hd=e("fa",function(e){function t(t,i){var n;return(n=e.call(this,Mc.BUFFER_BARRIER)||this)._info=new __,n._hash=0,n._info.copy(t),n._hash=i,n}return s(t,e),t.computeHash=function(e){var t=e.prevAccesses+" "+e.nextAccesses;return t+=e.type,t+=e.offset,t+=e.size,t+=e.discardContents,t+=e.srcQueue?e.srcQueue.type:0,Rc(t+=e.dstQueue?e.dstQueue.type:0,666)},n(t,[{key:"info",get:function(){return this._info}},{key:"hash",get:function(){return this._hash}}]),t}(I_)),cd={Device:V_,Swapchain:W_,Buffer:H_,Texture:ad,Sampler:rd,Shader:sd,InputAssembler:X_,RenderPass:nd,Framebuffer:j_,DescriptorSet:K_,DescriptorSetLayout:Y_,PipelineLayout:q_,PipelineState:td,CommandBuffer:z_,Queue:id,GeneralBarrier:od,TextureBarrier:ud,BufferBarrier:hd,RasterizerState:Q_,BlendState:$_,BlendTarget:J_,DepthStencilState:Z_,PipelineStateInfo:ed};Object.assign(cd,k_),v.gfx=cd;var ld,_d,dd={GFXDevice:!0,GFXBuffer:!0,GFXTexture:!0,GFXSampler:!0,GFXShader:!0,GFXInputAssembler:!0,GFXRenderPass:!0,GFXFramebuffer:!0,GFXPipelineState:!0,GFXCommandBuffer:!0,GFXQueue:!0,GFXObjectType:!0,GFXObject:!1,GFXAttributeName:!0,GFXType:!0,GFXFormat:!0,GFXBufferUsageBit:!0,GFXMemoryUsageBit:!0,GFXBufferFlagBit:!0,GFXBufferAccessBit:"MemoryAccessBit",GFXPrimitiveMode:!0,GFXPolygonMode:!0,GFXShadeModel:!0,GFXCullMode:!0,GFXComparisonFunc:!0,GFXStencilOp:!0,GFXBlendOp:!0,GFXBlendFactor:!0,GFXColorMask:!0,GFXFilter:!0,GFXAddress:!0,GFXTextureType:!0,GFXTextureUsageBit:!0,GFXSampleCount:!0,GFXTextureFlagBit:!0,GFXShaderStageFlagBit:!0,GFXDescriptorType:!0,GFXCommandBufferType:!0,GFXLoadOp:!0,GFXStoreOp:!0,GFXPipelineBindPoint:!0,GFXDynamicStateFlagBit:!0,GFXStencilFace:!0,GFXQueueType:!0,GFXRect:!0,GFXViewport:!0,GFXColor:!0,GFXClearFlag:!0,GFXOffset:!0,GFXExtent:!0,GFXTextureSubres:"TextureSubresLayers",GFXTextureCopy:!0,GFXBufferTextureCopy:!0,GFXFormatType:!0,GFXFormatInfo:!0,GFXMemoryStatus:!0,GFXFormatInfos:!0,GFXFormatSize:!0,GFXFormatSurfaceSize:!0,GFXGetTypeSize:!0,getTypedArrayConstructor:!1};for(var fd in dd){var pd=dd[fd];!0===pd?pd=fd.slice(3):!1===pd&&(pd=fd),re(v,"cc",[{name:fd,newName:pd,target:v.gfx,targetName:"cc.gfx"}])}se(v,"cc",[{name:"GFX_MAX_VERTEX_ATTRIBUTES"},{name:"GFX_MAX_TEXTURE_UNITS"},{name:"GFX_MAX_ATTACHMENTS"},{name:"GFX_MAX_BUFFER_BINDINGS"},{name:"GFXTextureLayout"}]),se(Dc,"Feature",[{name:"COLOR_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.RENDER_TARGET;"},{name:"COLOR_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.RENDER_TARGET;"},{name:"TEXTURE_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R32F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_HALF_FLOAT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = (device.getFormatFeatures(Format.R16F) & (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE)) === (FormatFeatureBit.RENDER_TARGET | FormatFeatureBit.SAMPLED_TEXTURE);"},{name:"TEXTURE_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R32F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"TEXTURE_HALF_FLOAT_LINEAR",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R16F) & FormatFeatureBit.LINEAR_FILTER;"},{name:"FORMAT_R11G11B10F",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.R11G11B10F) !== FormatFeatureBit.NONE;"},{name:"FORMAT_SRGB",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.SRGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC1",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ETC2",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ETC2_RGB8) !== FormatFeatureBit.NONE;"},{name:"FORMAT_DXT",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.BC1) !== FormatFeatureBit.NONE;"},{name:"FORMAT_PVRTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.PVRTC_RGB2) !== FormatFeatureBit.NONE;"},{name:"FORMAT_ASTC",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.ASTC_RGBA_4x4) !== FormatFeatureBit.NONE;"},{name:"FORMAT_RGB8",suggest:"Please use device.getFormatFeatures() instead, like: \nlet isSupported = device.getFormatFeatures(Format.RGB8) !== FormatFeatureBit.NONE;"}]),se(s_.prototype,"ColorAttachment",[{name:"beginAccesses",suggest:"Please assign to ColorAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to ColorAttachment.barrier instead"}]),se(a_.prototype,"DepthStencilAttachment",[{name:"beginAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"},{name:"endAccesses",suggest:"Please assign to DepthStencilAttachment.barrier instead"}]),re(V_.prototype,"Device",[{name:"getGlobalBarrier",newName:"getGeneralBarrier"}]),function(e){e[e.AUTO=0]="AUTO",e[e.CANVAS=1]="CANVAS",e[e.WEBGL=2]="WEBGL",e[e.HEADLESS=3]="HEADLESS"}(ld||(ld=e("bo",{}))),function(e){e[e.UNKNOWN=-1]="UNKNOWN",e[e.CANVAS=0]="CANVAS",e[e.WEBGL=1]="WEBGL",e[e.OPENGL=2]="OPENGL",e[e.HEADLESS=3]="HEADLESS"}(_d||(_d=e("bp",{})));var md=e("bq",function(){function e(){this.initialized=!1,this._canvas=null,this._renderType=_d.UNKNOWN}var t=e.prototype;return t.init=function(e,t){if(!this.initialized){var i=St.querySettings(At.Category.RENDERING,"renderMode");if(this._canvas=e,this._renderType=this._determineRenderType(i),this._renderType===_d.WEBGL){var n=new Ul(t),r=!!globalThis.WebGL2RenderingContext,s=globalThis.navigator.userAgent.toLowerCase();(-1!==s.indexOf("safari")&&-1===s.indexOf("chrome")||Ec.browserType===Hh.UC)&&(r=!1);var a=[];r&&v.WebGL2Device&&a.push(v.WebGL2Device),v.WebGLDevice&&a.push(v.WebGLDevice),v.EmptyDevice&&a.push(v.EmptyDevice),V_.canvas=e;for(var o=0;o<a.length&&(this._gfxDevice=new a[o],!this._gfxDevice.initialize(n));o++);this._initSwapchain()}else this._renderType===_d.HEADLESS&&v.EmptyDevice&&(this._gfxDevice=new v.EmptyDevice,this._gfxDevice.initialize(new Ul(t)),this._initSwapchain());if(!this._gfxDevice)return k("can not support canvas rendering in 3D"),void(this._renderType=_d.UNKNOWN);this._canvas&&(this._canvas.oncontextmenu=function(){return!1})}},t._initSwapchain=function(){var e=new Bl(1,this._canvas),t=yc.windowSize;e.width=t.width,e.height=t.height,this._swapchain=this._gfxDevice.createSwapchain(e)},t._determineRenderType=function(e){("number"!=typeof e||e>_d.HEADLESS||e<ld.AUTO)&&(e=ld.AUTO);var t=_d.CANVAS,i=!1;if(e===ld.CANVAS?(t=_d.CANVAS,i=!0):e===ld.AUTO||e===ld.WEBGL?(t=_d.WEBGL,i=!0):e===ld.HEADLESS&&(t=_d.HEADLESS,i=!0),!i)throw new Error(te(3820,e));return t},n(e,[{key:"gfxDevice",get:function(){return this._gfxDevice}},{key:"swapchain",get:function(){return this._swapchain}}]),e}()),gd=e("br",new md),vd=function(){function e(e){this._map=null,this._count=0,e?(this._map=e,this._count=Object.keys(e).length):(this._map=Ne(!0),this._count=0)}var t=e.prototype;return t.add=function(e,t){return e in this._map||this._count++,this._map[e]=t},t.get=function(e){return this._map[e]},t.has=function(e){return e in this._map},t.remove=function(e){var t=this._map[e];return e in this._map&&(delete this._map[e],this._count--),t},t.clear=function(){0!==this._count&&(this._map=Ne(!0),this._count=0)},t.forEach=function(e){for(var t in this._map)e(this._map[t],t)},t.find=function(e){for(var t in this._map)if(e(this._map[t],t))return this._map[t];return null},t.destroy=function(){this._map=null},n(e,[{key:"count",get:function(){return this._count}}]),e}(),yd=function(){function e(t,i){this.id=e._pipelineId++,this.name="",this.pipes=[],this.name=t;for(var n=0,r=i.length;n<r;n++)this.pipes.push(i[n])}var t=e.prototype;return t.insert=function(e,t){return t>this.pipes.length?(q(4921),this):(this.pipes.splice(t,0,e),this)},t.append=function(e){return this.pipes.push(e),this},t.remove=function(e){return this.pipes.splice(e,1),this},t.sync=function(e){var t=this.pipes;if(0===t.length)return null;e.isFinished=!1;for(var i=0,n=t.length;i<n;){var r=(0,t[i])(e);if(r)return e.isFinished=!0,r;++i!==n&&(e.input=e.output,e.output=null)}return e.isFinished=!0,e.output},t.async=function(e){0!==this.pipes.length&&(e.isFinished=!1,this._flow(0,e))},t._flow=function(e,t){var i=this;(0,this.pipes[e])(t,(function(n){n?(t.isFinished=!0,t.dispatch("complete",n)):++e<i.pipes.length?(t.input=t.output,t.output=null,i._flow(e,t)):(t.isFinished=!0,t.dispatch("complete",n,t.output))}))},e}();yd._pipelineId=0,function(){function e(e){if(this._weakMap={},void 0===window.WeakRef)throw new Error("this platform does not support WeakRef!");if(e)for(var t in e)this._weakMap[t]=new WeakRef(e[t])}var t=e.prototype;t.add=function(e,t){return this._weakMap[e]=new WeakRef(t),t},t.has=function(e){return e in this._weakMap&&!!this._weakMap[e].deref()},t.get=function(e){return this._weakMap[e]&&this._weakMap[e].deref()},t.remove=function(e){var t=this._weakMap[e];return delete this._weakMap[e],t&&t.deref()},t.clear=function(){this._weakMap=Ne(!0)},t.forEach=function(e){for(var t in this._weakMap){var i=this.get(t);i&&e(i,t)}},t.find=function(e){for(var t in this._weakMap){var i=this.get(t);if(i&&e(i,t))return this._weakMap[t].deref()}return null},t.destroy=function(){this._weakMap={}},n(e,[{key:"count",get:function(){return Object.values(this._weakMap).filter((function(e){return e.deref()})).length}}])}();var Ed,Td=new vd,Ad=new vd,Sd=new vd,Rd=new vd,wd=new yd("normal load",[]),Id=new yd("fetch",[]),bd=new yd("transform url",[]),Od=new Map;!function(e){e.UUID="uuid",e.PATH="path",e.DIR="dir",e.URL="url",e.SCENE="scene"}(Ed||(Ed={}));var Nd,Cd={default:{priority:0},preload:{maxConcurrency:6,maxRequestsPerFrame:2,priority:-1},scene:{maxConcurrency:20,maxRequestsPerFrame:20,priority:1},bundle:{maxConcurrency:20,maxRequestsPerFrame:20,priority:2},remote:{maxRetryCount:4}};!function(e){e.INTERNAL="internal",e.RESOURCES="resources",e.MAIN="main",e.START_SCENE="start-scene"}(Nd||(Nd={}));var Md=function(){function e(t){this.id=e._taskId++,this.onComplete=null,this.onProgress=null,this.onError=null,this.source=null,this.output=null,this.input=null,this.progress=null,this.options=null,this.isFinished=!0,this.set(t)}e.create=function(t){var i;return 0!==e._deadPool.length?(i=e._deadPool.pop()).set(t):i=new e(t),i};var t=e.prototype;return t.set=function(e){void 0===e&&(e=Object.create(null)),this.onComplete=e.onComplete||null,this.onProgress=e.onProgress||null,this.onError=e.onError||null,this.source=this.input=e.input,this.output=null,this.progress=e.progress,this.options=e.options||Object.create(null)},t.dispatch=function(e,t,i,n,r){switch(e){case"complete":this.onComplete&&this.onComplete(t,i);break;case"progress":this.onProgress&&this.onProgress(t,i,n,r);break;case"error":this.onError&&this.onError(t,i,n,r);break;default:var s="on"+e[0].toUpperCase()+e.substr(1);"function"==typeof this[s]&&this[s](t,i,n,r)}},t.recycle=function(){e._deadPool.length!==e.MAX_DEAD_NUM&&(this.onComplete=null,this.onProgress=null,this.onError=null,this.source=this.output=this.input=null,this.progress=null,this.options=null,e._deadPool.push(this))},n(e,[{key:"isFinish",get:function(){return this.isFinished},set:function(e){this.isFinished=e}}]),e}();Md.MAX_DEAD_NUM=500,Md._taskId=0,Md._deadPool=[];var Pd="0123456789abcdef".split(""),Ld=["","","",""],xd=Ld.concat(Ld,"-",Ld,"-",Ld,"-",Ld,"-",Ld,Ld,Ld),Dd=xd.map((function(e,t){return"-"===e?NaN:t})).filter(Number.isFinite);function Fd(e){var t=e.split("@")[0];if(22!==t.length)return e;xd[0]=e[0],xd[1]=e[1];for(var i=2,n=2;i<22;i+=2){var r=Nt[e.charCodeAt(i)],s=Nt[e.charCodeAt(i+1)];xd[Dd[n++]]=Pd[r>>2],xd[Dd[n++]]=Pd[(3&r)<<2|s>>4],xd[Dd[n++]]=Pd[15&s]}return e.replace(t,xd.join(""))}var Bd=/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,}).*/;function Ud(e){var t=Bd.exec(e);return t?t[1]:""}function Gd(e,t){(t=t||Object.create(null)).__isNative__=t.isNative,t.nativeExt&&(t.ext=t.nativeExt);var i=Rd.find((function(t){return!!t.getAssetInfo(e)}));return i&&(t.bundle=i.name),zd(e,t)}function kd(e){return!!e&&(e instanceof v.SceneAsset||e instanceof v.Scene)}function Hd(e){return e&&(46===e.charCodeAt(0)&&47===e.charCodeAt(1)?e=e.slice(2):47===e.charCodeAt(0)&&(e=e.slice(1))),e}function zd(e,t){var i=Md.create({input:e,options:t}),n=[];try{for(var r,s=d(bd.sync(i));!(r=s()).done;){var a=r.value,o=a.url;a.recycle(),n.push(o)}}catch(e){for(var u,h=d(i.output);!(u=h()).done;)u.value.recycle();k(e.message,e.stack)}return i.recycle(),n.length>1?n:n[0]}var Vd,Wd,jd,Xd=Object.freeze({__proto__:null,getUuidFromURL:Ud,getUrlWithUuid:Gd,isScene:kd,normalize:Hd,transform:zd,decodeUuid:Fd}),Kd=Ys,Yd=Vs,qd=e("cw",Gs("cc.Asset")((Wd=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).loaded=!0,t._native=jd&&jd(),t._nativeUrl="",t._file=null,t._ref=0,Object.defineProperty(l(t),"_uuid",{value:"",writable:!0}),t}s(t,e),t.deserialize=function(e){return v.deserialize(e)};var i=t.prototype;return i.toString=function(){return this.nativeUrl},i.serialize=function(){},i._setRawAsset=function(e,t){void 0===t&&(t=!0),this._native=!1!==t?e||"":"/"+e},i.addRef=function(){return this._ref++,this},i.decRef=function(e){return void 0===e&&(e=!0),this._ref>0&&this._ref--,e&&v.assetManager._releaseManager.tryRelease(this),this},i.onLoaded=function(){},i.initDefault=function(e){e&&(this._uuid=e),this.isDefault=!0},i.validate=function(){return!0},i.destroy=function(){return z(te(12101,this._uuid)),e.prototype.destroy.call(this)},n(t,[{key:"nativeUrl",get:function(){if(!this._nativeUrl){if(!this._native)return"";var e=this._native;if(47===e.charCodeAt(0))return e.slice(1);46===e.charCodeAt(0)?this._nativeUrl=Gd(this._uuid,{nativeExt:e,isNative:!0}):this._nativeUrl=Gd(this._uuid,{__nativeName__:e,nativeExt:ec(e),isNative:!0})}return this._nativeUrl}},{key:"uuid",get:function(){return this._uuid}},{key:"_nativeAsset",get:function(){return this._file},set:function(e){this._file=e}},{key:"_nativeDep",get:function(){if(this._native)return{__isNative__:!0,uuid:this._uuid,ext:this._native}}},{key:"refCount",get:function(){return this._ref}}]),t}(Gh(Ba)),jd=Cs(Wd.prototype,"_native",[Kd],(function(){return""})),f(Wd.prototype,"_nativeAsset",[Yd],Object.getOwnPropertyDescriptor(Wd.prototype,"_nativeAsset"),Wd.prototype),Vd=Wd))||Vd);qd.prototype.createNode=null,v.Asset=qd;var Qd,Zd,Jd,$d,ef,tf,nf;!function(e){e[e.RGB565=Fc.R5G6B5]="RGB565",e[e.RGB5A1=Fc.RGB5A1]="RGB5A1",e[e.RGBA4444=Fc.RGBA4]="RGBA4444",e[e.RGB888=Fc.RGB8]="RGB888",e[e.RGB32F=Fc.RGB32F]="RGB32F",e[e.RGBA8888=Fc.RGBA8]="RGBA8888",e[e.RGBA32F=Fc.RGBA32F]="RGBA32F",e[e.A8=Fc.A8]="A8",e[e.I8=Fc.L8]="I8",e[e.AI8=Fc.LA8]="AI8",e[e.RGB_PVRTC_2BPPV1=Fc.PVRTC_RGB2]="RGB_PVRTC_2BPPV1",e[e.RGBA_PVRTC_2BPPV1=Fc.PVRTC_RGBA2]="RGBA_PVRTC_2BPPV1",e[e.RGB_A_PVRTC_2BPPV1=1024]="RGB_A_PVRTC_2BPPV1",e[e.RGB_PVRTC_4BPPV1=Fc.PVRTC_RGB4]="RGB_PVRTC_4BPPV1",e[e.RGBA_PVRTC_4BPPV1=Fc.PVRTC_RGBA4]="RGBA_PVRTC_4BPPV1",e[e.RGB_A_PVRTC_4BPPV1=1025]="RGB_A_PVRTC_4BPPV1",e[e.RGB_ETC1=Fc.ETC_RGB8]="RGB_ETC1",e[e.RGBA_ETC1=1026]="RGBA_ETC1",e[e.RGB_ETC2=Fc.ETC2_RGB8]="RGB_ETC2",e[e.RGBA_ETC2=Fc.ETC2_RGBA8]="RGBA_ETC2",e[e.RGBA_ASTC_4x4=Fc.ASTC_RGBA_4X4]="RGBA_ASTC_4x4",e[e.RGBA_ASTC_5x4=Fc.ASTC_RGBA_5X4]="RGBA_ASTC_5x4",e[e.RGBA_ASTC_5x5=Fc.ASTC_RGBA_5X5]="RGBA_ASTC_5x5",e[e.RGBA_ASTC_6x5=Fc.ASTC_RGBA_6X5]="RGBA_ASTC_6x5",e[e.RGBA_ASTC_6x6=Fc.ASTC_RGBA_6X6]="RGBA_ASTC_6x6",e[e.RGBA_ASTC_8x5=Fc.ASTC_RGBA_8X5]="RGBA_ASTC_8x5",e[e.RGBA_ASTC_8x6=Fc.ASTC_RGBA_8X6]="RGBA_ASTC_8x6",e[e.RGBA_ASTC_8x8=Fc.ASTC_RGBA_8X8]="RGBA_ASTC_8x8",e[e.RGBA_ASTC_10x5=Fc.ASTC_RGBA_10X5]="RGBA_ASTC_10x5",e[e.RGBA_ASTC_10x6=Fc.ASTC_RGBA_10X6]="RGBA_ASTC_10x6",e[e.RGBA_ASTC_10x8=Fc.ASTC_RGBA_10X8]="RGBA_ASTC_10x8",e[e.RGBA_ASTC_10x10=Fc.ASTC_RGBA_10X10]="RGBA_ASTC_10x10",e[e.RGBA_ASTC_12x10=Fc.ASTC_RGBA_12X10]="RGBA_ASTC_12x10",e[e.RGBA_ASTC_12x12=Fc.ASTC_RGBA_12X12]="RGBA_ASTC_12x12"}(Qd||(Qd=e("bw",{}))),function(e){e[e.REPEAT=Qc.WRAP]="REPEAT",e[e.CLAMP_TO_EDGE=Qc.CLAMP]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=Qc.MIRROR]="MIRRORED_REPEAT",e[e.CLAMP_TO_BORDER=Qc.BORDER]="CLAMP_TO_BORDER"}(Zd||(Zd=e("dY",{}))),function(e){e[e.NONE=qc.NONE]="NONE",e[e.LINEAR=qc.LINEAR]="LINEAR",e[e.NEAREST=qc.POINT]="NEAREST"}(Jd||(Jd=e("c9",{})));var rf=1346981187,sf=mt({PVR:0,PKM:1,ASTC:2});function af(e,t){return e[t]<<8|e[t+1]}function of(e){return!!(Ec.hasFeature(Ec.Feature.IMAGE_BITMAP)&&e instanceof ImageBitmap)}var uf,hf,cf,lf,_f,df,ff,pf,mf,gf,vf,yf,Ef=e("ci",Gs("cc.ImageAsset")((nf=tf=function(e){function t(t){var i;return(i=e.call(this)||this)._nativeData=void 0,i._exportedExts=void 0,i._format=Qd.RGBA8888,i._width=0,i._height=0,i._nativeData={_data:null,width:0,height:0,format:0,_compressed:!1,mipmapLevelDataSize:[]},void 0!==t&&i.reset(t),i}s(t,e),t.mergeCompressedTextureMips=function(e){var t=new Uint8Array(0),i=null;try{for(var n,r=8+4*e.length,s=0,a=d(e);!(n=a()).done;)s+=n.value.byteLength;s+=r,t=new Uint8Array(s);var o=new DataView(t.buffer,t.byteOffset,t.byteLength);o.setUint32(0,rf,!0),o.setUint32(4,e.length,!0);for(var u=r,h=0;h<e.length;h++){var c=e[h];if(o.setUint32(8+4*h,c.byteLength,!0),c instanceof ArrayBuffer){var l=new Uint8Array(c);t.set(l,u)}else{var _=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);t.set(_,u)}u+=c.byteLength}}catch(e){i=e,console.warn(i)}return t},t.parseCompressedTextures=function(e,i){var n={_data:new Uint8Array(0),_compressed:!0,width:0,height:0,format:0,mipmapLevelDataSize:[]},r=e instanceof ArrayBuffer?e:e.buffer,s=new DataView(r);if(s.getUint32(0,!0)===rf){var a=s.getUint32(4,!0),o=s.getUint32(8,!0),u=8+4*a;t.parseCompressedTexture(e,0,u,o,i,n);for(var h=u+o,c=1;c<a;c++){var l=s.getUint32(8+4*c,!0);t.parseCompressedTexture(e,c,h,l,i,n),h+=l}}else t.parseCompressedTexture(e,0,0,0,i,n);return n},t.parseCompressedTexture=function(e,i,n,r,s,a){switch(s){case sf.PVR:t.parsePVRTexture(e,i,n,r,a);break;case sf.PKM:t.parsePKMTexture(e,i,n,r,a);break;case sf.ASTC:t.parseASTCTexture(e,i,n,r,a)}},t.parsePVRTexture=function(e,t,i,n,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Int32Array(s,i,13);if(55727696===a[0]){var o=i+a[12]+52,u=n-a.byteLength;if(n>0){var h=new Uint8Array(s,o,u),c=new Uint8Array(r._data.byteLength+h.byteLength);c.set(r._data),c.set(h,r._data.byteLength),r._data=c,r.mipmapLevelDataSize[t]=u}else r._data=new Uint8Array(s,o);r.width=t>0?r.width:a[7],r.height=t>0?r.height:a[6]}else{if(559044176!==a[11])throw new Error("Invalid magic number in PVR header");var l=i+a[0],_=n-a.byteLength;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[t]=_}else r._data=new Uint8Array(s,l);r.width=t>0?r.width:a[1],r.height=t>0?r.height:a[2]}},t.parsePKMTexture=function(e,t,i,n,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s,i,16),o=af(a,6);if(0!==o&&1!==o&&3!==o)throw new Error("Invalid magic number in ETC header");var u=i+16,h=n-16;if(n>0){var c=new Uint8Array(s,u,h),l=new Uint8Array(r._data.byteLength+c.byteLength);l.set(r._data),l.set(c,r._data.byteLength),r._data=l,r.mipmapLevelDataSize[t]=h}else r._data=new Uint8Array(s,u);r.width=t>0?r.width:af(a,12),r.height=t>0?r.height:af(a,14)},t.parseASTCTexture=function(e,t,i,n,r){var s=e instanceof ArrayBuffer?e:e.buffer,a=new Uint8Array(s,i,16);if(1554098963!==a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24))throw new Error("Invalid magic number in ASTC header");var o=a[4],u=a[5],h=a[6];if((o<3||o>6||u<3||u>6||h<3||h>6)&&(o<4||7===o||9===o||11===o||o>12||u<4||7===u||9===u||11===u||u>12||1!==h))throw new Error("Invalid block number in ASTC header");var c=function(e,t){return 4===e?Qd.RGBA_ASTC_4x4:5===e?4===t?Qd.RGBA_ASTC_5x4:Qd.RGBA_ASTC_5x5:6===e?5===t?Qd.RGBA_ASTC_6x5:Qd.RGBA_ASTC_6x6:8===e?5===t?Qd.RGBA_ASTC_8x5:6===t?Qd.RGBA_ASTC_8x6:Qd.RGBA_ASTC_8x8:10===e?5===t?Qd.RGBA_ASTC_10x5:6===t?Qd.RGBA_ASTC_10x6:8===t?Qd.RGBA_ASTC_10x8:Qd.RGBA_ASTC_10x10:10===t?Qd.RGBA_ASTC_12x10:Qd.RGBA_ASTC_12x12}(o,u),l=i+16,_=n-16;if(n>0){var d=new Uint8Array(s,l,_),f=new Uint8Array(r._data.byteLength+d.byteLength);f.set(r._data),f.set(d,r._data.byteLength),r._data=f,r.mipmapLevelDataSize[t]=_}else r._data=new Uint8Array(s,l);r.width=t>0?r.width:a[7]+(a[8]<<8)+(a[9]<<16),r.height=t>0?r.height:a[10]+(a[11]<<8)+(a[12]<<16),r.format=c};var i=t.prototype;return i.reset=function(e){of(e)||e instanceof HTMLElement?this._nativeData=e:(this._nativeData=e,this._format=e.format)},i.destroy=function(){return this.data&&this.data instanceof HTMLImageElement?(this.data.src="",this._setRawAsset("")):of(this.data)&&this.data.close&&this.data.close(),e.prototype.destroy.call(this)},i._serialize=function(){},i._deserialize=function(e){var i="";"string"==typeof e?i=e:(this._width=e.w,this._height=e.h,i=e.fmt);for(var n,r=gd.gfxDevice,s=i.split("_"),a=Number.MAX_VALUE,o=this._format,u="",h=Rt.SUPPORT_TEXTURE_FORMATS,c=d(s);!(n=c()).done;){var l=n.value.split("@"),_=parseInt(l[0],void 0),f=t.extnames[_]||l[0],p=h.indexOf(f);if(-1!==p&&p<a){var m=l[1]?parseInt(l[1]):this._format;if(!(".astc"!==f||r&&r.getFormatFeatures(Fc.ASTC_RGBA_4X4)&Xc.SAMPLED_TEXTURE))continue;if(!(".pvr"!==f||r&&r.getFormatFeatures(Fc.PVRTC_RGBA4)&Xc.SAMPLED_TEXTURE))continue;if(!(m!==Qd.RGB_ETC1&&m!==Qd.RGBA_ETC1||r&&r.getFormatFeatures(Fc.ETC_RGB8)&Xc.SAMPLED_TEXTURE))continue;if(!(m!==Qd.RGB_ETC2&&m!==Qd.RGBA_ETC2||r&&r.getFormatFeatures(Fc.ETC2_RGB8)&Xc.SAMPLED_TEXTURE))continue;if(".webp"===f&&!Ec.hasFeature(Ec.Feature.WEBP))continue;a=p,u=f,o=m}}u?(this._setRawAsset(u),this._format=o):q(3121)},i.initDefault=function(i){if(e.prototype.initDefault.call(this,i),t._sharedPlaceHolderCanvas)this.reset(t._sharedPlaceHolderCanvas);else{var n=E.document.createElement("canvas"),r=n.getContext("2d"),s=n.width=n.height=2;r.fillStyle="#ff00ff",r.fillRect(0,0,s,s),this.reset(n),t._sharedPlaceHolderCanvas=n}},i.validate=function(){return!!this.data},n(t,[{key:"_nativeAsset",get:function(){return this._nativeData},set:function(e){e instanceof HTMLElement||of(e)||(e.format=e.format||this._format),this.reset(e)}},{key:"data",get:function(){return this._nativeData&&((e=this._nativeData)instanceof HTMLImageElement||e instanceof HTMLCanvasElement||of(e))?this._nativeData:this._nativeData&&this._nativeData._data;var e}},{key:"width",get:function(){return this._nativeData.width||this._width}},{key:"height",get:function(){return this._nativeData.height||this._height}},{key:"format",get:function(){return this._format}},{key:"isCompressed",get:function(){return this._format>=Qd.RGB_ETC1&&this._format<=Qd.RGBA_ASTC_12x12||this._format>=Qd.RGB_A_PVRTC_2BPPV1&&this._format<=Qd.RGBA_ETC1}},{key:"mipmapLevelDataSize",get:function(){return this._nativeData.mipmapLevelDataSize}},{key:"url",get:function(){return this.nativeUrl}}]),t}(qd),tf.extnames=[".png",".jpg",".jpeg",".bmp",".webp",".pvr",".pkm",".astc"],tf._sharedPlaceHolderCanvas=null,f((ef=nf).prototype,"_nativeAsset",[Ea],Object.getOwnPropertyDescriptor(ef.prototype,"_nativeAsset"),ef.prototype),$d=ef))||$d);v.ImageAsset=Ef,yt(Fc);var Tf,Af,Sf,Rf=new ge("Tex"),wf=e("d7",Gs("cc.TextureBase")((yf=vf=function(e){function t(){var t;return(t=e.call(this)||this)._format=cf&&cf(),t._minFilter=lf&&lf(),t._magFilter=_f&&_f(),t._mipFilter=df&&df(),t._wrapS=ff&&ff(),t._wrapT=pf&&pf(),t._wrapR=mf&&mf(),t._anisotropy=gf&&gf(),t._width=1,t._height=1,t._id=void 0,t._samplerInfo=new Xl,t._gfxSampler=null,t._gfxDevice=null,t._textureHash=0,t._id=Rf.getNewId(),t._gfxDevice=t._getGFXDevice(),t._textureHash=Rc(t._id,666),t}s(t,e);var i=t.prototype;return i.getId=function(){return this._id},i.getPixelFormat=function(){return this._format},i.getAnisotropy=function(){return this._anisotropy},i.setWrapMode=function(e,t,i){void 0===i&&(i=e),this._wrapS=e,this._samplerInfo.addressU=e,this._wrapT=t,this._samplerInfo.addressV=t,this._wrapR=i,this._samplerInfo.addressW=i,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setFilters=function(e,t){this._minFilter=e,this._samplerInfo.minFilter=e,this._magFilter=t,this._samplerInfo.magFilter=t,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setMipFilter=function(e){this._mipFilter=e,this._samplerInfo.mipFilter=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.setAnisotropy=function(e){this._anisotropy=e,this._samplerInfo.maxAnisotropy=e,this._gfxDevice&&(this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo))},i.destroy=function(){var t,i=e.prototype.destroy.call(this);return i&&null!==(t=v.director.root)&&void 0!==t&&t.batcher2D&&v.director.root.batcher2D._releaseDescriptorSetCache(this._textureHash),i},i.getHash=function(){return this._textureHash},i.getGFXTexture=function(){return null},i.getSamplerInfo=function(){return this._samplerInfo},i.getGFXSampler=function(){return this._gfxSampler||(this._gfxDevice?this._gfxSampler=this._gfxDevice.getSampler(this._samplerInfo):Z(9302)),this._gfxSampler},i._serialize=function(){return""},i._deserialize=function(e){var t=e.split(",");t.unshift(""),t.length>=5&&(this.setFilters(parseInt(t[1]),parseInt(t[2])),this.setWrapMode(parseInt(t[3]),parseInt(t[4]))),t.length>=7&&(this.setMipFilter(parseInt(t[5])),this.setAnisotropy(parseInt(t[6])))},i._getGFXDevice=function(){return gd.gfxDevice},i._getGFXFormat=function(){return this._getGFXPixelFormat(this._format)},i._setGFXFormat=function(e){this._format=void 0===e?Qd.RGBA8888:e},i._getGFXPixelFormat=function(e){return e===Qd.RGBA_ETC1?e=Qd.RGB_ETC1:e===Qd.RGB_A_PVRTC_4BPPV1?e=Qd.RGB_PVRTC_4BPPV1:e===Qd.RGB_A_PVRTC_2BPPV1&&(e=Qd.RGB_PVRTC_2BPPV1),e},n(t,[{key:"isCompressed",get:function(){return this._format>=Qd.RGB_ETC1&&this._format<=Qd.RGBA_ASTC_12x12||this._format>=Qd.RGB_A_PVRTC_2BPPV1&&this._format<=Qd.RGBA_ETC1}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}}]),t}(qd),vf.PixelFormat=Qd,vf.WrapMode=Zd,vf.Filter=Jd,cf=Cs((hf=yf).prototype,"_format",[Ys],(function(){return Qd.RGBA8888})),lf=Cs(hf.prototype,"_minFilter",[Ys],(function(){return Jd.LINEAR})),_f=Cs(hf.prototype,"_magFilter",[Ys],(function(){return Jd.LINEAR})),df=Cs(hf.prototype,"_mipFilter",[Ys],(function(){return Jd.NONE})),ff=Cs(hf.prototype,"_wrapS",[Ys],(function(){return Zd.REPEAT})),pf=Cs(hf.prototype,"_wrapT",[Ys],(function(){return Zd.REPEAT})),mf=Cs(hf.prototype,"_wrapR",[Ys],(function(){return Zd.REPEAT})),gf=Cs(hf.prototype,"_anisotropy",[Ys],(function(){return 0})),uf=hf))||uf);v.TextureBase=wf;var If=e("hu",Gs("cc.Script")(Tf=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(qd))||Tf);v._Script=If;var bf=e("hv",Gs("cc.JavaScript")(Af=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(If))||Af);v._JavaScript=bf;var Of,Nf,Cf,Mf,Pf,Lf,xf,Df=e("hw",Gs("cc.TypeScript")(Sf=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(If))||Sf);v._TypeScript=Df;var Ff,Bf,Uf,Gf,kf,Hf,zf,Vf,Wf,jf,Xf,Kf,Yf=e("fz",Gs("cc.ClickEvent")((Nf=function(){function e(){this.target=Cf&&Cf(),this.component=Mf&&Mf(),this._componentId=Pf&&Pf(),this.handler=Lf&&Lf(),this.customEventData=xf&&xf()}e.emitEvents=function(t){for(var i=arguments.length,n=new Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];for(var s=0,a=t.length;s<a;s++){var o=t[s];o instanceof e&&o.emit(n)}};var t=e.prototype;return t.emit=function(e){var t=this.target;if(v.isValid(t)){this._genCompIdIfNeeded();var i=v.js.getClassById(this._componentId),n=t.getComponent(i);if(v.isValid(n)){var r=n[this.handler];"function"==typeof r&&(null!=this.customEventData&&""!==this.customEventData&&(e=e.slice()).push(this.customEventData),r.apply(n,e))}}},t._compName2Id=function(e){var t=v.js.getClassByName(e);return v.js.getClassId(t)},t._compId2Name=function(e){var t=v.js.getClassById(e);return v.js.getClassName(t)},t._genCompIdIfNeeded=function(){this._componentId||(this._componentName=this.component,this.component="")},n(e,[{key:"_componentName",get:function(){return this._genCompIdIfNeeded(),this._compId2Name(this._componentId)},set:function(e){this._componentId=this._compName2Id(e)}}]),e}(),Cf=Cs(Nf.prototype,"target",[Ys],(function(){return null})),Mf=Cs(Nf.prototype,"component",[Ys],(function(){return""})),Pf=Cs(Nf.prototype,"_componentId",[Ys],(function(){return""})),Lf=Cs(Nf.prototype,"handler",[Ys],(function(){return""})),xf=Cs(Nf.prototype,"customEventData",[Ys],(function(){return""})),Of=Nf))||Of),qf=new ge("Comp"),Qf=Ba.Flags.IsOnLoadCalled,Zf=e("d0",(Ff=Gs("cc.Component"),Bf=va(If),Ff((Wf=Vf=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).node=kf&&kf(),t._enabled=Hf&&Hf(),t.__prefab=zf&&zf(),t._sceneGetter=null,t._id=qf.getNewId(),t}s(t,e);var i=t.prototype;return i._getRenderScene=function(){return this._sceneGetter?this._sceneGetter():this.node.scene.renderScene},i.addComponent=function(e){return this.node.addComponent(e)},i.getComponent=function(e){return this.node.getComponent(e)},i.getComponents=function(e){return this.node.getComponents(e)},i.getComponentInChildren=function(e){return this.node.getComponentInChildren(e)},i.getComponentsInChildren=function(e){return this.node.getComponentsInChildren(e)},i.destroy=function(){return!!e.prototype.destroy.call(this)&&(this._enabled&&this.node.activeInHierarchy&&v.director._compScheduler.disableComp(this),!0)},i._onPreDestroy=function(){this.unscheduleAllCallbacks(),v.director._nodeActivator.destroyComp(this),this.node._removeComponent(this)},i._instantiate=function(e){return e||(e=v.instantiate._clone(this,this)),e&&(e.node=null),e},i.schedule=function(e,t,i,n){void 0===t&&(t=0),void 0===i&&(i=v.macro.REPEAT_FOREVER),void 0===n&&(n=0),ee(e,1619),ee((t=t||0)>=0,1620),i=Number.isNaN(i)?v.macro.REPEAT_FOREVER:i,n=n||0;var r=v.director.getScheduler(),s=r.isTargetPaused(this);r.schedule(e,this,t,i,n,s)},i.scheduleOnce=function(e,t){void 0===t&&(t=0),this.schedule(e,0,0,t)},i.unschedule=function(e){e&&v.director.getScheduler().unschedule(e,this)},i.unscheduleAllCallbacks=function(){v.director.getScheduler().unscheduleAllForTarget(this)},n(t,[{key:"name",get:function(){if(this._name)return this._name;var e=Ce(this),t=e.lastIndexOf(".");return t>=0&&(e=e.slice(t+1)),this.node?this.node.name+"<"+e+">":e},set:function(e){this._name=e}},{key:"uuid",get:function(){return this._id}},{key:"__scriptAsset",get:function(){return null}},{key:"enabled",get:function(){return this._enabled},set:function(e){if(this._enabled!==e&&(this._enabled=e,this.node.activeInHierarchy)){var t=v.director._compScheduler;e?t.enableComp(this):t.disableComp(this)}}},{key:"enabledInHierarchy",get:function(){return this._enabled&&this.node&&this.node.activeInHierarchy}},{key:"_isOnLoadCalled",get:function(){return this._objFlags&Qf}}]),t}(Ba),Vf.EventHandler=Yf,Vf.system=null,f((Gf=Wf).prototype,"__scriptAsset",[Bf],Object.getOwnPropertyDescriptor(Gf.prototype,"__scriptAsset"),Gf.prototype),kf=Cs(Gf.prototype,"node",[Ys],(function(){return null})),Hf=Cs(Gf.prototype,"_enabled",[Ys],(function(){return!0})),zf=Cs(Gf.prototype,"__prefab",[Ys],(function(){return null})),Uf=Gf))||Uf)),Jf=Zf.prototype;Jf.update=null,Jf.lateUpdate=null,Jf.__preload=null,Jf.onLoad=null,Jf.start=null,Jf.onEnable=null,Jf.onDisable=null,Jf.onDestroy=null,Jf.onFocusInEditor=null,Jf.onLostFocusInEditor=null,Jf.resetInEditor=null,Jf._getLocalBounds=null,Jf.onRestore=null,Zf._requireComponent=null,Zf._executionOrder=0,we(Zf,"_registerEditorProps",(function(e,t){var i=t.requireComponent;i&&(Array.isArray(i)&&(i=i.filter(Boolean)),e._requireComponent=i);var n=t.executionOrder;n&&"number"==typeof n&&(e._executionOrder=n)})),v.Component=Zf;var $f=e("hl",Gs("cc.MissingScript")((Xf=function(e){function t(){var t;return(t=e.call(this)||this)._$erialized=Kf&&Kf(),t}return s(t,e),t.safeFindClass=function(e){var t=tt(e);if(t)return t;v.deserialize.reportMissingClass(e)},t.prototype.onLoad=function(){q(4600,this.node.name)},t}(Zf),Kf=Cs(Xf.prototype,"_$erialized",[Ys,Qs],(function(){return null})),jf=Xf))||jf);v._MissingScript=$f;try{var ep=$f.__values__;0!==ep.length&&"_$erialized"===ep[ep.length-1]||(k("The '_$erialized' prop in MissingScript is missing. Please contact jare."),k(" Error props: ['"+ep+"']"))}catch(Wn){k("Error when checking MissingScript 5, "+Wn)}var tp=function(){function e(e,t){this._document=void 0,this._chunks=void 0,this._document=e,this._chunks=t}return n(e,[{key:"document",get:function(){return this._document}},{key:"chunks",get:function(){return this._chunks}}]),e}();function ip(e){var t=e;return{chunks:t.chunks,document:t.document}}function np(e){if(e.length<16)throw new rp(te(13102));var t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(1313817411!==t.getUint32(0,!0))throw new rp(te(13100));var i=t.getUint32(4,!0);if(1!==i)throw new rp(te(13101,i));if(t.getUint32(8,!0)!==t.byteLength)throw new rp(te(13102));var n=12,r=t.getUint32(n,!0);n+=4;var s=new Uint8Array(t.buffer,n+t.byteOffset,r);n+=r;var a,o=function(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);if("Buffer"in globalThis)return globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString();throw new Error(te(13104))}(s);try{a=JSON.parse(o)}catch(e){throw new rp(e)}for(var u=[];n<t.byteLength;){n%8!=0&&(n+=8-n%8);var h=t.getUint32(n,!0);n+=4,u.push(new Uint8Array(t.buffer,n+t.byteOffset,h)),n+=h}if(n!==t.byteLength)throw new rp(te(13102));return new tp(a,u)}var rp=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(c(Error));function sp(e,t,i,n,r){if(t instanceof v.ValueType){r||e.push("if(prop){");var s=Ce(t);e.push("s._deserializeFastDefinedObject(o"+i+",prop,"+s+");"),r||e.push("}else o"+i+"=null;")}else e.push("\nif (prop) {\n s._deserializeAndAssignField(o, prop, "+n+");\n} else {\n o"+i+"=null;\n}\n")}!function(){function e(){this._viewOrPaddings=[],this._length=0}var t=e.prototype;t.alignAs=function(e){if(0!==e){var t=this._length%e;if(0!==t){var i=e-t;return this._viewOrPaddings.push(i),this._length+=i,i}}return 0},t.append=function(e){var t=this._length;return this._viewOrPaddings.push(e),this._length+=e.byteLength,t},t.get=function(){var e=new Uint8Array(this._length),t=0;return this._viewOrPaddings.forEach((function(i){"number"==typeof i?t+=i:(e.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),t),t+=i.byteLength)})),e},n(e,[{key:"byteLength",get:function(){return this._length}}])}(),v.internal.parseCCONJson=ip,v.internal.decodeCCONBinary=np,v.internal.CCON=tp;var ap=di.Attr.DELIMETER,op=ap+"type",up=ap+"default",hp=ap+"formerlySerializedAs",cp=function(e){function t(){return e.call(this,(function(e){e.clear()}),1)||this}return s(t,e),t.prototype.get=function(e,t,i,n,r){var s=this._get();return s?(s.reset(e,t,i,n,r),s):new lp(e,t,i,n,r)},t}(st),lp=function(){function e(e,t,i,n){this.deserializedList=void 0,this.deserializedData=void 0,this._ignoreEditorOnly=void 0,this.result=e,this.customEnv=n,this.deserializedList=[],this.deserializedData=null,this._classFinder=t,this._reportMissingClass=i,this._onDereferenced=null==t?void 0:t.onDereferenced}var t=e.prototype;return t.reset=function(e,t,i,n){this.result=e,this.customEnv=n,this._classFinder=t,this._reportMissingClass=i,this._onDereferenced=null==t?void 0:t.onDereferenced},t.clear=function(){this.result=null,this.customEnv=null,this.deserializedList.length=0,this.deserializedData=null,this._classFinder=null,this._reportMissingClass=null,this._onDereferenced=null},t.deserialize=function(e){var t,i=!1;e instanceof tp?(i=!0,t=e.document,e.chunks.length>0&&(e.chunks.length,this._mainBinChunk=e.chunks[0])):t=e,this._serializedData=t,this._context={fromCCON:i};var n=Array.isArray(t)?t[0]:t;return this.deserializedData=this._deserializeObject(n,0),this._serializedData=void 0,this._mainBinChunk=void 0,this._context=void 0,this.deserializedData},t._deserializeObject=function(e,t,i,n){switch(e.__type__){case"TypedArray":return this._deserializeTypedArrayView(e);case"TypedArrayRef":return this._deserializeTypedArrayViewRef(e);default:return e.__type__?this._deserializeTypeTaggedObject(e,t,i,n):Array.isArray(e)?this._deserializeArray(e):this._deserializePlainObject(e)}},t._deserializeTypedArrayView=function(e){return globalThis[e.ctor].from(e.array)},t._deserializeTypedArrayViewRef=function(e){var t=e.offset,i=e.length,n=e.ctor;return new globalThis[n](this._mainBinChunk.buffer,this._mainBinChunk.byteOffset+t,i)},t._deserializeArray=function(e){for(var t,i=new Array(e.length),n=0;n<e.length;n++)"object"==typeof(t=e[n])&&t?this._deserializeAndAssignField(i,t,""+n)&&(i[n]=null):i[n]=t;return i},t._deserializePlainObject=function(e){var t={};return this._fillPlainObject(t,e),t},t._deserializeTypeTaggedObject=function(e,t,i,n){var r=this,s=e.__type__,a=this._classFinder(s,e,i,n);if(!a)return this._classFinder===tt&&this._reportMissingClass(s),null;var o=function(e){var i=new e;return t>=0&&(r.deserializedList[t]=i),i}(a);return this._deserializeInto(e,o,a),o},t._deserializeInto=function(e,t,i,n){void 0===n&&(n=!1),n||!t[Xa]?t._deserialize?t._deserialize(e.content,this):v.Class._isCCClass(i)?this._deserializeFireClass(t,e,i):this._deserializeFastDefinedObject(t,e,i):this._runCustomizedDeserialize(e,t,i)},t._runCustomizedDeserialize=function(e,t,i){var n=this,r={readProperty:function(t){var i=e[t];return"object"==typeof i&&i?n._deserializeObjectField(i):i},readThis:function(){n._deserializeInto(e,t,i,!0)},readSuper:function(){var r=ze(i);r&&n._deserializeInto(e,t,r)}};t[Xa](r,this._context)},t._deserializeFireClass=function(e,t,i){var n;if(i.hasOwnProperty("__deserialize__"))n=i.__deserialize__;else{n=function(e,t){for(var i=di.Attr.getClassAttrs(t),n=t.__values__,r=["var prop;"],s=wt.test(rt(t)),a=0;a<n.length;a++){var o=n[a],u=void 0,h=void 0;di.IDENTIFIER_RE.test(o)?(h='"'+o+'"',u="."+o):u="["+(h=di.escapeForJS(o))+"]";var c=u;if(i[o+hp]){var l=i[o+hp];c=di.IDENTIFIER_RE.test(l)?"."+l:"["+di.escapeForJS(l)+"]"}r.push("prop=d"+c+";"),r.push('if(typeof prop!=="undefined"){');var _=di.getDefault(i[o+up]),d=i[o+op];if(s&&(void 0!==_||d)){var f=void 0;if(void 0===_)f=d instanceof di.Attr.PrimitiveType||d===ui||d===hi;else{var p=typeof _;f="string"===p||"number"===p||"boolean"===p}f?r.push("o"+u+"=prop;"):sp(r,_,u,h,!0)}else r.push('if(typeof prop!=="object"){o'+u+"=prop;}else{"),sp(r,_,u,h,!1),r.push("}");r.push("}")}return(Ve(t,v.Node)||Ve(t,v.Component))&&r.push("d._id&&(o._id=d._id);"),"_$erialized"===n[n.length-1]&&(r.push("o._$erialized=JSON.parse(JSON.stringify(d));"),r.push("s._fillPlainObject(o._$erialized,d);")),Function("s","o","d","k",r.join(""))}(0,i);try{if(i===$f){var r=i.__values__;0!==r.length&&"_$erialized"===r[r.length-1]||(k("The '_$erialized' prop of MissingScript is missing. Will force the raw data to be save."),k(" Error props: ['"+r+"']. Please contact jare."));var s=n;n=function(e,t,i,n){s(e,t,i,n),t._$erialized||k("Unable to stash previously serialized data. "+JSON.stringify(i))}}}catch(e){k("Error when checking MissingScript 6, "+e)}we(i,"__deserialize__",n,!0)}n(this,e,t,i)},t._deserializeAndAssignField=function(e,t,i){var n=t.__id__;if("number"==typeof n){var r=this.deserializedList[n];if(r)e[i]=r;else{var s,a=this._serializedData[n];e[i]=this._deserializeObject(a,n,void 0,i),null===(s=this._onDereferenced)||void 0===s||s.call(this,this.deserializedList,n,e,i)}}else{var o=t.__uuid__;if(o){var u=t.__expectedType__;this.result.push(e,i,o,u)}else e[i]=this._deserializeObject(t,-1)}return!1},t._deserializeObjectField=function(e){var t=e.__id__;if("number"==typeof t){var i=this.deserializedList[t];if(i)return i;var n=this._serializedData[t];return this._deserializeObject(n,t,void 0,void 0)}if(e.__uuid__)throw e.__expectedType__,new Error("Asset reference field serialization is currently not supported in custom serialization.");return this._deserializeObject(e,-1)},t._fillPlainObject=function(e,t){for(var i in t)if(t.hasOwnProperty(i)){var n=t[i];"object"!=typeof n?"__type__"!==i&&(e[i]=n):n?this._deserializeAndAssignField(e,n,i)&&(e[i]=null):e[i]=null}},t._deserializeFastDefinedObject=function(e,t,i){if(i===v.Vec2)return e.x=t.x||0,void(e.y=t.y||0);if(i===v.Vec3)return e.x=t.x||0,e.y=t.y||0,void(e.z=t.z||0);if(i!==v.Color){if(i===v.Size)return e.width=t.width||0,void(e.height=t.height||0);for(var n=di.Attr.getClassAttrs(i),r=i.__values__,s=0;s<r.length;s++){var a=r[s],o=t[a];void 0!==o||t.hasOwnProperty(a)||(o=di.getDefault(n[a+up])),"object"!=typeof o?e[a]=o:o?this._deserializeAndAssignField(e,o,a):e[a]=null}}else{e.r=t.r||0,e.g=t.g||0,e.b=t.b||0;var u=t.a;e.a=void 0===u?255:u}},e}();lp.pool=new cp;var _p=[Rn,Ki,zi,_n,en,Cn,Pn,En];function dp(e,t){e.x=t[1],e.y=t[2],e.z=t[3],e.w=t[4]}var fp=[function(e,t){e.x=t[1],e.y=t[2]},function(e,t){e.x=t[1],e.y=t[2],e.z=t[3]},dp,dp,function(e,t){e._val=t[1]},function(e,t){e.width=t[1],e.height=t[2]},function(e,t){e.x=t[1],e.y=t[2],e.width=t[3],e.height=t[4]},function(e,t){En.fromArray(e,t,1)}],pp=e("hn",function(){function e(){this.uuidObjList=null,this.uuidPropList=null,this.uuidList=null,this.uuidTypeList=[]}var t=e.prototype;return t.init=function(e){e?(this.uuidObjList=e[8],this.uuidPropList=e[9],this.uuidList=e[10]):this.uuidList||(this.uuidList=[],this.uuidObjList=[],this.uuidPropList=[],this.uuidTypeList=[])},t.reset=function(){this.uuidList&&(this.uuidList.length=0,this.uuidObjList.length=0,this.uuidPropList.length=0,this.uuidTypeList.length=0)},t.push=function(e,t,i,n){this.uuidObjList.push(e),this.uuidPropList.push(t),this.uuidList.push(i),this.uuidTypeList.push(n||"")},e}());function mp(e,t){for(var i=e[4][t[0]],n=i[0],r=new(0,n[0]),s=n[1],a=n[2],o=i[i.length-1],u=1;u<o;++u)r[s[i[u]]]=t[u];for(;u<t.length;++u){var h=s[i[u]],c=n[i[u]+a];(0,Ap[c])(e,r,h,t[u])}return r}function gp(e,t,i){var n=new t;return n._deserialize?n._deserialize(i,e[0]):Z(5303,Ce(t)),n}function vp(e,t,i,n){n>=0?t[i]=e[5][n]:e[7][3*~n]=t}function yp(e){return function(t,i,n,r){for(var s=0;s<r.length;++s)e(t,r,s,r[s]);i[n]=r}}function Ep(e,t,i,n){t[i]=null,e[8][n]=t}function Tp(e,t,i,n){t[i]=mp(e,n)}pp.pool=new st((function(e){e.reset()}),5),pp.pool.get=function(){return this._get()||new pp};var Ap=new Array(13);function Sp(e,t,i){return e||i(t),Object}function Rp(e,t,i,n,r,s,a){var o=e(t);if(!o){if(r)return void(i[n]=function(t,i,n){return function(){var r=e(n)||Sp(s,n,a);return t[i]=r,new r}}(i,n,t));o=Sp(s,t,a)}i[n]=o}function wp(e,t,i,n){for(var r=i||tt,s=e[3],a=0;a<s.length;++a){var o=s[a];"string"!=typeof o?Rp(r,o[0],o,0,t,i,n):Rp(r,o,s,a,t,i,n)}}function Ip(e){var t=e[4];if(t)for(var i=e[3],n=0;n<t.length;++n){var r=t[n];r[0]=i[r[0]]}}function bp(e,t,i){"string"==typeof e&&(e=JSON.parse(e));var n,r=!t;if(t=t||pp.pool.get(),function(e){if(Array.isArray(e)){var t=e[0];return"number"==typeof t||t instanceof Op}return!1}(e)){t.init(e),i=i||{};var s,a=e[0],o=!1;if("object"==typeof a&&(o=a.preprocessed,a=a.version),a<1)throw new Error(te(5304,a));i._version=a,i.result=t,e[0]=i,o||(wp(e,!1,i.classFinder,null!==(s=i.reportMissingClass)&&void 0!==s?s:bp.reportMissingClass),Ip(e)),v.game._isCloning=!0;var u=e[5],h=function(e){var t=e[5],i=e[6],n=0===i?0:i.length,r=t[t.length-1],s=t.length-n;"number"!=typeof r?r=0:(r<0&&(r=~r),--s);for(var a=0;a<s;++a)t[a]=mp(e,t[a]);for(var o=e[3],u=0;u<n;++u,++a){var h=i[u],c=t[a];if(h>=0){var l=o[h];t[a]=gp(e,l,c)}else(0,Ap[h=~h])(e,t,a,c)}return r}(e);v.game._isCloning=!1,e[7]&&function(e,t,i){for(var n=e.length-1,r=0,s=3*e[n];r<s;r+=3){var a=e[r],o=t[e[r+2]],u=e[r+1];u>=0?a[i[u]]=o:a[~u]=o}for(;r<n;r+=3){var h=t[e[r]],c=t[e[r+2]],l=e[r+1];l>=0?h[i[l]]=c:h[~l]=c}}(e[7],u,e[2]),function(e){for(var t=e[5],i=e[2],n=e[1],r=e[8],s=e[9],a=e[10],o=0;o<r.length;++o){var u=r[o];"number"==typeof u&&(r[o]=t[u]);var h=s[o];"number"==typeof h&&(h=h>=0?i[h]:~h,s[o]=h);var c=a[o];"number"==typeof c&&(a[o]=n[c])}}(e),n=u[h]}else n=function(e,t,i){var n,r=(i=i||{}).classFinder||tt,s=i.createAssetRefs||Ec.platform===jh.EDITOR_CORE,a=i.customEnv,o=i.ignoreEditorOnly,u=null!==(n=i.reportMissingClass)&&void 0!==n?n:v.deserialize.reportMissingClass;t.init();var h=lp.pool.get(t,r,u,a,o);v.game._isCloning=!0;var c=h.deserialize(e);return v.game._isCloning=!1,lp.pool.put(h),s&&t.assignAssetsBy((function(e,t){return EditorExtends.serialize.asAsset(e,t.type)})),c}(e,t,i);return r&&pp.pool.put(t),n}Ap[0]=function(e,t,i,n){t[i]=n},Ap[1]=vp,Ap[2]=yp(vp),Ap[3]=yp(Ep),Ap[4]=Tp,Ap[5]=function(e,t,i,n){fp[n[0]](t[i],n)},Ap[6]=Ep,Ap[7]=function(e,t,i,n){t[i].set(n)},Ap[8]=function(e,t,i,n){var r=new _p[n[0]];fp[n[0]](r,n),t[i]=r},Ap[9]=yp(Tp),Ap[10]=function(e,t,i,n){var r=e[3][n[0]];t[i]=gp(e,r,n[1])},Ap[11]=function(e,t,i,n){var r=n[0];t[i]=r;for(var s=1;s<n.length;s+=3){var a=n[s],o=n[s+1],u=n[s+2];(0,Ap[o])(e,r,a,u)}},Ap[12]=function(e,t,i,n){for(var r=n[0],s=0;s<r.length;++s){var a=r[s],o=n[s+1];0!==o&&(0,Ap[o])(e,r,s,a)}t[i]=r},bp.Details=pp,bp.reportMissingClass=function(e){Z(5302,e)};var Op=function(e){this.preprocessed=!0,this.version=e};function Np(e,t,i){return[1,0,0,[e],0,i?[t,-1]:[t],[0],0,[],[],[]]}v.deserialize=bp;var Cp=new WeakMap,Mp=new WeakSet,Pp=new WeakSet;function Lp(e,t){var i;i=$f.safeFindClass;var n,r=pp.pool.get();try{n=bp(e,r,{classFinder:i,customEnv:t})}catch(e){throw k(e),pp.pool.put(r),e}n._uuid=t.__uuid__||"";for(var s=r.uuidList,a=r.uuidObjList,o=r.uuidPropList,u=r.uuidTypeList||[],h=[],c=0;c<s.length;c++){var l=s[c];h[c]={uuid:Fd(l),owner:a[c],prop:o[c],type:tt(u[c])}}return Cp.set(n,h),n._native&&Mp.add(n),pp.pool.put(r),n}var xp=function(){function e(){this._depends=new vd}var t=e.prototype;return t.init=function(){this._depends.clear()},t.getNativeDep=function(e){var t=this._depends.get(e);return t&&t.nativeDep?r({},t.nativeDep):null},t.getDeps=function(e){return this._depends.has(e)?this._depends.get(e).deps:[]},t.getDepsRecursively=function(e){var t=Object.create(null),i=[];return this._descend(e,t,i),i},t.remove=function(e){this._depends.remove(e)},t.parse=function(e,t){var i,n,r=null;if(Array.isArray(t)||t.__type__||t instanceof tp){if(this._depends.has(e))return this._depends.get(e);if(!Array.isArray(t)||"number"==typeof(n=(i=t[5])[i.length-1])&&n<0)try{var s=Lp(t,{__uuid__:e});(r=this._parseDepsFromAsset(s)).nativeDep&&(r.nativeDep.uuid=e),Sd.add(e+"@import",s)}catch(t){Ad.remove(e+"@import"),r={deps:[]}}else r={deps:this._parseDepsFromJson(t)}}else{if(this._depends.has(e)&&(r=this._depends.get(e)).parsedFromExistAsset)return r;r=this._parseDepsFromAsset(t)}return this._depends.add(e,r),r},t._parseDepsFromAsset=function(e){for(var t={deps:[],parsedFromExistAsset:!0},i=Cp.get(e),n=0,r=i.length;n<r;n++)t.deps.push(i[n].uuid);return Mp.has(e)&&(t.nativeDep=e._nativeDep),t},t._parseDepsFromJson=function(e){var t=function(e){return i=(t=e)[1],t[10].map((function(e){return i[e]}));var t,i}(e);return t.forEach((function(e,i){return t[i]=Fd(e)})),t},t._descend=function(e,t,i){for(var n=this.getDeps(e),r=0;r<n.length;r++){var s=n[r];t[s]||(t[s]=!0,i.push(s),this._descend(s,t,i))}},n(e,null,[{key:"instance",get:function(){return this._instance||(this._instance=new e),this._instance}}]),e}();xp._instance=void 0;var Dp,Fp=xp.instance,Bp=[new Ll];function Up(e){return e&&0==(e&e-1)}var Gp,kp,Hp,zp,Vp,Wp=Gs("cc.SimpleTexture")(Dp=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._gfxTexture=null,t._gfxTextureView=null,t._mipmapLevel=1,t._textureWidth=0,t._textureHeight=0,t._baseLevel=0,t._maxLevel=1e3,t}s(t,e);var i=t.prototype;return i.getGFXTexture=function(){return this._gfxTextureView},i.destroy=function(){return this._tryDestroyTextureView(),this._tryDestroyTexture(),e.prototype.destroy.call(this)},i.updateImage=function(){this.updateMipmaps(0)},i.updateMipmaps=function(){},i.uploadData=function(e,t,i){if(void 0===t&&(t=0),void 0===i&&(i=0),this._gfxTexture&&!(this._mipmapLevel<=t)){var n=this._getGFXDevice();if(n){var r=Bp[0];r.texExtent.width=this._textureWidth>>t,r.texExtent.height=this._textureHeight>>t,r.texSubres.mipLevel=t,r.texSubres.baseArrayLayer=i,ArrayBuffer.isView(e)?n.copyBuffersToTexture([e],this._gfxTexture,Bp):n.copyTexImagesToTexture([e],this._gfxTexture,Bp)}}},i._assignImage=function(e,t,i){var n=e.data;if(n&&(this.uploadData(n,t,i),this._checkTextureLoaded(),Rt.CLEANUP_IMAGE_CACHE)){var r=Fp.getDeps(this._uuid),s=r.indexOf(e._uuid);-1!==s&&(ut(r,s),e.decRef())}},i._checkTextureLoaded=function(){this._textureReady()},i._textureReady=function(){this.loaded=!0,this.emit("load")},i._setMipmapLevel=function(e){this._mipmapLevel=e<1?1:e},i._setMipRange=function(e,t){this._baseLevel=e<1?0:e,this._maxLevel=t<1?0:t},i.setMipRange=function(e,t){ee(e<=t,3124),this._setMipRange(e,t);var i=this._getGFXDevice();if(i){var n=this._createTextureView(i);this._tryDestroyTextureView(),this._gfxTextureView=n}},i._getGfxTextureCreateInfo=function(){return null},i._getGfxTextureViewCreateInfo=function(){return null},i._tryReset=function(){if(this._tryDestroyTextureView(),this._tryDestroyTexture(),0!==this._mipmapLevel){var e=this._getGFXDevice();e&&(this._createTexture(e),this._gfxTextureView=this._createTextureView(e))}},i.isUsingOfflineMipmaps=function(){return!1},i._createTexture=function(e){if(0!==this._width&&0!==this._height){var t=jc.NONE;this._mipFilter!==Jd.NONE&&function(e,t,i){return!(e.gfxAPI===Lc.WEBGL)||Up(t)&&Up(i)}(e,this._width,this._height)&&(this._mipmapLevel=function(e,t){for(var i=Math.max(e,t),n=0;i;)i>>=1,n++;return n}(this._width,this._height),this.isUsingOfflineMipmaps()||this.isCompressed||(t=jc.GEN_MIPMAP));var i=this._getGfxTextureCreateInfo({usage:Wc.SAMPLED|Wc.TRANSFER_DST,format:this._getGFXFormat(),levelCount:this._mipmapLevel,flags:t});if(i){var n=e.createTexture(i);this._textureWidth=i.width,this._textureHeight=i.height,this._gfxTexture=n}}},i._createTextureView=function(e){if(!this._gfxTexture)return null;var t=this._maxLevel<this._mipmapLevel?this._maxLevel:this._mipmapLevel-1,i=this._getGfxTextureViewCreateInfo({texture:this._gfxTexture,format:this._getGFXFormat(),baseLevel:this._baseLevel,levelCount:t-this._baseLevel+1});return i?e.createTexture(i):null},i._tryDestroyTexture=function(){this._gfxTexture&&(this._gfxTexture.destroy(),this._gfxTexture=null)},i._tryDestroyTextureView=function(){this._gfxTextureView&&(this._gfxTextureView.destroy(),this._gfxTextureView=null)},n(t,[{key:"mipmapLevel",get:function(){return this._mipmapLevel}}]),t}(wf))||Dp;v.SimpleTexture=Wp;var jp=[],Xp=e("bx",(Gp=Gs("cc.Texture2D"),kp=va([Ef]),Gp((zp=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._mipmaps=Vp&&Vp(),t}s(t,e);var i=t.prototype;return i._setMipmapParams=function(e){var t=this;if(this._mipmaps=e,this._setMipmapLevel(this._mipmaps.length),this._mipmaps.length>0){var i=this._mipmaps[0];this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._mipmaps.forEach((function(e,i){t._assignImage(e,i)}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})},i.initialize=function(){this.mipmaps=this._mipmaps},i.onLoaded=function(){this.initialize()},i.reset=function(e){this._width=e.width,this._height=e.height,this._setGFXFormat(e.format);var t=void 0===e.mipmapLevel?1:e.mipmapLevel;this._setMipmapLevel(t);var i=void 0===e.baseLevel?0:e.baseLevel,n=void 0===e.maxLevel?1e3:e.maxLevel;this._setMipRange(i,n),this._tryReset()},i.create=function(e,t,i,n,r,s){void 0===i&&(i=Qd.RGBA8888),void 0===n&&(n=1),void 0===r&&(r=0),void 0===s&&(s=1e3),this.reset({width:e,height:t,format:i,mipmapLevel:n,baseLevel:r,maxLevel:s})},i.toString=function(){return 0!==this._mipmaps.length?this._mipmaps[0].url:""},i.updateMipmaps=function(e,t){if(void 0===e&&(e=0),!(e>=this._mipmaps.length))for(var i=Math.min(void 0===t?this._mipmaps.length:t,this._mipmaps.length-e),n=0;n<i;++n){var r=e+n;this._assignImage(this._mipmaps[r],r)}},i.getHtmlElementObj=function(){return this._mipmaps[0]&&this._mipmaps[0].data instanceof HTMLElement?this._mipmaps[0].data:null},i.destroy=function(){return this._mipmaps=[],e.prototype.destroy.call(this)},i.description=function(){return"<cc.Texture2D | Name = "+(this._mipmaps[0]?this._mipmaps[0].url:"")+" | Dimension = "+this.width+" x "+this.height+">"},i.releaseTexture=function(){this.destroy()},i._serialize=function(){return null},i._deserialize=function(t,i){var n=t;e.prototype._deserialize.call(this,n.base,i),this._mipmaps=new Array(n.mipmaps.length);for(var r=0;r<n.mipmaps.length;++r)if(this._mipmaps[r]=new Ef,n.mipmaps[r]){var s=n.mipmaps[r];i.result.push(this._mipmaps,""+r,s,rt(Ef))}},i._getGfxTextureCreateInfo=function(e){var t=new Wl(Vc.TEX2D);return t.width=this._width,t.height=this._height,Object.assign(t,e),t},i._getGfxTextureViewCreateInfo=function(e){var t=new jl;return t.type=Vc.TEX2D,Object.assign(t,e),t},i.initDefault=function(t){e.prototype.initDefault.call(this,t);var i=new Ef;i.initDefault(),this.image=i},i.validate=function(){return this.mipmaps&&0!==this.mipmaps.length},n(t,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(e){if(e.length>0&&e[0].mipmapLevelDataSize&&e[0].mipmapLevelDataSize.length>0){jp.length=0;for(var t=e[0].mipmapLevelDataSize,i=e[0].data,n=e[0].width,r=e[0].height,s=e[0].format,a=0,o=0;o<t.length;o++){var u=new Uint8Array(i.buffer,a,t[o]),h=new Uint8Array(t[o]);h.set(u),jp[o]=new Ef({_data:h,_compressed:!0,width:n,height:r,format:s,mipmapLevelDataSize:[]}),jp[o]._uuid=e[0]._uuid,this.setMipFilter(Jd.LINEAR),a+=t[o]}this._setMipmapParams(jp)}else this._setMipmapParams(e)}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(e){this.mipmaps=e?[e]:[]}}]),t}(Wp),Vp=Cs(zp.prototype,"_mipmaps",[kp],(function(){return[]})),Hp=zp))||Hp));v.Texture2D=Xp;var Kp={NONE:0,IGNORE_RAYCAST:1<<20,GIZMOS:1<<21,EDITOR:1<<22,UI_3D:1<<23,SCENE_GIZMO:1<<24,UI_2D:1<<25,PROFILER:1<<28,DEFAULT:1<<30,ALL:4294967295},Yp=e("dc",function(){function e(){}return e.init=function(){var t=St.querySettings(At.Category.ENGINE,"customLayers");if(t)for(var i=0;i<t.length;i++){var n=t[i];e.addLayer(n.name,n.bit)}},e.makeMaskInclude=function(e){for(var t,i=0,n=d(e);!(t=n()).done;)i|=t.value;return i},e.makeMaskExclude=function(t){return~e.makeMaskInclude(t)},e.addLayer=function(t,i){if(void 0!==i)if(i>19||i<0)console.warn("maximum layers reached.");else{var n=1<<i;e.Enum[t],te(2104,t),e.Enum[t]=n,we(e.Enum,String(n),t),e.BitMask[t]=n,we(e.BitMask,String(n),t)}else console.warn("bitNum can't be undefined")},e.deleteLayer=function(t){if(t>19||t<0)console.warn("do not change buildin layers.");else{var i=1<<t;delete e.Enum[e.Enum[i]],delete e.Enum[i],delete e.BitMask[e.BitMask[i]],delete e.BitMask[i]}},e.nameToLayer=function(t){return void 0===t?(console.warn("name can't be undefined"),-1):S(e.Enum[t])},e.layerToName=function(t){return t>31||t<0?(console.warn("Unable to access unknown layer."),""):e.Enum[1<<t]},e}());Yp.Enum=mt(Kp),Yp.BitMask=pt(r({},Kp)),v.Layers=Yp;var qp,Qp,Zp=function(){function e(e){this._uiComp=null,this._opacity=1,this._localOpacity=1,this.colorDirty=!0,this._uiTransformComp=null,this._node=void 0,this._node=e}return e.prototype.applyOpacity=function(e){this._opacity=this._localOpacity*e},e.markOpacityTree=function(){},n(e,[{key:"uiTransformComp",get:function(){return this._uiTransformComp||(this._uiTransformComp=this._node.getComponent("cc.UITransform")),this._uiTransformComp},set:function(e){this._uiTransformComp=e}},{key:"uiComp",get:function(){return this._uiComp},set:function(e){this._uiComp&&e?q(12002):this._uiComp=e}},{key:"opacity",get:function(){return this._opacity}},{key:"localOpacity",get:function(){return this._localOpacity},set:function(e){this._localOpacity=e,this.colorDirty=!0}}]),e}();Ba.Flags.Destroying,function(e){e[e.LOCAL=0]="LOCAL",e[e.WORLD=1]="WORLD"}(qp||(qp=e("h9",{}))),function(e){e[e.NONE=0]="NONE",e[e.POSITION=1]="POSITION",e[e.ROTATION=2]="ROTATION",e[e.SCALE=4]="SCALE",e[e.RS=e.ROTATION|e.SCALE]="RS",e[e.TRS=e.POSITION|e.ROTATION|e.SCALE]="TRS",e[e.TRS_MASK=~e.TRS]="TRS_MASK"}(Qp||(Qp=e("dC",{}))),v.internal.TransformBit=Qp;var Jp,$p,em,tm,im,nm,rm,sm,am,om,um,hm,cm,lm,_m,dm,fm,pm,mm,gm=e("ed",mt({Static:0,Stationary:1,Movable:2}));!function(e){e.TOUCH_START="touch-start",e.TOUCH_MOVE="touch-move",e.TOUCH_END="touch-end",e.TOUCH_CANCEL="touch-cancel",e.MOUSE_DOWN="mouse-down",e.MOUSE_MOVE="mouse-move",e.MOUSE_UP="mouse-up",e.MOUSE_WHEEL="mouse-wheel",e.MOUSE_ENTER="mouse-enter",e.MOUSE_LEAVE="mouse-leave",e.KEY_DOWN="keydown",e.KEY_UP="keyup",e.DEVICEMOTION="devicemotion",e.TRANSFORM_CHANGED="transform-changed",e.MOBILITY_CHANGED="mobility-changed",e.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",e.SIZE_CHANGED="size-changed",e.ANCHOR_CHANGED="anchor-changed",e.COLOR_CHANGED="color-changed",e.CHILD_ADDED="child-added",e.CHILD_REMOVED="child-removed",e.PARENT_CHANGED="parent-changed",e.NODE_DESTROYED="node-destroyed",e.LAYER_CHANGED="layer-changed",e.SIBLING_ORDER_CHANGED="sibling-order-changed",e.ACTIVE_IN_HIERARCHY_CHANGED="active-in-hierarchy-changed",e.COMPONENT_ADDED="component-added",e.COMPONENT_REMOVED="component-removed",e.LIGHT_PROBE_CHANGED="light-probe-changed"}(Jp||(Jp=e("cX",{})));var vm=Ba.Flags.Destroying,ym=Ba.Flags.DontDestroy,Em=Ba.Flags.Deactivating,Tm=new ge("Node");function Am(e){return e?"string"==typeof e?it(e):e:(Z(3804),null)}var Sm,Rm,wm,Im,bm,Om,Nm,Cm,Mm,Pm,Lm=new Ki,xm=new Ki,Dm=new _n,Fm=new _n,Bm=new _n,Um=new hn,Gm=(new hn,new En),km=new En,Hm=[],zm=Symbol("ReserveContentsForAllSyncablePrefab"),Vm=0,Wm=e("dT",($p=Gs("cc.Node"),em=va(Ki),tm=va(gm),$p((mm=pm=function(e){s(i,e),i._setScene=function(e){e._updateScene()},i._findComponent=function(e,t){var i=t,n=e._components;if(i._sealed)for(var r=0;r<n.length;++r){var s=n[r];if(s.constructor===t)return s}else for(var a=0;a<n.length;++a){var o=n[a];if(o instanceof t)return o}return null},i._findComponents=function(e,t,i){var n=t,r=e._components;if(n._sealed)for(var s=0;s<r.length;++s){var a=r[s];a.constructor===t&&i.push(a)}else for(var o=0;o<r.length;++o){var u=r[o];u instanceof t&&i.push(u)}},i._findChildComponent=function(e,t){for(var n=0;n<e.length;++n){var r=e[n],s=i._findComponent(r,t);if(s)return s;if(r._children.length>0&&(s=i._findChildComponent(r._children,t)))return s}return null},i._findChildComponents=function(e,t,n){for(var r=0;r<e.length;++r){var s=e[r];i._findComponents(s,t,n),s._children.length>0&&i._findChildComponents(s._children,t,n)}};var t=i.prototype;function i(t){var i;return(i=e.call(this,t)||this)._parent=rm&&rm(),i._children=sm&&sm(),i._active=am&&am(),i._components=om&&om(),i._prefab=um&&um(),i._scene=null,i._activeInHierarchy=!1,i._id=Tm.getNewId(),i._name=void 0,i._eventProcessor=new v.NodeEventProcessor(l(i)),i._eventMask=0,i._siblingIndex=0,i._originalSceneId="",i._uiProps=new Zp(l(i)),i._static=!1,i._lpos=hm&&hm(),i._lrot=cm&&cm(),i._lscale=lm&&lm(),i._mobility=_m&&_m(),i._layer=dm&&dm(),i._euler=fm&&fm(),i._dirtyFlags=Qp.NONE,i._eulerDirty=!1,i._flagChangeVersion=0,i._hasChangedFlags=0,i._name=void 0!==t?t:"New Node",i._pos=new Ki,i._rot=new _n,i._scale=new Ki(1,1,1),i._mat=new En,i}return t._updateScene=function(){null==this._parent?k("Node %s(%s) has not attached to a scene.",this.name,this.uuid):this._scene=this._parent._scene},t.attr=function(e){ke(this,e)},t.getParent=function(){return this._parent},t.setParent=function(e,t){if(void 0===t&&(t=!1),t&&this.updateWorldTransform(),this._parent!==e){var i=this._parent,n=e;if(this._parent=n,this._siblingIndex=0,this._onSetParent(i,t),this.emit&&this.emit(Jp.PARENT_CHANGED,i),i&&!(i._objFlags&vm)){var r=i._children.indexOf(this);i._children.splice(r,1),i._updateSiblingIndex(),i.emit&&i.emit(Jp.CHILD_REMOVED,this)}n&&(n._children.push(this),this._siblingIndex=n._children.length-1,n.emit&&n.emit(Jp.CHILD_ADDED,this)),this._onHierarchyChanged(i)}},t.getChildByUuid=function(e){if(!e)return U("Invalid uuid"),null;for(var t=this._children,i=0,n=t.length;i<n;i++)if(t[i]._id===e)return t[i];return null},t.getChildByName=function(e){if(!e)return U("Invalid name"),null;for(var t=this._children,i=0,n=t.length;i<n;i++)if(t[i]._name===e)return t[i];return null},t.getChildByPath=function(e){for(var t=e.split("/"),i=this,n=function(e){var n=t[e];if(0===n.length)return"continue";var r=i.children.find((function(e){return e.name===n}));if(!r)return{v:null};i=r},r=0;r<t.length;++r){var s=n(r);if("continue"!==s&&"object"==typeof s)return s.v}return i},t.addChild=function(e){e.setParent(this)},t.insertChild=function(e,t){e.setParent(this),e.setSiblingIndex(t)},t.getSiblingIndex=function(){return this._siblingIndex},t.setSiblingIndex=function(e){if(this._parent)if(this._parent._objFlags&Em)Z(3821);else{var t=this._parent._children;e=-1!==e?e:t.length-1;var i=t.indexOf(this);e!==i&&(t.splice(i,1),e<t.length?t.splice(e,0,this):t.push(this),this._parent._updateSiblingIndex(),this._onSiblingIndexChanged&&this._onSiblingIndexChanged(e))}},t.walk=function(e,t){var n=1,r=null,s=null,a=0,o=i._stacks[i._stackId];o||(o=[],i._stacks.push(o)),i._stackId++,o.length=0,o[0]=this;for(var u=null,h=!1;n;)if(s=o[--n])if(!h&&e?e(s):h&&t&&t(s),o[n]=null,h){if(u===this._parent)break;if(h=!1,r)if(r[++a])o[n]=r[a],n++;else if(u&&(o[n]=u,n++,h=!0,u._parent?(a=(r=u._parent._children).indexOf(u),u=u._parent):(u=null,r=null),a<0))break}else s._children.length>0?(u=s,r=s._children,a=0,o[n]=r[a],n++):(o[n]=s,n++,h=!0);o.length=0,i._stackId--},t.removeFromParent=function(){this._parent&&this._parent.removeChild(this)},t.removeChild=function(e){this._children.indexOf(e)>-1&&(e.parent=null)},t.removeAllChildren=function(){for(var e=this._children,t=e.length-1;t>=0;t--){var i=e[t];i&&(i.parent=null)}this._children.length=0},t.isChildOf=function(e){var t=this;do{if(t===e)return!0;t=t._parent}while(t);return!1},t.getComponent=function(e){var t=Am(e);return t?i._findComponent(this,t):null},t.getComponents=function(e){var t=Am(e),n=[];return t&&i._findComponents(this,t,n),n},t.getComponentInChildren=function(e){var t=Am(e);return t?i._findChildComponent(this._children,t):null},t.getComponentsInChildren=function(e){var t=Am(e),n=[];return t&&(i._findComponents(this,t,n),i._findChildComponents(this._children,t,n)),n},t.addComponent=function(e){var t;if("string"==typeof e){if(!(t=it(e)))throw v._RF.peek()&&Z(3808,e),TypeError(te(3807,e))}else{if(!e)throw TypeError(te(3804));t=e}if("function"!=typeof t)throw TypeError(te(3809));if(!Ve(t,v.Component))throw TypeError(te(3810));var i=t._requireComponent;if(i)if(Array.isArray(i))for(var n=0;n<i.length;n++){var r=i[n];this.getComponent(r)||this.addComponent(r)}else{var s=i;this.getComponent(s)||this.addComponent(s)}var a=new t;return a.node=this,this._components.push(a),this.emit(Jp.COMPONENT_ADDED,a),this._activeInHierarchy&&v.director._nodeActivator.activateComp(a),a},t.removeComponent=function(e){if(e){var t=null;(t=e instanceof Zf?e:this.getComponent(e))&&t.destroy()}else Z(3813)},t.on=function(e,t,i,n){switch(void 0===n&&(n=!1),e){case Jp.TRANSFORM_CHANGED:this._eventMask|=1}this._eventProcessor.on(e,t,i,n)},t.off=function(e,t,i,n){if(void 0===n&&(n=!1),this._eventProcessor.off(e,t,i,n),!this._eventProcessor.hasEventListener(e))switch(e){case Jp.TRANSFORM_CHANGED:this._eventMask&=-2}},t.once=function(e,t,i,n){this._eventProcessor.once(e,t,i,n)},t.emit=function(e,t,i,n,r,s){this._eventProcessor.emit(e,t,i,n,r,s)},t.dispatchEvent=function(e){this._eventProcessor.dispatchEvent(e)},t.hasEventListener=function(e,t,i){return this._eventProcessor.hasEventListener(e,t,i)},t.targetOff=function(e){this._eventProcessor.targetOff(e),1&this._eventMask&&!this._eventProcessor.hasEventListener(Jp.TRANSFORM_CHANGED)&&(this._eventMask&=-2)},t.destroy=function(){return!!e.prototype.destroy.call(this)&&(this.active=!1,!0)},t.destroyAllChildren=function(){for(var e=this._children,t=0;t<e.length;++t)e[t].destroy()},t._removeComponent=function(e){if(e){if(!(this._objFlags&vm)){var t=this._components.indexOf(e);-1!==t?(this._components.splice(t,1),this.emit(Jp.COMPONENT_REMOVED,e)):e.node!==this&&Z(3815)}}else Z(3814)},t._updateSiblingIndex=function(){for(var e=0;e<this._children.length;++e)this._children[e]._siblingIndex=e;this.emit(Jp.SIBLING_ORDER_CHANGED)},t._instantiate=function(e,t){return e||(e=v.instantiate._clone(this,this)),e._prefab,e._parent=null,e._onBatchCreated(t),e},t._onHierarchyChangedBase=function(){var e=this._parent;!this._persistNode||e instanceof v.Scene||v.game.removePersistRootNode(this);var t=this._active&&!(!e||!e._activeInHierarchy);this._activeInHierarchy!==t&&v.director._nodeActivator.activateNode(this,t)},t._onPreDestroyBase=function(){this._objFlags|=vm;var e=this._parent,t=!!e&&0!=(e._objFlags&vm);if(!t&&m&&this._registerIfAttached(!1),this._persistNode&&v.game.removePersistRootNode(this),!t&&e){this.emit(Jp.PARENT_CHANGED,this);var i=e._children.indexOf(this);e._children.splice(i,1),this._siblingIndex=0,e._updateSiblingIndex(),e.emit&&e.emit(Jp.CHILD_REMOVED,this)}this.emit(Jp.NODE_DESTROYED,this),this._eventProcessor.destroy();for(var n=this._children,r=0;r<n.length;++r)n[r]._destroyImmediate();for(var s=this._components,a=0;a<s.length;++a)s[a]._destroyImmediate();return t},i.isNode=function(e){return e instanceof i&&(e.constructor===i||!(e instanceof v.Scene))},t._onPreDestroy=function(){return this._onPreDestroyBase()},t[ja]=function(e){e.writeThis()},t._onSetParent=function(e,t){if(void 0===t&&(t=!1),this._parent&&(null!=e&&e._scene===this._parent._scene||null==this._parent._scene||this.walk(i._setScene)),t){var n=this._parent;n?(n.updateWorldTransform(),Si(En.determinant(n._mat),0,Ti)?(q(14300),this._dirtyFlags|=Qp.TRS,this.updateWorldTransform()):(En.multiply(Gm,En.invert(Gm,n._mat),this._mat),En.toRTS(Gm,this._lrot,this._lpos,this._lscale))):(Ki.copy(this._lpos,this._pos),_n.copy(this._lrot,this._rot),Ki.copy(this._lscale,this._scale)),this._eulerDirty=!0}this.invalidateChildren(Qp.TRS)},t._onHierarchyChanged=function(e){this.eventProcessor.reattach(),this._onHierarchyChangedBase(e)},t._onBatchCreated=function(e){this.hasChangedFlags=Qp.TRS,this._dirtyFlags|=Qp.TRS;for(var t=this._children.length,i=0;i<t;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(e)},t._onBeforeSerialize=function(){this.eulerAngles},t._onPostActivated=function(e){e?(this._eventProcessor.setEnabled(!0),this.invalidateChildren(Qp.TRS),this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.setTextureDirty(),this._uiProps.uiComp.markForUpdateRenderData())):this._eventProcessor.setEnabled(!1)},t.translate=function(e,t){var i=t||qp.LOCAL;if(i===qp.LOCAL)Ki.transformQuat(Lm,e,this._lrot),this._lpos.x+=Lm.x,this._lpos.y+=Lm.y,this._lpos.z+=Lm.z;else if(i===qp.WORLD)if(this._parent){_n.invert(Dm,this._parent.worldRotation),Ki.transformQuat(Lm,e,Dm);var n=this.worldScale;this._lpos.x+=Lm.x/n.x,this._lpos.y+=Lm.y/n.y,this._lpos.z+=Lm.z/n.z}else this._lpos.x+=e.x,this._lpos.y+=e.y,this._lpos.z+=e.z;this.invalidateChildren(Qp.POSITION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.POSITION)},t.rotate=function(e,t){var i=t||qp.LOCAL;if(_n.normalize(Dm,e),i===qp.LOCAL)_n.multiply(this._lrot,this._lrot,Dm);else if(i===qp.WORLD){var n=this.worldRotation;_n.multiply(Fm,Dm,n),_n.invert(Dm,n),_n.multiply(Fm,Dm,Fm),_n.multiply(this._lrot,this._lrot,Fm)}this._eulerDirty=!0,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.lookAt=function(e,t){this.getWorldPosition(Lm),Ki.subtract(Lm,Lm,e),Ki.normalize(Lm,Lm),_n.fromViewUp(Dm,Lm,t),this.setWorldRotation(Dm)},t.invalidateChildren=function(e){var t,i,n=0,r=0,s=0,a=0,o=e|Qp.POSITION;for(Hm[0]=this;n>=0;){if(a=(t=Hm[n--]).hasChangedFlags,t.isValid&&(t._dirtyFlags&a&e)!==e)for(t._dirtyFlags|=e,t.hasChangedFlags=a|e,s=(i=t._children).length,r=0;r<s;r++)Hm[++n]=i[r];e=o}},t.updateWorldTransform=function(){if(this._dirtyFlags){for(var e,t=this,i=0;t&&t._dirtyFlags;)Hm[i++]=t,t=t._parent;for(var n=0;i;){if(n|=(e=Hm[--i])._dirtyFlags,t){if(n&Qp.POSITION&&(Ki.transformMat4(e._pos,e._lpos,t._mat),e._mat.m12=e._pos.x,e._mat.m13=e._pos.y,e._mat.m14=e._pos.z),n&Qp.RS){En.fromRTS(e._mat,e._lrot,e._lpos,e._lscale),En.multiply(e._mat,t._mat,e._mat);var r=n&Qp.ROTATION?e._rot:null;En.toRTS(e._mat,r,null,e._scale)}}else n&Qp.POSITION&&(Ki.copy(e._pos,e._lpos),e._mat.m12=e._pos.x,e._mat.m13=e._pos.y,e._mat.m14=e._pos.z),n&Qp.RS&&(n&Qp.ROTATION&&_n.copy(e._rot,e._lrot),n&Qp.SCALE&&(Ki.copy(e._scale,e._lscale),En.fromRTS(e._mat,e._rot,e._pos,e._scale)));e._dirtyFlags=Qp.NONE,t=e}}},t.setPosition=function(e,t,i){void 0===t&&void 0===i?Ki.copy(this._lpos,e):void 0===i?Ki.set(this._lpos,e,t,this._lpos.z):Ki.set(this._lpos,e,t,i),this.invalidateChildren(Qp.POSITION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.POSITION)},t.getPosition=function(e){return e?Ki.set(e,this._lpos.x,this._lpos.y,this._lpos.z):Ki.copy(new Ki,this._lpos)},t.setRotation=function(e,t,i,n){void 0===t||void 0===i||void 0===n?_n.copy(this._lrot,e):_n.set(this._lrot,e,t,i,n),this._eulerDirty=!0,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.setRotationFromEuler=function(e,t,i){var n=void 0===i?this._euler.z:i;void 0===t?(Ki.copy(this._euler,e),_n.fromEuler(this._lrot,e.x,e.y,e.z)):(Ki.set(this._euler,e,t,n),_n.fromEuler(this._lrot,e,t,n)),this._eulerDirty=!1,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.getRotation=function(e){return e?_n.set(e,this._lrot.x,this._lrot.y,this._lrot.z,this._lrot.w):_n.copy(new _n,this._lrot)},t.setScale=function(e,t,i){void 0===t&&void 0===i?Ki.copy(this._lscale,e):void 0===i?Ki.set(this._lscale,e,t,this._lscale.z):Ki.set(this._lscale,e,t,i),this.invalidateChildren(Qp.SCALE),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.SCALE)},t.getScale=function(e){return e?Ki.set(e,this._lscale.x,this._lscale.y,this._lscale.z):Ki.copy(new Ki,this._lscale)},t.inverseTransformPoint=function(e,t){Ki.copy(e,t);for(var i=this,n=0;i._parent;)Hm[n++]=i,i=i._parent;for(;n>=0;)Ki.transformInverseRTS(e,e,i._lrot,i._lpos,i._lscale),i=Hm[--n];return e},t.setWorldPosition=function(e,t,i){void 0===t||void 0===i?Ki.copy(this._pos,e):Ki.set(this._pos,e,t,i);var n=this._parent,r=this._lpos;n?(n.updateWorldTransform(),Ki.transformMat4(r,this._pos,En.invert(Gm,n._mat))):Ki.copy(r,this._pos),this.invalidateChildren(Qp.POSITION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.POSITION)},t.getWorldPosition=function(e){return this.updateWorldTransform(),e?Ki.copy(e,this._pos):Ki.copy(new Ki,this._pos)},t.setWorldRotation=function(e,t,i,n){void 0===t||void 0===i||void 0===n?_n.copy(this._rot,e):_n.set(this._rot,e,t,i,n),this._parent?(this._parent.updateWorldTransform(),_n.multiply(this._lrot,_n.conjugate(this._lrot,this._parent._rot),this._rot)):_n.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.setWorldRotationFromEuler=function(e,t,i){_n.fromEuler(this._rot,e,t,i),this._parent?(this._parent.updateWorldTransform(),_n.multiply(this._lrot,_n.conjugate(this._lrot,this._parent._rot),this._rot)):_n.copy(this._lrot,this._rot),this._eulerDirty=!0,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)},t.getWorldRotation=function(e){return this.updateWorldTransform(),e?_n.copy(e,this._rot):_n.copy(new _n,this._rot)},t.setWorldScale=function(e,t,i){var n=this._parent;n&&this.updateWorldTransform(),void 0===t||void 0===i?Ki.copy(this._scale,e):Ki.set(this._scale,e,t,i),n?(Lm.x=this._scale.x/Ki.set(xm,this._mat.m00,this._mat.m01,this._mat.m02).length(),Lm.y=this._scale.y/Ki.set(xm,this._mat.m04,this._mat.m05,this._mat.m06).length(),Lm.z=this._scale.z/Ki.set(xm,this._mat.m08,this._mat.m09,this._mat.m10).length(),En.scale(Gm,this._mat,Lm),En.multiply(km,En.invert(km,n._mat),Gm),hn.fromQuat(Um,_n.conjugate(Bm,this._lrot)),hn.multiplyMat4(Um,Um,km),this._lscale.x=Ki.set(Lm,Um.m00,Um.m01,Um.m02).length(),this._lscale.y=Ki.set(Lm,Um.m03,Um.m04,Um.m05).length(),this._lscale.z=Ki.set(Lm,Um.m06,Um.m07,Um.m08).length()):Ki.copy(this._lscale,this._scale),this.invalidateChildren(Qp.SCALE),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.SCALE)},t.getWorldScale=function(e){return this.updateWorldTransform(),e?Ki.copy(e,this._scale):Ki.copy(new Ki,this._scale)},t.getWorldMatrix=function(e){this.updateWorldTransform();var t=e||new En;return En.copy(t,this._mat)},t.getWorldRS=function(e){this.updateWorldTransform();var t=e||new En;return En.copy(t,this._mat),t.m12=0,t.m13=0,t.m14=0,t},t.getWorldRT=function(e){this.updateWorldTransform();var t=e||new En;return En.fromRT(t,this._rot,this._pos)},t.setRTS=function(e,t,i){var n=0;e&&(n|=Qp.ROTATION,void 0!==e.w?(_n.copy(this._lrot,e),this._eulerDirty=!0):(Ki.copy(this._euler,e),_n.fromEuler(this._lrot,e.x,e.y,e.z),this._eulerDirty=!1)),t&&(Ki.copy(this._lpos,t),n|=Qp.POSITION),i&&(Ki.copy(this._lscale,i),n|=Qp.SCALE),n&&(this.invalidateChildren(n),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,n))},t.pauseSystemEvents=function(e){this._eventProcessor.setEnabled(!1,e)},t.resumeSystemEvents=function(e){this._eventProcessor.setEnabled(!0,e)},i.resetHasChangedFlags=function(){Vm+=1},i.clearNodeArray=function(){i.ClearFrame<i.ClearRound&&!m?i.ClearFrame++:(i.ClearFrame=0,Hm.length=0)},t.getPathInHierarchy=function(){for(var e=this.name,t=this.parent;t&&!(t instanceof v.Scene);)e=t.name+"/"+e,t=t.parent;return e},n(i,[{key:"components",get:function(){return this._components}},{key:"_persistNode",get:function(){return(this._objFlags&ym)>0},set:function(e){e?this._objFlags|=ym:this._objFlags&=~ym}},{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"uuid",get:function(){return this._id}},{key:"children",get:function(){return this._children}},{key:"active",get:function(){return this._active},set:function(e){if(e=!!e,this._active!==e){this._active=e;var t=this._parent;t&&t._activeInHierarchy&&v.director._nodeActivator.activateNode(this,e)}}},{key:"activeInHierarchy",get:function(){return this._activeInHierarchy}},{key:"parent",get:function(){return this._parent},set:function(e){this.setParent(e)}},{key:"scene",get:function(){return this._scene}},{key:"eventProcessor",get:function(){return this._eventProcessor}},{key:"position",get:function(){return this._lpos},set:function(e){this.setPosition(e)}},{key:"worldPosition",get:function(){return this.updateWorldTransform(),this._pos},set:function(e){this.setWorldPosition(e)}},{key:"rotation",get:function(){return this._lrot},set:function(e){this.setRotation(e)}},{key:"eulerAngles",get:function(){return this._eulerDirty&&(_n.toEuler(this._euler,this._lrot),this._eulerDirty=!1),this._euler},set:function(e){this.setRotationFromEuler(e.x,e.y,e.z)}},{key:"angle",get:function(){return this._euler.z},set:function(e){Ki.set(this._euler,0,0,e),_n.fromAngleZ(this._lrot,e),this._eulerDirty=!1,this.invalidateChildren(Qp.ROTATION),1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.ROTATION)}},{key:"worldRotation",get:function(){return this.updateWorldTransform(),this._rot},set:function(e){this.setWorldRotation(e)}},{key:"scale",get:function(){return this._lscale},set:function(e){this.setScale(e)}},{key:"worldScale",get:function(){return this.updateWorldTransform(),this._scale},set:function(e){this.setWorldScale(e)}},{key:"matrix",set:function(e){En.toRTS(e,this._lrot,this._lpos,this._lscale),this.invalidateChildren(Qp.TRS),this._eulerDirty=!0,1&this._eventMask&&this.emit(Jp.TRANSFORM_CHANGED,Qp.TRS)}},{key:"worldMatrix",get:function(){return this.updateWorldTransform(),this._mat}},{key:"forward",get:function(){return Ki.transformQuat(new Ki,Ki.FORWARD,this.worldRotation)},set:function(e){var t=e.length();Ki.multiplyScalar(Lm,e,-1/t),_n.fromViewUp(Dm,Lm),this.setWorldRotation(Dm)}},{key:"up",get:function(){return Ki.transformQuat(new Ki,Ki.UP,this.worldRotation)}},{key:"right",get:function(){return Ki.transformQuat(new Ki,Ki.RIGHT,this.worldRotation)}},{key:"mobility",get:function(){return this._mobility},set:function(e){this._mobility=e,this.emit(Jp.MOBILITY_CHANGED)}},{key:"layer",get:function(){return this._layer},set:function(e){this._layer=e,this._uiProps&&this._uiProps.uiComp&&(this._uiProps.uiComp.setNodeDirty(),this._uiProps.uiComp.markForUpdateRenderData()),this.emit(Jp.LAYER_CHANGED,this._layer)}},{key:"hasChangedFlags",get:function(){return this._flagChangeVersion===Vm?this._hasChangedFlags:0},set:function(e){this._flagChangeVersion=Vm,this._hasChangedFlags=e}}]),i}(Ba),pm.idGenerator=Tm,pm._stacks=[[]],pm._stackId=0,pm.EventType=Jp,pm.NodeSpace=qp,pm.TransformDirtyBit=Qp,pm.TransformBit=Qp,pm.reserveContentsForAllSyncablePrefabTag=zm,pm.ClearFrame=0,pm.ClearRound=1e3,f((nm=mm).prototype,"_persistNode",[Vs],Object.getOwnPropertyDescriptor(nm.prototype,"_persistNode"),nm.prototype),rm=Cs(nm.prototype,"_parent",[Ys],(function(){return null})),sm=Cs(nm.prototype,"_children",[Ys],(function(){return[]})),am=Cs(nm.prototype,"_active",[Ys],(function(){return!0})),om=Cs(nm.prototype,"_components",[Ys],(function(){return[]})),um=Cs(nm.prototype,"_prefab",[Ys],(function(){return null})),hm=Cs(nm.prototype,"_lpos",[Ys],(function(){return new Ki})),cm=Cs(nm.prototype,"_lrot",[Ys],(function(){return new _n})),lm=Cs(nm.prototype,"_lscale",[Ys],(function(){return new Ki(1,1,1)})),_m=Cs(nm.prototype,"_mobility",[Ys],(function(){return gm.Static})),dm=Cs(nm.prototype,"_layer",[Ys],(function(){return Yp.Enum.DEFAULT})),fm=Cs(nm.prototype,"_euler",[Ys],(function(){return new Ki})),f(nm.prototype,"eulerAngles",[em],Object.getOwnPropertyDescriptor(nm.prototype,"eulerAngles"),nm.prototype),f(nm.prototype,"mobility",[tm],Object.getOwnPropertyDescriptor(nm.prototype,"mobility"),nm.prototype),im=nm))||im));v.Node=Wm,function(e){e[e.right=0]="right",e[e.left=1]="left",e[e.top=2]="top",e[e.bottom=3]="bottom",e[e.front=4]="front",e[e.back=5]="back"}(Mm||(Mm={})),function(e){e[e.NONE=0]="NONE",e[e.AUTO=1]="AUTO",e[e.BAKED_CONVOLUTION_MAP=2]="BAKED_CONVOLUTION_MAP"}(Pm||(Pm={}));var jm=e("hs",Gs("cc.TextureCube")((Cm=Nm=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).isRGBE=wm&&wm(),t._mipmapAtlas=Im&&Im(),t._mipmapMode=bm&&bm(),t._mipmaps=Om&&Om(),t}s(t,e);var i=t.prototype;return i.isUsingOfflineMipmaps=function(){return this._mipmapMode===Pm.BAKED_CONVOLUTION_MAP},t.fromTexture2DArray=function(e,i){for(var n=[],r=e.length/6,s=0;s<r;s++){var a=6*s;n.push({front:e[a+Mm.front].image,back:e[a+Mm.back].image,left:e[a+Mm.left].image,right:e[a+Mm.right].image,top:e[a+Mm.top].image,bottom:e[a+Mm.bottom].image})}return(i=i||new t).mipmaps=n,i},i.onLoaded=function(){this._mipmapMode===Pm.BAKED_CONVOLUTION_MAP?this.mipmapAtlas=this._mipmapAtlas:this.mipmaps=this._mipmaps},i.reset=function(e){this._width=e.width,this._height=e.height,this._setGFXFormat(e.format);var t=void 0===e.mipmapLevel?1:e.mipmapLevel;this._setMipmapLevel(t);var i=void 0===e.baseLevel?0:e.baseLevel,n=void 0===e.maxLevel?1e3:e.maxLevel;this._setMipRange(i,n),this._tryReset()},i.updateMipmaps=function(e,t){var i=this;if(void 0===e&&(e=0),!(e>=this._mipmaps.length))for(var n=Math.min(void 0===t?this._mipmaps.length:t,this._mipmaps.length-e),r=function(t){var n=e+t;Xm(i._mipmaps[n],(function(e,t){i._assignImage(e,n,t)}))},s=0;s<n;++s)r(s)},i.destroy=function(){return this._mipmaps=[],this._mipmapAtlas=null,e.prototype.destroy.call(this)},i.releaseTexture=function(){this.mipmaps=[],this._mipmapAtlas=null},i._serialize=function(){return null},i._deserialize=function(t,i){var n=t;if(e.prototype._deserialize.call(this,n.base,i),this.isRGBE=n.rgbe,this._mipmapMode=n.mipmapMode,this._mipmapMode===Pm.BAKED_CONVOLUTION_MAP){var r=n.mipmapAtlas,s=n.mipmapLayout;this._mipmapAtlas={atlas:{},layout:s},this._mipmapAtlas.atlas={front:new Ef,back:new Ef,left:new Ef,right:new Ef,top:new Ef,bottom:new Ef};var a=rt(Ef);i.result.push(this._mipmapAtlas.atlas,"front",r.front,a),i.result.push(this._mipmapAtlas.atlas,"back",r.back,a),i.result.push(this._mipmapAtlas.atlas,"left",r.left,a),i.result.push(this._mipmapAtlas.atlas,"right",r.right,a),i.result.push(this._mipmapAtlas.atlas,"top",r.top,a),i.result.push(this._mipmapAtlas.atlas,"bottom",r.bottom,a)}else{this._mipmaps=new Array(n.mipmaps.length);for(var o=0;o<n.mipmaps.length;++o){this._mipmaps[o]={front:new Ef,back:new Ef,left:new Ef,right:new Ef,top:new Ef,bottom:new Ef};var u=n.mipmaps[o],h=rt(Ef);i.result.push(this._mipmaps[o],"front",u.front,h),i.result.push(this._mipmaps[o],"back",u.back,h),i.result.push(this._mipmaps[o],"left",u.left,h),i.result.push(this._mipmaps[o],"right",u.right,h),i.result.push(this._mipmaps[o],"top",u.top,h),i.result.push(this._mipmaps[o],"bottom",u.bottom,h)}}},i._getGfxTextureCreateInfo=function(e){var t=new Wl(Vc.CUBE);return t.width=this._width,t.height=this._height,t.layerCount=6,Object.assign(t,e),t},i._getGfxTextureViewCreateInfo=function(e){var t=new jl;return t.type=Vc.CUBE,t.baseLayer=0,t.layerCount=6,Object.assign(t,e),t},i._uploadAtlas=function(){var e=this,t=this._mipmapAtlas.layout,i=t[0];this.reset({width:i.width,height:i.height,format:this._mipmapAtlas.atlas.front.format,mipmapLevel:t.length}),Xm(this._mipmapAtlas.atlas,(function(i,n){var r=new Xp;r.image=i,r.reset({width:i.width,height:i.height,format:i.format}),r.uploadData(i.data);for(var s=0;s<t.length;s++){var a=t[s],o=new Uint8Array(4*a.width*a.height),u=new Ll;u.texOffset.x=a.left,u.texOffset.y=a.top,u.texExtent.width=a.width,u.texExtent.height=a.height,e._getGFXDevice().copyTextureToBuffers(r.getGFXTexture(),[o],[u]);var h=new Ef({_data:o,_compressed:i.isCompressed,width:a.width,height:a.height,format:i.format});e._assignImage(h,a.level,n)}}))},i.initDefault=function(t){e.prototype.initDefault.call(this,t);var i=new Ef;i.initDefault(),this.mipmaps=[{front:i,back:i,top:i,bottom:i,left:i,right:i}]},i.validate=function(){if(this._mipmapMode===Pm.BAKED_CONVOLUTION_MAP){if(null===this.mipmapAtlas||0===this.mipmapAtlas.layout.length)return!1;var e=this.mipmapAtlas.atlas;return!!(e.top&&e.bottom&&e.front&&e.back&&e.left&&e.right)}return 0!==this._mipmaps.length&&!this._mipmaps.find((function(e){return!(e.top&&e.bottom&&e.front&&e.back&&e.left&&e.right)}))},n(t,[{key:"mipmaps",get:function(){return this._mipmaps},set:function(e){var t=this;if(this._mipmaps=e,this._setMipmapLevel(this._mipmaps.length),this._mipmaps.length>0){var i=this._mipmaps[0].front;this.reset({width:i.width,height:i.height,format:i.format,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel}),this._mipmaps.forEach((function(e,i){Xm(e,(function(e,n){t._assignImage(e,i,n)}))}))}else this.reset({width:0,height:0,mipmapLevel:this._mipmaps.length,baseLevel:this._baseLevel,maxLevel:this._maxLevel})}},{key:"mipmapAtlas",get:function(){return this._mipmapAtlas},set:function(e){var t=this;if(this._mipmapAtlas=e,this._mipmapAtlas){var i=this._mipmapAtlas.atlas.front;if(i.data){var n=this._mipmapAtlas.atlas,r=this._mipmapAtlas.layout,s=r[0],a=Object.assign(E.document.createElement("canvas"),{width:i.width,height:i.height}).getContext("2d");this.reset({width:s.width,height:s.height,format:i.format,mipmapLevel:r.length});for(var o=function(e){var s=r[e];Xm(n,(function(e,n){a.clearRect(0,0,i.width,i.height);var r=e.data;a.drawImage(r,0,0);var o=a.getImageData(s.left,s.top,s.width,s.height),u=new Ef({_data:o.data,_compressed:e.isCompressed,width:o.width,height:o.height,format:e.format});t._assignImage(u,s.level,n)}))},u=0;u<r.length;u++)o(u)}}else this.reset({width:0,height:0,mipmapLevel:0})}},{key:"image",get:function(){return 0===this._mipmaps.length?null:this._mipmaps[0]},set:function(e){this.mipmaps=e?[e]:[]}}]),t}(Wp),Nm.FaceIndex=Mm,wm=Cs((Rm=Cm).prototype,"isRGBE",[Ys],(function(){return!1})),Im=Cs(Rm.prototype,"_mipmapAtlas",[Ys],(function(){return null})),bm=Cs(Rm.prototype,"_mipmapMode",[Ys],(function(){return Pm.NONE})),Om=Cs(Rm.prototype,"_mipmaps",[Ys],(function(){return[]})),Sm=Rm))||Sm);function Xm(e,t){t(e.front,Mm.front),t(e.back,Mm.back),t(e.left,Mm.left),t(e.right,Mm.right),t(e.top,Mm.top),t(e.bottom,Mm.bottom)}v.TextureCube=jm;var Km=e("bM",function(){function e(){this._groundAlbedoHDR=new zi(.2,.2,.2,1),this._skyColorHDR=new zi(.2,.5,.8,1),this._skyIllumHDR=0,this._groundAlbedoLDR=new zi(.2,.2,.2,1),this._skyColorLDR=new zi(.2,.5,.8,1),this._skyIllumLDR=0,this._mipmapCount=1,this._enabled=!1}return e.prototype.initialize=function(e){this._skyColorHDR=e.skyColorHDR,this._groundAlbedoHDR.set(e.groundAlbedoHDR),this._skyIllumHDR=e.skyIllumHDR,this._skyColorLDR=e.skyColorLDR,this._groundAlbedoLDR.set(e.groundAlbedoLDR),this._skyIllumLDR=e.skyIllumLDR},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"skyColor",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR:this._skyColorLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(e):this._skyColorLDR.set(e)}},{key:"skyIllum",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=e:this._skyIllumLDR=e}},{key:"groundAlbedo",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR:this._groundAlbedoLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(e):this._groundAlbedoLDR.set(e)}}]),e}());Km.SUN_ILLUM=65e3,Km.SKY_ILLUM=2e4,v.Ambient=Km;var Ym,qm,Qm="MainFlow",Zm="ForwardFlow",Jm="ShadowFlow";!function(e){e[e.DEFAULT=100]="DEFAULT",e[e.UI=200]="UI"}(Ym||(Ym={})),v.RenderPassStage=Ym,function(e){e[e.MIN=0]="MIN",e[e.MAX=255]="MAX",e[e.DEFAULT=128]="DEFAULT"}(qm||(qm=e("dV",{})));var $m,eg={bindings:[],layouts:{}},tg={bindings:[],layouts:{}};!function(e){e[e.UBO_GLOBAL=0]="UBO_GLOBAL",e[e.UBO_CAMERA=1]="UBO_CAMERA",e[e.UBO_SHADOW=2]="UBO_SHADOW",e[e.UBO_CSM=3]="UBO_CSM",e[e.SAMPLER_SHADOWMAP=4]="SAMPLER_SHADOWMAP",e[e.SAMPLER_ENVIRONMENT=5]="SAMPLER_ENVIRONMENT",e[e.SAMPLER_SPOT_SHADOW_MAP=6]="SAMPLER_SPOT_SHADOW_MAP",e[e.SAMPLER_DIFFUSEMAP=7]="SAMPLER_DIFFUSEMAP",e[e.COUNT=8]="COUNT"}($m||($m={}));var ig,ng=$m.SAMPLER_SHADOWMAP,rg=$m.COUNT-ng;!function(e){e[e.UBO_LOCAL=0]="UBO_LOCAL",e[e.UBO_FORWARD_LIGHTS=1]="UBO_FORWARD_LIGHTS",e[e.UBO_SKINNING_ANIMATION=2]="UBO_SKINNING_ANIMATION",e[e.UBO_SKINNING_TEXTURE=3]="UBO_SKINNING_TEXTURE",e[e.UBO_MORPH=4]="UBO_MORPH",e[e.UBO_UI_LOCAL=5]="UBO_UI_LOCAL",e[e.UBO_SH=6]="UBO_SH",e[e.SAMPLER_JOINTS=7]="SAMPLER_JOINTS",e[e.SAMPLER_MORPH_POSITION=8]="SAMPLER_MORPH_POSITION",e[e.SAMPLER_MORPH_NORMAL=9]="SAMPLER_MORPH_NORMAL",e[e.SAMPLER_MORPH_TANGENT=10]="SAMPLER_MORPH_TANGENT",e[e.SAMPLER_LIGHTMAP=11]="SAMPLER_LIGHTMAP",e[e.SAMPLER_SPRITE=12]="SAMPLER_SPRITE",e[e.SAMPLER_REFLECTION=13]="SAMPLER_REFLECTION",e[e.STORAGE_REFLECTION=14]="STORAGE_REFLECTION",e[e.SAMPLER_REFLECTION_PROBE_CUBE=15]="SAMPLER_REFLECTION_PROBE_CUBE",e[e.SAMPLER_REFLECTION_PROBE_PLANAR=16]="SAMPLER_REFLECTION_PROBE_PLANAR",e[e.COUNT=17]="COUNT"}(ig||(ig=e("dS",{})));var sg,ag=ig.SAMPLER_JOINTS,og=ig.STORAGE_REFLECTION-ag,ug=ig.COUNT-ag-og;!function(e){e[e.GLOBAL=0]="GLOBAL",e[e.MATERIAL=1]="MATERIAL",e[e.LOCAL=2]="LOCAL"}(sg||(sg={}));var hg=new Fl([ng,0,ag],[rg,0,og],[0,0,0],[0,0,0],[0,0,0],[0,0,ug],[0,0,0],[0,2,1]),cg=function(){};cg.SIZE=4*(cg.COUNT=4+(cg.DEBUG_VIEW_COMPOSITE_PACK_3_OFFSET=4+(cg.DEBUG_VIEW_COMPOSITE_PACK_2_OFFSET=4+(cg.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET=4+(cg.DEBUG_VIEW_MODE_OFFSET=4+(cg.NATIVE_SIZE_OFFSET=4+(cg.SCREEN_SIZE_OFFSET=4+(cg.TIME_OFFSET=0)))))))),cg.NAME="CCGlobal",cg.BINDING=$m.UBO_GLOBAL,cg.DESCRIPTOR=new f_(cg.BINDING,fl.UNIFORM_BUFFER,1,il.ALL),cg.LAYOUT=new Yl(sg.GLOBAL,cg.BINDING,cg.NAME,[new Kl("cc_time",Uc.FLOAT4,1),new Kl("cc_screenSize",Uc.FLOAT4,1),new Kl("cc_nativeSize",Uc.FLOAT4,1),new Kl("cc_debug_view_mode",Uc.FLOAT,4),new Kl("cc_debug_view_composite_pack_1",Uc.FLOAT,4),new Kl("cc_debug_view_composite_pack_2",Uc.FLOAT,4),new Kl("cc_debug_view_composite_pack_3",Uc.FLOAT,4)],1),eg.layouts[cg.NAME]=cg.LAYOUT,eg.bindings[cg.BINDING]=cg.DESCRIPTOR;var lg=function(){};lg.SIZE=4*(lg.COUNT=4+(lg.VIEW_PORT_OFFSET=4+(lg.NEAR_FAR_OFFSET=4+(lg.GLOBAL_FOG_ADD_OFFSET=4+(lg.GLOBAL_FOG_BASE_OFFSET=4+(lg.GLOBAL_FOG_COLOR_OFFSET=4+(lg.AMBIENT_GROUND_OFFSET=4+(lg.AMBIENT_SKY_OFFSET=4+(lg.MAIN_LIT_COLOR_OFFSET=4+(lg.MAIN_LIT_DIR_OFFSET=4+(lg.EXPOSURE_OFFSET=4+(lg.SCREEN_SCALE_OFFSET=4+(lg.SURFACE_TRANSFORM_OFFSET=4+(lg.CAMERA_POS_OFFSET=16+(lg.MAT_VIEW_PROJ_INV_OFFSET=16+(lg.MAT_VIEW_PROJ_OFFSET=16+(lg.MAT_PROJ_INV_OFFSET=16+(lg.MAT_PROJ_OFFSET=16+(lg.MAT_VIEW_INV_OFFSET=16+(lg.MAT_VIEW_OFFSET=0)))))))))))))))))))),lg.NAME="CCCamera",lg.BINDING=$m.UBO_CAMERA,lg.DESCRIPTOR=new f_(lg.BINDING,fl.UNIFORM_BUFFER,1,il.ALL),lg.LAYOUT=new Yl(sg.GLOBAL,lg.BINDING,lg.NAME,[new Kl("cc_matView",Uc.MAT4,1),new Kl("cc_matViewInv",Uc.MAT4,1),new Kl("cc_matProj",Uc.MAT4,1),new Kl("cc_matProjInv",Uc.MAT4,1),new Kl("cc_matViewProj",Uc.MAT4,1),new Kl("cc_matViewProjInv",Uc.MAT4,1),new Kl("cc_cameraPos",Uc.FLOAT4,1),new Kl("cc_surfaceTransform",Uc.FLOAT4,1),new Kl("cc_screenScale",Uc.FLOAT4,1),new Kl("cc_exposure",Uc.FLOAT4,1),new Kl("cc_mainLitDir",Uc.FLOAT4,1),new Kl("cc_mainLitColor",Uc.FLOAT4,1),new Kl("cc_ambientSky",Uc.FLOAT4,1),new Kl("cc_ambientGround",Uc.FLOAT4,1),new Kl("cc_fogColor",Uc.FLOAT4,1),new Kl("cc_fogBase",Uc.FLOAT4,1),new Kl("cc_fogAdd",Uc.FLOAT4,1),new Kl("cc_nearFar",Uc.FLOAT4,1),new Kl("cc_viewPort",Uc.FLOAT4,1)],1),eg.layouts[lg.NAME]=lg.LAYOUT,eg.bindings[lg.BINDING]=lg.DESCRIPTOR;var _g=function(){};_g.SIZE=4*(_g.COUNT=4+(_g.PLANAR_NORMAL_DISTANCE_INFO_OFFSET=4+(_g.SHADOW_COLOR_OFFSET=4+(_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET=4+(_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET=4+(_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET=4+(_g.SHADOW_PROJ_INFO_OFFSET=4+(_g.SHADOW_PROJ_DEPTH_INFO_OFFSET=4+(_g.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET=16+(_g.MAT_LIGHT_VIEW_PROJ_OFFSET=16+(_g.MAT_LIGHT_VIEW_OFFSET=0))))))))))),_g.NAME="CCShadow",_g.BINDING=$m.UBO_SHADOW,_g.DESCRIPTOR=new f_(_g.BINDING,fl.UNIFORM_BUFFER,1,il.ALL),_g.LAYOUT=new Yl(sg.GLOBAL,_g.BINDING,_g.NAME,[new Kl("cc_matLightView",Uc.MAT4,1),new Kl("cc_matLightViewProj",Uc.MAT4,1),new Kl("cc_shadowInvProjDepthInfo",Uc.FLOAT4,1),new Kl("cc_shadowProjDepthInfo",Uc.FLOAT4,1),new Kl("cc_shadowProjInfo",Uc.FLOAT4,1),new Kl("cc_shadowNFLSInfo",Uc.FLOAT4,1),new Kl("cc_shadowWHPBInfo",Uc.FLOAT4,1),new Kl("cc_shadowLPNNInfo",Uc.FLOAT4,1),new Kl("cc_shadowColor",Uc.FLOAT4,1),new Kl("cc_planarNDInfo",Uc.FLOAT4,1)],1),eg.layouts[_g.NAME]=_g.LAYOUT,eg.bindings[_g.BINDING]=_g.DESCRIPTOR;var dg=function(){};dg.CSM_LEVEL_COUNT=4,dg.SIZE=4*(dg.COUNT=4+(dg.CSM_SPLITS_INFO_OFFSET=(dg.CSM_PROJ_INFO_OFFSET=(dg.CSM_PROJ_DEPTH_INFO_OFFSET=(dg.MAT_CSM_VIEW_PROJ_OFFSET=(dg.CSM_ATLAS_OFFSET=(dg.CSM_VIEW_DIR_2_OFFSET=(dg.CSM_VIEW_DIR_1_OFFSET=(dg.CSM_VIEW_DIR_0_OFFSET=0)+4*dg.CSM_LEVEL_COUNT)+4*dg.CSM_LEVEL_COUNT)+4*dg.CSM_LEVEL_COUNT)+4*dg.CSM_LEVEL_COUNT)+16*dg.CSM_LEVEL_COUNT)+4*dg.CSM_LEVEL_COUNT)+4*dg.CSM_LEVEL_COUNT)),dg.NAME="CCCSM",dg.BINDING=$m.UBO_CSM,dg.DESCRIPTOR=new f_(dg.BINDING,fl.UNIFORM_BUFFER,1,il.FRAGMENT),dg.LAYOUT=new Yl(sg.GLOBAL,dg.BINDING,dg.NAME,[new Kl("cc_csmViewDir0",Uc.FLOAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_csmViewDir1",Uc.FLOAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_csmViewDir2",Uc.FLOAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_csmAtlas",Uc.FLOAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_matCSMViewProj",Uc.MAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_csmProjDepthInfo",Uc.FLOAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_csmProjInfo",Uc.FLOAT4,dg.CSM_LEVEL_COUNT),new Kl("cc_csmSplitsInfo",Uc.FLOAT4,1)],1),eg.layouts[dg.NAME]=dg.LAYOUT,eg.bindings[dg.BINDING]=dg.DESCRIPTOR;var fg=$m.SAMPLER_SHADOWMAP,pg=new f_(fg,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),mg=new ql(sg.GLOBAL,fg,"cc_shadowMap",Uc.SAMPLER2D,1);eg.layouts.cc_shadowMap=mg,eg.bindings[fg]=pg;var gg=$m.SAMPLER_ENVIRONMENT,vg=new f_(gg,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),yg=new ql(sg.GLOBAL,gg,"cc_environment",Uc.SAMPLER_CUBE,1);eg.layouts.cc_environment=yg,eg.bindings[gg]=vg;var Eg=$m.SAMPLER_DIFFUSEMAP,Tg=new f_(Eg,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),Ag=new ql(sg.GLOBAL,Eg,"cc_diffuseMap",Uc.SAMPLER_CUBE,1);eg.layouts.cc_diffuseMap=Ag,eg.bindings[Eg]=Tg;var Sg=$m.SAMPLER_SPOT_SHADOW_MAP,Rg=new f_(Sg,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),wg=new ql(sg.GLOBAL,Sg,"cc_spotShadowMap",Uc.SAMPLER2D,1);eg.layouts.cc_spotShadowMap=wg,eg.bindings[Sg]=Rg;var Ig=e("e5",(function(){}));Ig.MAT_WORLD_OFFSET=0,Ig.MAT_WORLD_IT_OFFSET=Ig.MAT_WORLD_OFFSET+16,Ig.LIGHTINGMAP_UVPARAM=Ig.MAT_WORLD_IT_OFFSET+16,Ig.LOCAL_SHADOW_BIAS=Ig.LIGHTINGMAP_UVPARAM+4,Ig.COUNT=Ig.LOCAL_SHADOW_BIAS+4,Ig.SIZE=4*Ig.COUNT,Ig.NAME="CCLocal",Ig.BINDING=ig.UBO_LOCAL,Ig.DESCRIPTOR=new f_(Ig.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX|il.COMPUTE),Ig.LAYOUT=new Yl(sg.LOCAL,Ig.BINDING,Ig.NAME,[new Kl("cc_matWorld",Uc.MAT4,1),new Kl("cc_matWorldIT",Uc.MAT4,1),new Kl("cc_lightingMapUVParam",Uc.FLOAT4,1),new Kl("cc_localShadowBias",Uc.FLOAT4,1)],1),tg.layouts[Ig.NAME]=Ig.LAYOUT,tg.bindings[Ig.BINDING]=Ig.DESCRIPTOR;var bg=function(){};bg.SIZE=4*(bg.COUNT=4+(bg.WORLD_BOUND_HALF_EXTENTS=4+(bg.WORLD_BOUND_CENTER=0))),bg.NAME="CCWorldBound",bg.BINDING=ig.UBO_LOCAL,bg.DESCRIPTOR=new f_(bg.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX|il.COMPUTE),bg.LAYOUT=new Yl(sg.LOCAL,bg.BINDING,bg.NAME,[new Kl("cc_worldBoundCenter",Uc.FLOAT4,1),new Kl("cc_worldBoundHalfExtents",Uc.FLOAT4,1)],1),tg.layouts[bg.NAME]=bg.LAYOUT,tg.bindings[bg.BINDING]=bg.DESCRIPTOR;var Og="a_matWorld0",Ng="a_sh_linear_const_r",Cg=function(){};Cg.BATCHING_COUNT=10,Cg.MAT_WORLDS_OFFSET=0,Cg.SIZE=4*(Cg.COUNT=16*Cg.BATCHING_COUNT),Cg.NAME="CCLocalBatched",Cg.BINDING=ig.UBO_LOCAL,Cg.DESCRIPTOR=new f_(Cg.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX|il.COMPUTE),Cg.LAYOUT=new Yl(sg.LOCAL,Cg.BINDING,Cg.NAME,[new Kl("cc_matWorlds",Uc.MAT4,Cg.BATCHING_COUNT)],1),tg.layouts[Cg.NAME]=Cg.LAYOUT,tg.bindings[Cg.BINDING]=Cg.DESCRIPTOR;var Mg=function(){};Mg.LIGHTS_PER_PASS=1,Mg.SIZE=4*(Mg.COUNT=(Mg.LIGHT_DIR_OFFSET=(Mg.LIGHT_SIZE_RANGE_ANGLE_OFFSET=(Mg.LIGHT_COLOR_OFFSET=(Mg.LIGHT_POS_OFFSET=0)+4*Mg.LIGHTS_PER_PASS)+4*Mg.LIGHTS_PER_PASS)+4*Mg.LIGHTS_PER_PASS)+4*Mg.LIGHTS_PER_PASS),Mg.NAME="CCForwardLight",Mg.BINDING=ig.UBO_FORWARD_LIGHTS,Mg.DESCRIPTOR=new f_(Mg.BINDING,fl.DYNAMIC_UNIFORM_BUFFER,1,il.FRAGMENT),Mg.LAYOUT=new Yl(sg.LOCAL,Mg.BINDING,Mg.NAME,[new Kl("cc_lightPos",Uc.FLOAT4,Mg.LIGHTS_PER_PASS),new Kl("cc_lightColor",Uc.FLOAT4,Mg.LIGHTS_PER_PASS),new Kl("cc_lightSizeRangeAngle",Uc.FLOAT4,Mg.LIGHTS_PER_PASS),new Kl("cc_lightDir",Uc.FLOAT4,Mg.LIGHTS_PER_PASS)],1),tg.layouts[Mg.NAME]=Mg.LAYOUT,tg.bindings[Mg.BINDING]=Mg.DESCRIPTOR;var Pg=function(){};Pg.LIGHTS_PER_PASS=10;var Lg=e("ek",(function(){}));Lg.JOINTS_TEXTURE_INFO_OFFSET=0,Lg.COUNT=Lg.JOINTS_TEXTURE_INFO_OFFSET+4,Lg.SIZE=4*Lg.COUNT,Lg.NAME="CCSkinningTexture",Lg.BINDING=ig.UBO_SKINNING_TEXTURE,Lg.DESCRIPTOR=new f_(Lg.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX),Lg.LAYOUT=new Yl(sg.LOCAL,Lg.BINDING,Lg.NAME,[new Kl("cc_jointTextureInfo",Uc.FLOAT4,1)],1),tg.layouts[Lg.NAME]=Lg.LAYOUT,tg.bindings[Lg.BINDING]=Lg.DESCRIPTOR;var xg=e("em",(function(){}));xg.JOINTS_ANIM_INFO_OFFSET=0,xg.COUNT=xg.JOINTS_ANIM_INFO_OFFSET+4,xg.SIZE=4*xg.COUNT,xg.NAME="CCSkinningAnimation",xg.BINDING=ig.UBO_SKINNING_ANIMATION,xg.DESCRIPTOR=new f_(xg.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX),xg.LAYOUT=new Yl(sg.LOCAL,xg.BINDING,xg.NAME,[new Kl("cc_jointAnimInfo",Uc.FLOAT4,1)],1),tg.layouts[xg.NAME]=xg.LAYOUT,tg.bindings[xg.BINDING]=xg.DESCRIPTOR;var Dg=e("en","a_jointAnimInfo"),Fg=e("ei",function(){function e(){}return e.initLayout=function(t){e._jointUniformCapacity=t,e._count=12*t,e._size=4*e._count,e.LAYOUT.members[0].count=3*t},n(e,null,[{key:"JOINT_UNIFORM_CAPACITY",get:function(){return e._jointUniformCapacity}},{key:"COUNT",get:function(){return e._count}},{key:"SIZE",get:function(){return e._size}}]),e}());function Bg(e){Fg.initLayout(e),tg.layouts[Fg.NAME]=Fg.LAYOUT,tg.bindings[Fg.BINDING]=Fg.DESCRIPTOR}Fg._jointUniformCapacity=0,Fg._count=0,Fg._size=0,Fg.NAME="CCSkinning",Fg.BINDING=ig.UBO_SKINNING_TEXTURE,Fg.DESCRIPTOR=new f_(Fg.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX),Fg.LAYOUT=new Yl(sg.LOCAL,Fg.BINDING,Fg.NAME,[new Kl("cc_joints",Uc.FLOAT4,1)],1);var Ug=e("ch",(function(){}));Ug.MAX_MORPH_TARGET_COUNT=60,Ug.OFFSET_OF_WEIGHTS=0,Ug.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH=4*Ug.MAX_MORPH_TARGET_COUNT,Ug.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT=Ug.OFFSET_OF_DISPLACEMENT_TEXTURE_WIDTH+4,Ug.OFFSET_OF_VERTICES_COUNT=Ug.OFFSET_OF_DISPLACEMENT_TEXTURE_HEIGHT+4,Ug.COUNT_BASE_4_BYTES=4*Math.ceil(Ug.MAX_MORPH_TARGET_COUNT/4)+4,Ug.SIZE=4*Ug.COUNT_BASE_4_BYTES,Ug.NAME="CCMorph",Ug.BINDING=ig.UBO_MORPH,Ug.DESCRIPTOR=new f_(Ug.BINDING,fl.UNIFORM_BUFFER,1,il.VERTEX),Ug.LAYOUT=new Yl(sg.LOCAL,Ug.BINDING,Ug.NAME,[new Kl("cc_displacementWeights",Uc.FLOAT4,Ug.MAX_MORPH_TARGET_COUNT/4),new Kl("cc_displacementTextureInfo",Uc.FLOAT4,1)],1),tg.layouts[Ug.NAME]=Ug.LAYOUT,tg.bindings[Ug.BINDING]=Ug.DESCRIPTOR;var Gg=function(){};Gg.NAME="CCUILocal",Gg.BINDING=ig.UBO_UI_LOCAL,Gg.DESCRIPTOR=new f_(Gg.BINDING,fl.DYNAMIC_UNIFORM_BUFFER,1,il.VERTEX),Gg.LAYOUT=new Yl(sg.LOCAL,Gg.BINDING,Gg.NAME,[new Kl("cc_local_data",Uc.FLOAT4,1)],1),tg.layouts[Gg.NAME]=Gg.LAYOUT,tg.bindings[Gg.BINDING]=Gg.DESCRIPTOR;var kg=function(){};kg.SIZE=4*(kg.COUNT=4+(kg.SH_QUADRATIC_A_OFFSET=4+(kg.SH_QUADRATIC_B_OFFSET=4+(kg.SH_QUADRATIC_G_OFFSET=4+(kg.SH_QUADRATIC_R_OFFSET=4+(kg.SH_LINEAR_CONST_B_OFFSET=4+(kg.SH_LINEAR_CONST_G_OFFSET=4+(kg.SH_LINEAR_CONST_R_OFFSET=0)))))))),kg.NAME="CCSH",kg.BINDING=ig.UBO_SH,kg.DESCRIPTOR=new f_(kg.BINDING,fl.UNIFORM_BUFFER,1,il.FRAGMENT),kg.LAYOUT=new Yl(sg.LOCAL,kg.BINDING,kg.NAME,[new Kl("cc_sh_linear_const_r",Uc.FLOAT4,1),new Kl("cc_sh_linear_const_g",Uc.FLOAT4,1),new Kl("cc_sh_linear_const_b",Uc.FLOAT4,1),new Kl("cc_sh_quadratic_r",Uc.FLOAT4,1),new Kl("cc_sh_quadratic_g",Uc.FLOAT4,1),new Kl("cc_sh_quadratic_b",Uc.FLOAT4,1),new Kl("cc_sh_quadratic_a",Uc.FLOAT4,1)],1),tg.layouts[kg.NAME]=kg.LAYOUT,tg.bindings[kg.BINDING]=kg.DESCRIPTOR;var Hg=e("el",ig.SAMPLER_JOINTS),zg=new f_(Hg,fl.SAMPLER_TEXTURE,1,il.VERTEX),Vg=new ql(sg.LOCAL,Hg,"cc_jointTexture",Uc.SAMPLER2D,1);tg.layouts.cc_jointTexture=Vg,tg.bindings[Hg]=zg;var Wg=e("ej",ig.SAMPLER_JOINTS),jg=new f_(Wg,fl.SAMPLER_TEXTURE,1,il.VERTEX),Xg=new ql(sg.LOCAL,Wg,"cc_realtimeJoint",Uc.SAMPLER2D,1);tg.layouts.cc_realtimeJoint=Xg,tg.bindings[Wg]=jg;var Kg=e("cp",ig.SAMPLER_MORPH_POSITION),Yg=new f_(Kg,fl.SAMPLER_TEXTURE,1,il.VERTEX),qg=new ql(sg.LOCAL,Kg,"cc_PositionDisplacements",Uc.SAMPLER2D,1);tg.layouts.cc_PositionDisplacements=qg,tg.bindings[Kg]=Yg;var Qg=e("co",ig.SAMPLER_MORPH_NORMAL),Zg=new f_(Qg,fl.SAMPLER_TEXTURE,1,il.VERTEX),Jg=new ql(sg.LOCAL,Qg,"cc_NormalDisplacements",Uc.SAMPLER2D,1);tg.layouts.cc_NormalDisplacements=Jg,tg.bindings[Qg]=Zg;var $g=e("cn",ig.SAMPLER_MORPH_TANGENT),ev=new f_($g,fl.SAMPLER_TEXTURE,1,il.VERTEX),tv=new ql(sg.LOCAL,$g,"cc_TangentDisplacements",Uc.SAMPLER2D,1);tg.layouts.cc_TangentDisplacements=tv,tg.bindings[$g]=ev;var iv=ig.SAMPLER_LIGHTMAP,nv=new f_(iv,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),rv=new ql(sg.LOCAL,iv,"cc_lightingMap",Uc.SAMPLER2D,1);tg.layouts.cc_lightingMap=rv,tg.bindings[iv]=nv;var sv=ig.SAMPLER_SPRITE,av=new f_(sv,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),ov=new ql(sg.LOCAL,sv,"cc_spriteTexture",Uc.SAMPLER2D,1);tg.layouts.cc_spriteTexture=ov,tg.bindings[sv]=av;var uv=ig.SAMPLER_REFLECTION,hv=new f_(uv,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),cv=new ql(sg.LOCAL,uv,"cc_reflectionTexture",Uc.SAMPLER2D,1);tg.layouts.cc_reflectionTexture=cv,tg.bindings[uv]=hv;var lv=ig.STORAGE_REFLECTION,_v=new f_(lv,fl.STORAGE_IMAGE,1,il.COMPUTE),dv=new Jl(sg.LOCAL,lv,"cc_reflectionStorage",Uc.IMAGE2D,1);tg.layouts.cc_reflectionStorage=dv,tg.bindings[lv]=_v;var fv=ig.SAMPLER_REFLECTION_PROBE_CUBE,pv=new f_(fv,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),mv=new ql(sg.LOCAL,fv,"cc_reflectionProbeCubemap",Uc.SAMPLER_CUBE,1);tg.layouts.cc_reflectionProbeCubemap=mv,tg.bindings[fv]=pv;var gv=ig.SAMPLER_REFLECTION_PROBE_PLANAR,vv=new f_(gv,fl.SAMPLER_TEXTURE,1,il.FRAGMENT),yv=new ql(sg.LOCAL,gv,"cc_reflectionProbePlanarMap",Uc.SAMPLER2D,1);tg.layouts.cc_reflectionProbePlanarMap=yv,tg.bindings[gv]=vv;var Ev,Tv,Av,Sv=e("dF",Yp.makeMaskExclude([Yp.BitMask.UI_2D,Yp.BitMask.GIZMOS,Yp.BitMask.EDITOR,Yp.BitMask.SCENE_GIZMO,Yp.BitMask.PROFILER])),Rv=Yp.makeMaskExclude([Yp.BitMask.UI_2D,Yp.BitMask.PROFILER]),wv=Yp.Enum.ALL;function Iv(e){return(e.getFormatFeatures(Fc.R32F)&(Xc.RENDER_TARGET|Xc.SAMPLED_TEXTURE))==(Xc.RENDER_TARGET|Xc.SAMPLED_TEXTURE)&&!(e.gfxAPI===Lc.WEBGL)}function bv(){return!(!v.rendering||!v.rendering.enableEffectImport)}e("gL",Object.freeze({__proto__:null,PIPELINE_FLOW_MAIN:Qm,PIPELINE_FLOW_FORWARD:Zm,PIPELINE_FLOW_SHADOW:Jm,PIPELINE_FLOW_SMAA:"SMAAFlow",PIPELINE_FLOW_TONEMAP:"ToneMapFlow",get RenderPassStage(){return Ym},get RenderPriority(){return qm},globalDescriptorSetLayout:eg,localDescriptorSetLayout:tg,get PipelineGlobalBindings(){return $m},get ModelLocalBindings(){return ig},get SetIndex(){return sg},bindingMappingInfo:hg,UBOGlobal:cg,UBOCamera:lg,UBOShadow:_g,UBOCSM:dg,UNIFORM_SHADOWMAP_BINDING:fg,UNIFORM_ENVIRONMENT_BINDING:gg,UNIFORM_DIFFUSEMAP_BINDING:Eg,UNIFORM_SPOT_SHADOW_MAP_TEXTURE_BINDING:Sg,UBOLocal:Ig,UBOWorldBound:bg,INST_MAT_WORLD:Og,INST_SH:Ng,UBOLocalBatched:Cg,UBOForwardLight:Mg,UBODeferredLight:Pg,JOINT_UNIFORM_CAPACITY:30,UBOSkinningTexture:Lg,UBOSkinningAnimation:xg,INST_JOINT_ANIM_INFO:Dg,UBOSkinning:Fg,localDescriptorSetLayout_ResizeMaxJoints:Bg,UBOMorph:Ug,UBOUILocal:Gg,UBOSH:kg,UNIFORM_JOINT_TEXTURE_BINDING:Hg,UNIFORM_REALTIME_JOINT_TEXTURE_BINDING:Wg,UNIFORM_POSITION_MORPH_TEXTURE_BINDING:Kg,UNIFORM_NORMAL_MORPH_TEXTURE_BINDING:Qg,UNIFORM_TANGENT_MORPH_TEXTURE_BINDING:$g,UNIFORM_LIGHTMAP_TEXTURE_BINDING:iv,UNIFORM_SPRITE_TEXTURE_BINDING:sv,UNIFORM_REFLECTION_TEXTURE_BINDING:uv,UNIFORM_REFLECTION_STORAGE_BINDING:lv,UNIFORM_REFLECTION_PROBE_CUBEMAP_BINDING:fv,UNIFORM_REFLECTION_PROBE_TEXTURE_BINDING:gv,CAMERA_DEFAULT_MASK:Sv,CAMERA_EDITOR_MASK:Rv,MODEL_ALWAYS_MASK:wv,supportsR16HalfFloatTexture:function(e){return(e.getFormatFeatures(Fc.R16F)&(Xc.RENDER_TARGET|Xc.SAMPLED_TEXTURE))==(Xc.RENDER_TARGET|Xc.SAMPLED_TEXTURE)},supportsR32FloatTexture:Iv,isEnableEffect:bv}));var Ov=4227858432,Nv=66060288,Cv=1044480,Mv=e("de",(function(e,t,i,n){return void 0===n&&(n=0),t<<26&Ov|e<<20&Nv|i<<12&Cv|4095&n})),Pv=e("df",(function(e){return(e&Ov)>>>26})),Lv=e("dg",(function(e){return(e&Nv)>>>20})),xv=e("dh",(function(e){return(e&Cv)>>>12})),Dv=e("di",(function(e){return 4095&e})),Fv=e("dj",(function(e,t){return 67108863&e|t<<26&Ov})),Bv=e("dk",((Ev={})[Uc.UNKNOWN]=function(e,t,i){return void 0===i&&(i=0),q(12010,i)},Ev[Uc.INT]=function(e,t,i){return void 0===i&&(i=0),e[i]},Ev[Uc.INT2]=function(e,t,i){return void 0===i&&(i=0),Rn.fromArray(t,e,i)},Ev[Uc.INT3]=function(e,t,i){return void 0===i&&(i=0),Ki.fromArray(t,e,i)},Ev[Uc.INT4]=function(e,t,i){return void 0===i&&(i=0),zi.fromArray(t,e,i)},Ev[Uc.FLOAT]=function(e,t,i){return void 0===i&&(i=0),e[i]},Ev[Uc.FLOAT2]=function(e,t,i){return void 0===i&&(i=0),Rn.fromArray(t,e,i)},Ev[Uc.FLOAT3]=function(e,t,i){return void 0===i&&(i=0),Ki.fromArray(t,e,i)},Ev[Uc.FLOAT4]=function(e,t,i){return void 0===i&&(i=0),zi.fromArray(t,e,i)},Ev[Uc.MAT3]=function(e,t,i){return void 0===i&&(i=0),hn.fromArray(t,e,i)},Ev[Uc.MAT4]=function(e,t,i){return void 0===i&&(i=0),En.fromArray(t,e,i)},Ev)),Uv=e("dl",((Tv={})[Uc.UNKNOWN]=function(e,t,i){return void 0===i&&(i=0),q(12010,i)},Tv[Uc.INT]=function(e,t,i){return void 0===i&&(i=0),e[i]=t},Tv[Uc.INT2]=function(e,t,i){return void 0===i&&(i=0),Rn.toArray(e,t,i)},Tv[Uc.INT3]=function(e,t,i){return void 0===i&&(i=0),Ki.toArray(e,t,i)},Tv[Uc.INT4]=function(e,t,i){return void 0===i&&(i=0),zi.toArray(e,t,i)},Tv[Uc.FLOAT]=function(e,t,i){return void 0===i&&(i=0),e[i]=t},Tv[Uc.FLOAT2]=function(e,t,i){return void 0===i&&(i=0),Rn.toArray(e,t,i)},Tv[Uc.FLOAT3]=function(e,t,i){return void 0===i&&(i=0),Ki.toArray(e,t,i)},Tv[Uc.FLOAT4]=function(e,t,i){return void 0===i&&(i=0),zi.toArray(e,t,i)},Tv[Uc.MAT3]=function(e,t,i){return void 0===i&&(i=0),hn.toArray(e,t,i)},Tv[Uc.MAT4]=function(e,t,i){return void 0===i&&(i=0),En.toArray(e,t,i)},Tv)),Gv=(e("dm",((Av={})[Uc.INT]=function(e){return"number"==typeof e},Av[Uc.FLOAT]=function(e){return"number"==typeof e},Av[Uc.INT2]=function(e){return!!(e instanceof Rn)},Av[Uc.FLOAT2]=function(e){return!!(e instanceof Rn)},Av[Uc.INT3]=function(e){return!!(e instanceof Ki)},Av[Uc.FLOAT3]=function(e){return!!(e instanceof Ki)},Av[Uc.INT4]=function(e){return!!(e instanceof zi)},Av[Uc.FLOAT4]=function(e){return!!(e instanceof zi||e instanceof en||e instanceof _n)},Av[Uc.MAT3]=function(e){return!!(e instanceof hn)},Av[Uc.MAT4]=function(e){return!!(e instanceof En)},Av)),[Object.freeze([0]),Object.freeze([0,0]),Object.freeze([0,0,0,0]),Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])]);function kv(e){switch(e){case Uc.BOOL:case Uc.INT:case Uc.UINT:case Uc.FLOAT:return Gv[0];case Uc.BOOL2:case Uc.INT2:case Uc.UINT2:case Uc.FLOAT2:return Gv[1];case Uc.BOOL4:case Uc.INT4:case Uc.UINT4:case Uc.FLOAT4:return Gv[2];case Uc.MAT4:return Gv[3];case Uc.SAMPLER2D:return"default-texture";case Uc.SAMPLER_CUBE:return"default-cube-texture";case Uc.SAMPLER2D_ARRAY:return"default-array-texture";case Uc.SAMPLER3D:return"default-3d-texture"}return Gv[0]}function Hv(e){switch(e){case Uc.SAMPLER2D:return"-texture";case Uc.SAMPLER_CUBE:return"-cube-texture";case Uc.SAMPLER2D_ARRAY:return"-array-texture";case Uc.SAMPLER3D:return"-3d-texture";default:return"-unknown"}}function zv(e,t){for(var i=Object.entries(t),n=!1,r=0;r<i.length;r++)e[i[r][0]]!==i[r][1]&&(e[i[r][0]]=i[r][1],n=!0);return n}function Vv(e,t){switch(e.type){case"boolean":return"number"==typeof t?t.toString():t?"1":"0";case"string":return void 0!==t?t:e.options[0];case"number":return void 0!==t?t.toString():e.range[0].toString();default:return console.warn("unknown define type '"+e.type+"'"),"-1"}}function Wv(e,t){for(var i=0;i<e.length;i++){var n=e[i];if("!"===n[0]){if(t[n.slice(1)])return!1}else if(!t[n])return!1}return!0}var jv=new Map;function Xv(e,t){if(t.count)return e+F_(t.type)*t.count;var i=jv.get(t.name);return void 0!==i?e+F_(t.type)*i:(console.error("uniform '"+t.name+"' must have a count"),e)}function Kv(e){return Math.ceil(Math.log2(Math.max(e,2)))}jv.set("cc_joints",Fg.LAYOUT.members[0].count),jv.set("cc_lightPos",Mg.LIGHTS_PER_PASS),jv.set("cc_lightColor",Mg.LIGHTS_PER_PASS),jv.set("cc_lightSizeRangeAngle",Mg.LIGHTS_PER_PASS),jv.set("cc_lightDir",Mg.LIGHTS_PER_PASS);var Yv=new p_;function qv(e,t,i,n,r){for(var s=e.builtins[n],a=[],o=function(e){var t=s.blocks[e],n=i.layouts[t.name],o=n&&i.bindings.find((function(e){return e.binding===n.binding}));if(!(n&&o&&o.descriptorType&O_))return console.warn("builtin UBO '"+t.name+"' not available!"),"continue";a.push(n),r&&!r.includes(o)&&r.push(o)},u=0;u<s.blocks.length;u++)o(u);Array.prototype.unshift.apply(t.shaderInfo.blocks,a);for(var h=[],c=function(e){var t=s.samplerTextures[e],n=i.layouts[t.name],a=n&&i.bindings.find((function(e){return e.binding===n.binding}));if(!(n&&a&&a.descriptorType&N_))return console.warn("builtin samplerTexture '"+t.name+"' not available!"),"continue";h.push(n),r&&!r.includes(a)&&r.push(a)},l=0;l<s.samplerTextures.length;l++)c(l);Array.prototype.unshift.apply(t.shaderInfo.samplerTextures,h),r&&r.sort((function(e,t){return e.binding-t.binding}))}function Qv(e,t,i,n,r,s){void 0===s&&(s=new Set);for(var a=new RegExp("layout\\(location = ([^\\)]+)\\)\\s+"+n+".*?\\s(\\w+)[;,\\)]","g"),o=e,u=a.exec(e),h=function(){var h=u[2];if(!r.has(h)){var c=t.attributes.find((function(e){return e.name===h})),l=!0,_=0;if("in"===n){var d=e.slice(0,u.index);l=!(null==c||!c.defines.every((function(e){var t=e.startsWith("!"),n=t?e.slice(1):e,r=i.find((function(e){return e.name===n})),s=!!r;if(r&&(s=!("0"===r.value||"false"===r.value||"FALSE"===r.value)),s=t?!s:s){var a=new RegExp("[\\n|\\s]+#(?:if|elif)(.*?"+n+".*?(?:(?!#if|#elif).)*)[\\n|\\s]+$","g").exec(d);if(a){var o=a[1].split("||").some((function(e){return e.split("&&").every((function(e){var t=!0;if(e.includes("==")){var i=e.split("==");i[0].replaceAll(" ","")===n&&(t=i[1].replaceAll(" ","")===r.value)}else if(e.includes("!=")){var s=e.split("!=");s[0].replaceAll(" ","")===n&&(t=s[1].replaceAll(" ","")!==r.value)}return t}))}));s=s&&o}}return s})))}if(l){for(;s.has(_);)_++;s.add(_),c&&(c.location=_),r.set(h,_)}var f=u[0].replace(u[1],""+_);o=o.replace(u[0],f)}u=a.exec(e)};u;)h();return o}var Zv=function(){function e(){this._templates={},this._cache={},this._templateInfos={}}var t=e.prototype;return t.register=function(e){for(var t=0;t<e.shaders.length;t++)this.define(e.shaders[t]).effectName=e.name;for(var i=0;i<e.techniques.length;i++)for(var n=e.techniques[i],r=0;r<n.passes.length;r++){var s=n.passes[r];void 0!==s.propertyIndex&&void 0===s.properties&&(s.properties=n.passes[s.propertyIndex].properties)}},t.define=function(e){var t=this._templates[e.name];if(t&&t.hash===e.hash)return t;var i=r({},e);if(function(e){for(var t=0,i=function(i){var n=e.defines[i],r=1;if("number"===n.type){var s=n.range;r=Kv(s[1]-s[0]+1),n._map=function(e){return e-s[0]}}else"string"===n.type?(r=Kv(n.options.length),n._map=function(e){return Math.max(0,n.options.findIndex((function(t){return t===e})))}):"boolean"===n.type&&(n._map=function(e){return e?1:0});n._offset=t,t+=r},n=0;n<e.defines.length;n++)i(n);for(var r in t>31&&(e.uber=!0),e.constantMacros="",e.builtins.statistics)e.constantMacros+="#define "+r+" "+e.builtins.statistics[r]+"\n"}(i),this._templates[e.name]=i,!this._templateInfos[i.hash]){var n={};n.samplerStartBinding=i.blocks.length,n.shaderInfo=new n_,n.blockSizes=[],n.bindings=[];for(var s=0;s<i.blocks.length;s++){var a=i.blocks[s];n.blockSizes.push(a.members.reduce(Xv,0)),n.bindings.push(new f_(a.binding,fl.UNIFORM_BUFFER,1,a.stageFlags)),n.shaderInfo.blocks.push(new Yl(sg.MATERIAL,a.binding,a.name,a.members.map((function(e){return new Kl(e.name,e.type,e.count)})),1))}for(var o=0;o<i.samplerTextures.length;o++){var u=i.samplerTextures[o];n.bindings.push(new f_(u.binding,fl.SAMPLER_TEXTURE,u.count,u.stageFlags)),n.shaderInfo.samplerTextures.push(new ql(sg.MATERIAL,u.binding,u.name,u.type,u.count))}for(var h=0;h<i.samplers.length;h++){var c=i.samplers[h];n.bindings.push(new f_(c.binding,fl.SAMPLER,c.count,c.stageFlags)),n.shaderInfo.samplers.push(new Ql(sg.MATERIAL,c.binding,c.name,c.count))}for(var l=0;l<i.textures.length;l++){var _=i.textures[l];n.bindings.push(new f_(_.binding,fl.TEXTURE,_.count,_.stageFlags)),n.shaderInfo.textures.push(new Zl(sg.MATERIAL,_.binding,_.name,_.type,_.count))}for(var d=0;d<i.buffers.length;d++){var f=i.buffers[d];n.bindings.push(new f_(f.binding,fl.STORAGE_BUFFER,1,f.stageFlags)),n.shaderInfo.buffers.push(new $l(sg.MATERIAL,f.binding,f.name,1,f.memoryAccess))}for(var p=0;p<i.images.length;p++){var m=i.images[p];n.bindings.push(new f_(m.binding,fl.STORAGE_IMAGE,m.count,m.stageFlags)),n.shaderInfo.images.push(new Jl(sg.MATERIAL,m.binding,m.name,m.type,m.count,m.memoryAccess))}for(var g=0;g<i.subpassInputs.length;g++){var v=i.subpassInputs[g];n.bindings.push(new f_(v.binding,fl.INPUT_ATTACHMENT,v.count,v.stageFlags)),n.shaderInfo.subpassInputs.push(new e_(sg.MATERIAL,v.binding,v.name,v.count))}n.gfxAttributes=[];for(var y=0;y<i.attributes.length;y++){var E=i.attributes[y];n.gfxAttributes.push(new i_(E.name,E.format,E.isNormalized,0,E.isInstanced,E.location))}qv(i,n,tg,"locals"),n.shaderInfo.stages.push(new t_(il.VERTEX,"")),n.shaderInfo.stages.push(new t_(il.FRAGMENT,"")),n.handleMap=function(e){for(var t={},i=0;i<e.blocks.length;i++)for(var n=e.blocks[i],r=n.members,s=0,a=0;a<r.length;a++){var o=r[a];t[o.name]=Mv(n.binding,o.type,o.count,s),s+=(F_(o.type)>>2)*o.count}for(var u=0;u<e.samplerTextures.length;u++){var h=e.samplerTextures[u];t[h.name]=Mv(h.binding,h.type,h.count)}return t}(i),n.setLayouts=[],this._templateInfos[i.hash]=n}return i},t.getTemplate=function(e){return this._templates[e]},t.getTemplateInfo=function(e){var t=this._templates[e].hash;return this._templateInfos[t]},t.getDescriptorSetLayout=function(e,t,i){void 0===i&&(i=!1);var n=this._templates[t],r=this._templateInfos[n.hash];return r.setLayouts.length||(Yv.bindings=r.bindings,r.setLayouts[sg.MATERIAL]=e.createDescriptorSetLayout(Yv),Yv.bindings=tg.bindings,r.setLayouts[sg.LOCAL]=e.createDescriptorSetLayout(Yv)),r.setLayouts[i?sg.LOCAL:sg.MATERIAL]},t.hasProgram=function(e){return void 0!==this._templates[e]},t.getKey=function(e,t){return function(e,t){var i=e.defines;if(e.uber){for(var n="",r=0;r<i.length;r++){var s=i[r],a=t[s.name];if(a&&s._map){var o=s._map(a);n+=""+s._offset+o+"|"}}return""+n+e.hash}for(var u=0,h=0;h<i.length;h++){var c=i[h],l=t[c.name];l&&c._map&&(u|=c._map(l)<<c._offset)}return u.toString(16)+"|"+e.hash}(this._templates[e],t)},t.destroyShaderByDefines=function(e){var t=this,i=Object.keys(e);if(i.length)for(var n=i.map((function(t){var i=e[t];return"boolean"==typeof i&&(i=i?"1":"0"),new RegExp(""+t+i)})),r=Object.keys(this._cache).filter((function(e){return n.every((function(i){return i.test(t._cache[e].name)}))})),s=0;s<r.length;s++){var a=r[s],o=this._cache[a];z("destroyed shader "+o.name),o.destroy(),delete this._cache[a]}},t.getGFXShader=function(e,t,i,n,r){Object.assign(i,n.macros),r||(r=this.getKey(t,i));var s=this._cache[r];if(s)return s;var a=this._templates[t],o=this._templateInfos[a.hash];o.pipelineLayout||(this.getDescriptorSetLayout(e,t),qv(a,o,eg,"globals"),o.setLayouts[sg.GLOBAL]=n.descriptorSetLayout,o.pipelineLayout=e.createPipelineLayout(new g_(o.setLayouts)));var u=function(e,t){for(var i=[],n=0;n<t.length;n++){var r=t[n],s=r.name,a=e[s],o=Vv(r,a),u=!a||"0"===a;i.push({name:s,value:o,isDefault:u})}return i}(i,a.defines),h=n.constantMacros+a.constantMacros+u.reduce((function(e,t){return e+"#define "+t.name+" "+t.value+"\n"}),""),c=a.glsl3,l=Jv(e);l?c=a[l]:console.error("Invalid GFX API!"),o.shaderInfo.stages[0].source=h+c.vert,o.shaderInfo.stages[1].source=h+c.frag,o.shaderInfo.attributes=function(e,t,i){for(var n=[],r=e.attributes,s=0;s<r.length;s++)Wv(r[s].defines,i)&&n.push(t[s]);return n}(a,o.gfxAttributes,i),o.shaderInfo.name=function(e,t){return e+t.reduce((function(e,t){return t.isDefault?e:e+"|"+t.name+t.value}),"")}(t,u);var _=o.shaderInfo;return this._cache[r]=e.createShader(_)},e}();function Jv(e){switch(e.gfxAPI){case Lc.GLES2:case Lc.WEBGL:return"glsl1";case Lc.GLES3:case Lc.WEBGL2:return"glsl3";default:return"glsl4"}}var $v,ey,ty,iy,ny,ry,sy,ay,oy=e("du",new Zv);v.programLib=oy;var uy=["planar-shadow","skybox","deferred-lighting","bloom","post-process","profiler","splash-screen","standard","unlit","sprite","particle","particle-gpu","particle-trail","billboard","terrain","graphics","clear-stencil","spine","occlusion-query","geometry-renderer","debug-renderer"],hy=e("ht",Gs("cc.EffectAsset")((ay=sy=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).techniques=ty&&ty(),t.shaders=iy&&iy(),t.combinations=ny&&ny(),t.hideInEditor=ry&&ry(),t}s(t,e),t.register=function(e){t._effects[e.name]=e,t._layoutValid=!1},t.remove=function(e){if("string"!=typeof e)t._effects[e.name]&&t._effects[e.name]===e&&delete t._effects[e.name];else{if(t._effects[e])return void delete t._effects[e];for(var i in t._effects)if(t._effects[i]._uuid===e)return void delete t._effects[i]}},t.get=function(e){if(t._effects[e])return t._effects[e];for(var i in t._effects)if(t._effects[i]._uuid===e)return t._effects[i];return uy.includes(e)&&q(16101,e),null},t.getAll=function(){return t._effects},t.isLayoutValid=function(){return t._layoutValid},t.setLayoutValid=function(){t._layoutValid=!0};var i=t.prototype;return i.onLoaded=function(){v.rendering&&v.rendering.enableEffectImport?(function(e){for(var t=0;t<e.techniques.length;t++)for(var i=e.techniques[t],n=0;n<i.passes.length;n++){var r=i.passes[n];void 0!==r.propertyIndex&&void 0===r.properties&&(r.properties=i.passes[r.propertyIndex].properties)}}(this),v.rendering.programLib.addEffect(this)):oy.register(this),t.register(this),v.game.once(v.Game.EVENT_RENDERER_INITED,this._precompile,this)},i._precompile=function(){var e=this;if(v.rendering&&v.rendering.enableEffectImport)v.rendering.programLib.precompileEffect(gd.gfxDevice,this);else for(var t=v.director.root,i=function(i){var n=e.shaders[i],s=e.combinations[i];if(!s)return"continue";(function(e){return Object.keys(e).reduce((function(t,i){return t.reduce((function(t,n){for(var s=e[i],a=0;a<s.length;++a){var o=r({},n);o[i]=s[a],t.push(o)}return t}),[])}),[{}])})(s).forEach((function(e){return oy.getGFXShader(gd.gfxDevice,n.name,e,t.pipeline)}))},n=0;n<this.shaders.length;n++)i(n)},i.destroy=function(){return t.remove(this),e.prototype.destroy.call(this)},i.initDefault=function(i){e.prototype.initDefault.call(this,i);var n=t.get("builtin-unlit");this.name="builtin-unlit",this.shaders=n.shaders,this.combinations=n.combinations,this.techniques=n.techniques},i.validate=function(){return this.techniques.length>0&&this.shaders.length>0},t}(qd),sy._effects={},sy._layoutValid=!0,ty=Cs((ey=ay).prototype,"techniques",[Ys],(function(){return[]})),iy=Cs(ey.prototype,"shaders",[Ys],(function(){return[]})),ny=Cs(ey.prototype,"combinations",[Ys],(function(){return[]})),ry=Cs(ey.prototype,"hideInEditor",[Ys,Qs],(function(){return!1})),$v=ey))||$v);v.EffectAsset=hy;var cy=function(){function e(){this.name="",this.base="",this.importBase="",this.nativeBase="",this.deps=null,this.assetInfos=new vd,this.scenes=new vd,this.paths=new vd}var t=e.prototype;return t.init=function(e){var t=this;!function(e){var t=e.uuids,i=e.paths,n=e.types,r=e.deps,s=e.paths=Object.create(null);if(!1===e.debug){for(var a=0,o=t.length;a<o;a++)t[a]=Fd(t[a]);for(var u in i){var h=i[u],c=h[1];h[1]=n[c]}}else{for(var l=Object.create(null),_=0,d=t.length;_<d;_++){var f=t[_];t[_]=l[f]=Fd(f)}t=l}for(var p in i){var m=i[p];s[t[p]]=m}var g=e.scenes;for(var v in g){var y=g[v];g[v]=t[y]}var E=e.packs;for(var T in E)for(var A=E[T],S=0;S<A.length;++S)A[S]=t[A[S]];var R=e.versions;if(R)for(var w in R)for(var I=R[w],b=0;b<I.length;b+=2){var O=I[b];I[b]=t[O]||O}var N=e.redirect;if(N)for(var C=0;C<N.length;C+=2)N[C]=t[N[C]],N[C+1]=r[N[C+1]];if(e.extensionMap){var M=function(i){if(!Object.prototype.hasOwnProperty.call(e.extensionMap,i))return"continue";e.extensionMap[i].forEach((function(n,r){e.extensionMap[i][r]=t[n]||n}))};for(var P in e.extensionMap)M(P)}}(e),this.importBase=e.importBase||"",this.nativeBase=e.nativeBase||"",this.base=e.base||"",this.name=e.name||"",this.deps=e.deps||[],this._initUuid(e.uuids),this._initPath(e.paths),this._initScene(e.scenes),this._initPackage(e.packs),this._initVersion(e.versions),this._initRedirect(e.redirect);var i=function(i){if(!Object.prototype.hasOwnProperty.call(e.extensionMap,i))return"continue";e.extensionMap[i].forEach((function(e){var n=t.assetInfos.get(e);n&&(n.extension=i)}))};for(var n in e.extensionMap)i(n)},t.getInfoWithPath=function(e,t){if(!e)return null;e=Hd(e);var i=this.paths.get(e);if(i){if(!t)return i[0];for(var n=0,r=i.length;n<r;n++){var s=i[n];if(Ve(s.ctor,t))return s}}return null},t.getDirWithPath=function(e,t,i){"/"===(e=Hd(e))[e.length-1]&&(e=e.slice(0,-1));var n=i||[];return this.paths.forEach((function(i,r){if(r.startsWith(e)&&function(e,t){return!(e.length>t.length)||47===e.charCodeAt(t.length)}(r,e)||!e)for(var s=0,a=i.length;s<a;s++){var o=i[s];t&&!Ve(o.ctor,t)||n.push(o)}})),n},t.getAssetInfo=function(e){return this.assetInfos.get(e)||null},t.getSceneInfo=function(e){return e.endsWith(".scene")||(e+=".scene"),"/"===e[0]||e.startsWith("db://")||(e="/"+e),this.scenes.find((function(t,i){return i.endsWith(e)}))},t.destroy=function(){this.paths.destroy(),this.scenes.destroy(),this.assetInfos.destroy()},t._initUuid=function(e){if(e){this.assetInfos.clear();for(var t=0,i=e.length;t<i;t++){var n=e[t];this.assetInfos.add(n,{uuid:n})}}},t._initPath=function(e){if(e){var t=this.paths;for(var i in t.clear(),e){var n=e[i],r=n[0],s=n[1],a=3===n.length,o=this.assetInfos.get(i);o.path=r,o.ctor=tt(s),t.has(r)?a?t.get(r).push(o):t.get(r).unshift(o):t.add(r,[o])}}},t._initScene=function(e){if(e){var t=this.scenes;t.clear();var i=this.assetInfos;for(var n in e){var r=e[n],s=i.get(r);s.url=n,t.add(n,s)}}},t._initPackage=function(e){if(e){var t=this.assetInfos;for(var i in e){var n=e[i],r={uuid:i,packedUuids:n,ext:".json"};t.add(i,r);for(var s=0,a=n.length;s<a;s++){var o=n[s],u=t.get(o),h=u.packs;h?1===a?h.unshift(r):h.push(r):u.packs=[r]}}}},t._initVersion=function(e){if(e){var t=this.assetInfos,i=e.import;if(i)for(var n=0,r=i.length;n<r;n+=2){var s=i[n];t.get(s).ver=i[n+1]}if(i=e.native)for(var a=0,o=i.length;a<o;a+=2){var u=i[a];t.get(u).nativeVer=i[a+1]}}},t._initRedirect=function(e){if(e)for(var t=this.assetInfos,i=0,n=e.length;i<n;i+=2){var r=e[i];t.get(r).redirect=e[i+1]}},e}();function ly(e,t){e._uuid&&t.push(e._uuid)}function _y(e,t){for(var i=Object.getOwnPropertyNames(e),n=0;n<i.length;n++){var r=i[n];if("node"!==r&&"__eventTargets"!==r){var s=e[r];if("object"==typeof s&&s)if(Array.isArray(s))for(var a=0;a<s.length;a++){var o=s[a];o instanceof qd&&ly(o,t)}else if(s.constructor&&s.constructor!==Object)s instanceof qd&&ly(s,t);else for(var u=Object.getOwnPropertyNames(s),h=0;h<u.length;h++){var c=s[u[h]];c instanceof qd&&ly(c,t)}}}}function dy(e,t){for(var i=0;i<e._components.length;i++)_y(e._components[i],t);for(var n=0;n<e._children.length;n++)dy(e._children[n],t)}function fy(e,t,i,n){i.push(e._uuid);for(var r=Fp.getDeps(e._uuid),s=0,a=r.length;s<a;s++){var o=Td.get(r[s]);if(o){var u=o._uuid;u in t?t[u]+=n:t[u]=o.refCount+n,i.includes(u)||fy(o,t,i,n)}}}var py=[],my=new(function(){function e(){this._persistNodeDeps=new vd,this._toDelete=new vd,this._eventListener=!1,this._dontDestroyAssets=[]}var t=e.prototype;return t.addIgnoredAsset=function(e){this._dontDestroyAssets.push(e._uuid)},t.init=function(){this._persistNodeDeps.clear(),this._toDelete.clear()},t._addPersistNodeRef=function(e){var t=[];dy(e,t);for(var i=0,n=t.length;i<n;i++){var r=Td.get(t[i]);r&&r.addRef()}this._persistNodeDeps.add(e.uuid,t)},t._removePersistNodeRef=function(e){if(this._persistNodeDeps.has(e.uuid)){for(var t=this._persistNodeDeps.get(e.uuid),i=0,n=t.length;i<n;i++){var r=Td.get(t[i]);r&&r.decRef()}this._persistNodeDeps.remove(e.uuid)}},t._autoRelease=function(e,t,i){if(e){for(var n=Fp.getDeps(e.uuid),r=0,s=n.length;r<s;r++){var a=Td.get(n[r]);a&&a.decRef(e.autoReleaseAssets)}var o=Fp._depends.get(e.uuid);if(o&&o.persistDeps)for(var u=o.persistDeps,h=0,c=u.length;h<c;h++){var l=Td.get(u[h]);l&&l.decRef(e.autoReleaseAssets)}e.uuid!==t.uuid&&Fp.remove(e.uuid)}var _=Fp._depends.get(t.uuid);for(var f in _&&(_.persistDeps=[]),i){for(var p,m,g=i[f],v=this._persistNodeDeps.get(g.uuid),y=d(v);!(m=y()).done;){var E=m.value,T=Td.get(E);T&&T.addRef()}_&&(p=_.persistDeps).push.apply(p,v)}},t.tryRelease=function(e,t){void 0===t&&(t=!1),e instanceof qd&&(t?this._free(e,t):(this._toDelete.add(e._uuid,e),this._eventListener||(this._eventListener=!0,xt(this._freeAssets.bind(this)))))},t._freeAssets=function(){var e=this;this._eventListener=!1,this._toDelete.forEach((function(t){e._free(t)})),this._toDelete.clear()},t._free=function(e,t){void 0===t&&(t=!1);var i=e._uuid;if(this._toDelete.remove(i),ka(e,!0)&&-1===this._dontDestroyAssets.indexOf(i)&&!(!t&&e.refCount>0&&function(e){var t=Object.create(null);if(t[e._uuid]=e.refCount,fy(e,t,py,-1),py.length=0,0!==t[e._uuid])return t[e._uuid];for(var i in t)0!==t[i]&&fy(Td.get(i),t,py,1);return py.length=0,t[e._uuid]}(e)>0)){Td.remove(i);for(var n=Fp.getDeps(i),r=0,s=n.length;r<s;r++){var a=Td.get(n[r]);a&&(a.decRef(!1),this._free(a,!1))}e.destroy(),Fp.remove(i)}},e}()),gy=null;function vy(e,t){for(var i=0,n=e.input.length;i<n;i++){var r=e.input[i];t&&!r.isNative&&r.content instanceof qd&&r.content.decRef(!1),r.recycle()}e.input=null}function yy(e,t){return t?/\?/.test(e)?e+"&_t="+Date.now():e+"?_t="+Date.now():e}function Ey(e,t,i,n,r){void 0===r&&(r=0),e(r,(function(s,a){r++,!s||r>t?n&&n(s,a):setTimeout((function(){Ey(e,t,i,n,r)}),i)}))}function Ty(e,t,i,n,s){try{for(var a=Fp.parse(e,t),o=0,u=a.deps.length;o<u;o++){var h=a.deps[o];h in i||(i[h]=!0,n.push({uuid:h,bundle:s&&s.name}))}a.nativeDep&&(s&&(a.nativeDep.bundle=s.name),n.push(r({},a.nativeDep)))}catch(e){k(e.message,e.stack)}}function Ay(e,t,i){t&&(i=void 0!==i?i:v.assetManager.cacheAsset,kd(t)||!i||t.isDefault||Td.add(e,t))}function Sy(e,t,i){var n=0,r=[],s=e.length;0===s&&i&&i(r);for(var a=function(e){e&&r.push(e),++n===s&&i&&i(r)},o=0;o<s;o++)t(e[o],a)}function Ry(e,t,i){var n=e,r=t,s=i;if(void 0===i){var a="function"==typeof e;t?(s=t,a||(r=null)):void 0===t&&a&&(s=e,n=null,r=null),void 0!==t&&a&&(r=e,n=null)}return{options:n||Object.create(null),onProgress:r,onComplete:s}}function wy(e,t,i){var n=e,r=t,s=i;if(void 0===i){var a=Ve(e,qd);t?(s=t,a&&(r=null)):void 0!==t||a||(s=e,r=null,n=null),void 0===t||a||(r=e,n=null)}return{type:n,onProgress:r||gy,onComplete:s}}function Iy(e,t,i,n){if(void 0===n&&(n={}),!i[t]||n[t])return!1;n[t]=!0;var r=!1,s=Fp.getDeps(t);if(s)for(var a=0,o=s.length;a<o;a++){var u=s[a];if(u===e||Iy(e,u,i,n)){r=!0;break}}return r}function by(e){return function(t,i){if(e){var n=[];Array.isArray(i)?i.forEach((function(e){return e instanceof qd&&n.push(e.addRef())})):i instanceof qd&&n.push(i.addRef()),xt((function(){n.forEach((function(e){return e.decRef(!1)})),e(t,i)}))}}}var Oy=function(){function e(){this._config=new cy}var t=e.prototype;return t.getInfoWithPath=function(e,t){return this._config.getInfoWithPath(e,t)},t.getDirWithPath=function(e,t,i){return this._config.getDirWithPath(e,t,i)},t.getAssetInfo=function(e){return this._config.getAssetInfo(e)},t.getSceneInfo=function(e){return this._config.getSceneInfo(e)},t.init=function(e){this._config.init(e),Rd.add(e.name,this)},t.load=function(e,t,i,n){var r=wy(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u={__requestType__:Ed.PATH,type:s,bundle:this.name,__outputAsArray__:Array.isArray(e)};v.assetManager.loadAny(e,u,a,o)},t.preload=function(e,t,i,n){var r=wy(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.preloadAny(e,{__requestType__:Ed.PATH,type:s,bundle:this.name},a,o)},t.loadDir=function(e,t,i,n){var r=wy(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.loadAny(e,{__requestType__:Ed.DIR,type:s,bundle:this.name,__outputAsArray__:!0},a,o)},t.preloadDir=function(e,t,i,n){var r=wy(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;v.assetManager.preloadAny(e,{__requestType__:Ed.DIR,type:s,bundle:this.name},a,o)},t.loadScene=function(e,t,i,n){var r=Ry(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"scene",s.bundle=this.name,v.assetManager.loadAny({scene:e},s,a,(function(e,t){if(e)k(e.message,e.stack);else if(t.scene){var i=t.scene;i._id=t._uuid,i.name=t.name}else e=new Error("The asset "+t._uuid+" is not a scene");o&&o(e,t)}))},t.preloadScene=function(e,t,i,n){var r=Ry(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.bundle=this.name,v.assetManager.preloadAny({scene:e},s,a,(function(t){t&&Z(1210,e,t.message),o&&o(t)}))},t.get=function(e,t){var i=this.getInfoWithPath(e,t);return i&&Td.get(i.uuid)||null},t.release=function(e,t){var i=this.get(e,t);i&&my.tryRelease(i,!0)},t.releaseUnusedAssets=function(){var e=this;Td.forEach((function(t){var i=e.getAssetInfo(t._uuid);i&&!i.redirect&&my.tryRelease(t)}))},t.releaseAll=function(){var e=this;Td.forEach((function(t){var i=e.getAssetInfo(t._uuid);i&&!i.redirect&&my.tryRelease(t,!0)}))},t._destroy=function(){this._config.destroy()},n(e,[{key:"config",get:function(){return this._config}},{key:"name",get:function(){return this._config.name}},{key:"deps",get:function(){return this._config.deps}},{key:"base",get:function(){return this._config.base}}]),e}(),Ny=e("hy",new Oy);function Cy(e,t,i){var n=new E.Image;function r(){n.removeEventListener("load",r),n.removeEventListener("error",s),i&&i(null,n)}function s(){n.removeEventListener("load",r),n.removeEventListener("error",s),i&&i(new Error(te(4930,e)))}return"file:"!==E.location.protocol&&(n.crossOrigin="anonymous"),n.addEventListener("load",r),n.addEventListener("error",s),n.src=e,n}function My(e,t,i,n){var r=new XMLHttpRequest,s="download failed: "+e+", status: ";if(r.open("GET",e,!0),void 0!==t.xhrResponseType&&(r.responseType=t.xhrResponseType),void 0!==t.xhrWithCredentials&&(r.withCredentials=t.xhrWithCredentials),void 0!==t.xhrMimeType&&r.overrideMimeType&&r.overrideMimeType(t.xhrMimeType),void 0!==t.xhrTimeout&&(r.timeout=t.xhrTimeout),t.xhrHeader)for(var a in t.xhrHeader)r.setRequestHeader(a,t.xhrHeader[a]);return r.onload=function(){200===r.status||0===r.status?n&&n(null,r.response):n&&n(new Error(""+s+r.status+"(no response)"))},i&&(r.onprogress=function(e){e.lengthComputable&&i(e.loaded,e.total)}),r.onerror=function(){n&&n(new Error(""+s+r.status+"(error)"))},r.ontimeout=function(){n&&n(new Error(""+s+r.status+"(time out)"))},r.onabort=function(){n&&n(new Error(""+s+r.status+"(abort)"))},r.send(null),r}v.resources=Ny;var Py=E.document,Ly={};function xy(e,t,i){if(Ly[e])return i&&i(null),null;var n=Py.createElement("script");function r(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),Ly[e]=!0,i&&i(null)}function s(){n.parentNode.removeChild(n),n.removeEventListener("load",r,!1),n.removeEventListener("error",s,!1),i&&i(new Error(te(4928,e)))}return"file:"!==E.location.protocol&&(n.crossOrigin="anonymous"),n.async=t.scriptAsyncLoading||!1,n.src=e,n.addEventListener("load",r,!1),n.addEventListener("error",s,!1),Py.body.appendChild(n),n}var Dy=/^(?:\w+:\/\/|\.+\/).+/,Fy=function(e,t,i){(Ec.hasFeature(Ec.Feature.IMAGE_BITMAP)&&v.assetManager.allowImageBitmap?By:Cy)(e,t,i)},By=function(e,t,i){t.xhrResponseType="blob",My(e,t,t.onFileProgress,i)},Uy=function(e,t,i){t.xhrResponseType="json",My(e,t,t.onFileProgress,i)},Gy=function(e,t,i){t.xhrResponseType="arraybuffer",My(e,t,t.onFileProgress,i)},ky=function(e,t,i){Uy(e,t,(function(t,n){if(t)i(t);else{var r=ip(n);Promise.all(r.chunks.map((function(i){return new Promise((function(n,r){Gy(""+tc(e)+i,{},(function(e,i){t?r(t):n(new Uint8Array(i))}))}))}))).then((function(e){var t=new tp(r.document,e);i(null,t)})).catch((function(e){i(e)}))}}))},Hy=function(e,t,i){Gy(e,t,(function(e,t){if(e)i(e);else try{var n=np(new Uint8Array(t));i(null,n)}catch(e){i(e)}}))},zy=function(e,t,i){t.xhrResponseType="text",My(e,t,t.onFileProgress,i)},Vy=function(e,t,i){var n=ic(e),r=e;Dy.test(r)||(r=-1!==Zy.remoteBundles.indexOf(n)?Zy.remoteServerAddress+"remote/"+n:"assets/"+n);var s=t.version||Zy.bundleVers[n],a=0,o=null,u=null;Uy(r+"/config."+(s?s+".":"")+"json",t,(function(e,t){u=e,(o=t)&&(o.base=r+"/"),2==++a&&i(u,o)})),xy(r+"/index."+(s?s+".":"")+"js",t,(function(e){u=e,2==++a&&i(e,o)}))},Wy=function(){var e=t.prototype;function t(){this.maxConcurrency=6,this.maxRequestsPerFrame=6,this.maxRetryCount=3,this.appendTimeStamp=!!m,this.limited=!m,this.retryInterval=2e3,this.bundleVers=null,this.remoteBundles=[],this.downloadDomImage=Cy,this.downloadDomAudio=null,this.downloadFile=My,this.downloadScript=xy,this._downloaders={".png":Fy,".jpg":Fy,".bmp":Fy,".jpeg":Fy,".gif":Fy,".ico":Fy,".tiff":Fy,".webp":Fy,".image":Fy,".pvr":Gy,".pkm":Gy,".astc":Gy,".txt":zy,".xml":zy,".vsh":zy,".fsh":zy,".atlas":zy,".tmx":zy,".tsx":zy,".json":Uy,".ExportJson":Uy,".plist":zy,".ccon":ky,".cconb":Hy,".fnt":zy,".binary":Gy,".bin":Gy,".dbbin":Gy,".skel":Gy,".js":xy,bundle:Vy,default:zy},this._downloading=new vd,this._queue=[],this._queueDirty=!1,this._totalNum=0,this._totalNumThisPeriod=0,this._lastDate=-1,this._checkNextPeriod=!1,this._remoteServerAddress="",this._maxInterval=1/30}return e.init=function(e,t,i){void 0===e&&(e=""),void 0===t&&(t={}),void 0===i&&(i=[]),this._downloading.clear(),this._queue.length=0,this._remoteServerAddress=e,this.bundleVers=t,this.remoteBundles=i},e.register=function(e,t){"object"==typeof e?ke(this._downloaders,e):this._downloaders[e]=t},e.download=function(e,t,i,n,r){var s=this,a=Ad.get(e);if(a)r(null,a);else{var o=this._downloading.get(e);if(o){o.push(r);var u=this._queue.find((function(t){return t.id===e}));if(!u)return;var h=n.priority||0;u.priority<h&&(u.priority=h,this._queueDirty=!0)}else{var c=void 0!==n.maxRetryCount?n.maxRetryCount:this.maxRetryCount,l=void 0!==n.maxConcurrency?n.maxConcurrency:this.maxConcurrency,_=void 0!==n.maxRequestsPerFrame?n.maxRequestsPerFrame:this.maxRequestsPerFrame,d=this._downloaders[i]||this._downloaders.default;Ey((function(i,a){if(0===i&&s._downloading.add(e,[r]),s.limited){s._updateTime();var o=function(e,t){s._totalNum--,s._handleQueueInNextFrame(l,_),a(e,t)};s._totalNum<l&&s._totalNumThisPeriod<_?(d(yy(t,s.appendTimeStamp),n,o),s._totalNum++,s._totalNumThisPeriod++):(s._queue.push({id:e,priority:n.priority||0,url:t,options:n,done:o,handler:d}),s._queueDirty=!0,s._totalNum<l&&s._handleQueueInNextFrame(l,_))}else d(yy(t,s.appendTimeStamp),n,a)}),c,this.retryInterval,(function(t,i){t||Ad.add(e,i);for(var n=s._downloading.remove(e),r=0,a=n.length;r<a;r++)n[r](t,i)}))}}},e.loadSubpackage=function(e,t){v.assetManager.loadBundle(e,null,t)},e._updateTime=function(){var e=performance.now(),t=v.game.deltaTime,i=t>this._maxInterval?this._maxInterval:t;e-this._lastDate>1e3*i&&(this._totalNumThisPeriod=0,this._lastDate=e)},e._handleQueue=function(e,t){for(this._checkNextPeriod=!1,this._updateTime();this._queue.length>0&&this._totalNum<e&&this._totalNumThisPeriod<t;){this._queueDirty&&(this._queue.sort((function(e,t){return e.priority-t.priority})),this._queueDirty=!1);var i=this._queue.pop();if(!i)break;this._totalNum++,this._totalNumThisPeriod++,i.handler(yy(i.url,this.appendTimeStamp),i.options,i.done)}this._handleQueueInNextFrame(e,t)},e._handleQueueInNextFrame=function(e,t){!this._checkNextPeriod&&this._queue.length>0&&(xt(this._handleQueue.bind(this),e,t),this._checkNextPeriod=!0)},n(t,[{key:"remoteServerAddress",get:function(){return this._remoteServerAddress}}],[{key:"instance",get:function(){return t._instance||(t._instance=new t),t._instance}}]),t}();Wy._instance=void 0;var jy,Xy,Ky,Yy,qy,Qy,Zy=Wy.instance,Jy=e("e6",Wy.instance),$y=e("hr",Gs("cc.JsonAsset")((Xy=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).json=Ky&&Ky(),t}return s(t,e),t}(qd),Ky=Cs(Xy.prototype,"json",[Ys],(function(){return null})),jy=Xy))||jy);v.JsonAsset=$y;var eE,tE,iE=e("hq",Gs("cc.TextAsset")((qy=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).text=Qy&&Qy(),t}return s(t,e),t.prototype.toString=function(){return this.text},t}(qd),Qy=Cs(qy.prototype,"text",[Ys],(function(){return""})),Yy=qy))||Yy);v.TextAsset=iE;var nE=e("ho",Gs("cc.BufferAsset")((f((tE=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._buffer=null,t}s(t,e);var i=t.prototype;return i.buffer=function(){return this._buffer,this._buffer},i.validate=function(){return!!this._buffer},n(t,[{key:"_nativeAsset",get:function(){return this._buffer},set:function(e){e instanceof ArrayBuffer?this._buffer=e:this._buffer=e.buffer}}]),t}(qd)).prototype,"_nativeAsset",[Ea],Object.getOwnPropertyDescriptor(tE.prototype,"_nativeAsset"),tE.prototype),eE=tE))||eE);function rE(e,t,i,n){var r=null,s=null;try{(r=new Ef)._nativeUrl=e,r._nativeAsset=t}catch(e){s=e}n(s,r)}function sE(e,t,i,n){var r=new $y;r.json=t,n(null,r)}function aE(e,t,i,n){var r=new iE;r.text=t,n(null,r)}function oE(e,t,i,n){var r=new nE;r._nativeUrl=e,r._nativeAsset=t,n(null,r)}function uE(e,t,i,n){var r=new qd;r._nativeUrl=e,r._nativeAsset=t,n(null,r)}function hE(e,i,n,r){var s=Rd.get(i.name);s||(s=i.name===Nd.RESOURCES?Ny:new Oy,i.base=i.base||e+"/",s.init(i)),t.import("virtual:///prerequisite-imports/"+s.name).then((function(){r(null,s)})).catch(r)}v.BufferAsset=nE;var cE=function(){function e(){this._creating=new vd,this._producers={".png":rE,".jpg":rE,".bmp":rE,".jpeg":rE,".gif":rE,".ico":rE,".tiff":rE,".webp":rE,".image":rE,".pvr":rE,".pkm":rE,".txt":aE,".xml":aE,".vsh":aE,".fsh":aE,".atlas":aE,".tmx":aE,".tsx":aE,".fnt":aE,".json":sE,".ExportJson":sE,".binary":oE,".bin":oE,".dbbin":oE,".skel":oE,bundle:hE,default:uE}}var t=e.prototype;return t.register=function(e,t){"object"==typeof e?ke(this._producers,e):this._producers[e]=t},t.create=function(e,t,i,n,r){var s=this,a=this._producers[i]||this._producers.default,o=Td.get(e);if(n.reloadAsset||!o){var u=this._creating.get(e);u?u.push(r):(this._creating.add(e,[r]),a(e,t,n,(function(t,i){!t&&i instanceof qd&&(i._uuid=e,Ay(e,i,n.cacheAsset));for(var r=s._creating.remove(e),a=0,o=r.length;a<o;a++)r[a](t,i)})))}else r(null,o)},e}(),lE=e("e7",new cE),_E=new(function(){function e(){this._loading=new vd,this._unpackers={".json":this.unpackJson}}var t=e.prototype;return t.unpackJson=function(e,t,i,n){var r=Ne(!0),s=null;if(Array.isArray(t)){(t=function(e){if(e[0]<1)throw new Error(te(5304,e[0]));wp(e,!0,void 0,bp.reportMissingClass),Ip(e);for(var t=new Op(e[0]),i=e[1],n=e[2],r=e[3],s=e[4],a=e[5],o=0;o<a.length;++o)a[o].unshift(t,i,n,r,s);return a}(t)).length!==e.length&&Z(4915);for(var a=0;a<e.length;a++)r[e[a]+"@import"]=t[a]}else{var o=rt(Xp),u=rt(Ef);if(t.type===o&&t.data){var h=t.data;h.length!==e.length&&Z(4915);for(var c=0;c<e.length;c++)r[e[c]+"@import"]=Np(o,{base:h[c][0],mipmaps:h[c][1]})}else if(t.type===u&&t.data){var l=t.data;l.length!==e.length&&Z(4915);for(var _=0;_<e.length;_++)r[e[_]+"@import"]=l[_]}else s=new Error("unmatched type pack!"),r=null}n(s,r)},t.init=function(){this._loading.clear()},t.register=function(e,t){"object"==typeof e?ke(this._unpackers,e):this._unpackers[e]=t},t.unpack=function(e,t,i,n,r){t?(0,this._unpackers[i])(e,t,n,r):r(new Error("package data is wrong!"))},t.load=function(e,t,i){var n=this;if(!e.isNative&&e.info&&e.info.packs)if(Ad.has(e.id))i(null,Ad.get(e.id));else{var r=e.info.packs,s=r.find((function(e){return n._loading.has(e.uuid)}));if(s)this._loading.get(s.uuid).push({onComplete:i,id:e.id});else{s=r[0],this._loading.add(s.uuid,[{onComplete:i,id:e.id}]);var a=zd(s.uuid,{ext:s.ext,bundle:e.config.name});Jy.download(s.uuid,a,s.ext,e.options,(function(t,i){Ad.remove(s.uuid),t&&k(t.message,t.stack),n.unpack(s.packedUuids,i,s.ext,e.options,(function(e,i){if(!e)for(var r in i)Ad.add(r,i[r]);for(var a=n._loading.remove(s.uuid),o=0,u=a.length;o<u;o++){var h=a[o];if(t||e)h.onComplete(t||e);else{var c=i[h.id];c?h.onComplete(null,c):h.onComplete(new Error("can not retrieve data from package"))}}}))}))}}else Jy.download(e.id,e.url,e.ext,e.options,i)},e}());function dE(e,t){var i=!1;e.progress||(e.progress={finish:0,total:e.input.length,canInvoke:!0},i=!0);var n=e.options,r=e.progress,s=[],a=r.total,o=n.__exclude__=n.__exclude__||Object.create(null);e.output=[],Sy(e.input,(function(n,u){if(!n.isNative&&Td.has(n.uuid)){var h=Td.get(n.uuid);return n.content=h.addRef(),e.output.push(n),r.canInvoke&&e.dispatch("progress",++r.finish,r.total,n),void u()}_E.load(n,e.options,(function(h,c){h?e.isFinished||(!v.assetManager.force||i?(k(h.message,h.stack),r.canInvoke=!1,t(h)):(e.output.push(n),r.canInvoke&&e.dispatch("progress",++r.finish,r.total,n))):e.isFinished||(n.file=c,e.output.push(n),n.isNative||(o[n.uuid]=!0,Ty(n.uuid,c,o,s,n.config),r.total=a+s.length),r.canInvoke&&e.dispatch("progress",++r.finish,r.total,n)),u()}))}),(function(){if(e.isFinished)return vy(e,!0),void e.dispatch("error");if(s.length>0){var a=Md.create({input:s,progress:r,options:n,onProgress:e.onProgress,onError:Md.prototype.recycle,onComplete:function(n){var r;n||((r=e.output).push.apply(r,a.output),a.recycle()),i&&fE(e),t(n)}});Id.async(a)}else i&&fE(e),t()}))}function fE(e){for(var t=e.output,i=0,n=t.length;i<n;i++)t[i].content&&t[i].content.decRef(!1)}var pE=new(function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.parse=function(e){var t=this._parseXML(e).documentElement;if("plist"!==t.tagName)return q(5100),{};for(var i=null,n=0,r=t.childNodes.length;n<r&&1!==(i=t.childNodes[n]).nodeType;n++);return this._parseNode(i)},i._parseNode=function(e){var t=null,i=e.tagName;if("dict"===i)t=this._parseDict(e);else if("array"===i)t=this._parseArray(e);else if("string"===i)if(1===e.childNodes.length)t=e.firstChild.nodeValue;else{t="";for(var n=0;n<e.childNodes.length;n++)t+=e.childNodes[n].nodeValue}else"false"===i?t=!1:"true"===i?t=!0:"real"===i?t=parseFloat(e.firstChild.nodeValue):"integer"===i&&(t=parseInt(e.firstChild.nodeValue,10));return t},i._parseArray=function(e){for(var t=[],i=0,n=e.childNodes.length;i<n;i++){var r=e.childNodes[i];1===r.nodeType&&t.push(this._parseNode(r))}return t},i._parseDict=function(e){for(var t={},i="",n=0,r=e.childNodes.length;n<r;n++){var s=e.childNodes[n];1===s.nodeType&&("key"===s.tagName?i=s.firstChild.nodeValue:t[i]=this._parseNode(s))}return t},t}(function(){function e(){this._parser=null,globalThis.DOMParser&&(this._parser=new DOMParser)}var t=e.prototype;return t.parse=function(e){return this._parseXML(e)},t._parseXML=function(e){if(this._parser)return this._parser.parseFromString(e,"text/xml");throw new Error("Dom parser is not supported in this platform!")},e}())),mE=function(){function e(){this._parsing=new vd,this._parsers={".png":this.parseImage,".jpg":this.parseImage,".bmp":this.parseImage,".jpeg":this.parseImage,".gif":this.parseImage,".ico":this.parseImage,".tiff":this.parseImage,".webp":this.parseImage,".image":this.parseImage,".pvr":this.parsePVRTex,".pkm":this.parsePKMTex,".astc":this.parseASTCTex,".plist":this.parsePlist,import:this.parseImport,".ccon":this.parseImport,".cconb":this.parseImport}}var t=e.prototype;return t.parseImage=function(e,t,i){e instanceof HTMLImageElement?i(null,e):createImageBitmap(e,{premultiplyAlpha:"none"}).then((function(e){i(null,e)}),(function(e){i(e,null)}))},t.parsePVRTex=function(e,t,i){var n=null,r=null;try{r=Ef.parseCompressedTextures(e,0)}catch(e){n=e,console.warn(n)}i(n,r)},t.parsePKMTex=function(e,t,i){var n=null,r=null;try{r=Ef.parseCompressedTextures(e,1)}catch(e){n=e,console.warn(n)}i(n,r)},t.parseASTCTex=function(e,t,i){var n=null,r=null;try{r=Ef.parseCompressedTextures(e,2)}catch(e){n=e,console.warn(n)}i(n,r)},t.parsePlist=function(e,t,i){var n=null,r=pE.parse(e);r||(n=new Error("parse failed")),i(n,r)},t.parseImport=function(e,t,i){if(e){var n=null,r=null;try{n=Lp(e,t)}catch(e){r=e}i(r,n)}else i(new Error("The json file of asset "+t.__uuid__+" is empty or missing"))},t.init=function(){this._parsing.clear()},t.register=function(e,t){"object"==typeof e?ke(this._parsers,e):this._parsers[e]=t},t.parse=function(e,t,i,n,r){var s=this,a=Sd.get(e);if(a)r(null,a);else{var o=this._parsing.get(e);if(o)o.push(r);else{var u=this._parsers[i];u?(this._parsing.add(e,[r]),u(t,n,(function(t,i){t?Ad.remove(e):kd(i)||Sd.add(e,i);for(var n=s._parsing.remove(e),r=0,a=n.length;r<a;r++)n[r](t,i)}))):r(null,t)}}},n(e,null,[{key:"instance",get:function(){return this._instance||(this._instance=new e),this._instance}}]),e}();mE._instance=void 0;var gE=mE.instance;function vE(e,t){var i=!1;e.progress||(e.progress={finish:0,total:e.input.length,canInvoke:!0},i=!0);var n=e.options,r=e.progress;n.__exclude__=n.__exclude__||Object.create(null),e.output=[],Sy(e.input,(function(s,a){var o=Md.create({input:s,onProgress:e.onProgress,options:n,progress:r,onComplete:function(n,u){n&&!e.isFinished&&(!v.assetManager.force||i?(k(n.message,n.stack),r.canInvoke=!1,t(n)):r.canInvoke&&e.dispatch("progress",++r.finish,r.total,s)),e.output.push(u),o.recycle(),a(null)}});yE.async(o)}),(function(){if(n.__exclude__=null,e.isFinished)return vy(e,!0),void e.dispatch("error");!function(e){var t=e.source;if(e.options.__outputAsArray__||1!==t.length)for(var i=e.output=[],n=0,r=t.length;n<r;n++)i.push(t[n].content);else e.output=t[0].content}(e),vy(e,!0),t()}))}var yE=new yd("loadOneAsset",[function(e,t){var i=e.output=e.input,n=i.options,r=i.isNative,s=i.uuid,a=i.file,o=n.reloadAsset;a||!o&&!r&&Td.has(s)?t():_E.load(i,e.options,(function(e,n){i.file=n,t(e)}))},function(e,t){var i=e.output=e.input,n=e.progress,r=e.options.__exclude__,s=i.id,a=i.file,o=i.options;if(i.isNative)gE.parse(s,a,i.ext,o,(function(r,a){r?t(r):(i.content=a,n.canInvoke&&e.dispatch("progress",++n.finish,n.total,i),Ad.remove(s),Sd.remove(s),t())}));else{var u=i.uuid;if(u in r){var h=r[u],c=h.finish,l=h.content,_=h.err,f=h.callbacks;n.canInvoke&&e.dispatch("progress",++n.finish,n.total,i),c||Iy(u,u,r)?(l&&l.addRef(),i.content=l,t(_)):f.push({done:t,item:i})}else if(!o.reloadAsset&&Td.has(u)){var p=Td.get(u);i.content=p.addRef(),n.canInvoke&&e.dispatch("progress",++n.finish,n.total,i),t()}else o.__uuid__=u,gE.parse(s,a,"import",o,(function(i,n){i?t(i):function(e,t,i){var n=e.input,r=e.progress,s=n,a=s.uuid,o=s.id,u=s.options,h=s.config,c=u.cacheAsset,l=[];t.addRef&&t.addRef(),Ty(a,t,Object.create(null),l,h),r.canInvoke&&e.dispatch("progress",++r.finish,r.total+=l.length,n);var _=e.options.__exclude__[a]={content:t,finish:!1,callbacks:[{done:i,item:n}]},f=Md.create({input:l,options:e.options,onProgress:e.onProgress,onError:Md.prototype.recycle,progress:r,onComplete:function(e){if(t.decRef&&t.decRef(!1),_.finish=!0,_.err=e,!e){for(var i,n=Array.isArray(f.output)?f.output:[f.output],r=Object.create(null),s=d(n);!(i=s()).done;){var u=i.value;u&&(r[u instanceof qd?u._uuid+"@import":a+"@native"]=u)}!function(e,t,i){var n=Cp.get(t);if(n){for(var r=0,s=n.length;r<s;r++){var a=n[r],o=i[a.uuid+"@import"];if(o)a.owner[a.prop]=o.addRef();else{if(k("The asset "+a.uuid+" is missing!"),a.type&&a.type!==qd){var u=new a.type;u.initDefault(a.uuid),a.owner[a.prop]=u}!0}}Cp.delete(t)}Mp.has(t)&&(i[e+"@native"]?t._nativeAsset=i[e+"@native"]:(!0,console.error("the native asset of "+e+" is missing!")),Mp.delete(t))}(a,t,r);try{"function"!=typeof t.onLoaded||Pp.has(t)||Mp.has(t)||(t.onLoaded(),Pp.add(t))}catch(e){k("The asset "+a+" is invalid for some reason, detail message: "+e.message+", stack: "+e.stack)}Ad.remove(o),Sd.remove(o),Ay(a,t,c),f.recycle()}for(var h=_.callbacks,l=0,p=h.length;l<p;l++){var m=h[l];t.addRef&&t.addRef(),m.item.content=t,m.done(e)}h.length=0}});wd.async(f)}(e,n,t)}))}}]);function EE(e,t){var i=e.options,n=Object.create(null),r=Object.create(null);for(var s in i)switch(s){case Ed.PATH:case Ed.UUID:case Ed.DIR:case Ed.SCENE:case Ed.URL:break;case"__requestType__":case"__isNative__":case"ext":case"type":case"__nativeName__":case"audioLoadMode":case"bundle":n[s]=i[s];break;case"__exclude__":case"__outputAsArray__":r[s]=i[s];break;default:n[s]=i[s],r[s]=i[s]}e.options=r;var a=Md.create({input:e.input,options:n}),o=null;try{e.output=e.source=bd.sync(a)}catch(e){o=e;for(var u=0,h=a.output.length;u<h;u++)a.output[u].recycle()}a.recycle(),t(o)}var TE=function(){function e(){this.uuid="",this.overrideUuid="",this.url="",this.ext=".json",this.content=null,this.file=null,this.info=null,this.config=null,this.isNative=!1,this.options=Object.create(null),this._id=""}return e.create=function(){return 0!==e._deadPool.length?e._deadPool.pop():new e},e.prototype.recycle=function(){e._deadPool.length!==e.MAX_DEAD_NUM&&(this._id="",this.uuid="",this.overrideUuid="",this.url="",this.ext=".json",this.content=null,this.file=null,this.info=null,this.config=null,this.isNative=!1,this.options=Object.create(null),e._deadPool.push(this))},n(e,[{key:"id",get:function(){return this._id||(this._id=(this.overrideUuid||this.uuid)+"@"+(this.isNative?"native":"import")),this._id}}]),e}();TE.MAX_DEAD_NUM=500,TE._deadPool=[];var AE=[];function SE(e){var t=e.options,i=Array.isArray(e.input)?e.input:[e.input];e.output=[];for(var n=function(n){var r,s=i[n],a=TE.create(),o=null,u=null;if("string"==typeof s&&((s=Object.create(null))[t.__requestType__||Ed.UUID]=i[n]),"object"==typeof s)for(var h in Ge(s,t),s.preset&&Ge(s,Cd[s.preset]),s){switch(h){case Ed.UUID:if("break"===function(){var e,t=a.uuid=Fd(s.uuid);if(!s.bundle){var i=Rd.find((function(e){return!!e.getAssetInfo(t)}));s.bundle=i&&i.name}if(Rd.has(s.bundle)){if(o=Rd.get(s.bundle).config,(u=o.getAssetInfo(t))&&u.redirect){if(!Rd.has(u.redirect))throw new Error("Please load bundle "+u.redirect+" first");o=Rd.get(u.redirect).config,u=o.getAssetInfo(t)}a.config=o,a.info=u}return a.ext=s.ext||(null===(e=u)||void 0===e?void 0:e.extension)||".json","break"}())break;case"__requestType__":case"ext":case"bundle":case"preset":case"type":break;case Ed.DIR:if(Rd.has(s.bundle)){Rd.get(s.bundle).config.getDirWithPath(s.dir,s.type,AE);for(var c,l=d(AE);!(c=l()).done;){var _=c.value;i.push({uuid:_.uuid,__isNative__:!1,ext:_.extension||".json",bundle:s.bundle})}AE.length=0}a.recycle(),a=null;break;case Ed.PATH:if(Rd.has(s.bundle)){if(o=Rd.get(s.bundle).config,(u=o.getInfoWithPath(s.path,s.type))&&u.redirect){if(!Rd.has(u.redirect))throw new Error("you need to load bundle "+u.redirect+" first");o=Rd.get(u.redirect).config,u=o.getAssetInfo(u.uuid)}if(!u)throw a.recycle(),new Error("Bundle "+s.bundle+" doesn't contain "+s.path);a.config=o,a.uuid=u.uuid,a.info=u}a.ext=s.ext||(null===(r=u)||void 0===r?void 0:r.extension)||".json";break;case Ed.SCENE:if(!s.bundle){var f=Rd.find((function(e){return!!e.getSceneInfo(s.scene)}));s.bundle=f&&f.name}if(Rd.has(s.bundle)){if(o=Rd.get(s.bundle).config,(u=o.getSceneInfo(s.scene))&&u.redirect){if(!Rd.has(u.redirect))throw new Error("you need to load bundle "+u.redirect+" first");o=Rd.get(u.redirect).config,u=o.getAssetInfo(u.uuid)}if(!u)throw a.recycle(),new Error("Bundle "+o.name+" doesn't contain scene "+s.scene);a.config=o,a.uuid=u.uuid,a.info=u}break;case"__isNative__":a.isNative=s.__isNative__;break;case Ed.URL:a.url=s.url,a.uuid=s.uuid||s.url,a.ext=s.ext||ec(s.url),a.isNative=void 0===s.__isNative__||s.__isNative__;break;default:a.options[h]=s[h]}if(!a)break}if(!a)return"continue";if(e.output.push(a),!a.uuid&&!a.url)throw new Error("Can not parse this input:"+JSON.stringify(s))},r=0;r<i.length;r++)n(r);return null}function RE(e){for(var t=e.output=e.input,i=0;i<t.length;i++){var n=t[i];!Od.has(n.uuid)||function(){var e=Od.get(n.uuid),t=Rd.find((function(t){return!!t.getAssetInfo(e)}));if(t){var i;n.overrideUuid=e;var r=t.config,s=r.getAssetInfo(e);if(s&&s.redirect){if(!Rd.has(s.redirect))throw new Error("Please load bundle "+s.redirect+" first");s=(r=Rd.get(s.redirect).config).getAssetInfo(e)}n.config=r,n.info=s,n.ext=n.isNative?n.ext:(null===(i=s)||void 0===i?void 0:i.extension)||".json"}else q(16201,e,n.uuid)}()}}function wE(e){for(var t=e.output=e.input,i=0;i<t.length;i++){var n=t[i];if(!n.url){var r,s,a=n.config;s=n.isNative?a&&a.nativeBase?a.base+a.nativeBase:v.assetManager.generalNativeBase:a&&a.importBase?a.base+a.importBase:v.assetManager.generalImportBase;var o=n.overrideUuid||n.uuid,u="";n.info&&(u=n.isNative?n.info.nativeVer?"."+n.info.nativeVer:"":n.info.ver?"."+n.info.ver:""),r=".ttf"===n.ext?s+"/"+o.slice(0,2)+"/"+o+u+"/"+n.options.__nativeName__:s+"/"+o.slice(0,2)+"/"+o+u+n.ext,n.url=r}}return null}var IE=e("hx",function(){function e(){this.pipeline=wd.append(EE).append(vE),this.fetchPipeline=Id.append(EE).append(dE),this.transformPipeline=bd.append(SE).append(RE).append(wE),this.bundles=Rd,this.assets=Td,this.assetsOverrideMap=Od,this.generalImportBase="",this.generalNativeBase="",this.dependUtil=Fp,this.force=!1,this.allowImageBitmap=!Ec.isMobile,this.utils=Xd,this.downloader=Jy,this.parser=gE,this.packManager=_E,this.cacheAsset=!0,this.cacheManager=null,this.presets=Cd,this.factory=lE,this.preprocessPipe=EE,this.fetchPipe=dE,this.loadPipe=vE,this.references=null,this._releaseManager=my,this._files=Ad,this._parsed=Sd,this._parsePipeline=null,this._projectBundles=[]}var t=e.prototype;return t.init=function(e){void 0===e&&(e={});var t=e.server||St.querySettings(At.Category.ASSETS,"server")||"",i=e.bundleVers||St.querySettings(At.Category.ASSETS,"bundleVers")||{},n=e.remoteBundles||St.querySettings(At.Category.ASSETS,"remoteBundles")||[];this._files.clear(),this._parsed.clear(),this._releaseManager.init(),this.assets.clear(),this.bundles.clear(),this.packManager.init(),this.downloader.init(t,i,n),this.parser.init(),this.dependUtil.init();var r=e.importBase||St.querySettings(At.Category.ASSETS,"importBase")||"";r&&r.endsWith("/")&&(r=r.substr(0,r.length-1));var s=e.nativeBase||St.querySettings(At.Category.ASSETS,"nativeBase")||"";s&&s.endsWith("/")&&(s=s.substr(0,s.length-1)),this.generalImportBase=r,this.generalNativeBase=s,this._projectBundles=St.querySettings(At.Category.ASSETS,"projectBundles")||[];var a=St.querySettings(At.Category.ASSETS,"assetsOverrides")||{};for(var o in a)this.assetsOverrideMap.set(o,a[o])},t.getBundle=function(e){return Rd.get(e)||null},t.removeBundle=function(e){e._destroy(),Rd.remove(e.name)},t.loadAny=function(e,t,i,n){var r=Ry(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"default",e=Array.isArray(e)?e.slice():e;var u=Md.create({input:e,onProgress:a,onComplete:by(o),options:s});wd.async(u)},t.preloadAny=function(e,t,i,n){var r=Ry(t,i,n),s=r.options,a=r.onProgress,o=r.onComplete;s.preset=s.preset||"preload",e=Array.isArray(e)?e.slice():e;var u=Md.create({input:e,onProgress:a,onComplete:by(o),options:s});Id.async(u)},t.loadRemote=function(e,t,i){var n=Ry(t,void 0,i),r=n.options,s=n.onComplete;r.reloadAsset||!this.assets.has(e)?(r.__isNative__=!0,r.preset=r.preset||"remote",this.loadAny({url:e},r,null,(function(t,i){t?(k(t.message,t.stack),s&&s(t,i)):lE.create(e,i,r.ext||ec(e),r,(function(e,t){s&&s(e,t)}))}))):by(s)(null,this.assets.get(e))},t.loadBundle=function(e,t,i){var n=Ry(t,void 0,i),r=n.options,s=n.onComplete,a=ic(e);this.bundles.has(a)?by(s)(null,this.getBundle(a)):(r.preset=r.preset||"bundle",r.ext="bundle",r.__isNative__=!0,this.loadAny({url:e},r,null,(function(t,i){t?(k(t.message,t.stack),s&&s(t,i)):lE.create(e,i,"bundle",r,(function(e,t){s&&s(e,t)}))})))},t.releaseAsset=function(e){my.tryRelease(e,!0)},t.releaseUnusedAssets=function(){Td.forEach((function(e){my.tryRelease(e)}))},t.releaseAll=function(){Td.forEach((function(e){my.tryRelease(e,!0)}))},t.loadWithJson=function(){throw new Error("Only valid in Editor")},n(e,[{key:"main",get:function(){return Rd.get(Nd.MAIN)||null}},{key:"resources",get:function(){return Rd.get(Nd.RESOURCES)||null}}],[{key:"instance",get:function(){return this._instance||(this._instance=new e),this._instance}}]),e}());IE._instance=void 0,IE.Pipeline=yd,IE.Task=Md,IE.Cache=vd,IE.RequestItem=TE,IE.Bundle=Oy,IE.BuiltinBundleName=Nd,IE.CacheManager=function(){this.cacheDir=void 0,this.cacheEnabled=void 0,this.autoClear=void 0,this.cacheInterval=void 0,this.deleteInterval=void 0,this.cachedFiles=void 0},IE.Downloader=Wy,IE.Parser=mE,IE.DependUtil=xp;var bE=e("fq",v.assetManager=IE.instance);v.AssetManager=IE;var OE,NE,CE,ME=function(){function e(){this._resources={},this._materialsToBeCompiled=[]}var t=e.prototype;return t.init=function(){for(var e=this._resources,t=new Uint8Array(16),i=new Uint8Array(16),n=new Uint8Array(16),r=new Uint8Array(16),s=new Uint8Array(16),a=0,o=0;o<4;o++)t[a]=0,t[a+1]=0,t[a+2]=0,t[a+3]=255,i[a]=0,i[a+1]=0,i[a+2]=0,i[a+3]=0,n[a]=119,n[a+1]=119,n[a+2]=119,n[a+3]=255,r[a]=255,r[a+1]=255,r[a+2]=255,r[a+3]=255,s[a]=127,s[a+1]=127,s[a+2]=255,s[a+3]=255,a+=4;var u=new Uint8Array(1024);a=0;for(var h=0;h<256;h++)u[a]=221,u[a+1]=221,u[a+2]=221,u[a+3]=255,a+=4;a=0;for(var c=0;c<8;c++){for(var l=0;l<8;l++)u[a]=85,u[a+1]=85,u[a+2]=85,u[a+3]=255,a+=4;a+=32}a+=32;for(var _=0;_<8;_++){for(var d=0;d<8;d++)u[a]=85,u[a+1]=85,u[a+2]=85,u[a+3]=255,a+=4;a+=32}var f={width:2,height:2,_data:t,_compressed:!1,format:Xp.PixelFormat.RGBA8888},p={width:2,height:2,_data:i,_compressed:!1,format:Xp.PixelFormat.RGBA8888},m={width:2,height:2,_data:n,_compressed:!1,format:Xp.PixelFormat.RGBA8888},g={width:2,height:2,_data:r,_compressed:!1,format:Xp.PixelFormat.RGBA8888},y={width:2,height:2,_data:s,_compressed:!1,format:Xp.PixelFormat.RGBA8888},E={width:16,height:16,_data:u,_compressed:!1,format:Xp.PixelFormat.RGBA8888},T=new Ef(f),A=new Xp;A._uuid="black-texture",A.image=T,e[A._uuid]=A;var S=new Ef(p),R=new Xp;R._uuid="empty-texture",R.image=S,e[R._uuid]=R;var w=new jm;w._uuid="black-cube-texture",w.setMipFilter(jm.Filter.NEAREST),w.image={front:new Ef(f),back:new Ef(f),left:new Ef(f),right:new Ef(f),top:new Ef(f),bottom:new Ef(f)},e[w._uuid]=w;var I=new Ef(m),b=new Xp;b._uuid="grey-texture",b.image=I,e[b._uuid]=b;var O=new jm;O._uuid="grey-cube-texture",O.setMipFilter(jm.Filter.NEAREST),O.image={front:new Ef(m),back:new Ef(m),left:new Ef(m),right:new Ef(m),top:new Ef(m),bottom:new Ef(m)},e[O._uuid]=O;var N=new Ef(g),C=new Xp;C._uuid="white-texture",C.image=N,e[C._uuid]=C;var M=new jm;M._uuid="white-cube-texture",M.setMipFilter(jm.Filter.NEAREST),M.image={front:new Ef(g),back:new Ef(g),left:new Ef(g),right:new Ef(g),top:new Ef(g),bottom:new Ef(g)},e[M._uuid]=M;var P=new Ef(y),L=new Xp;L._uuid="normal-texture",L.image=P,e[L._uuid]=L;var x=new Ef(E),D=new Xp;D._uuid="default-texture",D.image=x,e[D._uuid]=D;var F=new jm;if(F.setMipFilter(jm.Filter.NEAREST),F._uuid="default-cube-texture",F.image={front:new Ef(E),back:new Ef(E),left:new Ef(E),right:new Ef(E),top:new Ef(E),bottom:new Ef(E)},e[F._uuid]=F,v.SpriteFrame){var B=new v.SpriteFrame,U=T,G=new Xp;G.image=U,B.texture=G,B._uuid="default-spriteframe",e[B._uuid]=B}},t.addAsset=function(e,t){this._resources[e]=t},t.get=function(e){return this._resources[e]},t.loadBuiltinAssets=function(){var e=this,t=St.querySettings(At.Category.ENGINE,"builtinAssets");if(!t)return Promise.resolve();var i=this._resources;return new Promise((function(n,r){bE.loadBundle(Nd.INTERNAL,(function(s){s?r(s):bE.loadAny(t,(function(t,s){t?r(t):(s.forEach((function(t){i[t.name]=t,my.addIgnoredAsset(t),t instanceof v.Material&&e._materialsToBeCompiled.push(t)})),n())}))}))}))},t.compileBuiltinMaterial=function(){for(var e=0;e<this._materialsToBeCompiled.length;++e)for(var t=this._materialsToBeCompiled[e],i=0;i<t.passes.length;++i)t.passes[i].tryCompile();this._materialsToBeCompiled.length=0},e}(),PE=e("d5",v.builtinResMgr=new ME),LE=e("h7",(OE=new Map,NE=0,function(e){return"number"==typeof e?e:(OE.has(e)||(OE.set(e,1<<NE),NE++),OE.get(e))})),xE=e("h0",function(){function e(e){this.instances=[],this.pass=void 0,this.hasPendingModels=!1,this.dynamicOffsets=[],this._device=void 0,this._device=e.device,this.pass=e}var t=e.prototype;return t.destroy=function(){for(var e=0;e<this.instances.length;++e){var t=this.instances[e];t.vb.destroy(),t.ia.destroy()}this.instances.length=0},t.merge=function(e,t,i){void 0===i&&(i=null);var n=e.instancedAttributeBlock,r=n.buffer.length;if(r){var s=e.inputAssembler,a=e.descriptorSet.getTexture(iv),o=e.descriptorSet.getTexture(fv),u=e.descriptorSet.getTexture(gv),h=e.useReflectionProbeType,c=i;c||(c=e.shaders[t]);for(var l=e.descriptorSet,_=0;_<this.instances.length;++_){var d,f,p=this.instances[_];if(!((null===(d=p.ia.indexBuffer)||void 0===d?void 0:d.objectID)!==(null===(f=s.indexBuffer)||void 0===f?void 0:f.objectID)||p.count>=1024)&&p.lightingMap.objectID===a.objectID&&p.useReflectionProbeType===h&&p.reflectionProbeCubemap.objectID===o.objectID&&p.reflectionProbePlanarMap.objectID===u.objectID&&p.stride===r){if(p.count>=p.capacity){p.capacity<<=1;var m=p.stride*p.capacity,g=p.data;p.data=new Uint8Array(m),p.data.set(g),p.vb.resize(m)}return p.shader=c,p.descriptorSet=l,p.data.set(n.buffer,p.stride*p.count++),void(this.hasPendingModels=!0)}}for(var v=this._device.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,32*r,r)),y=new Uint8Array(32*r),E=s.vertexBuffers.slice(),T=s.attributes.slice(),A=s.indexBuffer,S=0;S<n.attributes.length;S++){var R=n.attributes[S],w=new i_(R.name,R.format,R.isNormalized,E.length,!0);T.push(w)}y.set(n.buffer),E.push(v);var I=new r_(T,E,A),b=this._device.createInputAssembler(I);this.instances.push({count:1,capacity:32,vb:v,data:y,ia:b,stride:r,shader:c,descriptorSet:l,lightingMap:a,reflectionProbeCubemap:o,reflectionProbePlanarMap:u,useReflectionProbeType:h}),this.hasPendingModels=!0}},t.uploadBuffers=function(e){for(var t=0;t<this.instances.length;++t){var i=this.instances[t];i.count&&(i.ia.instanceCount=i.count,e.updateBuffer(i.vb,i.data))}},t.clear=function(){for(var e=0;e<this.instances.length;++e)this.instances[e].count=0;this.hasPendingModels=!1},e}()),DE=function(){function e(e){this.batches=[],this.dynamicOffsets=[],this._device=void 0,this._device=e.device}var t=e.prototype;return t.destroy=function(){for(var e=0;e<this.batches.length;++e){for(var t=this.batches[e],i=0;i<t.vbs.length;++i)t.vbs[i].destroy();t.vbIdx.destroy(),t.ia.destroy(),t.ubo.destroy()}this.batches.length=0},t.merge=function(e,t,i){var n=e.subMesh.flatBuffers;if(0!==n.length){for(var r=0,s=0,a=n[0].count,o=e.passes[t],u=e.shaders[t],h=e.descriptorSet,c=!1,l=0;l<this.batches.length;++l){var _=this.batches[l];if(_.vbs.length===n.length&&_.mergeCount<Cg.BATCHING_COUNT){c=!0;for(var d=0;d<_.vbs.length;++d)if(_.vbs[d].stride!==n[d].stride){c=!1;break}if(c){for(var f=0;f<_.vbs.length;++f){var p=n[f],m=_.vbs[f],g=_.vbDatas[f];(r=(a+_.vbCount)*p.stride)>m.size&&(m.resize(r),_.vbDatas[f]=new Uint8Array(r),_.vbDatas[f].set(g)),_.vbDatas[f].set(p.buffer,_.vbCount*p.stride)}var v=_.vbIdxData;(s=4*(a+_.vbCount))>_.vbIdx.size&&(_.vbIdx.resize(s),_.vbIdxData=new Float32Array(s/Float32Array.BYTES_PER_ELEMENT),_.vbIdxData.set(v),v=_.vbIdxData);var y=_.vbCount,E=y+a,T=_.mergeCount;if(v[y]!==T||v[E-1]!==T)for(var A=y;A<E;A++)v[A]=T+.1;return En.toArray(_.uboData,i.transform.worldMatrix,Cg.MAT_WORLDS_OFFSET+16*_.mergeCount),_.mergeCount||(h.bindBuffer(Cg.BINDING,_.ubo),h.update(),_.pass=o,_.shader=u,_.descriptorSet=h),++_.mergeCount,_.vbCount+=a,void(_.ia.vertexCount+=a)}}}for(var S=[],R=[],w=[],I=0;I<n.length;++I){var b=n[I],O=this._device.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,b.count*b.stride,b.stride));O.update(b.buffer.buffer),S.push(O),R.push(new Uint8Array(O.size)),w.push(O)}var N=this._device.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,4*a,4)),C=new Float32Array(a);C.fill(0),N.update(C),w.push(N);for(var M=e.inputAssembler.attributes,P=new Array(M.length+1),L=0;L<M.length;++L)P[L]=M[L];P[M.length]=new i_("a_dyn_batch_id",Fc.R32F,!1,n.length);var x=new r_(P,w),D=this._device.createInputAssembler(x),F=this._device.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,Cg.SIZE,Cg.SIZE));h.bindBuffer(Cg.BINDING,F),h.update();var B=new Float32Array(Cg.COUNT);En.toArray(B,i.transform.worldMatrix,Cg.MAT_WORLDS_OFFSET),this.batches.push({mergeCount:1,vbs:S,vbDatas:R,vbIdx:N,vbIdxData:C,vbCount:a,ia:D,ubo:F,uboData:B,pass:o,shader:u,descriptorSet:h})}},t.clear=function(){for(var e=0;e<this.batches.length;++e){var t=this.batches[e];t.vbCount=0,t.mergeCount=0,t.ia.vertexCount=0}},e}(),FE=new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE),BE=new kl(null),UE=new m_(null);!function(e){e[e.NONE=0]="NONE",e[e.INSTANCING=1]="INSTANCING",e[e.VB_MERGING=2]="VB_MERGING"}(CE||(CE=e("dr",{})));var GE=e("dd",function(){function e(e){this._rootBuffer=null,this._buffers=[],this._descriptorSet=null,this._pipelineLayout=null,this._passIndex=0,this._propertyIndex=0,this._programName="",this._dynamics={},this._propertyHandleMap={},this._rootBlock=null,this._blocksInt=[],this._blocks=[],this._shaderInfo=null,this._defines={},this._properties={},this._shader=null,this._bs=new $_,this._dss=new Z_,this._rs=new Q_,this._priority=qm.DEFAULT,this._stage=Ym.DEFAULT,this._phase=LE("default"),this._passID=4294967295,this._phaseID=4294967295,this._primitive=ul.TRIANGLE_LIST,this._batchingScheme=CE.NONE,this._dynamicStates=_l.NONE,this._instancedBuffers={},this._batchedBuffers={},this._hash=0,this._root=void 0,this._device=void 0,this._rootBufferDirty=!1,this._root=e,this._device=gd.gfxDevice}e.fillPipelineInfo=function(e,t){void 0!==t.priority&&(e._priority=t.priority),void 0!==t.primitive&&(e._primitive=t.primitive),void 0!==t.stage&&(e._stage=t.stage),void 0!==t.dynamicStates&&(e._dynamicStates=t.dynamicStates),void 0!==t.phase&&(e._phase=LE(t.phase));var i=e._bs;if(t.blendState){var n=t.blendState,r=n.targets;r&&r.forEach((function(e,t){i.setTarget(t,e)})),void 0!==n.isA2C&&(i.isA2C=n.isA2C),void 0!==n.isIndepend&&(i.isIndepend=n.isIndepend),void 0!==n.blendColor&&(i.blendColor=n.blendColor)}e._rs.assign(t.rasterizerState),e._dss.assign(t.depthStencilState)},e.getPassHash=function(e){var t="";if(v.rendering&&v.rendering.enableEffectImport){var i=v.rendering.programLib.getKey(e._phaseID,e.program,e.defines);t=e._phaseID.toString()+","+i}else t=oy.getKey(e.program,e.defines);var n,r=t+","+e._primitive+","+e._dynamicStates;return r+=function(e){for(var t,i=",bs,"+e.isA2C,n=d(e.targets);!(t=n()).done;){var r=t.value;i+=",bt,"+r.blend+","+r.blendEq+","+r.blendAlphaEq+","+r.blendColorMask,i+=","+r.blendSrc+","+r.blendDst+","+r.blendSrcAlpha+","+r.blendDstAlpha}return i}(e._bs),r+=function(e){var t=",dss,"+e.depthTest+","+e.depthWrite+","+e.depthFunc;return t+=","+e.stencilTestFront+","+e.stencilFuncFront+","+e.stencilRefFront+","+e.stencilReadMaskFront,t+=","+e.stencilFailOpFront+","+e.stencilZFailOpFront+","+e.stencilPassOpFront+","+e.stencilWriteMaskFront,(t+=","+e.stencilTestBack+","+e.stencilFuncBack+","+e.stencilRefBack+","+e.stencilReadMaskBack)+","+e.stencilFailOpBack+","+e.stencilZFailOpBack+","+e.stencilPassOpBack+","+e.stencilWriteMaskBack}(e._dss),Rc(r+=",rs,"+(n=e._rs).cullMode+","+n.depthBias+","+n.isFrontFaceCCW,666)};var t=e.prototype;return t.initialize=function(e){this._doInit(e),this.resetUBOs(),this.resetTextures(),this.tryCompile()},t.getHandle=function(e,t,i){void 0===t&&(t=0),void 0===i&&(i=Uc.UNKNOWN);var n=this._propertyHandleMap[e];return n?(i?n=Fv(n,i):t&&(n=Fv(n,Pv(n)-t)),n+t):0},t.getBinding=function(t){var i=this.getHandle(t);return i?e.getBindingFromHandle(i):-1},t.setUniform=function(t,i){var n=e.getBindingFromHandle(t),r=e.getTypeFromHandle(t),s=e.getOffsetFromHandle(t),a=this._getBlockView(r,n);Uv[r](a,i,s),this._rootBufferDirty=!0},t.getUniform=function(t,i){var n=e.getBindingFromHandle(t),r=e.getTypeFromHandle(t),s=e.getOffsetFromHandle(t),a=this._getBlockView(r,n);return Bv[r](a,i,s)},t.setUniformArray=function(t,i){for(var n=e.getBindingFromHandle(t),r=e.getTypeFromHandle(t),s=F_(r)>>2,a=this._getBlockView(r,n),o=e.getOffsetFromHandle(t),u=0;u<i.length;u++,o+=s)null!==i[u]&&Uv[r](a,i[u],o);this._rootBufferDirty=!0},t.bindTexture=function(e,t,i){this._descriptorSet.bindTexture(e,t,i||0)},t.bindSampler=function(e,t,i){this._descriptorSet.bindSampler(e,t,i||0)},t.setDynamicState=function(e,t){var i=this._dynamics[e];i&&i.value===t||(i.value=t,i.dirty=!0)},t.overridePipelineStates=function(){console.warn("base pass cannot override states, please use pass instance instead.")},t._setRootBufferDirty=function(e){this._rootBufferDirty=e},t.update=function(){this._descriptorSet?(this._rootBuffer&&this._rootBufferDirty&&(this._rootBuffer.update(this._rootBlock),this._rootBufferDirty=!1),this._descriptorSet.update()):Z(12006)},t.getInstancedBuffer=function(e){return void 0===e&&(e=0),this._instancedBuffers[e]||(this._instancedBuffers[e]=new xE(this))},t.getBatchedBuffer=function(e){return void 0===e&&(e=0),this._batchedBuffers[e]||(this._batchedBuffers[e]=new DE(this))},t.destroy=function(){for(var e=0;e<this._shaderInfo.blocks.length;e++){var t=this._shaderInfo.blocks[e];this._buffers[t.binding].destroy()}for(var i in this._buffers=[],this._rootBuffer&&(this._rootBuffer.destroy(),this._rootBuffer=null),this._instancedBuffers)this._instancedBuffers[i].destroy();for(var n in this._batchedBuffers)this._batchedBuffers[n].destroy();this._descriptorSet.destroy(),this._rs.destroy(),this._dss.destroy(),this._bs.destroy()},t.resetUniform=function(t){var i=this.getHandle(t);if(i){for(var n=e.getTypeFromHandle(i),r=e.getBindingFromHandle(i),s=e.getOffsetFromHandle(i),a=e.getCountFromHandle(i),o=this._getBlockView(n,r),u=this._properties[t],h=u&&u.value||kv(n),c=(F_(n)>>2)*a,l=0;l+h.length<=c;l+=h.length)o.set(h,s+l);this._rootBufferDirty=!0}},t.resetTexture=function(t,i){var n=this.getHandle(t);if(n){var r=e.getTypeFromHandle(n),s=e.getBindingFromHandle(n),a=this._properties[t],o=a&&a.value,u=o?""+o+Hv(r):kv(r),h=PE.get(u),c=h&&h.getGFXTexture(),l=a&&void 0!==a.samplerHash?rd.unpackFromHash(a.samplerHash):h&&h.getSamplerInfo(),_=this._device.getSampler(l);this._descriptorSet.bindSampler(s,_,i||0),this._descriptorSet.bindTexture(s,c,i||0)}},t.resetUBOs=function(){for(var e=0;e<this._shaderInfo.blocks.length;e++)for(var t=this._shaderInfo.blocks[e],i=0,n=0;n<t.members.length;n++){for(var r=t.members[n],s=this._getBlockView(r.type,t.binding),a=this._properties[r.name],o=a&&a.value||kv(r.type),u=(F_(r.type)>>2)*r.count,h=0;h+o.length<=u;h+=o.length)s.set(o,i+h);i+=u}this._rootBufferDirty=!0},t.resetTextures=function(){for(var e=0;e<this._shaderInfo.samplerTextures.length;e++)for(var t=this._shaderInfo.samplerTextures[e],i=0;i<t.count;i++)this.resetTexture(t.name,i)},t.tryCompile=function(){var t=this._root.pipeline;if(!t)return!1;if(this._syncBatchingScheme(),v.rendering&&v.rendering.enableEffectImport){var i=v.rendering.programLib,n=i.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);if(!n)return console.warn("create shader "+this._programName+" failed"),!1;this._shader=n.shader,this._pipelineLayout=i.getPipelineLayout(this.device,this._phaseID,this._programName)}else{var r=oy.getGFXShader(this._device,this._programName,this._defines,t);if(!r)return console.warn("create shader "+this._programName+" failed"),!1;this._shader=r,this._pipelineLayout=oy.getTemplateInfo(this._programName).pipelineLayout}return this._hash=e.getPassHash(this),!0},t.getShaderVariant=function(e){if(void 0===e&&(e=null),!this._shader&&!this.tryCompile())return console.warn("pass resources incomplete"),null;if(!e)return this._shader;for(var t=this._root.pipeline,i=0;i<e.length;i++){var n=e[i];this._defines[n.name]=n.value}var r=null;if(v.rendering&&v.rendering.enableEffectImport){var s=v.rendering.programLib.getProgramVariant(this._device,this._phaseID,this._programName,this._defines);s&&(r=s.shader)}else r=oy.getGFXShader(this._device,this._programName,this._defines,t);for(var a=0;a<e.length;a++){var o=e[a];delete this._defines[o.name]}return r},t.beginChangeStatesSilently=function(){},t.endChangeStatesSilently=function(){},t._doInit=function(t,i){if(void 0===i&&(i=!1),this._priority=qm.DEFAULT,this._stage=Ym.DEFAULT,v.rendering&&v.rendering.enableEffectImport){var n=v.rendering;if("number"==typeof t.phase?(this._passID=t._passID,this._phaseID=t._phaseID):(this._passID=n.getPassID(t.pass),this._passID!==n.INVALID_ID&&(this._phaseID=n.getPhaseID(this._passID,t.phase))),this._passID===n.INVALID_ID)return void console.error("Invalid render pass, program: "+t.program);if(this._phaseID===n.INVALID_ID)return void console.error("Invalid render phase, program: "+t.program)}this._phase=LE("default"),this._primitive=ul.TRIANGLE_LIST,this._passIndex=t.passIndex,this._propertyIndex=void 0!==t.propertyIndex?t.propertyIndex:t.passIndex,this._programName=t.program,this._defines=i?r({},t.defines):t.defines,v.rendering&&v.rendering.enableEffectImport?this._shaderInfo=v.rendering.programLib.getProgramInfo(this._phaseID,this._programName):this._shaderInfo=oy.getTemplate(t.program),this._properties=t.properties||this._properties;var s=this._device;e.fillPipelineInfo(this,t),t.stateOverrides&&e.fillPipelineInfo(this,t.stateOverrides),v.rendering&&v.rendering.enableEffectImport?UE.layout=v.rendering.programLib.getMaterialDescriptorSetLayout(this._device,this._phaseID,t.program):UE.layout=oy.getDescriptorSetLayout(this._device,t.program),this._descriptorSet=this._device.createDescriptorSet(UE);var a,o,u=this._shaderInfo.blocks;if(v.rendering&&v.rendering.enableEffectImport){var h=v.rendering.programLib;a=h.getBlockSizes(this._phaseID,this._programName),o=h.getHandleMap(this._phaseID,this._programName)}else{var c=oy.getTemplateInfo(t.program);a=c.blockSizes,o=c.handleMap}if(v.rendering&&v.rendering.enableEffectImport){var l=v.rendering.programLib.getShaderInfo(this._phaseID,this.program);this._buildMaterialUniformBlocks(s,l.blocks,a)}else this._buildUniformBlocks(s,u,a);var _=this._propertyHandleMap=o,d={};for(var f in this._properties){var p=this._properties[f];p.handleInfo&&(d[f]=this.getHandle.apply(this,p.handleInfo))}Object.assign(_,d)},t._buildUniformBlocks=function(e,t,i){for(var n=e.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<t.length;o++){var u=i[o];r.push(a),a+=Math.ceil(u/n)*n,s=u}var h=r[r.length-1]+s;h&&(FE.size=16*Math.ceil(h/16),this._rootBuffer=e.createBuffer(FE),this._rootBlock=new ArrayBuffer(h));for(var c=0,l=0;c<t.length;c++){var _=t[c].binding,d=i[c];BE.buffer=this._rootBuffer,BE.offset=r[l++],BE.range=16*Math.ceil(d/16);var f=this._buffers[_]=e.createBuffer(BE);this._blocks[_]=new Float32Array(this._rootBlock,BE.offset,d/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,f)}},t._buildMaterialUniformBlocks=function(e,t,i){for(var n=e.capabilities.uboOffsetAlignment,r=[],s=0,a=0,o=0;o<t.length;o++)if(1===t[o].set){var u=i[o];r.push(a),a+=Math.ceil(u/n)*n,s=u}if(0!==s){var h=r[r.length-1]+s;h&&(FE.size=16*Math.ceil(h/16),this._rootBuffer=e.createBuffer(FE),this._rootBlock=new ArrayBuffer(h))}for(var c=0,l=0;c<t.length;c++)if(1===t[c].set){var _=t[c].binding,d=i[c];BE.buffer=this._rootBuffer,BE.offset=r[l++],BE.range=16*Math.ceil(d/16);var f=this._buffers[_]=e.createBuffer(BE);this._blocks[_]=new Float32Array(this._rootBlock,BE.offset,d/Float32Array.BYTES_PER_ELEMENT),this._blocksInt[_]=new Int32Array(this._blocks[_].buffer,this._blocks[_].byteOffset,this._blocks[_].length),this._descriptorSet.bindBuffer(_,f)}},t._syncBatchingScheme=function(){this._defines.USE_INSTANCING?this._device.hasFeature(Dc.INSTANCED_ARRAYS)?this._batchingScheme=CE.INSTANCING:(this._defines.USE_INSTANCING=!1,this._batchingScheme=CE.NONE):this._defines.USE_BATCHING?this._batchingScheme=CE.VB_MERGING:this._batchingScheme=CE.NONE},t._getBlockView=function(e,t){return e<Uc.FLOAT?this._blocksInt[t]:this._blocks[t]},t._initPassFromTarget=function(e,t,i){this._priority=e.priority,this._stage=e.stage,this._phase=e.phase,this._phaseID=e._phaseID,this._passID=e._passID,this._batchingScheme=e.batchingScheme,this._primitive=e.primitive,this._dynamicStates=e.dynamicStates,this._bs=e.blendState,this._dss=t,this._descriptorSet=e.descriptorSet,this._rs=e.rasterizerState,this._passIndex=e.passIndex,this._propertyIndex=e.propertyIndex,this._programName=e.program,this._defines=e.defines,this._shaderInfo=e._shaderInfo,this._properties=e._properties,this._blocks=e._blocks,this._blocksInt=e._blocksInt,this._dynamics=e._dynamics,this._shader=e._shader,v.rendering&&v.rendering.enableEffectImport?this._pipelineLayout=v.rendering.programLib.getPipelineLayout(this.device,this._phaseID,this._programName):this._pipelineLayout=oy.getTemplateInfo(this._programName).pipelineLayout,this._hash=e._hash^i},t._updatePassHash=function(){this._hash=e.getPassHash(this)},n(e,[{key:"root",get:function(){return this._root}},{key:"device",get:function(){return this._device}},{key:"shaderInfo",get:function(){return this._shaderInfo}},{key:"localSetLayout",get:function(){return v.rendering&&v.rendering.enableEffectImport?v.rendering.programLib.getLocalDescriptorSetLayout(this._device,this._phaseID,this._programName):oy.getDescriptorSetLayout(this._device,this._programName,!0)}},{key:"program",get:function(){return this._programName}},{key:"properties",get:function(){return this._properties}},{key:"defines",get:function(){return this._defines}},{key:"passIndex",get:function(){return this._passIndex}},{key:"propertyIndex",get:function(){return this._propertyIndex}},{key:"dynamics",get:function(){return this._dynamics}},{key:"blocks",get:function(){return this._blocks}},{key:"blocksInt",get:function(){return this._blocksInt}},{key:"rootBufferDirty",get:function(){return this._rootBufferDirty}},{key:"priority",get:function(){return this._priority}},{key:"primitive",get:function(){return this._primitive}},{key:"stage",get:function(){return this._stage}},{key:"phase",get:function(){return this._phase}},{key:"passID",get:function(){return this._passID}},{key:"phaseID",get:function(){return this._phaseID}},{key:"rasterizerState",get:function(){return this._rs}},{key:"depthStencilState",get:function(){return this._dss}},{key:"blendState",get:function(){return this._bs}},{key:"dynamicStates",get:function(){return this._dynamicStates}},{key:"batchingScheme",get:function(){return this._batchingScheme}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"hash",get:function(){return this._hash}},{key:"pipelineLayout",get:function(){return this._pipelineLayout}}]),e}());GE.getTypeFromHandle=Pv,GE.getBindingFromHandle=Lv,GE.getCountFromHandle=xv,GE.getOffsetFromHandle=Dv;var kE=e("h1",function(){function e(){}return e.getOrCreatePipelineState=function(e,t,i,n,r){var s=t.hash^n.hash^r.attributesHash^i.typedID,a=this._PSOHashMap.get(s);if(!a){var o=t.pipelineLayout,u=new v_(r.attributes),h=new ed(i,o,n,u,t.rasterizerState,t.depthStencilState,t.blendState,t.primitive,t.dynamicStates);a=e.createPipelineState(h),this._PSOHashMap.set(s,a)}return a},e}());kE._PSOHashMap=new Map;var HE=new xl,zE=new bl;function VE(e,t){e.x=t.x*t.x,e.y=t.y*t.y,e.z=t.z*t.z}var WE,jE,XE,KE,YE,qE,QE,ZE,JE,$E=null;function eT(){return $E}function tT(e,t,i,n,r){if(n&&n.enabled&&r===$E){var s=n.subModels[0],a=s.inputAssembler,o=s.passes,u=s.shaders,h=s.descriptorSet;HE.width=zE.width=r.window.width,HE.height=zE.height=r.window.height;var c=kE.getOrCreatePipelineState(e,o[0],u[0],t,a);i.setViewport(HE),i.setScissor(zE),i.bindPipelineState(c),i.bindDescriptorSet(sg.MATERIAL,o[0].descriptorSet),i.bindDescriptorSet(sg.LOCAL,h),i.bindInputAssembler(a),i.draw(a)}}var iT=new zi,nT=e("d1",(WE=Gs("cc.Material"),jE=va(hy),WE((KE=function(e){function t(){var t;return(t=e.call(this)||this)._effectAsset=YE&&YE(),t._techIdx=qE&&qE(),t._defines=QE&&QE(),t._states=ZE&&ZE(),t._props=JE&&JE(),t._passes=[],t._hash=0,t}s(t,e),t.getHash=function(e){for(var t,i=0,n=d(e.passes);!(t=n()).done;)i^=t.value.hash;return i};var i=t.prototype;return i.initialize=function(e){this._passes.length?q(12005):(this._defines||(this._defines=[]),this._states||(this._states=[]),this._props||(this._props=[]),this._fillInfo(e),this._update())},i.reset=function(e){this.initialize(e)},i.destroy=function(){return this._doDestroy(),e.prototype.destroy.call(this)},i.recompileShaders=function(){console.warn("Shaders in material asset '"+this.name+"' cannot be modified at runtime, please instantiate the material first.")},i.overridePipelineStates=function(){console.warn("Pipeline states in material asset '"+this.name+"' cannot be modified at runtime, please instantiate the material first.")},i.onLoaded=function(){this._update()},i.resetUniforms=function(e){void 0===e&&(e=!0),this._props.length=this._passes.length;for(var t=0;t<this._props.length;t++)this._props[t]={};if(e)for(var i,n=d(this._passes);!(i=n()).done;){var r=i.value;r.resetUBOs(),r.resetTextures()}},i.setProperty=function(e,t,i){var n=!1;if(void 0===i)for(var r=this._passes,s=r.length,a=0;a<s;a++){var o=r[a];this._uploadProperty(o,e,t)&&(this._props[o.propertyIndex][e]=t,n=!0)}else{if(i>=this._passes.length)return void console.warn("illegal pass index: "+i+".");var u=this._passes[i];this._uploadProperty(u,e,t)&&(this._props[u.propertyIndex][e]=t,n=!0)}n||console.warn("illegal property name: "+e+".")},i.getProperty=function(e,t){if(void 0===t)for(var i=this._props,n=i.length,r=0;r<n;r++){var s=i[r];if(e in s)return s[e]}else{if(t>=this._props.length)return console.warn("illegal pass index: "+t+"."),null;var a=this._props[this._passes[t].propertyIndex];if(e in a)return a[e]}return null},i.copy=function(e,t){this._techIdx=e._techIdx,this._props.length=e._props.length;for(var i=0;i<e._props.length;i++)this._props[i]=r({},e._props[i]);this._defines.length=e._defines.length;for(var n=0;n<e._defines.length;n++)this._defines[n]=r({},e._defines[n]);this._states.length=e._states.length;for(var s=0;s<e._states.length;s++)this._states[s]=r({},e._states[s]);this._effectAsset=e._effectAsset,t&&this._fillInfo(t),this._update()},i._fillInfo=function(e){void 0!==e.technique&&(this._techIdx=e.technique),e.effectAsset?this._effectAsset=e.effectAsset:e.effectName&&(this._effectAsset=hy.get(e.effectName)),e.defines&&this._prepareInfo(e.defines,this._defines),e.states&&this._prepareInfo(e.states,this._states)},i._prepareInfo=function(e,t){var i=e;if(!Array.isArray(i)){var n=this._effectAsset?this._effectAsset.techniques[this._techIdx].passes.length:1;i=Array(n).fill(i)}for(var r=0;r<i.length;++r)Object.assign(t[r]||(t[r]={}),i[r])},i._createPasses=function(){var e=this._effectAsset.techniques[this._techIdx||0];if(!e)return[];for(var t=e.passes.length,i=[],n=0;n<t;++n){var r=e.passes[n],s=r.passIndex=n,a=r.defines=this._defines[s]||(this._defines[s]={});if(r.stateOverrides=this._states[s]||(this._states[s]={}),void 0!==r.propertyIndex&&Object.assign(a,this._defines[r.propertyIndex]),void 0!==r.embeddedMacros&&Object.assign(a,r.embeddedMacros),!r.switch||a[r.switch]){var o=new GE(v.director.root);o.initialize(r),i.push(o)}}return i},i._update=function(e){var i=this;if(void 0===e&&(e=!0),this._effectAsset){this._passes=this._createPasses();var n=this._effectAsset.techniques[this._techIdx].passes.length;if(this._props.length=n,e)this._passes.forEach((function(e,t){var n=i._props[t];for(var r in n||(n=i._props[t]={}),void 0!==e.propertyIndex&&Object.assign(n,i._props[e.propertyIndex]),n)i._uploadProperty(e,r,n[r])}));else for(var r=0;r<this._props.length;r++)this._props[r]={}}this._hash=t.getHash(this)},i._uploadProperty=function(e,t,i){var n=e.getHandle(t);if(!n)return!1;if(GE.getTypeFromHandle(n)<Uc.SAMPLER1D)if(Array.isArray(i))e.setUniformArray(n,i);else if(null!==i){var r;if(null!==(r=e.properties[t])&&void 0!==r&&r.linear){var s=i;VE(iT,s),iT.w=s.w,i=iT}e.setUniform(n,i)}else e.resetUniform(t);else if(Array.isArray(i))for(var a=0;a<i.length;a++)this._bindTexture(e,n,i[a],a);else i?this._bindTexture(e,n,i):e.resetTexture(t);return!0},i._bindTexture=function(e,t,i,n){var r=GE.getBindingFromHandle(t);if(i instanceof ad)e.bindTexture(r,i,n);else if(i instanceof wf){var s=i.getGFXTexture();if(!s||!s.width||!s.height)return;e.bindTexture(r,s,n),e.bindSampler(r,i.getGFXSampler(),n)}},i._doDestroy=function(){if(this._passes&&this._passes.length)for(var e,t=d(this._passes);!(e=t()).done;)e.value.destroy();this._passes.length=0},i.initDefault=function(t){e.prototype.initDefault.call(this,t),this.initialize({effectName:"builtin-unlit",defines:{USE_COLOR:!0},technique:0}),this.setProperty("mainColor",new en("#ff00ff"))},i.validate=function(){return!!this._effectAsset&&!this._effectAsset.isDefault&&this.passes.length>0},n(t,[{key:"effectAsset",get:function(){return this._effectAsset}},{key:"effectName",get:function(){return this._effectAsset?this._effectAsset.name:""}},{key:"technique",get:function(){return this._techIdx}},{key:"passes",get:function(){return this._passes}},{key:"hash",get:function(){return this._hash}},{key:"parent",get:function(){return null}},{key:"owner",get:function(){return null}}]),t}(qd),YE=Cs(KE.prototype,"_effectAsset",[jE],(function(){return null})),qE=Cs(KE.prototype,"_techIdx",[Ys],(function(){return 0})),QE=Cs(KE.prototype,"_defines",[Ys],(function(){return[]})),ZE=Cs(KE.prototype,"_states",[Ys],(function(){return[]})),JE=Cs(KE.prototype,"_props",[Ys],(function(){return[]})),XE=KE))||XE));v.Material=nT;var rT=e("bP",mt({Low_256x256:256,Medium_512x512:512,High_1024x1024:1024,Ultra_2048x2048:2048})),sT=e("bQ",mt({Planar:0,ShadowMap:1})),aT=e("bR",mt({HARD:0,SOFT:1,SOFT_2X:2,SOFT_4X:3})),oT=e("bS",mt({LEVEL_1:1,LEVEL_2:2,LEVEL_3:3,LEVEL_4:4})),uT=e("bT",mt({NONE:1,RemoveDuplicates:2,DisableRotationFix:3})),hT=sT.ShadowMap+1,cT=e("bU",function(){function e(){this.fixedSphere=new lr(0,0,0,.01),this.maxReceived=4,this._matLight=new En,this._material=null,this._instancingMaterial=null,this._enabled=!1,this._type=hT,this._distance=0,this._normal=new Ki(0,1,0),this._shadowColor=new en(0,0,0,76),this._size=new Rn(1024,1024),this._shadowMapDirty=!1}var t=e.prototype;return t.getPlanarShader=function(e){this._material||(this._material=new nT,this._material.initialize({effectName:"pipeline/planar-shadow"}));var t=this._material.passes;return t.length>0?t[0].getShaderVariant(e):null},t.getPlanarInstanceShader=function(e){this._instancingMaterial||(this._instancingMaterial=new nT,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var t=this._instancingMaterial.passes;return t.length>0?t[0].getShaderVariant(e):null},t.initialize=function(e){this._enabled=e.enabled,this._type=this.enabled?e.type:hT,this.normal=e.planeDirection,this.distance=e.planeHeight,this.shadowColor=e.shadowColor,this.maxReceived=e.maxReceived,e.shadowMapSize!==this._size.x&&(this.size.set(e.shadowMapSize,e.shadowMapSize),this._shadowMapDirty=!0)},t.activate=function(){if(this._enabled)if(this.type===sT.Planar)this._updatePlanarInfo();else{var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=2,e.onGlobalPipelineStateChanged()}else{var t=v.director.root;t.pipeline.macros.CC_SHADOW_TYPE=0,t.onGlobalPipelineStateChanged()}},t._updatePlanarInfo=function(){this._material||(this._material=new nT,this._material.initialize({effectName:"pipeline/planar-shadow"})),this._instancingMaterial||(this._instancingMaterial=new nT,this._instancingMaterial.initialize({effectName:"pipeline/planar-shadow",defines:{USE_INSTANCING:!0}}));var e=v.director.root;e.pipeline.macros.CC_SHADOW_TYPE=1,e.onGlobalPipelineStateChanged()},t.destroy=function(){this._material&&this._material.destroy(),this._instancingMaterial&&this._instancingMaterial.destroy(),this.fixedSphere.destroy()},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,this.activate()}},{key:"type",get:function(){return this._type},set:function(e){this._type=this.enabled?e:hT,this.activate()}},{key:"normal",get:function(){return this._normal},set:function(e){Ki.copy(this._normal,e)}},{key:"distance",get:function(){return this._distance},set:function(e){this._distance=e}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(e){this._shadowColor=e}},{key:"size",get:function(){return this._size},set:function(e){this._size.set(e)}},{key:"shadowMapDirty",get:function(){return this._shadowMapDirty},set:function(e){this._shadowMapDirty=e}},{key:"matLight",get:function(){return this._matLight}},{key:"material",get:function(){return this._material}},{key:"instancingMaterial",get:function(){return this._instancingMaterial}}]),e}());cT.MAX_FAR=2e3,cT.COEFFICIENT_OF_EXPANSION=2*Math.sqrt(3),v.Shadows=cT;var lT=e("dv",function(e){function t(t,i){var n;(n=e.call(this,t.root)||this)._parent=void 0,n._owner=void 0,n._dontNotify=!1,n._parent=t,n._owner=i,n._doInit(n._parent,!0);for(var r=0;r<n._shaderInfo.blocks.length;r++){var s=n._shaderInfo.blocks[r],a=n._blocks[s.binding],o=n._parent.blocks[s.binding];a.set(o)}n._rootBufferDirty=!0;for(var u=n._parent,h=0;h<n._shaderInfo.samplerTextures.length;h++)for(var c=n._shaderInfo.samplerTextures[h],_=0;_<c.count;_++){var d=u._descriptorSet.getSampler(c.binding,_),f=u._descriptorSet.getTexture(c.binding,_);n._descriptorSet.bindSampler(c.binding,d,_),n._descriptorSet.bindTexture(c.binding,f,_)}return e.prototype.tryCompile.call(l(n)),n}s(t,e);var i=t.prototype;return i.overridePipelineStates=function(e,t){this._bs.reset(),this._rs.reset(),this._dss.reset(),GE.fillPipelineInfo(this,e),GE.fillPipelineInfo(this,t),this._onStateChange()},i.tryCompile=function(t){if(t&&!zv(this._defines,t))return!1;var i=e.prototype.tryCompile.call(this);return this._onStateChange(),i},i.beginChangeStatesSilently=function(){this._dontNotify=!0},i.endChangeStatesSilently=function(){this._dontNotify=!1},i._syncBatchingScheme=function(){this._defines.USE_BATCHING=this._defines.USE_INSTANCING=!1,this._batchingScheme=CE.NONE},i._onStateChange=function(){this._hash=GE.getPassHash(this),this._owner.onPassStateChange(this._dontNotify)},n(t,[{key:"parent",get:function(){return this._parent}}]),t}(GE)),_T=e("d2",function(e){function t(t){var i;return(i=e.call(this)||this)._passes=[],i._parent=void 0,i._owner=void 0,i._subModelIdx=0,i._parent=t.parent,i._owner=t.owner||null,i._subModelIdx=t.subModelIdx||0,i.copy(i._parent),i}s(t,e);var i=t.prototype;return i.recompileShaders=function(e,t){if(this._passes&&this.effectAsset)if(void 0===t)for(var i,n=d(this._passes);!(i=n()).done;)i.value.tryCompile(e);else this._passes[t].tryCompile(e)},i.overridePipelineStates=function(e,t){if(this._passes&&this.effectAsset){var i=this.effectAsset.techniques[this.technique].passes;if(void 0===t)for(var n=0;n<this._passes.length;n++){var r=this._passes[n],s=this._states[n]||(this._states[n]={});for(var a in e)s[a]=e[a];r.overridePipelineStates(i[r.passIndex],s)}else{var o=this._states[t]||(this._states[t]={});for(var u in e)o[u]=e[u];this._passes[t].overridePipelineStates(i[t],o)}}},i.destroy=function(){return this._doDestroy(),!0},i.onPassStateChange=function(e){this._hash=nT.getHash(this),!e&&this._owner&&this._owner._onRebuildPSO(this._subModelIdx,this)},i._createPasses=function(){var e=[],t=this._parent.passes;if(!t)return e;for(var i=0;i<t.length;++i)e.push(new lT(t[i],this));return e},n(t,[{key:"parent",get:function(){return this._parent}},{key:"owner",get:function(){return this._owner}}]),t}(nT)),dT=null,fT=null,pT=e("bN",mt({HEMISPHERE_DIFFUSE:0,AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION:1,DIFFUSEMAP_WITH_REFLECTION:2})),mT=e("bO",function(){function e(){this._envmapLDR=null,this._envmapHDR=null,this._diffuseMapLDR=null,this._diffuseMapHDR=null,this._globalDSManager=null,this._model=null,this._default=null,this._enabled=!1,this._useIBL=!1,this._useHDR=!0,this._useDiffuseMap=!1,this._editableMaterial=null,this._activated=!1,this._reflectionHDR=null,this._reflectionLDR=null,this._rotationAngle=0}var t=e.prototype;return t.initialize=function(e){this._activated=!1,this._enabled=e.enabled,this._useIBL=e.useIBL,this._useDiffuseMap=e.applyDiffuseMap,this._useHDR=e.useHDR},t.setEnvMaps=function(e,t){this._envmapHDR=e,this._envmapLDR=t,this._updateGlobalBinding(),this._updatePipeline()},t.setDiffuseMaps=function(e,t){this._diffuseMapHDR=e,this._diffuseMapLDR=t,this._updateGlobalBinding(),this._updatePipeline()},t.setSkyboxMaterial=function(e){e?(this._editableMaterial=new _T({parent:e}),this._editableMaterial.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})):this._editableMaterial=null,this._updatePipeline()},t.setReflectionMaps=function(e,t){this._reflectionHDR=e,this._reflectionLDR=t,this._updateGlobalBinding(),this._updatePipeline()},t.setRotationAngle=function(e){this._rotationAngle=e},t.getRotationAngle=function(){return this._rotationAngle},t.updateMaterialRenderInfo=function(){this._updateGlobalBinding(),this._updatePipeline()},t.activate=function(){var e=v.director.root.pipeline;this._globalDSManager=e.globalDSManager,this._default=PE.get("default-cube-texture"),this._model||(this._model=v.director.root.createModel(v.renderer.scene.Model));var t=this._default.isRGBE;if(this._default.isUsingOfflineMipmaps(),this.envmap&&(t=this.envmap.isRGBE,this.envmap.isUsingOfflineMipmaps()),!fT){var i=new nT;i.initialize({effectName:"pipeline/skybox",defines:{USE_RGBE_CUBEMAP:t}}),fT=new _T({parent:i})}this.enabled&&(dT||(dT=v.utils.createMesh(v.primitives.box({width:2,height:2,length:2}))),this._editableMaterial?this._model.initSubModel(0,dT.renderingSubMeshes[0],this._editableMaterial):this._model.initSubModel(0,dT.renderingSubMeshes[0],fT)),this.envmap||(this.envmap=this._default),this.diffuseMap||(this.diffuseMap=this._default),this._updateGlobalBinding(),this._updatePipeline(),this._activated=!0},t._updatePipeline=function(){var e=v.director.root,t=e.pipeline,i=this.useIBL?this.isRGBE?2:1:0,n=this.useIBL&&this.useDiffuseMap&&this.diffuseMap?this.isRGBE?2:1:0,r=this.useHDR,s=this.useConvolutionMap;if(t.macros.CC_USE_IBL===i&&t.macros.CC_USE_DIFFUSEMAP===n&&t.macros.CC_USE_HDR===r&&t.macros.CC_IBL_CONVOLUTED===s||(t.macros.CC_USE_IBL=i,t.macros.CC_USE_DIFFUSEMAP=n,t.macros.CC_USE_HDR=r,t.macros.CC_IBL_CONVOLUTED=s,this._activated&&e.onGlobalPipelineStateChanged()),this.enabled){var a=this.envmap?this.envmap:this._default,o=this._editableMaterial?this._editableMaterial:fT;o&&(o.setProperty("environmentMap",a),o.recompileShaders({USE_RGBE_CUBEMAP:this.isRGBE})),this._model&&(this._model.setSubModelMaterial(0,o),this._updateSubModes())}},t._updateGlobalBinding=function(){if(this._globalDSManager){var e=gd.gfxDevice;if(this.reflectionMap){var t=this.reflectionMap.getGFXTexture(),i=e.getSampler(this.reflectionMap.getSamplerInfo());this._globalDSManager.bindSampler(gg,i),this._globalDSManager.bindTexture(gg,t)}else{var n=this.envmap?this.envmap:this._default;if(n){var r=n.getGFXTexture(),s=e.getSampler(n.getSamplerInfo());this._globalDSManager.bindSampler(gg,s),this._globalDSManager.bindTexture(gg,r)}}var a=this.diffuseMap?this.diffuseMap:this._default;if(a){var o=a.getGFXTexture(),u=e.getSampler(a.getSamplerInfo());this._globalDSManager.bindSampler(Eg,u),this._globalDSManager.bindTexture(Eg,o)}this._globalDSManager.update()}},t._updateSubModes=function(){if(this._model)for(var e=this._model.subModels,t=0;t<e.length;t++)e[t].update()},n(e,[{key:"model",get:function(){return this._model}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,e?this.activate():this._updatePipeline()}},{key:"useHDR",get:function(){return this._useHDR},set:function(e){this._useHDR=e,this.setEnvMaps(this._envmapHDR,this._envmapLDR)}},{key:"useIBL",get:function(){return this._useIBL},set:function(e){this._useIBL=e,this._updatePipeline()}},{key:"useDiffuseMap",get:function(){return this._useDiffuseMap},set:function(e){this._useDiffuseMap=e,this._updatePipeline()}},{key:"isRGBE",get:function(){return!!this.envmap&&this.envmap.isRGBE}},{key:"useConvolutionMap",get:function(){return this.reflectionMap?this.reflectionMap.isUsingOfflineMipmaps():!!this.envmap&&this.envmap.isUsingOfflineMipmaps()}},{key:"envmap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.setEnvMaps(e,this._envmapLDR):this.setEnvMaps(this._envmapHDR,e)}},{key:"diffuseMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.setDiffuseMaps(e,this._diffuseMapLDR):this.setDiffuseMaps(this._diffuseMapHDR,e)}},{key:"reflectionMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR}}]),e}());v.Skybox=mT;var gT,vT,yT,ET,TT,AT,ST,RT,wT,IT,bT,OT,NT,CT,MT,PT,LT,xT,DT,FT,BT,UT,GT,kT,HT,zT,VT,WT,jT,XT,KT,YT,qT,QT,ZT,JT,$T,eA,tA,iA,nA,rA,sA,aA,oA,uA,hA,cA,lA,_A,dA,fA,pA,mA,gA,vA,yA,EA,TA,AA,SA,RA,wA,IA,bA,OA,NA,CA,MA,PA,LA,xA,DA,FA,BA,UA,GA,kA,HA,zA,VA,WA,jA,XA,KA,YA,qA,QA,ZA,JA,$A,eS,tS,iS,nS,rS,sS,aS,oS,uS,hS,cS,lS,_S,dS,fS,pS,mS,gS,vS,yS,ES=new zi,TS=e("bV",mt({LINEAR:0,EXP:1,EXP_SQUARED:2,LAYERED:3})),AS=TS.LAYERED+1,SS=e("bW",function(){function e(){this._fogColor=new en("#C8C8C8"),this._colorArray=new zi(.2,.2,.2,1),this._enabled=!1,this._accurate=!1,this._type=0,this._fogDensity=.3,this._fogStart=.5,this._fogEnd=300,this._fogAtten=5,this._fogTop=1.5,this._fogRange=1.2,this._activated=!1}var t=e.prototype;return t.initialize=function(e){this._activated=!1,this.fogColor=e.fogColor,this._enabled=e.enabled,this._type=this.enabled?e.type:AS,this._accurate=e.accurate,this.fogDensity=e.fogDensity,this.fogStart=e.fogStart,this.fogEnd=e.fogEnd,this.fogAtten=e.fogAtten,this.fogTop=e.fogTop,this.fogRange=e.fogRange},t.activate=function(){this._updatePipeline(),this._activated=!0},t._updatePipeline=function(){var e=v.director.root,t=this.enabled?this.type:AS,i=this.accurate?1:0,n=e.pipeline;n.macros.CC_USE_FOG===t&&n.macros.CC_USE_ACCURATE_FOG===i||(n.macros.CC_USE_FOG=t,n.macros.CC_USE_ACCURATE_FOG=i,this._activated&&e.onGlobalPipelineStateChanged())},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e,e?this.activate():(this._type=AS,this._updatePipeline())}},{key:"accurate",get:function(){return this._accurate},set:function(e){this._accurate=e,this._updatePipeline()}},{key:"fogColor",get:function(){return this._fogColor},set:function(e){this._fogColor.set(e),ES.set(e.x,e.y,e.z,e.w),VE(this._colorArray,ES)}},{key:"type",get:function(){return this._type},set:function(e){this._type=this.enabled?e:AS,this.enabled&&this._updatePipeline()}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(e){this._fogDensity=e}},{key:"fogStart",get:function(){return this._fogStart},set:function(e){this._fogStart=e}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(e){this._fogEnd=e}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(e){this._fogAtten=e}},{key:"fogTop",get:function(){return this._fogTop},set:function(e){this._fogTop=e}},{key:"fogRange",get:function(){return this._fogRange},set:function(e){this._fogRange=e}},{key:"colorArray",get:function(){return this._colorArray}}]),e}());v.Fog=SS;var RS=new Ki(0,1,0),wS=new Ki,IS=new zi,bS=new en,OS=new _n,NS=function(e){var t=1/Math.max(Math.max(Math.max(e.x,e.y),e.z),1e-4);t<1&&(e.x*=t,e.y*=t,e.z*=t)},CS=e("ha",(gT=Gs("cc.AmbientInfo"),vT=va(Kt),yT=qs("_skyColor"),ET=qs("_skyIllum"),TT=qs("_groundAlbedo"),gT((f((ST=function(){function e(){this._skyColorHDR=RT&&RT(),this._skyIllumHDR=wT&&wT(),this._groundAlbedoHDR=IT&&IT(),this._skyColorLDR=bT&&bT(),this._skyIllumLDR=OT&&OT(),this._groundAlbedoLDR=NT&&NT(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,this._resource.initialize(this)},n(e,[{key:"skyColorHDR",get:function(){return this._skyColorHDR}},{key:"groundAlbedoHDR",get:function(){return this._groundAlbedoHDR}},{key:"skyIllumHDR",get:function(){return this._skyIllumHDR}},{key:"skyColorLDR",get:function(){return this._skyColorLDR}},{key:"groundAlbedoLDR",get:function(){return this._groundAlbedoLDR}},{key:"skyIllumLDR",get:function(){return this._skyIllumLDR}},{key:"skyLightingColor",get:function(){var e=v.director.root.pipeline.pipelineSceneData.isHDR;return IS.set(e?this._skyColorHDR:this._skyColorLDR),NS(IS),bS.set(255*IS.x,255*IS.y,255*IS.z,255)},set:function(e){IS.set(e.x,e.y,e.z,e.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(IS):this._skyColorLDR.set(IS),this._resource&&this._resource.skyColor.set(IS)}},{key:"skyColor",set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyColorHDR.set(e):this._skyColorLDR.set(e),this._resource&&this._resource.skyColor.set(e)}},{key:"skyIllum",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR:this._skyIllumLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._skyIllumHDR=e:this._skyIllumLDR=e,this._resource&&(this._resource.skyIllum=e)}},{key:"groundLightingColor",get:function(){var e=v.director.root.pipeline.pipelineSceneData.isHDR;return IS.set(e?this._groundAlbedoHDR:this._groundAlbedoLDR),NS(IS),bS.set(255*IS.x,255*IS.y,255*IS.z,255)},set:function(e){IS.set(e.x,e.y,e.z,e.w),v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(IS):this._groundAlbedoLDR.set(IS),this._resource&&this._resource.groundAlbedo.set(IS)}},{key:"groundAlbedo",set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._groundAlbedoHDR.set(e):this._groundAlbedoLDR.set(e),this._resource&&this._resource.groundAlbedo.set(e)}}]),e}()).prototype,"skyIllum",[vT],Object.getOwnPropertyDescriptor(ST.prototype,"skyIllum"),ST.prototype),RT=Cs(ST.prototype,"_skyColorHDR",[Ys,yT],(function(){return new zi(.2,.5,.8,1)})),wT=Cs(ST.prototype,"_skyIllumHDR",[Ys,ET],(function(){return Km.SKY_ILLUM})),IT=Cs(ST.prototype,"_groundAlbedoHDR",[Ys,TT],(function(){return new zi(.2,.2,.2,1)})),bT=Cs(ST.prototype,"_skyColorLDR",[Ys],(function(){return new zi(.2,.5,.8,1)})),OT=Cs(ST.prototype,"_skyIllumLDR",[Ys],(function(){return Km.SKY_ILLUM})),NT=Cs(ST.prototype,"_groundAlbedoLDR",[Ys],(function(){return new zi(.2,.2,.2,1)})),AT=ST))||AT));v.AmbientInfo=CS;var MS=e("hb",(CT=Gs("cc.SkyboxInfo"),MT=va(pT),PT=va(jm),LT=va(Kt),xT=va(jm),DT=va(jm),FT=va(nT),BT=va(jm),UT=qs("_envmap"),GT=va(jm),kT=va(jm),HT=va(jm),zT=va(nT),VT=va(jm),WT=va(jm),CT((f((XT=function(){function e(){this._envLightingType=KT&&KT(),this._envmapHDR=YT&&YT(),this._envmapLDR=qT&&qT(),this._diffuseMapHDR=QT&&QT(),this._diffuseMapLDR=ZT&&ZT(),this._enabled=JT&&JT(),this._useHDR=$T&&$T(),this._editableMaterial=eA&&eA(),this._reflectionHDR=tA&&tA(),this._reflectionLDR=iA&&iA(),this._rotationAngle=nA&&nA(),this._resource=null}return e.prototype.activate=function(e){this.envLightingType=this._envLightingType,this._resource=e,this._resource.initialize(this),this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setSkyboxMaterial(this._editableMaterial),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.setRotationAngle(this._rotationAngle),this._resource.activate()},n(e,[{key:"applyDiffuseMap",get:function(){return pT.DIFFUSEMAP_WITH_REFLECTION===this._envLightingType},set:function(e){this._resource&&(this._resource.useDiffuseMap=e)}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=this._enabled))}},{key:"envLightingType",get:function(){return this._envLightingType},set:function(e){this.envmap||pT.HEMISPHERE_DIFFUSE===e?(pT.HEMISPHERE_DIFFUSE===e?(this.useIBL=!1,this.applyDiffuseMap=!1):pT.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION===e?(this.useIBL=!0,this.applyDiffuseMap=!1):pT.DIFFUSEMAP_WITH_REFLECTION===e&&(this.useIBL=!0,this.applyDiffuseMap=!0),this._envLightingType=e):(this.useIBL=!1,this.applyDiffuseMap=!1,this._envLightingType=pT.HEMISPHERE_DIFFUSE,q(15001))}},{key:"useIBL",get:function(){return pT.HEMISPHERE_DIFFUSE!==this._envLightingType},set:function(e){this._resource&&(this._resource.useIBL=e)}},{key:"useHDR",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR=this._useHDR,this._useHDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR=e,this._useHDR=e,this._resource&&this.envLightingType===pT.DIFFUSEMAP_WITH_REFLECTION&&(null===this.diffuseMap?(this.envLightingType=pT.AUTOGEN_HEMISPHERE_DIFFUSE_WITH_REFLECTION,q(15e3)):this.diffuseMap.isDefault&&q(15002)),this._resource&&(this._resource.useHDR=this._useHDR,this._resource.updateMaterialRenderInfo())}},{key:"envmap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._envmapHDR:this._envmapLDR},set:function(e){var t=v.director.root.pipeline.pipelineSceneData.isHDR;t?(this._envmapHDR=e,this._reflectionHDR=null):(this._envmapLDR=e,this._reflectionLDR=null),e||(t?this._diffuseMapHDR=null:this._diffuseMapLDR=null,this.applyDiffuseMap=!1,this.useIBL=!1,this.envLightingType=pT.HEMISPHERE_DIFFUSE,q(15001)),this._resource&&(this._resource.setEnvMaps(this._envmapHDR,this._envmapLDR),this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR),this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR),this._resource.useDiffuseMap=this.applyDiffuseMap,this._resource.envmap=e)}},{key:"rotationAngle",get:function(){return this._rotationAngle},set:function(e){this._rotationAngle=e,this._resource&&this._resource.setRotationAngle(this._rotationAngle)}},{key:"diffuseMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR:this._diffuseMapLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._diffuseMapHDR=e:this._diffuseMapLDR=e,this._resource&&this._resource.setDiffuseMaps(this._diffuseMapHDR,this._diffuseMapLDR)}},{key:"reflectionMap",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR:this._reflectionLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this._reflectionHDR=e:this._reflectionLDR=e,this._resource&&this._resource.setReflectionMaps(this._reflectionHDR,this._reflectionLDR)}},{key:"skyboxMaterial",get:function(){return this._editableMaterial},set:function(e){this._editableMaterial=e,this._resource&&this._resource.setSkyboxMaterial(this._editableMaterial)}}]),e}()).prototype,"envLightingType",[MT],Object.getOwnPropertyDescriptor(XT.prototype,"envLightingType"),XT.prototype),f(XT.prototype,"envmap",[PT],Object.getOwnPropertyDescriptor(XT.prototype,"envmap"),XT.prototype),f(XT.prototype,"rotationAngle",[LT],Object.getOwnPropertyDescriptor(XT.prototype,"rotationAngle"),XT.prototype),f(XT.prototype,"diffuseMap",[xT],Object.getOwnPropertyDescriptor(XT.prototype,"diffuseMap"),XT.prototype),f(XT.prototype,"reflectionMap",[DT],Object.getOwnPropertyDescriptor(XT.prototype,"reflectionMap"),XT.prototype),f(XT.prototype,"skyboxMaterial",[FT],Object.getOwnPropertyDescriptor(XT.prototype,"skyboxMaterial"),XT.prototype),KT=Cs(XT.prototype,"_envLightingType",[Ys],(function(){return pT.HEMISPHERE_DIFFUSE})),YT=Cs(XT.prototype,"_envmapHDR",[Ys,BT,UT],(function(){return null})),qT=Cs(XT.prototype,"_envmapLDR",[Ys,GT],(function(){return null})),QT=Cs(XT.prototype,"_diffuseMapHDR",[Ys,kT],(function(){return null})),ZT=Cs(XT.prototype,"_diffuseMapLDR",[Ys,HT],(function(){return null})),JT=Cs(XT.prototype,"_enabled",[Ys],(function(){return!1})),$T=Cs(XT.prototype,"_useHDR",[Ys],(function(){return!0})),eA=Cs(XT.prototype,"_editableMaterial",[Ys,zT],(function(){return null})),tA=Cs(XT.prototype,"_reflectionHDR",[Ys,VT],(function(){return null})),iA=Cs(XT.prototype,"_reflectionLDR",[Ys,WT],(function(){return null})),nA=Cs(XT.prototype,"_rotationAngle",[Ys],(function(){return 0})),jT=XT))||jT));v.SkyboxInfo=MS;var PS=e("hc",(rA=Gs("cc.FogInfo"),sA=va(TS),aA=va(Kt),oA=va(Kt),uA=va(Kt),hA=va(Kt),cA=va(Kt),lA=va(Kt),rA((wA=RA=function(){function e(){this._type=fA&&fA(),this._fogColor=pA&&pA(),this._enabled=mA&&mA(),this._fogDensity=gA&&gA(),this._fogStart=vA&&vA(),this._fogEnd=yA&&yA(),this._fogAtten=EA&&EA(),this._fogTop=TA&&TA(),this._fogRange=AA&&AA(),this._accurate=SA&&SA(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,this._resource.initialize(this),this._resource.activate()},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e,e&&(this._resource.type=this._type)))}},{key:"accurate",get:function(){return this._accurate},set:function(e){this._accurate!==e&&(this._accurate=e,this._resource&&(this._resource.accurate=e,e&&(this._resource.type=this._type)))}},{key:"fogColor",get:function(){return this._fogColor},set:function(e){this._fogColor.set(e),this._resource&&(this._resource.fogColor=this._fogColor)}},{key:"type",get:function(){return this._type},set:function(e){this._type=e,this._resource&&(this._resource.type=e)}},{key:"fogDensity",get:function(){return this._fogDensity},set:function(e){this._fogDensity=e,this._resource&&(this._resource.fogDensity=e)}},{key:"fogStart",get:function(){return this._fogStart},set:function(e){this._fogStart=e,this._resource&&(this._resource.fogStart=e)}},{key:"fogEnd",get:function(){return this._fogEnd},set:function(e){this._fogEnd=e,this._resource&&(this._resource.fogEnd=e)}},{key:"fogAtten",get:function(){return this._fogAtten},set:function(e){this._fogAtten=e,this._resource&&(this._resource.fogAtten=e)}},{key:"fogTop",get:function(){return this._fogTop},set:function(e){this._fogTop=e,this._resource&&(this._resource.fogTop=e)}},{key:"fogRange",get:function(){return this._fogRange},set:function(e){this._fogRange=e,this._resource&&(this._resource.fogRange=e)}}]),e}(),RA.FogType=TS,f((dA=wA).prototype,"type",[sA],Object.getOwnPropertyDescriptor(dA.prototype,"type"),dA.prototype),f(dA.prototype,"fogDensity",[aA],Object.getOwnPropertyDescriptor(dA.prototype,"fogDensity"),dA.prototype),f(dA.prototype,"fogStart",[oA],Object.getOwnPropertyDescriptor(dA.prototype,"fogStart"),dA.prototype),f(dA.prototype,"fogEnd",[uA],Object.getOwnPropertyDescriptor(dA.prototype,"fogEnd"),dA.prototype),f(dA.prototype,"fogAtten",[hA],Object.getOwnPropertyDescriptor(dA.prototype,"fogAtten"),dA.prototype),f(dA.prototype,"fogTop",[cA],Object.getOwnPropertyDescriptor(dA.prototype,"fogTop"),dA.prototype),f(dA.prototype,"fogRange",[lA],Object.getOwnPropertyDescriptor(dA.prototype,"fogRange"),dA.prototype),fA=Cs(dA.prototype,"_type",[Ys],(function(){return TS.LINEAR})),pA=Cs(dA.prototype,"_fogColor",[Ys],(function(){return new en("#C8C8C8")})),mA=Cs(dA.prototype,"_enabled",[Ys],(function(){return!1})),gA=Cs(dA.prototype,"_fogDensity",[Ys],(function(){return.3})),vA=Cs(dA.prototype,"_fogStart",[Ys],(function(){return.5})),yA=Cs(dA.prototype,"_fogEnd",[Ys],(function(){return 300})),EA=Cs(dA.prototype,"_fogAtten",[Ys],(function(){return 5})),TA=Cs(dA.prototype,"_fogTop",[Ys],(function(){return 1.5})),AA=Cs(dA.prototype,"_fogRange",[Ys],(function(){return 1.2})),SA=Cs(dA.prototype,"_accurate",[Ys],(function(){return!1})),_A=dA))||_A)),LS=e("hd",(IA=Gs("cc.ShadowsInfo"),bA=va(sT),OA=va(Kt),NA=va(Xt),CA=va(rT),IA((f((PA=function(){function e(){this._enabled=LA&&LA(),this._type=xA&&xA(),this._normal=DA&&DA(),this._distance=FA&&FA(),this._shadowColor=BA&&BA(),this._maxReceived=UA&&UA(),this._size=GA&&GA(),this._resource=null}var t=e.prototype;return t.setPlaneFromNode=function(e){e.getWorldRotation(OS),this.planeDirection=Ki.transformQuat(wS,RS,OS),e.getWorldPosition(wS),this.planeHeight=Ki.dot(this._normal,wS)},t.activate=function(e){this._resource=e,this._resource.initialize(this),this._resource.activate()},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e,e&&(this._resource.type=this._type)))}},{key:"type",get:function(){return this._type},set:function(e){this._type=e,this._resource&&(this._resource.type=e)}},{key:"shadowColor",get:function(){return this._shadowColor},set:function(e){this._shadowColor.set(e),this._resource&&(this._resource.shadowColor=e)}},{key:"planeDirection",get:function(){return this._normal},set:function(e){Ki.copy(this._normal,e),this._resource&&(this._resource.normal=e)}},{key:"planeHeight",get:function(){return this._distance},set:function(e){this._distance=e,this._resource&&(this._resource.distance=e)}},{key:"maxReceived",get:function(){return this._maxReceived},set:function(e){this._maxReceived=e,this._resource&&(this._resource.maxReceived=e)}},{key:"shadowMapSize",get:function(){return this._size.x},set:function(e){this._size.set(e,e),this._resource&&(this._resource.size.set(e,e),this._resource.shadowMapDirty=!0)}}]),e}()).prototype,"type",[bA],Object.getOwnPropertyDescriptor(PA.prototype,"type"),PA.prototype),f(PA.prototype,"planeHeight",[OA],Object.getOwnPropertyDescriptor(PA.prototype,"planeHeight"),PA.prototype),f(PA.prototype,"maxReceived",[NA],Object.getOwnPropertyDescriptor(PA.prototype,"maxReceived"),PA.prototype),f(PA.prototype,"shadowMapSize",[CA],Object.getOwnPropertyDescriptor(PA.prototype,"shadowMapSize"),PA.prototype),LA=Cs(PA.prototype,"_enabled",[Ys],(function(){return!1})),xA=Cs(PA.prototype,"_type",[Ys],(function(){return sT.Planar})),DA=Cs(PA.prototype,"_normal",[Ys],(function(){return new Ki(0,1,0)})),FA=Cs(PA.prototype,"_distance",[Ys],(function(){return 0})),BA=Cs(PA.prototype,"_shadowColor",[Ys],(function(){return new en(0,0,0,76)})),UA=Cs(PA.prototype,"_maxReceived",[Ys],(function(){return 4})),GA=Cs(PA.prototype,"_size",[Ys],(function(){return new Rn(1024,1024)})),MA=PA))||MA));v.ShadowsInfo=LS;var xS=e("he",new Ki(-1024,-1024,-1024)),DS=e("hf",new Ki(1024,1024,1024)),FS=e("hg",8),BS=e("hh",(kA=Gs("cc.OctreeInfo"),HA=va(Xt),kA((f((VA=function(){function e(){this._enabled=WA&&WA(),this._minPos=jA&&jA(),this._maxPos=XA&&XA(),this._depth=KA&&KA(),this._resource=null}return e.prototype.activate=function(e){this._resource=e,this._resource.initialize(this)},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled!==e&&(this._enabled=e,this._resource&&(this._resource.enabled=e))}},{key:"minPos",get:function(){return this._minPos},set:function(e){this._minPos=e,this._resource&&(this._resource.minPos=e)}},{key:"maxPos",get:function(){return this._maxPos},set:function(e){this._maxPos=e,this._resource&&(this._resource.maxPos=e)}},{key:"depth",get:function(){return this._depth},set:function(e){this._depth=e,this._resource&&(this._resource.depth=e)}}]),e}()).prototype,"depth",[HA],Object.getOwnPropertyDescriptor(VA.prototype,"depth"),VA.prototype),WA=Cs(VA.prototype,"_enabled",[Ys],(function(){return!1})),jA=Cs(VA.prototype,"_minPos",[Ys],(function(){return new Ki(xS)})),XA=Cs(VA.prototype,"_maxPos",[Ys],(function(){return new Ki(DS)})),KA=Cs(VA.prototype,"_depth",[Ys],(function(){return FS})),zA=VA))||zA));v.OctreeInfo=BS;var US,GS,kS,HS,zS,VS,WS,jS,XS,KS,YS,qS,QS,ZS,JS,$S,eR,tR,iR,nR,rR,sR,aR,oR,uR,hR,cR,lR,_R,dR,fR,pR,mR,gR,vR,yR,ER,TR,AR,SR,RR,wR,IR,bR,OR,NR,CR,MR,PR,LR,xR,DR,FR,BR,UR,GR,kR,HR,zR,VR,WR,jR,XR,KR,YR,qR=e("hi",(YA=Gs("cc.LightProbeInfo"),qA=va(Kt),QA=va(Xt),ZA=va(Xt),JA=va(Kt),YA((f((eS=function(){function e(){this._giScale=tS&&tS(),this._giSamples=iS&&iS(),this._bounces=nS&&nS(),this._reduceRinging=rS&&rS(),this._showProbe=sS&&sS(),this._showWireframe=aS&&aS(),this._showConvex=oS&&oS(),this._data=uS&&uS(),this._nodes=[],this._scene=null,this._resource=null}var t=e.prototype;return t.activate=function(e,t){this._scene=e,this._resource=t,this._resource.initialize(this)},t.clearSHCoefficients=function(){if(this._data){for(var e=this._data.probes,t=0;t<e.length;t++)e[t].coefficients.length=0;this.clearAllSHUBOs()}},t.isUniqueNode=function(){return 1===this._nodes.length},t.addNode=function(e){if(!e)return!1;for(var t=0;t<this._nodes.length;t++)if(this._nodes[t].node===e)return!1;return this._nodes.push({node:e,probes:null}),!0},t.removeNode=function(e){if(!e)return!1;var t=this._nodes.findIndex((function(t){return t.node===e}));return-1!==t&&(this._nodes.splice(t,1),!0)},t.syncData=function(e,t){for(var i=0;i<this._nodes.length;i++)if(this._nodes[i].node===e)return void(this._nodes[i].probes=t)},t.update=function(e){if(void 0===e&&(e=!0),v.internal.LightProbesData){this._data||(this._data=new v.internal.LightProbesData,this._resource&&(this._resource.data=this._data));for(var t=[],i=0;i<this._nodes.length;i++){var n=this._nodes[i].node,r=this._nodes[i].probes,s=n.worldPosition;if(r)for(var a=0;a<r.length;a++){var o=new Ki(0,0,0);Ki.add(o,r[a],s),t.push(o)}}if(t.length<4)return this.resetAllTetraIndices(),void this._data.reset();this._data.updateProbes(t),e&&(this.resetAllTetraIndices(),this._data.updateTetrahedrons())}},t.clearAllSHUBOs=function(){if(this._scene){var e=this._scene.renderScene;if(e)for(var t=e.models,i=0;i<t.length;i++)t[i].clearSHUBOs()}},t.resetAllTetraIndices=function(){if(this._scene){var e=this._scene.renderScene;if(e)for(var t=e.models,i=0;i<t.length;i++)t[i].tetrahedronIndex=-1}},n(e,[{key:"giScale",get:function(){return this._giScale},set:function(e){this._giScale!==e&&(this._giScale=e,this._resource&&(this._resource.giScale=e))}},{key:"giSamples",get:function(){return this._giSamples},set:function(e){this._giSamples!==e&&(this._giSamples=e,this._resource&&(this._resource.giSamples=e))}},{key:"bounces",get:function(){return this._bounces},set:function(e){this._bounces!==e&&(this._bounces=e,this._resource&&(this._resource.bounces=e))}},{key:"reduceRinging",get:function(){return this._reduceRinging},set:function(e){this._reduceRinging!==e&&(this._reduceRinging=e,this._resource&&(this._resource.reduceRinging=e))}},{key:"showProbe",get:function(){return this._showProbe},set:function(e){this._showProbe!==e&&(this._showProbe=e,this._resource&&(this._resource.showProbe=e))}},{key:"showWireframe",get:function(){return this._showWireframe},set:function(e){this._showWireframe!==e&&(this._showWireframe=e,this._resource&&(this._resource.showWireframe=e))}},{key:"showConvex",get:function(){return this._showConvex},set:function(e){this._showConvex!==e&&(this._showConvex=e,this._resource&&(this._resource.showConvex=e))}},{key:"data",get:function(){return this._data},set:function(e){this._data!==e&&(this._data=e,this._resource&&(this._resource.data=e))}}]),e}()).prototype,"giScale",[qA],Object.getOwnPropertyDescriptor(eS.prototype,"giScale"),eS.prototype),f(eS.prototype,"giSamples",[QA],Object.getOwnPropertyDescriptor(eS.prototype,"giSamples"),eS.prototype),f(eS.prototype,"bounces",[ZA],Object.getOwnPropertyDescriptor(eS.prototype,"bounces"),eS.prototype),f(eS.prototype,"reduceRinging",[JA],Object.getOwnPropertyDescriptor(eS.prototype,"reduceRinging"),eS.prototype),tS=Cs(eS.prototype,"_giScale",[Ys],(function(){return 1})),iS=Cs(eS.prototype,"_giSamples",[Ys],(function(){return 1024})),nS=Cs(eS.prototype,"_bounces",[Ys],(function(){return 2})),rS=Cs(eS.prototype,"_reduceRinging",[Ys],(function(){return 0})),sS=Cs(eS.prototype,"_showProbe",[Ys],(function(){return!0})),aS=Cs(eS.prototype,"_showWireframe",[Ys],(function(){return!0})),oS=Cs(eS.prototype,"_showConvex",[Ys],(function(){return!1})),uS=Cs(eS.prototype,"_data",[Ys],(function(){return null})),$A=eS))||$A)),QR=e("hj",(hS=Gs("cc.SceneGlobals"),cS=va(MS),hS((_S=function(){function e(){this.ambient=dS&&dS(),this.shadows=fS&&fS(),this._skybox=pS&&pS(),this.fog=mS&&mS(),this.octree=gS&&gS(),this.lightProbeInfo=vS&&vS(),this.bakedWithStationaryMainLight=yS&&yS()}return e.prototype.activate=function(e){var t=v.director.root.pipeline.pipelineSceneData;this.skybox.activate(t.skybox),this.ambient.activate(t.ambient),this.shadows.activate(t.shadows),this.fog.activate(t.fog),this.octree.activate(t.octree),this.lightProbeInfo&&t.lightProbes&&this.lightProbeInfo.activate(e,t.lightProbes),v.director.root.onGlobalPipelineStateChanged()},n(e,[{key:"skybox",get:function(){return this._skybox},set:function(e){this._skybox=e}}]),e}(),dS=Cs(_S.prototype,"ambient",[Ys],(function(){return new CS})),fS=Cs(_S.prototype,"shadows",[Ys],(function(){return new LS})),pS=Cs(_S.prototype,"_skybox",[Ys],(function(){return new MS})),mS=Cs(_S.prototype,"fog",[Ys],(function(){return new PS})),f(_S.prototype,"skybox",[cS],Object.getOwnPropertyDescriptor(_S.prototype,"skybox"),_S.prototype),gS=Cs(_S.prototype,"octree",[Ys],(function(){return new BS})),vS=Cs(_S.prototype,"lightProbeInfo",[Ys],(function(){return new qR})),yS=Cs(_S.prototype,"bakedWithStationaryMainLight",[Ys],(function(){return!1})),lS=_S))||lS));v.SceneGlobals=QR;var ZR=Gs("cc.TargetInfo")((GS=function(){this.localID=kS&&kS()},kS=Cs(GS.prototype,"localID",[Ys],(function(){return[]})),US=GS))||US,JR=(HS=Gs("cc.TargetOverrideInfo"),zS=va(Ba),VS=va(ZR),WS=va(Wm),jS=va(ZR),HS((KS=function(){this.source=YS&&YS(),this.sourceInfo=qS&&qS(),this.propertyPath=QS&&QS(),this.target=ZS&&ZS(),this.targetInfo=JS&&JS()},YS=Cs(KS.prototype,"source",[Ys,zS],(function(){return null})),qS=Cs(KS.prototype,"sourceInfo",[Ys,VS],(function(){return null})),QS=Cs(KS.prototype,"propertyPath",[Ys],(function(){return[]})),ZS=Cs(KS.prototype,"target",[Ys,WS],(function(){return null})),JS=Cs(KS.prototype,"targetInfo",[Ys,jS],(function(){return null})),XS=KS))||XS),$R=Gs("cc.CompPrefabInfo")((eR=function(){this.fileId=tR&&tR()},tR=Cs(eR.prototype,"fileId",[Ys],(function(){return""})),$S=eR))||$S,ew=(iR=Gs("CCPropertyOverrideInfo"),nR=va(ZR),iR((sR=function(){function e(){this.targetInfo=aR&&aR(),this.propertyPath=oR&&oR(),this.value=uR&&uR()}return e.prototype.isTarget=function(){},e}(),aR=Cs(sR.prototype,"targetInfo",[Ys,nR],(function(){return null})),oR=Cs(sR.prototype,"propertyPath",[Ys],(function(){return[]})),uR=Cs(sR.prototype,"value",[Ys],null),rR=sR))||rR),tw=(hR=Gs("cc.MountedChildrenInfo"),cR=va(ZR),lR=va([Wm]),hR((dR=function(){function e(){this.targetInfo=fR&&fR(),this.nodes=pR&&pR()}return e.prototype.isTarget=function(){},e}(),fR=Cs(dR.prototype,"targetInfo",[Ys,cR],(function(){return null})),pR=Cs(dR.prototype,"nodes",[Ys,lR],(function(){return[]})),_R=dR))||_R),iw=(mR=Gs("cc.MountedComponentsInfo"),gR=va(ZR),vR=va([Zf]),mR((ER=function(){function e(){this.targetInfo=TR&&TR(),this.components=AR&&AR()}return e.prototype.isTarget=function(){},e}(),TR=Cs(ER.prototype,"targetInfo",[Ys,gR],(function(){return null})),AR=Cs(ER.prototype,"components",[Ys,vR],(function(){return[]})),yR=ER))||yR),nw=(SR=Gs("cc.PrefabInstance"),RR=va(Wm),wR=va([tw]),IR=va([iw]),bR=va([ew]),OR=va([ZR]),SR((CR=function(){function e(){this.fileId=MR&&MR(),this.prefabRootNode=PR&&PR(),this.mountedChildren=LR&&LR(),this.mountedComponents=xR&&xR(),this.propertyOverrides=DR&&DR(),this.removedComponents=FR&&FR(),this.targetMap={},this.expanded=!1}var t=e.prototype;return t.findPropertyOverride=function(){},t.removePropertyOverride=function(){},e}(),MR=Cs(CR.prototype,"fileId",[Ys],(function(){return""})),PR=Cs(CR.prototype,"prefabRootNode",[Ys,RR],null),LR=Cs(CR.prototype,"mountedChildren",[Ys,wR],(function(){return[]})),xR=Cs(CR.prototype,"mountedComponents",[Ys,IR],(function(){return[]})),DR=Cs(CR.prototype,"propertyOverrides",[Ys,bR],(function(){return[]})),FR=Cs(CR.prototype,"removedComponents",[Ys,OR],(function(){return[]})),NR=CR))||NR),rw=(BR=Gs("cc.PrefabInfo"),UR=va(Wm),GR=va(nw),kR=va([JR]),BR((zR=function(){this.root=VR&&VR(),this.asset=WR&&WR(),this.fileId=jR&&jR(),this.instance=XR&&XR(),this.targetOverrides=KR&&KR(),this.nestedPrefabInstanceRoots=YR&&YR()},VR=Cs(zR.prototype,"root",[Ys,UR],null),WR=Cs(zR.prototype,"asset",[Ys],null),jR=Cs(zR.prototype,"fileId",[Ys],(function(){return""})),XR=Cs(zR.prototype,"instance",[Ys,GR],null),KR=Cs(zR.prototype,"targetOverrides",[Ys,kR],null),YR=Cs(zR.prototype,"nestedPrefabInstanceRoots",[Ys],null),HR=zR))||HR);function sw(e){var t=e._prefab;if(t&&t.instance){if(!t.asset)return Z(3701,e.name),void(t.instance=void 0);var i=e._objFlags,n=e._parent,r=e._id,s=e._prefab;e[Ta],v.game._isCloning=!0,t.asset._doInstantiate(e),v.game._isCloning=!1,e._objFlags=i,e._parent=n,e._id=r,e._prefab&&(e._prefab.instance=null==s?void 0:s.instance)}}function aw(e,t,i){var n;if(t&&e){var r=t,s=null===(n=e._prefab)||void 0===n?void 0:n.instance;!i&&s&&(t[s.fileId]={},r=t[s.fileId]);var a=e._prefab;a&&(r[a.fileId]=e);for(var o=e.components,u=0;u<o.length;u++){var h=o[u];h.__prefab&&(r[h.__prefab.fileId]=h)}for(var c=0;c<e.children.length;c++)aw(e.children[c],r,!1)}}function ow(e,t){if(!e)return null;for(var i=t,n=0;n<e.length;n++){if(!i)return null;i=i[e[n]]}return i}function uw(e,t,i){if(t)for(var n=0;n<t.length;n++){var r=t[n];if(r&&r.targetInfo){var s=ow(r.targetInfo.localID,i);if(!s)continue;var a=i,o=r.targetInfo.localID;if(o.length>0)for(var u=0;u<o.length-1;u++)a=a[o[u]];if(r.nodes)for(var h=0;h<r.nodes.length;h++){var c=r.nodes[h];c&&!s._children.includes(c)&&(s._children.push(c),c._parent=s,aw(c,a,!1),c._siblingIndex=s._children.length-1,dw(c,!0))}}}}function hw(e,t,i){if(t)for(var n=0;n<t.length;n++){var r=t[n];if(r&&r.targetInfo){var s=ow(r.targetInfo.localID,i);if(!s)continue;if(r.components)for(var a=0;a<r.components.length;a++){var o=r.components[a];o&&(o.node=s,s._components.push(o))}}}}function cw(e,t,i){if(t)for(var n=0;n<t.length;n++){var r=t[n];if(r){var s=ow(r.localID,i);if(!s||!s.node)continue;var a=s.node.components.indexOf(s);a>=0&&s.node._components.splice(a,1)}}}function lw(e,t,i){if(!(t.length<=0))for(var n=null,r=0;r<t.length;r++){var s=t[r];if(s&&s.targetInfo){if(!(n=ow(s.targetInfo.localID,i)))continue;var a=n,o=s.propertyPath.slice();if(o.length>0){var u=o.pop();if(!u)continue;for(var h=0;h<o.length&&(a=a[o[h]]);h++);if(!a)continue;if(Array.isArray(a))if("length"===u)a[u]=s.value;else{var c=Number.parseInt(u);Number.isInteger(c)&&c<a.length&&(a[u]=s.value)}else a[u]instanceof Tt?a[u].set(s.value):a[u]=s.value}}}}function _w(e){var t,i=null===(t=e._prefab)||void 0===t?void 0:t.targetOverrides;if(i)for(var n=0;n<i.length;n++){var r,s,a=i[n],o=a.source,u=a.sourceInfo;if(u){var h,c,l=null===(h=a.source)||void 0===h||null===(c=h._prefab)||void 0===c?void 0:c.instance;l&&l.targetMap&&(o=ow(u.localID,l.targetMap))}if(o){var _,d=a.targetInfo;if(d){var f=null===(r=a.target)||void 0===r||null===(s=r._prefab)||void 0===s?void 0:s.instance;if(f&&f.targetMap&&(_=ow(d.localID,f.targetMap))){var p=a.propertyPath.slice(),m=o;if(p.length>0){var g=p.pop();if(!g)return;for(var v=0;v<p.length&&(m=m[p[v]]);v++);if(!m)continue;m[g]=_}}}}}}function dw(e,t){void 0===t&&(t=!1);var i=e._prefab,n=null==i?void 0:i.instance;if(n&&!n.expanded){sw(e),t&&e&&e.children&&e.children.forEach((function(e){dw(e,!0)}));var r={};n.targetMap=r,aw(e,r,!0),uw(0,n.mountedChildren,r),cw(0,n.removedComponents,r),hw(0,n.mountedComponents,r),lw(0,n.propertyOverrides,r),n.expanded=!0}else t&&e&&e.children&&e.children.forEach((function(e){dw(e,!0)}))}function fw(e){var t=e._prefab;t&&t.nestedPrefabInstanceRoots&&t.nestedPrefabInstanceRoots.forEach((function(e){var t,i;dw(e),pw(e,null===(t=e._prefab)||void 0===t||null===(i=t.instance)||void 0===i?void 0:i.fileId)}))}function pw(e,t){for(var i=e.components,n=e.children,r=0;r<i.length;r++){var s,a,o=i[r],u=null!==(s=null===(a=o.__prefab)||void 0===a?void 0:a.fileId)&&void 0!==s?s:"";o._id=""+t+u}for(var h=0;h<n.length;h++){var c=n[h],l=c._prefab,_=null!=l&&l.instance?l.instance.fileId:null==l?void 0:l.fileId;_&&(c._id=""+t+_,null!=l&&l.instance||pw(c,t))}}v._PrefabInfo=rw;var mw,gw,vw,yw,Ew,Tw,Aw,Sw=Object.freeze({__proto__:null,createNodeWithPrefab:sw,generateTargetMap:aw,getTarget:ow,applyMountedChildren:uw,applyMountedComponents:hw,applyRemovedComponents:cw,applyPropertyOverrides:lw,applyTargetOverrides:_w,expandPrefabInstanceNode:dw,expandNestedPrefabInstanceNode:fw,applyNodeAndComponentId:pw,TargetInfo:ZR,TargetOverrideInfo:JR,CompPrefabInfo:$R,PropertyOverrideInfo:ew,MountedChildrenInfo:tw,MountedComponentsInfo:iw,PrefabInstance:nw,PrefabInfo:rw}),Rw=e("fK",Gs("cc.Scene")((gw=function(e){s(i,e);var t=i.prototype;function i(t){var i;return(i=e.call(this,t)||this).autoReleaseAssets=vw&&vw(),i._globals=yw&&yw(),i.dependAssets=null,i._renderScene=null,i._inited=void 0,i._prefabSyncedInLiveReload=!1,i._activeInHierarchy=!1,v.director&&v.director.root&&(i._renderScene=v.director.root.createScene({})),i._inited=!v.game||!v.game._isCloning,i}return t._updateScene=function(){this._scene=this},t.destroy=function(){var e=Ba.prototype.destroy.call(this);if(e)for(var t=this._children,i=0;i<t.length;++i)t[i].active=!1;return this._renderScene&&v.director.root.destroyScene(this._renderScene),this._active=!1,this._activeInHierarchy=!1,e},t.addComponent=function(){throw new Error(te(3822))},t._onHierarchyChanged=function(){},t._onPostActivated=function(){},t._onBatchCreated=function(e){for(var t=this._children.length,i=0;i<t;++i)this._children[i]._siblingIndex=i,this._children[i]._onBatchCreated(e)},t.updateWorldTransform=function(){},t._instantiate=function(){},t._load=function(){this._inited||(fw(this),_w(this),this._onBatchCreated(m),this._inited=!0),this.walk(Wm._setScene)},t._activate=function(e){e=!1!==e,v.director._nodeActivator.activateNode(this,e),this._globals.activate(this)},n(i,[{key:"renderScene",get:function(){return this._renderScene}},{key:"globals",get:function(){return this._globals}}]),i}(Wm),vw=Cs(gw.prototype,"autoReleaseAssets",[Ys],(function(){return!1})),yw=Cs(gw.prototype,"_globals",[Ys],(function(){return new QR})),mw=gw))||mw);v.Scene=Rw;var ww=e("hp",Gs("cc.SceneAsset")((Tw=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).scene=Aw&&Aw(),t}s(t,e);var i=t.prototype;return i.initDefault=function(t){e.prototype.initDefault.call(this,t),this.scene=new Rw("New Scene")},i.validate=function(){return!!this.scene},t}(qd),Aw=Cs(Tw.prototype,"scene",[Ys],(function(){return null})),Ew=Tw))||Ew);v.SceneAsset=ww,pe({SystemEventType:{newName:"Input.EventType",since:"3.3.0",removed:!1}}),pe({SystemEvent:{newName:"Input",since:"3.4.0",removed:!1},systemEvent:{newName:"input",since:"3.4.0",removed:!1}});var Iw,bw,Ow=e("fy",function(){function e(e,t){this.type=void 0,this.bubbles=void 0,this.target=null,this.currentTarget=null,this.eventPhase=0,this.propagationStopped=!1,this.propagationImmediateStopped=!1,this.type=e,this.bubbles=!!t}var t=e.prototype;return t.unuse=function(){this.type=e.NO_TYPE,this.target=null,this.currentTarget=null,this.eventPhase=e.NONE,this.propagationStopped=!1,this.propagationImmediateStopped=!1},t.reuse=function(e,t){this.type=e,this.bubbles=t||!1},t.isStopped=function(){return this.propagationStopped||this.propagationImmediateStopped},t.getCurrentTarget=function(){return this.currentTarget},t.getType=function(){return this.type},e}());Ow.NO_TYPE="no_type",Ow.TOUCH="touch",Ow.MOUSE="mouse",Ow.KEYBOARD="keyboard",Ow.ACCELERATION="acceleration",Ow.NONE=0,Ow.CAPTURING_PHASE=1,Ow.AT_TARGET=2,Ow.BUBBLING_PHASE=3,v.Event=Ow,function(e){e.TOUCH_START="touch-start",e.TOUCH_MOVE="touch-move",e.TOUCH_END="touch-end",e.TOUCH_CANCEL="touch-cancel",e.MOUSE_DOWN="mouse-down",e.MOUSE_MOVE="mouse-move",e.MOUSE_UP="mouse-up",e.MOUSE_WHEEL="mouse-wheel",e.MOUSE_ENTER="mouse-enter",e.MOUSE_LEAVE="mouse-leave",e.KEY_DOWN="keydown",e.KEY_UP="keyup",e.DEVICEMOTION="devicemotion",e.TRANSFORM_CHANGED="transform-changed",e.SCENE_CHANGED_FOR_PERSISTS="scene-changed-for-persists",e.SIZE_CHANGED="size-changed",e.ANCHOR_CHANGED="anchor-changed",e.COLOR_CHANGED="color-changed",e.CHILD_ADDED="child-added",e.CHILD_REMOVED="child-removed",e.PARENT_CHANGED="parent-changed",e.NODE_DESTROYED="node-destroyed",e.LAYER_CHANGED="layer-changed",e.SIBLING_ORDER_CHANGED="sibling-order-changed"}(Iw||(Iw=e("fG",{}))),function(e){e.TOUCH_START="touch-start",e.TOUCH_MOVE="touch-move",e.TOUCH_END="touch-end",e.TOUCH_CANCEL="touch-cancel",e.MOUSE_DOWN="mouse-down",e.MOUSE_MOVE="mouse-move",e.MOUSE_UP="mouse-up",e.MOUSE_WHEEL="mouse-wheel",e.KEY_DOWN="keydown",e.KEY_PRESSING="key-pressing",e.KEY_UP="keyup",e.DEVICEMOTION="devicemotion",e.GAMEPAD_INPUT="gamepad-input",e.GAMEPAD_CHANGE="gamepad-change",e.HANDLE_INPUT="handle-input",e.HANDLE_POSE_INPUT="handle-pose-input",e.HMD_POSE_INPUT="hmd-pose-input",e.HANDHELD_POSE_INPUT="handheld-pose-input"}(bw||(bw=e("e3",{}))),v.SystemEventType=Iw;var Nw=e("hD",function(e){function t(t,i){var n;return(n=e.call(this,Iw.DEVICEMOTION,i)||this).acc=void 0,n.acc=t,n}return s(t,e),t}(Ow));Ow.EventAcceleration=Nw;var Cw=e("hE",function(e){function t(t,i,n){var r;return"boolean"==typeof i&&(i=i?Iw.KEY_DOWN:Iw.KEY_UP),(r=e.call(this,i,n)||this).windowId=void 0,r.keyCode=void 0,r.rawEvent=void 0,r._isPressed=void 0,r._isPressed=i!==Iw.KEY_UP,"number"==typeof t?r.keyCode=t:(r.keyCode=t.keyCode,r.rawEvent=t),r.windowId=0,r}return s(t,e),n(t,[{key:"isPressed",get:function(){return this._isPressed}}]),t}(Ow));Ow.EventKeyboard=Cw;var Mw=e("hF",function(e){function t(i,n,r,s){var a;return(a=e.call(this,i,n)||this).movementX=0,a.movementY=0,a.windowId=0,a.preventSwallow=!1,a._eventType=void 0,a._button=t.BUTTON_MISSING,a._x=0,a._y=0,a._prevX=0,a._prevY=0,a._scrollX=0,a._scrollY=0,a._eventType=i,r&&(a._prevX=r.x,a._prevY=r.y),a.windowId=null!=s?s:a.windowId,a}s(t,e);var i=t.prototype;return i.setScrollData=function(e,t){this._scrollX=e,this._scrollY=t},i.getScrollX=function(){return this._scrollX},i.getScrollY=function(){return this._scrollY},i.setLocation=function(e,t){this._x=e,this._y=t},i.getLocation=function(e){return e||(e=new Rn),Rn.set(e,this._x,this._y),e},i.getLocationInView=function(e){return e||(e=new Rn),Rn.set(e,this._x,v.view._designResolutionSize.height-this._y),e},i.getUILocation=function(e){return e||(e=new Rn),Rn.set(e,this._x,this._y),v.view._convertToUISpace(e),e},i.getPreviousLocation=function(e){return e||(e=new Rn),Rn.set(e,this._prevX,this._prevY),e},i.getUIPreviousLocation=function(e){return e||(e=new Rn),Rn.set(e,this._prevX,this._prevY),v.view._convertToUISpace(e),e},i.getDelta=function(e){return e||(e=new Rn),Rn.set(e,this._x-this._prevX,this._y-this._prevY),e},i.getDeltaX=function(){return this._x-this._prevX},i.getDeltaY=function(){return this._y-this._prevY},i.getUIDelta=function(e){return e||(e=new Rn),Rn.set(e,(this._x-this._prevX)/v.view.getScaleX(),(this._y-this._prevY)/v.view.getScaleY()),e},i.getUIDeltaX=function(){return(this._x-this._prevX)/v.view.getScaleX()},i.getUIDeltaY=function(){return(this._y-this._prevY)/v.view.getScaleY()},i.setButton=function(e){this._button=e},i.getButton=function(){return this._button},i.getLocationX=function(){return this._x},i.getLocationY=function(){return this._y},i.getUILocationX=function(){var e=v.view.getViewportRect();return(this._x-e.x)/v.view.getScaleX()},i.getUILocationY=function(){var e=v.view.getViewportRect();return(this._y-e.y)/v.view.getScaleY()},n(t,[{key:"eventType",get:function(){return this._eventType}}]),t}(Ow));Mw.BUTTON_MISSING=-1,Mw.BUTTON_LEFT=0,Mw.BUTTON_RIGHT=2,Mw.BUTTON_MIDDLE=1,Mw.BUTTON_4=3,Mw.BUTTON_5=4,Mw.BUTTON_6=5,Mw.BUTTON_7=6,Mw.BUTTON_8=7,Ow.EventMouse=Mw;var Pw=new Rn,Lw=e("fF",function(e){function t(t,i,n,r){var s;return void 0===r&&(r=[]),(s=e.call(this,n,i)||this).touch=null,s.simulate=!1,s.windowId=0,s.preventSwallow=!1,s._eventCode=void 0,s._touches=void 0,s._allTouches=void 0,s._eventCode=n,s._touches=t||[],s._allTouches=r,s}s(t,e);var i=t.prototype;return i.getEventCode=function(){return this._eventCode},i.getTouches=function(){return this._touches},i.getAllTouches=function(){return this._allTouches},i.setLocation=function(e,t){this.touch&&this.touch.setTouchInfo(this.touch.getID(),e,t)},i.getLocation=function(e){return this.touch?this.touch.getLocation(e):new Rn},i.getUILocation=function(e){return this.touch?this.touch.getUILocation(e):new Rn},i.getLocationInView=function(e){return this.touch?this.touch.getLocationInView(e):new Rn},i.getPreviousLocation=function(e){return this.touch?this.touch.getPreviousLocation(e):new Rn},i.getStartLocation=function(e){return this.touch?this.touch.getStartLocation(e):new Rn},i.getUIStartLocation=function(e){return this.touch?this.touch.getUIStartLocation(e):new Rn},i.getID=function(){return this.touch?this.touch.getID():null},i.getDelta=function(e){return this.touch?this.touch.getDelta(e):new Rn},i.getUIDelta=function(e){return this.touch?this.touch.getUIDelta(e):new Rn},i.getDeltaX=function(){return this.touch?this.touch.getDelta(Pw).x:0},i.getDeltaY=function(){return this.touch?this.touch.getDelta(Pw).y:0},i.getLocationX=function(){return this.touch?this.touch.getLocationX():0},i.getLocationY=function(){return this.touch?this.touch.getLocationY():0},t}(Ow));Lw.MAX_TOUCHES=5,Ow.EventTouch=Lw;var xw,Dw=e("fH",function(e){function t(t,i){var n;return(n=e.call(this,t,!1)||this).gamepad=void 0,n.gamepad=i,n}return s(t,e),t}(Ow)),Fw=e("fI",function(e){function t(t,i){var n;return(n=e.call(this,t,!1)||this).handleInputDevice=void 0,n.handleInputDevice=i,n}return s(t,e),t}(Ow)),Bw=(e("hG",function(e){function t(t,i){var n;return(n=e.call(this,t,!1)||this).hmdInputDevice=void 0,n.hmdInputDevice=i,n}return s(t,e),t}(Ow)),e("hH",function(e){function t(t,i){var n;return(n=e.call(this,t,!1)||this).handheldInputDevice=void 0,n.handheldInputDevice=i,n}return s(t,e),t}(Ow)),e("hI",(function(e,t,i,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=void 0,this.y=void 0,this.z=void 0,this.timestamp=void 0,this.x=e,this.y=t,this.z=i,this.timestamp=n})));!function(e){e[e.NONE=0]="NONE",e[e.MOBILE_BACK=6]="MOBILE_BACK",e[e.BACKSPACE=8]="BACKSPACE",e[e.TAB=9]="TAB",e[e.ENTER=13]="ENTER",e[e.SHIFT_LEFT=16]="SHIFT_LEFT",e[e.CTRL_LEFT=17]="CTRL_LEFT",e[e.ALT_LEFT=18]="ALT_LEFT",e[e.PAUSE=19]="PAUSE",e[e.CAPS_LOCK=20]="CAPS_LOCK",e[e.ESCAPE=27]="ESCAPE",e[e.SPACE=32]="SPACE",e[e.PAGE_UP=33]="PAGE_UP",e[e.PAGE_DOWN=34]="PAGE_DOWN",e[e.END=35]="END",e[e.HOME=36]="HOME",e[e.ARROW_LEFT=37]="ARROW_LEFT",e[e.ARROW_UP=38]="ARROW_UP",e[e.ARROW_RIGHT=39]="ARROW_RIGHT",e[e.ARROW_DOWN=40]="ARROW_DOWN",e[e.INSERT=45]="INSERT",e[e.DELETE=46]="DELETE",e[e.DIGIT_0=48]="DIGIT_0",e[e.DIGIT_1=49]="DIGIT_1",e[e.DIGIT_2=50]="DIGIT_2",e[e.DIGIT_3=51]="DIGIT_3",e[e.DIGIT_4=52]="DIGIT_4",e[e.DIGIT_5=53]="DIGIT_5",e[e.DIGIT_6=54]="DIGIT_6",e[e.DIGIT_7=55]="DIGIT_7",e[e.DIGIT_8=56]="DIGIT_8",e[e.DIGIT_9=57]="DIGIT_9",e[e.KEY_A=65]="KEY_A",e[e.KEY_B=66]="KEY_B",e[e.KEY_C=67]="KEY_C",e[e.KEY_D=68]="KEY_D",e[e.KEY_E=69]="KEY_E",e[e.KEY_F=70]="KEY_F",e[e.KEY_G=71]="KEY_G",e[e.KEY_H=72]="KEY_H",e[e.KEY_I=73]="KEY_I",e[e.KEY_J=74]="KEY_J",e[e.KEY_K=75]="KEY_K",e[e.KEY_L=76]="KEY_L",e[e.KEY_M=77]="KEY_M",e[e.KEY_N=78]="KEY_N",e[e.KEY_O=79]="KEY_O",e[e.KEY_P=80]="KEY_P",e[e.KEY_Q=81]="KEY_Q",e[e.KEY_R=82]="KEY_R",e[e.KEY_S=83]="KEY_S",e[e.KEY_T=84]="KEY_T",e[e.KEY_U=85]="KEY_U",e[e.KEY_V=86]="KEY_V",e[e.KEY_W=87]="KEY_W",e[e.KEY_X=88]="KEY_X",e[e.KEY_Y=89]="KEY_Y",e[e.KEY_Z=90]="KEY_Z",e[e.NUM_0=96]="NUM_0",e[e.NUM_1=97]="NUM_1",e[e.NUM_2=98]="NUM_2",e[e.NUM_3=99]="NUM_3",e[e.NUM_4=100]="NUM_4",e[e.NUM_5=101]="NUM_5",e[e.NUM_6=102]="NUM_6",e[e.NUM_7=103]="NUM_7",e[e.NUM_8=104]="NUM_8",e[e.NUM_9=105]="NUM_9",e[e.NUM_MULTIPLY=106]="NUM_MULTIPLY",e[e.NUM_PLUS=107]="NUM_PLUS",e[e.NUM_SUBTRACT=109]="NUM_SUBTRACT",e[e.NUM_DECIMAL=110]="NUM_DECIMAL",e[e.NUM_DIVIDE=111]="NUM_DIVIDE",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NUM_LOCK=144]="NUM_LOCK",e[e.SCROLL_LOCK=145]="SCROLL_LOCK",e[e.SEMICOLON=186]="SEMICOLON",e[e.EQUAL=187]="EQUAL",e[e.COMMA=188]="COMMA",e[e.DASH=189]="DASH",e[e.PERIOD=190]="PERIOD",e[e.SLASH=191]="SLASH",e[e.BACK_QUOTE=192]="BACK_QUOTE",e[e.BRACKET_LEFT=219]="BRACKET_LEFT",e[e.BACKSLASH=220]="BACKSLASH",e[e.BRACKET_RIGHT=221]="BRACKET_RIGHT",e[e.QUOTE=222]="QUOTE",e[e.SHIFT_RIGHT=2e3]="SHIFT_RIGHT",e[e.CTRL_RIGHT=2001]="CTRL_RIGHT",e[e.ALT_RIGHT=2002]="ALT_RIGHT",e[e.NUM_ENTER=2003]="NUM_ENTER"}(xw||(xw=e("fB",{})));var Uw=new Rn,Gw=e("hJ",function(){function e(e,t,i){void 0===i&&(i=0),this._point=new Rn,this._prevPoint=new Rn,this._lastModified=0,this._id=0,this._startPoint=new Rn,this._startPointCaptured=!1,this.setTouchInfo(i,e,t)}var t=e.prototype;return t.getLocation=function(e){return e||(e=new Rn),e.set(this._point.x,this._point.y),e},t.getLocationX=function(){return this._point.x},t.getLocationY=function(){return this._point.y},t.getUILocation=function(e){return e||(e=new Rn),e.set(this._point.x,this._point.y),v.view._convertToUISpace(e),e},t.getUILocationX=function(){var e=v.view.getViewportRect();return(this._point.x-e.x)/v.view.getScaleX()},t.getUILocationY=function(){var e=v.view.getViewportRect();return(this._point.y-e.y)/v.view.getScaleY()},t.getPreviousLocation=function(e){return e||(e=new Rn),e.set(this._prevPoint.x,this._prevPoint.y),e},t.getUIPreviousLocation=function(e){return e||(e=new Rn),e.set(this._prevPoint.x,this._prevPoint.y),v.view._convertToUISpace(e),e},t.getStartLocation=function(e){return e||(e=new Rn),e.set(this._startPoint.x,this._startPoint.y),e},t.getUIStartLocation=function(e){return e||(e=new Rn),e.set(this._startPoint.x,this._startPoint.y),v.view._convertToUISpace(e),e},t.getDelta=function(e){return e||(e=new Rn),e.set(this._point),e.subtract(this._prevPoint),e},t.getUIDelta=function(e){return e||(e=new Rn),Uw.set(this._point),Uw.subtract(this._prevPoint),e.set(v.view.getScaleX(),v.view.getScaleY()),Rn.divide(e,Uw,e),e},t.getLocationInView=function(e){return e||(e=new Rn),e.set(this._point.x,v.view._designResolutionSize.height-this._point.y),e},t.getPreviousLocationInView=function(e){return e||(e=new Rn),e.set(this._prevPoint.x,v.view._designResolutionSize.height-this._prevPoint.y),e},t.getStartLocationInView=function(e){return e||(e=new Rn),e.set(this._startPoint.x,v.view._designResolutionSize.height-this._startPoint.y),e},t.getID=function(){return this._id},t.setTouchInfo=function(e,t,i){void 0===e&&(e=0),this._prevPoint=this._point,this._point=new Rn(t||0,i||0),this._id=e,this._startPointCaptured||(this._startPoint=new Rn(this._point),this._startPointCaptured=!0)},t.setPoint=function(e,t){"object"==typeof e?(this._point.x=e.x,this._point.y=e.y):(this._point.x=e||0,this._point.y=t||0),this._lastModified=v.game.frameStartTime},t.setPrevPoint=function(e,t){this._prevPoint="object"==typeof e?new Rn(e.x,e.y):new Rn(e||0,t||0),this._lastModified=v.game.frameStartTime},n(e,[{key:"lastModified",get:function(){return this._lastModified}}]),e}());v.Touch=Gw;var kw,Hw,zw,Vw=function(){function e(){this._intervalInMileSeconds=200,this._accelTimer=0,this._eventTarget=new kh,this._deviceEventName=void 0,this._globalEventClass=void 0,this._didAccelerateFunc=void 0,this._globalEventClass=window.DeviceMotionEvent||window.DeviceOrientationEvent,qh.browserType===Hh.MOBILE_QQ&&(this._globalEventClass=window.DeviceOrientationEvent),this._deviceEventName=this._globalEventClass===window.DeviceMotionEvent?"devicemotion":"deviceorientation",this._didAccelerateFunc=this._didAccelerate.bind(this)}var t=e.prototype;return t._registerEvent=function(){this._accelTimer=performance.now(),window.addEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},t._unregisterEvent=function(){this._accelTimer=0,window.removeEventListener(this._deviceEventName,this._didAccelerateFunc,!1)},t._didAccelerate=function(e){var t=performance.now();if(!(t-this._accelTimer<this._intervalInMileSeconds)){this._accelTimer=t;var i=0,n=0,r=0;if(this._globalEventClass===window.DeviceMotionEvent){var s=e.accelerationIncludingGravity;i=.1*((null==s?void 0:s.x)||0),n=.1*((null==s?void 0:s.y)||0),r=.1*((null==s?void 0:s.z)||0)}else{var a=e;i=(a.gamma||0)/90*.981,n=-(a.beta||0)/90*.981,r=(a.alpha||0)/90*.981}if(gc.isFrameRotated){var o=i;i=-n,n=o}var u=i;90===window.orientation?(i=-n,n=u):-90===window.orientation?(i=n,n=-u):180===window.orientation&&(i=-i,n=-n),qh.os===Wh.ANDROID&&qh.browserType!==Hh.MOBILE_QQ&&(i=-i,n=-n);var h=performance.now(),c=new Bw(i,n,r,h),l=new Nw(c);this._eventTarget.emit(bw.DEVICEMOTION,l)}},t.start=function(){var e=this;window.DeviceMotionEvent&&"function"==typeof DeviceMotionEvent.requestPermission?DeviceMotionEvent.requestPermission().then((function(t){"granted"===t&&e._registerEvent()})).catch((function(){})):this._registerEvent()},t.stop=function(){this._unregisterEvent()},t.setInterval=function(e){this._intervalInMileSeconds=e},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},e}(),Ww=function(){},jw=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){throw new Error("Method not implemented.")},t}(Ww),Xw=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){throw new Error("Method not implemented.")},t}(Ww),Kw=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){throw new Error("Method not implemented.")},t}(Ww),Yw=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){throw new Error("Method not implemented.")},t}(Ww),qw=function(e){function t(t){var i;return(i=e.call(this)||this).positive=void 0,i.negative=void 0,i.positive=t.positive,i.negative=t.negative,i}return s(t,e),t.prototype.getValue=function(){var e=this.positive.getValue(),t=this.negative.getValue();return Math.abs(e)>Math.abs(t)?e:-t},t}(jw),Qw=function(e){function t(t){var i;return(i=e.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.xAxis=void 0,i.yAxis=void 0,i.up=t.up,i.down=t.down,i.left=t.left,i.right=t.right,i.xAxis=new qw({positive:i.right,negative:i.left}),i.yAxis=new qw({positive:i.up,negative:i.down}),i}return s(t,e),t.prototype.getValue=function(){return new Rn(this.xAxis.getValue(),this.yAxis.getValue())},t}(Xw),Zw=(function(e){function t(t){var i;return(i=e.call(this)||this).up=void 0,i.down=void 0,i.left=void 0,i.right=void 0,i.forward=void 0,i.backward=void 0,i.xAxis=void 0,i.yAxis=void 0,i.zAxis=void 0,i.up=t.up,i.down=t.down,i.left=t.left,i.right=t.right,i.forward=t.forward,i.backward=t.backward,i.xAxis=new qw({positive:i.right,negative:i.left}),i.yAxis=new qw({positive:i.up,negative:i.down}),i.zAxis=new qw({positive:i.forward,negative:i.backward}),i}s(t,e),t.prototype.getValue=function(){return new Ki(this.xAxis.getValue(),this.yAxis.getValue(),this.zAxis.getValue())}}(Kw),function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(jw)),Jw=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(Qw),$w=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t}(Qw),eI=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(Yw),tI=function(e){function t(){return e.apply(this,arguments)||this}return s(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)},t}(Kw),iI=function(){function e(e){this._deviceId=-1,this._connected=!1,this._deviceId=e,this._initInputSource()}e._init=function(){qh.hasFeature(Xh.EVENT_GAMEPAD)&&e._registerEvent()},e._on=function(t,i,n){e._eventTarget.on(t,i,n)},e._removeInputDevice=function(t){var i=e.all.findIndex((function(e){return e.deviceId===t}));-1!==i&&ut(e.all,i)},e._getOrCreateInputDevice=function(t,i){var n=e.all.find((function(e){return e.deviceId===t}));return n||(n=new e(t),e.all.push(n)),n._connected=i,n},e._ensureDirectorDefined=function(){return new Promise((function(t){e._intervalId=setInterval((function(){v.director&&v.Director&&(clearInterval(e._intervalId),e._intervalId=-1,t())}),50)}))},e._registerEvent=function(){e._ensureDirectorDefined().then((function(){v.director.on(v.Director.EVENT_BEGIN_FRAME,e._scanGamepads)})).catch((function(){})),window.addEventListener("gamepadconnected",(function(t){e._cachedWebGamepads[t.gamepad.index]=t.gamepad;var i=e._getOrCreateInputDevice(t.gamepad.index,!0);e._eventTarget.emit(bw.GAMEPAD_CHANGE,new Dw(bw.GAMEPAD_CHANGE,i))})),window.addEventListener("gamepaddisconnected",(function(t){e._cachedWebGamepads[t.gamepad.index]=null;var i=e._getOrCreateInputDevice(t.gamepad.index,!1);e._removeInputDevice(t.gamepad.index),e._eventTarget.emit(bw.GAMEPAD_CHANGE,new Dw(bw.GAMEPAD_CHANGE,i))}))},e._scanGamepads=function(){var t=e._getWebGamePads();if(t){for(var i=[],n=0;n<t.length;++n){var r=null==t?void 0:t[n];if(r){var s=e._cachedWebGamepads[r.index];if(s){for(var a=void 0,o=s.buttons,u=0;u<o.length;++u){var h=o[u],c=r.buttons[u];if(Math.abs(h.value-c.value)>.01){a=e._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}for(var l=s.axes,_=0;_<l.length;++_){var d=l[_],f=r.axes[_];if(Math.abs(d-f)>.01){a=e._getOrCreateInputDevice(r.index,!0);break}}if(a){i.push(a);continue}}}}e._cachedWebGamepads=t;for(var p=0;p<i.length;++p){var m=i[p];e._eventTarget.emit(bw.GAMEPAD_INPUT,new Dw(bw.GAMEPAD_INPUT,m))}}},e._getWebGamePads=function(){return"function"==typeof navigator.getGamepads?navigator.getGamepads():"function"==typeof navigator.webkitGetGamepads?navigator.webkitGetGamepads():[]},e._getWebGamepad=function(t){for(var i=e._getWebGamePads(),n=0;n<i.length;++n){var r=i[n];if(r&&r.index===t)return r}};var t=e.prototype;return t._axisToButtons=function(e){var t=Math.abs(e);return e>0?{negative:0,positive:t}:e<0?{negative:t,positive:0}:{negative:0,positive:0}},t._initInputSource=function(){var t=this;this._buttonNorth=new Zw,this._buttonNorth.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[3].value:0},this._buttonEast=new Zw,this._buttonEast.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[1].value:0},this._buttonWest=new Zw,this._buttonWest.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[2].value:0},this._buttonSouth=new Zw,this._buttonSouth.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[0].value:0},this._buttonL1=new Zw,this._buttonL1.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[4].value:0},this._buttonL2=new Zw,this._buttonL2.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[6].value:0},this._buttonL3=new Zw,this._buttonL3.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[10].value:0},this._buttonR1=new Zw,this._buttonR1.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[5].value:0},this._buttonR2=new Zw,this._buttonR2.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[7].value:0},this._buttonR3=new Zw,this._buttonR3.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[11].value:0},this._buttonShare=new Zw,this._buttonShare.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[8].value:0},this._buttonOptions=new Zw,this._buttonOptions.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[9].value:0};var i=new Zw;i.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[12].value:0};var n=new Zw;n.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[13].value:0};var r=new Zw;r.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[14].value:0};var s=new Zw;s.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?i.buttons[15].value:0},this._dpad=new Jw({up:i,down:n,left:r,right:s});var a=new Zw;a.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[1]).negative:0};var o=new Zw;o.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[1]).positive:0};var u=new Zw;u.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[0]).negative:0};var h=new Zw;h.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[0]).positive:0},this._leftStick=new $w({up:a,down:o,left:u,right:h});var c=new Zw;c.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[3]).negative:0};var l=new Zw;l.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[3]).positive:0};var _=new Zw;_.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[2]).negative:0};var d=new Zw;d.getValue=function(){var i=e._getWebGamepad(t.deviceId);return i?t._axisToButtons(i.axes[2]).positive:0},this._rightStick=new $w({up:c,down:l,left:_,right:d}),this._buttonStart=new Zw,this._buttonStart.getValue=function(){return 0}},n(e,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonL1",get:function(){return this._buttonL1}},{key:"buttonL2",get:function(){return this._buttonL2}},{key:"buttonL3",get:function(){return this._buttonL3}},{key:"buttonR1",get:function(){return this._buttonR1}},{key:"buttonR2",get:function(){return this._buttonR2}},{key:"buttonR3",get:function(){return this._buttonR3}},{key:"buttonShare",get:function(){return this._buttonShare}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"dpad",get:function(){return this._dpad}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"deviceId",get:function(){return this._deviceId}},{key:"connected",get:function(){return this._connected}}]),e}();iI.all=[],iI._eventTarget=new kh,iI._cachedWebGamepads=[],iI._intervalId=-1,function(e){e[e.BUTTON_EAST=0]="BUTTON_EAST",e[e.BUTTON_SOUTH=1]="BUTTON_SOUTH",e[e.BUTTON_WEST=2]="BUTTON_WEST",e[e.BUTTON_NORTH=3]="BUTTON_NORTH",e[e.BUTTON_TRIGGER_LEFT=4]="BUTTON_TRIGGER_LEFT",e[e.BUTTON_TRIGGER_RIGHT=5]="BUTTON_TRIGGER_RIGHT",e[e.TRIGGER_LEFT=6]="TRIGGER_LEFT",e[e.TRIGGER_RIGHT=7]="TRIGGER_RIGHT",e[e.GRIP_LEFT=8]="GRIP_LEFT",e[e.GRIP_RIGHT=9]="GRIP_RIGHT",e[e.BUTTON_LEFT_STICK=10]="BUTTON_LEFT_STICK",e[e.LEFT_STICK_UP=11]="LEFT_STICK_UP",e[e.LEFT_STICK_DOWN=12]="LEFT_STICK_DOWN",e[e.LEFT_STICK_LEFT=13]="LEFT_STICK_LEFT",e[e.LEFT_STICK_RIGHT=14]="LEFT_STICK_RIGHT",e[e.BUTTON_RIGHT_STICK=15]="BUTTON_RIGHT_STICK",e[e.RIGHT_STICK_UP=16]="RIGHT_STICK_UP",e[e.RIGHT_STICK_DOWN=17]="RIGHT_STICK_DOWN",e[e.RIGHT_STICK_LEFT=18]="RIGHT_STICK_LEFT",e[e.RIGHT_STICK_RIGHT=19]="RIGHT_STICK_RIGHT",e[e.ROKID_MENU=20]="ROKID_MENU",e[e.ROKID_START=21]="ROKID_START"}(kw||(kw={})),function(e){e[e.KET_CLICK=0]="KET_CLICK",e[e.KET_STICK=1]="KET_STICK",e[e.KET_GRAB=2]="KET_GRAB"}(Hw||(Hw={})),function(e){e[e.UNDEFINE=0]="UNDEFINE",e[e.X=1]="X",e[e.Y=2]="Y",e[e.LEFT_STICK_X=3]="LEFT_STICK_X",e[e.LEFT_STICK_Y=4]="LEFT_STICK_Y",e[e.RIGHT_STICK_X=5]="RIGHT_STICK_X",e[e.RIGHT_STICK_Y=6]="RIGHT_STICK_Y",e[e.LEFT_TRIGGER=7]="LEFT_TRIGGER",e[e.RIGHT_TIRGGER=8]="RIGHT_TIRGGER",e[e.LEFT_GRIP=9]="LEFT_GRIP",e[e.RIGHT_GRIP=10]="RIGHT_GRIP"}(zw||(zw={}));var nI,rI,sI={1:kw.BUTTON_EAST,2:kw.BUTTON_SOUTH,3:kw.BUTTON_NORTH,4:kw.BUTTON_WEST,9:kw.BUTTON_LEFT_STICK,10:kw.BUTTON_RIGHT_STICK,11:kw.ROKID_MENU,12:kw.ROKID_START,13:kw.BUTTON_TRIGGER_LEFT,14:kw.BUTTON_TRIGGER_RIGHT},aI=function(){function e(){var e,t=this;this._eventTarget=new kh,this._nativeButtonState=((e={})[kw.BUTTON_SOUTH]=0,e[kw.BUTTON_EAST]=0,e[kw.BUTTON_WEST]=0,e[kw.BUTTON_NORTH]=0,e[kw.BUTTON_TRIGGER_LEFT]=0,e[kw.BUTTON_TRIGGER_RIGHT]=0,e[kw.TRIGGER_LEFT]=0,e[kw.TRIGGER_RIGHT]=0,e[kw.GRIP_LEFT]=0,e[kw.GRIP_RIGHT]=0,e[kw.LEFT_STICK_UP]=0,e[kw.LEFT_STICK_DOWN]=0,e[kw.LEFT_STICK_LEFT]=0,e[kw.LEFT_STICK_RIGHT]=0,e[kw.RIGHT_STICK_UP]=0,e[kw.RIGHT_STICK_DOWN]=0,e[kw.RIGHT_STICK_LEFT]=0,e[kw.RIGHT_STICK_RIGHT]=0,e[kw.BUTTON_LEFT_STICK]=0,e[kw.BUTTON_RIGHT_STICK]=0,e[kw.ROKID_MENU]=0,e[kw.ROKID_START]=0,e),this._initInputSource(),window.addEventListener("xr-remote-input",(function(e){var i=e,n=i.detail.keyEventType,r=i.detail.stickAxisCode,s=i.detail.stickAxisValue,a=i.detail.stickKeyCode,o=i.detail.isButtonPressed;if(n===Hw.KET_CLICK){var u=sI[a];t._nativeButtonState[u]=o?1:0}else if(n===Hw.KET_STICK||n===Hw.KET_GRAB){var h,c,l;switch(r){case zw.LEFT_STICK_X:h=kw.LEFT_STICK_LEFT,c=kw.LEFT_STICK_RIGHT,l=t._axisToButtons(s);break;case zw.LEFT_STICK_Y:h=kw.LEFT_STICK_DOWN,c=kw.LEFT_STICK_UP,l=t._axisToButtons(s);break;case zw.RIGHT_STICK_X:h=kw.RIGHT_STICK_LEFT,c=kw.RIGHT_STICK_RIGHT,l=t._axisToButtons(s);break;case zw.RIGHT_STICK_Y:h=kw.RIGHT_STICK_DOWN,c=kw.RIGHT_STICK_UP,l=t._axisToButtons(s);break;case zw.LEFT_TRIGGER:t._nativeButtonState[kw.TRIGGER_LEFT]=s;break;case zw.RIGHT_TIRGGER:t._nativeButtonState[kw.TRIGGER_RIGHT]=s;break;case zw.LEFT_GRIP:t._nativeButtonState[kw.GRIP_LEFT]=s;break;case zw.RIGHT_GRIP:t._nativeButtonState[kw.GRIP_RIGHT]=s}h&&c&&l&&(t._nativeButtonState[h]=l.negative,t._nativeButtonState[c]=l.positive)}t._eventTarget.emit(bw.HANDLE_INPUT,new Fw(bw.HANDLE_INPUT,t))}))}var t=e.prototype;return t._axisToButtons=function(e){var t=Math.abs(e);return e>0?{negative:0,positive:t}:e<0?{negative:t,positive:0}:{negative:0,positive:0}},t._on=function(e,t,i){this._eventTarget.on(e,t,i)},t._initInputSource=function(){var e=this;this._buttonNorth=new Zw,this._buttonNorth.getValue=function(){return e._nativeButtonState[kw.BUTTON_NORTH]},this._buttonEast=new Zw,this._buttonEast.getValue=function(){return e._nativeButtonState[kw.BUTTON_EAST]},this._buttonWest=new Zw,this._buttonWest.getValue=function(){return e._nativeButtonState[kw.BUTTON_WEST]},this._buttonSouth=new Zw,this._buttonSouth.getValue=function(){return e._nativeButtonState[kw.BUTTON_SOUTH]},this._buttonTriggerLeft=new Zw,this._buttonTriggerLeft.getValue=function(){return e._nativeButtonState[kw.BUTTON_TRIGGER_LEFT]},this._buttonTriggerRight=new Zw,this._buttonTriggerRight.getValue=function(){return e._nativeButtonState[kw.BUTTON_TRIGGER_RIGHT]},this._triggerLeft=new Zw,this._triggerLeft.getValue=function(){return e._nativeButtonState[kw.TRIGGER_LEFT]},this._triggerRight=new Zw,this._triggerRight.getValue=function(){return e._nativeButtonState[kw.TRIGGER_RIGHT]},this._gripLeft=new Zw,this._gripLeft.getValue=function(){return e._nativeButtonState[kw.GRIP_LEFT]},this._gripRight=new Zw,this._gripRight.getValue=function(){return e._nativeButtonState[kw.GRIP_RIGHT]},this._buttonLeftStick=new Zw,this._buttonLeftStick.getValue=function(){return e._nativeButtonState[kw.BUTTON_LEFT_STICK]};var t=new Zw;t.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_UP]};var i=new Zw;i.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_DOWN]};var n=new Zw;n.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_LEFT]};var r=new Zw;r.getValue=function(){return e._nativeButtonState[kw.LEFT_STICK_RIGHT]},this._leftStick=new $w({up:t,down:i,left:n,right:r}),this._buttonRightStick=new Zw,this._buttonRightStick.getValue=function(){return e._nativeButtonState[kw.BUTTON_RIGHT_STICK]};var s=new Zw;s.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_UP]};var a=new Zw;a.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_DOWN]};var o=new Zw;o.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_LEFT]};var u=new Zw;u.getValue=function(){return e._nativeButtonState[kw.RIGHT_STICK_RIGHT]},this._rightStick=new $w({up:s,down:a,left:o,right:u}),this._buttonOptions=new Zw,this._buttonOptions.getValue=function(){return e._nativeButtonState[kw.ROKID_MENU]},this._buttonStart=new Zw,this._buttonStart.getValue=function(){return e._nativeButtonState[kw.ROKID_START]},this._handLeftPosition=new tI,this._handLeftPosition.getValue=function(){return Ki.ZERO},this._handLeftOrientation=new eI,this._handLeftOrientation.getValue=function(){return _n.IDENTITY},this._handRightPosition=new tI,this._handRightPosition.getValue=function(){return Ki.ZERO},this._handRightOrientation=new eI,this._handRightOrientation.getValue=function(){return _n.IDENTITY},this._aimLeftPosition=new tI,this._aimLeftPosition.getValue=function(){return Ki.ZERO},this._aimLeftOrientation=new eI,this._aimLeftOrientation.getValue=function(){return _n.IDENTITY},this._aimRightPosition=new tI,this._aimRightPosition.getValue=function(){return Ki.ZERO},this._aimRightOrientation=new eI,this._aimRightOrientation.getValue=function(){return _n.IDENTITY}},n(e,[{key:"buttonNorth",get:function(){return this._buttonNorth}},{key:"buttonEast",get:function(){return this._buttonEast}},{key:"buttonWest",get:function(){return this._buttonWest}},{key:"buttonSouth",get:function(){return this._buttonSouth}},{key:"buttonTriggerLeft",get:function(){return this._buttonTriggerLeft}},{key:"buttonTriggerRight",get:function(){return this._buttonTriggerRight}},{key:"triggerLeft",get:function(){return this._triggerLeft}},{key:"triggerRight",get:function(){return this._triggerRight}},{key:"gripLeft",get:function(){return this._gripLeft}},{key:"gripRight",get:function(){return this._gripRight}},{key:"leftStick",get:function(){return this._leftStick}},{key:"rightStick",get:function(){return this._rightStick}},{key:"buttonLeftStick",get:function(){return this._buttonLeftStick}},{key:"buttonRightStick",get:function(){return this._buttonRightStick}},{key:"buttonOptions",get:function(){return this._buttonOptions}},{key:"buttonStart",get:function(){return this._buttonStart}},{key:"handLeftPosition",get:function(){return this._handLeftPosition}},{key:"handLeftOrientation",get:function(){return this._handLeftOrientation}},{key:"handRightPosition",get:function(){return this._handRightPosition}},{key:"handRightOrientation",get:function(){return this._handRightOrientation}},{key:"aimLeftPosition",get:function(){return this._aimLeftPosition}},{key:"aimLeftOrientation",get:function(){return this._aimLeftOrientation}},{key:"aimRightPosition",get:function(){return this._aimRightPosition}},{key:"aimRightOrientation",get:function(){return this._aimRightOrientation}}]),e}(),oI=function(){function e(){this._eventTarget=new kh,this._initInputSource()}var t=e.prototype;return t._on=function(e,t,i){this._eventTarget.on(e,t,i)},t._initInputSource=function(){this._viewLeftPosition=new tI,this._viewLeftPosition.getValue=function(){return Ki.ZERO},this._viewLeftOrientation=new eI,this._viewLeftOrientation.getValue=function(){return _n.IDENTITY},this._viewRightPosition=new tI,this._viewRightPosition.getValue=function(){return Ki.ZERO},this._viewRightOrientation=new eI,this._viewRightOrientation.getValue=function(){return _n.IDENTITY},this._headMiddlePosition=new tI,this._headMiddlePosition.getValue=function(){return Ki.ZERO},this._headMiddleOrientation=new eI,this._headMiddleOrientation.getValue=function(){return _n.IDENTITY}},n(e,[{key:"viewLeftPosition",get:function(){return this._viewLeftPosition}},{key:"viewLeftOrientation",get:function(){return this._viewLeftOrientation}},{key:"viewRightPosition",get:function(){return this._viewRightPosition}},{key:"viewRightOrientation",get:function(){return this._viewRightOrientation}},{key:"headMiddlePosition",get:function(){return this._headMiddlePosition}},{key:"headMiddleOrientation",get:function(){return this._headMiddleOrientation}}]),e}(),uI=function(){function e(){this._eventTarget=new kh,this._initInputSource()}var t=e.prototype;return t._on=function(e,t,i){this._eventTarget.on(e,t,i)},t._initInputSource=function(){this._handheldPosition=new tI,this._handheldPosition.getValue=function(){return Ki.ZERO},this._handheldOrientation=new eI,this._handheldOrientation.getValue=function(){return _n.IDENTITY}},n(e,[{key:"handheldPosition",get:function(){return this._handheldPosition}},{key:"handheldOrientation",get:function(){return this._handheldOrientation}}]),e}(),hI={Backspace:xw.BACKSPACE,Tab:xw.TAB,Enter:xw.ENTER,ShiftLeft:xw.SHIFT_LEFT,ControlLeft:xw.CTRL_LEFT,AltLeft:xw.ALT_LEFT,ShiftRight:xw.SHIFT_RIGHT,ControlRight:xw.CTRL_RIGHT,AltRight:xw.ALT_RIGHT,Pause:xw.PAUSE,CapsLock:xw.CAPS_LOCK,Escape:xw.ESCAPE,Space:xw.SPACE,PageUp:xw.PAGE_UP,PageDown:xw.PAGE_DOWN,End:xw.END,Home:xw.HOME,ArrowLeft:xw.ARROW_LEFT,ArrowUp:xw.ARROW_UP,ArrowRight:xw.ARROW_RIGHT,ArrowDown:xw.ARROW_DOWN,Insert:xw.INSERT,Delete:xw.DELETE,Digit0:xw.DIGIT_0,Digit1:xw.DIGIT_1,Digit2:xw.DIGIT_2,Digit3:xw.DIGIT_3,Digit4:xw.DIGIT_4,Digit5:xw.DIGIT_5,Digit6:xw.DIGIT_6,Digit7:xw.DIGIT_7,Digit8:xw.DIGIT_8,Digit9:xw.DIGIT_9,KeyA:xw.KEY_A,KeyB:xw.KEY_B,KeyC:xw.KEY_C,KeyD:xw.KEY_D,KeyE:xw.KEY_E,KeyF:xw.KEY_F,KeyG:xw.KEY_G,KeyH:xw.KEY_H,KeyI:xw.KEY_I,KeyJ:xw.KEY_J,KeyK:xw.KEY_K,KeyL:xw.KEY_L,KeyM:xw.KEY_M,KeyN:xw.KEY_N,KeyO:xw.KEY_O,KeyP:xw.KEY_P,KeyQ:xw.KEY_Q,KeyR:xw.KEY_R,KeyS:xw.KEY_S,KeyT:xw.KEY_T,KeyU:xw.KEY_U,KeyV:xw.KEY_V,KeyW:xw.KEY_W,KeyX:xw.KEY_X,KeyY:xw.KEY_Y,KeyZ:xw.KEY_Z,Numpad0:xw.NUM_0,Numpad1:xw.NUM_1,Numpad2:xw.NUM_2,Numpad3:xw.NUM_3,Numpad4:xw.NUM_4,Numpad5:xw.NUM_5,Numpad6:xw.NUM_6,Numpad7:xw.NUM_7,Numpad8:xw.NUM_8,Numpad9:xw.NUM_9,NumpadMultiply:xw.NUM_MULTIPLY,NumpadAdd:xw.NUM_PLUS,NumpadSubtract:xw.NUM_SUBTRACT,NumpadDecimal:xw.NUM_DECIMAL,NumpadDivide:xw.NUM_DIVIDE,NumpadEnter:xw.NUM_ENTER,F1:xw.F1,F2:xw.F2,F3:xw.F3,F4:xw.F4,F5:xw.F5,F6:xw.F6,F7:xw.F7,F8:xw.F8,F9:xw.F9,F10:xw.F10,F11:xw.F11,F12:xw.F12,NumLock:xw.NUM_LOCK,ScrollLock:xw.SCROLL_LOCK,Semicolon:xw.SEMICOLON,Equal:xw.EQUAL,Comma:xw.COMMA,Minus:xw.DASH,Period:xw.PERIOD,Slash:xw.SLASH,Backquote:xw.BACK_QUOTE,BracketLeft:xw.BRACKET_LEFT,Backslash:xw.BACKSLASH,BracketRight:xw.BRACKET_RIGHT,Quote:xw.QUOTE},cI=function(){function e(){this._eventTarget=new kh,this._registerEvent()}var t=e.prototype;return t.dispatchKeyboardDownEvent=function(e){this._handleKeyboardDown(e)},t.dispatchKeyboardUpEvent=function(e){this._handleKeyboardUp(e)},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},t._registerEvent=function(){var e=document.getElementById("GameCanvas");null==e||e.addEventListener("keydown",this._handleKeyboardDown.bind(this)),null==e||e.addEventListener("keyup",this._handleKeyboardUp.bind(this))},t._getInputEvent=function(e,t){var i,n=(i=e.code,hI[i]||xw.NONE);return new Cw(n,t)},t._handleKeyboardDown=function(e){if(e.stopPropagation(),e.preventDefault(),e.repeat){var t=this._getInputEvent(e,bw.KEY_PRESSING);this._eventTarget.emit(bw.KEY_PRESSING,t)}else{var i=this._getInputEvent(e,bw.KEY_DOWN);this._eventTarget.emit(bw.KEY_DOWN,i)}},t._handleKeyboardUp=function(e){var t=this._getInputEvent(e,bw.KEY_UP);e.stopPropagation(),e.preventDefault(),this._eventTarget.emit(bw.KEY_UP,t)},e}(),lI=function(){function e(){this._canvas=void 0,this._eventTarget=new kh,this._pointLocked=!1,this._isPressed=!1,this._preMousePos=new Rn,this._handleMouseDown=void 0,this._handleMouseMove=void 0,this._handleMouseUp=void 0,qh.hasFeature(Xh.EVENT_MOUSE)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||m||console.warn("failed to access canvas"),this._handleMouseDown=this._createCallback(bw.MOUSE_DOWN),this._handleMouseMove=this._createCallback(bw.MOUSE_MOVE),this._handleMouseUp=this._createCallback(bw.MOUSE_UP),this._registerEvent())}var t=e.prototype;return t.dispatchMouseDownEvent=function(e){this._handleMouseDown(e)},t.dispatchMouseMoveEvent=function(e){this._handleMouseMove(e)},t.dispatchMouseUpEvent=function(e){this._handleMouseUp(e)},t.dispatchScrollEvent=function(e){this._handleMouseWheel(e)},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},t._getCanvasRect=function(){var e=this._canvas,t=null==e?void 0:e.getBoundingClientRect();return t?new Pn(t.x,t.y,t.width,t.height):new Pn(0,0,0,0)},t._getLocation=function(e){var t=this._getCanvasRect(),i=gc.devicePixelRatio,n=this._pointLocked?this._preMousePos.x/i+e.movementX:e.clientX-t.x,r=this._pointLocked?this._preMousePos.y/i-e.movementY:t.y+t.height-e.clientY;return new Rn(n*=i,r*=i)},t._registerEvent=function(){var e,t,i,n,r=this;window.addEventListener("mousedown",(function(){r._isPressed=!0})),null===(e=this._canvas)||void 0===e||e.addEventListener("mousedown",this._handleMouseDown),null===(t=this._canvas)||void 0===t||t.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp),null===(i=this._canvas)||void 0===i||i.addEventListener("mouseup",this._handleMouseUp),null===(n=this._canvas)||void 0===n||n.addEventListener("wheel",this._handleMouseWheel.bind(this)),this._registerPointerLockEvent()},t._registerPointerLockEvent=function(){var e=this,t=function(){var t=e._canvas;document.pointerLockElement===t||document.mozPointerLockElement===t?e._pointLocked=!0:e._pointLocked=!1};"onpointerlockchange"in document?document.addEventListener("pointerlockchange",t,!1):"onmozpointerlockchange"in document&&document.addEventListener("mozpointerlockchange",t,!1)},t._createCallback=function(e){var t=this;return function(i){var n,r=t._getLocation(i),s=i.button,a=i.buttons,o=s;switch(e){case bw.MOUSE_DOWN:null===(n=t._canvas)||void 0===n||n.focus(),t._isPressed=!0;break;case bw.MOUSE_UP:t._isPressed=!1;break;case bw.MOUSE_MOVE:o=1&a?Mw.BUTTON_LEFT:2&a?Mw.BUTTON_RIGHT:4&a?Mw.BUTTON_MIDDLE:Mw.BUTTON_MISSING}var u=new Mw(e,!1,t._preMousePos);u.setLocation(r.x,r.y),u.setButton(o),u.movementX=i.movementX,u.movementY=i.movementY,t._preMousePos.set(r.x,r.y),i.stopPropagation(),i.target===t._canvas&&i.preventDefault(),t._eventTarget.emit(e,u)}},t._handleMouseWheel=function(e){var t=bw.MOUSE_WHEEL,i=this._getLocation(e),n=e.button,r=new Mw(t,!1,this._preMousePos);r.setLocation(i.x,i.y),r.setButton(n),r.movementX=e.movementX,r.movementY=e.movementY,r.setScrollData(5*e.deltaX,5*-e.deltaY),this._preMousePos.set(i.x,i.y),e.stopPropagation(),e.target===this._canvas&&e.preventDefault(),this._eventTarget.emit(t,r)},e}(),_I=new Rn,dI=new(function(){function e(){this._touchMap=void 0,this._maxTouches=8,this._touchMap=new Map}var t=e.prototype;return t._cloneTouch=function(e){var t=e.getID();e.getStartLocation(_I);var i=new Gw(_I.x,_I.y,t);return e.getLocation(_I),i.setPoint(_I.x,_I.y),e.getPreviousLocation(_I),i.setPrevPoint(_I),i},t._createTouch=function(e,t,i){if(this._touchMap.has(e))console.log("Cannot create the same touch object.");else{if(!this._checkTouchMapSizeMoreThanMax(e)){var n=new Gw(t,i,e);return this._touchMap.set(e,n),this._updateTouch(n,t,i),this._cloneTouch(n)}console.log("The touches is more than MAX_TOUCHES.")}},t.releaseTouch=function(e){this._touchMap.has(e)&&this._touchMap.delete(e)},t.getTouch=function(e,t,i){var n=this._touchMap.get(e);return n?this._updateTouch(n,t,i):n=this._createTouch(e,t,i),n?this._cloneTouch(n):void 0},t.getAllTouches=function(){var e=this,t=[];return this._touchMap.forEach((function(i){if(i){var n=e._cloneTouch(i);t.push(n)}})),t},t._updateTouch=function(e,t,i){e.getLocation(_I),e.setPrevPoint(_I),e.setPoint(t,i)},t._checkTouchMapSizeMoreThanMax=function(e){var t=this;if(this._touchMap.has(e))return!1;var i=Rt.ENABLE_MULTI_TOUCH?this._maxTouches:1;if(this._touchMap.size<i)return!1;var n=performance.now();return this._touchMap.forEach((function(e){n-e.lastModified>Rt.TOUCH_TIMEOUT&&(console.log("The touches is more than MAX_TOUCHES, release touch id "+e.getID()+"."),t.releaseTouch(e.getID()))})),i>=this._touchMap.size},e}()),fI=function(){function e(){this._canvas=void 0,this._eventTarget=new kh,qh.hasFeature(Xh.INPUT_TOUCH)&&(this._canvas=document.getElementById("GameCanvas"),this._canvas||m||console.warn("failed to access canvas"),this._registerEvent())}var t=e.prototype;return t._registerEvent=function(){var e,t,i,n;null===(e=this._canvas)||void 0===e||e.addEventListener("touchstart",this._createCallback(bw.TOUCH_START)),null===(t=this._canvas)||void 0===t||t.addEventListener("touchmove",this._createCallback(bw.TOUCH_MOVE)),null===(i=this._canvas)||void 0===i||i.addEventListener("touchend",this._createCallback(bw.TOUCH_END)),null===(n=this._canvas)||void 0===n||n.addEventListener("touchcancel",this._createCallback(bw.TOUCH_CANCEL))},t._createCallback=function(e){var t=this;return function(i){for(var n,r=t._getCanvasRect(),s=[],a=i.changedTouches.length,o=0;o<a;++o){var u=i.changedTouches[o],h=u.identifier;if(null!==h){var c=t._getLocation(u,r),l=dI.getTouch(h,c.x,c.y);l&&(e!==bw.TOUCH_END&&e!==bw.TOUCH_CANCEL||dI.releaseTouch(h),s.push(l))}}if(i.stopPropagation(),i.target===t._canvas&&i.preventDefault(),e===bw.TOUCH_START&&(null===(n=t._canvas)||void 0===n||n.focus()),s.length>0){var _=new Lw(s,!1,e,Rt.ENABLE_MULTI_TOUCH?dI.getAllTouches():s);t._eventTarget.emit(e,_)}}},t._getCanvasRect=function(){var e=this._canvas,t=null==e?void 0:e.getBoundingClientRect();return t?new Pn(t.x,t.y,t.width,t.height):new Pn(0,0,0,0)},t._getLocation=function(e,t){if(globalThis.__globalXR.ar&&globalThis.__globalXR.ar.isWebXR())return new Rn(e.clientX,e.clientY);var i=e.clientX-t.x,n=t.y+t.height-e.clientY;if(gc.isFrameRotated){var r=i;i=t.height-n,n=r}var s=gc.devicePixelRatio;return new Rn(i*=s,n*=s)},t.on=function(e,t,i){this._eventTarget.on(e,t,i)},e}();!function(e){e[e.GLOBAL=0]="GLOBAL",e[e.UI=1]="UI"}(rI||(rI=e("d$",{})));var pI=function(){function e(e){this.priority=rI.GLOBAL,this._inputEventTarget=void 0,this._inputEventTarget=e}return e.prototype.dispatchEvent=function(e){return this._inputEventTarget.emit(e.type,e),!0},e}(),mI=((nI={})[bw.MOUSE_DOWN]=bw.TOUCH_START,nI[bw.MOUSE_MOVE]=bw.TOUCH_MOVE,nI[bw.MOUSE_UP]=bw.TOUCH_END,nI),gI=e("d_",function(){function e(){this._dispatchImmediately=!0,this._eventTarget=new kh,this._touchInput=new fI,this._mouseInput=new lI,this._keyboardInput=new cI,this._accelerometerInput=new Vw,this._handleInput=new aI,this._hmdInput=new oI,this._handheldInput=new uI,this._eventTouchList=[],this._eventMouseList=[],this._eventKeyboardList=[],this._eventAccelerationList=[],this._eventGamepadList=[],this._eventHandleList=[],this._eventHMDList=[],this._eventHandheldList=[],this._needSimulateTouchMoveEvent=!1,this._inputEventDispatcher=void 0,this._eventDispatcherList=[],this._registerEvent(),this._inputEventDispatcher=new pI(this._eventTarget),this._registerEventDispatcher(this._inputEventDispatcher),iI._init()}var t=e.prototype;return t._dispatchMouseDownEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchMouseDownEvent)||void 0===t||t.call(i,e)},t._dispatchMouseMoveEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchMouseMoveEvent)||void 0===t||t.call(i,e)},t._dispatchMouseUpEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchMouseUpEvent)||void 0===t||t.call(i,e)},t._dispatchMouseScrollEvent=function(e){var t,i;null===(t=(i=this._mouseInput).dispatchScrollEvent)||void 0===t||t.call(i,e)},t._dispatchKeyboardDownEvent=function(e){var t,i;null===(t=(i=this._keyboardInput).dispatchKeyboardDownEvent)||void 0===t||t.call(i,e)},t._dispatchKeyboardUpEvent=function(e){var t,i;null===(t=(i=this._keyboardInput).dispatchKeyboardUpEvent)||void 0===t||t.call(i,e)},t.on=function(e,t,i){return this._eventTarget.on(e,t,i),t},t.once=function(e,t,i){return this._eventTarget.once(e,t,i),t},t.off=function(e,t,i){this._eventTarget.off(e,t,i)},t.setAccelerometerEnabled=function(e){e?this._accelerometerInput.start():this._accelerometerInput.stop()},t.setAccelerometerInterval=function(e){this._accelerometerInput.setInterval(e)},t._simulateEventTouch=function(e){var t=mI[e.type],i=dI.getTouch(0,e.getLocationX(),e.getLocationY());if(i){var n=[i],r=new Lw(n,!1,t,t===bw.TOUCH_END?[]:n);r.windowId=e.windowId,t===bw.TOUCH_END&&dI.releaseTouch(0),this._dispatchOrPushEventTouch(r,this._eventTouchList)}},t._registerEventDispatcher=function(e){this._eventDispatcherList.push(e),this._eventDispatcherList.sort((function(e,t){return t.priority-e.priority}))},t._emitEvent=function(e){for(var t=this._eventDispatcherList.length,i=0;i<t;++i){var n=this._eventDispatcherList[i];try{if(!n.dispatchEvent(e))break}catch(t){console.error("Error occurs in an event listener: "+e.type),console.error(t)}}},t._registerEvent=function(){var e=this;if(Ec.hasFeature(Ec.Feature.INPUT_TOUCH)){var t=this._eventTouchList;this._touchInput.on(bw.TOUCH_START,(function(i){e._dispatchOrPushEventTouch(i,t)})),this._touchInput.on(bw.TOUCH_MOVE,(function(i){e._dispatchOrPushEventTouch(i,t)})),this._touchInput.on(bw.TOUCH_END,(function(i){e._dispatchOrPushEventTouch(i,t)})),this._touchInput.on(bw.TOUCH_CANCEL,(function(i){e._dispatchOrPushEventTouch(i,t)}))}if(Ec.hasFeature(Ec.Feature.EVENT_MOUSE)){var i=this._eventMouseList;this._mouseInput.on(bw.MOUSE_DOWN,(function(t){e._needSimulateTouchMoveEvent=!0,e._simulateEventTouch(t),e._dispatchOrPushEvent(t,i)})),this._mouseInput.on(bw.MOUSE_MOVE,(function(t){e._needSimulateTouchMoveEvent&&e._simulateEventTouch(t),e._dispatchOrPushEvent(t,i)})),this._mouseInput.on(bw.MOUSE_UP,(function(t){e._needSimulateTouchMoveEvent=!1,e._simulateEventTouch(t),e._dispatchOrPushEvent(t,i)})),this._mouseInput.on(bw.MOUSE_WHEEL,(function(t){e._dispatchOrPushEvent(t,i)}))}if(Ec.hasFeature(Ec.Feature.EVENT_KEYBOARD)){var n=this._eventKeyboardList;this._keyboardInput.on(bw.KEY_DOWN,(function(t){e._dispatchOrPushEvent(t,n)})),this._keyboardInput.on(bw.KEY_PRESSING,(function(t){e._dispatchOrPushEvent(t,n)})),this._keyboardInput.on(bw.KEY_UP,(function(t){e._dispatchOrPushEvent(t,n)}))}if(Ec.hasFeature(Ec.Feature.EVENT_ACCELEROMETER)){var r=this._eventAccelerationList;this._accelerometerInput.on(bw.DEVICEMOTION,(function(t){e._dispatchOrPushEvent(t,r)}))}if(Ec.hasFeature(Ec.Feature.EVENT_GAMEPAD)){var s=this._eventGamepadList;iI._on(bw.GAMEPAD_CHANGE,(function(t){e._dispatchOrPushEvent(t,s)})),iI._on(bw.GAMEPAD_INPUT,(function(t){e._dispatchOrPushEvent(t,s)}))}if(Ec.hasFeature(Ec.Feature.EVENT_HANDLE)){var a=this._eventHandleList;this._handleInput._on(bw.HANDLE_INPUT,(function(t){e._dispatchOrPushEvent(t,a)})),this._handleInput._on(bw.HANDLE_POSE_INPUT,(function(t){e._dispatchOrPushEvent(t,a)}))}if(Ec.hasFeature(Ec.Feature.EVENT_HMD)){var o=this._eventHMDList;this._hmdInput._on(bw.HMD_POSE_INPUT,(function(t){e._dispatchOrPushEvent(t,o)}))}if(Ec.hasFeature(Ec.Feature.EVENT_HANDHELD)){var u=this._eventHandheldList;this._handheldInput._on(bw.HANDHELD_POSE_INPUT,(function(t){e._dispatchOrPushEvent(t,u)}))}},t._clearEvents=function(){this._eventMouseList.length=0,this._eventTouchList.length=0,this._eventKeyboardList.length=0,this._eventAccelerationList.length=0,this._eventGamepadList.length=0,this._eventHandleList.length=0,this._eventHMDList.length=0},t._dispatchOrPushEvent=function(e,t){this._dispatchImmediately?this._emitEvent(e):t.push(e)},t._dispatchOrPushEventTouch=function(e,t){if(this._dispatchImmediately)for(var i=e.getTouches(),n=i.length,r=0;r<n;++r)e.touch=i[r],e.propagationStopped=e.propagationImmediateStopped=!1,this._emitEvent(e);else t.push(e)},t._frameDispatchEvents=function(){for(var e=this._eventHMDList,t=0,i=e.length;t<i;++t){var n=e[t];this._emitEvent(n)}for(var r=this._eventHandheldList,s=0,a=r.length;s<a;++s){var o=r[s];this._emitEvent(o)}for(var u=this._eventMouseList,h=0,c=u.length;h<c;++h){var l=u[h];this._emitEvent(l)}for(var _=this._eventTouchList,d=0,f=_.length;d<f;++d)for(var p=_[d],m=p.getTouches(),g=m.length,v=0;v<g;++v)p.touch=m[v],p.propagationStopped=p.propagationImmediateStopped=!1,this._emitEvent(p);for(var y=this._eventKeyboardList,E=0,T=y.length;E<T;++E){var A=y[E];this._emitEvent(A)}for(var S=this._eventAccelerationList,R=0,w=S.length;R<w;++R){var I=S[R];this._emitEvent(I)}for(var b=this._eventGamepadList,O=0,N=b.length;O<N;++O){var C=b[O];this._emitEvent(C)}for(var M=this._eventHandleList,P=0,L=M.length;P<L;++P){var x=M[P];this._emitEvent(x)}this._clearEvents()},e}());gI.EventType=bw;var vI=e("e0",new gI),yI=e("hL",function(e){function t(){var t;return t=e.call(this)||this,vI.on(bw.MOUSE_DOWN,(function(e){t.emit(Iw.MOUSE_DOWN,e)})),vI.on(bw.MOUSE_MOVE,(function(e){t.emit(Iw.MOUSE_MOVE,e)})),vI.on(bw.MOUSE_UP,(function(e){t.emit(Iw.MOUSE_UP,e)})),vI.on(bw.MOUSE_WHEEL,(function(e){t.emit(Iw.MOUSE_WHEEL,e)})),vI.on(bw.TOUCH_START,(function(e){t.emit(Iw.TOUCH_START,e.touch,e)})),vI.on(bw.TOUCH_MOVE,(function(e){t.emit(Iw.TOUCH_MOVE,e.touch,e)})),vI.on(bw.TOUCH_END,(function(e){t.emit(Iw.TOUCH_END,e.touch,e)})),vI.on(bw.TOUCH_CANCEL,(function(e){t.emit(Iw.TOUCH_CANCEL,e.touch,e)})),vI.on(bw.KEY_DOWN,(function(e){t.emit(Iw.KEY_DOWN,e)})),vI.on(bw.KEY_PRESSING,(function(e){t.emit(Iw.KEY_DOWN,e)})),vI.on(bw.KEY_UP,(function(e){t.emit(Iw.KEY_UP,e)})),vI.on(bw.DEVICEMOTION,(function(e){t.emit(Iw.DEVICEMOTION,e)})),t}s(t,e);var i=t.prototype;return i.setAccelerometerEnabled=function(e){vI.setAccelerometerEnabled(e)},i.setAccelerometerInterval=function(e){vI.setAccelerometerInterval(e)},i.on=function(t,i,n,r){return e.prototype.on.call(this,t,i,n,r),i},i.off=function(t,i,n){e.prototype.off.call(this,t,i,n)},t}(kh));yI.EventType=Iw,v.SystemEvent=yI;var EI,TI,AI,SI,RI,wI,II,bI,OI=e("hK",new yI);v.systemEvent=OI,re(Iw,"Node.EventType",[{name:"POSITION_PART",newName:"TRANSFORM_CHANGED"},{name:"ROTATION_PART",newName:"TRANSFORM_CHANGED"},{name:"SCALE_PART",newName:"TRANSFORM_CHANGED"}]),re(Ow,"Event",[{name:"ACCELERATION",newName:"DEVICEMOTION",target:yI.EventType,targetName:"SystemEvent.EventType"}]),ae(Ow,"Event",[{name:"TOUCH",suggest:"please use SystemEvent.EventType.TOUCH_START, SystemEvent.EventType.TOUCH_MOVE, SystemEvent.EventType.TOUCH_END and SystemEvent.EventType.TOUCH_CANCEL instead"},{name:"MOUSE",suggest:"please use SystemEvent.EventType.MOUSE_DOWN, SystemEvent.EventType.MOUSE_MOVE, SystemEvent.EventType.MOUSE_UP, SystemEvent.EventType.MOUSE_WHEEL, Node.EventType.MOUSE_ENTER and Node.EventType.MOUSE_LEAVE instead"},{name:"KEYBOARD",suggest:"please use SystemEvent.EventType.KEY_DOWN and SystemEvent.EventType.KEY_UP instead"}]),re(Mw,"EventMouse",["DOWN","UP","MOVE"].map((function(e){return{name:e,newName:"MOUSE_"+e,target:yI.EventType,targetName:"SystemEvent.EventType"}}))),re(Mw,"EventMouse",[{name:"SCROLL",newName:"MOUSE_WHEEL",target:yI.EventType,targetName:"SystemEvent.EventType"}]),ae(Mw.prototype,"EventMouse.prototype",[{name:"eventType",suggest:"please use EventMouse.prototype.type instead"}]),re(Lw,"EventTouch",[{name:"BEGAN",newName:"TOUCH_START",target:yI.EventType,targetName:"SystemEvent.EventType"}]),re(Lw,"EventTouch",[{name:"MOVED",newName:"TOUCH_MOVE",target:yI.EventType,targetName:"SystemEvent.EventType"}]),re(Lw,"EventTouch",[{name:"ENDED",newName:"TOUCH_END",target:yI.EventType,targetName:"SystemEvent.EventType"}]),re(Lw,"EventTouch",[{name:"CANCELLED",newName:"TOUCH_CANCEL",target:yI.EventType,targetName:"SystemEvent.EventType"}]),ae(Lw.prototype,"EventTouch.prototype",[{name:"getEventCode",suggest:"please use EventTouch.prototype.type instead"}]),re(Lw.prototype,"EventTouch.prototype",[{name:"getUILocationInView",newName:"getLocationInView",target:Lw,targetName:"EventTouch"}]),ae(Rt.KEY,"macro.KEY",["back","menu","0","1","2","3","4","5","6","7","8","9","0","*","+","-","/",";","=",",",".","[","]","dpadLeft","dpadRight","dpadUp","dpadDown","dpadCenter"].map((function(e){return{name:e}}))),ae(Rt.KEY,"macro.KEY",[{name:"shift",suggest:"please use KeyCode.SHIFT_LEFT instead"}]),ae(Rt.KEY,"macro.KEY",[{name:"ctrl",suggest:"please use KeyCode.CTRL_LEFT instead"}]),ae(Rt.KEY,"macro.KEY",[{name:"alt",suggest:"please use KeyCode.ALT_LEFT instead"}]),ae(Rt,"macro",[{name:"KEY",suggest:"please use KeyCode instead"}]),function(e){e[e.VERTICAL=0]="VERTICAL",e[e.HORIZONTAL=1]="HORIZONTAL"}(EI||(EI=e("bz",{}))),function(e){e[e.ORTHO=0]="ORTHO",e[e.PERSPECTIVE=1]="PERSPECTIVE"}(TI||(TI=e("bA",{}))),function(e){e[e.F1_8=0]="F1_8",e[e.F2_0=1]="F2_0",e[e.F2_2=2]="F2_2",e[e.F2_5=3]="F2_5",e[e.F2_8=4]="F2_8",e[e.F3_2=5]="F3_2",e[e.F3_5=6]="F3_5",e[e.F4_0=7]="F4_0",e[e.F4_5=8]="F4_5",e[e.F5_0=9]="F5_0",e[e.F5_6=10]="F5_6",e[e.F6_3=11]="F6_3",e[e.F7_1=12]="F7_1",e[e.F8_0=13]="F8_0",e[e.F9_0=14]="F9_0",e[e.F10_0=15]="F10_0",e[e.F11_0=16]="F11_0",e[e.F13_0=17]="F13_0",e[e.F14_0=18]="F14_0",e[e.F16_0=19]="F16_0",e[e.F18_0=20]="F18_0",e[e.F20_0=21]="F20_0",e[e.F22_0=22]="F22_0"}(AI||(AI=e("bB",{}))),function(e){e[e.ISO100=0]="ISO100",e[e.ISO200=1]="ISO200",e[e.ISO400=2]="ISO400",e[e.ISO800=3]="ISO800"}(SI||(SI=e("bC",{}))),function(e){e[e.D1=0]="D1",e[e.D2=1]="D2",e[e.D4=2]="D4",e[e.D8=3]="D8",e[e.D15=4]="D15",e[e.D30=5]="D30",e[e.D60=6]="D60",e[e.D125=7]="D125",e[e.D250=8]="D250",e[e.D500=9]="D500",e[e.D1000=10]="D1000",e[e.D2000=11]="D2000",e[e.D4000=12]="D4000"}(RI||(RI=e("bD",{}))),function(e){e[e.DEFAULT=-1]="DEFAULT",e[e.LEFT_EYE=0]="LEFT_EYE",e[e.RIGHT_EYE=1]="RIGHT_EYE",e[e.MAIN=2]="MAIN"}(wI||(wI=e("bE",{}))),function(e){e[e.NO_TRACKING=0]="NO_TRACKING",e[e.POSITION_AND_ROTATION=1]="POSITION_AND_ROTATION",e[e.POSITION=2]="POSITION",e[e.ROTATION=3]="ROTATION"}(II||(II=e("bF",{}))),function(e){e[e.EDITOR=0]="EDITOR",e[e.GAME_VIEW=1]="GAME_VIEW",e[e.SCENE_VIEW=2]="SCENE_VIEW",e[e.PREVIEW=3]="PREVIEW",e[e.GAME=100]="GAME"}(bI||(bI=e("bG",{})));var NI=[1.8,2,2.2,2.5,2.8,3.2,3.5,4,4.5,5,5.6,6.3,7.1,8,9,10,11,13,14,16,18,20,22],CI=[1,.5,1/4,1/8,1/15,1/30,1/60,.008,.004,.002,.001,5e-4,1/4e3],MI=[100,200,400,800],PI=new Ki,LI=new Ki,xI=new En,DI=e("bH",vl.STENCIL<<1),FI=[],BI=e("bI",function(){function e(e){if(this.isWindowSize=!0,this.screenScale=void 0,this._device=void 0,this._scene=null,this._node=null,this._name=null,this._enabled=!1,this._proj=-1,this._aspect=void 0,this._orthoHeight=10,this._fovAxis=EI.VERTICAL,this._fov=bi(45),this._nearClip=1,this._farClip=1e3,this._clearColor=new Dl(.2,.2,.2,1),this._viewport=new Pn(0,0,1,1),this._orientedViewport=new Pn(0,0,1,1),this._curTransform=xc.IDENTITY,this._isProjDirty=!0,this._matView=new En,this._matProj=new En,this._matProjInv=new En,this._matViewProj=new En,this._matViewProjInv=new En,this._frustum=new ys,this._forward=new Ki,this._position=new Ki,this._priority=0,this._aperture=AI.F16_0,this._apertureValue=void 0,this._shutter=RI.D125,this._shutterValue=0,this._iso=SI.ISO100,this._isoValue=0,this._window=null,this._width=1,this._height=1,this._clearFlag=vl.NONE,this._clearDepth=1,this._visibility=Sv,this._exposure=0,this._clearStencil=0,this._geometryRenderer=null,this._windowId=0,this._cameraType=wI.DEFAULT,this._trackingType=II.NO_TRACKING,this._usage=bI.GAME,this._device=e,this._apertureValue=NI[this._aperture],this._shutterValue=CI[this._shutter],this._isoValue=MI[this._iso],this._aspect=this.screenScale=1,this._frustum.accurate=!0,!FI.length){var t=e.capabilities.clipSpaceSignY;FI[xc.IDENTITY]=new En(1,0,0,0,0,t),FI[xc.ROTATE_90]=new En(0,1,0,0,-t,0),FI[xc.ROTATE_180]=new En(-1,0,0,0,0,-t),FI[xc.ROTATE_270]=new En(0,-1,0,0,t,0)}}var t=e.prototype;return t._updateAspect=function(e){if(void 0===e&&(e=!0),this._aspect=this.window.width*this._viewport.width/(this.window.height*this._viewport.height),e){var t=this.window.swapchain;(t&&t.surfaceTransform||xc.IDENTITY)%2&&(this._aspect=1/this._aspect)}this._isProjDirty=!0},t.initialize=function(e){void 0!==e.usage?this._usage=e.usage:this.setDefaultUsage(),void 0!==e.trackingType&&(this._trackingType=e.trackingType),void 0!==e.cameraType&&(this._cameraType=e.cameraType),this.node=e.node,this._width=1,this._height=1,this.clearFlag=vl.NONE,this.clearDepth=1,this.visibility=Sv,this._name=e.name,this._proj=e.projection,this._priority=e.priority||0,this._aspect=this.screenScale=1,this.updateExposure(),this.changeTargetWindow(e.window)},t.destroy=function(){var e;this._node=null,this.detachFromScene(),this._window&&(this._window.detachCamera(this),this.window=null),this._name=null,null===(e=this._geometryRenderer)||void 0===e||e.destroy()},t.attachToScene=function(e){this._enabled=!0,this._scene=e},t.detachFromScene=function(){this._enabled=!1,this._scene=null},t.resize=function(e,t){this._window&&(this._width=e,this._height=t,this._aspect=e*this._viewport.width/(t*this._viewport.height),this._isProjDirty=!0)},t.setFixedSize=function(e,t){this._width=e,this._height=t,this._updateAspect(),this.isWindowSize=!1},t.syncCameraEditor=function(){},t.update=function(e){var t;if(void 0===e&&(e=!1),this._node){var i=!1;(this._node.hasChangedFlags||e)&&(En.invert(this._matView,this._node.worldMatrix),this._forward.x=-this._matView.m02,this._forward.y=-this._matView.m06,this._forward.z=-this._matView.m10,En.multiply(this._matView,(new En).scale(this._node.worldScale),this._matView),this._node.getWorldPosition(this._position),i=!0);var n=null===(t=this.window)||void 0===t?void 0:t.swapchain,r=n&&n.surfaceTransform||xc.IDENTITY;if(this._isProjDirty||this._curTransform!==r){this._curTransform=r;var s=this._device.capabilities.clipSpaceSignY;if(this._proj===TI.PERSPECTIVE)En.perspective(this._matProj,this._fov,this._aspect,this._nearClip,this._farClip,this._fovAxis===EI.VERTICAL,this._device.capabilities.clipSpaceMinZ,s,r);else{var a=this._orthoHeight*this._aspect,o=this._orthoHeight;En.ortho(this._matProj,-a,a,-o,o,this._nearClip,this._farClip,this._device.capabilities.clipSpaceMinZ,s,r)}En.invert(this._matProjInv,this._matProj),i=!0,this._isProjDirty=!1}i&&(En.multiply(this._matViewProj,this._matProj,this._matView),En.invert(this._matViewProjInv,this._matViewProj),this._frustum.update(this._matViewProj,this._matViewProjInv))}},t.setViewportInOrientedSpace=function(e){var t,i=e.x,n=e.width,r=e.height,s=this._device.capabilities.screenSpaceSignY<0?1-e.y-r:e.y,a=null===(t=this.window)||void 0===t?void 0:t.swapchain;switch(a&&a.surfaceTransform||xc.IDENTITY){case xc.ROTATE_90:this._viewport.x=1-s-r,this._viewport.y=i,this._viewport.width=r,this._viewport.height=n;break;case xc.ROTATE_180:this._viewport.x=1-i-n,this._viewport.y=1-s-r,this._viewport.width=n,this._viewport.height=r;break;case xc.ROTATE_270:this._viewport.x=s,this._viewport.y=1-i-n,this._viewport.width=r,this._viewport.height=n;break;case xc.IDENTITY:this._viewport.x=i,this._viewport.y=s,this._viewport.width=n,this._viewport.height=r}this._orientedViewport.x=i,this._orientedViewport.y=s,this._orientedViewport.width=n,this._orientedViewport.height=r,this.resize(this.width,this.height)},t.initGeometryRenderer=function(){var e;this._geometryRenderer||(this._geometryRenderer=v.internal.GeometryRenderer?new v.internal.GeometryRenderer:null,null===(e=this._geometryRenderer)||void 0===e||e.activate(this._device))},t.changeTargetWindow=function(e){void 0===e&&(e=null),this._window&&this._window.detachCamera(this);var t=e||v.director.root.mainWindow;if(t){t.attachCamera(this),this.window=t;var i=t.swapchain;(i&&i.surfaceTransform||xc.IDENTITY)%2?this.resize(t.height,t.width):this.resize(t.width,t.height)}},t.detachCamera=function(){this._window&&this._window.detachCamera(this)},t.screenPointToRay=function(e,t,i){if(!this._node)return null;var n=this.width,r=this.height,s=this._orientedViewport.x*n,a=this._orientedViewport.y*r,o=this._orientedViewport.width*n,u=this._orientedViewport.height*r,h=this._proj===TI.PERSPECTIVE,c=this._device.capabilities.clipSpaceSignY,l=yn[this._curTransform];Ki.set(PI,(t-s)/o*2-1,(i-a)/u*2-1,h?1:-1);var _=PI.x,d=PI.y;return PI.x=_*l[0]+d*l[2]*c,PI.y=_*l[1]+d*l[3]*c,Ki.transformMat4(h?PI:e.o,PI,this._matViewProjInv),h?(this._node.getWorldPosition(LI),Zn.fromPoints(e,LI,PI)):Ki.transformQuat(e.d,Ki.FORWARD,this._node.worldRotation),e},t.screenToWorld=function(e,t){var i=this.width,n=this.height,r=this._orientedViewport.x*i,s=this._orientedViewport.y*n,a=this._orientedViewport.width*i,o=this._orientedViewport.height*n,u=this._device.capabilities.clipSpaceSignY,h=yn[this._curTransform];if(this._proj===TI.PERSPECTIVE){Ki.set(e,(t.x-r)/a*2-1,(t.y-s)/o*2-1,1);var c=e.x,l=e.y;e.x=c*h[0]+l*h[2]*u,e.y=c*h[1]+l*h[3]*u,Ki.transformMat4(e,e,this._matViewProjInv),this._node&&this._node.getWorldPosition(PI),Ki.lerp(e,PI,e,Ii(this._nearClip/this._farClip,1,t.z))}else{Ki.set(e,(t.x-r)/a*2-1,(t.y-s)/o*2-1,2*t.z-1);var _=e.x,d=e.y;e.x=_*h[0]+d*h[2]*u,e.y=_*h[1]+d*h[3]*u,Ki.transformMat4(e,e,this._matViewProjInv)}return e},t.worldToScreen=function(e,t){var i=this._device.capabilities.clipSpaceSignY,n=yn[this._curTransform];Ki.transformMat4(e,t,this._matViewProj);var r=e.x,s=e.y;e.x=r*n[0]+s*n[2]*i,e.y=r*n[1]+s*n[3]*i;var a=this.width,o=this.height,u=this._orientedViewport.x*a,h=this._orientedViewport.y*o,c=this._orientedViewport.width*a,l=this._orientedViewport.height*o;return e.x=u+.5*(e.x+1)*c,e.y=h+.5*(e.y+1)*l,e.z=.5*e.z+.5,e},t.worldMatrixToScreen=function(e,t,i,n){En.multiply(e,this._matViewProj,t),En.multiply(e,FI[this._curTransform],e);var r=i/2,s=n/2;return En.identity(xI),En.transform(xI,xI,Ki.set(PI,r,s,0)),En.scale(xI,xI,Ki.set(PI,r,s,1)),En.multiply(e,xI,e),e},t.calculateObliqueMat=function(e){var t=new zi(Math.sign(e.x),Math.sign(e.y),1,1).transformMat4(this._matProjInv),i=new zi(this._matProj.m03,this._matProj.m07,this._matProj.m11,this._matProj.m15),n=2/zi.dot(e,t),r=e.multiplyScalar(n).subtract(i);this._matProj.m02=r.x,this._matProj.m06=r.y,this._matProj.m10=r.z,this._matProj.m14=r.w},t.setExposure=function(e){this._exposure=.833333/Math.pow(2,e)},t.updateExposure=function(){var e=Math.log2(this._apertureValue*this._apertureValue/this._shutterValue*100/this._isoValue);this.setExposure(e)},t.setDefaultUsage=function(){this._usage=bI.GAME},n(e,[{key:"name",get:function(){return this._name}},{key:"scene",get:function(){return this._scene}},{key:"node",get:function(){return this._node},set:function(e){this._node=e}},{key:"systemWindowId",get:function(){return this._windowId}},{key:"window",get:function(){return this._window},set:function(e){this._window=e}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"forward",get:function(){return this._forward},set:function(e){this._forward=e}},{key:"aperture",get:function(){return this._aperture},set:function(e){this._aperture=e,this._apertureValue=NI[this._aperture],this.updateExposure()}},{key:"apertureValue",get:function(){return this._apertureValue}},{key:"shutter",get:function(){return this._shutter},set:function(e){this._shutter=e,this._shutterValue=CI[this._shutter],this.updateExposure()}},{key:"shutterValue",get:function(){return this._shutterValue}},{key:"iso",get:function(){return this._iso},set:function(e){this._iso=e,this._isoValue=MI[this._iso],this.updateExposure()}},{key:"isoValue",get:function(){return this._isoValue}},{key:"exposure",get:function(){return this._exposure}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(e){this._clearFlag=e}},{key:"clearColor",get:function(){return this._clearColor},set:function(e){this._clearColor.x=e.x,this._clearColor.y=e.y,this._clearColor.z=e.z,this._clearColor.w=e.w}},{key:"clearDepth",get:function(){return this._clearDepth},set:function(e){this._clearDepth=e}},{key:"clearStencil",get:function(){return this._clearStencil},set:function(e){this._clearStencil=e}},{key:"projectionType",get:function(){return this._proj},set:function(e){this._proj=e,this._isProjDirty=!0}},{key:"aspect",get:function(){return this._aspect}},{key:"orthoHeight",get:function(){return this._orthoHeight},set:function(e){this._orthoHeight=e,this._isProjDirty=!0}},{key:"fovAxis",get:function(){return this._fovAxis},set:function(e){this._fovAxis=e,this._isProjDirty=!0}},{key:"fov",get:function(){return this._fov},set:function(e){this._fov=e,this._isProjDirty=!0}},{key:"nearClip",get:function(){return this._nearClip},set:function(e){this._nearClip=e,this._isProjDirty=!0}},{key:"farClip",get:function(){return this._farClip},set:function(e){this._farClip=e,this._isProjDirty=!0}},{key:"viewport",get:function(){return this._viewport},set:function(e){q(8302),this.setViewportInOrientedSpace(e)}},{key:"frustum",get:function(){return this._frustum},set:function(e){this._frustum=e}},{key:"matView",get:function(){return this._matView}},{key:"matProj",get:function(){return this._matProj}},{key:"matProjInv",get:function(){return this._matProjInv}},{key:"matViewProj",get:function(){return this._matViewProj}},{key:"matViewProjInv",get:function(){return this._matViewProjInv}},{key:"surfaceTransform",get:function(){return this._curTransform}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"cameraType",get:function(){return this._cameraType},set:function(e){this._cameraType=e}},{key:"trackingType",get:function(){return this._trackingType},set:function(e){this._trackingType=e}},{key:"cameraUsage",get:function(){return this._usage},set:function(e){this._usage=e}}],[{key:"standardExposureValue",get:function(){return 1/38400}},{key:"standardLightMeterScale",get:function(){return 1e4}}]),e}()),UI=new Ki,GI=lr.create(0,0,0,1),kI=new Th((function(){return{model:null,depth:0}}),128);function HI(e,t){var i=0;e.node&&(Ki.subtract(UI,e.node.worldPosition,t.position),i=Ki.dot(UI,t.forward));var n=kI.alloc();return n.model=e,n.depth=i,n}function zI(e,t){var i=e.pipelineSceneData,n=i.validPunctualLights;n.length=0;for(var r=t.scene.spotLights,s=0;s<r.length;s++){var a=r[s];a.baked||(lr.set(GI,a.position.x,a.position.y,a.position.z,a.range),$r.sphereFrustum(GI,t.frustum)&&n.push(a))}for(var o=t.scene.sphereLights,u=0;u<o.length;u++){var h=o[u];h.baked||(lr.set(GI,h.position.x,h.position.y,h.position.z,h.range),$r.sphereFrustum(GI,t.frustum)&&n.push(h))}i.validPunctualLights=n}function VI(e,t){var i=t.scene,n=i.mainLight,r=e.pipelineSceneData,s=r.shadows,a=r.skybox,o=r.csmLayers,u=r.renderObjects;kI.freeArray(u),u.length=0;var h=o.castShadowObjects;h.length=0;var c=o.layerObjects;c.clear(),s.enabled&&(e.pipelineUBO.updateShadowUBORange(_g.SHADOW_COLOR_OFFSET,s.shadowColor),s.type===sT.ShadowMap&&n&&n.node&&o.update(r,t)),t.clearFlag&DI&&(a.enabled&&a.model?u.push(HI(a.model,t)):t.cameraUsage!==bI.EDITOR&&t.cameraUsage!==bI.SCENE_VIEW&&v.warnID(15100,t.name));var l=i.models,_=t.visibility;function d(e){if(e.enabled){if(i.isCulledByLod(t,e))return;if(e.castShadow&&(h.push(HI(e,t)),c.push(HI(e,t))),e.node&&(_&e.node.layer)===e.node.layer||_&e.visFlags){if(e.worldBounds&&!$r.aabbFrustum(e.worldBounds,t.frustum))return;u.push(HI(e,t))}}}for(var f=0;f<l.length;f++)d(l[f])}var WI,jI=new m_(null),XI=e("bL",function(){function e(){this._device=null,this._passes=null,this._shaders=null,this._subMesh=null,this._patches=null,this._priority=qm.DEFAULT,this._inputAssembler=null,this._descriptorSet=null,this._worldBoundDescriptorSet=null,this._planarInstanceShader=null,this._planarShader=null,this._reflectionTex=null,this._reflectionSampler=null,this._instancedAttributeBlock={buffer:null,views:[],attributes:[]},this._instancedWorldMatrixIndex=-1,this._instancedSHIndex=-1,this._useReflectionProbeType=0}var t=e.prototype;return t.initialize=function(e,t,i){void 0===i&&(i=null);var n=v.director.root;this._device=gd.gfxDevice,jI.layout=t[0].localSetLayout,this._inputAssembler=this._device.createInputAssembler(e.iaInfo),this._descriptorSet=this._device.createDescriptorSet(jI);var r=v.director.root.pipeline.pipelineSceneData.getOcclusionQueryPass();if(r){var s=new m_(null);s.layout=r.localSetLayout,this._worldBoundDescriptorSet=this._device.createDescriptorSet(s)}this._subMesh=e,this._patches=i,this._passes=t,this._flushPassInfo(),t[0].batchingScheme===CE.VB_MERGING&&this.subMesh.genFlatBuffers(),this.priority=qm.DEFAULT;var a=v.rendering;if((!a||!a.enableEffectImport)&&t[0].phase===LE("reflection")||bv()&&t[0].phaseID===a.getPhaseID(a.getPassID("default"),"reflection")){var o=n.mainWindow.width,u=n.mainWindow.height,h=512;u<o?(o=h*o/u,u=h):u=h*u/(o=h),this._reflectionTex=this._device.createTexture(new Wl(Vc.TEX2D,Wc.STORAGE|Wc.TRANSFER_SRC|Wc.SAMPLED,Fc.RGBA8,o,u)),this.descriptorSet.bindTexture(uv,this._reflectionTex),this._reflectionSampler=this._device.getSampler(new Xl(qc.LINEAR,qc.LINEAR,qc.NONE,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP)),this.descriptorSet.bindSampler(uv,this._reflectionSampler),this.descriptorSet.bindTexture(lv,this._reflectionTex)}},t.initPlanarShadowShader=function(){var e=v.director.root.pipeline.pipelineSceneData.shadows;this._planarShader=e.getPlanarShader(this._patches)},t.initPlanarShadowInstanceShader=function(){var e=v.director.root.pipeline.pipelineSceneData.shadows;this._planarInstanceShader=e.getPlanarInstanceShader(this._patches)},t.destroy=function(){var e;this._descriptorSet.destroy(),this._descriptorSet=null,this._inputAssembler.destroy(),this._inputAssembler=null,null===(e=this._worldBoundDescriptorSet)||void 0===e||e.destroy(),this._worldBoundDescriptorSet=null,this.priority=qm.DEFAULT,this._patches=null,this._subMesh=null,this._passes=null,this._shaders=null,this._reflectionTex&&this._reflectionTex.destroy(),this._reflectionTex=null,this._reflectionSampler=null},t.update=function(){for(var e,t=0;t<this._passes.length;++t)this._passes[t].update();this._descriptorSet.update(),null===(e=this._worldBoundDescriptorSet)||void 0===e||e.update()},t.onPipelineStateChanged=function(){var e=this._passes;if(e){for(var t=0;t<e.length;t++){var i=e[t];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently()}this._flushPassInfo()}},t.onMacroPatchesStateChanged=function(e){this._patches=e;var t=this._passes;if(t){for(var i=0;i<t.length;i++){var n=t[i];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}this._flushPassInfo()}},t.onGeometryChanged=function(){if(this._subMesh){var e=this._subMesh.drawInfo;if(this._inputAssembler&&e){var t=this._inputAssembler.drawInfo;Object.keys(e).forEach((function(i){t[i]=e[i]})),this._inputAssembler.drawInfo=t}}},t.getInstancedAttributeIndex=function(e){for(var t=this.instancedAttributeBlock.attributes,i=0;i<t.length;i++)if(t[i].name===e)return i;return-1},t.updateInstancedWorldMatrix=function(e,t){var i=this.instancedAttributeBlock.views,n=i[t],r=i[t+1],s=i[t+2];n[0]=e.m00,n[1]=e.m01,n[2]=e.m02,n[3]=e.m12,r[0]=e.m04,r[1]=e.m05,r[2]=e.m06,r[3]=e.m13,s[0]=e.m08,s[1]=e.m09,s[2]=e.m10,s[3]=e.m14},t.updateInstancedSH=function(e,t){for(var i=this.instancedAttributeBlock.views,n=(kg.SH_QUADRATIC_R_OFFSET-kg.SH_LINEAR_CONST_R_OFFSET)/4,r=0,s=t;s<t+n;s++)for(var a=0;a<4;a++)i[s][a]=e[r++]},t.UpdateInstancedAttributes=function(e){this.instancedWorldMatrixIndex=-1,this.instancedSHIndex=-1;var t=this.passes[0];if(t.device.hasFeature(Dc.INSTANCED_ARRAYS)){for(var i=0,n=0;n<e.length;n++){var r=e[n];r.isInstanced&&(i+=b_[r.format].size)}var s=this.instancedAttributeBlock;s.buffer=new Uint8Array(i),s.views.length=s.attributes.length=0;for(var a=0,o=0;o<e.length;o++){var u=e[o];if(u.isInstanced){var h=new i_;h.format=u.format,h.name=u.name,h.isNormalized=u.isNormalized,h.location=u.location,s.attributes.push(h);var c=b_[u.format],l=new(B_(c))(s.buffer.buffer,a,c.count);s.views.push(l),a+=c.size}}t.batchingScheme===CE.INSTANCING&&t.getInstancedBuffer().destroy(),this.instancedWorldMatrixIndex=this.getInstancedAttributeIndex(Og),this.instancedSHIndex=this.getInstancedAttributeIndex(Ng)}},t._flushPassInfo=function(){var e=this._passes;if(e){this._shaders||(this._shaders=[]),this._shaders.length=e.length;for(var t=0,i=e.length;t<i;t++)this._shaders[t]=e[t].getShaderVariant(this.patches)}},n(e,[{key:"passes",get:function(){return this._passes},set:function(e){e.length>8?Z(12004,8):(this._passes=e,this._flushPassInfo(),this._passes[0].batchingScheme===CE.VB_MERGING&&this.subMesh.genFlatBuffers(),this._descriptorSet&&(this._descriptorSet.destroy(),jI.layout=e[0].localSetLayout,this._descriptorSet=this._device.createDescriptorSet(jI)))}},{key:"shaders",get:function(){return this._shaders}},{key:"subMesh",get:function(){return this._subMesh},set:function(e){this._inputAssembler.destroy(),this._inputAssembler=this._device.createInputAssembler(e.iaInfo),this._passes[0].batchingScheme===CE.VB_MERGING&&this.subMesh.genFlatBuffers(),this._subMesh=e}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"inputAssembler",get:function(){return this._inputAssembler}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"worldBoundDescriptorSet",get:function(){return this._worldBoundDescriptorSet}},{key:"patches",get:function(){return this._patches}},{key:"planarInstanceShader",get:function(){return this._planarInstanceShader}},{key:"planarShader",get:function(){return this._planarShader}},{key:"instancedAttributeBlock",get:function(){return this._instancedAttributeBlock}},{key:"instancedWorldMatrixIndex",get:function(){return this._instancedWorldMatrixIndex},set:function(e){this._instancedWorldMatrixIndex=e}},{key:"instancedSHIndex",get:function(){return this._instancedSHIndex},set:function(e){this._instancedSHIndex=e}},{key:"useReflectionProbeType",get:function(){return this._useReflectionProbeType},set:function(e){this._useReflectionProbeType=e}}]),e}()),KI=new En,YI=[{name:"CC_RECEIVE_SHADOW",value:!0}],qI=[{name:"CC_USE_LIGHTMAP",value:1}],QI=[{name:"CC_USE_LIGHTMAP",value:2}],ZI=[{name:"CC_USE_LIGHT_PROBE",value:!0}];!function(e){e[e.DEFAULT=0]="DEFAULT",e[e.SKINNING=1]="SKINNING",e[e.BAKED_SKINNING=2]="BAKED_SKINNING",e[e.BATCH_2D=3]="BATCH_2D",e[e.PARTICLE_BATCH=4]="PARTICLE_BATCH",e[e.LINE=5]="LINE"}(WI||(WI=e("bJ",{})));var JI,$I=new Xl(qc.LINEAR,qc.LINEAR,qc.NONE,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP),eb=new Xl(qc.LINEAR,qc.LINEAR,qc.LINEAR,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP),tb=(e("bK",function(){function e(){this.type=WI.DEFAULT,this.scene=null,this.isDynamicBatching=!1,this._worldBounds=null,this._modelBounds=null,this._subModels=[],this._node=null,this._transform=null,this._device=void 0,this._inited=!1,this._descriptorSetCount=1,this._updateStamp=-1,this._localDataUpdated=!0,this._localData=new Float32Array(Ig.COUNT),this._localBuffer=null,this._localSHData=null,this._localSHBuffer=null,this._lightmap=null,this._lightmapUVParam=new zi,this._tetrahedronIndex=-1,this._lastWorldBoundCenter=new Ki(1/0,1/0,1/0),this._useLightProbe=!1,this._worldBoundBuffer=null,this._receiveShadow=!1,this._castShadow=!1,this._shadowBias=0,this._shadowNormalBias=0,this._enabled=!0,this._visFlags=Yp.Enum.NONE,this._priority=0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0,this._device=gd.gfxDevice}var t=e.prototype;return t.initialize=function(){this._inited||(this._receiveShadow=!0,this.castShadow=!1,this.enabled=!0,this.visFlags=Yp.Enum.NONE,this._inited=!0,this._bakeToReflectionProbe=!0,this._reflectionProbeType=0)},t.destroy=function(){for(var e=this._subModels,t=0;t<e.length;t++)this._subModels[t].destroy();this._localBuffer&&(this._localBuffer.destroy(),this._localBuffer=null),this._localSHBuffer&&(this._localSHBuffer.destroy(),this._localSHBuffer=null),this._worldBoundBuffer&&(this._worldBoundBuffer.destroy(),this._worldBoundBuffer=null),this._worldBounds=null,this._modelBounds=null,this._subModels.length=0,this._inited=!1,this._localDataUpdated=!0,this._transform=null,this._node=null,this.isDynamicBatching=!1},t.attachToScene=function(e){this.scene=e,this._localDataUpdated=!0},t.detachFromScene=function(){this.scene=null},t.updateTransform=function(){var e=this.transform;if(e.hasChangedFlags||e._dirtyFlags){e.updateWorldTransform(),this._localDataUpdated=!0;var t=this._worldBounds;this._modelBounds&&t&&this._modelBounds.transform(e._mat,e._pos,e._rot,e._scale,t)}},t.updateWorldBound=function(){var e=this.transform;if(null!==e){e.updateWorldTransform(),this._localDataUpdated=!0;var t=this._worldBounds;this._modelBounds&&t&&this._modelBounds.transform(e._mat,e._pos,e._rot,e._scale,t)}},t.updateUBOs=function(e){for(var t=this._subModels,i=0;i<t.length;i++)t[i].update();this._updateStamp=e,this.updateSHUBOs();var n=this.node.scene.globals.shadows.enabled&&this.node.scene.globals.shadows.type===sT.Planar;if(this._localDataUpdated){this._localDataUpdated=!1;for(var r=this.transform._mat,s=!1,a=0;a<t.length;a++){var o=t[a],u=o.instancedWorldMatrixIndex;u>=0?o.updateInstancedWorldMatrix(r,u):s=!0}(s||n)&&this._localBuffer&&(En.toArray(this._localData,r,Ig.MAT_WORLD_OFFSET),En.inverseTranspose(KI,r),En.toArray(this._localData,KI,Ig.MAT_WORLD_IT_OFFSET),this._localBuffer.update(this._localData))}},t.showTetrahedron=function(){return this.isLightProbeAvailable()},t.isLightProbeAvailable=function(){if(!this._useLightProbe)return!1;var e=v.director.root.pipeline.pipelineSceneData.lightProbes;return!(!e||e.empty()||!this._worldBounds)},t.updateSHBuffer=function(){if(this._localSHData){for(var e=this._subModels,t=!1,i=0;i<e.length;i++){var n=e[i],r=n.instancedSHIndex;r>=0?n.updateInstancedSH(this._localSHData,r):t=!0}t&&this._localSHBuffer&&this._localSHBuffer.update(this._localSHData)}},t.clearSHUBOs=function(){if(this._localSHData){for(var e=0;e<kg.COUNT;e++)this._localSHData[e]=0;this.updateSHBuffer()}},t.updateSHUBOs=function(){if(this.isLightProbeAvailable()){var e=this._worldBounds.center;if(!e.equals(this._lastWorldBoundCenter,Ti)){var t=[],i=new zi(0,0,0,0),n=v.director.root.pipeline.pipelineSceneData.lightProbes;this._lastWorldBoundCenter.set(e),this._tetrahedronIndex=n.data.getInterpolationWeights(e,this._tetrahedronIndex,i),n.data.getInterpolationSHCoefficients(this._tetrahedronIndex,i,t)&&this._localSHData&&(v.internal.SH.reduceRinging(t,n.reduceRinging),v.internal.SH.updateUBOData(this._localSHData,kg.SH_LINEAR_CONST_R_OFFSET,t),this.updateSHBuffer())}}},t.createBoundingShape=function(e,t){e&&t&&(this._modelBounds=_s.fromPoints(_s.create(),e,t),this._worldBounds=_s.clone(this._modelBounds))},t._createSubModel=function(){return new XI},t.initSubModel=function(e,t,i){this.initialize(),null==this._subModels[e]?this._subModels[e]=this._createSubModel():this._subModels[e].destroy(),this._subModels[e].initialize(t,i.passes,this.getMacroPatches(e)),this._subModels[e].initPlanarShadowShader(),this._subModels[e].initPlanarShadowInstanceShader(),this._updateAttributesAndBinding(e)},t.setSubModelMesh=function(e,t){this._subModels[e]&&(this._subModels[e].subMesh=t)},t.setSubModelMaterial=function(e,t){this._subModels[e]&&(this._subModels[e].passes=t.passes,this._updateAttributesAndBinding(e))},t.onGlobalPipelineStateChanged=function(){for(var e=this._subModels,t=0;t<e.length;t++)e[t].onPipelineStateChanged()},t.onMacroPatchesStateChanged=function(){for(var e=this._subModels,t=0;t<e.length;t++)e[t].onMacroPatchesStateChanged(this.getMacroPatches(t))},t.onGeometryChanged=function(){for(var e=this._subModels,t=0;t<e.length;t++)e[t].onGeometryChanged()},t.initLightingmap=function(e,t){this._lightmap=e,this._lightmapUVParam=t},t.updateLightingmap=function(e,t){zi.toArray(this._localData,t,Ig.LIGHTINGMAP_UVPARAM),this._localDataUpdated=!0,this._lightmap=e,this._lightmapUVParam=t,this.onMacroPatchesStateChanged(),e||(e=PE.get("empty-texture"));var i=e.getGFXTexture();if(i)for(var n=this._device.getSampler(e.mipmaps.length>1?eb:$I),r=this._subModels,s=0;s<r.length;s++){var a=r[s].descriptorSet;a.bindTexture(iv,i),a.bindSampler(iv,n),a.update()}},t.updateReflectionProbeCubemap=function(e){this._localDataUpdated=!0,this.onMacroPatchesStateChanged(),e||(e=PE.get("default-cube-texture"));var t=e.getGFXTexture();if(t)for(var i=this._device.getSampler(e.getSamplerInfo()),n=this._subModels,r=0;r<n.length;r++){var s=n[r].descriptorSet;s.bindSampler(fv,i),s.bindTexture(fv,t),s.update()}},t.updateReflectionProbePlanarMap=function(e){this._localDataUpdated=!0,this.onMacroPatchesStateChanged();var t=this._device.getSampler(new Xl(qc.LINEAR,qc.LINEAR,qc.NONE,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP));if(e||(e=PE.get("empty-texture").getGFXTexture()),e)for(var i=this._subModels,n=0;n<i.length;n++){var r=i[n].descriptorSet;r.bindTexture(gv,e),r.bindSampler(gv,t),r.update()}},t.updateLocalShadowBias=function(){var e=this._localData;e[Ig.LOCAL_SHADOW_BIAS+0]=this._shadowBias,e[Ig.LOCAL_SHADOW_BIAS+1]=this._shadowNormalBias,e[Ig.LOCAL_SHADOW_BIAS+2]=0,e[Ig.LOCAL_SHADOW_BIAS+3]=0,this._localDataUpdated=!0},t.getMacroPatches=function(){var e=this.receiveShadow?YI:null;if(null!=this._lightmap){var t=!1;this.node&&this.node.scene&&(t=this.node.scene.globals.bakedWithStationaryMainLight);var i=t?QI:qI;e=e?e.concat(i):i}this._useLightProbe&&(e=e?e.concat(ZI):ZI);var n=[{name:"CC_USE_REFLECTION_PROBE",value:this._reflectionProbeType}];return e?e.concat(n):n},t._updateAttributesAndBinding=function(e){var t=this._subModels[e];if(t){this._initLocalDescriptors(e),this._updateLocalDescriptors(e,t.descriptorSet),this._initLocalSHDescriptors(e),this._updateLocalSHDescriptors(e,t.descriptorSet),this._initWorldBoundDescriptors(e),t.worldBoundDescriptorSet&&this._updateWorldBoundDescriptors(e,t.worldBoundDescriptorSet);var i=t.passes[0].getShaderVariant(t.patches);this._updateInstancedAttributes(i.attributes,t)}},t._updateInstancedAttributes=function(e,t){t.UpdateInstancedAttributes(e),this._localDataUpdated=!0},t._initLocalDescriptors=function(){this._localBuffer||(this._localBuffer=this._device.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE,Ig.SIZE,Ig.SIZE)))},t._initLocalSHDescriptors=function(){this._useLightProbe&&(this._localSHData||(this._localSHData=new Float32Array(kg.COUNT)),this._localSHBuffer||(this._localSHBuffer=this._device.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE,kg.SIZE,kg.SIZE))))},t._initWorldBoundDescriptors=function(){this._worldBoundBuffer||(this._worldBoundBuffer=this._device.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE,bg.SIZE,bg.SIZE)))},t._updateLocalDescriptors=function(e,t){this._localBuffer&&t.bindBuffer(Ig.BINDING,this._localBuffer)},t._updateLocalSHDescriptors=function(e,t){this._localSHBuffer&&t.bindBuffer(kg.BINDING,this._localSHBuffer)},t._updateWorldBoundDescriptors=function(e,t){this._worldBoundBuffer&&t.bindBuffer(bg.BINDING,this._worldBoundBuffer)},n(e,[{key:"subModels",get:function(){return this._subModels}},{key:"inited",get:function(){return this._inited}},{key:"worldBounds",get:function(){return this._worldBounds}},{key:"modelBounds",get:function(){return this._modelBounds}},{key:"localBuffer",get:function(){return this._localBuffer}},{key:"localSHBuffer",get:function(){return this._localSHBuffer}},{key:"worldBoundBuffer",get:function(){return this._worldBoundBuffer}},{key:"updateStamp",get:function(){return this._updateStamp}},{key:"useLightProbe",get:function(){return this._useLightProbe},set:function(e){this._useLightProbe=e,this.onMacroPatchesStateChanged()}},{key:"tetrahedronIndex",get:function(){return this._tetrahedronIndex},set:function(e){this._tetrahedronIndex=e}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(e){this._shadowBias=e}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(e){this._shadowNormalBias=e}},{key:"receiveShadow",get:function(){return this._receiveShadow},set:function(e){this._receiveShadow=e,this.onMacroPatchesStateChanged()}},{key:"castShadow",get:function(){return this._castShadow},set:function(e){this._castShadow=e}},{key:"node",get:function(){return this._node},set:function(e){this._node=e}},{key:"transform",get:function(){return this._transform},set:function(e){this._transform=e}},{key:"visFlags",get:function(){return this._visFlags},set:function(e){this._visFlags=e}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"priority",get:function(){return this._priority},set:function(e){this._priority=e}},{key:"bakeToReflectionProbe",get:function(){return this._bakeToReflectionProbe},set:function(e){this._bakeToReflectionProbe=e}},{key:"reflectionProbeType",get:function(){return this._reflectionProbeType},set:function(e){this._reflectionProbeType=e;for(var t=this._subModels,i=0;i<t.length;i++)t[i].useReflectionProbeType=e;this.onMacroPatchesStateChanged()}}]),e}()),e("bX",function(){function e(){this._enabled=!1,this._minPos=new Ki(0,0,0),this._maxPos=new Ki(0,0,0),this._depth=0}return e.prototype.initialize=function(e){this._enabled=e.enabled,this._minPos=e.minPos,this._maxPos=e.maxPos,this._depth=e.depth},n(e,[{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}},{key:"minPos",get:function(){return this._minPos},set:function(e){this._minPos=e}},{key:"maxPos",get:function(){return this._maxPos},set:function(e){this._maxPos=e}},{key:"depth",get:function(){return this._depth},set:function(e){this._depth=e}}]),e}()));function ib(e,t){t<1e3?t=1e3:t>15e3&&(t=15e3);var i=t*t,n=(.860117757+.000154118254*t+1.28641212e-7*i)/(1+.000842420235*t+7.08145163e-7*i),r=(.317398726+422806245e-13*t+4.20481691e-8*i)/(1-289741816e-13*t+1.61456053e-7*i),s=2*n-8*r+4,a=3*n/s,o=2*r/s,u=1/o*a,h=1/o*(1-a-o);e.x=3.2404542*u-1.5371385+-.4985314*h,e.y=-.969266*u+1.8760108+.041556*h,e.z=.0556434*u-.2040259+1.0572252*h}!function(e){e[e.DIRECTIONAL=0]="DIRECTIONAL",e[e.SPHERE=1]="SPHERE",e[e.SPOT=2]="SPOT",e[e.UNKNOWN=3]="UNKNOWN"}(JI||(JI=e("bZ",{})));var nb,rb=e("b_",(function(e){return 4*Math.PI*Math.PI*e*e})),sb=e("b$",function(){function e(){this._baked=!1,this._color=new Ki(1,1,1),this._colorTemp=6550,this._colorTempRGB=new Ki(1,1,1),this._scene=null,this._node=null,this._name=null,this._useColorTemperature=!1,this._type=JI.UNKNOWN,this._visibility=Sv}var t=e.prototype;return t.initialize=function(){this.color=new Ki(1,1,1),this.colorTemperature=6550},t.attachToScene=function(e){this._scene=e},t.detachFromScene=function(){this._scene=null},t.destroy=function(){this._name=null,this._node=null},t.update=function(){},n(e,[{key:"baked",get:function(){return this._baked},set:function(e){this._baked=e}},{key:"color",get:function(){return this._color},set:function(e){this._color.set(e)}},{key:"useColorTemperature",get:function(){return this._useColorTemperature},set:function(e){this._useColorTemperature=e}},{key:"colorTemperature",get:function(){return this._colorTemp},set:function(e){this._colorTemp=e,ib(this._colorTempRGB,this._colorTemp)}},{key:"colorTemperatureRGB",get:function(){return this._colorTempRGB}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e}},{key:"node",get:function(){return this._node},set:function(e){this._node=e,this._node&&(this._node.hasChangedFlags|=Qp.ROTATION)}},{key:"type",get:function(){return this._type}},{key:"name",get:function(){return this._name},set:function(e){this._name=e}},{key:"scene",get:function(){return this._scene}}]),e}()),ab=new Ki(0,0,-1),ob=new Ki,ub=(e("c0",function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Ki(1,-1,-1),t._illuminanceHDR=Km.SUN_ILLUM,t._illuminanceLDR=1,t._shadowEnabled=!1,t._shadowPcf=aT.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._shadowSaturation=1,t._shadowDistance=50,t._shadowInvisibleOcclusionRange=200,t._csmLevel=oT.LEVEL_4,t._csmNeedUpdate=!1,t._csmLayerLambda=.75,t._csmOptimizationMode=uT.DisableRotationFix,t._csmLayersTransition=!1,t._csmTransitionRange=.05,t._shadowFixedArea=!1,t._shadowNear=.1,t._shadowFar=10,t._shadowOrthoSize=5,t._type=JI.DIRECTIONAL,t}s(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.illuminance=Km.SUN_ILLUM,this.direction=new Ki(1,-1,-1)},i.update=function(){this._node&&this._node.hasChangedFlags&&(this.direction=Ki.transformQuat(ob,ab,this._node.worldRotation))},i._activate=function(){var e=v.director.root,t=e.pipeline;this._shadowEnabled?(this._shadowFixedArea||!t.pipelineSceneData.csmSupported?t.macros.CC_DIR_LIGHT_SHADOW_TYPE=1:this.csmLevel>1&&t.pipelineSceneData.csmSupported?(t.macros.CC_DIR_LIGHT_SHADOW_TYPE=2,t.macros.CC_CASCADED_LAYERS_TRANSITION=this._csmLayersTransition):t.macros.CC_DIR_LIGHT_SHADOW_TYPE=1,t.macros.CC_DIR_SHADOW_PCF_TYPE=this._shadowPcf):t.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,e.onGlobalPipelineStateChanged()},n(t,[{key:"direction",get:function(){return this._dir},set:function(e){Ki.normalize(this._dir,e)}},{key:"illuminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._illuminanceHDR:this._illuminanceLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.illuminanceHDR=e:this.illuminanceLDR=e}},{key:"illuminanceHDR",get:function(){return this._illuminanceHDR},set:function(e){this._illuminanceHDR=e}},{key:"illuminanceLDR",get:function(){return this._illuminanceLDR},set:function(e){this._illuminanceLDR=e}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled=e,this._activate()}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(e){this._shadowPcf=e,this._activate()}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(e){this._shadowBias=e}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(e){this._shadowNormalBias=e}},{key:"shadowSaturation",get:function(){return this._shadowSaturation},set:function(e){this._shadowSaturation=e}},{key:"shadowDistance",get:function(){return this._shadowDistance},set:function(e){this._shadowDistance=Math.min(e,cT.MAX_FAR)}},{key:"shadowInvisibleOcclusionRange",get:function(){return this._shadowInvisibleOcclusionRange},set:function(e){this._shadowInvisibleOcclusionRange=Math.min(e,cT.MAX_FAR)}},{key:"csmLevel",get:function(){return this._csmLevel},set:function(e){this._csmLevel=e,this._activate()}},{key:"csmNeedUpdate",get:function(){return this._csmNeedUpdate},set:function(e){this._csmNeedUpdate=e}},{key:"csmLayerLambda",get:function(){return this._csmLayerLambda},set:function(e){this._csmLayerLambda=e}},{key:"csmOptimizationMode",get:function(){return this._csmOptimizationMode},set:function(e){this._csmOptimizationMode=e}},{key:"shadowFixedArea",get:function(){return this._shadowFixedArea},set:function(e){this._shadowFixedArea=e,this._activate()}},{key:"shadowNear",get:function(){return this._shadowNear},set:function(e){this._shadowNear=e}},{key:"shadowFar",get:function(){return this._shadowFar},set:function(e){this._shadowFar=Math.min(e,cT.MAX_FAR)}},{key:"shadowOrthoSize",get:function(){return this._shadowOrthoSize},set:function(e){this._shadowOrthoSize=e}},{key:"csmLayersTransition",get:function(){return this._csmLayersTransition},set:function(e){this._csmLayersTransition=e,this._activate()}},{key:"csmTransitionRange",get:function(){return this._csmTransitionRange},set:function(e){this._csmTransitionRange=e}}]),t}(sb)),e("c1",function(e){function t(){var t;return(t=e.call(this)||this)._needUpdate=!1,t._size=.15,t._range=1,t._luminanceHDR=0,t._luminanceLDR=0,t._pos=void 0,t._aabb=void 0,t._aabb=_s.create(),t._pos=new Ki,t._type=JI.SPHERE,t}s(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.range=1,this.luminanceHDR=1700/rb(.15),this.luminanceLDR=1},i.update=function(){if(this._node&&(this._node.hasChangedFlags||this._needUpdate)){this._node.getWorldPosition(this._pos);var e=this._range;_s.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,e,e,e),this._needUpdate=!1}},n(t,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(e){this._size=e}},{key:"range",get:function(){return this._range},set:function(e){this._range=e,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=e:this.luminanceLDR=e}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(e){this._luminanceHDR=e}},{key:"luminanceLDR",set:function(e){this._luminanceLDR=e}},{key:"aabb",get:function(){return this._aabb}}]),t}(sb)),new Ki(0,0,-1)),hb=new _n,cb=new En,lb=new En,_b=new En,db=new En,fb=(e("c2",function(e){function t(){var t;return(t=e.call(this)||this)._dir=new Ki(1,-1,-1),t._range=5,t._spotAngle=Math.cos(Math.PI/6),t._pos=void 0,t._aabb=void 0,t._frustum=void 0,t._angle=0,t._needUpdate=!1,t._size=.15,t._luminanceHDR=0,t._luminanceLDR=0,t._shadowEnabled=!1,t._shadowPcf=aT.HARD,t._shadowBias=1e-5,t._shadowNormalBias=0,t._aabb=_s.create(),t._frustum=ys.create(),t._pos=new Ki,t._type=JI.SPOT,t}s(t,e);var i=t.prototype;return i.initialize=function(){e.prototype.initialize.call(this),this.size=.15,this.luminanceHDR=1700/rb(.15),this.luminanceLDR=1,this.range=Math.cos(Math.PI/6),this._dir.set(new Ki(1,-1,-1))},i.update=function(){this._node&&(this._node.hasChangedFlags||this._needUpdate)&&(this._node.getWorldPosition(this._pos),Ki.transformQuat(this._dir,ub,this._node.getWorldRotation(hb)),Ki.normalize(this._dir,this._dir),_s.set(this._aabb,this._pos.x,this._pos.y,this._pos.z,this._range,this._range,this._range),this._node.getWorldRT(cb),En.invert(cb,cb),En.perspective(lb,this._angle,1,.001,this._range),En.multiply(_b,lb,cb),this._frustum.update(_b,db),this._needUpdate=!1)},n(t,[{key:"position",get:function(){return this._pos}},{key:"size",get:function(){return this._size},set:function(e){this._size=e}},{key:"range",get:function(){return this._range},set:function(e){this._range=e,this._needUpdate=!0}},{key:"luminance",get:function(){return v.director.root.pipeline.pipelineSceneData.isHDR?this._luminanceHDR:this._luminanceLDR},set:function(e){v.director.root.pipeline.pipelineSceneData.isHDR?this.luminanceHDR=e:this.luminanceLDR=e}},{key:"luminanceHDR",get:function(){return this._luminanceHDR},set:function(e){this._luminanceHDR=e}},{key:"luminanceLDR",get:function(){return this._luminanceLDR},set:function(e){this._luminanceLDR=e}},{key:"direction",get:function(){return this._dir}},{key:"spotAngle",get:function(){return this._spotAngle},set:function(e){this._angle=e,this._spotAngle=Math.cos(.5*e),this._needUpdate=!0}},{key:"angle",get:function(){return this._angle}},{key:"aabb",get:function(){return this._aabb}},{key:"frustum",get:function(){return this._frustum}},{key:"shadowEnabled",get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled=e}},{key:"shadowPcf",get:function(){return this._shadowPcf},set:function(e){this._shadowPcf=e}},{key:"shadowBias",get:function(){return this._shadowBias},set:function(e){this._shadowBias=e}},{key:"shadowNormalBias",get:function(){return this._shadowNormalBias},set:function(e){this._shadowNormalBias=e}}]),t}(sb)),new s_);fb.format=Fc.RGBA8;var pb=new a_;pb.format=Fc.DEPTH_STENCIL;var mb,gb,vb=new h_([fb],pb),yb={width:1,height:1,renderPassInfo:vb},Eb=e("dx",Gs("cc.RenderTexture")(nb=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._window=null,t}s(t,e);var i=t.prototype;return i.initialize=function(e){this._name=e.name||"",this._width=e.width,this._height=e.height,this._initWindow(e)},i.reset=function(e){this.initialize(e)},i.destroy=function(){if(this._window){var t=v.director.root;null==t||t.destroyWindow(this._window),this._window=null}return e.prototype.destroy.call(this)},i.resize=function(e,t){this._width=Math.floor(Ri(e,1,2048)),this._height=Math.floor(Ri(t,1,2048)),this._window&&this._window.resize(this._width,this._height),this.emit("resize",this._window)},i._serialize=function(){return{}},i._deserialize=function(t,i){var n=t;this._width=n.w,this._height=n.h,this._name=n.n,e.prototype._deserialize.call(this,n.base,i)},i.getGFXTexture=function(){return this._window&&this._window.framebuffer.colorTextures[0]},i.onLoaded=function(){this._initWindow()},i._initWindow=function(e){var t=v.director.root;yb.title=this._name,yb.width=this._width,yb.height=this._height,yb.renderPassInfo=e&&e.passInfo?e.passInfo:vb,fb.barrier=gd.gfxDevice.getGeneralBarrier(new c_(sl.FRAGMENT_SHADER_READ_TEXTURE,sl.FRAGMENT_SHADER_READ_TEXTURE)),this._window?(this._window.destroy(),this._window.initialize(gd.gfxDevice,yb)):this._window=t.createWindow(yb)},i.initDefault=function(t){e.prototype.initDefault.call(this,t),this._width=this._height=1,this._initWindow()},i.validate=function(){return this.width>=1&&this.width<=2048&&this.height>=1&&this.height<=2048},i.readPixels=function(e,t,i,n,r){void 0===e&&(e=0),void 0===t&&(t=0),i=i||this.width,n=n||this.height;var s=this.getGFXTexture();if(!s)return Z(7606),null;var a=4*i*n;if(void 0===r)r=new Uint8Array(a);else if(r.length<a)return Z(7607,a),null;var o=this._getGFXDevice(),u=[],h=[],c=new Ll;return c.texOffset.x=e,c.texOffset.y=t,c.texExtent.width=i,c.texExtent.height=n,h.push(c),u.push(r),null==o||o.copyTextureToBuffers(s,u,h),r},n(t,[{key:"window",get:function(){return this._window}}]),t}(wf))||nb);v.RenderTexture=Eb,function(e){e[e.SKYBOX=DI|vl.DEPTH_STENCIL]="SKYBOX",e[e.SOLID_COLOR=vl.ALL]="SOLID_COLOR"}(mb||(mb=e("c3",{}))),function(e){e[e.CUBE=0]="CUBE",e[e.PLANAR=1]="PLANAR"}(gb||(gb=e("c4",{})));var Tb,Ab,Sb,Rb,wb,Ib,bb,Ob,Nb,Cb,Mb,Pb=[new Ki(0,-90,0),new Ki(0,90,0),new Ki(90,0,0),new Ki(-90,0,0),new Ki(0,0,0),new Ki(0,180,0)];e("c5",function(){function e(e){this.bakedCubeTextures=[],this.realtimePlanarTexture=null,this._resolution=512,this._clearFlag=mb.SKYBOX,this._backgroundColor=new en(0,0,0,255),this._visibility=Sv,this._probeType=gb.CUBE,this._cubemap=null,this._size=new Ki(1,1,1),this._camera=null,this._probeId=0,this._needRefresh=!1,this._needRender=!1,this._node=null,this._cameraNode=null,this._boundingBox=null,this._cameraWorldPos=new Ki,this._cameraWorldRotation=new _n,this._forward=new Ki,this._up=new Ki,this._previewSphere=null,this._previewPlane=null,this._probeId=e}var t=e.prototype;return t.initialize=function(e,t){this._node=e,this._cameraNode=t;var i=this.node.getWorldPosition();this._boundingBox=_s.create(i.x,i.y,i.z,this._size.x,this._size.y,this._size.z),this._createCamera(t)},t.initBakedTextures=function(){if(0===this.bakedCubeTextures.length)for(var e=0;e<6;e++){var t=this._createTargetTexture(this._resolution,this._resolution);this.bakedCubeTextures.push(t)}},t.captureCubemap=function(){this.initBakedTextures(),this._resetCameraParams(),this._needRender=!0},t.renderPlanarReflection=function(e){if(e){if(!this.realtimePlanarTexture){var t=v.view.getDesignResolutionSize();this.realtimePlanarTexture=this._createTargetTexture(t.width,t.height),v.internal.reflectionProbeManager.updatePlanarMap(this,this.realtimePlanarTexture.getGFXTexture())}this._syncCameraParams(e),this._transformReflectionCamera(e),this._needRender=!0}},t.switchProbeType=function(e,t){e===gb.CUBE?this._needRender=!1:null!==t&&this.renderPlanarReflection(t)},t.getProbeId=function(){return this._probeId},t.renderArea=function(){return this._probeType===gb.PLANAR?new Rn(this.realtimePlanarTexture.width,this.realtimePlanarTexture.height):new Rn(this.resolution,this.resolution)},t.isFinishedRendering=function(){return!0},t.validate=function(){return null!==this.cubemap},t.destroy=function(){this._camera&&(this._camera.destroy(),this._camera=null);for(var e=0;e<this.bakedCubeTextures.length;e++)this.bakedCubeTextures[e].destroy();this.bakedCubeTextures=[],this.realtimePlanarTexture&&(this.realtimePlanarTexture.destroy(),this.realtimePlanarTexture=null)},t.enable=function(){},t.disable=function(){},t.updateCameraDir=function(e){this.cameraNode.setRotationFromEuler(Pb[e]),this.camera.update(!0)},t.updateBoundingBox=function(){if(this.node){this.node.updateWorldTransform();var e=this.node.getWorldPosition();_s.set(this._boundingBox,e.x,e.y,e.z,this._size.x,this._size.y,this._size.z)}},t.hasFrameBuffer=function(e){if(0===this.bakedCubeTextures.length)return!1;for(var t=0;t<this.bakedCubeTextures.length;t++){var i;if((null===(i=this.bakedCubeTextures[t].window)||void 0===i?void 0:i.framebuffer)===e)return!0}return!1},t._syncCameraParams=function(e){this.camera.projectionType=e.projectionType,this.camera.orthoHeight=e.orthoHeight,this.camera.nearClip=e.nearClip,this.camera.farClip=e.farClip,this.camera.fov=e.fov,this.camera.visibility=e.visibility,this.camera.clearFlag=e.clearFlag,this.camera.clearColor=e.clearColor,this.camera.priority=e.priority-1,this.camera.resize(e.width,e.height)},t._createCamera=function(e){if(v.director.root,!this._camera){if(this._camera=v.director.root.createCamera(),!this._camera)return null;this._camera.initialize({name:e.name,node:e,projection:TI.PERSPECTIVE,window:v.director.root&&v.director.root.tempWindow,priority:0,cameraType:wI.DEFAULT,trackingType:II.NO_TRACKING})}return this._camera.setViewportInOrientedSpace(new Pn(0,0,1,1)),this._camera.fovAxis=EI.VERTICAL,this._camera.fov=bi(90),this._camera.orthoHeight=10,this._camera.nearClip=1,this._camera.farClip=1e3,this._camera.clearColor=this._backgroundColor,this._camera.clearDepth=1,this._camera.clearStencil=0,this._camera.clearFlag=this._clearFlag,this._camera.visibility=this._visibility,this._camera.aperture=AI.F16_0,this._camera.shutter=RI.D125,this._camera.iso=SI.ISO100,this._camera},t._resetCameraParams=function(){this.camera.projectionType=TI.PERSPECTIVE,this.camera.orthoHeight=10,this.camera.nearClip=1,this.camera.farClip=1e3,this.camera.fov=bi(90),this.camera.priority=0,this.camera.resize(this.resolution,this.resolution),this.camera.visibility=this._visibility,this.camera.clearFlag=this._clearFlag,this.camera.clearColor=this._backgroundColor,this.cameraNode.worldPosition=this.node.worldPosition,this.cameraNode.worldRotation=this.node.worldRotation,this.camera.update(!0)},t._createTargetTexture=function(e,t){var i=new Eb;return i.reset({width:e,height:t}),i},t._transformReflectionCamera=function(e){var t=Ki.dot(this.node.worldPosition,Ki.UP);this._reflect(this._cameraWorldPos,e.node.worldPosition,Ki.UP,t),this.cameraNode.worldPosition=this._cameraWorldPos,Ki.transformQuat(this._forward,Ki.FORWARD,e.node.worldRotation),this._reflect(this._forward,this._forward,Ki.UP,0),this._forward.normalize(),this._forward.negative(),Ki.transformQuat(this._up,Ki.UP,e.node.worldRotation),this._reflect(this._up,this._up,Ki.UP,0),this._up.normalize(),_n.fromViewUp(this._cameraWorldRotation,this._forward,this._up),this.cameraNode.worldRotation=this._cameraWorldRotation,this.camera.update(!0);var i=new zi(Ki.UP.x,Ki.UP.y,Ki.UP.z,-Ki.dot(Ki.UP,this.node.worldPosition));i.transformMat4(this.camera.matView.clone().invert().transpose()),this.camera.calculateObliqueMat(i)},t._reflect=function(e,t,i,n){var r=Ki.clone(i);r.normalize();var s=Ki.dot(r,t)-n;return r.multiplyScalar(2*s),Ki.subtract(e,t,r),e},n(e,[{key:"probeType",get:function(){return this._probeType},set:function(e){this._probeType=e}},{key:"resolution",get:function(){return this._resolution},set:function(e){e!==this._resolution&&this.bakedCubeTextures.forEach((function(t){t.resize(e,e)})),this._resolution=e}},{key:"clearFlag",get:function(){return this._clearFlag},set:function(e){this._clearFlag=e,this.camera.clearFlag=this._clearFlag}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this.camera.clearColor=this._backgroundColor}},{key:"visibility",get:function(){return this._visibility},set:function(e){this._visibility=e,this._camera.visibility=this._visibility}},{key:"size",get:function(){return this._size},set:function(e){this._size.set(e);var t=this.node.getWorldPosition();_s.set(this._boundingBox,t.x,t.y,t.z,this._size.x,this._size.y,this._size.z)}},{key:"cubemap",get:function(){return this._cubemap},set:function(e){this._cubemap=e}},{key:"node",get:function(){return this._node}},{key:"camera",get:function(){return this._camera}},{key:"needRefresh",get:function(){return this._needRefresh},set:function(e){this._needRefresh=e}},{key:"needRender",get:function(){return this._needRender},set:function(e){this._needRender=e}},{key:"boundingBox",get:function(){return this._boundingBox}},{key:"cameraNode",get:function(){return this._cameraNode},set:function(e){this._cameraNode=e}},{key:"previewSphere",get:function(){return this._previewSphere},set:function(e){this._previewSphere=e}},{key:"previewPlane",get:function(){return this._previewPlane},set:function(e){this._previewPlane=e}}]),e}()),e("c6",function(){function e(){this.screenUsagePercentage=1,this._models=[]}var t=e.prototype;return t.addModel=function(e){this._models.splice(0,0,e)},t.eraseModel=function(e){var t=this._models.indexOf(e);t>=0&&this._models.splice(t,1)},t.clearModels=function(){this._models.length=0},n(e,[{key:"models",get:function(){return this._models}}]),e}()),e("c7",function(){function e(){this.scene=void 0,this.node=null,this._device=void 0,this.enabled=!0,this._localBoundaryCenter=new Ki(0,0,0),this._objectSize=1,this._lodDataArray=[],this._lockedLODLevelVec=[],this._isLockLevelChanged=!1,this._device=gd.gfxDevice}var t=e.prototype;return t.attachToScene=function(e){this.scene=e},t.detachFromScene=function(){this.scene=null},t.lockLODLevels=function(e){if(e.length!==this._lockedLODLevelVec.length)this._isLockLevelChanged=!0;else for(var t=e.length,i=0;i<t;i++)if(e[i]!==this._lockedLODLevelVec[i]){this._isLockLevelChanged=!0;break}this._lockedLODLevelVec=e},t.isLockLevelChanged=function(){return this._isLockLevelChanged},t.resetLockChangeFlag=function(){this._isLockLevelChanged=!1},t.getLockedLODLevels=function(){return this._lockedLODLevelVec},t.clearLODs=function(){this._lodDataArray.length=0},t.insertLOD=function(e,t){this._lodDataArray.splice(e,0,t)},t.updateLOD=function(e,t){this._lodDataArray[e]=t},t.eraseLOD=function(e){this._lodDataArray.splice(e,1)},t.getVisibleLODLevel=function(e){for(var t=this.getScreenUsagePercentage(e),i=-1,n=0;n<this.lodCount;++n)if(t>=this.lodDataArray[n].screenUsagePercentage){i=n;break}return i},t.getScreenUsagePercentage=function(e){return this.node?(e.projectionType===TI.PERSPECTIVE&&(t=Ki.len(this.localBoundaryCenter.transformMat4(this.node.worldMatrix).subtract(e.node.worldPosition))),this.distanceToScreenUsagePercentage(e,t,this.getWorldSpaceSize())):0;var t},t.distanceToScreenUsagePercentage=function(e,t,i){return e.projectionType===TI.PERSPECTIVE?i*e.matProj.m05/(2*t):i*e.matProj.m05*.5},t.getWorldSpaceSize=function(){var e=this.node.scale;return Math.max(Math.abs(e.x),Math.abs(e.y),Math.abs(e.z))*this.objectSize},n(e,[{key:"localBoundaryCenter",get:function(){return this._localBoundaryCenter.clone()},set:function(e){this._localBoundaryCenter.set(e)}},{key:"lodCount",get:function(){return this._lodDataArray.length}},{key:"objectSize",get:function(){return this._objectSize},set:function(e){this._objectSize=e}},{key:"lodDataArray",get:function(){return this._lodDataArray}}]),e}()),function(e){e[e.PER_INSTANCE=0]="PER_INSTANCE",e[e.PER_BATCH=1]="PER_BATCH",e[e.PER_PHASE=2]="PER_PHASE",e[e.PER_PASS=3]="PER_PASS",e[e.COUNT=4]="COUNT"}(Tb||(Tb={})),function(e){e[e.CONSTANTS=0]="CONSTANTS",e[e.CBV=1]="CBV",e[e.UAV=2]="UAV",e[e.SRV=3]="SRV",e[e.TABLE=4]="TABLE",e[e.SSV=5]="SSV"}(Ab||(Ab={})),function(e){e[e.MANAGED=0]="MANAGED",e[e.MEMORYLESS=1]="MEMORYLESS",e[e.PERSISTENT=2]="PERSISTENT",e[e.EXTERNAL=3]="EXTERNAL",e[e.BACKBUFFER=4]="BACKBUFFER"}(Sb||(Sb={})),function(e){e[e.NONE=0]="NONE",e[e.RENDER_OPAQUE=1]="RENDER_OPAQUE",e[e.RENDER_CUTOUT=2]="RENDER_CUTOUT",e[e.RENDER_TRANSPARENT=3]="RENDER_TRANSPARENT"}(Rb||(Rb={})),function(e){e[e.BUFFER=0]="BUFFER",e[e.TEXTURE1D=1]="TEXTURE1D",e[e.TEXTURE2D=2]="TEXTURE2D",e[e.TEXTURE3D=3]="TEXTURE3D"}(wb||(wb={})),function(e){e[e.NONE=0]="NONE",e[e.UNIFORM=1]="UNIFORM",e[e.INDIRECT=2]="INDIRECT",e[e.STORAGE=4]="STORAGE",e[e.SAMPLED=8]="SAMPLED",e[e.COLOR_ATTACHMENT=16]="COLOR_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=32]="DEPTH_STENCIL_ATTACHMENT",e[e.INPUT_ATTACHMENT=64]="INPUT_ATTACHMENT"}(Ib||(Ib={})),function(e){e[e.SYNC=0]="SYNC",e[e.ASYNC=1]="ASYNC"}(bb||(bb={})),function(e){e[e.NONE=0]="NONE",e[e.OPAQUE_OBJECT=1]="OPAQUE_OBJECT",e[e.CUTOUT_OBJECT=2]="CUTOUT_OBJECT",e[e.TRANSPARENT_OBJECT=4]="TRANSPARENT_OBJECT",e[e.SHADOW_CASTER=8]="SHADOW_CASTER",e[e.UI=16]="UI",e[e.DEFAULT_LIGHTING=32]="DEFAULT_LIGHTING",e[e.VOLUMETRIC_LIGHTING=64]="VOLUMETRIC_LIGHTING",e[e.CLUSTERED_LIGHTING=128]="CLUSTERED_LIGHTING",e[e.PLANAR_SHADOW=256]="PLANAR_SHADOW",e[e.GEOMETRY=512]="GEOMETRY",e[e.PROFILER=1024]="PROFILER",e[e.DRAW_INSTANCING=2048]="DRAW_INSTANCING",e[e.DRAW_NON_INSTANCING=4096]="DRAW_NON_INSTANCING",e[e.REFLECTION_PROBE=8192]="REFLECTION_PROBE",e[e.ALL=4294967295]="ALL"}(Ob||(Ob={})),function(e){e[e.NONE=0]="NONE",e[e.DEFAULT=1]="DEFAULT",e[e.CLUSTERED=2]="CLUSTERED"}(Nb||(Nb={})),function(e){e[e.RENDER_TARGET=0]="RENDER_TARGET",e[e.DEPTH_STENCIL=1]="DEPTH_STENCIL"}(Cb||(Cb={})),function(e){e[e.READ=0]="READ",e[e.READ_WRITE=1]="READ_WRITE",e[e.WRITE=2]="WRITE"}(Mb||(Mb={}));var Lb,xb=function(e,t,i,n,r,s,a){void 0===e&&(e=""),void 0===t&&(t=Mb.WRITE),void 0===i&&(i=Cb.RENDER_TARGET),void 0===n&&(n=nl.LOAD),void 0===r&&(r=rl.STORE),void 0===s&&(s=vl.ALL),void 0===a&&(a=new Dl),this.slotName=void 0,this.accessType=void 0,this.attachmentType=void 0,this.loadOp=void 0,this.storeOp=void 0,this.clearFlags=void 0,this.clearColor=void 0,this.slotID=0,this.slotName=e,this.accessType=t,this.attachmentType=i,this.loadOp=n,this.storeOp=r,this.clearFlags=s,this.clearColor=a};!function(e){e[e.FLOAT_TYPE=0]="FLOAT_TYPE",e[e.INT_TYPE=1]="INT_TYPE"}(Lb||(Lb={}));var Db,Fb,Bb=function(e,t,i,n,r){void 0===e&&(e=""),void 0===t&&(t=Mb.READ),void 0===i&&(i=vl.NONE),void 0===n&&(n=new Dl),void 0===r&&(r=Lb.FLOAT_TYPE),this.name=void 0,this.accessType=void 0,this.clearFlags=void 0,this.clearColor=void 0,this.clearValueType=void 0,this.name=e,this.accessType=t,this.clearFlags=i,this.clearColor=n,this.clearValueType=r},Ub=function(e,t){void 0===e&&(e=null),void 0===t&&(t=0),this.light=void 0,this.level=void 0,this.light=e,this.level=t};!function(e){e[e.UNIFORM_BUFFER=0]="UNIFORM_BUFFER",e[e.DYNAMIC_UNIFORM_BUFFER=1]="DYNAMIC_UNIFORM_BUFFER",e[e.SAMPLER_TEXTURE=2]="SAMPLER_TEXTURE",e[e.SAMPLER=3]="SAMPLER",e[e.TEXTURE=4]="TEXTURE",e[e.STORAGE_BUFFER=5]="STORAGE_BUFFER",e[e.DYNAMIC_STORAGE_BUFFER=6]="DYNAMIC_STORAGE_BUFFER",e[e.STORAGE_IMAGE=7]="STORAGE_IMAGE",e[e.INPUT_ATTACHMENT=8]="INPUT_ATTACHMENT"}(Db||(Db={})),se(wf.prototype,"TextureBase.prototype",[{name:"hasPremultipliedAlpha"},{name:"setPremultiplyAlpha"},{name:"setFlipY"}]),re(Eb.prototype,"RenderTexture.prototype",[{name:"getGFXWindow",customFunction:function(){return this._window}}]);var Gb,kb=((Fb={})[Bc.UNORM]="Uint",Fb[Bc.SNORM]="Int",Fb[Bc.UINT]="Uint",Fb[Bc.INT]="Int",Fb[Bc.UFLOAT]="Float",Fb[Bc.FLOAT]="Float",Fb.default="Uint",Fb);function Hb(e){return""+(kb[e.type]||kb.default)+e.size/e.count*8}function zb(e,t,i,n,r,s,a){void 0===i&&(i=Fc.R32F),void 0===n&&(n=0),void 0===r&&(r=e.byteLength-n),void 0===s&&(s=0),a||(a=new DataView(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)));var o=b_[i];s||(s=o.size);for(var u="set"+Hb(o),h="get"+Hb(o),c=o.size/o.count,l=Math.floor(r/s),_=Ec.isLittleEndian,d=0;d<l;++d)for(var f=n+s*d,p=0;p<o.count;++p){var m=f+c*p,g=e[h](m,_);a[u](m,t(g,p,e),_)}return a}e("cs",function(){function e(e,t,i,n,r,s){void 0===n&&(n=null),void 0===r&&(r=null),void 0===s&&(s=!0),this.mesh=void 0,this.subMeshIdx=void 0,this._flatBuffers=[],this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0,this._vertexIdChannel=void 0,this._geometricInfo=void 0,this._vertexBuffers=void 0,this._attributes=void 0,this._indexBuffer=null,this._indirectBuffer=null,this._primitiveMode=void 0,this._iaInfo=void 0,this._isOwnerOfIndexBuffer=!0,this._drawInfo=null,this._attributes=t,this._vertexBuffers=e,this._indexBuffer=n,this._indirectBuffer=r,this._primitiveMode=i,this._iaInfo=new r_(t,e,n,r),this._isOwnerOfIndexBuffer=s}var t=e.prototype;return t.invalidateGeometricInfo=function(){this._geometricInfo=void 0},t.genFlatBuffers=function(){if(!this._flatBuffers.length&&this.mesh&&void 0!==this.subMeshIdx){var e=this.mesh,t=0,i=e.struct.primitives[this.subMeshIdx];i.indexView&&(t=i.indexView.count);for(var n=0;n<i.vertexBundelIndices.length;n++){var r=i.vertexBundelIndices[n],s=e.struct.vertexBundles[r],a=i.indexView?i.indexView.count:s.view.count,o=s.view.stride,u=o*a,h=new Uint8Array(e.data.buffer,s.view.offset,s.view.length),c=new Uint8Array(i.indexView?u:s.view.length);if(i.indexView){for(var l=e.readIndices(this.subMeshIdx),_=0;_<t;++_)for(var d=_*o,f=l[_]*o,p=0;p<o;++p)c[d+p]=h[f+p];this._flatBuffers.push({stride:o,count:a,buffer:c})}else c.set(e.data.subarray(s.view.offset,s.view.offset+s.view.length)),this._flatBuffers.push({stride:o,count:a,buffer:c})}}},t.destroy=function(){for(var e=0;e<this.vertexBuffers.length;e++)this.vertexBuffers[e].destroy();if(this.vertexBuffers.length=0,this._indexBuffer&&(this._isOwnerOfIndexBuffer&&this._indexBuffer.destroy(),this._indexBuffer=null),this._jointMappedBuffers&&this._jointMappedBufferIndices){for(var t=0;t<this._jointMappedBufferIndices.length;t++)this._jointMappedBuffers[this._jointMappedBufferIndices[t]].destroy();this._jointMappedBuffers=void 0,this._jointMappedBufferIndices=void 0}this._indirectBuffer&&(this._indirectBuffer.destroy(),this._indirectBuffer=null)},t.enableVertexIdChannel=function(e){if(!this._vertexIdChannel){var t=this.vertexBuffers.length,i=this.attributes.length,n=this._allocVertexIdBuffer(e);this._vertexBuffers.push(n),this._attributes.push(new i_("a_vertexId",Fc.R32F,!1,t)),this._iaInfo.attributes=this._attributes,this._iaInfo.vertexBuffers=this._vertexBuffers,this._vertexIdChannel={stream:t,index:i}}},t._allocVertexIdBuffer=function(e){for(var t=0===this.vertexBuffers.length||0===this.vertexBuffers[0].stride?0:this.vertexBuffers[0].size/this.vertexBuffers[0].stride,i=new Float32Array(t),n=0;n<t;++n)i[n]=n+.5;var r=e.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE,i.byteLength,i.BYTES_PER_ELEMENT));return r.update(i),r},n(e,[{key:"attributes",get:function(){return this._attributes}},{key:"vertexBuffers",get:function(){return this._vertexBuffers}},{key:"indexBuffer",get:function(){return this._indexBuffer}},{key:"indirectBuffer",get:function(){return this._indirectBuffer}},{key:"primitiveMode",get:function(){return this._primitiveMode}},{key:"geometricInfo",get:function(){if(this._geometricInfo)return this._geometricInfo;if(void 0===this.mesh)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Ki.ZERO,max:Ki.ZERO}};if(void 0===this.subMeshIdx)return{positions:new Float32Array,indices:new Uint8Array,boundingBox:{min:Ki.ZERO,max:Ki.ZERO}};var e=this.mesh,t=this.subMeshIdx,i=e.readAttribute(t,Al.ATTR_POSITION),n=e.readIndices(t),r=new Ki,s=new Ki,a=this.attributes.find((function(e){return e.name===Al.ATTR_POSITION}));if(a){var o=b_[a.format].count;2===o?(r.set(i[0],i[1],0),s.set(i[0],i[1],0)):(r.set(i[0],i[1],i[2]),s.set(i[0],i[1],i[2]));for(var u=0;u<i.length;u+=o)2===o?(r.x=i[u]>r.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,s.x=i[u]<s.x?i[u]:s.x,s.y=i[u+1]<s.y?i[u+1]:s.y):(r.x=i[u]>r.x?i[u]:r.x,r.y=i[u+1]>r.y?i[u+1]:r.y,r.z=i[u+2]>r.z?i[u+2]:r.z,s.x=i[u]<s.x?i[u]:s.x,s.y=i[u+1]<s.y?i[u+1]:s.y,s.z=i[u+2]<s.z?i[u+2]:s.z)}return this._geometricInfo={positions:i,indices:n,boundingBox:{max:r,min:s}},this._geometricInfo}},{key:"drawInfo",get:function(){return this._drawInfo},set:function(e){this._drawInfo=e}},{key:"flatBuffers",get:function(){return this._flatBuffers}},{key:"jointMappedBuffers",get:function(){var e=this;if(this._jointMappedBuffers)return this._jointMappedBuffers;var t=this._jointMappedBuffers=[],i=this._jointMappedBufferIndices=[];if(!this.mesh||void 0===this.subMeshIdx)return this._jointMappedBuffers=this.vertexBuffers;var n,r,s=this.mesh.struct,a=s.primitives[this.subMeshIdx];if(!s.jointMaps||void 0===a.jointMapIndex||!s.jointMaps[a.jointMapIndex])return this._jointMappedBuffers=this.vertexBuffers;for(var o=v.director.root.device,u=0;u<a.vertexBundelIndices.length;u++){var h=s.vertexBundles[a.vertexBundelIndices[u]];r=0,n=Fc.UNKNOWN;for(var c=0;c<h.attributes.length;c++){var l=h.attributes[c];if(l.name===Al.ATTR_JOINTS){n=l.format;break}r+=b_[l.format].size}n?function(){var c=new Uint8Array(e.mesh.data.buffer,h.view.offset,h.view.length),l=new DataView(c.slice().buffer),_=s.jointMaps[a.jointMapIndex];zb(l,(function(e){return _.indexOf(e)}),n,r,h.view.length,h.view.stride,l);var d=o.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE,h.view.length,h.view.stride));d.update(l.buffer),t.push(d),i.push(u)}():t.push(this.vertexBuffers[a.vertexBundelIndices[u]])}return this._vertexIdChannel&&t.push(this._allocVertexIdBuffer(o)),t}},{key:"iaInfo",get:function(){return this._iaInfo}}]),e}()),function(e){e[e.NONE=0]="NONE",e[e.FXAA=1]="FXAA",e[e.FXAAHQ=2]="FXAAHQ"}(Gb||(Gb={}));var Vb=[];function Wb(e){return Vb.includes(e)||Vb.push(e),Vb.indexOf(e)}function jb(e,t){var i=nl.CLEAR;return e&vl.COLOR||t!==Cb.RENDER_TARGET||(i=e&DI?nl.CLEAR:nl.LOAD),(e&vl.DEPTH_STENCIL)!==vl.DEPTH_STENCIL&&t===Cb.DEPTH_STENCIL&&(e&vl.DEPTH||(i=nl.LOAD),e&vl.STENCIL||(i=nl.LOAD)),i}function Xb(e,t,i,n,r){void 0===n&&(n=null),void 0===r&&(r=0);var s=new bl,a=e?e.viewport:new bl(0,0,1,1),o=t,u=i;if(s.x=a.x*o,s.y=a.y*u,s.width=a.width*o,s.height=a.height*u,n)switch(n.type){case JI.DIRECTIONAL:var h=n;if(h.shadowFixedArea||h.csmLevel===oT.LEVEL_1)s.x=0,s.y=0,s.width=o,s.height=u;else{var c=v.director.root.device.capabilities.screenSpaceSignY;s.x=r%2*.5*o,s.y=c?.5*(1-Math.floor(r/2))*u:.5*Math.floor(r/2)*u,s.width=.5*o,s.height=.5*u}break;case JI.SPOT:s.x=0,s.y=0,s.width=o,s.height=u}return s}var Kb=function(){function e(e){void 0===e&&(e=Gb.NONE),this.antiAliasing=Gb.NONE,this.antiAliasing=e,this._init()}return e.prototype._init=function(){this.postMaterial=new nT,this.postMaterial.name="builtin-post-process-material",Rt.ENABLE_ANTIALIAS_FXAA&&(this.antiAliasing=Gb.FXAA),this.postMaterial.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this.antiAliasing}});for(var e=0;e<this.postMaterial.passes.length;++e)this.postMaterial.passes[e].tryCompile()},e}(),Yb=null;function qb(e,t,i,n,r,s,a){var o=s,u=a,h=Xb(i,s,a,n,r);s=h.width,a=h.height;var c=t.device,l=e;if(!t.containsResource(l)){var _=Iv(c)?Fc.R32F:Fc.RGBA8;t.addRenderTarget(l,_,o,u,Sb.MANAGED),t.addDepthStencil(l+"Depth",Fc.DEPTH_STENCIL,o,u,Sb.MANAGED)}t.updateRenderTarget(l,o,u),t.updateDepthStencil(l+"Depth",o,u);var d=t.addRasterPass(s,a,"default");d.name=e,d.setViewport(new xl(h.x,h.y,h.width,h.height)),d.addRasterView(l,new xb("_",Mb.WRITE,Cb.RENDER_TARGET,nl.CLEAR,rl.STORE,vl.COLOR,new Dl(1,1,1,i.clearColor.w))),d.addRasterView(l+"Depth",new xb("_",Mb.WRITE,Cb.DEPTH_STENCIL,nl.CLEAR,rl.DISCARD,vl.DEPTH_STENCIL,new Dl(i.clearDepth,i.clearStencil,0,0))),d.addQueue(Rb.RENDER_OPAQUE).addSceneOfCamera(i,new Ub(n,r),Ob.SHADOW_CASTER)}var Qb=function(){this.shadowEnabled=!1,this.mainLightShadowNames=new Array,this.spotLightShadowNames=new Array};function Zb(e,t,i){!function(e,t){var i=e.pipelineSceneData.validPunctualLights;i.length=0;for(var n=lr.create(0,0,0,1),r=t.scene.spotLights,s=0;s<r.length;s++){var a=r[s];a.baked||(lr.set(n,a.position.x,a.position.y,a.position.z,a.range),$r.sphereFrustum(n,t.frustum)&&i.push(a))}for(var o=t.scene.sphereLights,u=0;u<o.length;u++){var h=o[u];h.baked||(lr.set(n,h.position.x,h.position.y,h.position.z,h.range),$r.sphereFrustum(n,t.frustum)&&i.push(h))}}(i,t);var n=i,r=n.pipelineSceneData.shadows,s=i.pipelineSceneData.validPunctualLights,a=new Qb,o=i.pipelineSceneData.shadows;if(!r.enabled||r.type!==sT.ShadowMap)return a;a.shadowEnabled=!0;for(var u=[],h=0,c=0;h<r.maxReceived&&c<s.length;){var l=s[c];l.type===JI.SPOT&&l.shadowEnabled&&(u.push(l),h++),c++}var _=t.scene.mainLight,d=o.size.x,f=o.size.y;if(_&&_.shadowEnabled)if(a.mainLightShadowNames[0]="MainLightShadow"+e,_.shadowFixedArea)qb(a.mainLightShadowNames[0],i,t,_,0,d,f);else for(var p=n.pipelineSceneData.csmSupported?_.csmLevel:1,m=0;m<p;m++)a.mainLightShadowNames[m]="MainLightShadow"+e,qb(a.mainLightShadowNames[m],i,t,_,m,d,f);for(var g=0;g<u.length;g++){var v=u[g],y="SpotLightShadow"+g.toString()+e;a.spotLightShadowNames[g]=y,qb(y,i,t,v,0,d,f)}return a}var Jb=function(){},$b=function(){function e(){this._init()}return e.prototype._init=function(){this.deferredLightingMaterial=new nT,this.deferredLightingMaterial.name="builtin-deferred-material",this.deferredLightingMaterial.initialize({effectName:"pipeline/deferred-lighting",defines:{CC_RECEIVE_SHADOW:1}});for(var e=0;e<this.deferredLightingMaterial.passes.length;++e)this.deferredLightingMaterial.passes[e].tryCompile()},e}(),eO=null;function tO(e,t){for(var i,n=d(t.descriptorSetLayoutData.descriptorBlocks);!(i=n()).done;)for(var r=i.value,s=0;s!==r.descriptors.length;++s)if(e===r.descriptors[s].descriptorID)return r.offset+s;return-1}function iO(e){for(var t,i=v.director.root.pipeline.layoutGraph,n=i.vertices(),r=i.attributeIndex.get(e),s=d(n);!(t=s()).done;)for(var a,o=t.value,u=d(i.getLayout(o).descriptorSets);!(a=u()).done;)for(var h,c=a.value,l=(c[0],c[1]),_=d(l.descriptorSetLayoutData.descriptorBlocks);!(h=_()).done;)for(var f,p=d(h.value.descriptors);!(f=p()).done;)if(f.value.descriptorID===r)return tO(r,l);return-1}var nO=new Map;function rO(e){var t=nO.get(e);if(t)return t;var i=v.director.root.pipeline,n=i.layoutGraph.locateChild(i.layoutGraph.nullVertex(),e);H(4294967295!==n);var r=i.layoutGraph.getLayout(n).descriptorSets.get(Tb.PER_PASS);return nO.set(e,r),r}var sO,aO,oO,uO,hO,cO=new Xl(qc.LINEAR,qc.LINEAR,qc.NONE,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP),lO=new Xl(qc.POINT,qc.POINT,qc.NONE,Qc.CLAMP,Qc.CLAMP,Qc.CLAMP),_O=function(){function e(e){this._device=void 0,this._descriptorSetMap=new Map,this._globalDescriptorSet=void 0,this._descriptorSetLayout=void 0,this._linearSampler=void 0,this._pointSampler=void 0,this._device=e,this._linearSampler=this._device.getSampler(cO),this._pointSampler=this._device.getSampler(lO);var t=new p_(eg.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(t),this._globalDescriptorSet=this._device.createDescriptorSet(new m_(this._descriptorSetLayout))}var t=e.prototype;return t.regenLayout=function(){var e=new p_(eg.bindings);this._descriptorSetLayout=this._device.createDescriptorSetLayout(e),this._globalDescriptorSet=this._device.createDescriptorSet(new m_(this._descriptorSetLayout))},t.bindBuffer=function(e,t){this._globalDescriptorSet.bindBuffer(e,t);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindBuffer(e,t),n=i.next()},t.bindSampler=function(e,t){this._globalDescriptorSet.bindSampler(e,t);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindSampler(e,t),n=i.next()},t.bindTexture=function(e,t){this._globalDescriptorSet.bindTexture(e,t);for(var i=this._descriptorSetMap.values(),n=i.next();!n.done;)n.value.bindTexture(e,t),n=i.next()},t.update=function(){this._globalDescriptorSet.update();for(var e=this._descriptorSetMap.values(),t=e.next();!t.done;)t.value.update(),t=e.next()},t.getOrCreateDescriptorSet=function(e){var t=this._device;if(!this._descriptorSetMap.has(e)){var i=bv()?rO("default").descriptorSet:this._globalDescriptorSet,n=t.createDescriptorSet(new m_(bv()?rO("default").descriptorSetLayout:this._descriptorSetLayout));this._descriptorSetMap.set(e,n);for(var r=$m.UBO_GLOBAL;r<$m.COUNT;r++)n.bindBuffer(r,i.getBuffer(r)),n.bindSampler(r,i.getSampler(r)),n.bindTexture(r,i.getTexture(r));var s=t.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,_g.SIZE,_g.SIZE)),a=bv()?iO("CCShadow"):_g.BINDING;n.bindBuffer(a,s),n.update()}return this._descriptorSetMap.get(e)},t.destroy=function(){this._descriptorSetLayout.destroy()},n(e,[{key:"descriptorSetMap",get:function(){return this._descriptorSetMap}},{key:"linearSampler",get:function(){return this._linearSampler}},{key:"pointSampler",get:function(){return this._pointSampler}},{key:"descriptorSetLayout",get:function(){return this._descriptorSetLayout}},{key:"globalDescriptorSet",get:function(){return this._globalDescriptorSet},set:function(e){this._globalDescriptorSet=e}}]),e}(),dO=e("h4",function(){function e(){this._singleMode=0,this._compositeModeValue=0,this._lightingWithAlbedo=!0,this._csmLayerColoration=!1,this._nativeConfig=null,this._activate()}var t=e.prototype;return t.isCompositeModeEnabled=function(e){return 0!=(this._compositeModeValue&1<<e)},t.enableCompositeMode=function(e,t){this._enableCompositeMode(e,t),this._updatePipeline()},t.enableAllCompositeMode=function(e){this._enableAllCompositeMode(e),this._updatePipeline()},t.isEnabled=function(){return 0!==this._getType()},t.reset=function(){this._activate(),this._updatePipeline()},t._activate=function(){this._singleMode=0,this._enableAllCompositeMode(!0),this._lightingWithAlbedo=!0,this._csmLayerColoration=!1},t._updatePipeline=function(){var e=v.director.root,t=e.pipeline,i=this._getType();t.macros.CC_USE_DEBUG_VIEW!==i&&(t.macros.CC_USE_DEBUG_VIEW=i,e.onGlobalPipelineStateChanged())},t._enableCompositeMode=function(e,t){t?this._compositeModeValue|=1<<e:this._compositeModeValue&=~(1<<e)},t._enableAllCompositeMode=function(e){for(var t=0;t<12;t++)e?this._compositeModeValue|=1<<t:this._compositeModeValue&=~(1<<t)},t._getType=function(){if(0!==this._singleMode)return 1;if(!0!==this._lightingWithAlbedo||!1!==this._csmLayerColoration)return 2;for(var e=0;e<12;e++)if(!this.isCompositeModeEnabled(e))return 2;return 0},n(e,[{key:"singleMode",get:function(){return this._singleMode},set:function(e){this._singleMode=e,this._updatePipeline()}},{key:"lightingWithAlbedo",get:function(){return this._lightingWithAlbedo},set:function(e){this._lightingWithAlbedo=e,this._updatePipeline()}},{key:"csmLayerColoration",get:function(){return this._csmLayerColoration},set:function(e){this._csmLayerColoration=e,this._updatePipeline()}}]),e}()),fO=new En,pO=new En,mO=new En,gO=new zi,vO=new zi(0,0,1,0),yO=new Ki,EO=function(){function e(){this._globalUBO=new Float32Array(cg.COUNT),this._cameraUBO=new Float32Array(lg.COUNT),this._shadowUBO=new Float32Array(_g.COUNT),this._csmUBO=new Float32Array(dg.COUNT)}e.updateGlobalUBOView=function(e,t){var i=v.director,n=i.root,r=t,s=Math.floor(e.width),a=Math.floor(e.height);r[cg.TIME_OFFSET]=n.cumulativeTime,r[cg.TIME_OFFSET+1]=n.frameTime,r[cg.TIME_OFFSET+2]=i.getTotalFrames(),r[cg.TIME_OFFSET+3]=n.cumulativeTime-Math.floor(n.frameTime),r[cg.SCREEN_SIZE_OFFSET]=s,r[cg.SCREEN_SIZE_OFFSET+1]=a,r[cg.SCREEN_SIZE_OFFSET+2]=1/s,r[cg.SCREEN_SIZE_OFFSET+3]=1/a,r[cg.NATIVE_SIZE_OFFSET]=s,r[cg.NATIVE_SIZE_OFFSET+1]=a,r[cg.NATIVE_SIZE_OFFSET+2]=1/r[cg.NATIVE_SIZE_OFFSET],r[cg.NATIVE_SIZE_OFFSET+3]=1/r[cg.NATIVE_SIZE_OFFSET+1];var o=n.debugView;if(o){r[cg.DEBUG_VIEW_MODE_OFFSET]=o.singleMode,r[cg.DEBUG_VIEW_MODE_OFFSET+1]=o.lightingWithAlbedo?1:0,r[cg.DEBUG_VIEW_MODE_OFFSET+2]=o.csmLayerColoration?1:0;for(var u=0;u<12;u++)r[cg.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET+u]=o.isCompositeModeEnabled(u)?1:0}else{r[cg.DEBUG_VIEW_MODE_OFFSET]=0,r[cg.DEBUG_VIEW_MODE_OFFSET+1]=1,r[cg.DEBUG_VIEW_MODE_OFFSET+2]=0;for(var h=0;h<12;h++)r[cg.DEBUG_VIEW_COMPOSITE_PACK_1_OFFSET+h]=1}},e.updateCameraUBOView=function(e,t,i){var n,r=(i.scene?i.scene:v.director.getScene().renderScene).mainLight,s=e.pipelineSceneData,a=s.ambient,o=s.skybox,u=s.fog,h=s.shadows,c=t,l=i.exposure,_=s.isHDR;if(c[lg.SCREEN_SCALE_OFFSET]=s.shadingScale,c[lg.SCREEN_SCALE_OFFSET+1]=s.shadingScale,c[lg.SCREEN_SCALE_OFFSET+2]=1/c[lg.SCREEN_SCALE_OFFSET],c[lg.SCREEN_SCALE_OFFSET+3]=1/c[lg.SCREEN_SCALE_OFFSET+1],c[lg.EXPOSURE_OFFSET]=l,c[lg.EXPOSURE_OFFSET+1]=1/l,c[lg.EXPOSURE_OFFSET+2]=_?1:0,c[lg.EXPOSURE_OFFSET+3]=1/BI.standardExposureValue,r){var d=r.shadowEnabled&&h.type===sT.ShadowMap?1:0,f=r.direction;if(vO.set(f.x,f.y,f.z,d),zi.toArray(c,vO,lg.MAIN_LIT_DIR_OFFSET),Ki.toArray(c,r.color,lg.MAIN_LIT_COLOR_OFFSET),r.useColorTemperature){var p=r.colorTemperatureRGB;c[lg.MAIN_LIT_COLOR_OFFSET]*=p.x,c[lg.MAIN_LIT_COLOR_OFFSET+1]*=p.y,c[lg.MAIN_LIT_COLOR_OFFSET+2]*=p.z}c[lg.MAIN_LIT_COLOR_OFFSET+3]=_?r.illuminance*l:r.illuminance}else vO.set(0,0,1,0),zi.toArray(c,vO,lg.MAIN_LIT_DIR_OFFSET),zi.toArray(c,zi.ZERO,lg.MAIN_LIT_COLOR_OFFSET);var m=a.skyColor;m.w=_?a.skyIllum*l:a.skyIllum,c[lg.AMBIENT_SKY_OFFSET+0]=m.x,c[lg.AMBIENT_SKY_OFFSET+1]=m.y,c[lg.AMBIENT_SKY_OFFSET+2]=m.z,c[lg.AMBIENT_SKY_OFFSET+3]=m.w,c[lg.AMBIENT_GROUND_OFFSET+0]=a.groundAlbedo.x,c[lg.AMBIENT_GROUND_OFFSET+1]=a.groundAlbedo.y,c[lg.AMBIENT_GROUND_OFFSET+2]=a.groundAlbedo.z,c[lg.AMBIENT_GROUND_OFFSET+3]=o.envmap?null===(n=o.envmap)||void 0===n?void 0:n.mipmapLevel:1,En.toArray(c,i.matView,lg.MAT_VIEW_OFFSET),En.toArray(c,i.node.worldMatrix,lg.MAT_VIEW_INV_OFFSET),Ki.toArray(c,i.position,lg.CAMERA_POS_OFFSET),En.toArray(c,i.matProj,lg.MAT_PROJ_OFFSET),En.toArray(c,i.matProjInv,lg.MAT_PROJ_INV_OFFSET),En.toArray(c,i.matViewProj,lg.MAT_VIEW_PROJ_OFFSET),En.toArray(c,i.matViewProjInv,lg.MAT_VIEW_PROJ_INV_OFFSET),c[lg.CAMERA_POS_OFFSET+3]=this.getCombineSignY(),c[lg.SURFACE_TRANSFORM_OFFSET]=i.surfaceTransform,c[lg.SURFACE_TRANSFORM_OFFSET+1]=i.cameraUsage,c[lg.SURFACE_TRANSFORM_OFFSET+2]=Math.cos(bi(s.skybox.getRotationAngle())),c[lg.SURFACE_TRANSFORM_OFFSET+3]=Math.sin(bi(s.skybox.getRotationAngle()));var g=u.colorArray;c[lg.GLOBAL_FOG_COLOR_OFFSET]=g.x,c[lg.GLOBAL_FOG_COLOR_OFFSET+1]=g.y,c[lg.GLOBAL_FOG_COLOR_OFFSET+2]=g.z,c[lg.GLOBAL_FOG_COLOR_OFFSET+3]=g.z,c[lg.GLOBAL_FOG_BASE_OFFSET]=u.fogStart,c[lg.GLOBAL_FOG_BASE_OFFSET+1]=u.fogEnd,c[lg.GLOBAL_FOG_BASE_OFFSET+2]=u.fogDensity,c[lg.GLOBAL_FOG_ADD_OFFSET]=u.fogTop,c[lg.GLOBAL_FOG_ADD_OFFSET+1]=u.fogRange,c[lg.GLOBAL_FOG_ADD_OFFSET+2]=u.fogAtten,c[lg.NEAR_FAR_OFFSET]=i.nearClip,c[lg.NEAR_FAR_OFFSET+1]=i.farClip,c[lg.VIEW_PORT_OFFSET]=s.shadingScale*i.window.width*i.viewport.x,c[lg.VIEW_PORT_OFFSET+1]=s.shadingScale*i.window.height*i.viewport.y,c[lg.VIEW_PORT_OFFSET+2]=s.shadingScale*i.window.width*i.viewport.z,c[lg.VIEW_PORT_OFFSET+3]=s.shadingScale*i.window.height*i.viewport.w},e.getPCFRadius=function(e,t){var i=e.size.x;switch(t.shadowPcf){case aT.HARD:return 0;case aT.SOFT:return 1/(.5*i);case aT.SOFT_2X:return 2/(.5*i);case aT.SOFT_4X:return 3/(.5*i)}return 0},e.updatePlanarNormalAndDistance=function(e,t){Ki.normalize(yO,e.normal),t[_g.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+0]=yO.x,t[_g.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+1]=yO.y,t[_g.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+2]=yO.z,t[_g.PLANAR_NORMAL_DISTANCE_INFO_OFFSET+3]=-e.distance},e.updateShadowUBOView=function(t,i,n,r){var s=t.device,a=r.scene.mainLight,o=t.pipelineSceneData,u=o.shadows,h=o.csmLayers,c=i,l=n,_=o.csmSupported,d=Iv(s)?0:1;if(a&&u.enabled){if(u.type===sT.ShadowMap){if(a.shadowEnabled){if(a.shadowFixedArea||a.csmLevel===oT.LEVEL_1||!_){var f=h.specialLayer.matShadowView,p=h.specialLayer.matShadowProj,m=h.specialLayer.matShadowViewProj,g=a.shadowNear,v=a.shadowFar;En.toArray(c,f,_g.MAT_LIGHT_VIEW_OFFSET),c[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,c[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,c[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,c[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,c[_g.SHADOW_PROJ_INFO_OFFSET+0]=p.m00,c[_g.SHADOW_PROJ_INFO_OFFSET+1]=p.m05,c[_g.SHADOW_PROJ_INFO_OFFSET+2]=1/p.m00,c[_g.SHADOW_PROJ_INFO_OFFSET+3]=1/p.m05,En.toArray(c,m,_g.MAT_LIGHT_VIEW_PROJ_OFFSET),gO.set(g,v,0,1-a.shadowSaturation),zi.toArray(c,gO,_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),gO.set(0,d,a.shadowNormalBias,0),zi.toArray(c,gO,_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}else{for(var y=this.getPCFRadius(u,a),E=0;E<a.csmLevel;E++){var T=h.layers[E],A=T.matShadowView;gO.set(A.m00,A.m04,A.m08,y),zi.toArray(l,gO,dg.CSM_VIEW_DIR_0_OFFSET+4*E),gO.set(A.m01,A.m05,A.m09,T.splitCameraNear),zi.toArray(l,gO,dg.CSM_VIEW_DIR_1_OFFSET+4*E),gO.set(A.m02,A.m06,A.m10,T.splitCameraFar),zi.toArray(l,gO,dg.CSM_VIEW_DIR_2_OFFSET+4*E);var S=T.csmAtlas;zi.toArray(l,S,dg.CSM_ATLAS_OFFSET+4*E);var R=T.matShadowViewProj;En.toArray(l,R,dg.MAT_CSM_VIEW_PROJ_OFFSET+16*E);var w=T.matShadowProj;l[dg.CSM_PROJ_DEPTH_INFO_OFFSET+0+4*E]=w.m10,l[dg.CSM_PROJ_DEPTH_INFO_OFFSET+1+4*E]=w.m14,l[dg.CSM_PROJ_DEPTH_INFO_OFFSET+2+4*E]=w.m11,l[dg.CSM_PROJ_DEPTH_INFO_OFFSET+3+4*E]=w.m15,l[dg.CSM_PROJ_INFO_OFFSET+0+4*E]=w.m00,l[dg.CSM_PROJ_INFO_OFFSET+1+4*E]=w.m05,l[dg.CSM_PROJ_INFO_OFFSET+2+4*E]=1/w.m00,l[dg.CSM_PROJ_INFO_OFFSET+3+4*E]=1/w.m05}gO.set(a.csmTransitionRange,0,0,0),zi.toArray(l,gO,dg.CSM_SPLITS_INFO_OFFSET),gO.set(.1,a.shadowDistance,0,1-a.shadowSaturation),zi.toArray(c,gO,_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),gO.set(0,d,a.shadowNormalBias,a.csmLevel),zi.toArray(c,gO,_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET)}gO.set(u.size.x,u.size.y,a.shadowPcf,a.shadowBias),zi.toArray(c,gO,_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}}else e.updatePlanarNormalAndDistance(u,c);en.toArray(c,u.shadowColor,_g.SHADOW_COLOR_OFFSET)}},e.updateShadowUBOLightView=function(e,t,i,n){var r=e.device,s=e.pipelineSceneData,a=s.shadows,o=s.csmLayers,u=t,h=Iv(r)?0:1,c=e.device.capabilities,l=s.csmSupported;switch(i.type){case JI.DIRECTIONAL:var _=i;if(a.enabled&&_&&_.shadowEnabled&&a.type===sT.ShadowMap){var d,f,p,m=.1,g=0,v=0;if(_.shadowFixedArea||_.csmLevel===oT.LEVEL_1||!l)d=o.specialLayer.matShadowView,f=o.specialLayer.matShadowProj,p=o.specialLayer.matShadowViewProj,_.shadowFixedArea?(m=_.shadowNear,g=_.shadowFar,v=0):(m=.1,g=o.specialLayer.shadowCameraFar,v=1),gO.set(0,h,_.shadowNormalBias,0),zi.toArray(u,gO,_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET);else{var y=o.layers[n];d=y.matShadowView,f=y.matShadowProj,p=y.matShadowViewProj,m=y.splitCameraNear,g=y.splitCameraFar,v=_.csmLevel}En.toArray(u,d,_g.MAT_LIGHT_VIEW_OFFSET),u[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=f.m10,u[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=f.m14,u[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=f.m11,u[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=f.m15,u[_g.SHADOW_PROJ_INFO_OFFSET+0]=f.m00,u[_g.SHADOW_PROJ_INFO_OFFSET+1]=f.m05,u[_g.SHADOW_PROJ_INFO_OFFSET+2]=1/f.m00,u[_g.SHADOW_PROJ_INFO_OFFSET+3]=1/f.m05,En.toArray(u,p,_g.MAT_LIGHT_VIEW_PROJ_OFFSET),gO.set(m,g,0,1-_.shadowSaturation),zi.toArray(u,gO,_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),gO.set(0,h,_.shadowNormalBias,v),zi.toArray(u,gO,_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET),gO.set(a.size.x,a.size.y,_.shadowPcf,_.shadowBias),zi.toArray(u,gO,_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET)}break;case JI.SPOT:var E=i;a.enabled&&E&&E.shadowEnabled&&(En.invert(fO,i.node.getWorldMatrix()),En.toArray(u,fO,_g.MAT_LIGHT_VIEW_OFFSET),En.perspective(pO,i.angle,1,.001,i.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0),En.multiply(mO,pO,fO),En.toArray(u,mO,_g.MAT_LIGHT_VIEW_PROJ_OFFSET),gO.set(.01,i.range,0,0),zi.toArray(u,gO,_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET),gO.set(a.size.x,a.size.y,E.shadowPcf,E.shadowBias),zi.toArray(u,gO,_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET),gO.set(1,h,E.shadowNormalBias,0),zi.toArray(u,gO,_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET))}en.toArray(u,a.shadowColor,_g.SHADOW_COLOR_OFFSET)},e.getCombineSignY=function(){return e._combineSignY};var t=e.prototype;return t._initCombineSignY=function(){var t=this._device;e._combineSignY=.5*t.capabilities.screenSpaceSignY+.5<<1|.5*t.capabilities.clipSpaceSignY+.5},t.activate=function(e,t){this._device=e,this._pipeline=t;var i=this._pipeline.descriptorSet;if(!bv()){this._initCombineSignY();var n=e.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,cg.SIZE,cg.SIZE));i.bindBuffer(cg.BINDING,n);var r=e.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,lg.SIZE,lg.SIZE));i.bindBuffer(lg.BINDING,r);var s=e.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,_g.SIZE,_g.SIZE)),a=bv()?iO("CCShadow"):_g.BINDING;i.bindBuffer(a,s);var o=e.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,dg.SIZE,dg.SIZE)),u=bv()?iO("CCCSM"):dg.BINDING;i.bindBuffer(u,o)}},t.updateGlobalUBO=function(t){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;n.update(),e.updateGlobalUBOView(t,this._globalUBO),r[0].updateBuffer(n.getBuffer(cg.BINDING),this._globalUBO),i.bindBuffer(cg.BINDING,n.getBuffer(cg.BINDING)),i.update()},t.updateCameraUBO=function(t){var i=this._pipeline.globalDSManager,n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers;e.updateCameraUBOView(this._pipeline,this._cameraUBO,t),r[0].updateBuffer(n.getBuffer(lg.BINDING),this._cameraUBO),i.bindBuffer(lg.BINDING,n.getBuffer(lg.BINDING)),i.update()},t.updateShadowUBO=function(t){var i=this._pipeline.pipelineSceneData;if(i.shadows.enabled){var n=this._pipeline.descriptorSet,r=this._pipeline.commandBuffers,s=i.shadowFrameBufferMap,a=t.scene.mainLight;a&&s.has(a)&&n.bindTexture(fg,s.get(a).colorTextures[0]),e.updateShadowUBOView(this._pipeline,this._shadowUBO,this._csmUBO,t),n.update();var o=bv()?iO("CCShadow"):_g.BINDING;r[0].updateBuffer(n.getBuffer(o),this._shadowUBO);var u=bv()?iO("CCCSM"):dg.BINDING;r[0].updateBuffer(n.getBuffer(u),this._csmUBO)}},t.updateShadowUBOLight=function(t,i,n){void 0===n&&(n=0),e.updateShadowUBOLightView(this._pipeline,this._shadowUBO,i,n),t.bindTexture(fg,PE.get("default-texture").getGFXTexture()),t.bindTexture(Sg,PE.get("default-texture").getGFXTexture()),t.update();var r=bv()?iO("CCShadow"):_g.BINDING;this._pipeline.commandBuffers[0].updateBuffer(t.getBuffer(r),this._shadowUBO)},t.updateShadowUBORange=function(e,t){t instanceof En?En.toArray(this._shadowUBO,t,e):t instanceof en&&en.toArray(this._shadowUBO,t,e)},t.destroy=function(){},e}();EO._combineSignY=0;var TO,AO,SO,RO,wO,IO,bO,OO,NO=e("gP",Gs("RenderStage")((aO=function(){function e(){this._name=oO&&oO(),this._priority=uO&&uO(),this._enabled=!0,this._tag=hO&&hO()}var t=e.prototype;return t.initialize=function(e){return this._name=e.name,this._priority=e.priority,e.tag&&(this._tag=e.tag),!0},t.activate=function(e,t){this._pipeline=e,this._flow=t},n(e,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"enabled",get:function(){return this._enabled},set:function(e){this._enabled=e}}]),e}(),oO=Cs(aO.prototype,"_name",[Ys],(function(){return""})),uO=Cs(aO.prototype,"_priority",[Ys],(function(){return 0})),hO=Cs(aO.prototype,"_tag",[Ys],(function(){return 0})),sO=aO))||sO);v.RenderStage=NO;var CO,MO=e("gO",(TO=Gs("RenderFlow"),AO=va([NO]),TO((RO=function(){function e(){this._name=wO&&wO(),this._priority=IO&&IO(),this._tag=bO&&bO(),this._stages=OO&&OO()}var t=e.prototype;return t.initialize=function(e){return this._name=e.name,this._priority=e.priority,this._stages=e.stages,e.tag&&(this._tag=e.tag),!0},t.activate=function(e){this._pipeline=e,this._stages.sort((function(e,t){return e.priority-t.priority}));for(var t=0,i=this._stages.length;t<i;t++)this._stages[t].activate(e,this)},t.render=function(e){for(var t=0,i=this._stages.length;t<i;t++)this._stages[t].enabled&&this._stages[t].render(e)},t.destroy=function(){for(var e=0,t=this._stages.length;e<t;e++)this._stages[e].destroy();this._stages.length=0},n(e,[{key:"name",get:function(){return this._name}},{key:"priority",get:function(){return this._priority}},{key:"tag",get:function(){return this._tag}},{key:"stages",get:function(){return this._stages}},{key:"pipeline",get:function(){return this._pipeline}}]),e}(),wO=Cs(RO.prototype,"_name",[Ys],(function(){return""})),IO=Cs(RO.prototype,"_priority",[Ys],(function(){return 0})),bO=Cs(RO.prototype,"_tag",[Ys],(function(){return 0})),OO=Cs(RO.prototype,"_stages",[AO,Ys],(function(){return[]})),SO=RO))||SO));v.RenderFlow=MO,function(e){e.RENDER_FRAME_BEGIN="render-frame-begin",e.RENDER_FRAME_END="render-frame-end",e.RENDER_CAMERA_BEGIN="render-camera-begin",e.RENDER_CAMERA_END="render-camera-end",e.ATTACHMENT_SCALE_CAHNGED="attachment-scale-changed"}(CO||(CO=e("h3",{})));var PO,LO,xO,DO,FO,BO,UO,GO,kO,HO,zO,VO,WO,jO,XO,KO,YO,qO,QO,ZO,JO,$O,eN,tN,iN,nN,rN,sN,aN,oN,uN,hN,cN,lN,_N,dN,fN,pN,mN,gN,vN,yN,EN,TN,AN,SN,RN,wN,IN,bN,ON,NN,CN,MN,PN,LN,xN,DN,FN,BN,UN,GN,kN,HN,zN,VN,WN,jN,XN,KN,YN,qN,QN,ZN,JN,$N,eC,tC,iC,nC,rC,sC,aC,oC,uC,hC,cC,lC,_C,dC,fC=e("h2",function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).eventTargetOn=e.prototype.on,t.eventTargetOnce=e.prototype.once,t}s(t,e);var i=t.prototype;return i.on=function(e,t,i,n){return this.eventTargetOn(e,t,i,n)},i.once=function(e,t,i){return this.eventTargetOnce(e,t,i)},t}(kh)),pC=new bl,mC=new xl,gC=function(){this.renderPass=null,this.sampler=null,this.prefiterTex=null,this.downsampleTexs=[],this.upsampleTexs=[],this.combineTex=null,this.prefilterFramebuffer=null,this.downsampleFramebuffers=[],this.upsampleFramebuffers=[],this.combineFramebuffer=null},vC=function(){this.quadIB=null,this.quadVB=null,this.quadIA=null},yC=e("gN",(PO=Gs("cc.RenderPipeline"),LO=va([MO]),PO((DO=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._tag=FO&&FO(),t._flows=BO&&BO(),t._quadIB=null,t._quadVBOnscreen=null,t._quadVBOffscreen=null,t._quadIAOnscreen=null,t._quadIAOffscreen=null,t._eventProcessor=new fC,t._commandBuffers=[],t._pipelineUBO=new EO,t._macros={},t._constantMacros="",t._profiler=null,t._geometryRenderer=null,t._pipelineRenderData=null,t._renderPasses=new Map,t._width=0,t._height=0,t._lastUsedRenderArea=new bl,t._clusterEnabled=!1,t._bloomEnabled=!1,t}s(t,e);var i=t.prototype;return i.getPipelineRenderData=function(){return this._pipelineRenderData},i.initialize=function(e){return this._flows=e.flows,e.tag&&(this._tag=e.tag),!0},i.createRenderPass=function(e,t,i){var n=this._device,r=new s_,s=new a_;r.format=t,s.format=i,s.stencilStoreOp=rl.DISCARD,s.depthStoreOp=rl.DISCARD,e&vl.COLOR||(e&DI?r.loadOp=nl.CLEAR:(r.loadOp=nl.LOAD,r.barrier=n.getGeneralBarrier(new c_(sl.COLOR_ATTACHMENT_WRITE,sl.COLOR_ATTACHMENT_WRITE)))),(e&vl.DEPTH_STENCIL)!==vl.DEPTH_STENCIL&&(e&vl.DEPTH||(s.depthLoadOp=nl.LOAD),e&vl.STENCIL||(s.stencilLoadOp=nl.LOAD)),s.barrier=n.getGeneralBarrier(new c_(sl.DEPTH_STENCIL_ATTACHMENT_WRITE,sl.DEPTH_STENCIL_ATTACHMENT_WRITE));var a=new h_([r],s);return n.createRenderPass(a)},i.getRenderPass=function(e,t){var i=function(e){for(var t,i=666,n=d(e.colorTextures);!(t=n()).done;){var r=t.value,s=null==r?void 0:r.info;i=Rc(s.type+"_"+s.usage+"_"+s.format+"_"+s.width+"_"+s.height+"_"+s.flags+"_\n "+s.layerCount+"_"+s.levelCount+"_"+s.samples+"_"+s.depth+"_"+s.externalRes,i)}if(e.depthStencilTexture){var a=e.depthStencilTexture.info;i=Rc(a.type+"_"+a.usage+"_"+a.format+"_"+a.width+"_"+a.height+"_"+a.flags+"_\n "+a.layerCount+"_"+a.levelCount+"_"+a.samples+"_"+a.depth+"_"+a.externalRes,i)}return i}(t),n=Rc(i+"_"+e,666),r=this._renderPasses.get(n);return r||(r=this.createRenderPass(e,t.colorTextures[0].format,t.depthStencilTexture.format),this._renderPasses.set(n,r),r)},i.newFramebufferByRatio=function(e){for(var t=this.pipelineSceneData,i=this._width*t.shadingScale,n=this._height*t.shadingScale,r=e.colorTextures,s=0;s<r.length;s++)r[s].resize(i,n);e.depthStencilTexture&&e.depthStencilTexture.resize(i,n);var a=this._device.createFramebuffer(new d_(e.renderPass,r,e.depthStencilTexture));return e.destroy(),a},i.generateRenderArea=function(e,t){var i=e.viewport,n=e.window.width,r=e.window.height;t.x=i.x*n,t.y=i.y*r,t.width=i.width*n,t.height=i.height*r},i.generateViewport=function(e,t){this.generateRenderArea(e,pC),t||(t=mC);var i=this.pipelineSceneData.shadingScale;return t.left=pC.x*i,t.top=pC.y*i,t.width=pC.width*i,t.height=pC.height*i,t},i.generateScissor=function(e,t){t||(t=pC),this.generateRenderArea(e,t);var i=this.pipelineSceneData.shadingScale;return t.x*=i,t.y*=i,t.width*=i,t.height*=i,t},i.getMacroString=function(e){var t=this._macros[e];return void 0===t?"":t},i.getMacroInt=function(e){var t=this._macros[e];return void 0===t?0:t},i.getMacroBool=function(e){var t=this._macros[e];return void 0!==t&&t},i.setMacroString=function(e,t){this._macros[e]=t},i.setMacroInt=function(e,t){this._macros[e]=t},i.setMacroBool=function(e,t){this._macros[e]=t},i.activate=function(){this._device=gd.gfxDevice,this._generateConstantMacros(),this._globalDSManager=new _O(this._device),this._descriptorSet=this._globalDSManager.globalDescriptorSet,this._pipelineUBO.activate(this._device,this),this._macros.CC_USE_HDR=this._pipelineSceneData.isHDR,this._macros.CC_USE_DEBUG_VIEW=0,this._generateConstantMacros(),this._pipelineSceneData.activate(this._device);for(var e=0;e<this._flows.length;e++)this._flows[e].activate(this);return!0},i._ensureEnoughSize=function(){},i.render=function(e){if(0!==e.length){this.updateGeometryRenderer(e),this._commandBuffers[0].begin(),this.emit(CO.RENDER_FRAME_BEGIN,e),this._ensureEnoughSize(e),function(e){for(var t=e.length-1;t>=0;--t){var i=e[t];if(i.window.swapchain)return void($E=i)}$E=null}(e);for(var t=0;t<e.length;t++){var i=e[t];if(i.scene){this.emit(CO.RENDER_CAMERA_BEGIN,i),zI(this,i),VI(this,i),this._pipelineUBO.updateGlobalUBO(i.window),this._pipelineUBO.updateCameraUBO(i);for(var n=0;n<this._flows.length;n++)this._flows[n].render(i);this.emit(CO.RENDER_CAMERA_END,i)}}this.emit(CO.RENDER_FRAME_END,e),this._commandBuffers[0].end(),this._device.queue.submit(this._commandBuffers)}},i._destroyQuadInputAssembler=function(){this._quadIB&&(this._quadIB.destroy(),this._quadIB=null),this._quadVBOnscreen&&(this._quadVBOnscreen.destroy(),this._quadVBOnscreen=null),this._quadVBOffscreen&&(this._quadVBOffscreen.destroy(),this._quadVBOffscreen=null),this._quadIAOnscreen&&(this._quadIAOnscreen.destroy(),this._quadIAOnscreen=null),this._quadIAOffscreen&&(this._quadIAOffscreen.destroy(),this._quadIAOffscreen=null)},i._destroyBloomData=function(){var e,t=this._pipelineRenderData.bloom;if(null!==t){t.prefiterTex&&t.prefiterTex.destroy(),t.prefilterFramebuffer&&t.prefilterFramebuffer.destroy();for(var i=0;i<t.downsampleTexs.length;++i)t.downsampleTexs[i].destroy(),t.downsampleFramebuffers[i].destroy();t.downsampleTexs.length=0,t.downsampleFramebuffers.length=0;for(var n=0;n<t.upsampleTexs.length;++n)t.upsampleTexs[n].destroy(),t.upsampleFramebuffers[n].destroy();t.upsampleTexs.length=0,t.upsampleFramebuffers.length=0,t.combineTex&&t.combineTex.destroy(),t.combineFramebuffer&&t.combineFramebuffer.destroy(),null===(e=t.renderPass)||void 0===e||e.destroy(),this._pipelineRenderData.bloom=null}},i._genQuadVertexData=function(e,t){var i=new Float32Array(16),n=t.x/this._width,r=(t.x+t.width)/this._width,s=t.y/this._height,a=(t.y+t.height)/this._height;if(this.device.capabilities.screenSpaceSignY>0){var o=a;a=s,s=o}var u=0;switch(e){case xc.IDENTITY:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=a,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=s;break;case xc.ROTATE_90:u=0,i[u++]=-1,i[u++]=-1,i[u++]=r,i[u++]=a,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=s,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=1,i[u++]=n,i[u++]=s;break;case xc.ROTATE_180:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=-1,i[u++]=r,i[u++]=s,i[u++]=-1,i[u++]=1,i[u++]=n,i[u++]=a,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=a;break;case xc.ROTATE_270:u=0,i[u++]=-1,i[u++]=-1,i[u++]=n,i[u++]=s,i[u++]=1,i[u++]=-1,i[u++]=n,i[u++]=a,i[u++]=-1,i[u++]=1,i[u++]=r,i[u++]=s,i[u++]=1,i[u++]=1,i[u++]=r,i[u++]=a}return i},i._createQuadInputAssembler=function(){var e=new vC,t=4*Float32Array.BYTES_PER_ELEMENT,i=4*t,n=this._device.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE|zc.HOST,i,t));if(!n)return e;var r=Uint8Array.BYTES_PER_ELEMENT,s=6*r,a=this._device.createBuffer(new Gl(Gc.INDEX|Gc.TRANSFER_DST,zc.DEVICE,s,r));if(!a)return e;var o=new Uint8Array(6);o[0]=0,o[1]=1,o[2]=2,o[3]=1,o[4]=3,o[5]=2,a.update(o);var u=new Array(2);u[0]=new i_("a_position",Fc.RG32F),u[1]=new i_("a_texCoord",Fc.RG32F);var h=this._device.createInputAssembler(new r_(u,[n],a));return e.quadIB=a,e.quadVB=n,e.quadIA=h,e},i.updateQuadVertexData=function(e,t){var i=this._lastUsedRenderArea;if(i.x!==e.x||i.y!==e.y||i.width!==e.width||i.height!==e.height){var n=this._genQuadVertexData(xc.IDENTITY,e);this._quadVBOffscreen.update(n);var r=this._genQuadVertexData(t.swapchain&&t.swapchain.surfaceTransform||xc.IDENTITY,e);this._quadVBOnscreen.update(r),i.copy(e)}},i.destroy=function(){for(var t,i,n=0;n<this._flows.length;n++)this._flows[n].destroy();this._flows.length=0,this._descriptorSet&&this._descriptorSet.destroy(),null===(t=this._globalDSManager)||void 0===t||t.destroy();for(var r=0;r<this._commandBuffers.length;r++)this._commandBuffers[r].destroy();return this._commandBuffers.length=0,this._pipelineUBO.destroy(),null===(i=this._pipelineSceneData)||void 0===i||i.destroy(),e.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){},i._generateConstantMacros=function(){var e="";e+="#define CC_DEVICE_SUPPORT_FLOAT_TEXTURE "+(this.device.getFormatFeatures(Fc.RGBA32F)&(Xc.RENDER_TARGET|Xc.SAMPLED_TEXTURE)?1:0)+"\n",e+="#define CC_ENABLE_CLUSTERED_LIGHT_CULLING "+(this._clusterEnabled?1:0)+"\n",e+="#define CC_DEVICE_MAX_VERTEX_UNIFORM_VECTORS "+this.device.capabilities.maxVertexUniformVectors+"\n",e+="#define CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS "+this.device.capabilities.maxFragmentUniformVectors+"\n",e+="#define CC_DEVICE_CAN_BENEFIT_FROM_INPUT_ATTACHMENT "+(this.device.hasFeature(Dc.INPUT_ATTACHMENT_BENEFIT)?1:0)+"\n",e+="#define CC_PLATFORM_ANDROID_AND_WEBGL "+(qh.os===Wh.ANDROID&&qh.isBrowser?1:0)+"\n",e+="#define CC_ENABLE_WEBGL_HIGHP_STRUCT_VALUES "+(Rt.ENABLE_WEBGL_HIGHP_STRUCT_VALUES?1:0)+"\n",e+="#define CC_JOINT_UNIFORM_CAPACITY "+Fg.JOINT_UNIFORM_CAPACITY+"\n",this._constantMacros=e},i.updateGeometryRenderer=function(e){if(!this._geometryRenderer)for(var t=0;t<e.length;t++){var i=e[t];if(i&&i.window&&i.window.swapchain)return i.initGeometryRenderer(),void(this._geometryRenderer=i.geometryRenderer)}},i.generateBloomRenderData=function(){if(null==this._pipelineRenderData.bloom){var e=this._pipelineRenderData.bloom=new gC,t=this.device,i=new s_;i.format=Fc.RGBA8,i.loadOp=nl.CLEAR,i.storeOp=rl.STORE,i.barrier=t.getGeneralBarrier(new c_(sl.NONE,sl.COLOR_ATTACHMENT_WRITE)),e.renderPass=t.createRenderPass(new h_([i]));var n=this._width,r=this._height;e.prefiterTex=t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,n>>1,r>>1)),e.prefilterFramebuffer=t.createFramebuffer(new d_(e.renderPass,[e.prefiterTex])),n>>=1,r>>=1;for(var s=0;s<6;++s)e.downsampleTexs.push(t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,n>>1,r>>1))),e.downsampleFramebuffers[s]=t.createFramebuffer(new d_(e.renderPass,[e.downsampleTexs[s]])),e.upsampleTexs.push(t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,n,r))),e.upsampleFramebuffers[s]=t.createFramebuffer(new d_(e.renderPass,[e.upsampleTexs[s]])),n>>=1,r>>=1;e.combineTex=t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA8,this._width,this._height)),e.combineFramebuffer=t.createFramebuffer(new d_(e.renderPass,[e.combineTex])),e.sampler=this.globalDSManager.linearSampler}},i.on=function(e,t,i,n){return this._eventProcessor.on(e,t,i,n)},i.once=function(e,t,i){return this._eventProcessor.once(e,t,i)},i.off=function(e,t,i){this._eventProcessor.off(e,t,i)},i.emit=function(e,t,i,n,r,s){this._eventProcessor.emit(e,t,i,n,r,s)},i.targetOff=function(e){this._eventProcessor.targetOff(e)},i.removeAll=function(e){this._eventProcessor.removeAll(e)},i.hasEventListener=function(e,t,i){return this._eventProcessor.hasEventListener(e,t,i)},n(t,[{key:"tag",get:function(){return this._tag}},{key:"flows",get:function(){return this._flows}},{key:"quadIAOnscreen",get:function(){return this._quadIAOnscreen}},{key:"quadIAOffscreen",get:function(){return this._quadIAOffscreen}},{key:"constantMacros",get:function(){return this._constantMacros}},{key:"macros",get:function(){return this._macros}},{key:"device",get:function(){return this._device}},{key:"globalDSManager",get:function(){return this._globalDSManager}},{key:"descriptorSetLayout",get:function(){return this._globalDSManager.descriptorSetLayout}},{key:"descriptorSet",get:function(){return this._descriptorSet}},{key:"commandBuffers",get:function(){return this._commandBuffers}},{key:"pipelineUBO",get:function(){return this._pipelineUBO}},{key:"pipelineSceneData",get:function(){return this._pipelineSceneData}},{key:"profiler",get:function(){return this._profiler},set:function(e){this._profiler=e}},{key:"geometryRenderer",get:function(){return this._geometryRenderer}},{key:"clusterEnabled",get:function(){return this._clusterEnabled},set:function(e){this._clusterEnabled=e}},{key:"bloomEnabled",get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled=e}},{key:"shadingScale",get:function(){return this._pipelineSceneData.shadingScale},set:function(e){this._pipelineSceneData.shadingScale!==e&&(this._pipelineSceneData.shadingScale=e,this.emit(CO.ATTACHMENT_SCALE_CAHNGED,e))}}]),t}(qd),FO=Cs(DO.prototype,"_tag",[Ys],(function(){return 0})),BO=Cs(DO.prototype,"_flows",[LO,Ys],(function(){return[]})),xO=DO))||xO));v.RenderPipeline=yC,ae(yC.prototype,"RenderPipeline.prototype",[{name:"geometryRenderer",suggest:"please use camera.geometryRenderer instead."}]),function(e){e[e.BLOOM=18]="BLOOM",e[e.POST_PROCESS=19]="POST_PROCESS",e[e.UI=20]="UI"}(UO||(UO={})),function(e){e[e.AR=5]="AR",e[e.FORWARD=10]="FORWARD"}(GO||(GO={})),function(e){e[e.SHADOW=0]="SHADOW",e[e.FORWARD=1]="FORWARD",e[e.UI=10]="UI"}(kO||(kO={})),function(e){e[e.GBUFFER=10]="GBUFFER",e[e.LIGHTING=15]="LIGHTING",e[e.TRANSPARENT=18]="TRANSPARENT"}(HO||(HO={})),function(e){e[e.SHADOW=0]="SHADOW",e[e.MAIN=1]="MAIN",e[e.UI=10]="UI"}(zO||(zO={})),yt(Vc),yt(Wc),yt(rl),yt(nl),yt(sl),yt(Fc),function(e){e[e.SCENE=0]="SCENE",e[e.POSTPROCESS=1]="POSTPROCESS",e[e.UI=2]="UI"}(dC||(dC={})),yt(dC),VO=Gs("RenderTextureDesc"),WO=va(Vc),jO=va(Wc),XO=va(Fc),VO((KO=function(){this.name=YO&&YO(),this.type=qO&&qO(),this.usage=QO&&QO(),this.format=ZO&&ZO(),this.width=JO&&JO(),this.height=$O&&$O()},YO=Cs(KO.prototype,"name",[Ys],(function(){return""})),qO=Cs(KO.prototype,"type",[WO],(function(){return Vc.TEX2D})),QO=Cs(KO.prototype,"usage",[jO],(function(){return Wc.COLOR_ATTACHMENT})),ZO=Cs(KO.prototype,"format",[XO],(function(){return Fc.UNKNOWN})),JO=Cs(KO.prototype,"width",[Ys],(function(){return-1})),$O=Cs(KO.prototype,"height",[Ys],(function(){return-1})),KO));var EC,TC=(eN=Gs("RenderTextureConfig"),tN=va(Eb),eN((nN=function(){this.name=rN&&rN(),this.texture=sN&&sN()},rN=Cs(nN.prototype,"name",[Ys],(function(){return""})),sN=Cs(nN.prototype,"texture",[tN],(function(){return null})),iN=nN))||iN),AC=(aN=Gs("MaterialConfig"),oN=va(nT),aN((uN=function(){this.name=hN&&hN(),this.material=cN&&cN()},hN=Cs(uN.prototype,"name",[Ys],(function(){return""})),cN=Cs(uN.prototype,"material",[oN],(function(){return null})),uN)),lN=Gs("FrameBufferDesc"),_N=va([qt]),dN=va(Eb),lN((fN=function(){this.name=pN&&pN(),this.renderPass=mN&&mN(),this.colorTextures=gN&&gN(),this.depthStencilTexture=vN&&vN(),this.texture=yN&&yN()},pN=Cs(fN.prototype,"name",[Ys],(function(){return""})),mN=Cs(fN.prototype,"renderPass",[Ys],(function(){return 0})),gN=Cs(fN.prototype,"colorTextures",[_N],(function(){return[]})),vN=Cs(fN.prototype,"depthStencilTexture",[Ys],(function(){return""})),yN=Cs(fN.prototype,"texture",[dN],(function(){return null})),fN)),EN=Gs("ColorDesc"),TN=va(Fc),AN=va(nl),SN=va(rl),RN=va(sl),wN=va(sl),EN((bN=function(){this.format=ON&&ON(),this.loadOp=NN&&NN(),this.storeOp=CN&&CN(),this.sampleCount=MN&&MN(),this.beginAccesses=PN&&PN(),this.endAccesses=LN&&LN()},ON=Cs(bN.prototype,"format",[TN],(function(){return Fc.UNKNOWN})),NN=Cs(bN.prototype,"loadOp",[AN],(function(){return nl.CLEAR})),CN=Cs(bN.prototype,"storeOp",[SN],(function(){return rl.STORE})),MN=Cs(bN.prototype,"sampleCount",[Ys],(function(){return 1})),PN=Cs(bN.prototype,"beginAccesses",[RN],(function(){return sl.NONE})),LN=Cs(bN.prototype,"endAccesses",[wN],(function(){return sl.COLOR_ATTACHMENT_WRITE})),IN=bN))||IN),SC=(xN=Gs("DepthStencilDesc"),DN=va(Fc),FN=va(nl),BN=va(rl),UN=va(nl),GN=va(rl),kN=va(sl),HN=va(sl),xN((VN=function(){this.format=WN&&WN(),this.depthLoadOp=jN&&jN(),this.depthStoreOp=XN&&XN(),this.stencilLoadOp=KN&&KN(),this.stencilStoreOp=YN&&YN(),this.sampleCount=qN&&qN(),this.beginAccesses=QN&&QN(),this.endAccesses=ZN&&ZN()},WN=Cs(VN.prototype,"format",[DN],(function(){return Fc.UNKNOWN})),jN=Cs(VN.prototype,"depthLoadOp",[FN],(function(){return nl.CLEAR})),XN=Cs(VN.prototype,"depthStoreOp",[BN],(function(){return rl.STORE})),KN=Cs(VN.prototype,"stencilLoadOp",[UN],(function(){return nl.CLEAR})),YN=Cs(VN.prototype,"stencilStoreOp",[GN],(function(){return rl.STORE})),qN=Cs(VN.prototype,"sampleCount",[Ys],(function(){return 1})),QN=Cs(VN.prototype,"beginAccesses",[kN],(function(){return sl.NONE})),ZN=Cs(VN.prototype,"endAccesses",[HN],(function(){return sl.DEPTH_STENCIL_ATTACHMENT_WRITE})),zN=VN))||zN);JN=Gs("RenderPassDesc"),$N=va([AC]),eC=va(SC),JN((tC=function(){this.index=iC&&iC(),this.colorAttachments=nC&&nC(),this.depthStencilAttachment=rC&&rC()},iC=Cs(tC.prototype,"index",[Ys],(function(){return-1})),nC=Cs(tC.prototype,"colorAttachments",[$N],(function(){return[]})),rC=Cs(tC.prototype,"depthStencilAttachment",[eC],(function(){return new SC})),tC)),function(e){e[e.FRONT_TO_BACK=0]="FRONT_TO_BACK",e[e.BACK_TO_FRONT=1]="BACK_TO_FRONT"}(EC||(EC={})),yt(EC);var RC=(sC=Gs("RenderQueueDesc"),aC=va(EC),oC=va([qt]),sC((hC=function(){this.isTransparent=cC&&cC(),this.sortMode=lC&&lC(),this.stages=_C&&_C()},cC=Cs(hC.prototype,"isTransparent",[Ys],(function(){return!1})),lC=Cs(hC.prototype,"sortMode",[aC],(function(){return EC.FRONT_TO_BACK})),_C=Cs(hC.prototype,"stages",[oC],(function(){return[]})),uC=hC))||uC);function wC(e,t){return e.hash-t.hash||e.depth-t.depth||e.shaderId-t.shaderId}function IC(e,t){return e.priority-t.priority||e.hash-t.hash||t.depth-e.depth||e.shaderId-t.shaderId}var bC=function(){function e(e){this.queue=void 0,this._passDesc=void 0,this._passPool=void 0,this._passDesc=e,this._passPool=new Ah((function(){return{priority:0,hash:0,depth:0,shaderId:0,subModel:null,passIdx:0}}),64),this.queue=new Sh(64,this._passDesc.sortFunc)}var t=e.prototype;return t.clear=function(){this.queue.clear(),this._passPool.reset()},t.insertRenderPass=function(e,t,i){var n=e.model.subModels[t],r=n.passes[i],s=n.shaders[i];if(r.blendState.targets[0].blend!==this._passDesc.isTransparent||!(r.phase&this._passDesc.phases))return!1;var a=0|r.priority<<16|n.priority<<8|i,o=this._passPool.add();return o.priority=e.model.priority,o.hash=a,o.depth=e.depth||0,o.shaderId=s.typedID,o.subModel=n,o.passIdx=i,this.queue.push(o),!0},t.sort=function(){this.queue.sort()},t.recordCommandBuffer=function(e,t,i){for(var n=0;n<this.queue.length;++n){var r=this.queue.array[n],s=r.subModel,a=r.passIdx,o=s.inputAssembler,u=s.passes[a],h=s.shaders[a],c=kE.getOrCreatePipelineState(e,u,h,t,o);i.bindPipelineState(c),i.bindDescriptorSet(sg.MATERIAL,u.descriptorSet),i.bindDescriptorSet(sg.LOCAL,s.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},e}();function OC(e){for(var t=0,i=0;i<e.stages.length;i++)t|=LE(e.stages[i]);var n=wC;switch(e.sortMode){case EC.BACK_TO_FRONT:n=IC;break;case EC.FRONT_TO_BACK:n=wC}return new bC({isTransparent:e.isTransparent,phases:t,sortFunc:n})}function NC(e){e.clear()}function CC(e){e.sort()}var MC=function(){function e(){this.queue=new Set}var t=e.prototype;return t.clear=function(){for(var e=this.queue.values(),t=e.next();!t.done;)t.value.clear(),t=e.next();this.queue.clear()},t.uploadBuffers=function(e){for(var t=this.queue.values(),i=t.next();!i.done;){for(var n=0;n<i.value.batches.length;++n){var r=i.value.batches[n];if(r.mergeCount){for(var s=0;s<r.vbs.length;++s)r.vbs[s].update(r.vbDatas[s]);e.updateBuffer(r.vbIdx,r.vbIdxData.buffer),e.updateBuffer(r.ubo,r.uboData)}}i=t.next()}},t.recordCommandBuffer=function(e,t,i,n,r){void 0===n&&(n=null);for(var s=this.queue.values(),a=s.next();!a.done;){for(var o=!1,u=0;u<a.value.batches.length;++u){var h=a.value.batches[u];if(h.mergeCount){if(!o){var c=h.shader,l=kE.getOrCreatePipelineState(e,h.pass,c,t,h.ia);i.bindPipelineState(l),i.bindDescriptorSet(sg.MATERIAL,h.pass.descriptorSet),o=!0}n&&i.bindDescriptorSet(sg.GLOBAL,n),r?i.bindDescriptorSet(sg.LOCAL,h.descriptorSet,r):i.bindDescriptorSet(sg.LOCAL,h.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(h.ia),i.draw(h.ia)}}a=s.next()}},e}(),PC=function(){function e(){this.queue=new Set,this._renderQueue=[]}var t=e.prototype;return t.clear=function(){for(var e=this.queue.values(),t=e.next();!t.done;)t.value.clear(),t=e.next();this._renderQueue.length=0,this.queue.clear()},t.sort=function(){for(var e=this.queue.values(),t=e.next();!t.done;)t.value.pass.blendState.targets[0].blend||this._renderQueue.push(t.value),t=e.next();for(t=(e=this.queue.values()).next();!t.done;)t.value.pass.blendState.targets[0].blend&&this._renderQueue.push(t.value),t=e.next()},t.uploadBuffers=function(e){for(var t=this.queue.values(),i=t.next();!i.done;)i.value.hasPendingModels&&i.value.uploadBuffers(e),i=t.next()},t.recordCommandBuffer=function(e,t,i,n,r){void 0===n&&(n=null);for(var s=0===this._renderQueue.length?this.queue.values():this._renderQueue.values(),a=s.next();!a.done;){var o=a.value,u=o.instances,h=o.pass;if(o.hasPendingModels){i.bindDescriptorSet(sg.MATERIAL,h.descriptorSet);for(var c=null,l=0;l<u.length;++l){var _=u[l];if(_.count){var d=_.shader,f=kE.getOrCreatePipelineState(e,h,d,t,_.ia);c!==f&&(i.bindPipelineState(f),c=f),n&&i.bindDescriptorSet(sg.GLOBAL,n),r?i.bindDescriptorSet(sg.LOCAL,_.descriptorSet,r):i.bindDescriptorSet(sg.LOCAL,_.descriptorSet,a.value.dynamicOffsets),i.bindInputAssembler(_.ia),i.draw(_.ia)}}}a=s.next()}},e}(),LC=new Th((function(){return{subModel:null,passIdx:-1,dynamicOffsets:[],lights:[]}}),16),xC=new Float32Array(4),DC=[],FC=[],BC=new En,UC=new En;function GC(e,t){return!(!t.worldBounds||$r.aabbWithAABB(t.worldBounds,e.aabb))}function kC(e,t){return!(!t.worldBounds||$r.aabbWithAABB(t.worldBounds,e.aabb)&&$r.aabbFrustum(t.worldBounds,e.frustum))}var HC="forward-add",zC=LE(HC),VC=[];function WC(e,t){var i=v.rendering;bv()&&(zC=i.getPhaseID(i.getPassID("default"),HC)),t.length=0;for(var n=!1,r=0;r<e.length;r++){for(var s=e[r].passes,a=-1,o=0;o<s.length;o++)if((!i||!i.enableEffectImport)&&s[o].phase===zC||bv()&&s[o].phaseID===zC){a=o,n=!0;break}t.push(a)}return n}var jC,XC,KC,YC,qC,QC,ZC,JC,$C,eM,tM=function(){function e(e){this._pipeline=void 0,this._device=void 0,this._lightPasses=[],this._instancedLightPassPool=LC.alloc(),this._batchedLightPassPool=LC.alloc(),this._shadowUBO=new Float32Array(_g.COUNT),this._lightBufferCount=16,this._lightBufferStride=void 0,this._lightBufferElementCount=void 0,this._lightBuffer=void 0,this._firstLightBufferView=void 0,this._lightBufferData=void 0,this._instancedQueue=void 0,this._batchedQueue=void 0,this._lightMeterScale=1e4,this._pipeline=e,this._device=e.device,this._instancedQueue=new PC,this._batchedQueue=new MC;var t=this._device.capabilities.uboOffsetAlignment;this._lightBufferStride=Math.ceil(Mg.SIZE/t)*t,this._lightBufferElementCount=this._lightBufferStride/Float32Array.BYTES_PER_ELEMENT,this._lightBuffer=this._device.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,this._lightBufferStride*this._lightBufferCount,this._lightBufferStride)),this._firstLightBufferView=this._device.createBuffer(new kl(this._lightBuffer,0,Mg.SIZE)),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount)}var t=e.prototype;return t.clear=function(){this._instancedQueue.clear(),this._batchedQueue.clear();for(var e=0;e<this._lightPasses.length;e++){var t=this._lightPasses[e];t.dynamicOffsets.length=0,t.lights.length=0}LC.freeArray(this._lightPasses),this._lightPasses.length=0,this._instancedLightPassPool.dynamicOffsets.length=0,this._instancedLightPassPool.lights.length=0,this._batchedLightPassPool.dynamicOffsets.length=0,this._batchedLightPassPool.lights.length=0},t.destroy=function(){for(var e=this._pipeline.globalDSManager.descriptorSetMap,t=e.keys,i=0;i<t.length;i++){var n=t[i],r=e.get(n);if(r){var s=bv()?iO("CCShadow"):_g.BINDING;r.getBuffer(s).destroy(),r.getTexture(fg).destroy(),r.getTexture(Sg).destroy(),r.destroy()}e.delete(n)}},t.gatherLightPasses=function(e,t){this.clear();var i=this._pipeline.pipelineSceneData.validPunctualLights;if(i.length){this._updateUBOs(e,t),this._updateLightDescriptorSet(e,t);for(var n=this._pipeline.pipelineSceneData.renderObjects,r=0;r<n.length;r++){var s=n[r].model,a=s.subModels;if(WC(a,VC)&&(FC.length=0,this._lightCulling(s,i),FC.length))for(var o=0;o<a.length;o++){var u=VC[o];if(!(u<0)){var h=a[o],c=h.passes[u];h.passes[0].blendState.targets[0].blend||(bv()&&iO("CCForwardLight"),h.descriptorSet.bindBuffer(Mg.BINDING,this._firstLightBufferView),h.descriptorSet.update(),this._addRenderQueue(c,h,s,u))}}}for(var l=0;l<i.length;l++){var _=i[l];this._instancedLightPassPool.lights.push(_),this._instancedLightPassPool.dynamicOffsets.push(this._lightBufferStride*l),this._batchedLightPassPool.lights.push(_),this._batchedLightPassPool.dynamicOffsets.push(this._lightBufferStride*l)}this._instancedQueue.uploadBuffers(t),this._batchedQueue.uploadBuffers(t)}},t.recordCommandBuffer=function(e,t,i){for(var n=this._pipeline.globalDSManager,r=0;r<this._instancedLightPassPool.lights.length;++r){var s=this._instancedLightPassPool.lights[r];DC[0]=this._instancedLightPassPool.dynamicOffsets[r];var a=n.getOrCreateDescriptorSet(s);this._instancedQueue.recordCommandBuffer(e,t,i,a,DC)}for(var o=0;o<this._batchedLightPassPool.lights.length;++o){var u=this._batchedLightPassPool.lights[o];DC[0]=this._batchedLightPassPool.dynamicOffsets[o];var h=n.getOrCreateDescriptorSet(u);this._batchedQueue.recordCommandBuffer(e,t,i,h,DC)}for(var c=0;c<this._lightPasses.length;c++){var l=this._lightPasses[c],_=l.subModel,d=l.passIdx,f=l.dynamicOffsets,p=l.lights,m=_.passes[d],g=_.shaders[d],v=_.inputAssembler,y=kE.getOrCreatePipelineState(e,m,g,t,v),E=m.descriptorSet,T=_.descriptorSet;i.bindPipelineState(y),i.bindDescriptorSet(sg.MATERIAL,E),i.bindInputAssembler(v);for(var A=0;A<f.length;++A){var S=p[A],R=n.getOrCreateDescriptorSet(S);DC[0]=f[A],i.bindDescriptorSet(sg.GLOBAL,R),i.bindDescriptorSet(sg.LOCAL,T,DC),i.draw(v)}}},t._lightCulling=function(e,t){for(var i=!1,n=0;n<t.length;n++){var r=t[n];switch(r.type){case JI.SPHERE:i=GC(r,e);break;case JI.SPOT:i=kC(r,e)}i||FC.push(n)}},t._addRenderQueue=function(e,t,i,n){var r=this._pipeline.pipelineSceneData.validPunctualLights,s=e.batchingScheme,a=null;s===CE.NONE&&((a=LC.alloc()).subModel=t,a.passIdx=n);for(var o=0;o<FC.length;o++){var u=FC[o],h=r[u];if((h.visibility&i.node.layer)===i.node.layer)switch(s){case CE.INSTANCING:var c=e.getInstancedBuffer(o);c.merge(t,n),c.dynamicOffsets[0]=this._lightBufferStride,this._instancedQueue.queue.add(c);break;case CE.VB_MERGING:var l=e.getBatchedBuffer(o);l.merge(t,n,i),l.dynamicOffsets[0]=this._lightBufferStride,this._batchedQueue.queue.add(l);break;default:a.lights.push(h),a.dynamicOffsets.push(this._lightBufferStride*u)}}s===CE.NONE&&this._lightPasses.push(a)},t._updateLightDescriptorSet=function(e,t){for(var i=this._pipeline.device,n=this._pipeline.pipelineSceneData,r=n.shadows,s=n.shadowFrameBufferMap,a=e.scene.mainLight,o=Iv(i)?0:1,u=this._pipeline.globalDSManager,h=n.validPunctualLights,c=this._pipeline.device.capabilities,l=0;l<h.length;l++){var _=h[l],d=u.getOrCreateDescriptorSet(_);if(d){var f=void 0,p=void 0;switch(_.type){case JI.SPHERE:a&&EO.updatePlanarNormalAndDistance(r,this._shadowUBO),this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=1,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=0,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=2,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=0,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,en.toArray(this._shadowUBO,r.shadowColor,_g.SHADOW_COLOR_OFFSET);break;case JI.SPOT:var m=_;if(a&&EO.updatePlanarNormalAndDistance(r,this._shadowUBO),En.invert(BC,_.node.getWorldMatrix()),En.perspective(UC,_.angle,1,.001,_.range,!0,c.clipSpaceMinZ,c.clipSpaceSignY,0),f=UC.clone(),p=UC.clone().invert(),En.multiply(UC,UC,BC),En.toArray(this._shadowUBO,BC,_g.MAT_LIGHT_VIEW_OFFSET),En.toArray(this._shadowUBO,UC,_g.MAT_LIGHT_VIEW_PROJ_OFFSET),this._shadowUBO[_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+0]=.01,this._shadowUBO[_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+1]=_.range,this._shadowUBO[_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+2]=0,this._shadowUBO[_g.SHADOW_NEAR_FAR_LINEAR_SATURATION_INFO_OFFSET+3]=0,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+0]=r.size.x,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+1]=r.size.y,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+2]=m.shadowPcf,this._shadowUBO[_g.SHADOW_WIDTH_HEIGHT_PCF_BIAS_INFO_OFFSET+3]=m.shadowBias,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+0]=1,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+1]=o,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+2]=m.shadowNormalBias,this._shadowUBO[_g.SHADOW_LIGHT_PACKING_NBIAS_NULL_INFO_OFFSET+3]=0,this._shadowUBO[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+0]=f.m10,this._shadowUBO[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+1]=f.m14,this._shadowUBO[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+2]=f.m11,this._shadowUBO[_g.SHADOW_PROJ_DEPTH_INFO_OFFSET+3]=f.m15,this._shadowUBO[_g.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+0]=p.m10,this._shadowUBO[_g.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+1]=p.m14,this._shadowUBO[_g.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+2]=p.m11,this._shadowUBO[_g.SHADOW_INV_PROJ_DEPTH_INFO_OFFSET+3]=p.m15,this._shadowUBO[_g.SHADOW_PROJ_INFO_OFFSET+0]=f.m00,this._shadowUBO[_g.SHADOW_PROJ_INFO_OFFSET+1]=f.m05,this._shadowUBO[_g.SHADOW_PROJ_INFO_OFFSET+2]=1/f.m00,this._shadowUBO[_g.SHADOW_PROJ_INFO_OFFSET+3]=1/f.m05,en.toArray(this._shadowUBO,r.shadowColor,_g.SHADOW_COLOR_OFFSET),s.has(_)){var g,v=null===(g=s.get(_))||void 0===g?void 0:g.colorTextures[0];v&&d.bindTexture(Sg,v)}}d.update();var y=bv()?iO("CCShadow"):_g.BINDING;t.updateBuffer(d.getBuffer(y),this._shadowUBO)}}},t._updateUBOs=function(e,t){var i=e.exposure,n=this._pipeline.pipelineSceneData,r=n.isHDR,s=n.shadows,a=n.validPunctualLights;a.length>this._lightBufferCount&&(this._firstLightBufferView.destroy(),this._lightBufferCount=Di(a.length),this._lightBuffer.resize(this._lightBufferStride*this._lightBufferCount),this._lightBufferData=new Float32Array(this._lightBufferElementCount*this._lightBufferCount),this._firstLightBufferView.initialize(new kl(this._lightBuffer,0,Mg.SIZE)));for(var o=0,u=0;o<a.length;o++,u+=this._lightBufferElementCount){var h=a[o];switch(h.type){case JI.SPHERE:if(Ki.toArray(xC,h.position),xC[3]=0,this._lightBufferData.set(xC,u+Mg.LIGHT_POS_OFFSET),xC[0]=h.size,xC[1]=h.range,xC[2]=0,xC[3]=0,this._lightBufferData.set(xC,u+Mg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Ki.toArray(xC,h.color),h.useColorTemperature){var c=h.colorTemperatureRGB;xC[0]*=c.x,xC[1]*=c.y,xC[2]*=c.z}xC[3]=r?h.luminance*i*this._lightMeterScale:h.luminance,this._lightBufferData.set(xC,u+Mg.LIGHT_COLOR_OFFSET);break;case JI.SPOT:if(Ki.toArray(xC,h.position),xC[3]=1,this._lightBufferData.set(xC,u+Mg.LIGHT_POS_OFFSET),xC[0]=h.size,xC[1]=h.range,xC[2]=h.spotAngle,xC[3]=s.enabled&&h.shadowEnabled&&s.type===sT.ShadowMap?1:0,this._lightBufferData.set(xC,u+Mg.LIGHT_SIZE_RANGE_ANGLE_OFFSET),Ki.toArray(xC,h.direction),this._lightBufferData.set(xC,u+Mg.LIGHT_DIR_OFFSET),Ki.toArray(xC,h.color),h.useColorTemperature){var l=h.colorTemperatureRGB;xC[0]*=l.x,xC[1]*=l.y,xC[2]*=l.z}xC[3]=r?h.luminance*i*this._lightMeterScale:h.luminance,this._lightBufferData.set(xC,u+Mg.LIGHT_COLOR_OFFSET)}}t.updateBuffer(this._lightBuffer,this._lightBufferData)},e}(),iM=new _s,nM=function(){function e(e){this._pendingSubModels=[],this._castModels=[],this._instancedQueue=new PC,this._pipeline=void 0,this._pipeline=e}var t=e.prototype;return t.gatherShadowPasses=function(e,t){var i=this._pipeline.pipelineSceneData.shadows;if(this._instancedQueue.clear(),this._pendingSubModels.length=0,this._castModels.length=0,i.enabled&&i.type===sT.Planar&&!(i.normal.length()<1e-6)){var n=e.scene,r=e.frustum,s=0!=(e.visibility&Yp.BitMask.DEFAULT);if(n.mainLight&&s){for(var a=n.models,o=0;o<a.length;o++){var u=a[o];n.isCulledByLod(e,u)||u.enabled&&u.node&&u.castShadow&&this._castModels.push(u)}var h=i.instancingMaterial.passes[0].getInstancedBuffer();this._instancedQueue.queue.add(h);for(var c=0;c<this._castModels.length;c++){var l=this._castModels[c];if(!l.worldBounds||(_s.transform(iM,l.worldBounds,i.matLight),$r.aabbFrustum(iM,r)))for(var _=l.subModels,d=0;d<_.length;d++)for(var f=_[d],p=f.passes,m=0;m<p.length;m++)p[m].batchingScheme===CE.INSTANCING?(h.merge(f,m,f.planarShader),this._instancedQueue.queue.add(h)):this._pendingSubModels.push(f)}this._instancedQueue.uploadBuffers(t)}}},t.recordCommandBuffer=function(e,t,i){var n=this._pipeline.pipelineSceneData.shadows;if(n.enabled&&n.type===sT.Planar&&(this._instancedQueue.recordCommandBuffer(e,t,i),this._pendingSubModels.length)){var r=n.material.passes[0],s=r.descriptorSet;i.bindDescriptorSet(sg.MATERIAL,s);for(var a=this._pendingSubModels,o=0;o<a.length;o++){var u=a[o],h=u.planarShader,c=u.inputAssembler,l=kE.getOrCreatePipelineState(e,r,h,t,c);i.bindPipelineState(l),i.bindDescriptorSet(sg.LOCAL,u.descriptorSet),i.bindInputAssembler(c),i.draw(c)}}},e}(),rM=function(){function e(){this._phaseID=LE("default");var e=v.rendering;bv()&&(this._phaseID=e.getPhaseID(e.getPassID("default"),"default"))}var t=e.prototype;return t.activate=function(e){this._pipeline=e},t.render=function(e,t){for(var i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=e.scene.batches,a=0;a<s.length;a++){var o=s[a],u=!1;if(e.visibility&o.visFlags&&(u=!0),u)for(var h=o.shaders.length,c=0;c<h;c++){var l=o.passes[c];if(l.phase===this._phaseID){var _=o.shaders[c],d=o.inputAssembler,f=kE.getOrCreatePipelineState(n,l,_,t,d);r.bindPipelineState(f),r.bindDescriptorSet(sg.MATERIAL,l.descriptorSet);var p=o.descriptorSet;r.bindDescriptorSet(sg.LOCAL,p),r.bindInputAssembler(d),r.draw(d)}}}},e}(),sM=[new Dl(0,0,0,1)],aM=e("gT",(jC=Gs("ForwardStage"),XC=va([RC]),jC((ZC=QC=function(e){function t(){var t;return(t=e.call(this)||this).renderQueues=qC&&qC(),t._renderQueues=[],t._renderArea=new bl,t._batchedQueue=void 0,t._instancedQueue=void 0,t._phaseID=LE("default"),t._clearFlag=4294967295,t.additiveInstanceQueues=[],t._batchedQueue=new MC,t._instancedQueue=new PC,t._uiPhase=new rM,t}s(t,e);var i=t.prototype;return i.addRenderInstancedQueue=function(e){this.additiveInstanceQueues.includes(e)||this.additiveInstanceQueues.push(e)},i.removeRenderInstancedQueue=function(e){var t=this.additiveInstanceQueues.indexOf(e);t>-1&&this.additiveInstanceQueues.splice(t,1)},i.initialize=function(t){return e.prototype.initialize.call(this,t),t.renderQueues&&(this.renderQueues=t.renderQueues),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=OC(this.renderQueues[n]);this._additiveLightQueue=new tM(this._pipeline),this._planarQueue=new nM(this._pipeline),this._uiPhase.activate(t)},i.destroy=function(){},i.render=function(e){var t;this._instancedQueue.clear(),this._batchedQueue.clear();var i=this._pipeline,n=i.device;this._renderQueues.forEach(NC);for(var r=i.pipelineSceneData.renderObjects,s=0,a=0,o=0,u=0;u<r.length;++u){var h=r[u],c=h.model.subModels;for(s=0;s<c.length;++s){var l=c[s],_=l.passes;for(a=0;a<_.length;++a){var d=_[a];if(d.phase===this._phaseID){var f=d.batchingScheme;if(f===CE.INSTANCING){var p=d.getInstancedBuffer();p.merge(l,a),this._instancedQueue.queue.add(p)}else if(f===CE.VB_MERGING){var m=d.getBatchedBuffer();m.merge(l,a,h.model),this._batchedQueue.queue.add(m)}else for(o=0;o<this._renderQueues.length;o++)this._renderQueues[o].insertRenderPass(h,s,a)}}}}this._instancedQueue.sort(),this._renderQueues.forEach(CC);var g=i.commandBuffers[0];i.pipelineUBO.updateShadowUBO(e);for(var v=0;v<this.additiveInstanceQueues.length;v++)this.additiveInstanceQueues[v].uploadBuffers(g);this._instancedQueue.uploadBuffers(g),this._batchedQueue.uploadBuffers(g),this._additiveLightQueue.gatherLightPasses(e,g),this._planarQueue.gatherShadowPasses(e,g),e.clearFlag&vl.COLOR&&(sM[0].x=e.clearColor.x,sM[0].y=e.clearColor.y,sM[0].z=e.clearColor.z,sM[0].w=e.clearColor.w),i.generateRenderArea(e,this._renderArea);var y=e.window.framebuffer,E=i.getRenderPass(e.clearFlag&this._clearFlag,y);g.beginRenderPass(E,y,this._renderArea,sM,e.clearDepth,e.clearStencil),g.bindDescriptorSet(sg.GLOBAL,i.descriptorSet),this._renderQueues[0].recordCommandBuffer(n,E,g);for(var T=0;T<this.additiveInstanceQueues.length;T++)this.additiveInstanceQueues[T].recordCommandBuffer(n,E,g);this._instancedQueue.recordCommandBuffer(n,E,g),this._batchedQueue.recordCommandBuffer(n,E,g),this._additiveLightQueue.recordCommandBuffer(n,E,g),g.bindDescriptorSet(sg.GLOBAL,i.descriptorSet),this._planarQueue.recordCommandBuffer(n,E,g),this._renderQueues[1].recordCommandBuffer(n,E,g),null===(t=e.geometryRenderer)||void 0===t||t.render(E,g,i.pipelineSceneData),this._uiPhase.render(e,E),tT(n,E,g,i.profiler,e),g.endRenderPass()},t}(NO),QC.initInfo={name:"ForwardStage",priority:GO.FORWARD,tag:0,renderQueues:[{isTransparent:!1,sortMode:EC.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:EC.BACK_TO_FRONT,stages:["default","planarShadow"]}]},qC=Cs((YC=ZC).prototype,"renderQueues",[XC,Ys],(function(){return[]})),KC=YC))||KC)),oM=e("gS",Gs("ForwardFlow")((eM=$C=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._stages.length){var i=new aM;i.initialize(aM.initInfo),this._stages.push(i)}return!0},i.activate=function(t){e.prototype.activate.call(this,t)},i.render=function(t){e.prototype.render.call(this,t)},i.destroy=function(){e.prototype.destroy.call(this)},t}(MO),$C.initInfo={name:Zm,priority:kO.FORWARD,stages:[]},JC=eM))||JC),uM=LE("shadow-caster");function hM(e){var t=e.passes,i=v.rendering;bv()&&(uM=i.getPhaseID(i.getPassID("default"),"shadow-caster"));for(var n=0;n<t.length;n++)if((!i||!i.enableEffectImport)&&t[n].phase===uM||bv()&&t[n].phaseID===uM)return n;return-1}var cM,lM,_M,dM,fM,pM,mM=function(){function e(e){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._instancedQueue=void 0,this._batchedQueue=void 0,this._pipeline=e,this._instancedQueue=new PC,this._batchedQueue=new MC}var t=e.prototype;return t.gatherLightPasses=function(e,t,i,n){void 0===n&&(n=0),this.clear();var r=this._pipeline.pipelineSceneData,s=r.shadows;if(t&&s.enabled&&s.type===sT.ShadowMap){switch(t.type){case JI.DIRECTIONAL:var a=t;if(a.shadowEnabled){var o,u=r.csmLayers;!function(e,t,i){var n=e.scene.mainLight,r=t.csmLayers.layerObjects,s=i.validFrustum,a=i.shadowObjects;a.length=0;for(var o=e.visibility,u=r.length-1;u>=0;u--){var h=r.array[u];if(h){var c=h.model;c&&c.enabled&&c.node&&((o&c.node.layer)===c.node.layer||o&c.visFlags)&&c.worldBounds&&c.castShadow?$r.aabbFrustum(c.worldBounds,s)&&(a.push(h),i.level<n.csmLevel&&n.csmOptimizationMode===uT.RemoveDuplicates&&$r.aabbFrustumCompletelyInside(c.worldBounds,s)&&r.fastRemove(u)):r.fastRemove(u)}else r.fastRemove(u)}}(e,r,o=a.shadowFixedArea?u.specialLayer:u.layers[n]);for(var h=o.shadowObjects,c=0;c<h.length;c++){var l=h[c].model;this.add(l)}}break;case JI.SPOT:var _=t;if(_.shadowEnabled)for(var d=_.visibility,f=r.csmLayers.castShadowObjects,p=0;p<f.length;p++){var m=f[p].model;(!m.worldBounds||(d&m.node.layer)===m.node.layer&&$r.aabbFrustum(m.worldBounds,_.frustum))&&this.add(m)}}this._instancedQueue.uploadBuffers(i),this._batchedQueue.uploadBuffers(i)}},t.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._batchedQueue.clear()},t.add=function(e){for(var t=e.subModels,i=0;i<t.length;i++){var n=t[i],r=hM(n);if(!(r<0)){var s=n.passes[r];if(s.batchingScheme===CE.INSTANCING){var a=s.getInstancedBuffer();a.merge(n,r),this._instancedQueue.queue.add(a)}else if(s.batchingScheme===CE.VB_MERGING){var o=s.getBatchedBuffer();o.merge(n,r,e),this._batchedQueue.queue.add(o)}else{var u=n.shaders[r];this._subModelsArray.push(n),u&&this._shaderArray.push(u),this._passArray.push(s)}}}},t.recordCommandBuffer=function(e,t,i){this._instancedQueue.recordCommandBuffer(e,t,i),this._batchedQueue.recordCommandBuffer(e,t,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,u=kE.getOrCreatePipelineState(e,a,s,t,o),h=a.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(sg.MATERIAL,h),i.bindDescriptorSet(sg.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}},e}(),gM=[new Dl(1,1,1,1)],vM=e("g$",Gs("ShadowStage")((_M=lM=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._shadowFrameBuffer=null,t._renderArea=new bl,t._light=null,t._globalDS=null,t._level=0,t._isShadowMapCleared=!1,t}s(t,e);var i=t.prototype;return i.setUsage=function(e,t,i,n){void 0===n&&(n=0),this._globalDS=e,this._light=t,this._shadowFrameBuffer=i,this._level=n},i.destroy=function(){var e;this._shadowFrameBuffer=null,this._globalDS=null,this._light=null,null===(e=this._additiveShadowQueue)||void 0===e||e.clear()},i.clearFramebuffer=function(e){if(this._light&&this._shadowFrameBuffer&&!this._isShadowMapCleared){gM[0].w=e.clearColor.w;var t=this._pipeline,i=t.pipelineSceneData,n=i.shadingScale,r=i.shadows,s=e.viewport,a=r.size;this._renderArea.x=s.x*a.x,this._renderArea.y=s.y*a.y,this._renderArea.width=s.width*a.x*n,this._renderArea.height=s.height*a.y*n;var o=t.commandBuffers[0],u=this._shadowFrameBuffer.renderPass;o.beginRenderPass(u,this._shadowFrameBuffer,this._renderArea,gM,e.clearDepth,e.clearStencil),o.endRenderPass(),this._isShadowMapCleared=!0}},i.render=function(e){var t=this._pipeline,i=t.pipelineSceneData,n=i.shadows,r=this._globalDS,s=t.commandBuffers[0],a=this._level,o=t.device;if(this._light&&this._shadowFrameBuffer){this._pipeline.pipelineUBO.updateShadowUBOLight(r,this._light,a),this._additiveShadowQueue.gatherLightPasses(e,this._light,s,a);var u=n.size;switch(this._light.type){case JI.DIRECTIONAL:var h=this._light;if(h.shadowFixedArea||h.csmLevel===oT.LEVEL_1||!i.csmSupported)this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y;else{var c=o.capabilities.screenSpaceSignY;this._renderArea.x=a%2*.5*u.x,this._renderArea.y=c>0?.5*(1-Math.floor(a/2))*u.y:.5*Math.floor(a/2)*u.y,this._renderArea.width=.5*u.x,this._renderArea.height=.5*u.y}break;case JI.SPOT:this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=u.x,this._renderArea.height=u.y}var l=this._shadowFrameBuffer.renderPass;s.beginRenderPass(l,this._shadowFrameBuffer,this._renderArea,gM,e.clearDepth,e.clearStencil),s.bindDescriptorSet(sg.GLOBAL,r),this._additiveShadowQueue.recordCommandBuffer(o,l,s),s.endRenderPass(),this._isShadowMapCleared=!1}},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._additiveShadowQueue=new mM(t),this._isShadowMapCleared=!1},t}(NO),lM.initInfo={name:"ShadowStage",priority:GO.FORWARD,tag:0},cM=_M))||cM),yM=[],EM=e("g_",Gs("ShadowFlow")((pM=fM=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._shadowRenderPass=null,t}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._stages.length){var i=new vM;i.initialize(vM.initInfo),this._stages.push(i)}return!0},i.activate=function(t){e.prototype.activate.call(this,t);var i=Iv(t.device)?0:1;t.macros.CC_SHADOWMAP_FORMAT=i;var n=t.device.gfxAPI===Lc.WEBGL?1:0;t.macros.CC_SHADOWMAP_USE_LINEAR_DEPTH=n,t.pipelineSceneData.csmSupported=t.device.capabilities.maxFragmentUniformVectors>=(cg.COUNT+lg.COUNT+_g.COUNT+dg.COUNT)/4,t.macros.CC_SUPPORT_CASCADED_SHADOW_MAP=t.pipelineSceneData.csmSupported,t.macros.CC_SHADOW_TYPE=0,t.macros.CC_DIR_SHADOW_PCF_TYPE=aT.HARD,t.macros.CC_DIR_LIGHT_SHADOW_TYPE=0,t.macros.CC_CASCADED_LAYERS_TRANSITION=0,t.onGlobalPipelineStateChanged()},i.render=function(e){var t=this._pipeline,i=t.pipelineSceneData.shadows,n=t.pipelineSceneData.csmLayers,r=t.pipelineSceneData.shadowFrameBufferMap,s=n.castShadowObjects,a=this._pipeline.pipelineSceneData.validPunctualLights;if(i.enabled&&i.type===sT.ShadowMap){for(var o=0,u=0;o<i.maxReceived&&u<a.length;){var h=a[u];h.type===JI.SPOT&&h.shadowEnabled&&(yM.push(h),o++),u++}if(0!==s.length){i.shadowMapDirty&&this.resizeShadowMap();var c=e.scene.mainLight;if(c&&c.shadowEnabled){var l=t.descriptorSet;r.has(c)||this._initShadowFrameBuffer(t,c,e.window.swapchain);var _=r.get(c);if(c.shadowFixedArea)this._renderStage(e,c,_,l);else for(var d=t.pipelineSceneData.csmSupported?c.csmLevel:1,f=0;f<d;f++)this._renderStage(e,c,_,l,f)}for(var p=0;p<yM.length;p++){var m=yM[p],g=t.globalDSManager.getOrCreateDescriptorSet(m);r.has(m)||this._initShadowFrameBuffer(t,m,e.window.swapchain);var v=r.get(m);this._renderStage(e,m,v,g)}yM.length=0}else this.clearShadowMap(yM,e)}},i.destroy=function(){if(e.prototype.destroy.call(this),this._pipeline){for(var t=this._pipeline.pipelineSceneData.shadowFrameBufferMap,i=Array.from(t.values()),n=0;n<i.length;n++){var r=i[n];if(r){for(var s=r.colorTextures,a=0;a<s.length;a++){var o=s[a];o&&o.destroy()}s.length=0;var u=r.depthStencilTexture;u&&u.destroy(),r.destroy()}}t.clear()}this._shadowRenderPass&&this._shadowRenderPass.destroy()},i._initShadowFrameBuffer=function(e,t){var i=e.device,n=e.pipelineSceneData.shadows.size,r=e.pipelineSceneData.shadowFrameBufferMap,s=Iv(i)?Fc.R32F:Fc.RGBA8;if(!this._shadowRenderPass){var a=new s_;a.format=s,a.loadOp=nl.CLEAR,a.storeOp=rl.STORE,a.sampleCount=1;var o=new a_;o.format=Fc.DEPTH_STENCIL,o.depthLoadOp=nl.CLEAR,o.depthStoreOp=rl.DISCARD,o.stencilLoadOp=nl.CLEAR,o.stencilStoreOp=rl.DISCARD,o.sampleCount=1;var u=new h_([a],o);this._shadowRenderPass=i.createRenderPass(u)}var h=[];h.push(i.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,s,n.x,n.y)));var c=i.createTexture(new Wl(Vc.TEX2D,Wc.DEPTH_STENCIL_ATTACHMENT,Fc.DEPTH_STENCIL,n.x,n.y)),l=i.createFramebuffer(new d_(this._shadowRenderPass,h,c));r.set(t,l)},i._renderStage=function(e,t,i,n,r){void 0===r&&(r=0);for(var s=0;s<this._stages.length;s++){var a=this._stages[s];a.setUsage(n,t,i,r),a.render(e)}},i.clearShadowMap=function(e,t){var i=this._pipeline,n=i.pipelineSceneData,r=t.scene.mainLight;if(r){var s=this._pipeline.descriptorSet;n.shadowFrameBufferMap.has(r)||this._initShadowFrameBuffer(this._pipeline,r,t.window.swapchain);for(var a=n.shadowFrameBufferMap.get(r),o=0;o<this._stages.length;o++){var u=this._stages[o];u.setUsage(s,r,a),u.clearFramebuffer(t)}}for(var h=0;h<e.length;h++){var c=e[h],l=i.globalDSManager.getOrCreateDescriptorSet(c);n.shadowFrameBufferMap.has(c)||this._initShadowFrameBuffer(this._pipeline,c,t.window.swapchain);for(var _=n.shadowFrameBufferMap.get(c),d=0;d<this._stages.length;d++){var f=this._stages[d];f.setUsage(l,c,_),f.clearFramebuffer(t)}}},i.resizeShadowMap=function(){for(var e,t=this._pipeline.pipelineSceneData.shadows,i=t.size,n=this._pipeline,r=n.device,s=n.pipelineSceneData.shadowFrameBufferMap,a=Iv(r)?Fc.R32F:Fc.RGBA8,o=d(s.keys());!(e=o()).done;){var u=e.value,h=s.get(u);if(h){var c=[];c.push(n.device.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,a,i.x,i.y)));var l=h.depthStencilTexture;l&&l.resize(i.x,i.y);var _=h.renderPass;h.destroy();var f=r.createFramebuffer(new d_(_,c,l));s.set(u,f)}}t.shadowMapDirty=!1},t}(MO),fM.initInfo={name:Jm,priority:kO.SHADOW,tag:dC.SCENE,stages:[]},dM=pM))||dM),TM=new En,AM=new En,SM=new En,RM=new En,wM=new En,IM=new En,bM=new En,OM=new Ki(0,0,0),NM=new Ki,CM=new Rn,MM=new Ki,PM=new Ki,LM=new Ki(1e7,1e7,1e7),xM=new Ki(-1e7,-1e7,-1e7),DM=new Ki,FM=0,BM=0,UM=function(){function e(e){this._shadowObjects=[],this._shadowCameraFar=0,this._level=void 0,this._matShadowView=new En,this._matShadowProj=new En,this._matShadowViewProj=new En,this._validFrustum=new ys,this._splitFrustum=new ys,this._lightViewFrustum=new ys,this._castLightViewBoundingBox=new _s,this._level=e,this._validFrustum.accurate=!0,this._splitFrustum.accurate=!0,this._lightViewFrustum.accurate=!0}var t=e.prototype;return t.copyToValidFrustum=function(e){ys.copy(this._validFrustum,e)},t.calculateValidFrustumOrtho=function(e,t,i,n,r){ys.createOrtho(this._validFrustum,e,t,i,n,r)},t.calculateSplitFrustum=function(e,t,i,n){this._splitFrustum.split(i,n,e.aspect,e.fov,t)},t.destroy=function(){this._shadowObjects.length=0},t.createMatrix=function(e,t,i){var n=v.director.root.device,r=e.shadowInvisibleOcclusionRange;ys.copy(this._lightViewFrustum,this._splitFrustum),En.fromRT(AM,e.node.rotation,OM),En.invert(SM,AM);var s,a,o=SM.clone();this._lightViewFrustum.transform(SM),_s.fromPoints(this._castLightViewBoundingBox,LM,xM),this._castLightViewBoundingBox.mergeFrustum(this._lightViewFrustum),e.csmOptimizationMode===uT.DisableRotationFix?(s=2*this._castLightViewBoundingBox.halfExtents.x,a=2*this._castLightViewBoundingBox.halfExtents.y):s=a=Ki.distance(this._lightViewFrustum.vertices[0],this._lightViewFrustum.vertices[6]);var u=v.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1;if(u>1&&e.csmOptimizationMode===uT.RemoveDuplicates)if(this._level>=u-1)BM=this._castLightViewBoundingBox.halfExtents.z,FM=this._castLightViewBoundingBox.center.z;else{var h=Math.abs(this._castLightViewBoundingBox.center.z-FM)+BM;this._castLightViewBoundingBox.halfExtents.z=Math.max(this._castLightViewBoundingBox.center.z,h)}var c=this._castLightViewBoundingBox.halfExtents.z;this._shadowCameraFar=2*c+r;var l=this._castLightViewBoundingBox.center;if(DM.set(l.x,l.y,l.z+c+r),Ki.transformMat4(DM,DM,AM),En.fromRT(AM,e.node.rotation,DM),En.invert(SM,AM),!i){var _=.5*s,d=.5*a;En.ortho(RM,-_,_,-d,d,.1,this._shadowCameraFar,n.capabilities.clipSpaceMinZ,n.capabilities.clipSpaceSignY),En.multiply(IM,RM,o),Ki.transformMat4(NM,DM,IM);var f=2/t;CM.set(f,f);var p=NM.x%CM.x,m=NM.y%CM.y;MM.set(NM.x-p,NM.y-m,NM.z),En.invert(bM,IM),Ki.transformMat4(PM,MM,bM),En.fromRT(AM,e.node.rotation,PM),En.invert(SM,AM),En.multiply(wM,RM,SM),En.copy(this._matShadowView,SM),En.copy(this._matShadowProj,RM),En.copy(this._matShadowViewProj,wM)}ys.createOrtho(this._validFrustum,s,a,.1,this._shadowCameraFar,AM)},n(e,[{key:"level",get:function(){return this._level}},{key:"shadowObjects",get:function(){return this._shadowObjects}},{key:"shadowCameraFar",get:function(){return this._shadowCameraFar},set:function(e){this._shadowCameraFar=e}},{key:"matShadowView",get:function(){return this._matShadowView},set:function(e){this._matShadowView=e}},{key:"matShadowProj",get:function(){return this._matShadowProj},set:function(e){this._matShadowProj=e}},{key:"matShadowViewProj",get:function(){return this._matShadowViewProj},set:function(e){this._matShadowViewProj=e}},{key:"validFrustum",get:function(){return this._validFrustum}},{key:"splitFrustum",get:function(){return this._splitFrustum}},{key:"lightViewFrustum",get:function(){return this._lightViewFrustum}},{key:"castLightViewBoundingBox",get:function(){return this._castLightViewBoundingBox}}]),e}(),GM=function(e){function t(t){var i;return(i=e.call(this,t)||this)._splitCameraNear=0,i._splitCameraFar=0,i._csmAtlas=new zi,i._calculateAtlas(t),i}s(t,e);var i=t.prototype;return i.destroy=function(){e.prototype.destroy.call(this)},i._calculateAtlas=function(e){var t=v.director.root.device.capabilities.clipSpaceSignY,i=e%2-.5,n=(.5-Math.floor(e/2))*t;this._csmAtlas.set(.5,.5,i,n)},n(t,[{key:"splitCameraNear",get:function(){return this._splitCameraNear},set:function(e){this._splitCameraNear=e}},{key:"splitCameraFar",get:function(){return this._splitCameraFar},set:function(e){this._splitCameraFar=e}},{key:"csmAtlas",get:function(){return this._csmAtlas},set:function(e){this._csmAtlas=e}}]),t}(UM),kM=function(){function e(){this._castShadowObjects=[],this._layerObjects=new Sh(64),this._layers=[],this._levelCount=0,this._specialLayer=new UM(1),this._shadowDistance=0;for(var e=0;e<oT.LEVEL_4;e++)this._layers[e]=new GM(e)}var t=e.prototype;return t.update=function(e,t){var i=t.scene.mainLight;if(null!==i){var n=e.shadows,r=v.director.root.pipeline.pipelineSceneData.csmSupported?i.csmLevel:1,s=i.shadowDistance;n.enabled&&i.shadowEnabled&&(i.shadowFixedArea?this._updateFixedArea(i):((i.csmNeedUpdate||this._levelCount!==r||this._shadowDistance!==s)&&(this._splitFrustumLevels(i),this._levelCount=r,this._shadowDistance=s),this._calculateCSM(t,i,n)))}},t.destroy=function(){this._castShadowObjects.length=0;for(var e=0;e<this._layers.length;e++)this._layers[e].destroy();this._layers.length=0},t._updateFixedArea=function(e){var t=v.director.root.device,i=e.shadowOrthoSize,n=e.shadowOrthoSize,r=e.shadowNear,s=e.shadowFar;En.fromRT(AM,e.node.getWorldRotation(),e.node.getWorldPosition()),En.invert(SM,AM),En.ortho(RM,-i,i,-n,n,r,s,t.capabilities.clipSpaceMinZ,t.capabilities.clipSpaceSignY),En.multiply(wM,RM,SM),this._specialLayer.matShadowView=SM,this._specialLayer.matShadowProj=RM,this._specialLayer.matShadowViewProj=wM,this._specialLayer.calculateValidFrustumOrtho(2*i,2*n,r,s,AM)},t._splitFrustumLevels=function(e){var t=.1,i=e.shadowDistance,n=i/t,r=v.director.root.pipeline.pipelineSceneData.csmSupported?e.csmLevel:1,s=e.csmLayerLambda;this._layers[0].splitCameraNear=t;for(var a=1;a<r;a++){var o=a/r,u=s*t*Math.pow(n,o)+(1-s)*(t+(i-t)*o),h=1.005*u;this._layers[a].splitCameraNear=u,this._layers[a-1].splitCameraFar=h}this._layers[r-1].splitCameraFar=i,e.csmNeedUpdate=!1},t._calculateCSM=function(e,t,i){var n=v.director.root.pipeline.pipelineSceneData.csmSupported?t.csmLevel:1,r=n>1?.5*i.size.x:i.size.x;if(!(r<0)){this._getCameraWorldMatrix(TM,e);for(var s=n-1;s>=0;s--){var a=this._layers[s],o=a.splitCameraNear,u=a.splitCameraFar;a.calculateSplitFrustum(e,TM,o,u),a.createMatrix(t,r,!1)}n===oT.LEVEL_1?(this._specialLayer.shadowCameraFar=this._layers[0].shadowCameraFar,En.copy(this._specialLayer.matShadowView,this._layers[0].matShadowView),En.copy(this._specialLayer.matShadowProj,this._layers[0].matShadowProj),En.copy(this._specialLayer.matShadowViewProj,this._layers[0].matShadowViewProj),this._specialLayer.copyToValidFrustum(this._layers[0].validFrustum)):(this._specialLayer.calculateSplitFrustum(e,TM,.1,t.shadowDistance),this._specialLayer.createMatrix(t,r,!0))}},t._getCameraWorldMatrix=function(e,t){if(t.node){var i=t.node,n=i.getWorldPosition(),r=i.getWorldRotation();En.fromRT(e,r,n),e.m08*=-1,e.m09*=-1,e.m10*=-1}},n(e,[{key:"castShadowObjects",get:function(){return this._castShadowObjects}},{key:"layerObjects",get:function(){return this._layerObjects}},{key:"layers",get:function(){return this._layers}},{key:"specialLayer",get:function(){return this._specialLayer}}]),e}(),HM=e("gQ",function(){function e(){this.fog=new SS,this.ambient=new Km,this.skybox=new mT,this.shadows=new cT,this.csmLayers=new kM,this.octree=new tb,this.lightProbes=v.internal.LightProbes?new v.internal.LightProbes:null,this.validPunctualLights=[],this.renderObjects=[],this.shadowFrameBufferMap=new Map,this._geometryRendererMaterials=[],this._geometryRendererPasses=[],this._geometryRendererShaders=[],this._occlusionQueryVertexBuffer=null,this._occlusionQueryIndicesBuffer=null,this._occlusionQueryInputAssembler=null,this._occlusionQueryMaterial=null,this._occlusionQueryShader=null,this._isHDR=!0,this._shadingScale=1,this._csmSupported=!0,this._shadingScale=1}var t=e.prototype;return t.activate=function(e){return this._device=e,this.initGeometryRendererMaterials(),this.initOcclusionQuery(),!0},t.initGeometryRendererMaterials=function(){for(var e=0,t=0;t<6;t++){this._geometryRendererMaterials[t]=new nT,this._geometryRendererMaterials[t]._uuid="geometry-renderer-material-"+t,this._geometryRendererMaterials[t].initialize({effectName:"builtin-geometry-renderer",technique:t});for(var i=0;i<this._geometryRendererMaterials[t].passes.length;++i)this._geometryRendererPasses[e]=this._geometryRendererMaterials[t].passes[i],this._geometryRendererShaders[e]=this._geometryRendererMaterials[t].passes[i].getShaderVariant(),e++}},t.initOcclusionQuery=function(){if(this._occlusionQueryInputAssembler||(this._occlusionQueryInputAssembler=this._createOcclusionQueryIA()),!this._occlusionQueryMaterial){var e=new nT;e._uuid="default-occlusion-query-material",e.initialize({effectName:"builtin-occlusion-query"}),this._occlusionQueryMaterial=e,e.passes.length>0&&(this._occlusionQueryShader=e.passes[0].getShaderVariant())}},t.getOcclusionQueryPass=function(){return this._occlusionQueryMaterial&&this._occlusionQueryMaterial.passes.length>0?this._occlusionQueryMaterial.passes[0]:null},t.updatePipelineSceneData=function(){},t.destroy=function(){var e,t,i;this.shadows.destroy(),this.csmLayers.destroy(),this.validPunctualLights.length=0,null===(e=this._occlusionQueryInputAssembler)||void 0===e||e.destroy(),this._occlusionQueryInputAssembler=null,null===(t=this._occlusionQueryVertexBuffer)||void 0===t||t.destroy(),this._occlusionQueryVertexBuffer=null,null===(i=this._occlusionQueryIndicesBuffer)||void 0===i||i.destroy(),this._occlusionQueryIndicesBuffer=null},t._createOcclusionQueryIA=function(){var e=this._device,t=new Float32Array([-1,-1,-1,1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,1,1]),i=3*Float32Array.BYTES_PER_ELEMENT,n=8*i;this._occlusionQueryVertexBuffer=e.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE,n,i)),this._occlusionQueryVertexBuffer.update(t);var r=new Uint16Array([0,2,1,1,2,3,4,5,6,5,7,6,1,3,7,1,7,5,0,4,6,0,6,2,0,1,5,0,5,4,2,6,7,2,7,3]),s=Uint16Array.BYTES_PER_ELEMENT,a=36*s;this._occlusionQueryIndicesBuffer=e.createBuffer(new Gl(Gc.INDEX|Gc.TRANSFER_DST,zc.DEVICE,a,s)),this._occlusionQueryIndicesBuffer.update(r);var o=[new i_("a_position",Fc.RGB32F)],u=new r_(o,[this._occlusionQueryVertexBuffer],this._occlusionQueryIndicesBuffer);return e.createInputAssembler(u)},n(e,[{key:"isHDR",get:function(){return this._isHDR},set:function(e){this._isHDR=e}},{key:"shadingScale",get:function(){return this._shadingScale},set:function(e){this._shadingScale=e}},{key:"csmSupported",get:function(){return this._csmSupported},set:function(e){this._csmSupported=e}},{key:"geometryRendererPasses",get:function(){return this._geometryRendererPasses}},{key:"geometryRendererShaders",get:function(){return this._geometryRendererShaders}}]),e}()),zM=Yp.makeMaskExclude([Yp.BitMask.UI_2D,Yp.BitMask.UI_3D,Yp.BitMask.GIZMOS,Yp.BitMask.EDITOR,Yp.BitMask.SCENE_GIZMO,Yp.BitMask.PROFILER]),VM="CC_USE_RGBE_OUTPUT",WM=LE("default"),jM=LE("reflect-map");function XM(e){var t=e.passes,i=v.rendering;bv()&&(WM=i.getPhaseID(i.getPassID("default"),"default"));for(var n=0;n<t.length;n++)if((!i||!i.enableEffectImport)&&t[n].phase===WM||bv()&&t[n].phaseID===WM)return n;return-1}function KM(e){var t=e.passes,i=v.rendering;bv()&&(jM=i.getPhaseID(i.getPassID("default"),"reflect-map"));for(var n=0;n<t.length;n++)if((!i||!i.enableEffectImport)&&t[n].phase===jM||bv()&&t[n].phaseID===jM)return n;return-1}var YM,qM,QM,ZM,JM,$M,eP,tP,iP,nP,rP,sP,aP,oP,uP,hP,cP,lP,_P,dP,fP,pP,mP,gP,vP,yP,EP,TP,AP,SP,RP,wP,IP,bP,OP,NP,CP,MP=function(){function e(e){this._pipeline=void 0,this._subModelsArray=[],this._passArray=[],this._shaderArray=[],this._rgbeSubModelsArray=[],this._instancedQueue=void 0,this._batchedQueue=void 0,this._pipeline=e,this._instancedQueue=new PC,this._batchedQueue=new MC}var t=e.prototype;return t.gatherRenderObjects=function(e,t,i){this.clear();var n=t.scene,r=this._pipeline.pipelineSceneData.skybox;r.enabled&&r.model&&e.camera.clearFlag&DI&&this.add(r.model);for(var s=n.models,a=e.camera.visibility,o=0;o<s.length;o++){var u=s[o];n.isCulledByLod(t,u)||u.enabled&&u.node&&u.worldBounds&&u.bakeToReflectionProbe&&(e.probeType===gb.CUBE?((a&u.node.layer)===u.node.layer||a&u.visFlags)&&$r.aabbWithAABB(u.worldBounds,e.boundingBox)&&this.add(u):((u.node.layer&zM)===u.node.layer||zM&u.visFlags)&&$r.aabbFrustum(u.worldBounds,e.camera.frustum)&&this.add(u))}this._instancedQueue.uploadBuffers(i),this._batchedQueue.uploadBuffers(i)},t.clear=function(){this._subModelsArray.length=0,this._shaderArray.length=0,this._passArray.length=0,this._instancedQueue.clear(),this._batchedQueue.clear(),this._rgbeSubModelsArray.length=0},t.add=function(e){for(var t=e.subModels,i=0;i<t.length;i++){var n=t[i],r=KM(n),s=!0;if(r<0&&(r=XM(n),s=!1),!(r<0)){var a=n.passes[r],o=a.batchingScheme;if(!s){var u=n.patches,h=[{name:VM,value:!0}];u=u?u.concat(h):h,n.onMacroPatchesStateChanged(u),this._rgbeSubModelsArray.push(n)}if(o===CE.INSTANCING){var c=a.getInstancedBuffer();c.merge(n,r),this._instancedQueue.queue.add(c)}else if(a.batchingScheme===CE.VB_MERGING){var l=a.getBatchedBuffer();l.merge(n,r,e),this._batchedQueue.queue.add(l)}else{var _=n.shaders[r];this._subModelsArray.push(n),_&&this._shaderArray.push(_),this._passArray.push(a)}}}},t.recordCommandBuffer=function(e,t,i){this._instancedQueue.recordCommandBuffer(e,t,i),this._batchedQueue.recordCommandBuffer(e,t,i);for(var n=0;n<this._subModelsArray.length;++n){var r=this._subModelsArray[n],s=this._shaderArray[n],a=this._passArray[n],o=r.inputAssembler,u=kE.getOrCreatePipelineState(e,a,s,t,o),h=a.descriptorSet;i.bindPipelineState(u),i.bindDescriptorSet(sg.MATERIAL,h),i.bindDescriptorSet(sg.LOCAL,r.descriptorSet),i.bindInputAssembler(o),i.draw(o)}this.resetRGBEMacro(),this._instancedQueue.clear(),this._batchedQueue.clear()},t.resetRGBEMacro=function(){for(var e=0;e<this._rgbeSubModelsArray.length;e++){var t=this._rgbeSubModelsArray[e],i=t.patches;if(i){for(var n=0;n<i.length;n++)if(i[n].name===VM){i.splice(n,1);break}t.onMacroPatchesStateChanged(i)}}},e}(),PP=[new Dl(1,1,1,1)],LP=e("h6",Gs("ReflectionProbeStage")((QM=qM=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._frameBuffer=null,t._renderArea=new bl,t._probe=null,t._rgbeColor=new Ki,t}s(t,e);var i=t.prototype;return i.setUsageInfo=function(e,t){this._probe=e,this._frameBuffer=t},i.destroy=function(){var e;this._frameBuffer=null,null===(e=this._probeRenderQueue)||void 0===e||e.clear()},i.clearFramebuffer=function(e){if(this._frameBuffer){PP[0].w=e.clearColor.w;var t=this._pipeline,i=t.pipelineSceneData.shadingScale,n=e.viewport,r=this._probe.resolution;this._renderArea.x=n.x*r,this._renderArea.y=n.y*r,this._renderArea.width=n.width*r*i,this._renderArea.height=n.height*r*i;var s=t.commandBuffers[0],a=this._frameBuffer.renderPass;s.beginRenderPass(a,this._frameBuffer,this._renderArea,PP,e.clearDepth,e.clearStencil),s.endRenderPass()}},i.render=function(e){var t=this._pipeline,i=t.commandBuffers[0];this._probeRenderQueue.gatherRenderObjects(this._probe,e,i),t.pipelineUBO.updateCameraUBO(this._probe.camera),this._renderArea.x=0,this._renderArea.y=0,this._renderArea.width=this._probe.renderArea().x,this._renderArea.height=this._probe.renderArea().y;var n=this._frameBuffer.renderPass;if(this._probe.camera.clearFlag&vl.COLOR){this._rgbeColor.x=this._probe.camera.clearColor.x,this._rgbeColor.y=this._probe.camera.clearColor.y,this._rgbeColor.z=this._probe.camera.clearColor.z;var r=function(e){var t=Math.max(Math.max(e.x,e.y),e.z),i=128;t>1e-4&&(i=Math.log(t)/Math.log(1.1),i=Ri((i=Math.ceil(i))+128,0,255));var n=1/Math.pow(1.1,i-128),r=function(e,t,i){if(t>i){var n=t;t=i,i=n}return e<t?t:e>i?i:e}(e.multiplyScalar(n),new Ki(0,0,0),new Ki(1,1,1));r.multiplyScalar(255);var s,a,o=un(r).add((s=r.subtract(un(r)))<(a=new Ki(.5,.5,.5))?a:s);return new zi(o.x/255,o.y/255,o.z/255,i/255)}(this._rgbeColor);PP[0].x=r.x,PP[0].y=r.y,PP[0].z=r.z,PP[0].w=r.w}var s=t.device;i.beginRenderPass(n,this._frameBuffer,this._renderArea,PP,this._probe.camera.clearDepth,this._probe.camera.clearStencil),i.bindDescriptorSet(sg.GLOBAL,t.descriptorSet),this._probeRenderQueue.recordCommandBuffer(s,n,i),i.endRenderPass(),t.pipelineUBO.updateCameraUBO(e)},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._probeRenderQueue=new MP(t)},t}(NO),qM.initInfo={name:"ReflectionProbeStage",priority:GO.FORWARD,tag:0},YM=QM))||YM),xP=e("h5",Gs("ReflectionProbeFlow")(($M=JM=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._stages.length){var i=new LP;i.initialize(LP.initInfo),this._stages.push(i)}return!0},i.activate=function(t){e.prototype.activate.call(this,t)},i.render=function(e){if(v.internal.reflectionProbeManager)for(var t=v.internal.reflectionProbeManager.getProbes(),i=0;i<t.length;i++)t[i].needRender&&t[i].probeType===gb.PLANAR&&this._renderStage(e,t[i])},i.destroy=function(){e.prototype.destroy.call(this)},i._renderStage=function(e,t){for(var i=0;i<this._stages.length;i++){var n=this._stages[i];if(t.probeType===gb.PLANAR)v.internal.reflectionProbeManager.updatePlanarMap(t,null),n.setUsageInfo(t,t.realtimePlanarTexture.window.framebuffer),n.render(e),v.internal.reflectionProbeManager.updatePlanarMap(t,t.realtimePlanarTexture.getGFXTexture());else{for(var r=0;r<6;r++){t.updateCameraDir(r);var s=t.bakedCubeTextures[r];n.setUsageInfo(t,s.window.framebuffer),n.render(e)}t.needRender=!1}}},t}(MO),JM.initInfo={name:"PIPELINE_FLOW_RELECTION_PROBE",priority:0,tag:dC.SCENE,stages:[]},ZM=$M))||ZM),DP=e("gR",(eP=Gs("ForwardPipeline"),tP=va([TC]),eP((nP=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).renderTextures=rP&&rP(),t._postRenderPass=null,t}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._flows.length){var i=new EM;i.initialize(EM.initInfo),this._flows.push(i);var n=new xP;n.initialize(xP.initInfo),this._flows.push(n);var r=new oM;r.initialize(oM.initInfo),this._flows.push(r)}return!0},i.activate=function(t){return this._macros={CC_PIPELINE_TYPE:0},this._pipelineSceneData=new HM,!(!e.prototype.activate.call(this,t)||!this._activeRenderer(t)&&(Z(2402),1))},i._ensureEnoughSize=function(e){for(var t=this._width,i=this._height,n=0;n<e.length;++n){var r=e[n].window;t=Math.max(r.width,t),i=Math.max(r.height,i)}t===this._width&&i===this._height||(this._width=t,this._height=i)},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler();for(var t=this._renderPasses.values(),i=t.next();!i.done;)i.value.destroy(),i=t.next();return this._commandBuffers.length=0,e.prototype.destroy.call(this)},i._activeRenderer=function(){var e=this.device;this._commandBuffers.push(e.commandBuffer);var t=this.globalDSManager.pointSampler;return this._descriptorSet.bindSampler(fg,t),this._descriptorSet.bindTexture(fg,PE.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(Sg,t),this._descriptorSet.bindTexture(Sg,PE.get("default-texture").getGFXTexture()),this._descriptorSet.update(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(cg.BINDING).destroy(),this._descriptorSet.getBuffer(_g.BINDING).destroy(),this._descriptorSet.getBuffer(lg.BINDING).destroy(),this._descriptorSet.getTexture(fg).destroy(),this._descriptorSet.getTexture(Sg).destroy())},n(t,[{key:"postRenderPass",get:function(){return this._postRenderPass}}]),t}(yC),rP=Cs(nP.prototype,"renderTextures",[tP,Ys],(function(){return[]})),iP=nP))||iP)),FP=[new Dl(0,0,0,0),new Dl(0,0,0,0),new Dl(0,0,0,0)],BP=e("gW",(sP=Gs("GbufferStage"),aP=va([RC]),sP((lP=cP=function(e){function t(){var t;return(t=e.call(this)||this).renderQueues=hP&&hP(),t._renderQueues=[],t._renderArea=new bl,t._batchedQueue=void 0,t._instancedQueue=void 0,t._phaseID=LE("default"),t._batchedQueue=new MC,t._instancedQueue=new PC,t}s(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),t.renderQueues&&(this.renderQueues=t.renderQueues),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=OC(this.renderQueues[n])},i.destroy=function(){},i.render=function(e){this._instancedQueue.clear(),this._batchedQueue.clear();var t=this._pipeline,i=t.device;this._renderQueues.forEach(NC),t.generateRenderArea(e,this._renderArea),t.updateQuadVertexData(this._renderArea,e.window);for(var n=t.pipelineSceneData.renderObjects,r=0,s=0,a=0,o=0;o<n.length;++o){var u=n[o],h=u.model.subModels;for(r=0;r<h.length;++r){var c=h[r],l=c.passes;for(s=0;s<l.length;++s){var _=l[s];if(_.phase===this._phaseID){var d=_.batchingScheme;if(d===CE.INSTANCING){var f=_.getInstancedBuffer();f.merge(c,s),this._instancedQueue.queue.add(f)}else if(d===CE.VB_MERGING){var p=_.getBatchedBuffer();p.merge(c,s,u.model),this._batchedQueue.queue.add(p)}else for(a=0;a<this._renderQueues.length;a++)this._renderQueues[a].insertRenderPass(u,r,s)}}}}this._renderQueues.forEach(CC);var m=t.commandBuffers[0];this._instancedQueue.uploadBuffers(m),this._batchedQueue.uploadBuffers(m),e.clearFlag&vl.COLOR&&(t.pipelineSceneData.isHDR?VE(FP[0],e.clearColor):(FP[0].x=e.clearColor.x,FP[0].y=e.clearColor.y,FP[0].z=e.clearColor.z)),FP[0].w=e.clearColor.w;var g=t.getPipelineRenderData().gbufferFrameBuffer,v=g.renderPass;m.beginRenderPass(v,g,this._renderArea,FP,e.clearDepth,e.clearStencil),m.setScissor(t.generateScissor(e)),m.setViewport(t.generateViewport(e)),m.bindDescriptorSet(sg.GLOBAL,t.descriptorSet);for(var y=0;y<this.renderQueues.length;y++)this._renderQueues[y].recordCommandBuffer(i,v,m);this._instancedQueue.recordCommandBuffer(i,v,m),this._batchedQueue.recordCommandBuffer(i,v,m),m.endRenderPass()},t}(NO),cP.initInfo={name:"GbufferStage",priority:HO.GBUFFER,tag:0,renderQueues:[{isTransparent:!1,sortMode:EC.FRONT_TO_BACK,stages:["default"]},{isTransparent:!0,sortMode:EC.BACK_TO_FRONT,stages:["default"]}]},hP=Cs((uP=lP).prototype,"renderQueues",[aP,Ys],(function(){return[]})),oP=uP))||oP)),UP=[new Dl(0,0,0,1)],GP=e("gX",(_P=Gs("LightingStage"),dP=va(nT),fP=va([RC]),_P((EP=yP=function(e){function t(){var t;return(t=e.call(this)||this)._deferredLitsBufs=null,t._maxDeferredLights=Pg.LIGHTS_PER_PASS,t._lightMeterScale=1e4,t._descriptorSet=null,t._renderArea=new bl,t._uiPhase=void 0,t._deferredMaterial=gP&&gP(),t.renderQueues=vP&&vP(),t._phaseID=LE("default"),t._renderQueues=[],t._uiPhase=new rM,t}s(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),!0},i.gatherLights=function(e){for(var t=this._pipeline,i=t.commandBuffers[0],n=e.scene.sphereLights,r=e.scene.spotLights,s=lr.create(0,0,0,1),a=new Float32Array(4),o=e.exposure,u=0,h=zi.length,c=h*this._maxDeferredLights,l=0;l<n.length&&u<this._maxDeferredLights;l++,++u){var _=n[l];if(lr.set(s,_.position.x,_.position.y,_.position.z,_.range),$r.sphereFrustum(s,e.frustum)){if(Ki.toArray(a,_.position),a[3]=0,this._lightBufferData.set(a,u*h),Ki.toArray(a,_.color),_.useColorTemperature){var d=_.colorTemperatureRGB;a[0]*=d.x,a[1]*=d.y,a[2]*=d.z}t.pipelineSceneData.isHDR?a[3]=_.luminance*o*this._lightMeterScale:a[3]=_.luminance,this._lightBufferData.set(a,u*h+1*c),a[0]=_.size,a[1]=_.range,a[2]=0,this._lightBufferData.set(a,u*h+2*c)}}for(var f=0;f<r.length&&u<this._maxDeferredLights;f++,++u){var p=r[f];if(lr.set(s,p.position.x,p.position.y,p.position.z,p.range),$r.sphereFrustum(s,e.frustum)){if(Ki.toArray(a,p.position),a[3]=1,this._lightBufferData.set(a,u*h+0*c),Ki.toArray(a,p.color),p.useColorTemperature){var m=p.colorTemperatureRGB;a[0]*=m.x,a[1]*=m.y,a[2]*=m.z}t.pipelineSceneData.isHDR?a[3]=p.luminance*o*this._lightMeterScale:a[3]=p.luminance,this._lightBufferData.set(a,u*h+1*c),a[0]=p.size,a[1]=p.range,a[2]=p.spotAngle,this._lightBufferData.set(a,u*h+2*c),Ki.toArray(a,p.direction),this._lightBufferData.set(a,u*h+3*c)}}var g=3*c+3;this._lightBufferData.set([u],g),i.updateBuffer(this._deferredLitsBufs,this._lightBufferData)},i._createStageDescriptor=function(e){var t=this._pipeline.device,i=16*Float32Array.BYTES_PER_ELEMENT*this._maxDeferredLights;i=Math.ceil(i/t.capabilities.uboOffsetAlignment)*t.capabilities.uboOffsetAlignment,this._deferredLitsBufs=t.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,i,t.capabilities.uboOffsetAlignment));var n=t.createBuffer(new kl(this._deferredLitsBufs,0,i));this._lightBufferData=new Float32Array(i/Float32Array.BYTES_PER_ELEMENT),this._descriptorSet=t.createDescriptorSet(new m_(e.localSetLayout)),this._descriptorSet.bindBuffer(Mg.BINDING,n);var r=t.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE,Ig.SIZE,Ig.SIZE));this._descriptorSet.bindBuffer(Ig.BINDING,r)},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._uiPhase.activate(t);for(var n=0;n<this.renderQueues.length;n++)this._renderQueues[n]=OC(this.renderQueues[n]);this._planarQueue=new nM(this._pipeline),this._deferredMaterial&&(t.pipelineSceneData.deferredLightingMaterial=this._deferredMaterial)},i.destroy=function(){var e;null===(e=this._deferredLitsBufs)||void 0===e||e.destroy(),this._deferredLitsBufs=null,this._descriptorSet=null},i.render=function(e){var t,i=this._pipeline,n=i.device,r=i.commandBuffers[0],s=i.pipelineSceneData,a=s.renderObjects;this._planarQueue.gatherShadowPasses(e,r),i.generateRenderArea(e,this._renderArea);for(var o=i.getPipelineRenderData(),u=s.deferredLightingMaterial.passes[0],h=u.getShaderVariant(),c=0;c<3;++c)u.descriptorSet.bindTexture(c,o.gbufferRenderTargets[c]),u.descriptorSet.bindSampler(c,o.sampler);u.descriptorSet.bindTexture(3,o.outputDepth),u.descriptorSet.bindSampler(3,o.sampler),u.descriptorSet.update(),this._descriptorSet||this._createStageDescriptor(u),this.gatherLights(e),e.clearFlag&vl.COLOR&&(UP[0].x=e.clearColor.x,UP[0].y=e.clearColor.y,UP[0].z=e.clearColor.z),UP[0].w=0;var l=o.outputFrameBuffer,_=l.renderPass;i.pipelineUBO.updateShadowUBO(e),r.beginRenderPass(_,l,this._renderArea,UP,e.clearDepth,e.clearStencil),r.setScissor(i.generateScissor(e)),r.setViewport(i.generateViewport(e)),r.bindDescriptorSet(sg.GLOBAL,i.descriptorSet);var d=i.quadIAOffscreen,f=null;null!=u&&null!=h&&null!=d&&(f=kE.getOrCreatePipelineState(n,u,h,_,d)),null!=f&&(this._descriptorSet.update(),r.bindPipelineState(f),r.bindDescriptorSet(sg.MATERIAL,u.descriptorSet),r.bindDescriptorSet(sg.LOCAL,this._descriptorSet),r.bindInputAssembler(d),r.draw(d)),this._renderQueues.forEach(NC);for(var p=0,m=0,g=0,v=0;v<a.length;++v){var y=a[v],E=y.model.subModels;for(p=0;p<E.length;++p){var T=E[p].passes;for(m=0;m<T.length;++m)if(T[m].phase===this._phaseID)for(g=0;g<this._renderQueues.length;g++)this._renderQueues[g].insertRenderPass(y,p,m)}}if(a.length>0){this._renderQueues.forEach(CC);for(var A=0;A<this._renderQueues.length;A++)this._renderQueues[A].recordCommandBuffer(n,_,r);this._planarQueue.recordCommandBuffer(n,_,r)}null===(t=e.geometryRenderer)||void 0===t||t.render(_,r,i.pipelineSceneData),this._uiPhase.render(e,_),r.endRenderPass()},t}(NO),yP.initInfo={name:"LightingStage",priority:HO.LIGHTING,tag:0},gP=Cs((mP=EP).prototype,"_deferredMaterial",[dP,Ys],(function(){return null})),vP=Cs(mP.prototype,"renderQueues",[fP,Ys],(function(){return[]})),pP=mP))||pP)),kP=[new Dl(0,0,0,1)],HP=e("gZ",(TP=Gs("PostProcessStage"),AP=va(nT),SP=va([RC]),TP((NP=OP=function(e){function t(){var t;return(t=e.call(this)||this)._postProcessMaterial=IP&&IP(),t.renderQueues=bP&&bP(),t._renderArea=new bl,t._stageDesc=void 0,t._localUBO=void 0,t._uiPhase=new rM,t}s(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._postProcessMaterial&&(t.pipelineSceneData.postprocessMaterial=this._postProcessMaterial),this._uiPhase.activate(t)},i.destroy=function(){},i.render=function(e){var t=this._pipeline,i=t.device,n=t.pipelineSceneData,r=t.commandBuffers[0];t.pipelineUBO.updateCameraUBO(e);var s=e.viewport;this._renderArea.x=s.x*e.window.width,this._renderArea.y=s.y*e.window.height,this._renderArea.width=s.width*e.window.width,this._renderArea.height=s.height*e.window.height;var a=t.getPipelineRenderData(),o=e.window.framebuffer,u=t.getRenderPass(e.clearFlag,o);e.clearFlag&vl.COLOR&&(kP[0].x=e.clearColor.x,kP[0].y=e.clearColor.y,kP[0].z=e.clearColor.z),kP[0].w=e.clearColor.w,r.beginRenderPass(u,o,this._renderArea,kP,e.clearDepth,e.clearStencil),r.bindDescriptorSet(sg.GLOBAL,t.descriptorSet);var h=n.postprocessMaterial.passes[0],c=h.getShaderVariant();t.bloomEnabled?h.descriptorSet.bindTexture(0,a.bloom.combineTex):h.descriptorSet.bindTexture(0,a.outputRenderTargets[0]),h.descriptorSet.bindSampler(0,a.sampler),h.descriptorSet.update();var l=e.window.swapchain?t.quadIAOnscreen:t.quadIAOffscreen,_=null;null!=h&&null!=c&&null!=l&&(_=kE.getOrCreatePipelineState(i,h,c,u,l));var d=t.pipelineSceneData.renderObjects;null!=_&&d.length>0&&(this._stageDesc||(this._stageDesc=i.createDescriptorSet(new m_(h.localSetLayout)),this._localUBO=i.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.DEVICE,Ig.SIZE,Ig.SIZE)),this._stageDesc.bindBuffer(Ig.BINDING,this._localUBO)),this._stageDesc.update(),r.bindPipelineState(_),r.bindDescriptorSet(sg.MATERIAL,h.descriptorSet),r.bindDescriptorSet(sg.LOCAL,this._stageDesc),r.bindInputAssembler(l),r.draw(l)),this._uiPhase.render(e,u),tT(i,u,r,t.profiler,e),r.endRenderPass()},t}(NO),OP.initInfo={name:"PostProcessStage",priority:UO.POST_PROCESS,tag:0},IP=Cs((wP=NP).prototype,"_postProcessMaterial",[AP,Ys],(function(){return null})),bP=Cs(wP.prototype,"renderQueues",[SP,Ys],(function(){return[]})),RP=wP))||RP));!function(e){e[e.NONE=0]="NONE",e[e.FXAA=1]="FXAA"}(CP||(CP={}));var zP,VP,WP,jP,XP,KP,YP,qP=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._antiAliasing=CP.NONE,t}s(t,e);var i=t.prototype;return i.updatePipelineSceneData=function(){this.updatePipelinePassInfo()},i.updateBloomPass=function(){if(this._bloomMaterial){var e=this._bloomMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently();for(var t=0;t<6;++t){var i=this._bloomMaterial.passes[1+t];i.beginChangeStatesSilently(),i.tryCompile(),i.endChangeStatesSilently();var n=this._bloomMaterial.passes[7+t];n.beginChangeStatesSilently(),n.tryCompile(),n.endChangeStatesSilently()}var r=this._bloomMaterial.passes[13];r.beginChangeStatesSilently(),r.tryCompile(),r.endChangeStatesSilently()}},i.updatePostProcessPass=function(){if(this.postprocessMaterial){var e=this.postprocessMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently()}},i.initPipelinePassInfo=function(){var e=new nT;e._uuid="builtin-deferred-material",e.initialize({effectName:"pipeline/deferred-lighting"});for(var t=0;t<e.passes.length;++t)e.passes[t].tryCompile();this._deferredLightingMaterial=e;var i=new nT;i._uuid="builtin-bloom-material",i.initialize({effectName:"pipeline/bloom"});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._bloomMaterial=i;var r=new nT;r._uuid="builtin-post-process-material",Rt.ENABLE_ANTIALIAS_FXAA&&(this._antiAliasing=CP.FXAA),r.initialize({effectName:"pipeline/post-process",defines:{ANTIALIAS_TYPE:this._antiAliasing}});for(var s=0;s<r.passes.length;++s)r.passes[s].tryCompile();this._postprocessMaterial=r,this.updatePipelinePassInfo()},i.updatePipelinePassInfo=function(){this.updateBloomPass(),this.updatePostProcessPass(),this.updateDeferredPassInfo()},i.activate=function(t){return e.prototype.activate.call(this,t),this.initPipelinePassInfo(),!0},i.updateDeferredPassInfo=function(){this.updateDeferredLightPass()},i.updateDeferredLightPass=function(){if(this._deferredLightingMaterial){v.director.root.pipeline.macros.CC_RECEIVE_SHADOW=1;var e=this._deferredLightingMaterial.passes[0];e.beginChangeStatesSilently(),e.tryCompile(),e.endChangeStatesSilently()}},n(t,[{key:"antiAliasing",get:function(){return this._antiAliasing},set:function(e){if(this._antiAliasing=e,this._postprocessMaterial){var t=this._postprocessMaterial.passes[0].defines;Object.assign(t,{ANTIALIAS_TYPE:e});var i=new nT;i.initialize({effectAsset:this._postprocessMaterial.effectAsset,defines:t});for(var n=0;n<i.passes.length;++n)i.passes[n].tryCompile();this._postprocessMaterial=i}}},{key:"bloomMaterial",get:function(){return this._bloomMaterial},set:function(e){this._bloomMaterial!==e&&e&&(this._bloomMaterial=e,this.updatePipelinePassInfo())}},{key:"postprocessMaterial",get:function(){return this._postprocessMaterial},set:function(e){this._postprocessMaterial!==e&&e&&(this._postprocessMaterial=e,this.updatePipelinePassInfo())}},{key:"deferredLightingMaterial",get:function(){return this._deferredLightingMaterial},set:function(e){this._deferredLightingMaterial!==e&&e&&(this._deferredLightingMaterial=e,this.updatePipelinePassInfo())}}]),t}(HM),QP=[new Dl(0,0,0,1)],ZP=function(){};ZP.SIZE=4*(ZP.COUNT=4+(ZP.TEXTURE_SIZE_OFFSET=0));var JP,$P,eL,tL,iL,nL,rL,sL,aL=e("gY",(zP=Gs("BloomStage"),VP=va(nT),zP((YP=KP=function(e){function t(){var t;return(t=e.call(this)||this).threshold=1,t.intensity=.8,t.iterations=2,t._bloomMaterial=XP&&XP(),t._renderArea=new bl,t._bloomUBO=[],t}s(t,e);var i=t.prototype;return i.initialize=function(t){return e.prototype.initialize.call(this,t),!0},i.activate=function(t,i){e.prototype.activate.call(this,t,i),this._bloomMaterial&&(t.pipelineSceneData.bloomMaterial=this._bloomMaterial)},i.destroy=function(){},i.render=function(e){var t,i=this._pipeline;if(i.generateBloomRenderData(),(null!==(t=e.window)&&void 0!==t&&t.swapchain||i.macros.CC_PIPELINE_TYPE)&&i.bloomEnabled&&0!==i.pipelineSceneData.renderObjects.length){if(0===this._bloomUBO.length)for(var n=0;n<14;++n)this._bloomUBO[n]=i.device.createBuffer(new Gl(Gc.UNIFORM|Gc.TRANSFER_DST,zc.HOST|zc.DEVICE,ZP.SIZE,ZP.SIZE));e.clearFlag&vl.COLOR&&(QP[0].x=e.clearColor.x,QP[0].y=e.clearColor.y,QP[0].z=e.clearColor.z),QP[0].w=e.clearColor.w,this._prefilterPass(e,i),this._downsamplePass(e,i),this._upsamplePass(e,i),this._combinePass(e,i)}},i._prefilterPass=function(e,t){t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;var i=t.commandBuffers[0],n=t.pipelineSceneData.bloomMaterial.passes[0],r=t.getPipelineRenderData(),s=r.bloom,a=new Float32Array(ZP.COUNT);a[ZP.TEXTURE_SIZE_OFFSET+2]=this.threshold,i.updateBuffer(this._bloomUBO[0],a),i.beginRenderPass(s.renderPass,s.prefilterFramebuffer,this._renderArea,QP,0,0),i.bindDescriptorSet(sg.GLOBAL,t.descriptorSet),n.descriptorSet.bindBuffer(0,this._bloomUBO[0]),n.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),n.descriptorSet.bindSampler(1,s.sampler),n.descriptorSet.update(),i.bindDescriptorSet(sg.MATERIAL,n.descriptorSet);var o=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,u=null,h=n.getShaderVariant();null!=n&&null!=h&&null!=o&&(u=kE.getOrCreatePipelineState(t.device,n,h,s.renderPass,o)),null!=u&&(i.bindPipelineState(u),i.bindInputAssembler(o),i.draw(o)),i.endRenderPass()},i._downsamplePass=function(e,t){t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=1,this._renderArea.height>>=1;for(var i=t.commandBuffers[0],n=t.pipelineSceneData.bloomMaterial,r=t.getPipelineRenderData().bloom,s=new Float32Array(ZP.COUNT),a=0;a<this.iterations;++a){s[ZP.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[ZP.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,i.updateBuffer(this._bloomUBO[a+1],s),this._renderArea.width>>=1,this._renderArea.height>>=1,i.beginRenderPass(r.renderPass,r.downsampleFramebuffers[a],this._renderArea,QP,0,0);var o=n.passes[1+a],u=o.getShaderVariant();o.descriptorSet.bindBuffer(0,this._bloomUBO[a+1]),0===a?o.descriptorSet.bindTexture(1,r.prefiterTex):o.descriptorSet.bindTexture(1,r.downsampleTexs[a-1]),o.descriptorSet.bindSampler(1,r.sampler),o.descriptorSet.update(),i.bindDescriptorSet(sg.MATERIAL,o.descriptorSet);var h=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,c=null;null!=o&&null!=u&&null!=h&&(c=kE.getOrCreatePipelineState(t.device,o,u,r.renderPass,h)),null!=c&&(i.bindPipelineState(c),i.bindInputAssembler(h),i.draw(h)),i.endRenderPass()}},i._upsamplePass=function(e,t){var i=t.getPipelineRenderData().bloom;t.generateRenderArea(e,this._renderArea),this._renderArea.width>>=this.iterations+1,this._renderArea.height>>=this.iterations+1;for(var n=t.commandBuffers[0],r=t.pipelineSceneData.bloomMaterial,s=new Float32Array(ZP.COUNT),a=0;a<this.iterations;++a){var o=a+6+1;s[ZP.TEXTURE_SIZE_OFFSET+0]=this._renderArea.width,s[ZP.TEXTURE_SIZE_OFFSET+1]=this._renderArea.height,n.updateBuffer(this._bloomUBO[o],s),this._renderArea.width<<=1,this._renderArea.height<<=1,n.beginRenderPass(i.renderPass,i.upsampleFramebuffers[this.iterations-1-a],this._renderArea,QP,0,0);var u=r.passes[7+a],h=u.getShaderVariant();u.descriptorSet.bindBuffer(0,this._bloomUBO[o]),0===a?u.descriptorSet.bindTexture(1,i.downsampleTexs[this.iterations-1]):u.descriptorSet.bindTexture(1,i.upsampleTexs[this.iterations-a]),u.descriptorSet.bindSampler(1,i.sampler),u.descriptorSet.update(),n.bindDescriptorSet(sg.MATERIAL,u.descriptorSet);var c=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,l=null;null!=u&&null!=h&&null!=c&&(l=kE.getOrCreatePipelineState(t.device,u,h,i.renderPass,c)),null!=l&&(n.bindPipelineState(l),n.bindInputAssembler(c),n.draw(c)),n.endRenderPass()}},i._combinePass=function(e,t){t.generateRenderArea(e,this._renderArea);var i=t.commandBuffers[0],n=t.pipelineSceneData.bloomMaterial,r=t.getPipelineRenderData(),s=r.bloom,a=new Float32Array(ZP.COUNT);a[ZP.TEXTURE_SIZE_OFFSET+3]=this.intensity,i.updateBuffer(this._bloomUBO[13],a),i.beginRenderPass(s.renderPass,s.combineFramebuffer,this._renderArea,QP,0,0),i.bindDescriptorSet(sg.GLOBAL,t.descriptorSet);var o=n.passes[13];o.descriptorSet.bindBuffer(0,this._bloomUBO[13]),o.descriptorSet.bindTexture(1,r.outputRenderTargets[0]),o.descriptorSet.bindTexture(2,s.upsampleTexs[0]),o.descriptorSet.bindSampler(1,s.sampler),o.descriptorSet.bindSampler(2,s.sampler),o.descriptorSet.update(),i.bindDescriptorSet(sg.MATERIAL,o.descriptorSet);var u=e.window.swapchain?t.quadIAOffscreen:t.quadIAOnscreen,h=null,c=o.getShaderVariant();null!=o&&null!=c&&null!=u&&(h=kE.getOrCreatePipelineState(t.device,o,c,s.renderPass,u)),null!=h&&(i.bindPipelineState(h),i.bindInputAssembler(u),i.draw(u)),i.endRenderPass()},t}(NO),KP.initInfo={name:"BloomStage",priority:UO.BLOOM,tag:0},XP=Cs((jP=YP).prototype,"_bloomMaterial",[VP,Ys],(function(){return null})),WP=jP))||WP)),oL=e("gV",Gs("MainFlow")((eL=$P=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._stages.length){var i=new BP;i.initialize(BP.initInfo),this._stages.push(i);var n=new GP;n.initialize(GP.initInfo),this._stages.push(n);var r=new aL;r.initialize(aL.initInfo),this._stages.push(r);var s=new HP;s.initialize(HP.initInfo),this._stages.push(s)}return!0},i.activate=function(t){e.prototype.activate.call(this,t)},i.render=function(t){e.prototype.render.call(this,t)},i.destroy=function(){e.prototype.destroy.call(this)},t}(MO),$P.initInfo={name:Qm,priority:zO.MAIN,stages:[]},JP=eL))||JP),uL=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).gbufferFrameBuffer=null,t.gbufferRenderTargets=[],t}return s(t,e),t}((function(){this.outputFrameBuffer=null,this.outputRenderTargets=[],this.outputDepth=null,this.sampler=null,this.bloom=null})),hL=e("gU",(tL=Gs("DeferredPipeline"),iL=va([TC]),tL((rL=function(e){function t(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this)._gbufferRenderPass=null,t._lightingRenderPass=null,t.renderTextures=sL&&sL(),t}s(t,e);var i=t.prototype;return i.initialize=function(t){if(e.prototype.initialize.call(this,t),0===this._flows.length){var i=new EM;i.initialize(EM.initInfo),this._flows.push(i);var n=new oL;n.initialize(oL.initInfo),this._flows.push(n)}return!0},i.activate=function(t){return this._macros={CC_PIPELINE_TYPE:1},this._pipelineSceneData=new qP,!(!e.prototype.activate.call(this,t)||!this._activeRenderer(t)&&(Z(2402),1))},i.destroy=function(){this._destroyUBOs(),this._destroyQuadInputAssembler(),this._destroyDeferredData();for(var t=this._renderPasses.values(),i=t.next();!i.done;)i.value.destroy(),i=t.next();return this._commandBuffers.length=0,e.prototype.destroy.call(this)},i.onGlobalPipelineStateChanged=function(){this.pipelineSceneData.updatePipelineSceneData()},i.getPipelineRenderData=function(){return this._pipelineRenderData||this._generateDeferredRenderData(),this._pipelineRenderData},i._activeRenderer=function(e){var t=this.device;this._commandBuffers.push(t.commandBuffer);var i=this.globalDSManager.pointSampler;this._descriptorSet.bindSampler(fg,i),this._descriptorSet.bindTexture(fg,PE.get("default-texture").getGFXTexture()),this._descriptorSet.bindSampler(Sg,i),this._descriptorSet.bindTexture(Sg,PE.get("default-texture").getGFXTexture()),this._descriptorSet.update();var n=new vC;if(!(n=this._createQuadInputAssembler()).quadIB||!n.quadVB||!n.quadIA)return!1;this._quadIB=n.quadIB,this._quadVBOffscreen=n.quadVB,this._quadIAOffscreen=n.quadIA;var r=this._createQuadInputAssembler();if(!r.quadIB||!r.quadVB||!r.quadIA)return!1;if(this._quadVBOnscreen=r.quadVB,this._quadIAOnscreen=r.quadIA,!this._gbufferRenderPass){var s=new s_;s.format=Fc.RGBA16F,s.loadOp=nl.CLEAR,s.storeOp=rl.STORE;var a=new s_;a.format=Fc.RGBA16F,a.loadOp=nl.CLEAR,a.storeOp=rl.STORE;var o=new s_;o.format=Fc.RGBA16F,o.loadOp=nl.CLEAR,o.storeOp=rl.STORE;var u=new a_;u.format=Fc.DEPTH_STENCIL,u.depthLoadOp=nl.CLEAR,u.depthStoreOp=rl.STORE,u.stencilLoadOp=nl.CLEAR,u.stencilStoreOp=rl.STORE;var h=new h_([s,a,o],u);this._gbufferRenderPass=t.createRenderPass(h)}if(!this._lightingRenderPass){var c=new s_;c.format=Fc.RGBA8,c.loadOp=nl.CLEAR,c.storeOp=rl.STORE,c.barrier=t.getGeneralBarrier(new c_(sl.NONE,sl.COLOR_ATTACHMENT_WRITE));var l=new a_;l.format=Fc.DEPTH_STENCIL,l.depthLoadOp=nl.LOAD,l.depthStoreOp=rl.DISCARD,l.stencilLoadOp=nl.LOAD,l.stencilStoreOp=rl.DISCARD,c.barrier=t.getGeneralBarrier(new c_(sl.DEPTH_STENCIL_ATTACHMENT_WRITE,sl.DEPTH_STENCIL_ATTACHMENT_WRITE));var _=new h_([c],l);this._lightingRenderPass=t.createRenderPass(_)}return this._width=e.width,this._height=e.height,this._generateDeferredRenderData(),!0},i._destroyUBOs=function(){this._descriptorSet&&(this._descriptorSet.getBuffer(cg.BINDING).destroy(),this._descriptorSet.getBuffer(_g.BINDING).destroy(),this._descriptorSet.getBuffer(lg.BINDING).destroy(),this._descriptorSet.getTexture(fg).destroy(),this._descriptorSet.getTexture(Sg).destroy())},i._destroyDeferredData=function(){var e=this._pipelineRenderData;if(e){e.gbufferFrameBuffer&&e.gbufferFrameBuffer.destroy(),e.outputFrameBuffer&&e.outputFrameBuffer.destroy(),e.outputDepth&&e.outputDepth.destroy();for(var t=0;t<e.gbufferRenderTargets.length;t++)e.gbufferRenderTargets[t].destroy();e.gbufferRenderTargets.length=0;for(var i=0;i<e.outputRenderTargets.length;i++)e.outputRenderTargets[i].destroy();e.outputRenderTargets.length=0,this._destroyBloomData()}this._pipelineRenderData=null},i._ensureEnoughSize=function(e){for(var t=this._width,i=this._height,n=0;n<e.length;++n){var r=e[n].window;t=Math.max(r.width,t),i=Math.max(r.height,i)}t===this._width&&i===this._height||(this._width=t,this._height=i,this._destroyDeferredData(),this._generateDeferredRenderData())},i._generateDeferredRenderData=function(){for(var e=this,t=this.device,i=this._pipelineRenderData=new uL,n=this.pipelineSceneData,r=0;r<3;++r)i.gbufferRenderTargets.push(t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale)));i.outputDepth=t.createTexture(new Wl(Vc.TEX2D,Wc.DEPTH_STENCIL_ATTACHMENT|Wc.SAMPLED,Fc.DEPTH_STENCIL,this._width*n.shadingScale,this._height*n.shadingScale)),i.gbufferFrameBuffer=t.createFramebuffer(new d_(this._gbufferRenderPass,i.gbufferRenderTargets,i.outputDepth)),i.outputRenderTargets.push(t.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED,Fc.RGBA16F,this._width*n.shadingScale,this._height*n.shadingScale))),i.outputFrameBuffer=t.createFramebuffer(new d_(this._lightingRenderPass,i.outputRenderTargets,null)),i.sampler=this.globalDSManager.pointSampler,this.on(CO.ATTACHMENT_SCALE_CAHNGED,(function(t){i.sampler=t<1?e.globalDSManager.pointSampler:e.globalDSManager.linearSampler,i.gbufferFrameBuffer=e.newFramebufferByRatio(i.gbufferFrameBuffer),i.gbufferFrameBuffer=e.newFramebufferByRatio(i.outputFrameBuffer)}))},t}(yC),sL=Cs(rL.prototype,"renderTextures",[iL,Ys],(function(){return[]})),nL=rL))||nL));function cL(){var e=new DP;return e.initialize({flows:[]}),e}var lL,_L=e("da",function(){function e(e){this._root=void 0,this._name="",this._cameras=[],this._models=[],this._lodGroups=[],this._batches=[],this._directionalLights=[],this._sphereLights=[],this._spotLights=[],this._mainLight=null,this._modelId=0,this._lodStateCache=null,this._root=e}e.registerCreateFunc=function(t){t._createSceneFun=function(t){return new e(t)}};var t=e.prototype;return t.initialize=function(e){return this._name=e.name,this._lodStateCache=new pL(this),!0},t.update=function(e){var t=this._mainLight;t&&t.update();for(var i=this._sphereLights,n=0;n<i.length;n++)i[n].update();for(var r=this._spotLights,s=0;s<r.length;s++)r[s].update();for(var a=this._models,o=0;o<a.length;o++){var u=a[o];u.enabled&&(u.updateTransform(e),u.updateUBOs(e))}this._lodStateCache.updateLodState()},t.destroy=function(){this.removeCameras(),this.removeSphereLights(),this.removeSpotLights(),this.removeModels(),this.removeLODGroups(),this._lodStateCache.clearCache()},t.isCulledByLod=function(e,t){return this._lodStateCache.isLodModelCulled(e,t)},t.addCamera=function(e){e.attachToScene(this),this._cameras.push(e),this._lodStateCache.addCamera(e)},t.removeCamera=function(e){for(var t=0;t<this._cameras.length;++t)if(this._cameras[t]===e)return this._cameras.splice(t,1),e.detachFromScene(),void this._lodStateCache.removeCamera(e)},t.removeCameras=function(){for(var e,t=d(this._cameras);!(e=t()).done;){var i=e.value;i.detachFromScene(),this._lodStateCache.removeCamera(i)}this._cameras.splice(0)},t.setMainLight=function(e){this._mainLight=e},t.unsetMainLight=function(e){if(this._mainLight===e){var t=this._directionalLights;if(t.length)return this.setMainLight(t[t.length-1]),void(this._mainLight.node&&(this._mainLight.node.hasChangedFlags|=Qp.ROTATION));this.setMainLight(null)}},t.addDirectionalLight=function(e){e.attachToScene(this),this._directionalLights.push(e)},t.removeDirectionalLight=function(e){for(var t=0;t<this._directionalLights.length;++t)if(this._directionalLights[t]===e)return e.detachFromScene(),void this._directionalLights.splice(t,1)},t.addSphereLight=function(e){e.attachToScene(this),this._sphereLights.push(e)},t.removeSphereLight=function(e){for(var t=0;t<this._sphereLights.length;++t)if(this._sphereLights[t]===e)return e.detachFromScene(),void this._sphereLights.splice(t,1)},t.addSpotLight=function(e){e.attachToScene(this),this._spotLights.push(e)},t.removeSpotLight=function(e){for(var t=0;t<this._spotLights.length;++t)if(this._spotLights[t]===e)return e.detachFromScene(),void this._spotLights.splice(t,1)},t.removeSphereLights=function(){for(var e=0;e<this._sphereLights.length;++e)this._sphereLights[e].detachFromScene();this._sphereLights.length=0},t.removeSpotLights=function(){for(var e=0;e<this._spotLights.length;++e)this._spotLights[e].detachFromScene();this._spotLights=[]},t.addModel=function(e){e.attachToScene(this),this._models.push(e)},t.removeModel=function(e){for(var t=0;t<this._models.length;++t)if(this._models[t]===e)return this._lodStateCache.removeModel(e),e.detachFromScene(),void this._models.splice(t,1)},t.removeModels=function(){for(var e,t=d(this._models);!(e=t()).done;){var i=e.value;this._lodStateCache.removeModel(i),i.detachFromScene(),i.destroy()}this._models.length=0},t.addBatch=function(e){this._batches.push(e)},t.removeBatch=function(e){for(var t=0;t<this._batches.length;++t)if(this._batches[t]===e)return void this._batches.splice(t,1)},t.removeBatches=function(){this._batches.length=0},t.addLODGroup=function(e){this._lodGroups.push(e),e.attachToScene(this),this._lodStateCache.addLodGroup(e)},t.removeLODGroup=function(e){var t=this._lodGroups.indexOf(e);t>=0&&(this._lodGroups.splice(t,1),e.detachFromScene(),this._lodStateCache.removeLodGroup(e))},t.removeLODGroups=function(){for(var e,t=d(this._lodGroups);!(e=t()).done;){var i=e.value;this._lodStateCache.removeLodGroup(i)}this._lodGroups.length=0},t.onGlobalPipelineStateChanged=function(){for(var e,t=d(this._models);!(e=t()).done;)e.value.onGlobalPipelineStateChanged()},t.generateModelId=function(){return this._modelId++},n(e,[{key:"root",get:function(){return this._root}},{key:"name",get:function(){return this._name}},{key:"cameras",get:function(){return this._cameras}},{key:"mainLight",get:function(){return this._mainLight}},{key:"sphereLights",get:function(){return this._sphereLights}},{key:"spotLights",get:function(){return this._spotLights}},{key:"models",get:function(){return this._models}},{key:"batches",get:function(){return this._batches}},{key:"lodGroups",get:function(){return this._lodGroups}}]),e}()),dL=function(){this.ownerLodLevel=-1,this.lodGroup=null,this.visibleCameras=new Map},fL=function(){this.usedLevel=-1,this.transformDirty=!0},pL=function(){function e(e){this._renderScene=null,this._modelsInLODGroup=new Map,this._lodStateInCamera=new Map,this._newAddedLodGroupVec=new Array,this._renderScene=e}var t=e.prototype;return t.addCamera=function(e){for(var t,i=d(this._renderScene.lodGroups);!(t=i()).done;){var n=t.value.node.layer;if((e.visibility&n)===n){this._lodStateInCamera.has(e)||this._lodStateInCamera.set(e,new Map);break}}},t.removeCamera=function(e){this._lodStateInCamera.has(e)&&this._lodStateInCamera.delete(e)},t.addLodGroup=function(e){this._newAddedLodGroupVec.push(e);for(var t,i=d(this._renderScene.cameras);!(t=i()).done;){var n=t.value;if(!this._lodStateInCamera.has(n)){var r=e.node.layer;(n.visibility&r)===r&&this._lodStateInCamera.set(n,new Map)}}},t.removeLodGroup=function(e){for(var t=0;t<e.lodCount;t++)for(var i,n=d(e.lodDataArray[t].models);!(i=n()).done;){var r=i.value;this._modelsInLODGroup.delete(r)}for(var s,a=d(this._lodStateInCamera);!(s=a()).done;)s.value[1].delete(e)},t.removeModel=function(e){this._modelsInLODGroup.has(e)&&this._modelsInLODGroup.delete(e)},t.updateLodState=function(){for(var e,t=this,i=d(this._newAddedLodGroupVec);!(e=i()).done;)for(var n=e.value,r=0;r<n.lodCount;r++)for(var s,a=d(n.lodDataArray[r].models);!(s=a()).done;){var o=s.value,u=this._modelsInLODGroup.get(o);u||(u=new dL),u.ownerLodLevel=r,u.lodGroup=n,this._modelsInLODGroup.set(o,u)}this._newAddedLodGroupVec.length=0;for(var h,c=function(){var e=h.value;if(e.enabled){var i=e.getLockedLODLevels();if(i.length>0){if(e.node.hasChangedFlags>0)for(var n,r=d(t._lodStateInCamera);!(n=r()).done;){var s=n.value,a=s[1].get(e);a||(a=new fL,s[1].set(e,a)),a.transformDirty=!0}if(e.isLockLevelChanged()){e.resetLockChangeFlag();for(var o=0;o<e.lodCount;o++)for(var u,c=d(e.lodDataArray[o].models);!(u=c()).done;){var l=u.value,_=t._modelsInLODGroup.get(l);if(_&&(_.visibleCameras.clear(),l.node&&l.node.active))for(var f,p=d(i);!(f=p()).done;){var m=f.value;if(_.ownerLodLevel===m){for(var g,v=d(t._lodStateInCamera);!(g=v()).done;){var y=g.value;_.visibleCameras.set(y[0],!0)}break}}}}return"continue"}for(var E,T=!1,A=d(t._lodStateInCamera);!(E=A()).done;){var S=E.value,R=S[1].get(e);R||(R=new fL,S[1].set(e,R));var w=S[0].node.hasChangedFlags,I=e.node.hasChangedFlags;if(w>0||I>0||R.transformDirty){R.transformDirty&&(R.transformDirty=!1);var b=e.getVisibleLODLevel(S[0]);b!==R.usedLevel&&(R.usedLevel=b,T=!0)}}if(e.isLockLevelChanged()&&(e.resetLockChangeFlag(),T=!0),T)for(var O=0;O<e.lodCount;O++)for(var N,C=function(){var i=N.value,n=t._modelsInLODGroup.get(i);n&&(n.visibleCameras.clear(),i.node&&i.node.active&&t._lodStateInCamera.forEach((function(t,i){var r=-1,s=t.get(e);s&&(r=s.usedLevel),n.ownerLodLevel===r&&n.visibleCameras.set(i,!0)})))},M=d(e.lodDataArray[O].models);!(N=M()).done;)C()}},l=d(this._renderScene.lodGroups);!(h=l()).done;)c()},t.isLodModelCulled=function(e,t){var i=this._modelsInLODGroup.get(t);return!!i&&!i.visibleCameras.has(e)},t.clearCache=function(){this._modelsInLODGroup.clear(),this._lodStateInCamera.clear(),this._newAddedLodGroupVec.length=0},t.isLodGroupVisibleByCamera=function(e,t){var i=e.node.layer;return(t.visibility&i)===i},e}(),mL=((lL={})[_c.PORTRAIT]=xc.IDENTITY,lL[_c.LANDSCAPE_RIGHT]=xc.ROTATE_90,lL[_c.PORTRAIT_UPSIDE_DOWN]=xc.ROTATE_180,lL[_c.LANDSCAPE_LEFT]=xc.ROTATE_270,lL),gL=function(){function e(){this._title="",this._width=1,this._height=1,this._swapchain=null,this._renderPass=null,this._colorTextures=[],this._depthStencilTexture=null,this._cameras=[],this._hasOnScreenAttachments=!1,this._hasOffScreenAttachments=!1,this._framebuffer=null,this._device=null}e.registerCreateFunc=function(t){t._createWindowFun=function(t){return new e(t)}};var t=e.prototype;return t.initialize=function(e,t){if(void 0!==t.title&&(this._title=t.title),void 0!==t.swapchain&&(this._swapchain=t.swapchain),this._width=t.width,this._height=t.height,this._device=e,this._renderPass=e.createRenderPass(t.renderPassInfo),t.swapchain)this._swapchain=t.swapchain,this._colorTextures.push(t.swapchain.colorTexture),this._depthStencilTexture=t.swapchain.depthStencilTexture;else{for(var i=0;i<t.renderPassInfo.colorAttachments.length;i++)this._colorTextures.push(e.createTexture(new Wl(Vc.TEX2D,Wc.COLOR_ATTACHMENT|Wc.SAMPLED|Wc.TRANSFER_SRC,t.renderPassInfo.colorAttachments[i].format,this._width,this._height)));t.renderPassInfo.depthStencilAttachment.format!==Fc.UNKNOWN&&(this._depthStencilTexture=e.createTexture(new Wl(Vc.TEX2D,Wc.DEPTH_STENCIL_ATTACHMENT|Wc.SAMPLED,t.renderPassInfo.depthStencilAttachment.format,this._width,this._height)),this._hasOffScreenAttachments=!0)}return this._framebuffer=e.createFramebuffer(new d_(this._renderPass,this._colorTextures,this._depthStencilTexture)),!0},t.destroy=function(){this.clearCameras(),this._framebuffer&&(this._framebuffer.destroy(),this._framebuffer=null),this._depthStencilTexture&&(this._depthStencilTexture.destroy(),this._depthStencilTexture=null);for(var e=0;e<this._colorTextures.length;e++){var t=this._colorTextures[e];t&&t.destroy()}this._colorTextures.length=0,this._device=null},t.resize=function(e,t){if(this._swapchain)this._swapchain.resize(e,t,mL[gc.orientation]),this._width=this._swapchain.width,this._height=this._swapchain.height;else{for(var i=0;i<this._colorTextures.length;i++)this._colorTextures[i].resize(e,t);this._depthStencilTexture&&this._depthStencilTexture.resize(e,t),this._width=e,this._height=t}this.framebuffer&&(this.framebuffer.destroy(),this._framebuffer=this._device.createFramebuffer(new d_(this._renderPass,this._colorTextures,this._depthStencilTexture)));for(var n,r=d(this._cameras);!(n=r()).done;)n.value.resize(e,t)},t.extractRenderCameras=function(e){for(var t=0;t<this._cameras.length;t++){var i=this._cameras[t];i.enabled&&(i.update(),e.push(i))}},t.attachCamera=function(e){for(var t=0;t<this._cameras.length;t++)if(this._cameras[t]===e)return;this._cameras.push(e),this.sortCameras()},t.detachCamera=function(e){for(var t=0;t<this._cameras.length;++t)if(this._cameras[t]===e)return void this._cameras.splice(t,1)},t.clearCameras=function(){this._cameras.length=0},t.sortCameras=function(){this._cameras.sort((function(e,t){return e.priority-t.priority}))},n(e,[{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"swapchain",get:function(){return this._swapchain}},{key:"framebuffer",get:function(){return this._framebuffer}},{key:"cameras",get:function(){return this._cameras}}]),e}(),vL=e("fL",function(){function e(e){var t=this;this._createSceneFun=null,this._createWindowFun=null,this._device=void 0,this._windows=[],this._mainWindow=null,this._curWindow=null,this._tempWindow=null,this._usesCustomPipeline=!0,this._pipeline=null,this._pipelineEvent=null,this._classicPipeline=null,this._customPipeline=null,this._batcher=null,this._dataPoolMgr=void 0,this._scenes=[],this._modelPools=new Map,this._cameraPool=null,this._lightPools=new Map,this._debugView=new dO,this._fpsTime=0,this._frameCount=0,this._fps=0,this._fixedFPS=0,this._useDeferredPipeline=!1,this._fixedFPSFrameTime=0,this._cumulativeTime=0,this._frameTime=0,this._cameraList=[],this._device=e,this._dataPoolMgr=v.internal.DataPoolManager&&new v.internal.DataPoolManager(e),_L.registerCreateFunc(this),gL.registerCreateFunc(this),this._cameraPool=new Th((function(){return new BI(t._device)}),4,(function(e){return e.destroy()}))}var t=e.prototype;return t.initialize=function(){var e,t=gd.swapchain,i=new s_;i.format=t.colorTexture.format;var n=new a_;n.format=t.depthStencilTexture.format,n.depthStoreOp=rl.DISCARD,n.stencilStoreOp=rl.DISCARD;var r=new h_([i],n);this._mainWindow=this.createWindow({title:"rootMainWindow",width:t.width,height:t.height,renderPassInfo:r,swapchain:t}),this._curWindow=this._mainWindow;var s=St.querySettings(At.Category.ANIMATION,"customJointTextureLayouts")||[];null===(e=this._dataPoolMgr)||void 0===e||e.jointTexturePool.registerCustomTextureLayouts(s),this._resizeMaxJointForDS()},t.destroy=function(){this.destroyScenes(),this._pipeline&&(this._pipeline.destroy(),this._pipeline=null,this._pipelineEvent=null),this._batcher&&(this._batcher.destroy(),this._batcher=null),this._curWindow=null,this._mainWindow=null,this.dataPoolManager.clear(),v.rendering&&v.rendering.destroy()},t.resize=function(e,t){for(var i,n=d(this._windows);!(i=n()).done;){var r=i.value;r.swapchain&&r.resize(e,t)}},t.setRenderPipeline=function(e){var t=v.internal,i=v.director,n=v.rendering;e instanceof hL&&(this._useDeferredPipeline=!0);var r=!1;if(e||(e=cL(),r=!0),this._useDeferredPipeline&&this.device.hasFeature(Dc.COMPUTE_SHADER)||(e.clusterEnabled=!1),e.bloomEnabled=!1,""!==Rt.CUSTOM_PIPELINE_NAME&&n&&this.usesCustomPipeline?(this._customPipeline=n.createCustomPipeline(),r=!0,this._pipeline=this._customPipeline):(this._classicPipeline=e,this._pipeline=this._classicPipeline,this._pipelineEvent=this._classicPipeline,this._usesCustomPipeline=!1),(St.querySettings(At.Category.RENDERING,"renderMode")!==ld.HEADLESS||this._classicPipeline)&&!this._pipeline.activate(this._mainWindow.swapchain))return r&&this._pipeline.destroy(),this._classicPipeline=null,this._customPipeline=null,this._pipeline=null,this._pipelineEvent=null,!1;var s=i.getScene();return s&&s.globals.activate(),this.onGlobalPipelineStateChanged(),!(!this._batcher&&t.Batcher2D&&(this._batcher=new t.Batcher2D(this),!this._batcher.initialize())&&(this.destroy(),1))},t.onGlobalPipelineStateChanged=function(){for(var e=0;e<this._scenes.length;e++)this._scenes[e].onGlobalPipelineStateChanged();this._pipeline.onGlobalPipelineStateChanged()},t.activeWindow=function(e){this._curWindow=e},t.resetCumulativeTime=function(){this._cumulativeTime=0},t.frameMove=function(e){var t=v.director,i=v.Director;this._frameTime=e,++this._frameCount,this._cumulativeTime+=e,this._fpsTime+=e,this._fpsTime>1&&(this._fps=this._frameCount,this._frameCount=0,this._fpsTime=0);for(var n=0;n<this._scenes.length;++n)this._scenes[n].removeBatches();var r=this._windows,s=this._cameraList;s.length=0;for(var a=0;a<r.length;a++)r[a].extractRenderCameras(s);if(this._pipeline&&s.length>0){this._device.acquire([gd.swapchain]);var o=this._scenes,u=t.getTotalFrames();this._batcher&&(this._batcher.update(),this._batcher.uploadBuffers());for(var h=0;h<o.length;h++)o[h].update(u);t.emit(i.EVENT_BEFORE_COMMIT),s.sort((function(e,t){return e.priority-t.priority}));for(var c=0;c<s.length;++c){var l;null===(l=s[c].geometryRenderer)||void 0===l||l.update()}t.emit(i.EVENT_BEFORE_RENDER),this._pipeline.render(s),t.emit(i.EVENT_AFTER_RENDER),this._device.present()}this._batcher&&this._batcher.reset()},t.createWindow=function(e){var t=this._createWindowFun(this);return t.initialize(this.device,e),this._windows.push(t),t},t.destroyWindow=function(e){for(var t=0;t<this._windows.length;++t)if(this._windows[t]===e)return e.destroy(),void this._windows.splice(t,1)},t.destroyWindows=function(){for(var e,t=d(this._windows);!(e=t()).done;)e.value.destroy();this._windows.length=0},t.createScene=function(e){var t=this._createSceneFun(this);return t.initialize(e),this._scenes.push(t),t},t.destroyScene=function(e){for(var t=0;t<this._scenes.length;++t)if(this._scenes[t]===e)return e.destroy(),void this._scenes.splice(t,1)},t.destroyScenes=function(){for(var e,t=d(this._scenes);!(e=t()).done;)e.value.destroy();this._scenes.length=0},t.createModel=function(e){var t=this._modelPools.get(e);t||(this._modelPools.set(e,new Th((function(){return new e}),10,(function(e){return e.destroy()}))),t=this._modelPools.get(e));var i=t.alloc();return i.initialize(),i},t.destroyModel=function(e){var t=this._modelPools.get(e.constructor);t?(t.free(e),e.scene&&e.scene.removeModel(e)):q(1300,e.constructor.name),e.destroy()},t.createCamera=function(){return this._cameraPool.alloc()},t.createLight=function(e){var t=this._lightPools.get(e);t||(this._lightPools.set(e,new Th((function(){return new e}),4,(function(e){return e.destroy()}))),t=this._lightPools.get(e));var i=t.alloc();return i.initialize(),i},t.destroyLight=function(e){if(e.scene)switch(e.type){case JI.DIRECTIONAL:e.scene.removeDirectionalLight(e);break;case JI.SPHERE:e.scene.removeSphereLight(e);break;case JI.SPOT:e.scene.removeSpotLight(e)}e.destroy()},t.recycleLight=function(e){var t=this._lightPools.get(e.constructor);if(t&&(t.free(e),e.scene))switch(e.type){case JI.DIRECTIONAL:e.scene.removeDirectionalLight(e);break;case JI.SPHERE:e.scene.removeSphereLight(e);break;case JI.SPOT:e.scene.removeSpotLight(e)}},t._resizeMaxJointForDS=function(){var e=(cg.COUNT+lg.COUNT+_g.COUNT+Ig.COUNT)/4,t=Math.floor((gd.gfxDevice.capabilities.maxVertexUniformVectors-e)/3);Bg(t=t<256?t:256)},n(e,[{key:"device",get:function(){return this._device}},{key:"mainWindow",get:function(){return this._mainWindow}},{key:"curWindow",get:function(){return this._curWindow},set:function(e){this._curWindow=e}},{key:"tempWindow",get:function(){return this._tempWindow},set:function(e){this._tempWindow=e}},{key:"windows",get:function(){return this._windows}},{key:"usesCustomPipeline",get:function(){return this._usesCustomPipeline}},{key:"pipeline",get:function(){return this._pipeline}},{key:"customPipeline",get:function(){return this._customPipeline}},{key:"pipelineEvent",get:function(){return this._pipelineEvent}},{key:"batcher2D",get:function(){return this._batcher}},{key:"scenes",get:function(){return this._scenes}},{key:"debugView",get:function(){return this._debugView}},{key:"cumulativeTime",get:function(){return this._cumulativeTime}},{key:"frameTime",get:function(){return this._frameTime}},{key:"frameCount",get:function(){return this._frameCount}},{key:"fps",get:function(){return this._fps}},{key:"fixedFPS",get:function(){return this._fixedFPS},set:function(e){e>0?(this._fixedFPS=e,this._fixedFPSFrameTime=1e3/e):this._fixedFPSFrameTime=0}},{key:"dataPoolManager",get:function(){return this._dataPoolMgr}},{key:"useDeferredPipeline",get:function(){return this._useDeferredPipeline}},{key:"cameraList",get:function(){return this._cameraList}}]),e}());v.Root=vL,di.Attr.setClassAttr(Yf,"target","type","Object"),di.Attr.setClassAttr(Yf,"target","ctor",Wm);var yL,EL=new Array(16),TL=null,AL=new Rn,SL=[Jp.TOUCH_START,Jp.TOUCH_MOVE,Jp.TOUCH_END,Jp.TOUCH_CANCEL],RL=[Jp.MOUSE_DOWN,Jp.MOUSE_ENTER,Jp.MOUSE_MOVE,Jp.MOUSE_LEAVE,Jp.MOUSE_UP,Jp.MOUSE_WHEEL];!function(e){e[e.ADD_POINTER_EVENT_PROCESSOR=0]="ADD_POINTER_EVENT_PROCESSOR",e[e.REMOVE_POINTER_EVENT_PROCESSOR=1]="REMOVE_POINTER_EVENT_PROCESSOR",e[e.MARK_LIST_DIRTY=2]="MARK_LIST_DIRTY"}(yL||(yL=e("e1",{})));var wL,IL=e("dz",function(){function e(e){this.claimedTouchIdList=[],this.maskList=null,this.cachedCameraPriority=0,this.previousMouseIn=!1,this.bubblingTarget=null,this.capturingTarget=null,this.shouldHandleEventMouse=!1,this.shouldHandleEventTouch=!1,this._dispatchingTouch=null,this._isEnabled=!1,this._node=void 0,this._node=e}var t=e.prototype;return t.setEnabled=function(t,i){if(void 0===i&&(i=!1),this._isEnabled!==t){this._isEnabled=t;var n=this.node.children;if(t&&this._attachMask(),e.callbacksInvoker.emit(yL.MARK_LIST_DIRTY),i&&n.length>0)for(var r=0;r<n.length;++r)n[r]._eventProcessor.setEnabled(t,!0)}},t.reattach=function(){var t,i=this;this.node.walk((function(n){t||(t=i._searchComponentsInParent(e._maskComp)),n.eventProcessor.maskList=t}))},t.destroy=function(){if(TL===this._node&&(TL=null),this.capturingTarget&&this.capturingTarget.clear(),this.bubblingTarget&&this.bubblingTarget.clear(),e.callbacksInvoker.emit(yL.REMOVE_POINTER_EVENT_PROCESSOR,this),this._dispatchingTouch){var t=new Lw([this._dispatchingTouch],!0,bw.TOUCH_CANCEL);t.touch=this._dispatchingTouch,this.dispatchEvent(t),this._dispatchingTouch=null}},t.on=function(e,t,i,n){var r,s;return this._tryEmittingAddEvent(e),((n=!!n)?null!==(r=this.capturingTarget)&&void 0!==r?r:this.capturingTarget=this._newCallbacksInvoker():null!==(s=this.bubblingTarget)&&void 0!==s?s:this.bubblingTarget=this._newCallbacksInvoker()).on(e,t,i),t},t.once=function(e,t,i,n){var r,s;return this._tryEmittingAddEvent(e),((n=!!n)?null!==(r=this.capturingTarget)&&void 0!==r?r:this.capturingTarget=this._newCallbacksInvoker():null!==(s=this.bubblingTarget)&&void 0!==s?s:this.bubblingTarget=this._newCallbacksInvoker()).on(e,t,i,!0),t},t.off=function(e,t,i,n){var r;null===(r=(n=!!n)?this.capturingTarget:this.bubblingTarget)||void 0===r||r.off(e,t,i)},t.targetOff=function(t){var i,n;null===(i=this.capturingTarget)||void 0===i||i.removeAll(t),null===(n=this.bubblingTarget)||void 0===n||n.removeAll(t),this.shouldHandleEventTouch&&!this._hasTouchListeners()&&(this.shouldHandleEventTouch=!1),this.shouldHandleEventMouse&&!this._hasMouseListeners()&&(this.shouldHandleEventMouse=!1),this._hasPointerListeners()||e.callbacksInvoker.emit(yL.REMOVE_POINTER_EVENT_PROCESSOR,this)},t.emit=function(e,t,i,n,r,s){var a;null===(a=this.bubblingTarget)||void 0===a||a.emit(e,t,i,n,r,s)},t.dispatchEvent=function(e){var t,i=this.node,n=0;for(e.target=i,EL.length=0,this.getCapturingTargets(e.type,EL),e.eventPhase=1,n=EL.length-1;n>=0;--n)if((t=EL[n]).eventProcessor.capturingTarget&&(e.currentTarget=t,t.eventProcessor.capturingTarget.emit(e.type,e,EL),e.propagationStopped))return void(EL.length=0);if(EL.length=0,e.eventPhase=2,e.currentTarget=i,this.capturingTarget&&this.capturingTarget.emit(e.type,e),!e.propagationImmediateStopped&&this.bubblingTarget&&this.bubblingTarget.emit(e.type,e),!e.propagationStopped&&e.bubbles)for(this.getBubblingTargets(e.type,EL),e.eventPhase=3,n=0;n<EL.length;++n)if((t=EL[n]).eventProcessor.bubblingTarget&&(e.currentTarget=t,t.eventProcessor.bubblingTarget.emit(e.type,e),e.propagationStopped))return void(EL.length=0);EL.length=0},t.hasEventListener=function(e,t,i){var n=!1;return this.bubblingTarget&&(n=this.bubblingTarget.hasEventListener(e,t,i)),!n&&this.capturingTarget&&(n=this.capturingTarget.hasEventListener(e,t,i)),n},t.getCapturingTargets=function(e,t){for(var i=this._node.parent;i;){var n;null!==(n=i.eventProcessor.capturingTarget)&&void 0!==n&&n.hasEventListener(e)&&t.push(i),i=i.parent}},t.getBubblingTargets=function(e,t){for(var i=this._node.parent;i;){var n;null!==(n=i.eventProcessor.bubblingTarget)&&void 0!==n&&n.hasEventListener(e)&&t.push(i),i=i.parent}},t._searchComponentsInParent=function(e){var t=this.node;if(e){for(var i=0,n=[],r=t;r&&Wm.isNode(r);r=r.parent,++i){var s=r.getComponent(e);if(s){var a={index:i,comp:s};n?n.push(a):n=[a]}}return n.length>0?n:null}return null},t._attachMask=function(){this.maskList=this._searchComponentsInParent(e._maskComp)},t._isTouchEvent=function(e){return-1!==SL.indexOf(e)},t._isMouseEvent=function(e){return-1!==RL.indexOf(e)},t._hasTouchListeners=function(){for(var e=0;e<SL.length;++e){var t=SL[e];if(this.hasEventListener(t))return!0}return!1},t._hasMouseListeners=function(){for(var e=0;e<RL.length;++e){var t=RL[e];if(this.hasEventListener(t))return!0}return!1},t._hasPointerListeners=function(){return!!this._hasTouchListeners()||this._hasMouseListeners()},t._tryEmittingAddEvent=function(t){var i=this._isTouchEvent(t),n=this._isMouseEvent(t);i?this.shouldHandleEventTouch=!0:n&&(this.shouldHandleEventMouse=!0),!i&&!n||this._hasPointerListeners()||e.callbacksInvoker.emit(yL.ADD_POINTER_EVENT_PROCESSOR,this)},t._newCallbacksInvoker=function(){var t=this,i=new Uh;return i._registerOffCallback((function(){t.shouldHandleEventTouch&&!t._hasTouchListeners()&&(t.shouldHandleEventTouch=!1),t.shouldHandleEventMouse&&!t._hasMouseListeners()&&(t.shouldHandleEventMouse=!1),t._hasPointerListeners()||e.callbacksInvoker.emit(yL.REMOVE_POINTER_EVENT_PROCESSOR,t)})),i},t._handleEventMouse=function(e){switch(e.type){case bw.MOUSE_DOWN:return this._handleMouseDown(e);case bw.MOUSE_MOVE:return this._handleMouseMove(e);case bw.MOUSE_UP:return this._handleMouseUp(e);case bw.MOUSE_WHEEL:return this._handleMouseWheel(e);default:return!1}},t._handleMouseDown=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(AL),!t._uiProps.uiTransformComp.hitTest(AL,e.windowId)||(e.type=Jp.MOUSE_DOWN,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0)))},t._handleMouseMove=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(AL),t._uiProps.uiTransformComp.hitTest(AL,e.windowId)?(this.previousMouseIn||(TL&&TL!==t&&(e.type=Jp.MOUSE_LEAVE,TL.dispatchEvent(e),TL.eventProcessor.previousMouseIn=!1),TL=t,e.type=Jp.MOUSE_ENTER,t.dispatchEvent(e),this.previousMouseIn=!0),e.type=Jp.MOUSE_MOVE,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0):(this.previousMouseIn&&(e.type=Jp.MOUSE_LEAVE,t.dispatchEvent(e),this.previousMouseIn=!1,TL=null),1)))},t._handleMouseUp=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(AL),!t._uiProps.uiTransformComp.hitTest(AL,e.windowId)||(e.type=Jp.MOUSE_UP,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0)))},t._handleMouseWheel=function(e){var t=this._node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(AL),!t._uiProps.uiTransformComp.hitTest(AL,e.windowId)||(e.type=Jp.MOUSE_WHEEL,e.bubbles=!0,t.dispatchEvent(e),e.propagationStopped=!0,0)))},t._handleEventTouch=function(e){switch(e.type){case bw.TOUCH_START:return this._handleTouchStart(e);case bw.TOUCH_MOVE:return this._handleTouchMove(e);case bw.TOUCH_END:return this._handleTouchEnd(e);case bw.TOUCH_CANCEL:return this._handleTouchCancel(e);default:return!1}},t._handleTouchStart=function(e){var t=this.node;return!(!t||!t._uiProps.uiTransformComp||(e.getLocation(AL),!t._uiProps.uiTransformComp.hitTest(AL,e.windowId)||(e.type=Jp.TOUCH_START,e.bubbles=!0,this._dispatchingTouch=e.touch,t.dispatchEvent(e),0)))},t._handleTouchMove=function(e){var t=this.node;return!(!t||!t._uiProps.uiTransformComp||(e.type=Jp.TOUCH_MOVE,e.bubbles=!0,this._dispatchingTouch=e.touch,t.dispatchEvent(e),0))},t._handleTouchEnd=function(e){var t=this.node;t&&t._uiProps.uiTransformComp&&(e.getLocation(AL),t._uiProps.uiTransformComp.hitTest(AL,e.windowId)?e.type=Jp.TOUCH_END:e.type=Jp.TOUCH_CANCEL,e.bubbles=!0,t.dispatchEvent(e),this._dispatchingTouch=null)},t._handleTouchCancel=function(e){var t=this.node;t&&t._uiProps.uiTransformComp&&(e.type=Jp.TOUCH_CANCEL,e.bubbles=!0,t.dispatchEvent(e))},n(e,[{key:"isEnabled",get:function(){return this._isEnabled}},{key:"node",get:function(){return this._node}}]),e}());IL._maskComp=null,IL.callbacksInvoker=new Uh,v.NodeEventProcessor=IL,re(Wm.prototype,"Node",[{name:"childrenCount",newName:"children.length",customGetter:function(){return this.children.length}}]),re(Wm.prototype,"Node",[{name:"width",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.width},customSetter:function(e){this._uiProps.uiTransformComp.width=e}},{name:"height",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.height},customSetter:function(e){this._uiProps.uiTransformComp.height=e}},{name:"anchorX",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorX},customSetter:function(e){this._uiProps.uiTransformComp.anchorX=e}},{name:"anchorY",targetName:"node.getComponent(UITransform)",customGetter:function(){return this._uiProps.uiTransformComp.anchorY},customSetter:function(e){this._uiProps.uiTransformComp.anchorY=e}},{name:"getAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(e){return e||(e=new Rn),e.set(this._uiProps.uiTransformComp.anchorPoint),e}},{name:"setAnchorPoint",targetName:"node.getComponent(UITransform)",customFunction:function(e,t){this._uiProps.uiTransformComp.setAnchorPoint(e,t)}},{name:"getContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(e){return e||(e=new Cn),e.set(this._uiProps.uiTransformComp.contentSize),e}},{name:"setContentSize",targetName:"node.getComponent(UITransform)",customFunction:function(e,t){"number"==typeof e?this._uiProps.uiTransformComp.setContentSize(e,t):this._uiProps.uiTransformComp.setContentSize(e)}}]),se(QR.prototype,"SceneGlobals.prototype",[{name:"aspect"},{name:"selfShadow"},{name:"linear"},{name:"packing"},{name:"autoAdapt"},{name:"fixedArea"},{name:"pcf"},{name:"bias"},{name:"normalBias"},{name:"near"},{name:"far"},{name:"shadowDistance"},{name:"invisibleOcclusionRange"},{name:"orthoSize"},{name:"saturation"}]),re(QR.prototype,"SceneGlobals.prototype",[{name:"distance",newName:"planeHeight"},{name:"normal",newName:"planeDirection"},{name:"size",newName:"shadowMapSize"}]),se(Wm.prototype,"Node.prototype",[{name:"addLayer"},{name:"removeLayer"}]),re(Zp.prototype,"NodeUIProperties",[{name:"opacityDirty",newName:"colorDirty"}]),se(Yp,"Layers",[{name:"All"},{name:"RaycastMask"},{name:"check"}]),re(Yp,"Layers",[{name:"Default",newName:"DEFAULT",target:Yp.Enum,targetName:"Layers.Enum"},{name:"Always",newName:"ALWAYS",target:Yp.Enum,targetName:"Layers.Enum"},{name:"IgnoreRaycast",newName:"IGNORE_RAYCAST",target:Yp.Enum,targetName:"Layers.Enum"},{name:"Gizmos",newName:"GIZMOS",target:Yp.Enum,targetName:"Layers.Enum"},{name:"Editor",newName:"EDITOR",target:Yp.Enum,targetName:"Layers.Enum"},{name:"UI",newName:"UI_3D",target:Yp.Enum,targetName:"Layers.Enum"},{name:"UI2D",newName:"UI_2D",target:Yp.Enum,targetName:"Layers.Enum"},{name:"SceneGizmo",newName:"SCENE_GIZMO",target:Yp.Enum,targetName:"Layers.Enum"},{name:"makeInclusiveMask",newName:"makeMaskInclude",target:Yp,targetName:"Layers"},{name:"makeExclusiveMask",newName:"makeMaskExclude",target:Yp,targetName:"Layers"}]),se(Yp.Enum,"Layers.Enum",[{name:"ALWAYS"}]),se(Yp.BitMask,"Layers.BitMask",[{name:"ALWAYS"}]);var bL=Ba.Flags.HideInHierarchy,OL=Ba.Flags.DontSave,NL=e("hk",Gs("cc.PrivateNode")(wL=function(e){function t(t){var i;return q(12003,(i=e.call(this,t)||this).name),i.hideFlags|=OL|bL,i}return s(t,e),t}(Wm))||wL);function CL(e,t){if(!t){var i=v.director.getScene();if(!i)return null;t=i}return t.getChildByPath(e)}re(Iw,"SystemEventType",["MOUSE_ENTER","MOUSE_LEAVE","TRANSFORM_CHANGED","SCENE_CHANGED_FOR_PERSISTS","SIZE_CHANGED","ANCHOR_CHANGED","COLOR_CHANGED","CHILD_ADDED","CHILD_REMOVED","PARENT_CHANGED","NODE_DESTROYED","LAYER_CHANGED","SIBLING_ORDER_CHANGED"].map((function(e){return{name:e,target:Wm.EventType,targetName:"Node.EventType"}}))),re(Wm.EventType,"Node.EventType",[{name:"DEVICEMOTION",target:yI.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_DOWN",target:yI.EventType,targetName:"SystemEvent.EventType"},{name:"KEY_UP",target:yI.EventType,targetName:"SystemEvent.EventType"}]),v.PrivateNode=NL,pe({BaseNode:{newName:"Node",since:"3.7.0",removed:!1}}),v.find=CL;var ML=ut,PL=Ba.Flags.IsStartCalled,LL=Ba.Flags.IsOnEnableCalled;function xL(e,t){for(var i=t.constructor._executionOrder,n=t._id,r=0,s=e.length-1,a=s>>>1;r<=s;a=r+s>>>1){var o=e[a],u=o.constructor._executionOrder;if(u>i)s=a-1;else if(u<i)r=a+1;else{var h=o._id;if(h>n)s=a-1;else{if(!(h<n))return a;r=a+1}}}return~r}function DL(e,t){for(var i=e.array,n=e.i+1;n<i.length;){var r=i[n];r.node._activeInHierarchy?++n:(e.removeAt(n),t&&(r._objFlags&=~t))}}Ba.Flags.IsEditorOnEnableCalled;var FL=function(e){this._zero=void 0,this._neg=void 0,this._pos=void 0,this._invoke=void 0;var t=at;this._zero=new t([]),this._neg=new t([]),this._pos=new t([]),this._invoke=e};function BL(e,t){return e.constructor._executionOrder-t.constructor._executionOrder}FL.stableRemoveInactive=DL;var UL=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.add=function(e){var t=e.constructor._executionOrder;(0===t?this._zero:t<0?this._neg:this._pos).array.push(e)},i.remove=function(e){var t=e.constructor._executionOrder;(0===t?this._zero:t<0?this._neg:this._pos).fastRemove(e)},i.cancelInactive=function(e){DL(this._zero,e),DL(this._neg,e),DL(this._pos,e)},i.invoke=function(){var e=this._neg;e.array.length>0&&(e.array.sort(BL),this._invoke(e),e.array.length=0),this._invoke(this._zero),this._zero.array.length=0;var t=this._pos;t.array.length>0&&(t.array.sort(BL),this._invoke(t),t.array.length=0)},t}(FL),GL=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.add=function(e){var t=e.constructor._executionOrder;if(0===t)this._zero.array.push(e);else{var i=t<0?this._neg.array:this._pos.array,n=xL(i,e);n<0&&i.splice(~n,0,e)}},i.remove=function(e){var t=e.constructor._executionOrder;if(0===t)this._zero.fastRemove(e);else{var i=t<0?this._neg:this._pos,n=xL(i.array,e);n>=0&&i.removeAt(n)}},i.invoke=function(e){this._neg.array.length>0&&this._invoke(this._neg,e),this._invoke(this._zero,e),this._pos.array.length>0&&this._invoke(this._pos,e)},t}(FL);function kL(e,t,i){var n="var a=it.array;for(it.i=0;it.i<a.length;++it.i){var c=a[it.i];"+e+"}",r=t?Function("it","dt",n):Function("it",n);return function(e,t,i){return function(n,r){try{t(n,r)}catch(t){v._throw(t);var s=n.array;for(i&&(s[n.i]._objFlags|=i),++n.i;n.i<s.length;++n.i)try{e(s[n.i],r)}catch(e){v._throw(e),i&&(s[n.i]._objFlags|=i)}}}}(Function("c","dt",e),r,i)}var HL=kL("c.start();c._objFlags|="+PL,!1,PL),zL=kL("c.update(dt)",!0),VL=kL("c.lateUpdate(dt)",!0),WL=function(e){var t=v.director._compScheduler,i=e.array;for(e.i=0;e.i<i.length;++e.i){var n=i[e.i];n._enabled&&(n.onEnable(),!n.node._activeInHierarchy||t._onEnabled(n))}},jL=function(){function e(){this._deferredComps=[],this.unscheduleAll()}var t=e.prototype;return t.unscheduleAll=function(){this.startInvoker=new UL(HL),this.updateInvoker=new GL(zL),this.lateUpdateInvoker=new GL(VL),this._updating=!1},t._onEnabled=function(e){v.director.getScheduler().resumeTarget(e),e._objFlags|=LL,this._updating?this._deferredComps.push(e):this._scheduleImmediate(e)},t._onDisabled=function(e){v.director.getScheduler().pauseTarget(e),e._objFlags&=~LL;var t=this._deferredComps.indexOf(e);t>=0?ML(this._deferredComps,t):(!e.start||e._objFlags&PL||this.startInvoker.remove(e),e.update&&this.updateInvoker.remove(e),e.lateUpdate&&this.lateUpdateInvoker.remove(e))},t.enableComp=function(e,t){if(!(e._objFlags&LL)){if(e.onEnable){if(t)return void t.add(e);if(e.onEnable(),!e.node._activeInHierarchy)return}this._onEnabled(e)}},t.disableComp=function(e){e._objFlags&LL&&(e.onDisable&&e.onDisable(),this._onDisabled(e))},t.startPhase=function(){this._updating=!0,this.startInvoker.invoke(),this._startForNewComps()},t.updatePhase=function(e){this.updateInvoker.invoke(e)},t.lateUpdatePhase=function(e){this.lateUpdateInvoker.invoke(e),this._updating=!1,this._startForNewComps()},t._startForNewComps=function(){this._deferredComps.length>0&&(this._deferredSchedule(),this.startInvoker.invoke())},t._scheduleImmediate=function(e){"function"!=typeof e.start||e._objFlags&PL||this.startInvoker.add(e),"function"==typeof e.update&&this.updateInvoker.add(e),"function"==typeof e.lateUpdate&&this.lateUpdateInvoker.add(e)},t._deferredSchedule=function(){for(var e=this._deferredComps,t=0,i=e.length;t<i;t++)this._scheduleImmediate(e[t]);e.length=0},e}(),XL=Ba.Flags.IsPreloadStarted,KL=Ba.Flags.IsOnLoadStarted,YL=Ba.Flags.IsOnLoadCalled,qL=Ba.Flags.Deactivating,QL=function(e){function t(){return e.apply(this,arguments)||this}s(t,e);var i=t.prototype;return i.add=function(e){this._zero.array.push(e)},i.remove=function(e){this._zero.fastRemove(e)},i.cancelInactive=function(e){FL.stableRemoveInactive(this._zero,e)},i.invoke=function(){this._invoke(this._zero),this._zero.array.length=0},t}(FL),ZL=kL("c.__preload();"),JL=kL("c.onLoad();c._objFlags|="+YL,!1,YL),$L=new st(4);function ex(e,t,i){Z(3817,e.name,i),console.log("Corrupted component value:",t),t?e._removeComponent(t):ot(e._components,i)}$L.get=function(){var e=this._get()||{preload:new QL(ZL),onLoad:new UL(JL),onEnable:new UL(WL)};e.preload._zero.i=-1;var t=e.onLoad;return t._zero.i=-1,t._neg.i=-1,t._pos.i=-1,(t=e.onEnable)._zero.i=-1,t._neg.i=-1,t._pos.i=-1,e};var tx=e("h8",function(){function e(){this.resetComp=void 0,this.reset()}var t=e.prototype;return t.reset=function(){this._activatingStack=[]},t.activateNode=function(e,t){if(t){var i=$L.get();this._activatingStack.push(i),this._activateNodeRecursively(e,i.preload,i.onLoad,i.onEnable),i.preload.invoke(),i.onLoad.invoke(),i.onEnable.invoke(),this._activatingStack.pop(),$L.put(i)}else{this._deactivateNodeRecursively(e);for(var n,r=d(this._activatingStack);!(n=r()).done;){var s=n.value;s.preload.cancelInactive(XL),s.onLoad.cancelInactive(KL),s.onEnable.cancelInactive()}}e.emit(Jp.ACTIVE_IN_HIERARCHY_CHANGED,e)},t.activateComp=function(e,t,i,n){if(ka(e,!0)&&(e._objFlags&XL||(e._objFlags|=XL,e.__preload&&(t?t.add(e):e.__preload())),e._objFlags&KL||(e._objFlags|=KL,e.onLoad?i?i.add(e):(e.onLoad(),e._objFlags|=YL):e._objFlags|=YL),e._enabled)){if(!e.node._activeInHierarchy)return;v.director._compScheduler.enableComp(e,n)}},t.destroyComp=function(e){v.director._compScheduler.disableComp(e),e.onDestroy&&e._objFlags&YL&&e.onDestroy()},t._activateNodeRecursively=function(e,t,i,n){if(e._objFlags&qL)Z(3816,e.name);else{e._activeInHierarchy=!0;for(var r=e._components.length,s=0;s<r;++s){var a=e._components[s];a instanceof v.Component?this.activateComp(a,t,i,n):(ex(e,a,s),--s,--r)}for(var o=0,u=e._children.length;o<u;++o){var h=e._children[o];h._active&&this._activateNodeRecursively(h,t,i,n)}e._onPostActivated(!0)}},t._deactivateNodeRecursively=function(e){e._objFlags|=qL,e._activeInHierarchy=!1;for(var t=e._components.length,i=0;i<t;++i){var n=e._components[i];if(n._enabled&&(v.director._compScheduler.disableComp(n),e._activeInHierarchy))return void(e._objFlags&=~qL)}for(var r=0,s=e._children.length;r<s;++r){var a=e._children[r];if(a._activeInHierarchy&&(this._deactivateNodeRecursively(a),e._activeInHierarchy))return void(e._objFlags&=~qL)}e._onPostActivated(!1),e._objFlags&=~qL},e}()),ix=Ba.Flags.Destroyed,nx=Ba.Flags.PersistentMask,rx=di.Attr.DELIMETER+"default",sx=di.IDENTIFIER_RE,ax="var ",ox="o",ux={"cc.ClickEvent":!1,"cc.PrefabInfo":!1},hx=di.escapeForJS,cx=function(){function e(e,t){this.varName=void 0,this.expression=void 0,this.varName=e,this.expression=t}return e.prototype.toString=function(){return ax+this.varName+"="+this.expression+";"},e}();function lx(e,t){return t instanceof cx?new cx(t.varName,e+t.expression):e+t}function _x(e,t,i){Array.isArray(i)?(i[0]=lx(t,i[0]),e.push(i)):e.push(lx(t,i)+";")}var dx=function(){function e(e){this._exps=void 0,this._targetExp=void 0,this._exps=[],this._targetExp=e}var t=e.prototype;return t.append=function(e,t){this._exps.push([e,t])},t.writeCode=function(e){var t;if(this._exps.length>1)e.push("t="+this._targetExp+";"),t="t";else{if(1!==this._exps.length)return;t=this._targetExp}for(var i=0;i<this._exps.length;i++){var n=this._exps[i];_x(e,t+fx(n[0])+"=",n[1])}},e}();function fx(e){return sx.test(e)?"."+e:"["+hx(e)+"]"}dx.pool=void 0,dx.pool=new st((function(e){e._exps.length=0,e._targetExp=null}),1),dx.pool.get=function(e){var t=this._get()||new dx;return t._targetExp=e,t};var px,mx,gx,vx,yx,Ex,Tx,Ax=function(){function e(e,t){var i;this.parent=void 0,this.objsToClear_iN$t=void 0,this.codeArray=void 0,this.objs=void 0,this.funcs=void 0,this.funcModuleCache=void 0,this.globalVariables=void 0,this.globalVariableId=void 0,this.localVariableId=void 0,this.result=void 0,this.parent=t,this.objsToClear_iN$t=[],this.codeArray=[],this.objs=[],this.funcs=[],this.funcModuleCache=Ne(),ke(this.funcModuleCache,ux),this.globalVariables=[],this.globalVariableId=0,this.localVariableId=0,this.codeArray.push("var o,t;","if(R){","o=R;","}else{","o=R=new "+this.getFuncModule(e.constructor,!0)+"();","}"),e._iN$t={globalVar:"R"},this.objsToClear_iN$t.push(e),this.enumerateObject(this.codeArray,e),this.globalVariables.length>0&&(i=ax+this.globalVariables.join(",")+";");var n=Cc(["return (function(R){",i||[],this.codeArray,"return o;","})"]);this.result=Function("O","F",n)(this.objs,this.funcs);for(var r=0,s=this.objsToClear_iN$t.length;r<s;++r)this.objsToClear_iN$t[r]._iN$t=null;this.objsToClear_iN$t.length=0}var t=e.prototype;return t.getFuncModule=function(e,t){var i=Ce(e);if(i){var n=this.funcModuleCache[i];if(n)return n;if(void 0===n){var r=-1!==i.indexOf(".");if(r)try{if(r=e===Function("return "+i)())return this.funcModuleCache[i]=i,i}catch(e){}}}var s=this.funcs.indexOf(e);s<0&&(s=this.funcs.length,this.funcs.push(e));var a="F["+s+"]";return t&&(a="("+a+")"),this.funcModuleCache[i]=a,a},t.getObjRef=function(e){var t=this.objs.indexOf(e);return t<0&&(t=this.objs.length,this.objs.push(e)),"O["+t+"]"},t.setValueType=function(e,t,i,n){var r=dx.pool.get(n),s=t.constructor.__props__;s||(s=Object.keys(t));for(var a=0;a<s.length;a++){var o=s[a],u=i[o];if(t[o]!==u){var h=this.enumerateField(i,o,u);r.append(o,h)}}r.writeCode(e),dx.pool.put(r)},t.enumerateCCClass=function(e,t,i){for(var n=i.__values__,r=di.Attr.getClassAttrs(i),s=0;s<n.length;s++){var a=n[s],o=t[a],u=r[a+rx];if(!Sx(u,o))if("object"==typeof o&&o instanceof v.ValueType&&(u=di.getDefault(u))&&u.constructor===o.constructor){var h=ox+fx(a);this.setValueType(e,u,o,h)}else this.setObjProp(e,t,a,o)}},t.instantiateArray=function(e){if(0===e.length)return"[]";var t="a"+ ++this.localVariableId,i=[new cx(t,"new Array("+e.length+")")];e._iN$t={globalVar:"",source:i},this.objsToClear_iN$t.push(e);for(var n=0;n<e.length;++n)_x(i,t+"["+n+"]=",this.enumerateField(e,n,e[n]));return i},t.instantiateTypedArray=function(e){var t=e.constructor.name;if(0===e.length)return"new "+t;var i="a"+ ++this.localVariableId,n=[new cx(i,"new "+t+"("+e.length+")")];e._iN$t={globalVar:"",source:n},this.objsToClear_iN$t.push(e);for(var r=0;r<e.length;++r)0!==e[r]&&_x(n,i+"["+r+"]=",e[r]);return n},t.enumerateField=function(e,t,i){if("object"==typeof i&&i){var n=i._iN$t;if(n){var r=n.globalVar;if(!r){r=n.globalVar="v"+ ++this.globalVariableId,this.globalVariables.push(r);var s=n.source[0];n.source[0]=lx(r+"=",s)}return r}return ArrayBuffer.isView(i)?this.instantiateTypedArray(i):Array.isArray(i)?this.instantiateArray(i):this.instantiateObj(i)}return"function"==typeof i?this.getFuncModule(i):"string"==typeof i?hx(i):("_objFlags"===t&&Ga(e)&&(i&=nx),i)},t.setObjProp=function(e,t,i,n){_x(e,ox+fx(i)+"=",this.enumerateField(t,i,n))},t.enumerateObject=function(e,t){var i=t.constructor;if(fi(i))this.enumerateCCClass(e,t,i);else for(var n in t)if(t.hasOwnProperty(n)&&(95!==n.charCodeAt(0)||95!==n.charCodeAt(1)||"__type__"===n)){var r=t[n];"object"==typeof r&&r&&r===t._iN$t||this.setObjProp(e,t,n,r)}},t.instantiateObj=function(e){if(e instanceof v.ValueType)return di.getNewValueTypeCode(e);if(e instanceof v.Asset)return this.getObjRef(e);if(e._objFlags&ix)return null;var t,i=e.constructor;if(fi(i)){if(this.parent)if(this.parent instanceof v.Component){if(e instanceof v.Node||e instanceof v.Component)return this.getObjRef(e)}else if(this.parent instanceof v.Node)if(e instanceof v.Node){if(!e.isChildOf(this.parent))return this.getObjRef(e)}else if(e instanceof v.Component){var n;if(null===(n=e.node)||void 0===n||!n.isChildOf(this.parent))return this.getObjRef(e)}t=new cx(ox,"new "+this.getFuncModule(i,!0)+"()")}else if(i===Object)t=new cx(ox,"{}");else{if(i)return this.getObjRef(e);t=new cx(ox,"Object.create(null)")}var r=[t];return e._iN$t={globalVar:"",source:r},this.objsToClear_iN$t.push(e),this.enumerateObject(r,e),["(function(){",r,"return o;})();"]},e}();function Sx(e,t){if("function"==typeof e)try{e=e()}catch(e){return!1}if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t&&e.constructor===t.constructor)if(e instanceof v.ValueType){if(e.equals(t))return!0}else{if(Array.isArray(e))return 0===e.length&&0===t.length;if(e.constructor===Object)return Se(e)&&Se(t)}return!1}var Rx=mt({AUTO:0,SINGLE_INSTANCE:1,MULTI_INSTANCE:2}),wx=e("dR",Gs("cc.Prefab")((Tx=Ex=function(e){function t(){var t;return(t=e.call(this)||this).data=gx&&gx(),t.optimizationPolicy=vx&&vx(),t.persistent=yx&&yx(),t._createFunction=void 0,t._instantiatedTimes=void 0,t._createFunction=null,t._instantiatedTimes=0,t}s(t,e);var i=t.prototype;return i.createNode=function(e){var t=v.instantiate(this);t.name=this.name,e(null,t)},i.compileCreateFunction=function(){var e,t;this._createFunction=(t=(e=this.data)instanceof v.Node&&e,new Ax(e,t).result)},i._doInstantiate=function(e){return this.data._prefab||q(3700),this._createFunction||this.compileCreateFunction(),this._createFunction(e)},i._instantiate=function(){var e;return this.optimizationPolicy!==Rx.SINGLE_INSTANCE&&(this.optimizationPolicy===Rx.MULTI_INSTANCE||this._instantiatedTimes+1>=t.OptimizationPolicyThreshold)?(e=this._doInstantiate(),this.data._instantiate(e)):e=this.data._instantiate(),++this._instantiatedTimes,e},i.initDefault=function(t){e.prototype.initDefault.call(this,t),this.data=new Wm,this.data.name="(Missing Node)";var i=new v._PrefabInfo;i.asset=this,i.root=this.data,this.data._prefab=i},i.validate=function(){return!!this.data},i.onLoaded=function(){var e=this.data;fw(e),_w(e)},t}(qd),Ex.OptimizationPolicy=Rx,Ex.OptimizationPolicyThreshold=3,gx=Cs((mx=Tx).prototype,"data",[Ys],(function(){return null})),vx=Cs(mx.prototype,"optimizationPolicy",[Ys],(function(){return Rx.AUTO})),yx=Cs(mx.prototype,"persistent",[Ys],(function(){return!1})),px=mx))||px);we(wx,"_utils",Sw),v.Prefab=wx,Me(v,"cc._Prefab","Prefab");var Ix=function(){function e(){this._allRenderers=[],this._dirtyRenderers=[],this._dirtyVersion=0}var t=e.prototype;return t.addRenderer=function(e){-1===e._internalId&&(e._internalId=this._allRenderers.length,this._allRenderers.push(e))},t.removeRenderer=function(e){if(-1!==e._internalId){var t=e._internalId;this._allRenderers[this._allRenderers.length-1]._internalId=t,ut(this._allRenderers,t),e._internalId=-1,e._dirtyVersion===this._dirtyVersion&&(ct(this._dirtyRenderers,e),e._dirtyVersion=-1)}},t.markDirtyRenderer=function(e){e._dirtyVersion!==this._dirtyVersion&&-1!==e._internalId&&(this._dirtyRenderers.push(e),e._dirtyVersion=this._dirtyVersion)},t.updateAllDirtyRenderers=function(){for(var e=this._dirtyRenderers.length,t=this._dirtyRenderers,i=0;i<e;i++)t[i].updateRenderer();this._dirtyRenderers.length=0,this._dirtyVersion++},e}(),bx=e("d4",new Ix),Ox=[".png",".jpg",".bmp",".jpeg",".gif",".ico",".tiff",".webp",".image",".pvr",".pkm",".astc"],Nx=[".mp3",".ogg",".wav",".m4a"];function Cx(){return!0}var Mx={transformURL:function(e){var t=Ud(e);if(!t)return e;var i=Rd.find((function(e){return!!e.getAssetInfo(t)}));if(!i)return e;var n,r=i.getAssetInfo(t);if(!(n=e.startsWith(i.base+i.config.nativeBase)?r.nativeVer||"":r.ver||"")||-1!==e.indexOf(n))return e;var s=!1;if(".ttf"===ec(e)&&(s=!0),s){var a=nc(e),o=ic(e);e=a+"."+n+"/"+o}else e=e.replace(/.*[/\\][0-9a-fA-F]{2}[/\\]([0-9a-fA-F-@]{8,})/,(function(e){return e+"."+n}));return e}},Px=e("hz",function(){function e(){this._autoReleaseSetting=Object.create(null),this._parseLoadResArgs=wy}var t=e.prototype;return t.load=function(e,t,i){void 0===i&&void 0!==t&&(i=t,t=null);for(var n=Array.isArray(e)?e:[e],r=0;r<n.length;r++){var s=n[r];"string"==typeof s?n[r]={url:s,__isNative__:!0}:(s.type&&(s.ext="."+s.type,s.type=void 0),s.url&&(s.__isNative__=!0))}var a=[],o=[];bE.loadAny(n,null,(function(e,i,n){n.content&&(Ox.includes(n.ext)?a.push(n.content):Nx.includes(n.ext)&&o.push(n.content)),t&&t(e,i,n)}),(function(e,t){var r=null;if(!e){t=Array.isArray(t)?t:[t];for(var s=function(e){var i=t[e];if(!(i instanceof qd)){var r=i,s=n[e].url;a.includes(r)?lE.create(s,i,".png",{},(function(i,n){r=t[e]=n})):o.includes(r)&&lE.create(s,i,".mp3",{},(function(i,n){r=t[e]=n})),Td.add(s,r)}},u=0;u<t.length;u++)s(u);if(t.length>1){var h=Object.create(null);t.forEach((function(e){h[e._uuid]=e})),r={isCompleted:Cx,_map:h}}else r=t[0]}i&&i(e,r)}))},t.getXMLHttpRequest=function(){return new XMLHttpRequest},t.getItem=function(e){return bE.assets.has(e)?{content:bE.assets.get(e)}:null},t.loadRes=function(e,t,i,n){var r=this._parseLoadResArgs(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete,u=ec(e);u&&!Ny.getInfoWithPath(e,s)&&(e=e.slice(0,-u.length)),Ny.load(e,s,a,o)},t.loadResArray=function(e,t,i,n){var r=this._parseLoadResArgs(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;e.forEach((function(t,i){var n=ec(t);n&&!Ny.getInfoWithPath(t,s)&&(e[i]=t.slice(0,-n.length))})),Ny.load(e,s,a,o)},t.loadResDir=function(e,t,i,n){var r=this._parseLoadResArgs(t,i,n),s=r.type,a=r.onProgress,o=r.onComplete;Ny.loadDir(e,s,a,(function(t,i){var n=[];t||(n=Ny.getDirWithPath(e,s).map((function(e){return e.path}))),o&&o(t,i,n)}))},t.getRes=function(e,t){return Td.has(e)?Td.get(e):Ny.get(e,t)},t.getResCount=function(){return Td.count},t.getDependsRecursively=function(e){if(!e)return[];var t="string"==typeof e?e:e._uuid;return Fp.getDepsRecursively(t).concat([t])},t.addDownloadHandlers=function(e){var t=Object.create(null),i=function(i){var n=e[i];t["."+i]=function(e,t,i){n({url:e},i)}};for(var n in e)i(n);Jy.register(t)},t.addLoadHandlers=function(e){var t=Object.create(null),i=function(i){var n=e[i];t["."+i]=function(e,t,i){n({content:e},i)}};for(var n in e)i(n);gE.register(t)},t.release=function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var i=e[t];"string"==typeof i&&(i=Td.get(i)),bE.releaseAsset(i)}else e&&("string"==typeof e&&(e=Td.get(e)),bE.releaseAsset(e))},t.releaseAsset=function(e){bE.releaseAsset(e)},t.releaseRes=function(e,t){Ny.release(e,t)},t.releaseAll=function(){bE.releaseAll(),Td.clear()},t.removeItem=function(e){return!!Td.remove(e)},t.setAutoRelease=function(e,t){"object"==typeof e&&(e=e._uuid),this._autoReleaseSetting[e]=!!t},t.setAutoReleaseRecursively=function(e,t){"object"==typeof e&&(e=e._uuid),t=!!t,this._autoReleaseSetting[e]=t;for(var i=Fp.getDepsRecursively(e),n=0;n<i.length;n++)this._autoReleaseSetting[i[n]]=t},t.isAutoRelease=function(e){return"object"==typeof e&&(e=e._uuid),!!this._autoReleaseSetting[e]},n(e,[{key:"onProgress",set:function(e){gy=e}},{key:"_cache",get:function(){if(Td instanceof vd)return Td._map;var e={};return Td.forEach((function(t,i){e[i]=t})),e}},{key:"md5Pipe",get:function(){return Mx}},{key:"downloader",get:function(){return Jy}},{key:"loader",get:function(){return bE.parser}}]),e}()),Lx=e("hA",new Px),xx=e("hB",{init:function(e){e.importBase=e.libraryPath,e.nativeBase=e.rawAssetsBase,bE.init(e),e.rawAssets&&Ny.init({base:"",deps:[],scenes:{},redirect:[],debug:!0,packs:{},types:[],versions:{import:[],native:[]},name:Nd.RESOURCES,importBase:e.importBase,nativeBase:e.nativeBase,paths:e.rawAssets.assets,uuids:Object.keys(e.rawAssets.assets),extensionMap:{}})},loadAsset:function(e,t){bE.loadAny(e,t)}}),Dx=e("hC",{});re(Dx,"url",[{name:"normalize",target:bE.utils,targetName:"assetManager.utils",newName:"normalize"},{name:"raw",targetName:"Asset.prototype",newName:"nativeUrl",customFunction:function(e){return e.startsWith("resources/")?zd({path:rc(e.substr(10)),bundle:Nd.RESOURCES,__isNative__:!0,ext:ec(e)}):""}}]),se(xx,"AssetLibrary",[{name:"getLibUrlNoExt",suggest:"AssetLibrary.getLibUrlNoExt was removed, if you want to transform url, please use assetManager.utils.getUrlWithUuid instead"},{name:"queryAssetInfo",suggest:"AssetLibrary.queryAssetInfo was removed"}]),se(Lx,"loader",[{name:"releaseResDir",suggest:"loader.releaseResDir was removed, please use assetManager.releaseAsset instead"},{name:"flowInDeps",suggest:"loader.flowInDeps was removed"},{name:"assetLoader",suggest:"loader.assetLoader was removed, assetLoader and md5Pipe were merged into assetManager.transformPipeline"}]),re(v,"cc",[{name:"loader",newName:"assetManager",logTimes:1,customGetter:function(){return Lx}},{name:"AssetLibrary",newName:"assetManager",logTimes:1,customGetter:function(){return xx}},{name:"Pipeline",target:IE,targetName:"AssetManager",newName:"Pipeline",logTimes:1},{name:"url",targetName:"assetManager",newName:"utils",logTimes:1,customGetter:function(){return Dx}}]),se(v,"cc",[{name:"LoadingItems",suggest:te(1400,"LoadingItems","AssetManager.Task")}]),re(Rt,"macro",[{name:"DOWNLOAD_MAX_CONCURRENT",target:Jy,targetName:"assetManager.downloader",newName:"maxConcurrency"}]);var Fx=my._autoRelease;my._autoRelease=function(e,t,i){Fx.call(my,e,t,i);for(var n=Lx._autoReleaseSetting,r=Object.keys(n),s=0;s<r.length;s++){var a=r[s];if(!0===n[a]){var o=Td.get(a);o&&my.tryRelease(o)}}};var Bx=e("cT",function(e){function t(){var t;return(t=e.call(this)||this)._compScheduler=void 0,t._nodeActivator=void 0,t._invalid=void 0,t._paused=void 0,t._root=void 0,t._loadingScene=void 0,t._scene=void 0,t._totalFrames=void 0,t._scheduler=void 0,t._systems=void 0,t._persistRootNodes={},t._invalid=!1,t._paused=!1,t._root=null,t._loadingScene="",t._scene=null,t._totalFrames=0,t._scheduler=new Ch,t._compScheduler=new jL,t._nodeActivator=new tx,t._systems=[],t}s(t,e);var i=t.prototype;return i.calculateDeltaTime=function(){},i.end=function(){var e=this;this.once(t.EVENT_END_FRAME,(function(){e.purgeDirector()}))},i.pause=function(){this._paused||(this._paused=!0)},i.purgeDirector=function(){this._scheduler.unscheduleAll(),this._compScheduler.unscheduleAll(),this._nodeActivator.reset(),ka(this._scene)&&this._scene.destroy(),this._scene=null,this.stopAnimation(),bE.releaseAll()},i.reset=function(){var e;for(var i in this.purgeDirector(),this._persistRootNodes)this.removePersistRootNode(this._persistRootNodes[i]);null===(e=this.getScene())||void 0===e||e.destroy(),this.emit(t.EVENT_RESET),this.startAnimation()},i.runSceneImmediate=function(e,i,n){var r=this;e instanceof ww&&(e=e.scene),ee(e instanceof Rw,1216),e._load();for(var s=Object.keys(this._persistRootNodes).map((function(e){return r._persistRootNodes[e]})),a=0;a<s.length;a++){var o=s[a];o.emit(Wm.EventType.SCENE_CHANGED_FOR_PERSISTS,e.renderScene);var u=e.uuid===o._originalSceneId&&e.getChildByUuid(o.uuid);if(u){var h=u.getSiblingIndex();o.hideFlags&=~Ba.Flags.DontSave,o.hideFlags|=Ba.Flags.DontSave&u.hideFlags,u._destroyImmediate(),e.insertChild(o,h)}else o.hideFlags|=Ba.Flags.DontSave,o.parent=e}var c=this._scene;ka(c)&&c.destroy(),bE._releaseManager._autoRelease(c,e,this._persistRootNodes),this._scene=null,Ba._deferredDestroy(),i&&i(),this.emit(t.EVENT_BEFORE_SCENE_LAUNCH,e),this._scene=e,e._activate(),this._root&&this._root.resetCumulativeTime(),this.startAnimation(),n&&n(null,e),this.emit(t.EVENT_AFTER_SCENE_LAUNCH,e)},i.runScene=function(e,i,n){var r=this;e instanceof ww&&(e=e.scene),ee(e,1205),ee(e instanceof Rw,1216),this.once(t.EVENT_END_FRAME,(function(){r.runSceneImmediate(e,i,n)}))},i.loadScene=function(e,i,n){var r=this;if(this._loadingScene)return q(1208,e,this._loadingScene),!1;var s=bE.bundles.find((function(t){return!!t.getSceneInfo(e)}));return s?(this.emit(t.EVENT_BEFORE_SCENE_LOADING,e),this._loadingScene=e,console.time("LoadScene "+e),s.loadScene(e,(function(t,s){console.timeEnd("LoadScene "+e),r._loadingScene="",t?(k(t),i&&i(t)):r.runSceneImmediate(s,n,i)})),!0):(Z(1209,e),!1)},i.preloadScene=function(e,t,i){var n=bE.bundles.find((function(t){return!!t.getSceneInfo(e)}));if(n)n.preloadScene(e,null,t,i);else{var r='Can not preload the scene "'+e+'" because it is not in the build settings.';i&&i(new Error(r)),k("preloadScene: "+r)}},i.resume=function(){this._paused&&(this._paused=!1)},i.getScene=function(){return this._scene},i.getDeltaTime=function(){return v.game.deltaTime},i.getTotalTime=function(){return v.game.totalTime},i.getCurrentTime=function(){return v.game.frameStartTime},i.getTotalFrames=function(){return this._totalFrames},i.isPaused=function(){return this._paused},i.getScheduler=function(){return this._scheduler},i.setScheduler=function(e){this._scheduler!==e&&(this.unregisterSystem(this._scheduler),this._scheduler=e,this.registerSystem(Ch.ID,e,200))},i.registerSystem=function(e,t,i){t.id=e,t.priority=i,this._systems.push(t),this._systems.sort(Rh.sortByPriority)},i.unregisterSystem=function(e){ct(this._systems,e),this._systems.sort(Rh.sortByPriority)},i.getSystem=function(e){return this._systems.find((function(t){return t.id===e}))},i.getAnimationManager=function(){return this.getSystem(v.AnimationManager.ID)},i.startAnimation=function(){this._invalid=!1},i.stopAnimation=function(){this._invalid=!0},i.mainLoop=function(e){var t;t=v.game._calculateDT(e),this.tick(t)},i.tick=function(e){if(!this._invalid){if(this.emit(t.EVENT_BEGIN_FRAME),vI._frameDispatchEvents(),!this._paused){this.emit(t.EVENT_BEFORE_UPDATE),this._compScheduler.startPhase(),this._compScheduler.updatePhase(e);for(var i=0;i<this._systems.length;++i)this._systems[i].update(e);this._compScheduler.lateUpdatePhase(e),this.emit(t.EVENT_AFTER_UPDATE),Ba._deferredDestroy();for(var n=0;n<this._systems.length;++n)this._systems[n].postUpdate(e)}this.emit(t.EVENT_BEFORE_DRAW),bx.updateAllDirtyRenderers(),this._root.frameMove(e),this.emit(t.EVENT_AFTER_DRAW),Wm.resetHasChangedFlags(),Wm.clearNodeArray(),yh.update(e),this.emit(t.EVENT_END_FRAME),this._totalFrames++}},i.buildRenderPipeline=function(){this._root&&(this._root.customPipeline.beginSetup(),v.rendering.getCustomPipeline(Rt.CUSTOM_PIPELINE_NAME).setup(this._root.cameraList,this._root.customPipeline),this._root.customPipeline.endSetup())},i.setupRenderPipelineBuilder=function(){""!==Rt.CUSTOM_PIPELINE_NAME&&v.rendering&&this._root&&this._root.usesCustomPipeline&&this.on(t.EVENT_BEFORE_RENDER,this.buildRenderPipeline,this)},i.init=function(){this._totalFrames=0,this._paused=!1,this.registerSystem(Ch.ID,this._scheduler,200),this._root=new vL(gd.gfxDevice),this._root.initialize({}),this.setupRenderPipelineBuilder();for(var e=0;e<this._systems.length;e++)this._systems[e].init();this.emit(t.EVENT_INIT)},i.addPersistRootNode=function(e){if(Wm.isNode(e)&&e.uuid){var t=e.uuid;if(!this._persistRootNodes[t]){var i=this._scene;if(ka(i))if(e.parent){if(!(e.parent instanceof Rw))return void q(3801);if(e.parent!==i)return void q(3802);e._originalSceneId=i.uuid}else e.parent=i,e._originalSceneId=i.uuid;this._persistRootNodes[t]=e,e._persistNode=!0,bE._releaseManager._addPersistNodeRef(e)}}else q(3800)},i.removePersistRootNode=function(e){var t=e.uuid||"";e===this._persistRootNodes[t]&&(delete this._persistRootNodes[t],e._persistNode=!1,e._originalSceneId="",bE._releaseManager._removePersistNodeRef(e))},i.isPersistRootNode=function(e){return!!e._persistNode},n(t,[{key:"root",get:function(){return this._root}}]),t}(kh));Bx.EVENT_INIT="director_init",Bx.EVENT_RESET="director_reset",Bx.EVENT_BEFORE_SCENE_LOADING="director_before_scene_loading",Bx.EVENT_BEFORE_SCENE_LAUNCH="director_before_scene_launch",Bx.EVENT_AFTER_SCENE_LAUNCH="director_after_scene_launch",Bx.EVENT_BEFORE_UPDATE="director_before_update",Bx.EVENT_AFTER_UPDATE="director_after_update",Bx.EVENT_BEFORE_DRAW="director_before_draw",Bx.EVENT_AFTER_DRAW="director_after_draw",Bx.EVENT_BEFORE_COMMIT="director_before_commit",Bx.EVENT_BEFORE_RENDER="director_before_render",Bx.EVENT_AFTER_RENDER="director_after_render",Bx.EVENT_BEFORE_PHYSICS="director_before_physics",Bx.EVENT_AFTER_PHYSICS="director_after_physics",Bx.EVENT_BEGIN_FRAME="director_begin_frame",Bx.EVENT_END_FRAME="director_end_frame",Bx.instance=void 0,v.Director=Bx;var Ux=e("cc",Bx.instance=v.director=new Bx),Gx=function(){function e(){this._rafHandle=0,this._stHandle=0,this._onTick=null,this._targetFrameRate=60,this._frameTime=0,this._startTime=0,this._isPlaying=!1,this._rAF=void 0,this._cAF=void 0,this._rAF=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||this._stTime.bind(this),this._cAF=window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.webkitCancelRequestAnimationFrame||window.msCancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.ocancelAnimationFrame||this._ctTime.bind(this)}var t=e.prototype;return t.start=function(){var e=this;this._isPlaying||(60===this._targetFrameRate?this._rafHandle=this._rAF.call(window,(function t(){e._isPlaying&&(e._rafHandle=e._rAF.call(window,t)),e._onTick&&e._onTick()})):(this._startTime=performance.now(),this._stHandle=this._stTime((function t(){e._startTime=performance.now(),e._isPlaying&&(e._stHandle=e._stTime(t)),e._onTick&&e._onTick()}))),this._isPlaying=!0)},t.stop=function(){this._isPlaying&&(this._cAF.call(window,this._rafHandle),this._ctTime(this._stHandle),this._rafHandle=this._stHandle=0,this._isPlaying=!1)},t._stTime=function(e){var t=performance.now(),i=Math.max(0,t-this._startTime),n=Math.max(0,this._frameTime-i);return setTimeout(e,n)},t._ctTime=function(e){clearTimeout(e)},n(e,[{key:"targetFrameRate",get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate!==e&&(this._targetFrameRate=e,this._frameTime=1e3/this._targetFrameRate,this._isPlaying&&(this.stop(),this.start()))}},{key:"onTick",get:function(){return this._onTick},set:function(e){this._onTick=e}}]),e}(),kx=new Rn,Hx=function(){var e=t.prototype;function t(){this._curTime=0,this.isMobile=!1,this.bgWidth=1920,this.bgHeight=1080,this.bgRatio=16/9,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoWidth=0,this.logoHeight=0,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=24,this.textXTrans=.5,this.textYExtraTrans=32,this.textExpandSize=4,this.scaleSize=1}return e.init=function(){var e,t,i,n,r,s,a,o,u=this;if(this.settings={displayRatio:null!==(e=St.querySettings(At.Category.SPLASH_SCREEN,"displayRatio"))&&void 0!==e?e:.4,totalTime:null!==(t=St.querySettings(At.Category.SPLASH_SCREEN,"totalTime"))&&void 0!==t?t:3e3,watermarkLocation:null!==(i=St.querySettings(At.Category.SPLASH_SCREEN,"watermarkLocation"))&&void 0!==i?i:"default",autoFit:null===(n=St.querySettings(At.Category.SPLASH_SCREEN,"autoFit"))||void 0===n||n,url:null!==(r=St.querySettings(At.Category.SPLASH_SCREEN,"url"))&&void 0!==r?r:"",type:null!==(s=St.querySettings(At.Category.SPLASH_SCREEN,"type"))&&void 0!==s?s:"default",bgBase64:null!==(a=St.querySettings(At.Category.SPLASH_SCREEN,"bgBase64"))&&void 0!==a?a:"",base64src:null!==(o=St.querySettings(At.Category.SPLASH_SCREEN,"base64src"))&&void 0!==o?o:""},this._curTime=0,!(""===this.settings.base64src||this.settings.totalTime<=0)){this.device=v.director.root.device,this.swapchain=v.director.root.mainWindow.swapchain,this.preInit(),this.initLayout(),this.initWaterMark();var h=new Promise((function(e,t){u.bgImage=new E.Image,u.bgImage.onload=function(){u.initBG(),e()},u.bgImage.onerror=function(){t()},u.bgImage.src=u.settings.bgBase64})),c=new Promise((function(e,t){u.logoImage=new E.Image,u.logoImage.onload=function(){u.initLogo(),e()},u.logoImage.onerror=function(){t()},u.logoImage.src=u.settings.base64src}));return Promise.all([h,c])}return this.settings.totalTime=0,Promise.resolve([])},e.preInit=function(){this.clearColors=[new Dl(0,0,0,255)];var e=this.device,t=this.swapchain;this.renderArea=new bl(0,0,t.width,t.height),this.cmdBuff=e.commandBuffer;var i=new Float32Array([.5,.5,1,0,-.5,.5,0,0,.5,-.5,1,1,-.5,-.5,0,1]),n=4*Float32Array.BYTES_PER_ELEMENT,r=4*n;this.vertexBuffers=e.createBuffer(new Gl(Gc.VERTEX|Gc.TRANSFER_DST,zc.DEVICE,r,n)),this.vertexBuffers.update(i);var s=new Uint16Array([0,1,2,1,3,2]),a=Uint16Array.BYTES_PER_ELEMENT,o=6*a;this.indicesBuffers=e.createBuffer(new Gl(Gc.INDEX|Gc.TRANSFER_DST,zc.DEVICE,o,a)),this.indicesBuffers.update(s);var u=[new i_("a_position",Fc.RG32F),new i_("a_texCoord",Fc.RG32F)],h=new r_(u,[this.vertexBuffers],this.indicesBuffers);this.quadAssmebler=e.createInputAssembler(h),this.projection=new En,En.ortho(this.projection,-1,1,-1,1,-1,1,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY,t.surfaceTransform),this.isMobile=Ec.isMobile},e.initLayout=function(){this.isMobile?(this.bgWidth=812,this.bgHeight=375,this.logoWidthTemp=70,this.logoHeightTemp=100,this.logoXTrans=.5,this.logoYTrans=2/3,this.textSize=12,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=16):(this.bgWidth=1920,this.bgHeight=1080,this.logoWidthTemp=140,this.logoHeightTemp=200,this.logoXTrans=.5,this.logoYTrans=1/6+2.5/6,this.textSize=24,this.textHeight=this.textSize+this.textExpandSize,this.textXTrans=.5,this.textYExtraTrans=32),this.initScale()},e.initScale=function(){var e=this.swapchain.width,t=this.swapchain.height,i=this.isMobile?375:1080,n=this.isMobile?812:1920;if(e>t){var r=n;n=i,i=r}this.scaleSize=e/t>16/9?t/n:e/i},e.update=function(e){var t=this.settings,i=this.device,n=this.swapchain;En.ortho(this.projection,-1,1,-1,1,-1,1,i.capabilities.clipSpaceMinZ,i.capabilities.clipSpaceSignY,n.surfaceTransform);var r=n.width,s=n.height;this.initScale(),this._curTime+=1e3*e;var a=$a(wi(this._curTime/t.totalTime)),o=1,u=1;r<s?(o=s*this.bgRatio,u=s):(o=r,u=r*this.bgRatio),this.bgMat.setProperty("resolution",kx.set(r,s),0),this.bgMat.setProperty("scale",kx.set(o,u),0),this.bgMat.setProperty("translate",kx.set(.5*r,.5*s),0),this.bgMat.setProperty("percent",1),this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update(),o=1,u=1,o=this.logoWidth*this.scaleSize*t.displayRatio,u=this.logoHeight*this.scaleSize*t.displayRatio;var h=s*this.logoYTrans;if(this.logoMat.setProperty("resolution",kx.set(r,s),0),this.logoMat.setProperty("scale",kx.set(o,u),0),this.logoMat.setProperty("translate",kx.set(r*this.logoXTrans,h),0),this.logoMat.setProperty("percent",a),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),this.watermarkMat){var c=this.watermarkTexture.width,l=this.watermarkTexture.height;o=c,u=l;var _=h-(.5*this.logoHeight*t.displayRatio+this.textYExtraTrans)*this.scaleSize-.5*l;this.watermarkMat.setProperty("resolution",kx.set(r,s),0),this.watermarkMat.setProperty("scale",kx.set(o,u),0),this.watermarkMat.setProperty("translate",kx.set(r*this.textXTrans,_),0),this.watermarkMat.setProperty("percent",a),this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update()}this.frame()},e.initBG=function(){var e=this.device;this.bgMat=new nT,this.bgMat.initialize({effectName:"util/splash-screen"});var t=new Xl;t.addressU=Qc.CLAMP,t.addressV=Qc.CLAMP,t.addressW=Qc.CLAMP,this.sampler=e.getSampler(t),this.bgTexture=e.createTexture(new Wl(Vc.TEX2D,Wc.SAMPLED|Wc.TRANSFER_DST,Fc.RGBA8,this.bgImage.width,this.bgImage.height));var i=this.bgMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.bgTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new Ll;s.texExtent.width=this.bgImage.width,s.texExtent.height=this.bgImage.height,s.texExtent.depth=1,e.copyTexImagesToTexture([this.bgImage],this.bgTexture,[s])},e.initLogo=function(){var e=this.device;this.logoMat=new nT,this.logoMat.initialize({effectName:"util/splash-screen"});var t=new Xl;t.addressU=Qc.CLAMP,t.addressV=Qc.CLAMP,t.addressW=Qc.CLAMP,this.sampler=e.getSampler(t),this.logoTexture=e.createTexture(new Wl(Vc.TEX2D,Wc.SAMPLED|Wc.TRANSFER_DST,Fc.RGBA8,this.logoImage.width,this.logoImage.height));var i=this.logoMat.passes[0],n=i.getBinding("mainTexture");i.bindTexture(n,this.logoTexture),this.shader=i.getShaderVariant();var r=i.descriptorSet;r.bindSampler(n,this.sampler),r.update();var s=new Ll;s.texExtent.width=this.logoImage.width,s.texExtent.height=this.logoImage.height,s.texExtent.depth=1,e.copyTexImagesToTexture([this.logoImage],this.logoTexture,[s]);var a=this.logoImage.width/this.logoImage.height;a<1?(this.logoWidth=this.logoWidthTemp,this.logoHeight=this.logoWidthTemp/a):(this.logoWidth=this.logoHeightTemp*a,this.logoHeight=this.logoHeightTemp)},e.initWaterMark=function(){var e=E.document.createElement("canvas");e.height=this.textHeight*this.scaleSize,e.style.width=""+e.width,e.style.height=""+e.height;var t="Created with Cocos",i=e.getContext("2d");i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070";var n=i.measureText(t).width+10;e.width=n,i.font=this.textSize*this.scaleSize+"px Arial",i.textBaseline="top",i.textAlign="center",i.fillStyle="#707070",i.fillText(t,e.width/2,0);var r=new Ll;r.texExtent.width=e.width,r.texExtent.height=e.height,r.texExtent.depth=1,this.watermarkTexture=this.device.createTexture(new Wl(Vc.TEX2D,Wc.SAMPLED|Wc.TRANSFER_DST,Fc.RGBA8,e.width,e.height)),this.device.copyTexImagesToTexture([e],this.watermarkTexture,[r]),this.watermarkMat=new nT,this.watermarkMat.initialize({effectName:"util/splash-screen"});var s=this.watermarkMat.passes[0],a=s.getBinding("mainTexture");s.bindTexture(a,this.watermarkTexture),s.descriptorSet.update()},e.frame=function(){var e=this.device,t=this.swapchain;if(!Ec.isXR||xr.entry.isRenderAllowable())for(var i=Ec.isXR?2:1,n=0;n<i;n++){if(Ec.isXR&&(xr.entry.renderLoopStart(n),4!==xr.entry.getXRIntConfig(13))){var r=xr.entry.getEyeFov(n),s=Math.tan(r[0]),a=Math.tan(r[1]),o=Math.tan(r[2]),u=Math.tan(r[3]);En.ortho(this.projection,s,a,o,u,-1,1,e.capabilities.clipSpaceMinZ,e.capabilities.clipSpaceSignY,t.surfaceTransform),this.bgMat.setProperty("u_projection",this.projection),this.bgMat.passes[0].update(),this.logoMat.setProperty("u_projection",this.projection),this.logoMat.passes[0].update(),this.watermarkMat&&(this.watermarkMat.setProperty("u_projection",this.projection),this.watermarkMat.passes[0].update())}e.acquire([t]);var h=this.cmdBuff,c=v.director.root.mainWindow.framebuffer,l=this.renderArea;l.width=t.width,l.height=t.height,h.begin(),h.beginRenderPass(c.renderPass,c,l,this.clearColors,1,0);var _=this.bgMat.passes[0],d=kE.getOrCreatePipelineState(e,_,this.shader,c.renderPass,this.quadAssmebler);h.bindPipelineState(d),h.bindDescriptorSet(sg.MATERIAL,_.descriptorSet),h.bindInputAssembler(this.quadAssmebler),h.draw(this.quadAssmebler);var f=this.logoMat.passes[0],p=kE.getOrCreatePipelineState(e,f,this.shader,c.renderPass,this.quadAssmebler);if(h.bindPipelineState(p),h.bindDescriptorSet(sg.MATERIAL,f.descriptorSet),h.bindInputAssembler(this.quadAssmebler),h.draw(this.quadAssmebler),this.watermarkMat){var m=this.watermarkMat.passes[0],g=kE.getOrCreatePipelineState(e,m,this.shader,c.renderPass,this.quadAssmebler);h.bindPipelineState(g),h.bindDescriptorSet(sg.MATERIAL,m.descriptorSet),h.bindInputAssembler(this.quadAssmebler),h.draw(this.quadAssmebler)}h.endRenderPass(),h.end(),e.flushCommands([h]),e.queue.submit([h]),e.present(),Ec.isXR&&xr.entry.renderLoopEnd(n)}},e.destroy=function(){this.device=null,this.swapchain=null,this.clearColors=null,this.bgImage.destroy&&this.bgImage.destroy(),this.bgImage=null,this.bgMat.destroy(),this.bgMat=null,this.bgTexture.destroy(),this.bgTexture=null,this.logoImage.destroy&&this.logoImage.destroy(),this.logoImage=null,this.renderArea=null,this.cmdBuff=null,this.shader=null,this.logoMat.destroy(),this.logoMat=null,this.logoTexture.destroy(),this.logoTexture=null,this.quadAssmebler.destroy(),this.quadAssmebler=null,this.vertexBuffers.destroy(),this.vertexBuffers=null,this.indicesBuffers.destroy(),this.indicesBuffers=null,this.sampler=null,this.watermarkTexture&&(this.watermarkMat.destroy(),this.watermarkMat=null,this.watermarkTexture.destroy(),this.watermarkTexture=null),this.settings=null},n(t,[{key:"isFinished",get:function(){return this._curTime>=this.settings.totalTime}},{key:"curTime",get:function(){return this._curTime},set:function(e){this._curTime=e}}],[{key:"instance",get:function(){return t._ins||(t._ins=new t),t._ins}}]),t}();Hx._ins=void 0,v.internal.SplashScreen=Hx;var zx=new(function(){function e(){this._data=null}return e.prototype.init=function(e){var t=this;return void 0===e&&(e=""),v.rendering&&v.rendering.enableEffectImport&&e?new Promise((function(i,n){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="arraybuffer",r.onload=function(){t._data=r.response,i()},r.onerror=function(){n(new Error("request effect settings failed!"))},r.send(null)})):Promise.resolve()},n(e,[{key:"data",get:function(){return this._data}}]),e}());v.effectSettings=zx;var Vx=e("e9",function(e){function i(){for(var t,i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];return(t=e.call.apply(e,[this].concat(n))||this).frame=null,t.container=null,t.canvas=null,t.renderType=-1,t.eventTargetOn=e.prototype.on,t.eventTargetOnce=e.prototype.once,t.config={},t.onStart=null,t.frameTime=1e3/60,t._isCloning=!1,t._inited=!1,t._engineInited=!1,t._rendererInitialized=!1,t._paused=!0,t._pausedByEngine=!1,t._frameRate=60,t._pacer=null,t._initTime=0,t._startTime=0,t._deltaTime=0,t._shouldLoadLaunchScene=!0,t.onPreBaseInitDelegate=new Kh,t.onPostBaseInitDelegate=new Kh,t.onPreInfrastructureInitDelegate=new Kh,t.onPostInfrastructureInitDelegate=new Kh,t.onPreSubsystemInitDelegate=new Kh,t.onPostSubsystemInitDelegate=new Kh,t.onPreProjectInitDelegate=new Kh,t.onPostProjectInitDelegate=new Kh,t}s(i,e);var r=i.prototype;return r.setFrameRate=function(e){this.frameRate=e},r.getFrameRate=function(){return this.frameRate},r.step=function(){Ux.tick(this.frameTime/1e3)},r.pauseByEngine=function(){this._paused||(this._pausedByEngine=!0,this.pause())},r.resumeByEngine=function(){this._pausedByEngine&&(this.resume(),this._pausedByEngine=!1)},r.pause=function(){var e;this._paused||(this._paused=!0,null===(e=this._pacer)||void 0===e||e.stop(),this.emit(i.EVENT_PAUSE))},r.resume=function(){var e;this._paused&&(vI._clearEvents(),this._paused=!1,null===(e=this._pacer)||void 0===e||e.start(),this.emit(i.EVENT_RESUME))},r.isPaused=function(){return this._paused},r.restart=function(){var e=this;return new Promise((function(e){Ux.once(Bx.EVENT_END_FRAME,(function(){return e()}))})).then((function(){Ux.reset(),v.Object._deferredDestroy(),e.pause(),e.resume(),e._shouldLoadLaunchScene=!0,Hx.instance.curTime=0,e._safeEmit(i.EVENT_RESTART)}))},r.end=function(){qh.close()},r.on=function(e,t,n,r){return(this._engineInited&&e===i.EVENT_ENGINE_INITED||this._inited&&e===i.EVENT_GAME_INITED||this._rendererInitialized&&e===i.EVENT_RENDERER_INITED)&&t.call(n),this.eventTargetOn(e,t,n,r)},r.once=function(e,t,n){return this._engineInited&&e===i.EVENT_ENGINE_INITED?t.call(n):this.eventTargetOnce(e,t,n)},r.init=function(e){var n=this;return this._compatibleWithOldParams(e),Promise.resolve().then((function(){return n.emit(i.EVENT_PRE_BASE_INIT),n.onPreBaseInitDelegate.dispatch()})).then((function(){V(e.debugMode||J.NONE)})).then((function(){return Ec.init()})).then((function(){n._initEvents()})).then((function(){return St.init(e.settingsPath,e.overrideSettings)})).then((function(){return n.emit(i.EVENT_POST_BASE_INIT),n.onPostBaseInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_INFRASTRUCTURE_INIT),n.onPreInfrastructureInitDelegate.dispatch()})).then((function(){Rt.init(),n._initXR();var e={frame:document.querySelector("#GameDiv"),container:document.querySelector("#Cocos3dGameContainer"),canvas:document.querySelector("#GameCanvas")};e&&(n.canvas=e.canvas,n.frame=e.frame,n.container=e.container),yc.init(),bc.init(),gd.init(n.canvas,hg),""===Rt.CUSTOM_PIPELINE_NAME&&(v.rendering=void 0),bE.init(),PE.init(),Yp.init(),n.initPacer()})).then((function(){return n.emit(i.EVENT_POST_INFRASTRUCTURE_INIT),n.onPostInfrastructureInitDelegate.dispatch()})).then((function(){return n.emit(i.EVENT_PRE_SUBSYSTEM_INIT),n.onPreSubsystemInitDelegate.dispatch()})).then((function(){return zx.init(St.querySettings(At.Category.RENDERING,"effectSettingsPath"))})).then((function(){if(v.rendering&&v.rendering.enableEffectImport)if(St.querySettings(At.Category.RENDERING,"renderMode")!==ld.HEADLESS){var e=zx.data;null!==e?v.rendering.init(gd.gfxDevice,e):console.error("Effect settings not found, effects will not be imported.")}else v.rendering.init(gd.gfxDevice,null)})).then((function(){return Ux.init(),PE.loadBuiltinAssets()})).then((function(){return n.emit(i.EVENT_POST_SUBSYSTEM_INIT),n.onPostSubsystemInitDelegate.dispatch()})).then((function(){console.log("Cocos Creator v"+y),n.emit(i.EVENT_ENGINE_INITED),n._engineInited=!0})).then((function(){return n.emit(i.EVENT_PRE_PROJECT_INIT),n.onPreProjectInitDelegate.dispatch()})).then((function(){var e=St.querySettings(At.Category.PLUGINS,"jsList"),t=Promise.resolve();return e&&(St.querySettings(At.Category.PATH,"projectPath"),e.forEach((function(e){t=t.then((function(){return t="src/"+e,new Promise((function(e,i){var n;function r(e){e.filename===t&&(n=e.error)}window.addEventListener("error",r);var s=document.createElement("script");s.charset="utf-8",s.async=!0,s.crossOrigin="anonymous",s.addEventListener("error",(function(){window.removeEventListener("error",r),i(Error("Error loading "+t))})),s.addEventListener("load",(function(){window.removeEventListener("error",r),document.head.removeChild(s),n?i(n):e()})),s.src=t.replace("#","%23"),document.head.appendChild(s)}));var t}))}))),t})).then((function(){var e=St.querySettings(At.Category.SCRIPTING,"scriptPackages");return e?Promise.all(e.map((function(e){return t.import(e)}))):Promise.resolve([])})).then((function(){return n._loadProjectBundles()})).then((function(){return n._loadCCEScripts()})).then((function(){return n._setupRenderPipeline()})).then((function(){return n._loadPreloadAssets()})).then((function(){return PE.compileBuiltinMaterial(),Hx.instance.init()})).then((function(){return n.emit(i.EVENT_POST_PROJECT_INIT),n.onPostProjectInitDelegate.dispatch()})).then((function(){n._inited=!0,n._safeEmit(i.EVENT_GAME_INITED)}))},r._initXR=function(){var e;if(void 0===globalThis.__globalXR&&(globalThis.__globalXR={}),globalThis.__globalXR.webxrCompatible=null!==(e=St.querySettings(At.Category.XR,"webxrCompatible"))&&void 0!==e&&e,Ec.isXR){var t,i;xr.entry=xr.XrEntry.getInstance();var n=null!==(t=St.querySettings(At.Category.RENDERING,"msaa"))&&void 0!==t?t:1,r=null!==(i=St.querySettings(At.Category.RENDERING,"renderingScale"))&&void 0!==i?i:1;xr.entry.setMultisamplesRTT(n),xr.entry.setRenderingScale(r)}},r._compatibleWithOldParams=function(e){var t=e.overrideSettings=e.overrideSettings||{};"showFPS"in e&&(t.profiling=t.profiling||{},t.profiling.showFPS=e.showFPS),"frameRate"in e&&(t.screen=t.screen||{},t.screen.frameRate=e.frameRate),"renderMode"in e&&(t.rendering=t.rendering||{},t.rendering.renderMode=e.renderMode),"renderPipeline"in e&&(t.rendering=t.rendering||{},t.rendering.renderPipeline=e.renderPipeline),"assetOptions"in e&&(t.assets=t.assets||{},Object.assign(t.assets,e.assetOptions)),"customJointTextureLayouts"in e&&(t.animation=t.animation||{},t.animation.customJointTextureLayouts=e.customJointTextureLayouts),"physics"in e&&(t.physics=t.physics||{},Object.assign(t.physics,e.physics)),"orientation"in e&&(t.screen=t.screen||{},t.screen.orientation=e.orientation),"exactFitScreen"in e&&(t.screen=t.screen||{},t.screen.exactFitScreen=e.exactFitScreen)},r._loadPreloadAssets=function(){var e=St.querySettings(At.Category.ASSETS,"preloadAssets");return e?Promise.all(e.map((function(e){return new Promise((function(t,i){bE.loadAny(e,(function(e){e?i(e):t()}))}))}))):Promise.resolve([])},r._loadCCEScripts=function(){return new Promise((function(e){e()}))},r._loadProjectBundles=function(){var e=St.querySettings(At.Category.ASSETS,"preloadBundles");return e?Promise.all(e.map((function(e){var t=e.bundle,i=e.version;return new Promise((function(e,n){var r={};i&&(r.version=i),bE.loadBundle(t,r,(function(t){t?n(t):e()}))}))}))):Promise.resolve([])},r.run=function(e){e&&(this.onStart=e),this._inited&&!m&&this.resume()},r._calculateDT=function(){var e=performance.now();return this._deltaTime=e>this._startTime?(e-this._startTime)/1e3:0,this._deltaTime>i.DEBUG_DT_THRESHOLD&&(this._deltaTime=this.frameTime/1e3),this._startTime=e,this._deltaTime},r._updateCallback=function(){var e=this;if(this._inited)if(Hx.instance.isFinished)if(this._shouldLoadLaunchScene){this._shouldLoadLaunchScene=!1;var t,i=St.querySettings(At.Category.LAUNCH,"launchScene");i?Ux.loadScene(i,(function(){var t;console.log("Success to load scene: "+i),e._initTime=performance.now(),Ux.startAnimation(),null===(t=e.onStart)||void 0===t||t.call(e)})):(this._initTime=performance.now(),Ux.startAnimation(),null===(t=this.onStart)||void 0===t||t.call(this))}else Ux.tick(this._calculateDT());else Hx.instance.update(this._calculateDT())},r.initPacer=function(){var e,t=null!==(e=St.querySettings(At.Category.SCREEN,"frameRate"))&&void 0!==e?e:60;H("number"==typeof t),this._pacer=new Gx,this._pacer.onTick=this._updateCallback.bind(this),this.frameRate=t},r._initEvents=function(){qh.on("show",this._onShow,this),qh.on("hide",this._onHide,this)},r._onHide=function(){this.emit(i.EVENT_HIDE),this.pauseByEngine()},r._onShow=function(){this.emit(i.EVENT_SHOW),this.resumeByEngine()},r.addPersistRootNode=function(e){Ux.addPersistRootNode(e)},r.removePersistRootNode=function(e){Ux.removePersistRootNode(e)},r.isPersistRootNode=function(e){return Ux.isPersistRootNode(e)},r._setupRenderPipeline=function(){var e=this,t=St.querySettings(At.Category.RENDERING,"renderPipeline");return t?new Promise((function(e,i){bE.loadAny(t,(function(t,n){return!t&&n instanceof yC?e(n):i(t)}))})).then((function(t){e._setRenderPipeline(t)})).catch((function(i){G(i),G("Failed load render pipeline: "+t+", engine failed to initialize, will fallback to default pipeline"),e._setRenderPipeline()})):this._setRenderPipeline()},r._setRenderPipeline=function(e){Ux.root.setRenderPipeline(e)||this._setRenderPipeline(),this._rendererInitialized=!0,this._safeEmit(i.EVENT_RENDERER_INITED)},r._safeEmit=function(e){this.emit(e)},n(i,[{key:"inited",get:function(){return this._inited}},{key:"frameRate",get:function(){return this._frameRate},set:function(e){"number"!=typeof e&&(e=parseInt(e,10),Number.isNaN(e)&&(e=60)),this._frameRate=e,this.frameTime=1e3/e,this._pacer&&(this._pacer.targetFrameRate=this._frameRate)}},{key:"deltaTime",get:function(){return this._deltaTime}},{key:"totalTime",get:function(){return performance.now()-this._initTime}},{key:"frameStartTime",get:function(){return this._startTime}}]),i}(kh));Vx.EVENT_HIDE="game_on_hide",Vx.EVENT_SHOW="game_on_show",Vx.EVENT_LOW_MEMORY="game_on_low_memory",Vx.EVENT_GAME_INITED="game_inited",Vx.EVENT_ENGINE_INITED="engine_inited",Vx.EVENT_RENDERER_INITED="renderer_inited",Vx.EVENT_PRE_BASE_INIT="pre_base_init",Vx.EVENT_POST_BASE_INIT="post_base_init",Vx.EVENT_PRE_INFRASTRUCTURE_INIT="pre_infrastructure_init",Vx.EVENT_POST_INFRASTRUCTURE_INIT="post_infrastructure_init",Vx.EVENT_PRE_SUBSYSTEM_INIT="pre_subsystem_init",Vx.EVENT_POST_SUBSYSTEM_INIT="post_subsystem_init",Vx.EVENT_PRE_PROJECT_INIT="pre_project_init",Vx.EVENT_POST_PROJECT_INIT="post_project_init",Vx.EVENT_RESTART="game_on_restart",Vx.EVENT_PAUSE="game_on_pause",Vx.EVENT_RESUME="game_on_resume",Vx.RENDER_TYPE_CANVAS=0,Vx.RENDER_TYPE_WEBGL=1,Vx.RENDER_TYPE_OPENGL=2,Vx.RENDER_TYPE_HEADLESS=3,Vx.DEBUG_DT_THRESHOLD=1,v.Game=Vx;var Wx=e("e8",v.game=new Vx);ae(Bx.prototype,"director",[{name:"calculateDeltaTime"},{name:"getDeltaTime",suggest:"Use game.deltaTime instead"},{name:"getTotalTime",suggest:"Use game.totalTime instead"},{name:"getCurrentTime",suggest:"Use game.frameStartTime instead"}]),se(Bx.prototype,"director",[{name:"setAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getAnimationInterval",suggest:"please use game.frameRate instead"},{name:"getRunningScene",suggest:"please use getScene instead"},{name:"setDepthTest",suggest:"please use camera API instead"},{name:"setClearColor",suggest:"please use camera API instead"},{name:"getWinSize",suggest:"please use view.getVisibleSize instead"},{name:"getWinSizeInPixels"},{name:"purgeCachedData",suggest:"please use assetManager.releaseAll instead"},{name:"convertToGL"},{name:"convertToUI"}]),re(Ux,"director",[{name:"_getSceneUuid",targetName:"assetManager.main",newName:"getSceneInfo",customFunction:function(e){var t;return bE.main?null===(t=bE.main.getSceneInfo(e))||void 0===t?void 0:t.uuid:""}}]),ae(Wx,"game",[{name:"collisionMatrix"},{name:"groupList"}]),re(Wx,"game",[{name:"_sceneInfos",targetName:"assetManager.main",newName:"getSceneInfo",customGetter:function(){var e=[];return bE.main&&bE.main.config.scenes.forEach((function(t){e.push(t)})),e}}]);var jx,Xx,Kx={syncPhysicsToGraphics:function(e){var t=globalThis.Bullet;t.CACHE.getWrapper(e,t.BODY_CACHE_NAME).syncPhysicsToGraphics()}};globalThis.BULLET&&console.log("[Physics][Bullet]: Using the external Bullet libs."),function(e){e[e.EBulletTypeVec3=0]="EBulletTypeVec3",e[e.EBulletTypeQuat=1]="EBulletTypeQuat",e[e.EBulletTypeTransform=2]="EBulletTypeTransform",e[e.EBulletTypeMotionState=3]="EBulletTypeMotionState",e[e.EBulletTypeCollisionObject=4]="EBulletTypeCollisionObject",e[e.EBulletTypeCollisionShape=5]="EBulletTypeCollisionShape",e[e.EBulletTypeStridingMeshInterface=6]="EBulletTypeStridingMeshInterface",e[e.EBulletTypeTriangleMesh=7]="EBulletTypeTriangleMesh",e[e.EBulletTypeCollisionDispatcher=8]="EBulletTypeCollisionDispatcher",e[e.EBulletTypeDbvtBroadPhase=9]="EBulletTypeDbvtBroadPhase",e[e.EBulletTypeSequentialImpulseConstraintSolver=10]="EBulletTypeSequentialImpulseConstraintSolver",e[e.EBulletTypeCollisionWorld=11]="EBulletTypeCollisionWorld",e[e.EBulletTypeTypedConstraint=12]="EBulletTypeTypedConstraint"}(jx||(jx=e("ft",{}))),function(e){e[e.NONE=0]="NONE",e[e.FilterBackfaces=1]="FilterBackfaces",e[e.KeepUnflippedNormal=2]="KeepUnflippedNormal",e[e.UseSubSimplexConvexCastRaytest=4]="UseSubSimplexConvexCastRaytest",e[e.UseGjkConvexCastRaytest=8]="UseGjkConvexCastRaytest"}(Xx||(Xx=e("fu",{})));var Yx=e("fo",{});function qx(){var e=function(){if((Ec.os===Ec.OS.IOS||Ec.os===Ec.OS.OSX)&&Ec.isBrowser&&/(OS 15_4)|(Version\/15.4)/.test(window.navigator.userAgent))return!1;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0]));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){return!1}return!1}();return Promise.resolve().then((function(){return async function(e){let i;return i=e?await t.import("./bullet.wasm-7211041d.js"):await t.import("./bullet.cocos-430d79e0.js"),i.default}(e)})).then((function(e){if("string"==typeof e){console.info("[Physics][Bullet]: Using wasm Bullet libs.");var t=function(e){console.info(e)},i=function(e){console.error(e)},n=new WebAssembly.Memory({initial:250}),r={cc:Kx,wasi_snapshot_preview1:{fd_close:t,fd_seek:t,fd_write:t},env:{memory:n}};return new Promise((function(t){fetch(e).then((function(e){e.arrayBuffer().then((function(e){!function(e){WebAssembly.instantiate(e,r).then((function(e){var i=e.instance.exports;Object.assign(Yx,i),t()}),i)}(e)}),i)}),i)}))}console.info("[Physics][Bullet]: Using asmjs Bullet libs.");var s=Kx,a={};a.buffer=new ArrayBuffer(16384e3),s.memory=a;var o=e(s,a);return Object.assign(Yx,o),new Promise((function(e){e()}))}))}globalThis.Bullet=Yx,Yx.BODY_CACHE_NAME="body",Wx.onPostInfrastructureInitDelegate.add(qx)}}}));
|